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

{block "content"}
   <div class="container">

   {if $import}
      <div class="panel panel-default first">
         <div class="panel-body">
            <h4 class="main-panel-title">
               {if $import.test}
                  Test importu indexovatelných filtrů.
               {else}
                  Indexovatelné filtry importovány.
               {/if}
            </h4>
            Počet přidaných: {$import.added|count}
            <br/>
            Počet aktualizovaných: {$import.info['updated']}
            <br/>
            Počet přeskočených: {$import.info['skipped']}
            <br/>

            {if count($errs) > 0}
               Vyskytlo se {count($import.errs)} chyb:
               <br/>
            {else}
               Nevyskytly se žádné chyby.
            {/if}
            <br/><br/>

            {foreach $import.errs as $row => $err}
               chyba: {$err}
               <br/>
            {/foreach}

            {if $import.added}
               <h4 class="main-panel-title">Přidané indexovatelné filtry</h4>
               <div style="overflow: auto; width: 100%;">
                  <table class="table">
                     <thead>
                     <tr>
                        <th style="width: 10%;">ID sekce</th>
                        <th style="width: 10%;">ID výrobce</th>
                        <th style="width: 10%;">parameter1</th>
                        <th style="width: 10%;">parameter2</th>
                        <th style="width: 10%;">parameter3</th>
                        <th>Url</th>
                        <th>Title</th>
                        <th>Meta title</th>
                        <th>Meta Description</th>

                     </tr>
                     </thead>
                     <tbody>
                     {foreach $import.added as $filter}
                        <tr>
                           <td>{$filter.id_section}</td>
                           <td>{$filter.id_producer}</td>
                           <td>{$filter.parameter1}</td>
                           <td>{$filter.parameter2}</td>
                           <td>{$filter.parameter3}</td>
                           <td>{$filter.url}</td>
                           <td>{$filter.title}</td>
                           <td>{$filter.meta_title}</td>
                           <td>{$filter.meta_description}</td>

                        </tr>
                     {/foreach}
                     </tbody>
                  </table>
               </div>
            {/if}

            <div class="form-group">
               <div class="col-md-2  col-md-offset-10">
                  <a href="" class="btn btn-primary btn-block">Zpět</a>
               </div>
            </div>
         </div>
      </div>
   {else}
      <form action="" method="post">
         <div class="panel panel-default first">
            <div class="panel-body">
               <h4 class="main-panel-title">{'indexedFilterExportTitle'|translate}</h4>
               <p>Zde si můžete vygenerovat .xls soubor obsahující všechny sekce s aktivními indexovatelnými filtry.</p>
               <p>Ve výchozím nastavení se exportují:</p>
               <ul>
                  <li>všechny kombinace sekce a jednoho indexovatelného parametru,</li>
                  <li>všechny kombinace s vlastním obsahem.</li>
               </ul>

               <div class="row bottom-space">
                  <div class="col-md-12">
                     <div class="checkbox">
                        <input id="exportOnlyExisting" class="check" type="checkbox" name="exportOnlyExisting" value="1">
                        <label for="exportOnlyExisting" class="control-label">{'exportOnlyExisting'|translate nofilter}</label>
                     </div>
                  </div>
               </div>
                 <div class="row bottom-space">
                  <div class="col-md-12">
                     <div class="checkbox">
                        <input id="exportOnlyNonEmpty" class="check" type="checkbox" name="exportOnlyNonEmpty" value="1">
                        <label for="exportOnlyNonEmpty" class="control-label">{'exportOnlyNonEmpty'|translate nofilter}</label>
                     </div>
                  </div>
               </div>
               <input type="hidden" name="acn" value="ExportExecute">

               <div class="form-group">
                  <div class="col-md-2  col-md-offset-10">
                     <input type="submit" class="btn btn-primary btn-block" value="{'exportButton'|translate}">
                  </div>
               </div>
            </div>
         </div>
      </form>
      </div>

      <div class="container">
      <form action="" method="post" enctype="multipart/form-data">
         <div class="panel panel-default first">
            <div class="panel-body">
               <h4 class="main-panel-title">{'indexedFilterImportTitle'|translate}</h4>
               <p>{'importHelp'|translate nofilter}</p>

               <div class="bottom-space form-horizontal">
                  <div class="form-group">
                     <label class="control-label col-md-3">{'importFileLabel'|translate nofilter}</label>
                     <div class="col-md-5">
                        <input type="file" class="filestyle" name="file" data-iconName="glyphicon-folder-open"
                               data-buttonText="{'fileSelect'|translate}"/>
                     </div>
                  </div>
               </div>
               <input type="hidden" name="acn" value="ImportExecute">

               <div class="form-group">
                  <div class="col-md-2 col-md-offset-8">
                     <input type="submit" name="importTry" class="btn btn-primary btn-block" value="{'importTry'|translate}">
                  </div>
                  <div class="col-md-2">
                     <input type="submit"class="btn btn-primary btn-block" value="{'importButton'|translate}">
                  </div>
               </div>
            </div>
         </div>
      </form>
   {/if}

   </div>
{/block}
