<?php

use auctionforge\inc\controllers\PolylangSupport;
use auctionforge\inc\helpers\LotHelper;
use auctionforge\inc\helpers\SettingsHelper;

if (SettingsHelper::getOption('enable_recently_viewed', 'off') === 'on') : ?>
<style>
.bp-recently-viewed-header { padding: 10px 15px; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 10px; }
.bp-recently-viewed-header .bp-title { font-size: 1.1em; font-weight: 600; margin: 0; }
.bp-btn-sm { padding: 6px 16px; font-size: 0.85em; white-space: nowrap; }
.bp-btn-outline { background: transparent; border: 1px solid #999; color: #555; text-decoration: none; border-radius: 3px; cursor: pointer; }
.bp-btn-outline:hover { background: #333; color: #fff; }
</style>
<?php endif; ?>
<?php

$pageAuctionListId = SettingsHelper::getOption('auction_list', 0);
$lang = SettingsHelper::getOption("lang", "en");
if (PolylangSupport::isPolylangActive()) {
    $lang = pll_current_language();
}

if (PolylangSupport::isPolylangActive()) {
    $langCode = pll_current_language();
    $profilePageId = SettingsHelper::getOption('profile', 0);
    $translate = pll_get_post_translations($profilePageId);
    if (!empty($translate[$langCode])) {
        $profileLink = get_permalink($translate[$langCode]);
    } else {
        $profileLink = get_permalink($profilePageId);
    }
} else {
    $profileLink = get_permalink(SettingsHelper::getOption('profile', 0));
}
?>
<script type="text/template" id="profile-page-template">
    <div class="bp-content bp-justify-between bp-row bp-no-margin bp-add-padding">
        <div class="bp-col bp-d-flex bp-md-f-wrap bp-f-center">
            <div class="bp-content__text bp-justify-between bp-mb-0">
                <div data-tab-id="profile-tabs" class="bp-tabs-block bp-col bp-hidden bp-d-flex bp-f-center">
                    <nav class="nav bp-tabs-link">
                        <a class="nav-link active" id="bp-profile-link" href="#bp-account"><?= __('My Account', 'auctionforge') ?></a>
                        <a class="nav-link" id="bp-wish-list-link" href="#bp-wish-list"><?= __('Wish List', 'auctionforge') ?></a>
                        <a class="nav-link" id="bp-bids-list-link" href="#bp-my-bids"><?= __('My Bids', 'auctionforge') ?></a>
                        <a class="nav-link" id="bp-payment-methods-link" href="#bp-payment-methods"><?= __('Payment methods', 'auctionforge') ?></a>
                        <a class="nav-link" id="bp-winnings-list-link" href="#bp-winnings"><?= __('Winnings', 'auctionforge') ?></a>
                        <?php if (SettingsHelper::getOption('enable_recently_viewed', 'off') === 'on') : ?>
                        <a class="nav-link" id="bp-recently-viewed-link" href="#bp-recently-viewed"><?= __('Recently Viewed', 'auctionforge') ?></a>
                        <?php endif; ?>
                        <a class="logoutLink nav-link" href="#logout"><?= __('Logout', 'auctionforge') ?></a>
                    </nav>
                </div>
            </div>
        </div>
    </div>
    <div class="bp-row bp-fix-width-lot">
        <div id="profile-section" class="bp-d-flex bp-f-wrap bp-f-center bp-md-f-around">
            <div id="profile-tabs" class="bp-tabs-content bp-col">
                <div id="bp-account" class="active bp-tabs__block">
                    <a href="#" class="bp-visible bp-spoiler-trigger"><span><?= __('My Account', 'auctionforge') ?></span></a>
                    <div id="profile-account-section"
                         data-confirm-email="<?= __('Please complete your registration to participate in our auctions. <a href=\'#\' id=\'resendEmailSection\'>Resend email</a>.', 'auctionforge') ?>"
                         data-incomplete-profile="<?= __('Please complete your details.', 'auctionforge') ?>"
                         data-pending="<?= __('You are not approved to bid yet.', 'auctionforge') ?>"
                         class="bp-spoiler-block"></div>
                </div>
                <div id="bp-wish-list" class="bp-tabs__block">
                    <a href="#" class="bp-visible bp-spoiler-trigger"><span><?= __('Wish List', 'auctionforge') ?></span></a>
                    <div id="profile-wishlist-section" class="bp-spoiler-block"></div>
                </div>
                <div id="bp-my-bids" class="bp-tabs__block">
                    <a href="#" class="bp-visible bp-spoiler-trigger"><span><?= __('My Bids', 'auctionforge') ?></span></a>
                    <div id="profile-bids-section" class="bp-spoiler-block"></div>
                </div>
                <div id="bp-payment-methods" class="bp-tabs__block">
                    <a href="#" class="bp-visible bp-spoiler-trigger"><span><?= __('Payment methods', 'auctionforge') ?></span></a>
                    <div id="profile-payment-methods-section" class="bp-spoiler-block"></div>
                </div>
                <div id="bp-winnings" class="bp-tabs__block">
                    <a href="#" class="bp-visible bp-spoiler-trigger"><span><?= __('Winnings', 'auctionforge') ?></span></a>
                    <div id="profile-winnings-section" class="bp-spoiler-block"></div>
                </div>
                <?php if (SettingsHelper::getOption('enable_recently_viewed', 'off') === 'on') : ?>
                <div id="bp-recently-viewed" class="bp-tabs__block">
                    <a href="#" class="bp-visible bp-spoiler-trigger"><span><?= __('Recently Viewed', 'auctionforge') ?></span></a>
                    <div id="profile-recently-viewed-section" class="bp-spoiler-block"></div>
                </div>
                <?php endif; ?>
                <div id="bp-logout">
                    <a href="#logout" class="bp-visible bp-spoiler-trigger logoutLink"><span><?= __('Logout', 'auctionforge') ?></span></a>
                </div>
            </div>
        </div>
    </div>
</script>
<script type="text/template" id="profile-account-template">
    <div class="bp-col bp-d-flex bp-f-center">
        <div class="bp-user-state">
            <p class="title"><%- user.successMessage %></p>
        </div>
    </div>
    <div class="bp-tabs-block bp-col bp-hidden bp-d-flex bp-f-center">
        <form id="updateDetailsSection" action="<?= LotHelper::getPolyLangPermalink($pageAuctionListId) ?>" class="bp-from">
            <% _.forEach(fields, function(field, index) { %>
            <% if (field.type == 'phone') { %>
            <div id="addressField<%- index %>" class="bp-form-group <%- (field.hidden !== undefined) ? 'hidden' : '' %>">
                <div class="bp-form-group__inner bp-form-group__inline bp-form-group__list bp-form-group__phone">
                    <select style="width: 100%" <%- (field.required) ? 'required' : '' %> class="phoneCodeSelect" name="<%- index %>CountryCode" id="details<%-
                    index %>CountryCode"></select>
                    <input type="text" <%- (field.required) ? 'required' : '' %> placeholder="<%- bp_t(field.label) %> <%-
                    (field.required) ? '*' : '' %>" value="<%- field.value %>" class="bp-form-control" name="<%- index %>" id="profile<%- index %>">
                    <span class="bp-form-error hidden"></span>
                </div>
            </div>
            <% } else if (field.type == 'password') { %>
            <div id="addressField<%- index %>" class="bp-form-group bp-form-group_svg bp_show_password-action <%- (field.hidden !== undefined) ? 'hidden' : '' %>">
                <div class="bp-form-group__inner">
                    <input type="<%- field.type %>" <%- (field.required) ? 'required' : '' %> placeholder="<%- bp_t(field.label) %> <%-
                    (field.required) ? '*' : '' %>" value="<%- field.value %>" class="bp-form-control bp-form-control_eye" name="<%- index %>" id="profile<%- index %>">
                    <i class="bp_show_password svg-icon svg-eye"></i>
                    <span class="bp-form-error hidden"></span>
                </div>
            </div>
            <% } else if (field.type == 'email') { %>
            <div id="addressField<%- index %>" class="bp-form-group  bp-form-group_svg <%- (field.hidden !== undefined) ? 'hidden' : '' %>">
                <div class="bp-form-group__inner">
                    <input type="<%- field.type %>" disabled placeholder="<%- bp_t(field.label) %> <%-
                    (field.required) ? '*' : '' %>" value="<%- field.value %>" class="bp-form-control bp-form-control_email" name="<%- index %>" id="profile<%-
                    index %>">
                    <svg class="icon">
                        <use xlink:href="#pencil"></use>
                    </svg>
                    <span class="bp-form-error hidden"></span>
                </div>
            </div>
            <% } else if (field.type == 'select') { %>
            <div id="addressField<%- index %>" class="bp-form-group <%- (field.hidden !== undefined) ? 'hidden' : '' %>">
                <div class="bp-form-group__inner">
                    <select style="width: 100%" <%- (field.required) ? 'required' : '' %> name="<%- index %>" id="profile<%- index
                    %>"></select>
                    <span class="bp-form-error hidden"></span>
                </div>
            </div>
            <% } else { %>
            <div id="addressField<%- index %>" class="bp-form-group <%- (field.hidden !== undefined) ? 'hidden' : '' %>">
                <div class="bp-form-group__inner">
                    <input type="<%- field.type %>" <%- (field.required) ? 'required' : '' %> placeholder="<%- bp_t(field.label) %> <%-
                    (field.required) ? '*' : '' %>" value="<%- field.value %>" class="bp-form-control" name="<%- index %>" id="profile<%- index %>">
                    <span class="bp-form-error hidden"></span>
                </div>
            </div>
            <% } %>
            <% }); %>
            <div id="invitationsEnabled" class="bp-form-group bp-form-check bp-form-jc-start bp-lh-28">
                <input class="bp-form-check-input" name="isEnabled" id="isEnabled-field" type="checkbox">
                <label class="bp-form-check-label" for="isEnabled-field">
                    <?= sprintf(__('Allow "%s" to send me invitation for new auctions', 'auctionforge'), get_option('blogname')) ?>
                </label>
            </div>
            <div class="bp-form-group">
                <button id="sendUpdate" type="submit" class="bp-btn bp-btn-black"><?= __('Update', 'auctionforge') ?></button>
            </div>
            <div class="bp-form-group bp-text-right">
                <a id="optOutUser" class="bp-text bp-text-small"
                   href="<?= apply_filters("bs_data_subject_request_link", "https://bidspirit.com/ui/dataSubjectRequest?lang={$lang}") ?>"
                   rel="nofollow">
                    <?= __("Remove account", "auctionforge") ?>
                </a>
            </div>
        </form>
    </div>
</script>
<script type="text/template" id="profile-account-v2-template">
    <div class="bp-col bp-d-flex bp-f-center">
        <div class="bp-user-state">
            <p class="title"><%- user.successMessage %></p>
        </div>
    </div>
    <div class="bp-tabs-block bp-col bp-hidden bp-d-flex bp-f-center">
        <form id="updateDetailsSection" action="<?= LotHelper::getPolyLangPermalink($pageAuctionListId) ?>" class="bp-from">
            <% _.forEach(fields, function(field, index) { %>
                <% if (field.type == 'phone') { %>
                <div id="addressField<%- index %>" class="bp-form-group <%- (field.hidden !== undefined) ? 'hidden' : '' %>">
                    <div class="bp-form-group__inner bp-form-group__inline bp-form-group__list bp-form-group__phone">
                        <select style="width: 100%" <%- (field.required) ? 'required' : '' %> class="phoneCodeSelect" name="<%- index %>CountryCode" id="details<%-
                        index %>CountryCode"></select>
                        <input type="text" <%- (field.required) ? 'required' : '' %> placeholder="<%- bp_t(field.label) %> <%-
                        (field.required) ? '*' : '' %>" value="<%- field.value %>" class="bp-form-control" name="<%- index %>" id="profile<%- index %>">
                        <span class="bp-form-error hidden"></span>
                    </div>
                </div>
                <% } else if (field.type == 'password') { %>
                <div id="addressField<%- index %>" class="bp-form-group bp-form-group_svg bp_show_password-action <%- (field.hidden !== undefined) ? 'hidden' : '' %>">
                    <div class="bp-form-group__inner">
                        <input type="<%- field.type %>" <%- (field.required) ? 'required' : '' %> placeholder="<%- bp_t(field.label) %> <%-
                        (field.required) ? '*' : '' %>" value="<%- field.value %>" class="bp-form-control bp-form-control_eye" name="<%- index %>" id="profile<%- index %>">
                        <i class="bp_show_password svg-icon svg-eye"></i>
                        <span class="bp-form-error hidden"></span>
                    </div>
                </div>
                <% } else if (field.type == 'email') { %>
                <div id="addressField<%- index %>" class="bp-form-group  bp-form-group_svg <%- (field.hidden !== undefined) ? 'hidden' : '' %>">
                    <div class="bp-form-group__inner">
                        <input type="<%- field.type %>" disabled placeholder="<%- bp_t(field.label) %> <%-
                        (field.required) ? '*' : '' %>" value="<%- field.value %>" class="bp-form-control bp-form-control_email" name="<%- index %>" id="profile<%-
                        index %>">
                        <svg class="icon">
                            <use xlink:href="#pencil"></use>
                        </svg>
                        <span class="bp-form-error hidden"></span>
                    </div>
                </div>
                <% } else if (field.type == 'select') { %>
                <div id="addressField<%- index %>" class="bp-form-group <%- (field.hidden !== undefined) ? 'hidden' : '' %>">
                    <div class="bp-form-group__inner">
                        <select style="width: 100%" <%- (field.required) ? 'required' : '' %> name="<%- index %>" id="profile<%- index
                        %>"></select>
                        <span class="bp-form-error hidden"></span>
                    </div>
                </div>
                <% } else if (index === 'id' && (field.requireIdPhoto)) { %>
                <div id="addressField<%- index %>" class="bp-form-group <%- (field.hidden !== undefined) ? 'hidden' : '' %>">
                    <div class="bp-form-group__inner bp-mb-20">
                        <input type="<%- field.type %>" <%- (field.required) ? 'required' : '' %> placeholder="<%- bp_t(field.label) %> <%-
                        (field.required) ? '*' : '' %>" value="<%- field.value %>" class="bp-form-control" name="<%- index %>" id="profile<%- index %>">
                        <span class="bp-form-error hidden"></span>
                    </div>
                    <div id="deleteIdPhotoSection" class="bp-form-group__inner bp-form-group__file bp-d-flex bp-f-wrap bp-gap-1">
                        <label><?= __("Id photo", "auctionforge") ?><span class="bp-required">*</span></label>
                        <div class="bp-d-flex bp-f-between bp-d-flex bp-gap-1 bp-f-align-center">
                            <svg class="bp-icon bp-icon-green bp-mr-auto">
                                <use xlink:href="#check"></use>
                            </svg>
                            <button type="button" id="showIdPhoto" class="bp-btn bp-btn-icon bp-btn-sm">
                                <i class="svg-icon svg-eye"></i>
                                <?= __("Display", "auctionforge") ?>
                            </button>
                            <button type="button" id="deleteIdPhoto" class="bp-btn bp-btn-alert bp-btn-stretch">
                                <?= __("Delete", "auctionforge") ?>
                            </button>
                        </div>
                    </div>
                    <div id="uploadIdPhotoSection" class="bp-form-group__inner bp-form-group__file bp-d-flex bp-f-wrap bp-gap-1">
                        <label><?= __("Document photo", "auctionforge") ?>
                            <span class="bp-required"><%- (field.idPhotoUploadRequired) ? '*' : '' %></span>
                        </label>
                        <div class="bp-d-flex bp-f-between">
                            <input type="file" name="filePhotoId" id="uploadIdPhotoInput" <%- (!field.hasIdPhoto && field.idPhotoUploadRequired) ? 'required' : '' %>>
                            <button type="button" id="uploadPhotoIdAction" class="bp-btn bp-btn-default bp-btn-sm"><?= __("Upload", "auctionforge") ?></button>
                        </div>
                    </div>
                </div>
                <% } else { %>
                <div id="addressField<%- index %>" class="bp-form-group <%- (field.hidden !== undefined) ? 'hidden' : '' %>">
                    <div class="bp-form-group__inner">
                        <input type="<%- field.type %>" <%- (field.required) ? 'required' : '' %> placeholder="<%- bp_t(field.label) %> <%-
                        (field.required) ? '*' : '' %>" value="<%- field.value %>" class="bp-form-control" name="<%- index %>" id="profile<%- index %>">
                        <span class="bp-form-error hidden"></span>
                    </div>
                </div>
                <% } %>
            <% }); %>
            <div id="shippingFields" class="bp-form-group">
                <div class="bp-form-group__inner">
                    <input type="checkbox" checked name="shippingCheckbox" id="profileShippingCheckbox" class="bp-form-check-input">
                    <label for="profileShippingCheckbox" class="bp-form-group bp-form-check bp-form-jc-start bp-lh-28 bp-mb-0">
                        <?= __("My residential address is the same as the shipping address", "auctionforge") ?>
                    </label>
                </div>
            </div>
            <% if (shippingFields !== undefined) { %>
            <div id="wrpShippingField" class="wrp-bp-form-group shippingFields hidden">
                <% _.forEach(shippingFields, function(field, index) { %>
                <% if (field.type == 'select') { %>
                <div id="shippingField<%- index %>" class="bp-form-group <%- (field.hidden !== undefined) ? 'hidden' : '' %>">
                    <div class="bp-form-group__inner">
                        <select class="bp-shippingField" disabled
                                style="width: 100%" <%- (field.required) ? 'required' : '' %>
                                name="shipping.<%- index %>" id="shipping<%- index %>"></select>
                        <span class="bp-form-error hidden"></span>
                    </div>
                </div>
                <% } else { %>
                <div id="shippingField<%- index %>" class="bp-form-group <%- (field.hidden !== undefined) ? 'hidden' : '' %>">
                    <div class="bp-form-group__inner">
                        <input disabled type="<%- field.type %>" <%- (field.required) ? 'required' : '' %> placeholder="<%- bp_t(field.label) %> <%-
                        (field.required) ? '*' : '' %>" value="<%- field.value %>" class="bp-shippingField bp-form-control" name="shipping.<%- index %>"
                        id="shipping<%- index %>">
                        <span class="bp-form-error hidden"></span>
                    </div>
                </div>
                <% } %>
                <% }); %>
            </div>
            <% } %>
            <div id="invitationsEnabled" class="bp-form-group bp-form-check bp-form-jc-start bp-lh-28">
                <input class="bp-form-check-input" name="isEnabled" id="isEnabled-field" type="checkbox">
                <label class="bp-form-check-label" for="isEnabled-field">
                    <?= sprintf(__('Allow "%s" to send me invitation for new auctions', 'auctionforge'), get_option('blogname')) ?>
                </label>
            </div>
            <div class="bp-form-group">
                <button id="sendUpdate" type="submit" class="bp-btn bp-btn-black"><?= __('Update', 'auctionforge') ?></button>
            </div>
            <div class="bp-form-group bp-text-right">
                <a id="optOutUser" class="bp-text bp-text-small"
                   href="<?= apply_filters("bs_data_subject_request_link", "https://bidspirit.com/ui/dataSubjectRequest?lang={$lang}") ?>"
                   rel="nofollow">
                    <?= __("Remove account", "auctionforge") ?>
                </a>
            </div>
        </form>
    </div>
</script>
<script type="text/template" id="account-items-template">
    <div class="bp-row bp-row_profile bp-fix-width-lot">
        <div class="bp-lots bp-d-flex bp-f-wrap bp-f-center bp-md-f-around">
            <% let date = ""; %>
            <% _.forEach(items, function(lot, index) { %>
                <% if (date !== lot.auction.date) { %>
                    <div class="bp-lot-0 bp-lots__head">
                        <p class="bp-lot__date"><%= lot.auction.date %></p>
                    </div>
                    <% date = lot.auction.date %>
                <% } %>
                <% if ((lot.soldBid !== undefined && lot.soldBid.price !== undefined && lot.soldBid.isSold === true)
                || (lot.leadingBid !== undefined && lot.leadingBid.price !== undefined && lot.leadingBid.isSold === true)
                || (lot.item.wasInLiveAuction === true)) { %>
                    <div class="bp-lot" data-lot-index="<%- lot.lotIndex %>" data-lot-id="<%- lot.item.id %>" data-auction-number="<%- lot.item.auctionId %>">
                <% } else { %>
                    <% console.log("unsold", lot) %>
                    <div class="bp-lot" data-lot-index="<%- lot.lotIndex %>" data-lot-id="<%- lot.item.id %>" data-auction-number="<%- lot.item.auctionId %>">
                <% } %>
                    <a href="#" class="bp-lot__wrp-image" style="background-color: <%- bgColor %>">
                        <% if (lot.thumbnail !== undefined) { %>
                            <div class="bp-lot__image" style="background-image:url(<%- lot.thumbnail %>);">
                        <% } else { %>
                            <div class="bp-lot__image" style="background-image:url(<%- imageBlank %>);">
                        <% } %>
                        </div>
                    </a>
                    <div class="bp-lot__content">
                        <% if (lot.isFavorite) {%>
                            <span class="bp__wishlist bp__wishlist-active"></span>
                        <% } else { %>
                            <span class="bp__wishlist"></span>
                        <% } %>
                        <div class="bp-lot__content_inner">
                            <div class="bp-lot__title">
                                <a href="#"><span class="bp-title"><?= __('Lot', 'auctionforge') ?>&nbsp;<%- lot.item.itemIndex %>:</span></a>
                                <article>
                                    <div><a href="#"><strong><%- lot.item.name %></strong></a></div>
                                    <%= smartCut(lot.item.description, 20) %>
                                </article>
                            </div>
                            <div class="bp-lot__message">
                                <% if (lot.leadingBid && !lot.leadingBid.isSelf && lot.selfAbsenteeBid) { %>
                                <p class="bp-lot__message-inner bp-text-red bp-lot__message-you_bid">
                                    <?= __ ('Your bid of', 'auctionforge') ?> <%- formattedPrice(lot.selfAbsenteeBid.price, currency) %> <?= __('has been outbid by a higher bid', 'auctionforge') ?>
                                </p>
                                <% } else if (lot.leadingBid && lot.leadingBid.isSelf && lot.selfAbsenteeBid) { %>
                                <p class="bp-lot__message-inner bp-text-green bp-lot__message-you_bid">
                                    <?= __('Your max absentee bid', 'auctionforge') ?>: <%- formattedPrice(lot.selfAbsenteeBid.price, currency) %>
                                </p>
                                <% } %>
                            </div>
                        </div>
                        <div class="bp-lot__tool_wrapper">
                            <% if (!lot.item.removedFromAuction) { %>
                            <div class="bp-lot__bid_wrapper bp-form-group">
                                <?php //TODO: Next feature #H91 task ?>
                                <div class="bp-form-group__inner js-data-bid-list-dis">
                                    <!--<input type="text" value="" class="bp-form-control" name="" id="">
                                    <span class="bp-form-error hidden"></span>-->
                                </div>
                            </div>
                            <% } %>
                            <% if (lot.leadingBid !== undefined && !lot.leadingBid.isSold && !lot.item.removedFromAuction) { %>
                                <% if (lot.leadingBid.isSelf) { %>
                                    <div class="bp-lot__tool bp-lead bp-bg-green">
                                <% } else if (lot.leadingBid && !lot.leadingBid.isSelf && lot.selfAbsenteeBid) { %>
                                    <div class="bp-lot__tool bp-lead bp-bg-red">
                                <% } else { %>
                                    <div class="bp-lot__tool bp-lead">
                                <% } %>
                                <% if (lot.leadingBid.isSelf) { %>
                                    <p class="bp-subtitle"><?= __('Your leading bid', 'auctionforge') ?>:</p>
                                <% } else {%>
                                    <p class="bp-subtitle"><?= __('Leading bid', 'auctionforge') ?>:</p>
                                <% } %>
                                <p class="bp-price"><%- formattedPrice(lot.leadingBid.price, currency) %></p>
                            </div>
                            <% } else if (lot.leadingBid !== undefined && lot.leadingBid.isSold && lot.soldBid !== undefined && !lot.item.removedFromAuction) { %>
                                <% if (lot.soldBid.isSelf) { %>
                                    <div class="bp-lot__tool bp-lead bp-bg-green">
                                        <p class="bp-subtitle"><?= __('Sold to you for', 'auctionforge') ?>:</p>
                                        <p class="bp-price"><%- formattedPrice(lot.soldBid.price, currency) %></p>
                                <% } else if (!lot.soldBid.isSelf) { %>
                                    <div class="bp-lot__tool bp-lead bp-bg-blue">
                                        <p class="bp-subtitle"><?= __('Sold for', 'auctionforge') ?>:</p>
                                        <p class="bp-price"><%- formattedPrice(lot.soldBid.price, currency) %></p>
                                <% } %>
                                </div>
                            <% } else if (!!lot.item.removedFromAuction) { %>
                                <div class="bp-lot__tool">
                                    <div class="bp-alert bp-alert-small bp-alert-radius-0 alert bp-alert-danger alert-primary" role="alert">
                                        <p><?= __("Lot was removed from auction", "auctionforge") ?></p>
                                    </div>
                                </div>
                            <% } else { %>
                                <div class="bp-lot__tool">
                                    <p class="bp-subtitle"><?= __('Start price', 'auctionforge') ?>:</p>
                                    <p class="bp-price"><%- formattedPrice(lot.startPrice, currency) %></p>
                                </div>
                            <% } %>
                        </div>
                    </div>
                </div>
            <% }); %>
        </div>
    </div>
</script>
<script type="text/template" id="recently-viewed-items-template">
    <div class="bp-row bp-row_profile bp-fix-width-lot">
        <div class="bp-recently-viewed-header bp-d-flex bp-f-between bp-f-center bp-mb-15">
            <p class="bp-title bp-mb-0"><?= __('Recently Viewed Items', 'auctionforge') ?></p>
            <a href="#" id="bp-clear-view-history" class="bp-btn bp-btn-sm bp-btn-outline"><?= __('Clear History', 'auctionforge') ?></a>
        </div>
        <div class="bp-lots bp-d-flex bp-f-wrap bp-f-center bp-md-f-around">
            <% _.forEach(items, function(lot, index) { %>
                <div class="bp-lot" data-post-id="<%- lot.post_id %>" data-term-id="<%- lot.term_id %>" data-lot-id="<%- lot.bidspirit_lot_id %>" data-auction-number="<%- lot.bidspirit_auction_id %>">
                    <a href="<%- lot.permalink %>" class="bp-lot__wrp-image" style="background-color: <%- bgColor %>">
                        <% if (lot.thumbnail) { %>
                            <div class="bp-lot__image" style="background-image:url(<%- lot.thumbnail %>);"></div>
                        <% } else { %>
                            <div class="bp-lot__image" style="background-image:url(<%- imageBlank %>);"></div>
                        <% } %>
                    </a>
                    <div class="bp-lot__content">
                        <span class="bp__wishlist"></span>
                        <div class="bp-lot__content_inner">
                            <div class="bp-lot__title">
                                <a href="<%- lot.permalink %>"><span class="bp-title"><?= __('Lot', 'auctionforge') ?>&nbsp;<%- lot.lot_index %>:</span></a>
                                <article>
                                    <div><a href="<%- lot.permalink %>"><strong><%- lot.lot_name %></strong></a></div>
                                    <% if (lot.lot_description) { %>
                                        <%- smartCut(lot.lot_description, 20) %>
                                    <% } %>
                                </article>
                            </div>
                            <div class="bp-lot__message">
                                <% if (lot.estimated_price) { %>
                                <p class="bp-lot__message-inner bp-lot__message-you_bid">
                                    <?= __('Estimate', 'auctionforge') ?>: <%- lot.estimated_price %>
                                </p>
                                <% } %>
                                <p class="bp-lot__message-inner bp-lot__message-you_bid bp-rv-bid-info" style="display:none;"></p>
                            </div>
                        </div>
                        <div class="bp-lot__tool_wrapper">
                            <% if (lot.sold_bid > 0) { %>
                                <div class="bp-lot__tool bp-lead bp-bg-blue">
                                    <p class="bp-subtitle"><?= __('Sold for', 'auctionforge') ?>:</p>
                                    <p class="bp-price"><%- formattedPrice(lot.sold_bid, currency) %></p>
                                </div>
                            <% } else if (lot.leading_bid > 0) { %>
                                <div class="bp-lot__tool bp-lead bp-bg-green">
                                    <p class="bp-subtitle"><?= __('Leading bid', 'auctionforge') ?>:</p>
                                    <p class="bp-price"><%- formattedPrice(lot.leading_bid, currency) %></p>
                                </div>
                            <% } else if (lot.start_price > 0) { %>
                                <div class="bp-lot__tool bp-lead">
                                    <p class="bp-subtitle"><?= __('Start price', 'auctionforge') ?>:</p>
                                    <p class="bp-price"><%- formattedPrice(lot.start_price, currency) %></p>
                                </div>
                            <% } %>
                        </div>
                    </div>
                </div>
            <% }); %>
        </div>
    </div>
</script>
<script type="text/template" id="account-empty-template">
    <div class="bp-row bp-fix-width-lot">
        <div class="bp-d-flex bp-f-wrap bp-f-center bp-mb-30">
            <p><%- message %></p>
        </div>
    </div>
</script>
<script type="text/template" id="account-link-profile">
    <% if (login) {%>
    <a href="<?= $profileLink ?>" class="bp-login-link">
        <i class="icon-user"></i> <span><?= __('Profile', 'auctionforge') ?></span>
    </a>
    <% } else { %>
    <a href="#" class="bp-login-link" data-micromodal-trigger="modal-login">
        <i class="icon-user"></i> <span><?= __('Login', 'auctionforge') ?></span>
    </a>
    <% } %>
</script>
<script type="text/template" id="account-link-register">
    <% if (!login) {%>
    <a href="#" class="bp-login-link" data-micromodal-trigger="modal-register">
        <span><?= __('Register', 'auctionforge') ?></span>
    </a>
    <% } %>
</script>
<script type="text/template" id="main-notice-template">
    <div class="bp-container">
        <div class="bp-row">
            <% if (type === 'PENDING') { %>
            <div class="bp-col bp-alert alert bp-alert-danger alert-primary bp-text-center bp-mt-10" role="alert">
                <p><?= __('Your account is pending approval. You will receive an email when you are approved to bid.', 'auctionforge') ?></p>
            </div>
            <% } else if (type === 'INCOMPLETE_PROFILE') { %>
                <% if (emailConfirmed !== undefined && emailConfirmed === true) { %>
                    <div class="bp-col bp-alert alert bp-alert-danger alert-primary bp-text-center bp-mt-10" role="alert">
                        <p><?= __('Please complete your registration to participate in our auctions.', 'auctionforge') ?> <a href="<?= $profileLink ?>"><strong><?= __('Profile', 'auctionforge') ?></strong></a></p>
                    </div>
                <% } else if (emailConfirmed === false) { %>
                    <div class="bp-col bp-alert alert bp-alert-danger alert-primary bp-text-center bp-mt-10" role="alert">
                        <p><?= __('Please complete your registration to participate in our auctions. <a href=\'#\' id=\'resendEmailSection\'>Resend email</a>.', 'auctionforge') ?></p>
                    </div>
                <% } %>
            <% } %>
        </div>
    </div>
</script>