<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

?>
<?php $_order = $block->getOrder() ?>
<?php if ($_order): ?>
    <?php $_items = $_order->getAllItems(); ?>
    
    <table class="email-items" style="border-collapse: separate; width: 100%">
        <thead>
            <th colspan="3" style="text-align: left;border-top: 1px solid #ccc; padding-top: 20px"><h3><?= __('WHAT’S INSIDE')?></h3></th>

            <th  class="items" style="text-align: right; border-top: 1px solid #ccc; min-width: 120px;  padding-top: 20px"><h3><?= __('ITEMS')?> (<?= /* @escapeNotVerified */ $_order->getTotalItemCount() ?>) </h3></th>
        </thead>
        <?php foreach ($_items as $_item): ?>
            <?php $HDdataCol = $this->helper('BG\DesignHuddle\Helper\Databgcollect')->getBgCollection($_item->getOrderId(),$_item->getProductId());  ?>
            <?php
                if ($_item->getParentItem()) {
                    continue;
                }
            ?>
            <tbody>
                <tr><td>
                <?php 
                    foreach($HDdataCol as $HDdataCols){
                        $imageUrl = $HDdataCols->getDhFilePath();
                        echo '<p><a class="hdimge" style="text-decoration: underline;cursor: pointer;padding: 6px 0;display: inherit;color: blue;" target="__blank" href="'.$imageUrl.'" >Download Custom Image</a></p>';
                    }
                ?> 
                </td></tr>
                <?= $block->getItemHtml($_item) ?>
            </tbody>
        <?php endforeach; ?>
        <tfoot class="order-totals">
            <tr><th colspan="3"></th><td style="padding: 10px 0 !important"></td></tr>
                <?= $block->getChildHtml('wp_order_totals') ?>
            <tr><th colspan="3"></th><td style="padding: 20px 0 !important"></td></tr>
        </tfoot>
    </table>
    <?php if ($this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('order', $_order, $_order->getStore()) && $_order->getGiftMessageId()): ?>
        <?php $_giftMessage = $this->helper('Magento\GiftMessage\Helper\Message')->getGiftMessage($_order->getGiftMessageId()); ?>
        <?php if ($_giftMessage): ?>
            <br />
            <table class="message-gift">
                <tr>
                    <td>
                        <h3><?= /* @escapeNotVerified */  __('Gift Message for this Order') ?></h3>
                        <strong><?= /* @escapeNotVerified */  __('From:') ?></strong> <?= $block->escapeHtml($_giftMessage->getSender()) ?>
                        <br /><strong><?= /* @escapeNotVerified */  __('To:') ?></strong> <?= $block->escapeHtml($_giftMessage->getRecipient()) ?>
                        <br /><strong><?= /* @escapeNotVerified */  __('Message:') ?></strong>
                        <br /><?= $block->escapeHtml($_giftMessage->getMessage()) ?>
                    </td>
                </tr>
            </table>
        <?php endif; ?>
    <?php endif; ?>
<?php endif; ?>
