<?php

use auctionforge\inc\controllers\BidspiritLots;

$auctionId = 0;
$inTaxonomy = false;
if (is_archive() && is_tax(BidspiritLots::TAX_AUCTION_TYPE)) {
    $auction = get_queried_object();
    if ($auction instanceof WP_Term) {
        $inTaxonomy = true;
        $auctionId = $auction->term_id;
    }
}
?>
<div class="bp-modal modal micromodal-slide top-content-modal modal-max-width" id="modal-search" aria-hidden="true">
    <div class="modal__overlay" tabindex="-1" data-micromodal-close>
        <div class="modal__overlay__inner" tabindex="-1">
            <button class="modal__close" aria-label="Close modal" data-micromodal-close></button>
            <div class="modal__container">
                <header class="modal__header">
                    <h2 class="modal__title modal__title_without-logo" id="modal-search-title">
                        <?= __('Search', 'auctionforge') ?>
                    </h2>
                </header>
                <main class="modal__content" id="modal-search-content">
                    <div class="errors-group bp-text-red hidden"></div>
                    <form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>" class="bp-from bp-search">
                        <div class="bp-form-group">
                            <div class="bp-form-group__inner bp-form-group__inner-search">
                                <input type="text" required placeholder="<?= __('Search') ?>" class="bp-form-control" name="s" id="s">
                                <?php if ($inTaxonomy) { ?>
                                    <input type="hidden" value="<?= $auctionId ?>" name="taxonomy">
                                <?php } ?>
                                <span class="bp-form-error hidden"></span>
                                <button id="sendSearch" type="submit" class="bp-btn bp-btn-search bp-form-control__inline-btn"></button>
                            </div>
                        </div>
                    </form>
                </main>
                <footer class="modal__footer"></footer>
            </div>
        </div>
    </div>
</div>