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

{block content}
   <div id="flapPosStoreSelect" class="tab-pane fade boxStatic">
      {if $body.data.data != NULL}
          {$data = json_decode($body.data.data, true)}
      {/if}
      <div class="form-group">
         <div class="col-md-2 control-label">
            <label>{'storesSelect'|translate:'posSettings'}</label>
         </div>
         <div class="col-md-8">
            <div class="input-group">
               <select class="selecter"
                       data-autocomplete="stores"
                       data-preload="stores"
                       data-placeholder="{'storesSelect'|translate:"posSettings"}"
                       name="data[data][stores][]">
                  {foreach $data.stores as $location}
                     <option value="{$location}" selected>{$location}</option>
                  {/foreach}
               </select>
               {if !empty($data.stores[0])}
                  <span class="input-group-btn">
                     <a href="/admin/launch.php?s=stores.php&acn=edit&ID={$data.stores[0]}&" title="Nastavení prodejny" class="btn btn-primary btn-sm">
                        <span class="glyphicon glyphicon-home"></span>
                     </a>
                  </span>
               {/if}
            </div>
         </div>
      </div>
   </div>
   <script type="application/javascript">
      initForm({
         selector: '#flapPosStoreSelect',
         beforeAdd: function (original) {
            var $item = original();
            window.preloadAutocompletes($item);
         },
      });
   </script>
{/block}
