<div id="flapSettingsZNZ" class="tab-pane fade in boxFlex">
   <div class="row">
      <div class="col-md-12">
         <h1 class="h4 main-panel-title">Nastavení</h1>
      </div>
   </div>

   {get_contexts language=1 currency=1 assign='contexts'}

   <input type="hidden" name="disable_autoload[znz]" value="1">

   <div class="panel panel-default">
      <div class="panel-heading collapsed panel-heading-flex" data-toggle="collapse" data-target="#znz_general">
         <p style="margin-left: 10px;"><strong>Obecná nastavení</strong></p>
      </div>

      <div id="znz_general" class="panel-collapse collapse in">
         <div class="panel-body">
            <div class="row wpj-form-group-flex">
               <div class="col-md-6">
                  <div class="wpj-form-group">
                     <label>Uzavření centrály</label>
                     <div class="input-group">
                        <input id="znz_expedition_closed_from" type="text" class="form-control input-sm"
                               name="data[znz][expeditionClosed][from]" value="{$body.data.znz.expeditionClosed.from}"
                               placeholder="Od" autocomplete="off"/>
                         {insert_calendar selector="#znz_expedition_closed_from" format='date'}
                        <span class="input-group-btn"></span>
                        <input id="znz_expedition_closed_to" type="text" class="form-control input-sm"
                               name="data[znz][expeditionClosed][to]" value="{$body.data.znz.expeditionClosed.to}"
                               placeholder="Do" autocomplete="off"/>
                         {insert_calendar selector="#znz_expedition_closed_to" format='date'}
                     </div>
                  </div>
               </div>
            </div>

            <div class="row">
               <div class="col-md-12"
                    style="border-bottom: 1px solid #e6e9ed; margin: 5px 0 10px; padding-bottom: 6px;">
                  <strong>Věrnostní program</strong>
               </div>
            </div>

            <div class="row">
               <div class="col-md-3">
                  <div class="wpj-form-group">
                     <label>Získávání bodů</label>
                     <div class="input-group">
                        <input type="number" class="form-control input-sm" name="data[znz][bonusProgram][pointValue]"
                               value="{$body.data.znz.bonusProgram.pointValue}"/>
                        <span class="input-group-addon">Kč = 1 bod</span>
                     </div>
                  </div>
               </div>
                              <div class="col-md-3">
                  <div class="wpj-form-group">
                     <input type="hidden" name="data[znz][bonusProgram][priceLevel][1][type]" value="userPointsCountReached">
                     <label>Po dosažení počtu bodů</label>
                     <div class="input-group">
                        <input type="number" class="form-control input-sm"
                               name="data[znz][bonusProgram][priceLevel][1][requiredPoints]"
                               value="{$body.data.znz.bonusProgram.priceLevel[1].requiredPoints}"/>
                        <span class="input-group-addon">bodů</span>
                     </div>
                  </div>
               </div>
               <div class="col-md-3">
                  <div class="wpj-form-group">
                     <label>Nastavit cenovou hladinu</label>
                     <select class="selecter" name="data[znz][bonusProgram][priceLevel][1][priceLevelId]"
                             data-autocomplete="priceLevels" data-preload="priceLevels">
                         {if $body.data.znz.bonusProgram.priceLevel[1].priceLevelId}
                            <option value="{$body.data.znz.bonusProgram.priceLevel[1].priceLevelId}"
                                    selected>{$body.data.znz.bonusProgram.priceLevel[1].priceLevelId}</option>
                         {/if}
                     </select>
                  </div>
               </div>
            </div>
            <div class="row">
               <div class="col-md-3">
                  <div class="wpj-form-group">
                     <label>Základní sleva</label>
                     <select class="selecter" name="data[znz][bonusProgram][priceLevel][0][priceLevelId]"
                             data-autocomplete="priceLevels" data-preload="priceLevels">
                         {if $body.data.znz.bonusProgram.priceLevel[0].priceLevelId}
                            <option value="{$body.data.znz.bonusProgram.priceLevel[0].priceLevelId}"
                                    selected>{$body.data.znz.bonusProgram.priceLevel[0].priceLevelId}</option>
                         {/if}
                     </select>
                  </div>
               </div>
               <div class="col-md-3">
                  <div class="wpj-form-group">
                     <div class="wpj-form-group">
                        <label>Typ</label>
                        <select class="selecter" name="data[znz][bonusProgram][priceLevel][0][type]">
                           <option value="">-- nevybráno --</option>
                           <option value="userRegistered" {if $body.data.znz.bonusProgram.priceLevel[0].type == 'userRegistered'}selected{/if}>Registrace</option>
                           <option value="userRegisteredFirstPurchase" {if $body.data.znz.bonusProgram.priceLevel[0].type == 'userRegisteredFirstPurchase'}selected{/if}>Registrace + 1. nákup</option>
                        </select>
                     </div>
                  </div>
               </div>
            </div>
         </div>
      </div>
   </div>

   <div class="panel panel-default">
      <div class="panel-heading collapsed panel-heading-flex" data-toggle="collapse" data-target="#znz_synchronization">
         <p style="margin-left: 10px;"><strong>Synchronizace</strong></p>
      </div>

      <div id="znz_synchronization" class="panel-collapse collapse in">
         <div class="panel-body">

            <div class="form-group">
               <div class="col-md-2 control-label">
                  <label>Synchronizace aktivní</label>
               </div>
               <div class="col-md-2">
                   {print_toggle nameRaw='data[znz][sync][enabled]' numeric=true value=$body.data.znz.sync.enabled}
               </div>

               <div class="col-md-2 control-label">
                  <label>Zapisovat do produkčního Heliosu</label>
               </div>
               <div class="col-md-2">
                   {print_toggle nameRaw='data[znz][sync][production]' numeric=true value=$body.data.znz.sync.production}
               </div>
            </div>


            <div class="row">
               <div class="col-md-12"
                    style="border-bottom: 1px solid #e6e9ed; margin: 5px 0 10px; padding-bottom: 6px;">
                  <strong>Objednávky</strong>
               </div>
            </div>

            <div class="form-group">
               <div class="col-md-2 control-label">
                  <label>Výchozí prefix objednávek</label>
               </div>
               <div class="col-md-3">
                  <input type="text" class="form-control input-sm"
                         name="data[znz][order][prefix]"
                         value="{$body.data.znz.order.prefix}"/>
               </div>
            </div>

            <div class="row">
               <div class="col-md-12"
                    style="margin: 5px 0 10px; padding-bottom: 6px;">
                  Prefix objednávek
               </div>
            </div>

             {foreach $contexts.language->getSupported() as $language}
                <div class="form-group">
                   <div class="col-md-2 control-label">
                      <label>Jazyk {$language->getId()}</label>
                   </div>
                   <div class="col-md-3">
                      <input type="text" class="form-control input-sm"
                             name="data[znz][order][prefixes][{$language->getId()}]"
                             value="{$body.data.znz.order.prefixes[$language->getId()]}" placeholder="{$body.data.znz.order.prefix}"/>
                   </div>
                </div>
             {/foreach}

            <div class="row">
               <div class="col-md-12"
                    style="margin: 5px 0 10px; padding-bottom: 6px;">
                  Indetifikace obchodu
               </div>
            </div>

             {foreach $contexts.language->getSupported() as $language}
                <div class="form-group">
                   <div class="col-md-2 control-label">
                      <label>Jazyk {$language->getId()}</label>
                   </div>
                   <div class="col-md-3">
                      <input type="text" class="form-control input-sm"
                             name="data[znz][order][storeId][{$language->getId()}]"
                             value="{$body.data.znz.order.storeId[$language->getId()]}" placeholder="store_id"/>
                   </div>
                </div>
             {/foreach}

            <div class="row">
               <div class="col-md-12"
                    style="border-bottom: 1px solid #e6e9ed; margin: 5px 0 10px; padding-bottom: 6px;">
                  <strong>Uživatelé</strong>
               </div>
            </div>

            <div class="row">
               <div class="col-md-12"
                    style="margin: 5px 0 10px; padding-bottom: 6px;">
                  Skupina uživatelů
               </div>
            </div>

             {foreach $contexts.language->getSupported() as $language}
                <div class="form-group">
                   <div class="col-md-2 control-label">
                      <label>Jazyk {$language->getId()}</label>
                   </div>
                   <div class="col-md-3">
                      <input type="text" class="form-control input-sm"
                             name="data[znz][user][groupId][{$language->getId()}]"
                             value="{$body.data.znz.user.groupId[$language->getId()]}" />
                   </div>
                </div>
             {/foreach}
         </div>
      </div>
   </div>
</div>