{if {find_module name='orders'}}
   <div class="row">
      <div class="col-md-5">
         <div class="form-group">
            <div class="col-md-8 control-label"><label>{'prod_subtract_from_store'|translate}</label></div>
            <div class="col-md-4">
               {print_toggle name="prod_subtract_from_store"}
            </div>
         </div>
         <div class="form-group">
            <div class="col-md-8 control-label"><label>{'prod_show_not_in_store'|translate}</label></div>
            <div class="col-md-4">
               {print_toggle name="prod_show_not_in_store"}
            </div>
         </div>
         <div class="form-group">
            <div class="col-md-8 control-label"><label>{'prod_sell_with_zero_price'|translate}</label></div>
            <div class="col-md-4">
               {print_toggle name="prod_sell_with_zero_price"}
            </div>
         </div>
         <div class="form-group">
            <div class="col-md-8 control-label">
               <label>{'prod_show_not_in_category'|translate}</label>
               <a class="help-tip" data-toggle="tooltip" title="{'prod_show_not_in_category_info'|translate}"><i class="bi bi-question-circle"></i></a>
            </div>
            <div class="col-md-4">
               {print_toggle name="prod_show_not_in_category"}
            </div>
         </div>
         <div class="form-group">
            <div class="col-md-8 control-label">
               <label>{'prod_show_admin_hidden'|translate}</label>
               <a class="help-tip" data-toggle="tooltip" title="{'prod_show_admin_hidden_info'|translate}"><i class="bi bi-question-circle"></i></a>
            </div>
            <div class="col-md-4">
               {print_toggle name="prod_show_admin_hidden"}
            </div>
         </div>
         <div class="form-group">
            <div class="col-md-8 control-label">
               <label>{'sort_in_cat_by_in_store'|translate}</label>
               <a class="help-tip" data-toggle="tooltip" title="{'sort_in_cat_by_in_store_info'|translate}"><i class="bi bi-question-circle"></i></a>
            </div>
            <div class="col-md-4">
               {print_toggle name="sort_in_cat_by_in_store"}
            </div>
         </div>

         {if $cfg.Modules.components}
            <div class="form-group">
               <div class="col-md-8 control-label">
                  <label>{'inStoreMaxVisible'|translate}</label>
                  <a class="help-tip" data-toggle="tooltip" title="{'inStoreMaxVisibleTooltip'|translate}"><i class="bi bi-question-circle"></i></a>
               </div>
               <div class="col-md-4">
                  <div class="input-group">
                     <input type="text" class="form-control input-sm" name="data[inStore_max_visible]" id='inStore_max_visible' maxlength="10" value="{$body.data.inStore_max_visible}" onkeypress="checkInputData('int');" />
                     <span class="input-group-addon">ks</span>
                  </div>
               </div>
            </div>
         {/if}
      </div>
      <div class="col-md-7">
         {if isSuperuser()}
            <div class="form-group">
               <div class="row">
                  <div class="col-md-3 control-label">
                     <label>{'EditGoods'|translate}</label>
                     <span class="glyphicon glyphicon-flash"></span>
                  </div>
                  <div class="col-md-7">
                     <span class="help-block">{'WhenOrdered'|translate}</span>
                  </div>
               </div>
               <div class="row">
                  <div class="col-md-7 col-md-offset-3">
                     <div class="radio">
                        <input type="radio" class="check" name="data[prod_do_after_order]" value="" {if $body.data.prod_do_after_order == ""}checked="checked"{/if} id="pDAO1" /><label for="pDAO1">
                           {'DoNothing'|translate}</label>
                     </div>
                     <div class="radio">
                        <input type="radio" class="check" name="data[prod_do_after_order]" value="status" {if $body.data.prod_do_after_order == "status"}checked="checked"{/if} id="pDAO2" /><label for="pDAO2">
                           {'MarkItOutOfStock'|translate}</label>
                     </div>
                     <div class="radio">
                        <input type="radio" class="check" name="data[prod_do_after_order]" value="delete" {if $body.data.prod_do_after_order == "delete"}checked="checked"{/if} id="pDAO3" /><label for="pDAO3">
                           {'ClearGoods'|translate}</label>
                     </div>
                     <div class="radio">
                        <input type="radio" class="check" name="data[prod_do_after_order]" value="hide" {if $body.data.prod_do_after_order == "hide"}checked="checked"{/if} id="pDAO4" /><label for="pDAO4">
                           {'SalesEnded'|translate}</label>
                     </div>
                  </div>
               </div>
            </div>
         {/if}
         <div class="form-group">
            <div class="col-md-8 control-label">
               <label>{'EANCheck'|translate}</label>
            </div>
            <div class="col-md-4">
               {print_toggle name="admin_ean_check"}
            </div>
         </div>

         {* Doprava zdarma *}
         <div class="form-group">
            <div class="col-md-8 control-label">
               <label>{'FreeDeliveryPayment'|translate}</label>
               <a class="help-tip" data-toggle="tooltip" title="{'FreeDeliveryPayment_info'|translate}"><i class="bi bi-question-circle"></i></a>
            </div>
            <div class="col-md-4">
               {print_toggle name="free_delivery_payment" value=$body.data.free_delivery_payment|default:'Y'}
            </div>
         </div>

         {if (findModule(Modules::PRODUCTS_SUPPLIERS)
          || findModule(Modules::SUPPLIERS)
          || findModule(Modules::STOCK_IN)
          || findModule(Modules::AUTOMATIC_IMPORT))}
         <div class="form-group">
            <div class="col-md-3 control-label">
               <label>{'productsOfSuppliers'|translate}</label>
               <a class="help-tip" data-toggle="tooltip" title="Propojení produktů v e-shopu a dodavatelů těchto produktů"><i class="bi bi-question-circle"></i></a>
            </div>
            <div class="col-md-5 control-label">
               <label>{'AllowEmptyPosCode'|translate nofilter}</label>
            </div>
            <div class="col-md-4">
                {print_toggle name="prod_allow_empty_supplier_code"}
            </div>
         </div>
         {/if}
      </div>
   </div>
{/if}
   <div class="row">
      <div class="col-md-5">
         {if findModule('reviews')}
         <div class="form-group">
            <div class="col-md-8 control-label"><label>{'ReviewCollections'|translate}</label></div>
            <div class="col-md-4">
               {print_toggle name="review_collections" value=$body.data.review_collections|default:'Y'}
            </div>
         </div>
         <div class="form-group">
            <div class="col-md-8 control-label">
               <label> {'Rewiew'|translate} </label>
               <a class="help-tip" data-toggle="tooltip" title="{'RewiewInfo'|translate}"><i class="bi bi-question-circle"></i></a>
            </div>
            <div class="col-md-4">
               <div class="input-group">
                  <input type="text" class="form-control input-sm" name="data[review_automatic_confirm]" id='review_automatic_confirm' maxlength="3" value="{$body.data.review_automatic_confirm}" onkeypress="checkInputData('int');" />
                  <span class="input-group-addon">dnů</span>
               </div>
            </div>
         </div>
      </div>
      <div class="col-md-7">
         <div class="form-group">
            <div class="col-md-8 control-label">
               <label> {'RewiewVerified'|translate nofilter} </label>
            </div>
            <div class="col-md-2">
               {print_toggle name="review_verified_only" value=$body.data.review_verified_only|default:'N'}
            </div>
         </div>
         {if findModule(Modules::COMMENTS, Modules::SUB_COMMENTS_ANONYMOUS)}
            <div class="form-group">
               <div class="col-md-8 control-label">
                  <label> {'CommentVerified'|translate nofilter} </label>
               </div>
               <div class="col-md-2">
                  {print_toggle name="comment_verified_only" value=$body.data.comment_verified_only|default:'N'}
               </div>
            </div>
         {/if}
         {/if}
      </div>
   </div>


{* Automatické označování *}
<div class="row bottom-space">
   <div class="col-md-12">
      <h1 class="h4 main-panel-title">{'AutomaticallyTagTitle'|translate}</h1>
   </div>
</div>
<div class="row">
   <div class="col-md-12">
      <div class="form-group">
         <div class="col-md-3 control-label">
            <label>{'AutomaticallyTag'|translate}</label>
            <a class="help-tip" data-toggle="tooltip" title="{'AutomaticallyTagInfo'|translate}"><i
                  class="bi bi-question-circle"></i></a>
         </div>
         <div class="col-md-2">
            <div class="input-group">
               <input type="text" class="form-control input-sm" name="data[prod_flag_automatic_new]" id='prod_flag_automatic_new'
                      maxlength="3"
                      value="{$body.data.prod_flag_automatic_new}" onkeypress="checkInputData('int');"/>
               <span class="input-group-addon">{'AutomaticallyTagDays'|translate}</span>
            </div>
         </div>
         <div class="col-md-2 control-label">
            <label>{'AutomaticallyTagBy'|translate}</label>
            <a class="help-tip" data-toggle="tooltip" title="{'AutomaticallyTagByInfo'|translate}"><i
                  class="bi bi-question-circle"></i></a>
         </div>
         <div class="col-md-2">
            <select class="selecter" name="data[prod_flag_automatic_new_field]">
               <option value="date_added" {if $body.data.prod_flag_automatic_new_field == 'date_added'}selected{/if}>{'AutomaticallyTagByDateAdded'|translate}</option>
               {ifmodule STOCK_IN}
                  <option value="date_stock_in" {if $body.data.prod_flag_automatic_new_field == 'date_stock_in'}selected{/if}>{'AutomaticallyTagByDateStockIn'|translate}</option>
               {/ifmodule}
            </select>
         </div>
      </div>
   </div>
</div>

{* Nastavení cen *}
<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>{'prod_show_price_vat'|translate}</label></div>
         <div class="col-md-6">
            <div class="radio">
               <input type="radio" class="check" name="data[prod_show_price_vat]" value="Y" {if $body.data.prod_show_price_vat == "Y"}checked="checked"{/if} id="pSPV1" /><label for="pSPV1">
                  {'withTax'|translate:'choice'}</label>
            </div>
            <div class="radio">
               <input type="radio" class="check" name="data[prod_show_price_vat]" value="N" {if $body.data.prod_show_price_vat == "N"}checked="checked"{/if} id="pSPV2" /><label for="pSPV2">
                  {'withoutTax'|translate:'choice'}</label>
            </div>
         </div>
      </div>
      <div class="form-group">
         <div class="col-md-6 control-label"><label>{'prod_prefer_price_vat'|translate}</label></div>
         <div class="col-md-6">
            <div class="radio">
               <input type="radio" class="check" name="data[prod_prefer_price_vat]" value="Y" {if $body.data.prod_prefer_price_vat == "Y"}checked="checked"{/if} id="pSPPV1" /><label for="pSPPV1">
                  {'withTax'|translate:'choice'}</label>
            </div>
            <div class="radio">
               <input type="radio" class="check" name="data[prod_prefer_price_vat]" value="N" {if $body.data.prod_prefer_price_vat == "N"}checked="checked"{/if} id="pSPPV2" /><label for="pSPPV2">
                  {'withoutTax'|translate:'choice'}</label>
            </div>
            <div class="radio">
               <input type="radio" class="check" name="data[prod_prefer_price_vat]" value="F" {if $body.data.prod_prefer_price_vat == "F"}checked="checked"{/if} id="pSPPV3" /><label for="pSPPV3">
                  {'finalTax'|translate}</label>
            </div>
         </div>
      </div>
      {ifmodule PRICE_HISTORY}
      <div class="form-group">
         <div class="col-md-6 control-label"><label>{'prod_min_display_discount'|translate}</label></div>
         <div class="col-md-3">
            <div class="input-group">
               <input type="text" class="form-control input-sm" name="data[prod_min_display_discount]" id='prod_min_display_discount'
                      value="{$body.data.prod_min_display_discount}" placeholder="1" />
               <span class="input-group-addon">%</span>
            </div>
         </div>
      </div>
      {block display_discount}
      <div class="form-group">
         <div class="col-md-7 control-label">
            <label>{'prod_display_discount'|translate}</label>
            <a class="help-tip" data-toggle="tooltip" title="{'prod_display_discountTooltip'|translate}"><i class="bi bi-question-circle"></i></a>
         </div>
         <div class="col-md-2">
            {print_toggle name="prod_display_discount" value=$body.data.prod_display_discount|default:'N'}
         </div>
      </div>
      {/block}
      {/ifmodule}
      <div class="form-group">
         <div class="col-md-7 control-label">
            <label>{'prod_vats_from_top'|translate}</label>
            <a class="help-tip" data-toggle="tooltip" title="{'prod_vats_from_topTooltip'|translate}"><i class="bi bi-question-circle"></i></a>
         </div>
         <div class="col-md-2">
            {print_toggle name="prod_vats_from_top" value=$body.data.prod_vats_from_top|default:'N'}
         </div>
      </div>
      {if !findModule('currencies')}
      <div class="form-group">
         <div class="col-md-6 control-label"><label>{'price_decimal_mark'|translate}</label></div>
         <div class="col-md-4">
            <select name="data[price_decimal_mark]" class="selecter">
               <option value="," {if $body.data.price_decimal_mark == ","}selected{/if}>{'comma'|translate}</option>
               <option value="." {if $body.data.price_decimal_mark == "."}selected{/if}>{'dot'|translate}</option>
            </select>
         </div>
      </div>
      {/if}
   </div>
   {if !findModule('currencies')}
   <div class="col-md-6">
      <div class="form-group">
         <div class="col-md-6 control-label"><label>{'price_round'|translate}</label></div>
         <div class="col-md-4">
            <select name="data[price_round]" class="selecter">
               <option value="0" {if $body.data.price_round == "0"}selected{/if}>{'DontRound'|translate}</option>
               <option value="1" {if $body.data.price_round == "1"}selected{/if}>{'Penny'|translate} </option>
               <option value="5" {if $body.data.price_round == "5"}selected{/if}>na 5-ti haléře</option>
               <option value="10" {if $body.data.price_round == "10"}selected{/if}>{'Penny10'|translate}</option>
               <option value="50" {if $body.data.price_round == "50"}selected{/if}>{'Penny50'|translate}</option>
               <option value="100" {if $body.data.price_round == "100"}selected{/if}>{'integers'|translate}</option>
               <option value="-5" {if $body.data.price_round == "-5"}selected{/if}>{'Crown5'|translate}</option>
               <option value="-10" {if $body.data.price_round == "-10"}selected{/if}>{'Crown10'|translate}</option>
            </select>
         </div>
      </div>
      <div class="form-group">
         <div class="col-md-6 control-label"><label>{'price_round_order'|translate}</label></div>
         <div class="col-md-4">
            <select name="data[price_round_order]" class="selecter">
               <option value="0" {if $body.data.price_round_order == "0"}selected{/if}>{'DontRound'|translate}</option>
               <option value="1" {if $body.data.price_round_order == "1"}selected{/if}>{'Penny'|translate}</option>
               <option value="5" {if $body.data.price_round_order == "5"}selected{/if}>na 5-ti haléře</option>
               <option value="10" {if $body.data.price_round_order == "10"}selected{/if}>{'Penny10'|translate}</option>
               <option value="50" {if $body.data.price_round_order == "50"}selected{/if}>{'Penny50'|translate}</option>
               <option value="100" {if $body.data.price_round_order == "100"}selected{/if}>{'integers'|translate}</option>
               <option value="-5" {if $body.data.price_round == "-5"}selected{/if}>{'Crown5'|translate}</option>
               <option value="-10" {if $body.data.price_round == "-10"}selected{/if}>{'Crown10'|translate}</option>
            </select>
         </div>
      </div>
      <div class="form-group">
         <div class="col-md-6 control-label"><label>{'RoundTheWay'|translate}</label></div>
         <div class="col-md-4">
            <select name="data[price_round_direction]" class="selecter">
               <option value="up" {if $body.data.price_round_direction == "up"}selected{/if}>{'WayUp'|translate}</option>
               <option value="down" {if $body.data.price_round_direction == "down"}selected{/if}>{'WayDown'|translate}</option>
               <option value="math" {if $body.data.price_round_direction == "math"}selected{/if}>{'Mathematically'|translate}</option>
            </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">
               <option value="0" {if $body.data.price_precision == "0"}selected{/if}>{'NoDecimalPlace'|translate} </option>
               <option value="2" {if $body.data.price_precision == "2"}selected{/if}>{'Decimal'|translate}</option>
               <option value="dynamic" {if $body.data.price_precision == "dynamic"}selected{/if}>{'TwoDecimal'|translate}</option>
            </select>
         </div>
      </div>
   </div>
   {/if}
</div>

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

<div id="product_templates">
   <div class="row bottom-space">
      <div class="col-md-3">
         <a href="#" data-form-add class="btn btn-success btn-block"><span class="glyphicon glyphicon-plus"></span>&nbsp;{'AddTemplate'|translate}</a>
      </div>
   </div>

   <div class="panel-group panel-group-lists panel">
      {foreach array_merge([[]], $body.data.product_templates) as $index => $template}
         <div class="panel" {if $index == 0}data-form-new style="display:none"{else}data-form-item{/if}>
            <div class="panel-body">
               <div class="form-group">
                  <div class="col-md-2 control-label"><label>{'Name'|translate}</label></div>
                  <div class="col-md-3">
                     <input type="text" class="form-control input-sm" name="data[product_templates][{$index}][name]" size="30" maxlength="255" value="{$template.name}">
                  </div>
                  <div class="col-md-1 col-md-offset-6">
                     <a class="btn-sm btn btn-danger" data-form-delete>
                        <input class="hidden" type="checkbox" name="data[product_templates][{$index}][delete]" />
                        <span class="glyphicon glyphicon-remove"></span>
                     </a>
                  </div>
               </div>
               <div class="form-group">
                  <div class="col-md-2 control-label"><label>Text</label></div>
                  <div class="col-md-9">
                  <textarea name="data[product_templates][{$index}][text]" id="data[product_templates][{$index}][text]" class="form-control input-sm">
                     {$template.text}
                  </textarea>
                     {if $index != 0}
                        {insert_wysiwyg target="data[product_templates][{$index}][text]"}
                     {/if}
                  </div>
               </div>
            </div>
         </div>
      {/foreach}
   </div>
</div>

{ifmodule PRODUCT_SETS}
   {* Setup of sets behaving *}
   <div class="row bottom-space">
      <div class="col-md-12">
         <h1 class="h4 main-panel-title">{'settingSets'|translate}</h1>
      </div>
   </div>
   <div class="row">
      <div class="col-md-12">
         <div class="form-group">
            <div class="col-md-4 control-label">
               <label>{'splitPrice'|translate}</label>
            </div>
            <div class="col-md-8">
               {$splitSetOptions = [
               'price_vat' => {'splitPriceVat'|translate},
               'price_default' => {'splitPriceDefault'|translate},
               'price_no_discount' => {'splitPriceNoDiscount'|translate},
               'no_split' => {'splitNoSplit'|translate}
               ]}
               {print_select name="data[products_sets][split]" var=$splitSetOptions selected=$dbcfg.products_sets['split']}
            </div>
         </div>
      </div>
   </div>
{/ifmodule}

{if $cfg.Modules.products.sets === 'js_multisets' }
   <div class="row bottom-space">
      <div class="col-md-12">
         <h1 class="h4 main-panel-title">{'settingMultiSets'|translate}</h1>
      </div>
   </div>
   <div class="row">
      <div class="col-md-12">
         <div class="form-group">
            <div class="col-md-4 control-label">
               <label>{'priceCalculationType'|translate:'productSetsSettingsTab'}</label>
            </div>
            <div class="col-md-8">
               {$options = [
               'price' => {'type_setPrice'|translate:'productSetsSettingsTab'},
               'productsPriceDiscounted' => {'type_setProductsPriceDiscounted'|translate:'productSetsSettingsTab'},
               'productsPriceDiscountedWithoutPriceLevel' => {'type_setProductsPriceDiscountedWithoutPriceLevel'|translate:'productSetsSettingsTab'}
               ]}
               <select class="selecter" name="data[multisets][price_calc_type]">
                  {foreach $options as $value => $name}
                     <option value="{$value}" {if $body.data.multisets.price_calc_type == $value}selected{/if}>{$name}</option>
                  {/foreach}
               </select>
            </div>
            </div>
            <div class="form-group">
            <div class="col-md-4 control-label">
               <label>{'discountDisplayType'|translate:'productSetsSettingsTab'}</label>
            </div>
            <div class="col-md-8">
               {$discountOptions = [
               'setPrice' => {'discountType_setPriceItems'|translate:'productSetsSettingsTab'},
               'discountItem' => {'discountType_discountItem'|translate:'productSetsSettingsTab'}
               ]}
               <select class="selecter" name="data[multisets][discount_display_type]">
                  {foreach $discountOptions as $value => $name}
                     <option value="{$value}" {if $body.data.multisets.discount_display_type == $value}selected{/if}>{$name}</option>
                  {/foreach}
               </select>
            </div>
         </div>
      </div>
   </div>
{/if}
{* Výpočet prodaných kusů za X dnů *}
<div class="row bottom-space">
   <div class="col-md-12">
      <h1 class="h4 main-panel-title">{'CountSoldProductsByPeriodTitle'|translate}</h1>
   </div>
</div>
<div class="row">
   <div class="col-md-12">
            <div class="form-group">
         <div class="col-md-3 control-label">
            <label>{'CountSoldProductsByPeriod'|translate}</label>
            <a class="help-tip" data-toggle="tooltip" title="{'CountSoldProductsByPeriodInfo'|translate}"><i
                  class="bi bi-question-circle"></i></a>
         </div>
         <div class="col-md-2">
            <div class="input-group">
               <input type="text" class="form-control input-sm" name="data[prod_count_sold_days]" id='prod_flag_automatic_new'
                      maxlength="3"
                      value="{$body.data.prod_count_sold_days}" onkeypress="checkInputData('int');"/>
               <span class="input-group-addon">{'CountSoldProductsByPeriodDays'|translate}</span>
            </div>
         </div>
      </div>
   </div>
</div>

<script type="text/javascript" src="../ckeditor/ckeditor.js"></script>
<script type="application/javascript">
   initForm({
      selector: '#product_templates',
      beforeAdd: function(original){
         var $item = original();
         $item.find('textarea').each(function() {
            var editor = CKEDITOR.replace(this,
               {
                  toolbar : 'BasicTable'
               }
            );
            CKFinder.SetupCKEditor( editor, '../ckeditor/ckfinder/' );
         });
      }
   });
</script>
