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

// @codingStandardsIgnoreFile

$taxAmount = $block->getTotal()->getValue();
?>
<?php if (($taxAmount == 0 && $this->helper('Magento\Tax\Helper\Data')->displayZeroTax()) || ($taxAmount > 0)): ?>
<?php global $taxIter; $taxIter++; ?>
<?php $class = "{$block->getTotal()->getCode()} " . ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary() ? 'summary-total' : ''); ?>
<tr<?php if ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary()): ?>
    onclick="expandDetails(this, '.summary-details-<?= /* @escapeNotVerified */ $taxIter ?>')"
<?php endif; ?>
    class="<?= /* @escapeNotVerified */ $class ?> row-totals">
    <td style="<?= /* @escapeNotVerified */ $block->getTotal()->getStyle() ?>" class="admin__total-mark" colspan="<?= /* @escapeNotVerified */ $block->getColspan() ?>">
        <?php if ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary()): ?>
            <div class="summary-collapse"><?= /* @escapeNotVerified */ $block->getTotal()->getTitle() ?></div>
        <?php else: ?>
            <?= /* @escapeNotVerified */ $block->getTotal()->getTitle() ?>
        <?php endif;?>
    </td>
    <td style="<?= /* @escapeNotVerified */ $block->getTotal()->getStyle() ?>" class="admin__total-amount"><?= /* @escapeNotVerified */ $block->formatPrice($block->getTotal()->getValue()) ?></td>
</tr>
<?php if ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary()): ?>
        <?php $isTop = 1; ?>
        <?php foreach ($block->getTotal()->getFullInfo() as $info): ?>
                <?php if (isset($info['hidden']) && $info['hidden']) {
                    continue;
                } ?>
                <?php $percent = $info['percent']; ?>
                <?php $amount = $info['amount']; ?>
                <?php $rates = $info['rates']; ?>
                <?php $isFirst = 1; ?>

                <?php foreach ($rates as $rate): ?>
                <tr class="summary-details-<?= /* @escapeNotVerified */ $taxIter ?> summary-details<?php if ($isTop): echo ' summary-details-first'; endif; ?>" style="display:none;">
                    <td class="admin__total-mark" style="<?= /* @escapeNotVerified */ $block->getTotal()->getStyle() ?>" colspan="<?= /* @escapeNotVerified */ $block->getColspan() ?>">
                        <?= $block->escapeHtml($rate['title']) ?>
                        <?php if (!is_null($rate['percent'])): ?>
                            (<?= (float)$rate['percent'] ?>%)
                        <?php endif; ?>
                        <br />
                    </td>
                    <?php if ($isFirst): ?>
                        <td style="<?= /* @escapeNotVerified */ $block->getTotal()->getStyle() ?>" class="admin__total-amount" rowspan="<?= count($rates) ?>">
                            <?= /* @escapeNotVerified */ $block->formatPrice($amount) ?>
                        </td>
                    <?php endif; ?>
                </tr>
                <?php $isFirst = 0; ?>
                <?php $isTop = 0; ?>
                <?php endforeach; ?>
        <?php endforeach; ?>
<?php endif;?>
<?php endif;?>

