{extends file="menu.tpl"}

{block name="menu-items"}
   <li class="nav-header"><i class="glyphicon glyphicon-tags"></i><span>{translate_type type=$type}</span></li>
   <li><a href="javascript:nf('launch.php?s=menu.php&type=Returns', 'launch.php?s=list.php&amp;type=Returns');"><i class="glyphicon glyphicon-list"></i> <span>{'toolbar_list'|translate:'Returns'}</span></a></li>
   <li><a href="javascript:nf('launch.php?s=menu.php&type=ReturnsMassModification', 'launch.php?s=list.php&amp;type=ReturnsMassModification');"><i class="glyphicon glyphicon-list"></i> <span>{'toolbar_massmodif'|translate:'Returns'}</span></a></li>

   <li class="nav-header smaller"><i class="glyphicon glyphicon-search"></i><span>{'search'|translate:'Returns'}</span></li>
   <li class="with_caret "><a href="#" class="opener"><span>{'filterBasic'|translate:'Returns'}</span></a></li>
   <li class="pill-content">
      <ul class="nav-sub nav-pills">
         <form id='search' target="mainFrame" method="get" action="launch.php" class="form-inline">
            <input type="hidden" name="type" value="{$type}" /><input type="hidden" name="s" value="list.php">

            <div class="wpj-form-group">
               <div class="input-group invert">
                  <input type="text" name="code" class="form-control input-sm" placeholder="{'searchCode'|translate:'Returns'}">
                   {inversion field="code"}
               </div>
            </div>

            <div class="wpj-form-group">
               <div class="input-group invert">
                  <select name="status[]" multiple="multiple" class="selecter" data-placeholder="{'selectStatus'|translate:'Returns'}">
                      {foreach $statuses as $key => $value}
                         <option value="{$key}">{$value}</option>
                      {/foreach}
                  </select>
                   {inversion field="status"}
               </div>
            </div>

             {ifmodule CURRENCIES}
            <div class="wpj-form-group">
                   <div class="input-group invert">
                     <select name="currency[]" multiple="multiple" class="selecter" data-placeholder="{'selectCurrency'|translate:'Returns'}">
                          {get_contexts currency=1 assign='contexts'}
                          {foreach $contexts.currency->getAll() as $currency}
                             <option value="{$currency->getId()}">{$currency->getId()}</option>
                          {/foreach}
                      </select>
                       {inversion field="currency"}
                   </div>
                </div>
             {/ifmodule}

            {ifmodule STORES}
               <div class="wpj-form-group">
                  <div class="input-group invert">
                     <select name="stores[]" multiple="multiple" class="selecter" data-placeholder="{'selectStore'|translate:'Returns'}"
                        data-autocomplete="stores">
                     </select>
                     {inversion field="stores"}
                  </div>
               </div>
            {/ifmodule}

            <div class="form-group">
               <div class="input-group">
                  <input id="createdFrom" data-filter-type="input" type="text" class="form-control"
                         name="date_range[from]" value="{$filter.date_added_range.from}"
                         placeholder="{'createdFrom'|translate:'Returns'}" autocomplete="off"/>
                   {insert_calendar selector="#createdFrom" format='date'}
                  <label for="createdFrom" class="input-group-addon">
                     <span class="bi bi-calendar-week"></span>
                  </label>
               </div>
            </div>

            <div class="wpj-form-group">
               <div class="input-group">
                  <input id="createdTo" data-filter-type="input" type="text" class="form-control"
                         name="date_range[to]" value="{$filter.date_added_range.from}"
                         placeholder="{'createdTo'|translate:'Returns'}" autocomplete="off"/>
                   {insert_calendar selector="#createdTo" format='date'}
                  <label for="createdTo" class="input-group-addon">
                     <span class="bi bi-calendar-week"></span>
                  </label>
               </div>
            </div>

            <div class="form-group">
               <div class="input-group">
                  <input id="acceptedFrom" data-filter-type="input" type="text" class="form-control"
                         name="date_range[accepted_from]" value="{$filter.date_added_range.accepted_from}"
                         placeholder="{'acceptedFrom'|translate:'Returns'}" autocomplete="off"/>
                   {insert_calendar selector="#acceptedFrom" format='date'}
                  <label for="acceptedFrom" class="input-group-addon">
                     <span class="bi bi-calendar-week"></span>
                  </label>
               </div>
            </div>

            <div class="wpj-form-group">
               <div class="input-group">
                  <input id="acceptedTo" data-filter-type="input" type="text" class="form-control"
                         name="date_range[accepted_to]" value="{$filter.date_added_range.accepted_from}"
                         placeholder="{'acceptedTo'|translate:'Returns'}" autocomplete="off"/>
                   {insert_calendar selector="#acceptedTo" format='date'}
                  <label for="acceptedTo" class="input-group-addon">
                     <span class="bi bi-calendar-week"></span>
                  </label>
               </div>
            </div>

            <div class="wpj-form-group">
                   <div class="input-group invert">
                     <select name="id_admin[]" multiple="multiple" class="selecter" data-placeholder="{'admin'|translate:'Returns'}">
                        {get_admins assign=admins}
                         {foreach $admins as $id => $admin}
                            <option value="{$id}">{$admin.login}</option>
                         {/foreach}
                      </select>
                       {inversion field="id_admin"}
                   </div>
             </div>

            <div class="form-group">
               <div class="input-group invert">
                  <input type="text" name="customer" class="form-control input-sm" placeholder="{'customer'|translate:'Returns'}">
                  {inversion field="customer"}
               </div>
            </div>


            <div class="form-group">
               <div class="input-group invert">
                  <select name="id_flag_or[]" multiple="multiple" class="selecter" data-placeholder="{'selectFlag'|translate:"orders"}">
                     {foreach $cfg.Returns.Flags as $flag => $flagData}
                        <option value="{$flag}">{$flagData.name}</option>
                     {/foreach}
                  </select>
                  {inversion field="id_flag_or"}
               </div>
            </div>

            <div class="form-group">
               <div class="input-group invert">
                  <select name="reasons[]" multiple="multiple" class="selecter" data-placeholder="{'return_reason'|translate}">
                     {foreach $reasons as $key => $value}
                         <option value="{$key}">{$value}</option>
                      {/foreach}
                  </select>
                  {inversion field="reasons"}
               </div>
            </div>

            <div class="form-group">
               <div class="input-group invert">
                  <input type="text" name="returnLabel" class="form-control input-sm" placeholder="{'searchReturnLabel'|translate:'Returns'}">
                  {inversion field="returnLabel"}
               </div>
            </div>

            <div class="form-group">
               <input id="do_not_stock_in" type="checkbox" data-filter-type="checkbox"
                      name="do_not_stock_in" value="Y" class="check"
               <label for="only_not_discounted">{'do_not_stock_in'|translate:'Returns'}</label>
            </div>

            <div class="form-group">
               <input type="reset" id="resetBtn" value="{'delete'|translate:'Returns'}" class="btn btn-danger btn-sm"/>
               <input type="submit" value="{'searchBtn'|translate:'Returns'}" class="btn btn-primary btn-sm"/>
            </div>

         </form>
      </ul>
   </li>
   <li class="with_caret "><a href="#" class="opener"><span>{'filterByProduct'|translate:"Returns"}</span></a></li>
   <li class="pill-content hidden">
      <div class="nav-sub productfilter-nav">
         <form target="mainFrame" method="get" action="launch.php" class="form-inline ">
             {include 'block.productsFilter.tpl' filter=$data.filter filterEnabled=true}
            <div class="form-group">
               <input type="reset" id="resetBtn" value="{'delete'|translate:"orders"}" class="btn btn-danger btn-sm"/>
               <input type="submit" value="{'searchBtn'|translate:"orders"}" class="btn btn-primary btn-sm"/>
               <input type="hidden" name="s" value="list.php">
               <input type="hidden" name="type" value="{$type}"/>
            </div>
         </form>
      </div>
   </li>
{/block}
