{extends "[shared]/window.tpl"}

{block tabs}
   {windowTab id='flapMain'}
{/block}

{block tabsContent}
   <div id="flapMain" class="tab-pane fade active in boxFlex">

      <div class="form-group">
         <label for="code" class="col-md-2 control-label">
            {'productBatch'|translate}
         </label>
         <div class="col-md-5">
            <input type="text" class="form-control" id="code" maxlength="100" name="data[code]" value="{$body.data.code}"/>
         </div>
      </div>

      <div class="form-group">
         <label for="code" class="col-md-2 control-label">
            {'dateExpiry'|translate}
         </label>
         <div class="col-md-5">
             <input type="text" class="form-control " name="data[date_expiry]" id="date_issued" value="{$body.data.date_expiry|format_date:'admin'}" autocomplete="off" />
               {insert_calendar selector='#date_issued' format='date'}
         </div>
      </div>

      <div class="form-group">
         <label for="code" class="col-md-2 control-label">
            {'product'|translate}
         </label>
         {if empty($body.data.id_product)}
            <div class="col-md-5">
               <input type="text" class="form-control input-sm" id="id_product" name="data[id_product]" maxlength="100"
                      value="{$body.data.id_product}" onKeyPress="checkInputData('int')"
                      placeholder="{'searchNameCode'|translate:'orders'}"/>
            </div>
            <div class="col-md-4">
               <select id="id_variation" name="data[id_variation]" class="input-sm form-control selecter"></select>
               <script type="text/javascript">
                  $(function () {
                     initAutocompleteVariation('#id_product', '#id_variation');
                  });
               </script>
            </div>
         {else}
            <div class="col-md-4">
               <p class="input-height"><a href="javascript:nw('product', {$body.data.id_product})">{$body.data.product_title} </a></p>
            </div>
            <div class="col-md-2 control-label"><label>Varianta</label></div>
            <div class="col-md-3">
               <p class=" input-height">{if $body.data.id_variation}{$body.data.variation_title}{else}Nemá{/if}</p>
            </div>
            <input type="hidden" name="data[id_product]" value="{$body.data.id_product}"/>
            <input type="hidden" name="data[id_variation]" value="{$body.data.id_variation}"/>
         {/if}
      </div>

   </div>
{/block}
