<div class="row">
    <div class="col-md-3">
        <div class="form-group">
            <label for="feedFrm_name">{'name'|translate}</label>
            <input type="text" name="data[name]" class="form-control input-sm" value="{$body.data.name}" id="feedFrm_name">
        </div>
    </div>
    <div class="col-md-3">
        <div class="form-group">
            {$type = $body.data.type}
            {if !array_key_exists($type, $body.feedTypes)}
               {$type = 'deprecated'}
            {/if}
            <label for="feedFrm_type">{'type'|translate}</label>
            {print_select var=$body.feedTypes name='data[type]' selected=$type param='id="feedFrm_type"'}
        </div>
    </div>
    <div class="col-md-3">
        <div class="form-group" id="feedFrm_data_ttl_container"{if $body.data.expensive} style="display:none;"{/if}>
            <label for="feedFrm_data_ttl">{'ttl'|translate}<a class="help-tip label-help-tip" data-toggle="tooltip" title="{'ttl_desc'|translate}"><i class="bi bi-question-circle"></i></a></label>
            {* ttl in minutes, leave empty to default *}
            <div class="input-group">
                <input type="text" class="form-control input-sm" name="data[data][ttl]" id="feedFrm_data_ttl" value="{$body.data.data.ttl}"/>
                <span class="input-group-addon input-group-addon-light">min</span>
            </div>
        </div>
    </div>
    <div class="col-md-3">
        <div class="form-group toggle-group">
            <div class="d-flex align-items-center">
                {print_toggle name="expensive" selected=$body.data.expensive attrs='id="feedFrm_expensive"'}
                <label for="feedFrm_expensive">{'expensive'|translate}</label>
                <a class="help-tip" data-toggle="tooltip" title="{'expensive_desc'|translate}"><i class="bi bi-question-circle"></i></a>
            </div>
        </div>
    </div>
</div>
<div class="row">
    {if $body.enableConfigurator && $body.feedService && in_array($body.feedService->getObjectType(), ['product', 'section'])}
        <div class="col-md-3">
            <div class="form-group">
                <label for="feedFrm_sectionMapping">{'sectionMapping'|translate}</label>
                {print_select var=['' => ' - ', 'google' => 'google', 'heureka' => 'heureka', 'heureka_sk' => 'heureka_sk', 'seznam' => 'seznam', 'glami' => 'glami'] name='data[section_mapping]' selected=$body.data.section_mapping param='id="feedFrm_sectionMapping"'}
            </div>
        </div>
    {/if}
    <div class="col-md-3">
        <div class="form-group">
            <label for="feedFrm_id_language">{'id_language'|translate}</label>
            {print_select name='data[id_language]' var=$body.languages selected=$body.data.id_language param='id="feedFrm_id_language"'}
        </div>
    </div>
    {if count($body.countries) > 1}
        <div class="col-md-3">
            <div class="form-group">
                <label for="feedFrm_id_country">{'id_country'|translate}</label>
                {print_select name='data[id_country]' var=$body.countries selected=$body.data.id_country param='id="feedFrm_id_country"'}
            </div>
        </div>
    {/if}
    <div class="col-md-3">
        <div class="form-group">
            <label for="feedFrm_id_currency">{'id_currency'|translate}</label>
            {print_select name='data[id_currency]' var=$body.currencies selected=$body.data.id_currency param='id="feedFrm_id_currency"'}
        </div>
    </div>
    <div class="col-md-12">
        <div class="form-group">
            <label for="feedFrm_data_note">{'note'|translate}</label>
            <textarea name="data[data][note]" class="form-control input-sm" id="feedFrm_data_note" style="resize:vertical;" rows="3">{$body.data.data.note}</textarea>
        </div>
    </div>
    <div class="col-md-3">
        <div class="form-group">
            <label for="feedFrm_format">{'format'|translate}</label>
            {print_select name="data[data][format]" var=['xml' => 'xml', 'xml_pretty' => 'xml (formátované)']+$body.additionalFormats selected=$body.data.data.format}
        </div>
    </div>
    {if $body.feedService && $body.feedService->getObjectType() === 'product'}
        <div class="col-md-4">
            <div class="form-group toggle-group">
                <div class="d-flex align-items-center">
                    {print_toggle name="only_feed_products" value=$body.data.only_feed_products attrs='id="only_feed_products"'}
                    <label for="only_feed_products">{'only_feed_products'|translate}</label>
                </div>
            </div>
        </div>
    {/if}
</div>
<div class="row">
    <div class="col-md-12">
        <hr/>
    </div>
</div>
{foreach $body.domainsWithScheme as $domain => $domainWithScheme}
    <div class="row">
        {if isDevelopment() || $domain !== 'www.kupshop.local'}
            <div class="col-md-12">
                <label for="feedFrm_url" title="{'url'|translate}">{$domain}</label>
            </div>
            <div class="col-lg-8 col-md-6">
                <div class="form-group">
                    <div class="input-group">
                        <input class="form-control input disabled" type="text"
                               value="{$domainWithScheme}/feed/{$body.data.id}/{$body.data.hash}{if $body.formatExtension}.{$body.formatExtension}{/if}"
                               disabled>
                        <span class="input-group-btn">
                            <button type="button"
                                    data-copy-clipboard="{$domainWithScheme}/feed/{$body.data.id}/{$body.data.hash}{if $body.formatExtension}.{$body.formatExtension}{/if}"
                                    class="btn btn-primary"
                                    title="{'clipboard-copy'|translate:'button'}">
                                <i class="glyphicon glyphicon-copy"></i>
                            </button>
                        </span>
                    </div>
                </div>
            </div>
            <div class="col-lg-2 col-md-3">
                <div class="form-group">
                    {if $body.formatExtension}
                        <a class="btn btn-block btn-secondary" target="_blank"
                           href="{$domainWithScheme}{path('kupshop_feeds_feed_export_1', ['feedID' => $body.data.id, 'hash' => $body.data.hash, 'limit' => 50, 'format' => $body.formatExtension])}">
                            {'download_feed_preview'|translate}
                        </a>
                    {else}
                        <a class="btn btn-block btn-secondary" target="_blank"
                           href="{$domainWithScheme}{path('kupshop_feeds_feed_export', ['feedID' => $body.data.id, 'hash' => $body.data.hash, 'limit' => 50])}">
                            {'download_feed_preview'|translate}
                        </a>
                    {/if}
                </div>
            </div>
            <div class="col-lg-2 col-md-3">
                <div class="form-group">
                    {if $body.formatExtension}
                        <a class="btn btn-block btn-secondary"
                           href="{$domainWithScheme}{path('kupshop_feeds_feed_export_1', ['feedID' => $body.data.id, 'hash' => $body.data.hash, 'file' => 1, 'format' => $body.formatExtension])}">
                            {'download_full_feed'|translate}
                        </a>
                    {else}
                        <a class="btn btn-block btn-secondary"
                           href="{$domainWithScheme}{path('kupshop_feeds_feed_export', ['feedID' => $body.data.id, 'hash' => $body.data.hash, 'file' => 1])}">
                            {'download_full_feed'|translate}
                        </a>
                    {/if}
                </div>
            </div>
        {/if}
    </div>
{/foreach}
<div class="row">
    <div class="col-md-12">
        {$body.customDataForm nofilter}
        <hr>
    </div>
    <div class="col-md-3">
        <p>
            <strong class="m-r-2">{'generated'|translate}</strong>
            <span>{$body.data.regenerated|default:'--'}</span>
        </p>
    </div>
    <div class="col-md-3">
        <p>
            <strong class="m-r-2" title="{'last_download_title'|translate}">{'last_download'|translate}</strong>
            <span>{$body.data.last_download|default:'--'}</span>
        </p>
    </div>
</div>
