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

// @codingStandardsIgnoreFile

?>
<?php $_order = $block->getOrder() ?>
<?php $_invoice = $block->getInvoice() ?>
<?php if ($_invoice): ?>
<?php $_invoices = [$_invoice]; ?>
<?php else: ?>
<?php $_invoices = $_order->getInvoiceCollection() ?>
<?php endif; ?>
<?php foreach ($_invoices as $_invoice): ?>
<div class="order-details-items invoice">
    <div class="order-title">
        <strong><?= /* @escapeNotVerified */ __('Invoice #') ?><?= /* @escapeNotVerified */ $_invoice->getIncrementId() ?></strong>
    </div>
    <div class="table-wrapper table-order-items invoice">
        <table class="data table table-order-items invoice" id="my-invoice-table-<?= /* @escapeNotVerified */ $_invoice->getId() ?>">
            <caption class="table-caption"><?= /* @escapeNotVerified */ __('Items Invoiced') ?></caption>
            <thead>
            <tr>
                <th class="col name"><?= /* @escapeNotVerified */ __('Product Name') ?></th>
                <th class="col sku"><?= /* @escapeNotVerified */ __('SKU') ?></th>
                <th class="col price"><?= /* @escapeNotVerified */ __('Price') ?></th>
                <th class="col qty"><?= /* @escapeNotVerified */ __('Qty Invoiced') ?></th>
                <th class="col subtotal"><?= /* @escapeNotVerified */ __('Subtotal') ?></th>
            </tr>
            </thead>
            <?php $_items = $_invoice->getItemsCollection(); ?>
            <?php $_count = $_items->count(); ?>
            <?php foreach ($_items as $_item): ?>
            <?php if ($_item->getOrderItem()->getParentItem()) {
    continue;
} ?>
            <tbody>
                <?= $block->getItemHtml($_item) ?>
            </tbody>
            <?php endforeach; ?>
            <tfoot>
                <?= $block->getInvoiceTotalsHtml($_invoice) ?>
            </tfoot>
        </table>
    </div>
    <div class="block block-order-details-view">
        <div class="block-title">
            <strong><?= /* @escapeNotVerified */ __('Order Information') ?></strong>
        </div>
        <div class="block-content">
        <?php if (!$_order->getIsVirtual()): ?>
            <div class="box box-order-shipping-address">
                <div class="box-title">
                    <strong><?= /* @escapeNotVerified */ __('Shipping Address') ?></strong>
                </div>
                <div class="box-content">
                    <?php $_shipping = $_invoice->getShippingAddress() ?>
                    <address><?= /* @escapeNotVerified */ $block->formatAddress($_shipping, 'html') ?></address>
                </div>
            </div>

            <div class="box box-order-shipping-method">
                <div class="box-title">
                    <strong><?= /* @escapeNotVerified */ __('Shipping Method') ?></strong>
                </div>
                <div class="box-content">
                    <?php if ($_order->getShippingDescription()): ?>
                        <?= $block->escapeHtml($_order->getShippingDescription()) ?>
                    <?php else: ?>
                        <?= /* @escapeNotVerified */ __('No shipping information available') ?>
                    <?php endif; ?>
                </div>
            </div>
        <?php endif; ?>
            <div class="box box-order-billing-address">
                <div class="box-title">
                    <strong><?= /* @escapeNotVerified */ __('Billing Address') ?></strong>
                </div>
                <div class="box-content">
                    <?php $_billing = $_invoice->getbillingAddress() ?>
                    <address><?= /* @escapeNotVerified */ $block->formatAddress($_order->getBillingAddress(), 'html') ?></address>
                </div>
            </div>

            <div class="box box-order-billing-method">
                <div class="box-title">
                    <strong><?= /* @escapeNotVerified */ __('Payment Method') ?></strong>
                </div>
                <div class="box-content">
                    <?= $block->getPaymentInfoHtml() ?>
                </div>
            </div>
        </div>
    </div>
</div>
<?php endforeach; ?>
