<?php
/**
 * @var $profilePage string
 */

use auctionforge\inc\helpers\SettingsHelper;

$forceShowEstimatedPrice = SettingsHelper::getOption('force_show_estimated_price', 'on');
?>
<script type="text/template" id="user-register">
    <button data-micromodal-trigger="modal-login" class="bp-btn bp-btn-login bp-header__btn"><?= __('Login', 'auctionforge') ?></button>
    <button data-micromodal-trigger="modal-register" class="bp-btn bp-btn-register bp-header__btn"><?= __('Register', 'auctionforge') ?></button>
</script>

<script type="text/template" id="user-profile">
    <a href="<?= $profilePage ?>" class="bp-btn bp-btn-login bp-header__btn"><?= __('Profile', 'auctionforge') ?></a>
</script>

<script type="text/template" id="user-profile-form">
    <div class="errors-group bp-text-red hidden"></div>
    <form action="#" class="bp-from bp-login">
        <div class="bp-form-group">
            <div class="bp-form-group__inner">
                <input disabled type="text" value="<%- firstName %>" placeholder="<?= __('First name', 'auctionforge') ?>" class="bp-form-control" name="firstName" id="firstName">
            </div>
        </div>
        <div class="bp-form-group">
            <div class="bp-form-group__inner">
                <input disabled type="text" value="<%- lastName %>" placeholder="<?= __('Last name', 'auctionforge') ?>" class="bp-form-control" name="lastName" id="lastName">
            </div>
        </div>
        <div class="bp-form-group">
            <div class="bp-form-group__inner">
                <input disabled type="text" value="<%- email %>" placeholder="<?= __('Email', 'auctionforge') ?>" class="bp-form-control" name="email" id="email">
            </div>
        </div>
    </form>
</script>

<script type="text/template" id="soldBid-template">
    <% if (item.leadingBid !== undefined && item.leadingBid.isSold && item.leadingBid.isSelf) { %>
        <div class="bp-control__notice bp-bg-green bp-d-flex bp-f-start bp-f-wrap">
            <p class="bp-title"><?= __('Sold to you for', 'auctionforge') ?>: <span class="bp-bid"><%- formattedPrice(item.soldBid.price, currencySymbol, true) %></span></p>
        </div>
    <% } else if (item.leadingBid !== undefined && item.leadingBid.isSold) { %>
        <div class="bp-control__notice bp-bg-blue bp-d-flex bp-f-start bp-f-wrap">
            <p class="bp-title"><?= __('Sold for', 'auctionforge') ?>: <span class="bp-bid"><%- formattedPrice(item.soldBid.price, currencySymbol, true) %></span></p>
        </div>
    <% } else if (itemInfo.state === 'ENDED') { %>
        <div class="bp-control__notice bp-bg-blue bp-d-flex bp-f-start bp-f-wrap" data-entry="3">
            <p class="bp-title"><?= __('Not sold', 'auctionforge') ?></p>
        </div>
    <% } %>
</script>

<script type="text/template" id="modal-islive-template">
    <header class="modal__header">
        <h2 class="modal__title" id="modal-login-title">
            <?= __('Auction is live', 'auctionforge') ?>
        </h2>
    </header>
    <main class="modal__content" id="modal-login-content">
        <button class="modal__close" aria-label="Close modal" data-micromodal-close></button>
        <div class="errors-group bp-text-red hidden"></div>
        <form id="isLiveSection" action="#" class="bp-from bp-login">
            <div class="bp-form-group">
                <a href="<%- linkLive %>" target="_blank" id="doAuction" type="submit" class="bp-btn bp-btn-black"><?= __('Enter live auction', 'auctionforge') ?></a>
            </div>
        </form>
    </main>
    <footer class="modal__footer"></footer>
</script>
<script type="text/template" id="auctionIsLive-template">
    <% if (isLive === true && (item !== undefined && item.wasInLiveAuction === true)) { %>
    <div class="bp-form-group__inner bp-form-group__inline">
        <a href="<%- linkLive %>" target="_blank" class="bp-btn bp-btn-default"><?= __('To auction', 'auctionforge') ?></a>
    </div>
    <% } else if ((state !== 'ENDED' && state !== 'ARCHIVED') && auctionInfo.absenteeBidsEnabled !== false && (item !== undefined && item.wasInLiveAuction !==
    true)) { %>
    <div class="bp-form-group__inner bp-form-group__inline">
        <label for="bidFormPrice" class="bp-form-group__label"><?= __('Your max bid', 'auctionforge') ?>:</label>
        <select id="bidFormPrice" name="price" style="width: 100%" class="bp-form-control bp-select2 price">
            <option value=""><?= __('Not data', 'auctionforge') ?></option>
        </select>
    </div>
    <div class="bp-form-group__inner bp-form-group__inline">
        <button class="bp-btn bp-btn-default"><?= __('Bid', 'auctionforge') ?></button>
    </div>
    <% } %>
</script>

<script type="text/template" id="modal-bid-template">
    <header class="modal__header">
        <h2 class="modal__title modal__title_without-logo" id="modal-bid-title">
            <?= __('Your bid', 'auctionforge') ?>:
        </h2>
    </header>
    <main class="modal__content bp-mb-30">
        <button class="modal__close" aria-label="Close modal" data-micromodal-close="modal-bid"></button>
        <p id="bid-lot-number" class="modal__content__item bp-d-flex"><strong><?= __('Lot number', 'auctionforge') ?>:</strong>&nbsp;<span><%- index
                %></span></p>
        <p id="bid-lot-name" class="modal__content__item bp-d-flex"><strong><?= __('Lot name', 'auctionforge')
                ?>:</strong>&nbsp;<span><%= name %></span></p>
        <p id="bid-max" class="modal__content__item bp-d-flex"><strong><?= __('Your max bid', 'auctionforge') ?>:</strong>&nbsp;<span
                    class="bp-text-red"><%- formattedPrice(fullPriceInfo.hammerPrice, currentCurrency, true) %></span></p>

        <p id="bid-house-commission" class="modal__content__item bp-d-flex">
            <strong><?= __("Buyer's premium", 'auctionforge') ?>:</strong>
            <span><%- fullPriceInfo.commissionInfo.commissionLabel %></span>
        </p>

        <%
        var _taxPercent = (typeof settings !== 'undefined' && settings.vat) ? parseFloat(settings.vat) : 0;
        var _houseState = (typeof window.bs_data !== 'undefined' && window.bs_data.auction_house_state) ? window.bs_data.auction_house_state : '';
        var _userState = '';
        if (user && user.address && user.address.countryCode === 'US') {
            _userState = user.address.stateCode || user.address.state || '';
        }
        var _sameState = (_houseState !== '' && _userState !== '' && _houseState.toUpperCase() === _userState.toUpperCase());
        if (_taxPercent > 0) {
            if (_sameState) { %>
        <p class="vat-field modal__content__item bp-d-flex">
            <strong>Sales Tax:</strong>
            <span><%- _taxPercent %>% on item price &amp; buyer's premium</span>
        </p>
        <%  } else { %>
        <p class="vat-field modal__content__item bp-d-flex">
            <strong>Sales Tax:</strong>
            <span>0%</span>
        </p>
        <%  }
        } %>

        <p class="vat-field-total modal__content__item bp-d-flex">
            <strong>Total Price:</strong>
            <% if (_taxPercent > 0 && _sameState) { %>
            <span class="bp-text-strong"><%- formattedPrice(fullPriceInfo.totalPriceInfo.price, currentCurrency, true, true) %></span>
            <% } else { %>
            <span class="bp-text-strong"><%- formattedPrice(fullPriceInfo.hammerPrice + fullPriceInfo.commissionInfo.commission, currentCurrency, true, true) %></span>
            <% } %>
        </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>
        <%
        var sendBidEmails = (user.sendBidEmails !== undefined && user.sendBidEmails === true) ? 'checked' : '';
        var sendOverBidEmails = (user.sendOverBidEmails !== undefined && user.sendOverBidEmails === true) ? 'checked' : '';
        var callUserWhenItemIsLive = (itemInfo.hasCallRequest !== undefined && itemInfo.hasCallRequest === true) ? 'checked' : '';
        %>
        <form id="subBidFormSection" class="bp-from bp-from__compact" action="/">
            <div class="bp-form-group bp-form-check bp-form-jc-start">
                <input class="bp-form-check-input" name="sendBidEmails" id="sendBidEmails" type="checkbox" <%- sendBidEmails %> />
                <label class="bp-form-check-label" for="sendBidEmails"><?= __("Send me a confirmation email when I place an absentee bid", "auctionforge") ?></label>
            </div>
            <div class="bp-form-group bp-form-check bp-form-jc-start">
                <input class="bp-form-check-input" name="sendOverBidEmails" id="sendOverBidEmails" type="checkbox" <%- sendOverBidEmails %> />
                <label class="bp-form-check-label" for="sendOverBidEmails"><?= __("Send a notification to my email if my bid is no longer the leading bid", "auctionforge") ?></label>
            </div>
            <% if ((settings.enableUsersCallRequests !== undefined && settings.enableUsersCallRequests === true)) { %>
            <% if (settings.minimumForUsersCallRequests !== undefined &&
                settings.minimumForUsersCallRequests <= parseInt(price)) { %>
            <div class="bp-form-group bp-form-check bp-form-jc-start">
                <input class="bp-form-check-input" name="callUserWhenItemIsLive" id="callUserWhenItemIsLive" type="checkbox" <%- callUserWhenItemIsLive %> />
                <label class="bp-form-check-label" for="callUserWhenItemIsLive"><?= __("Call me when this item goes on live auciton", "auctionforge") ?></label>
            </div>
            <% } %>
            <% } %>
        </form>
        <% if (additionalMessage !== undefined) { %>
            <p class="bp-text-red bp-mb-0"><%= additionalMessage %></p>
        <% } %>
        <p class="bp-text-red"><?= __("Please note you can't retract or cancel your bid", "auctionforge") ?></p>
    </main>
    <% if (additionalNotice) { %>
    <div id="additional-notice">
        <p class="bp-text-red"><%= additionalNoticeText %></p>
    </div>
    <% } %>
    <footer class="modal__footer bp-d-flex">
        <div class="bp-d-flex bp-f-start bp-mr-auto">
            <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">
            <a id="dontAgreeBid" class="bp-btn bp-btn-border bp-btn-link bp-mr-10" href="#"><?= __('I don\'t Agree', 'auctionforge') ?></a>
            <a id="agreeBid" class="bp-btn bp-btn-primal trigger" href="#"><?= __('I Agree', 'auctionforge') ?></a>
        </div>
    </footer>
</script>

<script type="text/template" id="lot-sold-content-template">
    <% if (itemInfo.leadingBid !== undefined && itemInfo.leadingBid.isSelf && itemInfo.leadingBid.isSold) { %>
        <div class="bp-lot__badge bp-bg-green">
            <p class="bp-lot__badge-text"><?= __('Sold to you for', 'auctionforge') ?>: <strong><%- formattedPrice(itemInfo.leadingBid.price, currency, true) %></strong></p>
        </div>
        <% } else if (itemInfo.leadingBid !== undefined && itemInfo.leadingBid.isSold) { %>
        <div class="bp-lot__badge bp-bg-blue">
            <p class="bp-lot__badge-text"><?= __('Sold for', 'auctionforge') ?>: <strong><%- formattedPrice(itemInfo.leadingBid.price, currency, true) %></strong></p>
        </div>
    <% } %>
</script>

<script type="text/template" id="lot-content-template">
	<div class="bp-lot__title">
        <%= title %>
    </div>
    <% if (auctionInfo.state !== 'ENDED' && auctionInfo.state !== 'ARCHIVED') { %>
    <div class="bp-lot__message" data-entry="3.3">
        <% if (itemInfo !== undefined && itemInfo.leadingBid && !itemInfo.leadingBid.isSelf && itemInfo.selfAbsenteeBid) { %>
            <p class="bp-lot__message-inner bp-text-red bp-lot__message-you_bid" data-entry="debug-message-1">
                <?= __ ('Your bid of', 'auctionforge') ?> <%- formattedPrice(itemInfo.selfAbsenteeBid.price, currency, true) %> <?= __('has been outbid by a higher bid', 'auctionforge') ?>
            </p>
        <% } else if (itemInfo !== undefined && itemInfo.leadingBid && itemInfo.leadingBid.isSelf && itemInfo.selfAbsenteeBid) { %>
            <p class="bp-lot__message-inner bp-text-green bp-lot__message-you_bid" data-entry="debug-message-2">
                <?= __('Your max bid', 'auctionforge') ?>: <%- formattedPrice(itemInfo.selfAbsenteeBid.price, currency, true) %>
            </p>
        <% } else if (itemInfo !== undefined && !!itemInfo.leadingBid && itemInfo.leadingBid.price !== undefined && itemInfo.leadingBid.price > 0 && (itemInfo
        .leadingBid.isSold)) { %>
            <% if (displayStartPriceInCatalog !== undefined && displayStartPriceInCatalog === true) { %>
                <p class="bp-lot__message-inner bp-text-grey bp-lot__message-start_price" data-entry="debug-4"><?= __('Start price', 'auctionforge') ?>:
                    <strong><%- formattedPrice(itemInfo.startPrice, currency, true) %></strong>
                </p>
            <% } else if (showEstimatedPriceInItemsList || Boolean(<?= ($forceShowEstimatedPrice == "on") ?>)) { %>
                <p class="bp-lot__message-inner bp-text-grey bp-lot__message-start_price bp-lot__message-not_sold-debug" data-entry="debug-2"><?= __('Estimated price',
                        'auctionforge') ?>: <strong><%- estimatedPrice %></strong>
                </p>
            <% } %>
        <% } else if (displayStartPriceInCatalog !== undefined && displayStartPriceInCatalog === true && (showEstimatedPriceInItemsList === true || Boolean
        (<?= ($forceShowEstimatedPrice == "on") ?>))) { %>
            <% if (houseInfo.enablePrebidsUnderStartPrice !== undefined && houseInfo.enablePrebidsUnderStartPrice === true && (estimatedPrice !== "") &&
        itemInfo.leadingBid !== undefined) { %>
                <p class="bp-lot__message-inner bp-text-grey bp-lot__message-start_price bp-lot__message-not_sold-debug" data-entry="debug-0"><?= __('Start price',
                        'auctionforge') ?>: <strong><%- formattedPrice(itemInfo.startPrice, currency, true) %></strong>
                </p>
            <% } else if (itemInfo.soldBid !== undefined && itemInfo.soldBid.price !== undefined && itemInfo.soldBid.price > 0) { %>
                <% if (showEstimatedPriceInItemsList || Boolean(<?= ($forceShowEstimatedPrice == "on") ?>)) { %>
                    <p class="bp-lot__message-inner bp-text-grey bp-lot__message-start_price bp-lot__message-not_sold-debug" data-entry="debug-2"><?= __('Estimated price',
                            'auctionforge') ?>: <strong><%- estimatedPrice %></strong>
                    </p>
                <% } else if (displayStartPriceInCatalog !== undefined && displayStartPriceInCatalog === true) { %>
                    <p class="bp-lot__message-inner bp-text-grey bp-lot__message-start_price" data-entry="debug-4"><?= __('Start price', 'auctionforge') ?>:
                        <strong><%- formattedPrice(itemInfo.startPrice, currency, true) %></strong>
                    </p>
                <% } %>
            <% } else if (showEstimatedPriceInItemsList || Boolean(<?= ($forceShowEstimatedPrice == "on") ?>) && itemInfo.startPrice > 0 && (estimatedPrice
        !== "")) { %>
                <p class="bp-lot__message-inner bp-text-grey bp-lot__message-start_price bp-lot__message-not_sold-debug" data-entry="debug-1"><?= __('Start price',
                        'auctionforge') ?>: <strong><%- formattedPrice(itemInfo.startPrice, currency, true) %></strong>
                </p>
            <% } else { %>
                <p class="bp-lot__message-inner bp-text-grey bp-lot__message-start_price bp-lot__message-not_sold-debug" data-entry="debug-3">
                    <%- (estimatedPrice !== "") ? '<?= __('Estimated price', 'auctionforge') ?>:' : "" %> <strong><%- estimatedPrice %></strong>
                </p>
            <% } %>
        <% } else if (displayStartPriceInCatalog !== undefined && displayStartPriceInCatalog === true && itemInfo.soldBid !== undefined) { %>
            <% if (displayStartPriceInCatalog !== undefined && displayStartPriceInCatalog === true) { %>
                <p class="bp-lot__message-inner bp-text-grey bp-lot__message-start_price" data-entry="debug-4"><?= __('Start price', 'auctionforge') ?>:
                    <strong><%- formattedPrice(itemInfo.startPrice, currency, true) %></strong>
                </p>
            <% } %>
        <% } else if (displayStartPriceInCatalog !== undefined && displayStartPriceInCatalog === false && itemInfo.soldBid !== undefined) { %>
            <% if (showEstimatedPriceInItemsList || Boolean(<?= ($forceShowEstimatedPrice == "on") ?>)) { %>
            <p class="bp-lot__message-inner bp-text-grey bp-lot__message-start_price bp-lot__message-not_sold-debug" data-entry="debug-2"><?= __('Estimated price',
                    'auctionforge') ?>: <strong><%- estimatedPrice %></strong>
            </p>
            <% } %>
        <% } %>
    </div>
    <% } %>
    <% if (itemInfo.soldBid) { %>
        <% if (hiddenPrice !== undefined && hiddenPrice) { %>
            <div class="bp-lot__tool"  data-entry="5.2">
            <% if (showEstimatedPriceInItemsList) { %>
                <p class="bp-subtitle"><%- (estimatedPrice !== "") ? '<?= __('Estimated price', 'auctionforge') ?>' : "" %></p>
                <p class="bp-price"><%- estimatedPrice %></p>
            <% } else { %>
                <p class="bp-subtitle"><?= __('Not available', 'auctionforge') ?></p>
            <% } %>
        <% } else if (itemInfo.soldBid !== null && settings.hideSoldPrice !== undefined && settings.hideSoldPrice == true) { %>
            <div class="bp-lot__tool bp-lead bp-bg-blue"  data-entry="5.2.0">
                <p class="bp-subtitle"><?= __('Sold', 'auctionforge') ?></p>
        <% } else if (itemInfo.soldBid !== null && itemInfo.soldBid.isSelf) { %>
            <div class="bp-lot__tool bp-lead bp-bg-green"  data-entry="6.2">
                <p class="bp-subtitle"><?= __('Sold to you for', 'auctionforge') ?>:</p>
                <p class="bp-price"><%- formattedPrice(itemInfo.soldBid.price, currency, true) %></p>
        <% } else { %>
            <div class="bp-lot__tool bp-lead bp-bg-blue"  data-entry="7.2">
                <p class="bp-subtitle"><?= __('Sold for', 'auctionforge') ?>:</p>
                <p class="bp-price"><%- formattedPrice(itemInfo.soldBid.price, currency, true) %></p>
        <% } %>
        </div>
    <% } else if (itemInfo.leadingBid) { %>
        <% if (itemInfo.leadingBid.isSold && itemInfo.soldBid !== undefined) { %>
            <% if (!hiddenPrice) { %>
                <div class="bp-lot__tool bp-lead" data-entry="1.2">
                    <% if (showEstimatedPriceInItemsList) { %>
                        <p class="bp-subtitle"><%- (estimatedPrice !== "") ? '<?= __('Estimated price', 'auctionforge') ?>' : "" %></p>
                        <p class="bp-price"><%- estimatedPrice %></p>
                    <% } else { %>
                        <p class="bp-subtitle"><?= __('Highest bid', 'auctionforge') ?>:</p>
                    <% } %>
            <% } else if (itemInfo.soldBid.isSelf) { %>
                <div class="bp-lot__tool bp-lead bp-bg-green">
                    <p class="bp-subtitle"><?= __('Sold to you for', 'auctionforge') ?>:</p>
            <% } else if (showEstimatedPriceInItemsList) { %>
                <div class="bp-lot__tool" data-entry="8.2">
                    <p class="bp-subtitle"><%- (estimatedPrice !== "") ? '<?= __('Estimated price', 'auctionforge') ?>' : "" %></p>
                    <p class="bp-price"><%- estimatedPrice %></p>
            <% } else { %>
                <div class="bp-lot__tool" data-entry="9.2">
                    <p class="bp-subtitle"><?= __('Not available', 'auctionforge') ?></p>
            <% } %>
            <% if (!showEstimatedPriceInItemsList && hiddenPrice !== undefined && !hiddenPrice) { %>
                <p class="bp-price"><%- formattedPrice(itemInfo.soldBid.price, currency, true) %></p>
            <% } %>
            </div>
        <% } else if ((settings.enablePrebidsUnderStartPrice !== undefined && settings.enablePrebidsUnderStartPrice === true)
                    && (itemInfo.leadingBid.price < itemInfo.startPrice) && itemInfo.leadingBid.isSelf === false) { %>
            <div class="bp-lot__tool" data-entry="12.1" style="margin-top:0;padding-top:0;">
                <% if ((showEstimatedPriceInItemsList || Boolean(<?= ($forceShowEstimatedPrice == "on") ?>)) && (estimatedPrice !== "")) { %>
                    <p class="bp-subtitle" data-entry="12.1.1"><?= __('Estimated price', 'auctionforge') ?>:</p>
                    <p class="bp-price"><%- estimatedPrice %></p>
                <% } else { %>
                    <% if (displayStartPriceInCatalog === true) { %>
                        <% if (itemInfo.startPrice !== undefined && itemInfo.startPrice !== 0) { %>
<% if (!(isShop !== undefined && isShop) && estimatedPrice !== "") { %>
                    <p class="bp-subtitle"><?= __('Estimate', 'auctionforge') ?>:</p>
                    <p class="bp-price" style="font-size:14px;font-weight:400;"><%- estimatedPrice %></p>
                    <% } %>
                    <p class="bp-subtitle" data-entry="12.1.3" style="font-weight:700;color:#000;"><?= __('Start price', 'auctionforge') ?>:</p>
                            <p class="bp-price"><%- formattedPrice(itemInfo.startPrice, currency, true) %></p>
                        <% } else { %>
                            <p class="bp-subtitle" data-entry="12.1.4"><?= __('Not available', 'auctionforge') ?></p>
                        <% } %>
                    <% } else { %>
                        <p class="bp-subtitle" data-entry="12.1.5"><%- (estimatedPrice !== "") ? '<?= __('Estimated price', 'auctionforge') ?>' : "" %></p>
                        <p class="bp-price"><%- (estimatedPrice !== "") ? estimatedPrice : "" %></p>
                    <% } %>
                <% } %>
            </div>
        <% } else { %>
            <% if (hiddenPrice !== undefined && hiddenPrice) { %>
                <div class="bp-lot__tool"  data-entry="2.2">
                    <% if (showEstimatedPriceInItemsList) { %>
                        <p class="bp-subtitle"><%- (estimatedPrice !== "") ? '<?= __('Estimated price', 'auctionforge') ?>' : "" %></p>
                        <p class="bp-price"><%- estimatedPrice %></p>
                    <% } else { %>
                        <p class="bp-subtitle"><?= __('Not available', 'auctionforge') ?></p>
                    <% } %>
            <% } else if (itemInfo.leadingBid.isSelf && itemInfo.selfAbsenteeBid) { %>
<% if (!(isShop !== undefined && isShop) && estimatedPrice !== "") { %>
                <div class="bp-lot__tool" data-entry="estimate-above" style="margin-top:0;padding-top:0;">
                    <p class="bp-subtitle"><?= __('Estimate', 'auctionforge') ?>:</p>
                    <p class="bp-price" style="font-size:14px;font-weight:400;"><%- estimatedPrice %></p>
                </div>
                <% } %>
                <div class="bp-lot__tool bp-lead bp-bg-green" data-entry="10.2">
                    <p class="bp-subtitle"><?= __('Your leading bid', 'auctionforge') ?>:</p>
                    <p class="bp-price"><%- formattedPrice(itemInfo.leadingBid.price, currency, true) %></p>
            <% } else if (itemInfo.selfAbsenteeBid && itemInfo.leadingBid && !itemInfo.leadingBid.isSelf) { %>
<% if (!(isShop !== undefined && isShop) && estimatedPrice !== "") { %>
                <div class="bp-lot__tool" data-entry="estimate-above" style="margin-top:0;padding-top:0;">
                    <p class="bp-subtitle"><?= __('Estimate', 'auctionforge') ?>:</p>
                    <p class="bp-price" style="font-size:14px;font-weight:400;"><%- estimatedPrice %></p>
                </div>
                <% } %>
                <div class="bp-lot__tool bp-lead bp-bg-red" data-entry="11.2">
                    <p class="bp-subtitle"><?= __('Leading bid', 'auctionforge') ?>:</p>
                    <p class="bp-price"><%- formattedPrice(itemInfo.leadingBid.price, currency, true) %></p>
            <% } else if (itemInfo.leadingBid && !itemInfo.leadingBid.isSelf) { %>
<% if (!(isShop !== undefined && isShop) && estimatedPrice !== "") { %>
                <div class="bp-lot__tool" data-entry="estimate-above" style="margin-top:0;padding-top:0;">
                    <p class="bp-subtitle"><?= __('Estimate', 'auctionforge') ?>:</p>
                    <p class="bp-price" style="font-size:14px;font-weight:400;"><%- estimatedPrice %></p>
                </div>
                <% } %>
                <div class="bp-lot__tool bp-lead" data-entry="12.2">
                    <p class="bp-subtitle"><?= __('Highest bid', 'auctionforge') ?>:</p>
                    <p class="bp-price"><%- formattedPrice(itemInfo.leadingBid.price, currency, true) %></p>
            <% } %>
            </div>
        <% } %>
    <% } else if (itemInfo.selfAbsenteeBid !== undefined && itemInfo.selfAbsenteeBid.price !== undefined && (auctionInfo.state !== 'ENDED' && auctionInfo.state !== 'ARCHIVED')) { %>
<% if (!(isShop !== undefined && isShop) && estimatedPrice !== "") { %>
        <div class="bp-lot__tool" data-entry="estimate-above" style="margin-top:0;padding-top:0;">
            <p class="bp-subtitle"><?= __('Estimate', 'auctionforge') ?>:</p>
            <p class="bp-price" style="font-size:14px;font-weight:400;"><%- estimatedPrice %></p>
        </div>
        <% } %>
        <div class="bp-lot__tool bp-lead" data-entry="14.2">
            <p class="bp-subtitle"><?= __('Highest bid', 'auctionforge') ?>:</p>
            <p class="bp-price"><%- formattedPrice(itemInfo.selfAbsenteeBid.price, currency, true) %></p>
        </div>
    <% } else {%>
        <% if (auctionInfo.state === 'ENDED') { %>
            <% if (postAuctionSaleOpened !== undefined && postAuctionSaleOpened === true) { %>
                <div class="bp-lot__tool"  data-entry="33.2">
                <p class="bp-lot__message-inner bp-text-grey bp-lot__message-start_price bp-lot__message-not_sold-debug" data-entry="debug-6">
                    <% if (itemInfo.postSalePrice !== undefined) { %>
                        <?= __('Price', 'auctionforge') ?>: <strong data-entry="33.2.0"><%- formattedPrice(itemInfo.postSalePrice, currency, true) %></strong>
                    <% } else { %>
                        <?= __('Price', 'auctionforge') ?>: <strong data-entry="33.2.1"><%- formattedPrice(itemInfo.startPrice, currency, true) %></strong>
                    <% } %>
                </p>
                </div>
            <% } else if ((showEstimatedPriceInItemsList || Boolean(<?= ($forceShowEstimatedPrice == "on") ?>)) && (estimatedPrice !== "")) { %>
                <div class="bp-lot__tool"  data-entry="3.2">
                    <p class="bp-subtitle"><%- (estimatedPrice !== "") ? '<?= __('Estimated price', 'auctionforge') ?>' : "" %></p>
                    <p class="bp-price"><%- estimatedPrice %></p>
                </div>
            <% } else if (displayStartPriceInCatalog !== undefined && displayStartPriceInCatalog === true) { %>
                <div class="bp-lot__tool" data-entry="113" style="margin-top:0;padding-top:0;">
<% if (!(isShop !== undefined && isShop) && estimatedPrice !== "") { %>
                    <p class="bp-subtitle"><?= __('Estimate', 'auctionforge') ?>:</p>
                    <p class="bp-price" style="font-size:14px;font-weight:400;"><%- estimatedPrice %></p>
                    <% } %>
                    <p class="bp-subtitle" style="font-weight:700;color:#000;"><?= __('Start price', 'auctionforge') ?>:</p>
                    <p class="bp-price"><%- formattedPrice(itemInfo.startPrice, currency, true) %></p>
                </div>
            <% } else if (isShop !== undefined && isShop && itemInfo.buyoutPrice !== undefined && itemInfo.buyoutPrice > 0) { %>
                <div class="bp-lot__tool" data-entry="110.2.shop">
                    <p class="bp-subtitle"><?= __('Purchase Price', 'auctionforge') ?>:</p>
                    <p class="bp-price"><%- formattedPrice(itemInfo.buyoutPrice, currency, true) %></p>
                </div>
            <% } else { %>
                <div class="bp-lot__tool"  data-entry="110.2">
                    <p class="bp-subtitle"><?= __('Not sold', 'auctionforge') ?>:</p>
                    <p class="bp-price"><%- formattedPrice(0, currency) %></p>
                </div>
            <% } %>
        <% } else { %>
            <% if (postAuctionSaleOpened) { %>
                <div class="bp-lot__tool"  data-entry="33.3">
                    <p class="bp-lot__message-inner bp-text-grey bp-lot__message-start_price bp-lot__message-not_sold-debug" data-entry="debug-7">
                        <% if (itemInfo.postSalePrice !== undefined) { %>
                        <?= __('Price', 'auctionforge') ?>: <strong data-entry="33.2.0"><%- formattedPrice(itemInfo.postSalePrice, currency, true) %></strong>
                        <% } else { %>
                        <?= __('Price', 'auctionforge') ?>: <strong data-entry="33.2.1"><%- formattedPrice(itemInfo.startPrice, currency, true) %></strong>
                        <% } %>
                    </p>
                </div>
            <% } else if (isShop !== undefined && isShop && itemInfo.buyoutPrice !== undefined && itemInfo.buyoutPrice > 0) { %>
                <div class="bp-lot__tool" data-entry="13.2.shop">
                    <p class="bp-subtitle"><?= __('Purchase Price', 'auctionforge') ?>:</p>
                    <p class="bp-price"><%- formattedPrice(itemInfo.buyoutPrice, currency, true) %></p>
                </div>
            <% } else if ((showEstimatedPriceInItemsList || Boolean(<?= ($forceShowEstimatedPrice == "on") ?>)) && estimatedPrice !== "") { %>
                <div class="bp-lot__tool" data-entry="13.2">
                    <p class="bp-subtitle"><%- (estimatedPrice !== "") ? '<?= __('Estimated price', 'auctionforge') ?>' : "" %></p>
                    <p class="bp-price"><%- (estimatedPrice !== "") ? estimatedPrice : "" %></p>
            <% } else if ((showEstimatedPriceInItemsList || Boolean(<?= ($forceShowEstimatedPrice == "on") ?>)) && estimatedPrice === "") { %>
                <div class="bp-lot__tool" data-entry="13.8">
                <% if (displayStartPriceInCatalog === true) { %>
                    <% if (itemInfo.startPrice !== 0) { %>
<% if (!(isShop !== undefined && isShop) && estimatedPrice !== "") { %>
                    <p class="bp-subtitle"><?= __('Estimate', 'auctionforge') ?>:</p>
                    <p class="bp-price" style="font-size:14px;font-weight:400;"><%- estimatedPrice %></p>
                    <% } %>
                    <p class="bp-subtitle" data-note="Estimate price is empty" data-entry="4.2.1" style="font-weight:700;color:#000;"><?= __('Start price', 'auctionforge') ?>:</p>
                        <p class="bp-price"><%- formattedPrice(itemInfo.startPrice, currency, true) %></p>
                    <% } else { %>
                        <p class="bp-subtitle" data-entry="4.2.3"><?= __('Not available', 'auctionforge') ?></p>
                    <% } %>
                <% } else { %>
                    <p class="bp-subtitle" data-entry="4.2.0"><%- (estimatedPrice !== "") ? '<?= __('Estimated price', 'auctionforge') ?>' : "" %></p>
                    <p class="bp-price"><%- (estimatedPrice !== "") ? estimatedPrice : "" %></p>
                <% } %>
            <% } else if (hiddenPrice !== undefined && hiddenPrice) { %>
                <div class="bp-lot__tool bp-lead bp-bg-red" data-entry="15.2">
                    <p class="bp-subtitle"><?= __('Not available', 'auctionforge') ?></p>
            <% } else { %>
            <div class="bp-lot__tool bp-lot__tool-not-sold" data-entry="4.2" style="margin-top:0;padding-top:0;">
                <% if (isShop !== undefined && isShop && itemInfo.buyoutPrice !== undefined && itemInfo.buyoutPrice > 0) { %>
                    <p class="bp-subtitle" data-entry="4.2.shop"><?= __('Purchase Price', 'auctionforge') ?>:</p>
                    <p class="bp-price"><%- formattedPrice(itemInfo.buyoutPrice, currency, true) %></p>
                <% } else if (showEstimatedPriceInItemsList) { %>
<% if (!(isShop !== undefined && isShop) && estimatedPrice !== "") { %>
                    <p class="bp-subtitle"><?= __('Estimate', 'auctionforge') ?>:</p>
                    <p class="bp-price" style="font-size:14px;font-weight:400;"><%- estimatedPrice %></p>
                    <% } %>
                    <p class="bp-subtitle" data-entry="4.2.4" style="font-weight:700;color:#000;"><?= __('Start price', 'auctionforge') ?>:</p>
                    <p class="bp-price"><%- formattedPrice(itemInfo.startPrice, currency, true) %></p>
                <% } else { %>
                    <% if (itemInfo.buyoutPrice !== undefined && (postAuctionSaleOpened && (auctionInfo.state !== 'ENDED' && auctionInfo.state !==
                'ARCHIVED'))) { %>
                        <p class="bp-subtitle" data-entry="4.2.2"><?= __('Purchase price', 'auctionforge') ?>:</p>
                        <p class="bp-price"><%- formattedPrice(itemInfo.buyoutPrice, currency, true) %></p>
                    <% } else if (displayStartPriceInCatalog === true) { %>
                        <% if (itemInfo.startPrice !== undefined && itemInfo.startPrice !== 0) { %>
<% if (!(isShop !== undefined && isShop) && estimatedPrice !== "") { %>
                    <p class="bp-subtitle"><?= __('Estimate', 'auctionforge') ?>:</p>
                    <p class="bp-price" style="font-size:14px;font-weight:400;"><%- estimatedPrice %></p>
                    <% } %>
                    <p class="bp-subtitle" data-entry="4.2.5" style="font-weight:700;color:#000;"><?= __('Start price', 'auctionforge') ?>:</p>
                            <p class="bp-price"><%- formattedPrice(itemInfo.startPrice, currency, true) %></p>
                        <% } else { %>
                            <p class="bp-subtitle" data-entry="4.2.7"><?= __('Not available', 'auctionforge') ?></p>
                        <% } %>
                    <% } else { %>
                        <p class="bp-subtitle" data-entry="4.2.0"><%- (estimatedPrice !== "") ? '<?= __('Estimated price', 'auctionforge') ?>' : "" %></p>
                        <p class="bp-price"><%- (estimatedPrice !== "") ? estimatedPrice : "" %></p>
                    <% } %>
                <% } %>
            <% } %>
            </div>
        <% } %>
    <% } %>

    <% if ((auctionInfo.state === 'READY' || auctionInfo.state === 'PRE_AUCTION') && !itemInfo.wasInLiveAuction && (auctionData.absenteeBidsEnabled === true)) { %>
        <% if (bidsInCatalog !== undefined && bidsInCatalog === true &&
            ((itemInfo.startPrice > 0 && itemInfo.soldBid === undefined) ||
            (houseInfo.enablePrebidsUnderStartPrice !== undefined && houseInfo.enablePrebidsUnderStartPrice === true))
        ) { %>
        <div class="bp-lot__bid">
            <form data-id="bidFormSection-<%= itemInfo.lotIndex %>" action="">
                <select class="js-data-bid-list" id=""></select>
                <button type="submit" class="bp-btn bp-btn-default bp-lot__bid-action">
                    <?= __("Bid", "auctionforge") ?>
                </button>
            </form>
        </div>
        <% } %>
    <% } %>
</script>
<script type="text/template" id="lotsLoadMore-template">
    <% _.forEach(lots, function(lot, index) { %>
    <div id="lot-<%- lot.itemIndex %>" class="bp-lot" data-lot-index="<%- lot.itemIndex %>" data-content="<%- lot.itemData %>" data-estimated-price="<%- lot
    .estimated_price %>">
        <% if (lot.isRemovedItem !== undefined && lot.isRemovedItem === "1") { %>
            <div class="bp-alert bp-alert-small bp-alert-radius-0 bp-alert-absolute alert bp-alert-danger alert-primary" role="alert">
                <p><?= __("Lot was removed from auction", "auctionforge") ?></p>
            </div>
        <% } %>
        <a href="<%- lot.guid %>" class="bp-lot__wrp-image" style="background-color: <%- bgColor %>">
            <span class="bp__wishlist<%- (lot.isRemovedItem !== undefined && lot.isRemovedItem === '1') ? '-removed' : '' %>"></span>
            <div class="bp-lot__image" style="background-image:url(<%- lot.featureImage %>);"></div>
        </a>
        <div id="lot-<%- lot.itemIndex %>-content" class="bp-lot__content lot-<%- (lot.isRemovedItem !== undefined && lot.isRemovedItem === '1') ? 'removed'
         : 'isset' %>">
            <div class="bp-lot__title">
                <a href="<%- lot.guid %>"><span class="bp-title"><%- lot.post_title %>:</span><%- lot.post_content
                    %></a>
            </div>
            <% if (showEstimatedPriceInItemsList !== undefined && showEstimatedPriceInItemsList === true) { %>
                <div class="bp-lot__message" data-entry="3.0"></div>
            <% } %>
            <div class="bp-lot__tool" data-entry="15.0">
                <% if (showEstimatedPriceInItemsList !== undefined && showEstimatedPriceInItemsList === true && lot.estimated_price !== '')
                { %>
                    <p class="bp-subtitle"><?= __('Estimated price', 'auctionforge') ?>:</p>
                    <p class="bp-price"><%- lot.estimated_price %></p>
                <% } else if (showEstimatedPriceInItemsList !== undefined && showEstimatedPriceInItemsList === false) { %>
                    <p class="bp-subtitle"><?= __('Leading bid', 'auctionforge') ?>:</p>
                    <p class="bp-price"></p>
                <% } %>
            </div>
        </div>
    </div>
    <% }) %>
</script>
<script type="text/template" id="lotsLoadMoreWithCatalog-template">
    <% _.forEach(lots, function(lot, index) { %>
    <div id="lot-<%- slug %>-<%- lot.itemIndex %>" class="bp-lot" data-lot-index="<%- lot.itemIndex %>" data-estimated-price="<%- lot
    .estimated_price %>">
        <a href="<%- lot.guid %>" class="bp-lot__wrp-image" style="background-color: <%- bgColor %>">
            <div class="bp-lot__image" style="background-image:url(<%- lot.featureImage %>);"></div>
        </a>
        <div id="lot-<%- slug %>-<%- lot.itemIndex %>-content" class="bp-lot__content">
            <div class="bp-lot__title">
                <a href="<%- lot.guid %>"><span class="bp-title"><%- lot.post_title %>:</span><%- lot.post_content
                    %></a>
            </div>
            <% if (showEstimatedPriceInItemsList !== undefined && showEstimatedPriceInItemsList === true) { %>
            <div class="bp-lot__message" data-entry="3.1"></div>
            <% } %>
            <div class="bp-lot__tool" data-entry="15.1">
                <% if (showEstimatedPriceInItemsList !== undefined && showEstimatedPriceInItemsList === true && lot.estimated_price !== '')
                { %>
                <p class="bp-subtitle"><?= __('Estimated price', 'auctionforge') ?>:</p>
                <p class="bp-price"><%- lot.estimated_price %></p>
                <% } else if (showEstimatedPriceInItemsList !== undefined && showEstimatedPriceInItemsList === false) { %>
                <p class="bp-subtitle"><?= __('Leading bid', 'auctionforge') ?>:</p>
                <% } %>
            </div>
        </div>
    </div>
    <% }) %>
</script>
<script type="text/template" id="loadMore-template">
    <div id="bsLoaderCatalog" class="bs-loader-small"></div>
</script>
<script type="text/template" id="oldest-browser-template">
    <div id="browserWarning" class="oldest-browser">
        <div>
            <p><%- message %>&nbsp;<a href="<%= link %>"><%- linkMessage %></a></p>
        </div>
    </div>
</script>
<script type="text/template" id="lots-notfound-template">
    <div class="bp-d-flex bp-mb-30 bp-padding-text">
        <p><?= __('Lots not found', 'auctionforge') ?></p>
    </div>
</script>