<?php
/** @var \Magetop\Advancepreview\Block\Order\CustomOrders $block */
//echo get_class($block);
$months = [
    1=>'January',
    2=>'February',
    3=>'March',
    4=>'April',
    5=>'May',
    6=>'June',
    7=>'July',
    8=>'August',
    9=>'September',
    10=>'October',
    11=>'November',
    12=>'December',
];
$txtIncre = $block->getRequest()->getParam('custom_increment_id','');
$txtMonth = $block->getRequest()->getParam('custom_month','');
$txtYear = $block->getRequest()->getParam('custom_year','');
//$txtProjectName = $block->getRequest()->getParam('project_name','');
$fromDate =  $block->getRequest()->getParam('from_date','');
$toDate =  $block->getRequest()->getParam('to_date','');
$dateRage = $block->getRequest()->getParam('date_range','');

?>
<div class="preview-custom-header">
    <form id="form-custom-order" method="get" action="<?php echo $block->getUrl('sales/order/history'); ?>" enctype="multipart/form-data">
        <div class="custom-header-col">
            <input type="text" name="custom_increment_id" value="<?php echo $txtIncre; ?>" id="txt-custom-increment-id" placeholder="<?php echo __('Search Order'); ?>">
        </div>
        <div class="custom-header-col">

            <input type="text" name="date_range" value="" id="txt-date-range" placeholder="<?php echo __('Date range'); ?>">
            <input type="hidden" id="txt-tmp-date-rage" value="<?php echo $dateRage; ?>">
            <input type="hidden" name="from_date" value="<?php echo $fromDate; ?>" id="txt-from-date" placeholder="">
            <input type="hidden" name="to_date" value="<?php echo $toDate; ?>" id="txt-to-date" placeholder="">
        </div>
        <div class="custom-header-col">
            <select id="txt-custom-year" name="custom_year">
                <option value=""><?php echo __('Select year') ?></option>
                <?php for ($i = 2022;$i <= 2035; $i++) : ?>
                    <option value="<?php echo $i ?>" <?php echo $txtYear == $i ? 'selected="selected"' : ''; ?>><?php echo $i ?></option>
                <?php endfor; ?>
            </select>
        </div>
        <div class="custom-header-col">
            <select id="txt-custom-month" name="custom_month">
                <option value=""><?php echo __('Select month') ?></option>
                <?php foreach ($months as $key => $month) : ?>
                    <option value="<?php echo $key ?>" <?php echo $txtMonth == $key ? 'selected="selected"' : ''; ?>><?php echo $month ?></option>
                <?php endforeach ?>
            </select>
        </div>
    </form>
</div>
