<?php
/**
 * @var $auctionCommission int
 * @var $fullPriceVat int
 * @var $postAuctionSaleOpenedUntil int
 */
?>
<script type="text/template" id="leadingBid-template">
    <% if (item.leadingBid !== undefined && item.leadingBid.isSold !== undefined && item.soldBid === undefined && !(itemInfo.state === 'ENDED' || itemInfo.state === 'ARCHIVED')) { %>
        <% if (obj.leader) { %>
        <div class="bp-control__notice bp-bg-green bp-d-flex bp-f-start bp-f-wrap" data-entry="1">
            <p class="bp-title"><?= __('Your leading bid', 'auctionforge') ?>: <span class="bp-bid"><%- formattedPrice(item.leadingBid.price,
                    currencySymbol, true) %></span></p>
        <% } else if (item.selfAbsenteeBid !== undefined && !item.leadingBid.isSelf) { %>
            <div class="bp-control__notice bp-bg-red bp-d-flex bp-f-start bp-f-wrap" data-entry="2">
                <p class="bp-title"><?= __('Highest bid', 'auctionforge') ?>: <span class="bp-bid"><%- formattedPrice(item.leadingBid.price, currencySymbol, true) %></span></p>
        <% } else { %>
            <div class="bp-control__notice bp-control_footer bp-d-flex bp-f-start bp-f-wrap" data-block="2"
                 data-entry="3">
                <p class="bp-title"><?= __('Highest bid', 'auctionforge') ?>: <span class="bp-bid"><%- formattedPrice(item.leadingBid.price, currencySymbol, true) %></span></p>
        <% } %>
        <% if (obj.leader) { %>
            <p class="bp-title bp-subtitle"><?= __('You are the highest bidder', 'auctionforge') ?></p>
        <% } else if (item.selfAbsenteeBid !== undefined && !item.leadingBid.isSelf) { %>
            <p class="bp-title bp-subtitle"><?= __('Your bid of', 'auctionforge') ?> <%- formattedPrice(item.selfAbsenteeBid.price, currencySymbol, true) %> <?= __('has been outbid by a higher bid', 'auctionforge') ?></p>
        <% } %>
        </div>
    <% } else if (item.soldBid !== undefined && item.soldBid.price !== undefined) { %>
        <% if (hiddenPrice !== undefined && hiddenPrice) { %>
            <div class="bp-control__notice bp-bg-red bp-d-flex bp-f-start bp-f-wrap" data-entry="4">
                <p class="bp-title"><?= __('Not available', 'auctionforge') ?></p>
        <% } else if (settings.hideSoldPrice !== undefined && settings.hideSoldPrice == true) { %>
            <div class="bp-control__notice bp-bg-blue bp-d-flex bp-f-start bp-f-wrap" data-entry="4.0">
                <p class="bp-title"><?= __('Sold', 'auctionforge') ?></p>
        <% } else if (item.soldBid.isSelf) { %>
            <div class="bp-control__notice bp-bg-green bp-d-flex bp-f-start bp-f-wrap" data-entry="5">
            <p class="bp-title"><?= __('Sold to you for', 'auctionforge') ?>: <span class="bp-bid"><%- formattedPrice(item.soldBid.price,
                    currencySymbol, true) %></span></p>
        <% } else { %>
            <div class="bp-control__notice bp-bg-blue bp-d-flex bp-f-start bp-f-wrap" data-block="1" data-entry="6">
            <p class="bp-title"><?= __('Sold for', 'auctionforge') ?>: <span class="bp-bid"><%- formattedPrice
                    (item.soldBid.price, currencySymbol, true) %></span></p>
        <% } %>
        </div>
    <% } else if (item.selfAbsenteeBid !== undefined && item.selfAbsenteeBid.price !== undefined && (itemInfo.state === 'READY' || itemInfo.state === 'RUNNING')) { %>
        <div class="bp-control__notice bp-control_footer bp-d-flex bp-f-start bp-f-wrap" data-entry="16">
            <p class="bp-title"><?= __('Highest bid', 'auctionforge') ?>: <span class="bp-bid"><%- formattedPrice(item.selfAbsenteeBid.price, currencySymbol, true) %></span></p>
    <% } else if (item.leadingBid !== undefined && item.leadingBid.isSold) { %>
        <% if (hiddenPrice !== undefined && hiddenPrice) { %>
            <div class="bp-control__notice bp-bg-red bp-d-flex bp-f-start bp-f-wrap" data-entry="7">
                <p class="bp-title"><?= __('Not available', 'auctionforge') ?></p>
        <% } else if (item.leadingBid.isSelf) { %>
            <div class="bp-control__notice bp-bg-green bp-d-flex bp-f-start bp-f-wrap" data-entry="8">
                <p class="bp-title"><?= __('Sold to you for', 'auctionforge') ?>: <span class="bp-bid"><%- formattedPrice(item .leadingBid.price,
                        currencySymbol, true) %></span></p>
        <% } else { %>
            <div class="bp-control__notice bp-bg-blue bp-d-flex bp-f-start bp-f-wrap" data-entry="9">
                <p class="bp-title"><?= __('Sold for', 'auctionforge') ?>: <span class="bp-bid"><%- formattedPrice(item.leadingBid.price,
                        currencySymbol, true) %></span></p>
        <% } %>
        </div>
    <% } else if (item.leadingBid === undefined && (itemInfo.state === 'READY' || itemInfo.state === 'RUNNING') && postAuctionSaleOpened === false) { %>
        <% if (hiddenPrice !== undefined && hiddenPrice) { %>
            <div class="bp-control__notice bp-bg-red bp-d-flex bp-f-start bp-f-wrap" data-entry="10.1">
                <p class="bp-title"><?= __('Not available', 'auctionforge') ?></p>
        <% } else if (item.wasInLiveAuction !== undefined && item.wasInLiveAuction === true) { %>
            <div class="bp-control__notice bp-d-flex bp-f-start bp-f-wrap" data-entry="17">
                <p class="bp-title"><?= __('Not sold', 'auctionforge') ?></p>
        <% } else { %>
            <% if (hideleadingBidSection) { %>
                <div class="bp-control__notice bp-d-flex bp-f-start bp-f-wrap bp-p-0" data-entry="11.x1">
            <% } else { %>
                <div class="bp-control__notice bp-d-flex bp-f-start bp-f-wrap" data-entry="11.x2">
            <% } %>
                <div id="postSaleBid" data-auction-commission="<?= $auctionCommission ?>" data-full-price-vat="<?= $fullPriceVat ?>"
                    class="bp-control__notice_wrp hidden bp-d-flex bp-f-start" data-entry="12"></div>
        <% } %>
        </div>
    <% } else if (item.leadingBid === undefined && (itemInfo.state === 'ENDED' || itemInfo.state === 'ARCHIVED')) { %>
        <% if (hiddenPrice !== undefined && hiddenPrice) { %>
            <div class="bp-control__notice bp-bg-red bp-d-flex bp-f-start bp-f-wrap" data-entry="10.1">
                <p class="bp-title"><?= __('Not available', 'auctionforge') ?></p>
        <% } else { %>
            <div class="bp-control__notice bp-d-flex bp-f-start bp-f-wrap" data-entry="11">
                <p class="bp-title"><?= __('Not sold', 'auctionforge') ?></p>
                <div id="postSaleBid" data-auction-commission="<?= $auctionCommission ?>" data-full-price-vat="<?= $fullPriceVat ?>"
                     class="bp-control__notice_wrp bp-d-flex bp-f-start" data-entry="12"></div>
        <% } %>
        </div>
    <% } else if (item.leadingBid !== undefined && item.leadingBid.isSold !== undefined && item.leadingBid.isSold === false) { %>
        <% if (hiddenPrice !== undefined && hiddenPrice) { %>
        <div class="bp-control__notice bp-bg-red bp-d-flex bp-f-start bp-f-wrap" data-entry="13">
            <p class="bp-title"><?= __('Not available', 'auctionforge') ?></p>
        <% } else { %>
        <% } %>
        <div class="bp-control__notice bp-bg-gray bp-d-flex bp-f-start bp-f-wrap" data-entry="14">
            <p class="bp-title"><?= __('Not sold', 'auctionforge') ?></p>
            <div id="postSaleBid" data-auction-commission="<?= $auctionCommission ?>" data-full-price-vat="<?= $fullPriceVat ?>"
                     class="bp-control__notice_wrp bp-d-flex bp-f-start" data-entry="15">
            </div>
        </div>
    <% } else { %>
        <% if (hiddenPrice !== undefined && hiddenPrice) { %>
            <div class="bp-control__notice bp-bg-red bp-d-flex bp-f-start bp-f-wrap" data-entry="13">
                <p class="bp-title"><?= __('Not available', 'auctionforge') ?></p>
        <% } else { %>
        <% } %>
        <div class="bp-control__notice bp-bg-gray bp-d-flex bp-f-start bp-f-wrap" data-entry="14">
            <p class="bp-title"><?= __('No bids', 'auctionforge') ?></p>
            <div id="postSaleBid" data-auction-commission="<?= $auctionCommission ?>" data-full-price-vat="<?= $fullPriceVat ?>"
                 class="bp-control__notice_wrp bp-d-flex
            bp-f-start" data-entry="15"></div>
        </div>
    <% } %>
</script>