{*
* 2007-2022 ETS-Soft
*
* NOTICE OF LICENSE
*
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
* If you want to use this file on more websites (or projects), you need to purchase additional licenses. 
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
* 
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs, please contact us for extra customization service at an affordable price
*
*  @author ETS-Soft <etssoft.jsc@gmail.com>
*  @copyright  2007-2022 ETS-Soft
*  @license    Valid for 1 website (or project) for each purchase of license
*  International Registered Trademark & Property of ETS-Soft
*}

{extends file="helpers/form/form.tpl"}
{block name="input"}
	{$smarty.block.parent}
	{if $input.name == 'field_length'}
		<p class="help-block">
			<span>{l s='Leave blank to get the maximum length.'  mod='ets_helpdesk'}</span>
			<a href="https://www.w3schools.com/sql/sql_datatypes.asp" rel="noreferrer noopener" target="_blank">{l s='View more detail' mod='ets_helpdesk'}</a>
		</p>
	{/if}
{/block}
{block name="input_row"}
	{if $input.name == 'type'}
		<div class="form-group group-field-type">
	{/if}
    {$smarty.block.parent}
	{if $input.name == 'field_length' }

			</div>
	{/if}
    {if $input.name|trim == 'field_length' && isset($form_option) && is_array($form_option)}
	    <div class="form-group ets_hd_option_wrap">
		    <label class="control-label col-lg-3"></label>
		    <div class="col-lg-8">
			    <div class="ets_hd_option_wrap_info">
				    <table class="ets_hd_options table">
						<thead>
							<tr>
								<th class="center"></th>
								<th class="left">{l s='Options' mod='ets_helpdesk'}</th>
								<th class="center">{l s='Default' mod='ets_helpdesk'}</th>
								<th></th>
							</tr>
						</thead>
						<tbody>
                        {if isset($form_option.values) && is_array($form_option.values) && $form_option.values|count > 0}
							{foreach from=$form_option.values item='option'}
								<tr class="ets_hd_option" data-id="{$option.id_ets_hd_option|intval}" data-ref="{$option.id_ets_hd_option|intval}">
									{include file="./form_option.tpl" fields=$form_option.fields fields_value=$option id=$option.id_ets_hd_option|intval type=$fields_value.type}
								</tr>
							{/foreach}
                        {elseif isset($form_option.defaults) && $form_option.defaults}
							{foreach from=$form_option.defaults item='default'}
								<tr class="ets_hd_option" data-id="0" data-ref="{$default|escape:'html':'UTF-8'}">
									{include file="./form_option.tpl" fields=$form_option.fields fields_value=array() id='op_'|cat:$default type=$fields_value.type}
								</tr>
							{/foreach}
                        {/if}
						<tr class="ets_hd_option" data-id="0" data-ref="tmp">
							{include file="./form_option.tpl" fields=$form_option.fields fields_value=array() id='@ID@' type=$fields_value.type}
						</tr>
						</tbody>
				    </table>
			    </div>
				<button class="btn btn-primary ets_hd_add_option" type="button" tabindex="-1">
					<i class="ets_svg_fill_white lh_16">
						<svg class="w_14 h_14" width="14" height="14" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1600 736v192q0 40-28 68t-68 28h-416v416q0 40-28 68t-68 28h-192q-40 0-68-28t-28-68v-416h-416q-40 0-68-28t-28-68v-192q0-40 28-68t68-28h416v-416q0-40 28-68t68-28h192q40 0 68 28t28 68v416h416q40 0 68 28t28 68z"/></svg>
					</i>
					{l s='Add option' mod='ets_helpdesk'}
				</button>
		    </div>
	    </div>
    {/if}
{/block}
