{extends "actions/action.tpl"}

{block "action"}
   <div class="form-group">
      <div class="col-md-3 control-label"><label>{'productDiscount'|translate}</label></div>
      <div class="col-md-4">
         <div class="input-group">
            <input type="number" min=0 step="0.001" class="form-control input-sm" name="{$name}[data][discount]" maxlength="11" value="{$data.discount}" required>
            <span class="input-group-addon" style="padding: 0px; border: 0px; min-width: 50px;">
               <select name="{$name}[data][unit]" class="selecter">
                  <option value="perc" {'perc'|selected:$data.unit}>%</option>
                  {get_contexts currency=1 assign='contexts'}
                  {foreach $contexts.currency->getAll() as $currency}
                     <option value="{$currency->getId()}" {$currency->getId()|selected:$data.unit}>{$currency->getId()}</option>
                  {/foreach}
               </select>
            </span>
         </div>
      </div>
      <div class="col-md-1 control-label"><label>{'vat'|translate:'vat'}</label></div>
      <div class="col-md-4">
         <select name="{$name}[data][vat]" class="selecter" id="priceVat">
            <option value="" data-vat="0" {if is_null($body.data.vat)}selected{/if}>{'byProducts'|translate:'vats'}</option>
            {foreach from=$vats item=vat key=key}
               <option value="{$vat.id}" data-vat="{$vat.vat}" {if $data.vat == $vat.id}selected{/if}>
                  {$vat.descr}
               </option>
            {/foreach}
         </select>
      </div>
   </div>
   <div class="form-group">
      <div class="col-md-10 col-md-offset-3">
         <input type="hidden" name="{$name}[data][combine]" value="N">
         <div class="checkbox">
            {$combine = $data.combine|default:"Y"}
            <input id="{$name}_combine" class="check" type="checkbox" name="{$name}[data][combine]"
                   value="Y" {if $combine == "Y"}checked{/if} />
            <label for="{$name}_combine">{'discountAdd'|translate:'OrderDiscounts'}</label>&nbsp;
            <a class="help-tip" data-toggle="tooltip"
               title="{'discountAddTooltip'|translate:'OrderDiscounts'}"><i class="bi bi-question-circle"></i></a>
         </div>
      </div>
   </div>
   <div class="form-group">
      <div class="col-md-10 col-md-offset-3">
         <input type="hidden" name="{$name}[data][divideDiscountPrice]" value="N">
         <div class="checkbox">
            {$divideDiscountPrice = $object->getDivideDiscountPrice($data)}
            <input id="{$name}_divide" class="check" type="checkbox" name="{$name}[data][divideDiscountPrice]"
                   value="Y" {if $divideDiscountPrice}checked{/if} />
            <label for="{$name}_divide">{'divideDiscountPrice'|translate:'OrderDiscounts'}</label>
         </div>
      </div>
   </div>

   {include 'block.productsFilter.tpl' filter_size=2 filter=$data.filter filterName=$name filterInputName=$name|cat:'[data][filter]'}
{/block}
