<?php
/**
 * @var $auctionCommission int
 * @var $displayVatField string
 * @var $lotHelper LotHelper
 */

use auctionforge\inc\helpers\LotHelper;

?>
<script type="text/template" id="modal-post-sale-template">
    <header class="modal__header">
        <h2 class="modal__title modal__title_without-logo" id="modal-post-sale-title">
            <?= __('Confirm purchase', 'auctionforge') ?>:
        </h2>
    </header>
    <main class="modal__content bp-mb-30">
        <p class="modal__content__item bp-d-flex"><strong><?= __('Lot number', 'auctionforge') ?>:</strong>&nbsp;<span><%- index %></span></p>
        <p class="modal__content__item bp-d-flex"><strong><?= __('Lot name', 'auctionforge') ?>:</strong>&nbsp;
            <span><%= name %></span></p>
        <% if (buyoutAction) { %>
            <p class="modal__content__item bp-d-flex">
                <strong><?= __('Buyout price', 'auctionforge') ?>:</strong>&nbsp;
                <span class="bp-text-red"><%- formattedPrice(price, currentCurrency) %></span>
            </p>
        <% } else { %>
            <p class="modal__content__item bp-d-flex">
                <strong><?= __('Price', 'auctionforge') ?>:</strong>&nbsp;
                <span class="bp-text-red"><%- formattedPrice(price, currentCurrency) %></span>
            </p>
        <% } %>
        <% if (auctionCommission !== undefined) { %>
            <p class="modal__content__item bp-d-flex">
                <strong><?= __("Buyer's Premium", 'auctionforge') ?>:</strong>
                <span><%- auctionCommission %>%</span>
            </p>
        <% } %>
        <?php if ($displayVatField == 'on') { ?>
            <% if (auctionHouseData.houseCommissionVatRule === 'SHOULD_ADD_VAT') { %>
            <p class="vat-field modal__content__item bp-d-flex">
                <strong><?= __('VAT', 'auctionforge') ?>:</strong>
                <% if (fullPriceVat === true) { %>
                    <span><?= __('On the full lot\'s price and commission', 'auctionforge') ?></span>
                <% } else { %>
                    <span><?= __('On commission only', 'auctionforge') ?></span>
                <% } %>
            </p>
            <% } else if (auctionHouseData.houseCommissionVatRule === 'EXEMPTED_FROM_VAT') { %>
                <% if (fullPriceVat === true) { %>
                <p class="vat-field modal__content__item bp-d-flex">
                    <strong><?= __('VAT', 'auctionforge') ?>:</strong>
                    <span><?= __('On lot\'s price, no vat on commission', 'auctionforge') ?></span>
                </p>
                <% } %>
            <% } %>
        <?php } ?>
        <?php if (0) { //Disabled ?>
        <p class="modal__content__item bp-d-flex">
            <strong><?= __('Price including commission', 'auctionforge') ?>:</strong>
            <span class="bp-text-strong"><%- formattedPrice(commissionPrice, currentCurrency) %></span>
        </p>
        <?php } ?>
        <br>
        <% if (auctionHouseData.noVatOnCommission !== true || fullPriceVat === true) { %>
        <p class="users-from-foreign-countries bp-mb-0" data-block="0.3">
            <?= __("Users from foreign countries may be exempted from tax payments, according to the relevant tax regulations", "auctionforge") ?>.
        </p>
        <% } %>
        <br>
        <p>
            <?= sprintf(__('By clicking the "I agree" button you signify your agreement to the terms and conditions of auction house %s', 'auctionforge'), get_option('blogname')) ?>
        </p>
    </main>
    <footer class="modal__footer d-flex justify-content-between bp-d-flex">
        <div class="bp-d-flex bp-f-start bp-mr-auto bp-md-f-center">
            <a target="_blank" class="bp-btn bp-btn-default bp-btn-link" href="<%- linkTerms %>"><?= __('Terms of sale', 'auctionforge') ?></a>
        </div>
        <div class="bp-d-flex bp-f-end bp-md-f-center">
            <a id="dontAgreeSaleBid" class="bp-btn bp-btn-border bp-btn-link bp-mr-10" href="#"><?= __('I don\'t Agree', 'auctionforge') ?></a>
            <a id="agreeSaleBid" class="bp-btn bp-btn-primal" href="#"><?= __('I Agree', 'auctionforge') ?></a>
        </div>
    </footer>
</script>
