{extends "[shared]window.tpl"}

{block size}
    height = 600;
{/block}

{block tabsContent}
    <div class="tab-pane fade active in boxStatic box">
        <h1 class="h4 main-panel-title">{'header'|translate}</h1>

        {foreach $body.data.feed_data as $feed}
            <div class="col-md-11">
                <h1 class="h4 main-panel-title">{$feed.product.feed_name}</h1>
            </div>
            <div class="form-group form-group-flex">
                <div class="col-md-2 control-label">
                    <label for="feed_productTitle">{'title'|translate}</label>
                </div>
                <div class="col-md-8">
                    <input name="data[feed][{$feed.product.feed_id}][title]" class="form-control input-sm" value="{$feed.product.title}" id="feed_productTitle">
                    <input name="data[feed][{$feed.product.feed_id}][id_feed_products]" type="hidden" value="{$feed.product.feed_products_id}">
                </div>
            </div>
            <div class="form-group form-group-flex">
               <div class="col-md-2 control-label"><label>Sekce{if $feed.sectionType} [{$feed.sectionType}]{/if}</label>{if !$feed.sectionType}<a class="help-tip" data-toggle="tooltip" title="Nelze nastavit, protože pro tento feed není dostupná informace o sekcích srovnávače."><i class="bi bi-question-circle"></i></a>{/if}</div>
               <div class="col-md-10">
                  <select class="selecter-categories" name="data[feed][{$feed.product.feed_id}][section]"{if !$feed.sectionType} disabled="disabled"{/if} data-type="{if $feed.sectionType}feed_{$feed.sectionType}{else}category{/if}">
                     <option value="">Vyberte sekci</option>
                     <option value="{$feed.product.id_section}" selected>{$feed.product.section_text}</option>
                  </select>
               </div>
            </div>
            <div class="form-group form-group-flex">
                <div class="col-md-2 control-label">
                    <label for="feed_productCpc">{'cpc'|translate}</label>
                </div>
                <div class="col-md-8">
                    <input name="data[feed][{$feed.product.feed_id}][cpc]" class="form-control input-sm" value="{$feed.product.cpc}" id="feed_productCpc">
                </div>
            </div>
            <div class="form-group form-group-flex">
                <div class="col-md-2 control-label">
                    <label for="feed_productActive">{'active'|translate}</label>
                </div>
                <div class="col-md-8">
                    <select class="selecter" name="data[feed][{$feed.product.feed_id}][active]">
                        <option value="" {$feed.product.active|selected:'-1'}>Nerozhoduje</option>
                        <option value="1" {$feed.product.active|selected:'1'}>Ano</option>
                        <option value="0" {$feed.product.active|selected:'0'}>Ne</option>
                    </select>
                </div>
            </div>
        {/foreach}

        <script type="text/javascript">
            function applyChosen($selector, type) {
                $selector.ajaxChosen({
                    dataType: 'json',
                    type: 'GET',
                    keepTypingMsg: 'Zadejte více znaků...',
                    lookingForMsg: 'Hledání slova',
                    url: 'launch.php?s=autocomplete.php&type=' + $selector.data('type'),
                }, function(data) {
                    return data;
                }, {
                    width: '765px',
                    placeholder_text_single: 'Vyberte sekci',
                    placeholder_text_multiple: 'Vyberte několik možností',
                });
            }

            $('.selecter-categories[data-type]').each(function(index, el) {
                applyChosen($(el));
            });
        </script>
    </div>
{/block}
