[*] BO : #PSFV-94 - // Refactoring AdminAddresses, form.tpl is now extendable
This commit is contained in:
@@ -24,157 +24,57 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{if $firstCall}
|
||||
<script type="text/javascript">
|
||||
var vat_number = {$vat_number};
|
||||
var module_dir = '{$module_dir}';
|
||||
|
||||
$(document).ready(function() {ldelim}
|
||||
var id_language = {$defaultFormLanguage};
|
||||
var languages = new Array();
|
||||
{foreach $languages as $k => $language}
|
||||
languages[{$k}] = {ldelim}
|
||||
id_lang: {$language.id_lang},
|
||||
iso_code: '{$language.iso_code}',
|
||||
name: '{$language.name}'
|
||||
{rdelim};
|
||||
{/foreach}
|
||||
displayFlags(languages, id_language, {$allowEmployeeFormLang});
|
||||
|
||||
if ($('#id_country'))
|
||||
{ldelim}
|
||||
ajaxStates({$fields_value.id_state});
|
||||
$('#id_country').change(function() {ldelim}
|
||||
ajaxStates();
|
||||
{rdelim});
|
||||
{rdelim}
|
||||
{rdelim});
|
||||
{if isset($script)}
|
||||
{$script}
|
||||
{/if}
|
||||
</script>
|
||||
<script type="text/javascript" src="../js/form.js"></script>
|
||||
{/if}
|
||||
{extends file="../helper/form/form.tpl"}
|
||||
|
||||
<form action="{$current}&submitAdd{$table}=1&token={$token}" method="post">
|
||||
{if $form_id}
|
||||
<input type="hidden" name="id_{$table}" value="{$form_id}" />
|
||||
{/if}
|
||||
<fieldset>
|
||||
{foreach $fields as $key => $field}
|
||||
{if $key == 'legend'}
|
||||
<legend>
|
||||
{if isset($field.image)}<img src="{$field.image}" alt="{$field.title}" />{/if}
|
||||
{$field.title}
|
||||
</legend>
|
||||
{elseif $key == 'input'}
|
||||
{foreach $field as $input}
|
||||
{if $input.name == 'id_customer'}
|
||||
{if isset($customer)}
|
||||
<label>{$input.label}</label>
|
||||
<div class="margin-form"><a style="display: block; padding-top: 4px;" href="?tab=AdminCustomers&id_customer={$customer->id}&viewcustomer&token={$tokenCustomer}">{$customer->lastname} {$customer->firstname} ({$customer->email})</a></div>
|
||||
<input type="hidden" name="id_customer" value="{$customer->id}" />
|
||||
<input type="hidden" name="email" value="{$customer->email}" />
|
||||
{else}
|
||||
<label>{l s='Customer e-mail'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="33" name="email" value="{$fields_value[$input.name]|escape:'htmlall':'UTF-8'}" style="text-transform: lowercase;" /> <sup>*</sup>
|
||||
</div>
|
||||
{/if}
|
||||
{else}
|
||||
{if $input.name == 'vat_number'}
|
||||
{if $vat == 'is_applicable'}
|
||||
<div id="vat_area" style="display: visible">
|
||||
{else if $vat == 'management'}
|
||||
<div id="vat_area" style="display: hidden">
|
||||
{else}
|
||||
<div style="display: none;">
|
||||
{/if}
|
||||
{else if $input.name == 'id_state'}
|
||||
<div id="contains_states" {if $contains_states}style="display:none;"{/if}>
|
||||
{/if}
|
||||
<label>{$input.label} </label>
|
||||
<div class="margin-form">
|
||||
{if $input.type == 'text'}
|
||||
<input type="text"
|
||||
name="{$input.name}"
|
||||
id="{$input.name}"
|
||||
value="{$fields_value[$input.name]|escape:'htmlall':'UTF-8'}"
|
||||
{if isset($input.size)}size="{$input.size}"{/if}
|
||||
{if isset($input.class)}class="{$input.class}"{/if}
|
||||
{if isset($input.readonly) && $input.readonly}readonly="readonly"{/if} />
|
||||
{elseif $input.type == 'select'}
|
||||
<select name="{$input.name}" id="{$input.name}" {if isset($input.onchange)}onchange="{$input.onchange}"{/if}>
|
||||
{if isset($input.options.optiongroup)}
|
||||
{foreach $input.options.optiongroup.query AS $optiongroup}
|
||||
<optgroup label="{$optiongroup[$input.options.optiongroup.label]}">
|
||||
{foreach $optiongroup[$input.options.options.query] as $option}
|
||||
<option value="{$option[$input.options.options.id]}"
|
||||
{if $fields_value[$input.name] == $option[$input.options.options.id]}selected="selected"{/if}>{$option[$input.options.options.name]|escape:'htmlall':'UTF-8'}</option>
|
||||
{/foreach}
|
||||
</optgroup>
|
||||
{/foreach}
|
||||
{else}
|
||||
{foreach $input.options.query AS $option}
|
||||
<option value="{$option[$input.options.id]}"
|
||||
{if $fields_value[$input.name] == $option[$input.options.id]}selected="selected"{/if}>{$option[$input.options.name]|escape:'htmlall':'UTF-8'}</option>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</select>
|
||||
{elseif $input.type == 'radio'}
|
||||
{foreach $input.values as $value}
|
||||
<input type="radio"
|
||||
name="{$input.name}"
|
||||
id="{$value.id}"
|
||||
value="{$value.value|escape:'htmlall':'UTF-8'}"
|
||||
{if $fields_value[$input.name] == $value.value}checked="checked"{/if} />
|
||||
<label {if isset($input.class)}class="{$input.class}"{/if} for="{$value.id}"> {$value.label}</label>
|
||||
{/foreach}
|
||||
{elseif $input.type == 'textarea'}
|
||||
<textarea name="{$input.name}" id="{$input.name}" cols="{$input.cols}" rows="{$input.rows}">{$fields_value[$input.name]|escape:'htmlall':'UTF-8'}</textarea>
|
||||
{elseif $input.type == 'checkbox'}
|
||||
|
||||
{/if}
|
||||
{if isset($input.required) && $input.required} <sup>*</sup>{/if}
|
||||
{if isset($input.p)}
|
||||
<p class="clear">
|
||||
{if is_array($input.p)}
|
||||
{foreach $input.p as $p}
|
||||
{if is_array($p)}
|
||||
<span id="{$p.id}">{$p.text}</span><br />
|
||||
{else}
|
||||
{$p}<br />
|
||||
{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{$input.p}
|
||||
{/if}
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
{if $input.name == 'id_state' || $input.name == 'vat_number'}
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{elseif $key == 'submit'}
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="{$field.title}" name="submitAdd{$table}" {if isset($field.class)}class="{$field.class}"{/if} />
|
||||
</div>
|
||||
{block name="label"}
|
||||
{* {if $input.type == 'text_customer'}
|
||||
{if isset($customer)}
|
||||
<label>{$input.label}</label>
|
||||
{else}
|
||||
<label>{l s='Customer e-mail'}</label>
|
||||
{/if}
|
||||
{else if isset($input.label)}
|
||||
<label>{$input.label} </label>
|
||||
{/if} *}
|
||||
{/block}
|
||||
|
||||
{block name="start_field_block"}
|
||||
{if $input.type == 'text_customer'}
|
||||
{if isset($customer)}
|
||||
<label>{$input.label}</label>
|
||||
<div class="margin-form"><a style="display: block; padding-top: 4px;" href="?tab=AdminCustomers&id_customer={$customer->id}&viewcustomer&token={$tokenCustomer}">{$customer->lastname} {$customer->firstname} ({$customer->email})</a></div>
|
||||
<input type="hidden" name="id_customer" value="{$customer->id}" />
|
||||
<input type="hidden" name="email" value="{$customer->email}" />
|
||||
{else}
|
||||
<label>{l s='Customer e-mail'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="33" name="email" value="{$fields_value[$input.name]|escape:'htmlall':'UTF-8'}" style="text-transform: lowercase;" /> <sup>*</sup>
|
||||
</div>
|
||||
{/if}
|
||||
{else}
|
||||
{if $input.name == 'vat_number'}
|
||||
{if $vat == 'is_applicable'}
|
||||
<div id="vat_area" style="display: visible">
|
||||
{else if $vat == 'management'}
|
||||
<div id="vat_area" style="display: hidden">
|
||||
{else}
|
||||
<div style="display: none;">
|
||||
{/if}
|
||||
{/foreach}
|
||||
{if $required_fields}
|
||||
<div class="small"><sup>*</sup> {l s ='Required field'}</div>
|
||||
{else if $input.name == 'id_state'}
|
||||
<div id="contains_states" {if $contains_states}style="display:none;"{/if}>
|
||||
{/if}
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<br /><br />
|
||||
{if $firstCall}
|
||||
{if $back}
|
||||
<a href="{$back}"><img src="../img/admin/arrow2.gif" />{l s='Back'}</a>
|
||||
{else}
|
||||
<a href="{$current}&token={$token}"><img src="../img/admin/arrow2.gif" />{l s='Back to list'}</a>
|
||||
<label>{$input.label} </label>
|
||||
<div class="margin-form">
|
||||
{/if}
|
||||
<br />
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
{block name="end_field_block"}
|
||||
{* close div margin-form *}
|
||||
{if $input.type != 'text_customer'}
|
||||
</div>
|
||||
{/if}
|
||||
{* close hidden div *}
|
||||
{if $input.name == 'vat_number' || $input.name == 'id_state'}
|
||||
</div>
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
@@ -71,13 +71,17 @@
|
||||
{if $input.name == 'id_state'}
|
||||
<div id="contains_states" {if $contains_states}style="display:none;"{/if}>
|
||||
{/if}
|
||||
{block name="label"}
|
||||
{if isset($input.label)}
|
||||
<label>{$input.label} </label>
|
||||
<label>{$input.label} </label>
|
||||
{/if}
|
||||
{/block}
|
||||
{if $input.type == 'hidden'}
|
||||
<input type="hidden" name="{$input.name}" value="{$fields_value[$input.name]}" />
|
||||
{else}
|
||||
<div class="margin-form">
|
||||
{block name="start_field_block"}
|
||||
<div class="margin-form">
|
||||
{/block}
|
||||
{if $input.type == 'text'}
|
||||
{if isset($input.lang) && isset($input.attributeLang)}
|
||||
{foreach $languages as $language}
|
||||
@@ -256,7 +260,7 @@
|
||||
</p>
|
||||
{/if}
|
||||
{if isset($languages)}<div class="clear"></div>{/if}
|
||||
</div>
|
||||
{block name="end_field_block"}</div>{/block}
|
||||
{/if}
|
||||
{if $input.name == 'id_state'}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user