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

{block js}
   {$smarty.block.parent}
{/block}

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

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

      {if $body.acn == "edit"}
         <h1 class="h4 main-panel-title">{'titleEdit'|translate}</h1>
      {else}
         <h1 class="h4 main-panel-title">{'titleAdd'|translate}</h1>
      {/if}
      <div class="form-group form-group-flex">
         <label class="col-md-2 control-label">
            {'name'|translate}
         </label>
         <div class="col-md-3">
            <input name="data[name]" class="form-control input-sm" value="{$body.data.name}">
         </div>
         <label class="col-md-2 control-label">
           {'code'|translate}
         </label>
         <div class="col-md-2">
            <input name="data[id]" class="form-control input-sm" maxlength="3" value="{$body.data.id}">
         </div>
         <label class="col-md-2 control-label">
            {'symbol'|translate}
         </label>
         <div class="col-md-2">
            <input name="data[symbol]" class="form-control input-sm" value="{$body.data.symbol}">
         </div>
      </div>

      <!-- //////////////////////////////// -->

      <div class="row bottom-space">
         <div class="col-md-12">
            <h1 class="h4 main-panel-title">{'PricesOfGoods'|translate}</h1>
         </div>
      </div>

      <div class="row">

         <div class="col-md-6">

            <div class="form-group">
               <div class="col-md-6 control-label"><label>{'price_round_direction'|translate}</label></div>
               <div class="col-md-6">
                  <select name="data[price_round_direction]" class="selecter">
                     {foreach from=$body.directions item=direction key=key}
                        <option value="{$key}" {if $key==$body.data.price_round_direction}selected{/if}>{$direction}</option>
                     {/foreach}
                  </select>
               </div>
            </div>

            <div class="form-group form-group-flex">
               <div class="col-md-6 control-label"><label>{'price_round'|translate}</label></div>
               <div class="col-md-6">
                  <select name="data[price_round]" class="selecter">
                     {foreach from=$body.rounds item=round key=key}
                        <option value="{$key}" {if $key==$body.data.price_round}selected{/if}>{$round}</option>
                     {/foreach}
                  </select>
               </div>
            </div>

            <div class="form-group form-group-flex">
               <div class="col-md-6 control-label"><label>{'price_round_order'|translate}</label></div>
               <div class="col-md-6">
                  <select name="data[price_round_order]" class="selecter">
                     {foreach from=$body.rounds item=round key=key}
                        <option value="{$key}" {if $key==$body.data.price_round_order}selected{/if}>{$round}</option>
                     {/foreach}
                  </select>
               </div>
            </div>
         </div>

         <div class="col-md-6">
            <div class="form-group form-group-flex">
               <div class="col-md-6 control-label"><label>{'price_decimal_mark'|translate}</label></div>
               <div class="col-md-6">
                  <select name="data[price_decimal_mark]" class="selecter">
                     {foreach from=$body.mark item=mark key=key}
                        <option value="{$key}" {if $key==$body.data.price_decimal_mark}selected{/if}>{$mark}</option>
                     {/foreach}
                  </select>
               </div>
            </div>



            <div class="form-group">
               <div class="col-md-6 control-label"><label>{'price_precision'|translate}</label></div>
               <div class="col-md-6">
                  <select name="data[price_precision]" class="selecter">
                     {foreach from=$body.precisions item=precision key=key}
                        <option value="{$key}" {if $key==$body.data.price_precision}selected{/if}>{$precision}</option>
                     {/foreach}
                  </select>
               </div>
            </div>

            <div class="form-group">
               <div class="col-md-6 control-label"><label>Baťovské ceny</label></div>
               <div class="col-md-6">
                  <select name="data[bata]" class="selecter">
                     <option value="">ne</option>
                     <option value="1" {if $body.data.bata == 1}selected{/if}>9,-</option>
                     <option value="0.1" {if $body.data.bata == 0.1}selected{/if}>9,90</option>
                     <option value="0.01" {if $body.data.bata == 0.01}selected{/if}>9,99</option>
                  </select>
               </div>
            </div>

         </div>

      </div>

      {if findModule('currencies') && $body.acn != 'add'}
         <div class="row bottom-space">
            <div class="col-md-12">
               <h1 class="h4 main-panel-title">{'Exchange'|translate}</h1>
            </div>
         </div>
         <div class="form-group">
            <div class="col-md-2 control-label two-lines">
               <label>{'currencies_update'|translate}</label>
               <a class="help-tip" data-toggle="tooltip" title="{'currencies_update_info'|translate}"><i class="bi bi-question-circle"></i></a>
            </div>
            <div class="col-md-1">
               {print_toggle name="sync"}
            </div>
            {if $body.data.sync == 'Y'}
               <div class="col-md-4 control-label">
                  <label>{'update_date'|translate}{$body.data.sync_date_update|date_format:"%e.%m.%Y %H:%M:%S"}</label>
               </div>
               <div class="col-md-3">
                  <button type="submit" class="btn btn-success btn-block" name="acn" value="syncCNB" title="Sesynchonizovat nyní">Sesynchonizovat nyní</button>
               </div>
            {/if}
         </div>
         <div class="form-group">
            <div class="col-md-3 col-md-offset-2">
               <label>{'currency_value'|translate} {$body.defaultCurrency}</label>
            </div>
            {if $body.data.sync == 'Y'}
               <div class="col-md-2">
                  <label>{'currency_corrections'|translate}</label>
                  <a class="help-tip" style="position: static;margin-left: 3px;" data-toggle="tooltip" title="{'currency_corrections_info'|translate}"><i
                        class="bi bi-question-circle"></i></a>
               </div>
            {/if}
         </div>
         <div class="form-group">
            <div class="col-md-2 control-label"><label>{$body.data.name} ({$body.data.symbol})</label></div>
            <div class="col-md-3">
               <div class="input-group">
                  <input type="text" class="form-control input-sm" name="data[rate]" size="30" maxlength="255" value="{$body.data.rate}">
                  <span class="input-group-addon">{$body.defaultSymbol}</span>
               </div>
            </div>
            {if $body.data.sync == 'Y'}
               <div class="col-md-2">
                  <div class="input-group">
                     <input type="text" class="form-control input-sm" name="data[corrections]" size="30" maxlength="255" value="{$body.data.corrections}">
                     <span class="input-group-addon">{$body.data.symbol}</span>
                  </div>
               </div>
            {/if}
         </div>
      {/if}

      <div class="row bottom-space">
         <div class="col-md-12">
            <h1 class="h4 main-panel-title">{'billing_info'|translate}</h1>
         </div>
      </div>
      <div class="form-group">
         <div class="col-md-2 control-label">
            <label>{'bank_iban'|translate}</label>
         </div>
         <div class="col-md-3">
            <input type="text" class="form-control input-sm" name="data[data][bank_iban]" size="30" maxlength="30"
                   value="{$body.data.data.bank_iban}">
         </div>
         <div class="col-md-2 control-label">
            <label>{'bank_swift'|translate}</label>
         </div>
         <div class="col-md-3">
            <input type="text" class="form-control input-sm" name="data[data][bank_swift]" size="11" maxlength="11"
                   value="{$body.data.data.bank_swift}">
         </div>
      </div>
      <div class="form-group">
         <div class="col-md-2 control-label">
            <label>{'bank_account'|translate}</label>
         </div>
         <div class="col-md-3">
            <input type="text" class="form-control input-sm" readonly size="30" maxlength="30" value="{$body.data.bank_account}">
         </div>
      </div>

   </div>
{/block}
