{extends "window/menuLinks.tpl"}

{block tabsContent}
   {$smarty.block.parent}
   <div id="flapItem" class="tab-pane fade active in boxStatic">
      {if $body.newMenuRoot}
         <input type="hidden" name="data[id_menu]" value="" />
         <input type="hidden" name="newMenuRoot" value="1" />
      {elseif $body.data.id !== $body.data.id_menu}
         <div class="form-group form-group-flex">
            <div class="col-md-2 control-label"><label>{'parent'|translate}</label></div>
            <div class="col-md-4">
               <select class="selecter" data-type="menu_links" data-preload="menuLinks" name="data[parent]" id="menuLinksPageFrm_data_parent">
                  <option value="{$body.data.parent}" selected>{$body.data.parent}</option>
               </select>
               <script>
                  menuLinksPage_applyChosen($('#menuLinksPageFrm_data_parent'));
                  function menuLinksPage_applyChosen($selector) {
                     $selector.ajaxChosen({
                        minTermLength: 0,
                        dataType: 'json',
                        type: 'GET',
                        url: 'launch.php?s=autocomplete.php&type=' + $selector.data('type')
                     }, function (data) {
                        return data;
                     }, {
                        width: '100%',
                        allow_single_deselect: true,
                        placeholder_text_single: 'Vyberte možnost',
                        placeholder_text_multiple: 'Vyberte několik možností'
                     });
                  }
               </script>
            </div>
         </div>
      {else}
         <input type="hidden" name="data[id_menu]" value="{$body.data.id_menu}" />
      {/if}
      <div class="form-group">
         <div class="col-md-2 control-label"><label>{'name'|translate}</label></div>
         <div class="col-md-10">
            <input type="text" class="form-control input-sm" name="data[name]" size="30" maxlength="100"
                   value="{$body.data.name}"/>
         </div>
      </div>
      {if isSuperuser() && ($body.newMenuRoot || $body.data.id === $body.data.id_menu)}
         <div class="form-group form-group-flex">
            <div class="col-md-2 control-label">
               <label>{'label'|translate}</label>
               <span class="glyphicon glyphicon-flash" style="color:#AAB2BD;" title="Vidí pouze superadmin"></span>
            </div>
            <div class="col-md-4">
               <select class="selecter" name="data[code]">
                  <option value="">-- žádný účel --</option>
                  {foreach $body.labels as $label}
                      <option value="{$label}" {if $body.data.code == $label}selected{/if}>{$label}</option>
                  {/foreach}
               </select>
            </div>
         </div>
      {/if}
      <div class="form-group">
         <div class="col-md-2 control-label"><label>{'visible'|translate}</label></div>
         <div class="col-md-3">
            {print_toggle name="figure"  value=$body.data.figure}
         </div>
      </div>
   </div>
{/block}