shop.balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

customer_form.twig (98455B)


      1 {{ header }}{{ column_left }}
      2 <div id="content">
      3   <div class="page-header">
      4     <div class="container-fluid">
      5       <div class="pull-right">
      6         <button type="submit" form="form-customer" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button>
      7         <a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a></div>
      8       <h1>{{ heading_title }}</h1>
      9       <ul class="breadcrumb">
     10         {% for breadcrumb in breadcrumbs %}
     11         <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
     12         {% endfor %}
     13       </ul>
     14     </div>
     15   </div>
     16   <div class="container-fluid"> {% if error_warning %}
     17     <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_warning }}
     18       <button type="button" class="close" data-dismiss="alert">&times;</button>
     19     </div>
     20     {% endif %}
     21     <div class="panel panel-default">
     22       <div class="panel-heading">
     23         <h3 class="panel-title"><i class="fa fa-pencil"></i> {{ text_form }}</h3>
     24       </div>
     25       <div class="panel-body">
     26         <form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-customer" class="form-horizontal">
     27           <ul class="nav nav-tabs">
     28             <li class="active"><a href="#tab-general" data-toggle="tab">{{ tab_general }}</a></li>
     29             <li><a href="#tab-affiliate" data-toggle="tab">{{ tab_affiliate }}</a></li>
     30             {% if customer_id %}
     31             <li><a href="#tab-history" data-toggle="tab">{{ tab_history }}</a></li>
     32             <li><a href="#tab-transaction" data-toggle="tab">{{ tab_transaction }}</a></li>
     33             <li><a href="#tab-reward" data-toggle="tab">{{ tab_reward }}</a></li>
     34             <li><a href="#tab-ip" data-toggle="tab">{{ tab_ip }}</a></li>
     35             {% endif %}
     36           </ul>
     37           <div class="tab-content">
     38             <div class="tab-pane active" id="tab-general">
     39               <div class="row">
     40                 <div class="col-sm-2">
     41                   <ul class="nav nav-pills nav-stacked" id="address">
     42                     <li class="active"><a href="#tab-customer" data-toggle="tab">{{ tab_general }}</a></li>
     43                     {% set address_row = 1 %}
     44                     {% for address in addresses %}
     45                     <li><a href="#tab-address{{ address_row }}" data-toggle="tab"><i class="fa fa-minus-circle" onclick="$('#address a:first').tab('show'); $('#address a[href=\'#tab-address{{ address_row }}\']').parent().remove(); $('#tab-address{{ address_row }}').remove();"></i> {{ tab_address }} {{ address_row }}</a></li>
     46                     {% set address_row = address_row + 1 %}
     47                     {% endfor %}
     48                     <li id="address-add"><a onclick="addAddress();"><i class="fa fa-plus-circle"></i> {{ button_address_add }}</a></li>
     49                   </ul>
     50                 </div>
     51                 <div class="col-sm-10">
     52                   <div class="tab-content">
     53                     <div class="tab-pane active" id="tab-customer">
     54                       <fieldset>
     55                         <legend>{{ text_account }}</legend>
     56                         <div class="form-group">
     57                           <label class="col-sm-2 control-label" for="input-customer-group">{{ entry_customer_group }}</label>
     58                           <div class="col-sm-10">
     59                             <select name="customer_group_id" id="input-customer-group" class="form-control">
     60                               {% for customer_group in customer_groups %}
     61                               {% if customer_group.customer_group_id == customer_group_id %}
     62                               <option value="{{ customer_group.customer_group_id }}" selected="selected">{{ customer_group.name }}</option>
     63                               {% else %}
     64                               <option value="{{ customer_group.customer_group_id }}">{{ customer_group.name }}</option>
     65                               {% endif %}
     66                               {% endfor %}
     67                             </select>
     68                           </div>
     69                         </div>
     70                         <div class="form-group required">
     71                           <label class="col-sm-2 control-label" for="input-firstname">{{ entry_firstname }}</label>
     72                           <div class="col-sm-10">
     73                             <input type="text" name="firstname" value="{{ firstname }}" placeholder="{{ entry_firstname }}" id="input-firstname" class="form-control" />
     74                             {% if error_firstname %}
     75                             <div class="text-danger">{{ error_firstname }}</div>
     76                             {% endif %}</div>
     77                         </div>
     78                         <div class="form-group required">
     79                           <label class="col-sm-2 control-label" for="input-lastname">{{ entry_lastname }}</label>
     80                           <div class="col-sm-10">
     81                             <input type="text" name="lastname" value="{{ lastname }}" placeholder="{{ entry_lastname }}" id="input-lastname" class="form-control" />
     82                             {% if error_lastname %}
     83                             <div class="text-danger">{{ error_lastname }}</div>
     84                             {% endif %}</div>
     85                         </div>
     86                         <div class="form-group required">
     87                           <label class="col-sm-2 control-label" for="input-email">{{ entry_email }}</label>
     88                           <div class="col-sm-10">
     89                             <input type="text" name="email" value="{{ email }}" placeholder="{{ entry_email }}" id="input-email" class="form-control" />
     90                             {% if error_email %}
     91                             <div class="text-danger">{{ error_email }}</div>
     92                             {% endif %}</div>
     93                         </div>
     94                         <div class="form-group required">
     95                           <label class="col-sm-2 control-label" for="input-telephone">{{ entry_telephone }}</label>
     96                           <div class="col-sm-10">
     97                             <input type="text" name="telephone" value="{{ telephone }}" placeholder="{{ entry_telephone }}" id="input-telephone" class="form-control" />
     98                             {% if error_telephone %}
     99                             <div class="text-danger">{{ error_telephone }}</div>
    100                             {% endif %}</div>
    101                         </div>
    102                         {% for custom_field in custom_fields %}
    103                         {% if custom_field.location == 'account' %}
    104                         {% if custom_field.type == 'select' %}
    105                         <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
    106                           <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
    107                           <div class="col-sm-10">
    108                             <select name="custom_field[{{ custom_field.custom_field_id }}]" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control">
    109                               <option value="">{{ text_select }}</option>
    110                               {% for custom_field_value in custom_field.custom_field_value %}
    111                               {% if account_custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id == account_custom_field[custom_field.custom_field_id] %}
    112                               <option value="{{ custom_field_value.custom_field_value_id }}" selected="selected">{{ custom_field_value.name }}</option>
    113                               {% else %}
    114                               <option value="{{ custom_field_value.custom_field_value_id }}">{{ custom_field_value.name }}</option>
    115                               {% endif %}
    116                               {% endfor %}
    117                             </select>
    118                             {% if error_custom_field[custom_field.custom_field_id] %}
    119                             <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
    120                             {% endif %}</div>
    121                         </div>
    122                         {% endif %}
    123                         {% if custom_field.type == 'radio' %}
    124                         <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
    125                           <label class="col-sm-2 control-label">{{ custom_field.name }}</label>
    126                           <div class="col-sm-10">
    127                             <div> {% for custom_field_value in custom_field.custom_field_value %}
    128                               <div class="radio"> {% if account_custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id == account_custom_field[custom_field.custom_field_id] %}
    129                                 <label>
    130                                   <input type="radio" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ custom_field_value.custom_field_value_id }}" checked="checked" />
    131                                   {{ custom_field_value.name }}</label>
    132                                 {% else %}
    133                                 <label>
    134                                   <input type="radio" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ custom_field_value.custom_field_value_id }}" />
    135                                   {{ custom_field_value.name }}</label>
    136                                 {% endif %}</div>
    137                               {% endfor %} </div>
    138                             {% if error_custom_field[custom_field.custom_field_id] %}
    139                             <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
    140                             {% endif %}</div>
    141                         </div>
    142                         {% endif %}
    143                         {% if custom_field.type == 'checkbox' %}
    144                         <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
    145                           <label class="col-sm-2 control-label">{{ custom_field.name }}</label>
    146                           <div class="col-sm-10">
    147                             <div> {% for custom_field_value in custom_field.custom_field_value %}
    148                               <div class="checkbox">{% if account_custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id in account_custom_field[custom_field.custom_field_id] %}
    149                                 <label>
    150                                   <input type="checkbox" name="custom_field[{{ custom_field.custom_field_id }}][]" value="{{ custom_field_value.custom_field_value_id }}" checked="checked" />
    151                                   {{ custom_field_value.name }}</label>
    152                                 {% else %}
    153                                 <label>
    154                                   <input type="checkbox" name="custom_field[{{ custom_field.custom_field_id }}][]" value="{{ custom_field_value.custom_field_value_id }}" />
    155                                   {{ custom_field_value.name }}</label>
    156                                 {% endif %}</div>
    157                               {% endfor %}</div>
    158                             {% if error_custom_field[custom_field.custom_field_id] %}
    159                             <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
    160                             {% endif %}</div>
    161                         </div>
    162                         {% endif %}
    163                         {% if custom_field.type == 'text' %}
    164                         <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
    165                           <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
    166                           <div class="col-sm-10">
    167                             <input type="text" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ account_custom_field[custom_field.custom_field_id] ? account_custom_field[custom_field.custom_field_id] : custom_field.value }}" placeholder="{{ custom_field.name }}" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control" />
    168                             {% if error_custom_field[custom_field.custom_field_id] %}
    169                             <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
    170                             {% endif %}</div>
    171                         </div>
    172                         {% endif %}
    173                         {% if custom_field.type == 'textarea' %}
    174                         <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
    175                           <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
    176                           <div class="col-sm-10">
    177                             <textarea name="custom_field[{{ custom_field.custom_field_id }}]" rows="5" placeholder="{{ custom_field.name }}" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control">{{ account_custom_field[custom_field.custom_field_id] ? account_custom_field[custom_field.custom_field_id] : custom_field.value }}</textarea>
    178                             {% if error_custom_field[custom_field.custom_field_id] %}
    179                             <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
    180                             {% endif %}</div>
    181                         </div>
    182                         {% endif %}
    183                         {% if custom_field.type == 'file' %}
    184                         <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
    185                           <label class="col-sm-2 control-label">{{ custom_field.name }}</label>
    186                           <div class="col-sm-10">
    187                             <button type="button" id="button-custom-field{{ custom_field.custom_field_id }}" data-loading-text="{{ text_loading }}" class="btn btn-default"><i class="fa fa-upload"></i> {{ button_upload }}</button>
    188                             <input type="hidden" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ account_custom_field[custom_field.custom_field_id] ? account_custom_field[custom_field.custom_field_id] }}" id="input-custom-field{{ custom_field.custom_field_id }}" />
    189                             {% if error_custom_field[custom_field.custom_field_id] %}
    190                             <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
    191                             {% endif %}</div>
    192                         </div>
    193                         {% endif %}
    194                         {% if custom_field.type == 'date' %}
    195                         <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
    196                           <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
    197                           <div class="col-sm-10">
    198                             <div class="input-group date">
    199                               <input type="text" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ account_custom_field[custom_field.custom_field_id] ? account_custom_field[custom_field.custom_field_id] : custom_field.value }}" placeholder="{{ custom_field.name }}" data-date-format="YYYY-MM-DD" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control" />
    200                               <span class="input-group-btn">
    201                               <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
    202                               </span></div>
    203                             {% if error_custom_field[custom_field.custom_field_id] %}
    204                             <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
    205                             {% endif %}</div>
    206                         </div>
    207                         {% endif %}
    208                         {% if custom_field.type == 'time' %}
    209                         <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
    210                           <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
    211                           <div class="col-sm-10">
    212                             <div class="input-group time">
    213                               <input type="text" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ account_custom_field[custom_field.custom_field_id] ? account_custom_field[custom_field.custom_field_id] : custom_field.value }}" placeholder="{{ custom_field.name }}" data-date-format="HH:mm" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control" />
    214                               <span class="input-group-btn">
    215                               <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
    216                               </span></div>
    217                             {% if error_custom_field[custom_field.custom_field_id] %}
    218                             <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
    219                             {% endif %}</div>
    220                         </div>
    221                         {% endif %}
    222                         {% if custom_field.type == 'datetime' %}
    223                         <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
    224                           <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
    225                           <div class="col-sm-10">
    226                             <div class="input-group datetime">
    227                               <input type="text" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ account_custom_field[custom_field.custom_field_id] ? account_custom_field[custom_field.custom_field_id] : custom_field.value }}" placeholder="{{ custom_field.name }}" data-date-format="YYYY-MM-DD HH:mm" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control" />
    228                               <span class="input-group-btn">
    229                               <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
    230                               </span></div>
    231                             {% if error_custom_field[custom_field.custom_field_id] %}
    232                             <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
    233                             {% endif %}</div>
    234                         </div>
    235                         {% endif %}
    236                         {% endif %}
    237                         {% endfor %}
    238                       </fieldset>
    239                       <fieldset>
    240                         <legend>{{ text_password }}</legend>
    241                         <div class="form-group required">
    242                           <label class="col-sm-2 control-label" for="input-password">{{ entry_password }}</label>
    243                           <div class="col-sm-10">
    244                             <input type="password" name="password" value="{{ password }}" placeholder="{{ entry_password }}" id="input-password" class="form-control" autocomplete="off" />
    245                             {% if error_password %}
    246                             <div class="text-danger">{{ error_password }}</div>
    247                             {% endif %}</div>
    248                         </div>
    249                         <div class="form-group required">
    250                           <label class="col-sm-2 control-label" for="input-confirm">{{ entry_confirm }}</label>
    251                           <div class="col-sm-10">
    252                             <input type="password" name="confirm" value="{{ confirm }}" placeholder="{{ entry_confirm }}" autocomplete="off" id="input-confirm" class="form-control" />
    253                             {% if error_confirm %}
    254                             <div class="text-danger">{{ error_confirm }}</div>
    255                             {% endif %}</div>
    256                         </div>
    257                       </fieldset>
    258                       <fieldset>
    259                         <legend>{{ text_other }}</legend>
    260                         <div class="form-group">
    261                           <label class="col-sm-2 control-label" for="input-newsletter">{{ entry_newsletter }}</label>
    262                           <div class="col-sm-10">
    263                             <select name="newsletter" id="input-newsletter" class="form-control">
    264                               {% if newsletter %}
    265                               <option value="1" selected="selected">{{ text_enabled }}</option>
    266                               <option value="0">{{ text_disabled }}</option>
    267                               {% else %}
    268                               <option value="1">{{ text_enabled }}</option>
    269                               <option value="0" selected="selected">{{ text_disabled }}</option>
    270                               {% endif %}
    271                             </select>
    272                           </div>
    273                         </div>
    274                         <div class="form-group">
    275                           <label class="col-sm-2 control-label" for="input-status">{{ entry_status }}</label>
    276                           <div class="col-sm-10">
    277                             <select name="status" id="input-status" class="form-control">
    278                               {% if status %}
    279                               <option value="1" selected="selected">{{ text_enabled }}</option>
    280                               <option value="0">{{ text_disabled }}</option>
    281                               {% else %}
    282                               <option value="1">{{ text_enabled }}</option>
    283                               <option value="0" selected="selected">{{ text_disabled }}</option>
    284                               {% endif %}
    285                             </select>
    286                           </div>
    287                         </div>
    288                         <div class="form-group">
    289                           <label class="col-sm-2 control-label" for="input-safe">{{ entry_safe }}</label>
    290                           <div class="col-sm-10">
    291                             <select name="safe" id="input-safe" class="form-control">
    292                               {% if safe %}
    293                               <option value="1" selected="selected">{{ text_yes }}</option>
    294                               <option value="0">{{ text_no }}</option>
    295                               {% else %}
    296                               <option value="1">{{ text_yes }}</option>
    297                               <option value="0" selected="selected">{{ text_no }}</option>
    298                               {% endif %}
    299                             </select>
    300                           </div>
    301                         </div>
    302                       </fieldset>
    303                     </div>
    304                     {% set address_row = 1 %}
    305                     {% for address in addresses %}
    306                     <div class="tab-pane" id="tab-address{{ address_row }}">
    307                       <input type="hidden" name="address[{{ address_row }}][address_id]" value="{{ address.address_id }}" />
    308                       <div class="form-group required">
    309                         <label class="col-sm-2 control-label" for="input-firstname{{ address_row }}">{{ entry_firstname }}</label>
    310                         <div class="col-sm-10">
    311                           <input type="text" name="address[{{ address_row }}][firstname]" value="{{ address.firstname }}" placeholder="{{ entry_firstname }}" id="input-firstname{{ address_row }}" class="form-control" />
    312                           {% if error_address[address_row].firstname %}
    313                           <div class="text-danger">{{ error_address[address_row].firstname }}</div>
    314                           {% endif %}</div>
    315                       </div>
    316                       <div class="form-group required">
    317                         <label class="col-sm-2 control-label" for="input-lastname{{ address_row }}">{{ entry_lastname }}</label>
    318                         <div class="col-sm-10">
    319                           <input type="text" name="address[{{ address_row }}][lastname]" value="{{ address.lastname }}" placeholder="{{ entry_lastname }}" id="input-lastname{{ address_row }}" class="form-control" />
    320                           {% if error_address[address_row].lastname %}
    321                           <div class="text-danger">{{ error_address[address_row].lastname }}</div>
    322                           {% endif %}</div>
    323                       </div>
    324                       <div class="form-group">
    325                         <label class="col-sm-2 control-label" for="input-company{{ address_row }}">{{ entry_company }}</label>
    326                         <div class="col-sm-10">
    327                           <input type="text" name="address[{{ address_row }}][company]" value="{{ address.company }}" placeholder="{{ entry_company }}" id="input-company{{ address_row }}" class="form-control" />
    328                         </div>
    329                       </div>
    330                       <div class="form-group required">
    331                         <label class="col-sm-2 control-label" for="input-address-1{{ address_row }}">{{ entry_address_1 }}</label>
    332                         <div class="col-sm-10">
    333                           <input type="text" name="address[{{ address_row }}][address_1]" value="{{ address.address_1 }}" placeholder="{{ entry_address_1 }}" id="input-address-1{{ address_row }}" class="form-control" />
    334                           {% if error_address[address_row].address_1 %}
    335                           <div class="text-danger">{{ error_address[address_row].address_1 }}</div>
    336                           {% endif %}</div>
    337                       </div>
    338                       <div class="form-group">
    339                         <label class="col-sm-2 control-label" for="input-address-2{{ address_row }}">{{ entry_address_2 }}</label>
    340                         <div class="col-sm-10">
    341                           <input type="text" name="address[{{ address_row }}][address_2]" value="{{ address.address_2 }}" placeholder="{{ entry_address_2 }}" id="input-address-2{{ address_row }}" class="form-control" />
    342                         </div>
    343                       </div>
    344                       <div class="form-group required">
    345                         <label class="col-sm-2 control-label" for="input-city{{ address_row }}">{{ entry_city }}</label>
    346                         <div class="col-sm-10">
    347                           <input type="text" name="address[{{ address_row }}][city]" value="{{ address.city }}" placeholder="{{ entry_city }}" id="input-city{{ address_row }}" class="form-control" />
    348                           {% if error_address[address_row].city %}
    349                           <div class="text-danger">{{ error_address[address_row].city }}</div>
    350                           {% endif %}</div>
    351                       </div>
    352                       <div class="form-group required">
    353                         <label class="col-sm-2 control-label" for="input-postcode{{ address_row }}">{{ entry_postcode }}</label>
    354                         <div class="col-sm-10">
    355                           <input type="text" name="address[{{ address_row }}][postcode]" value="{{ address.postcode }}" placeholder="{{ entry_postcode }}" id="input-postcode{{ address_row }}" class="form-control" />
    356                           {% if error_address[address_row].postcode %}
    357                           <div class="text-danger">{{ error_address[address_row].postcode }}</div>
    358                           {% endif %}</div>
    359                       </div>
    360                       <div class="form-group required">
    361                         <label class="col-sm-2 control-label" for="input-country{{ address_row }}">{{ entry_country }}</label>
    362                         <div class="col-sm-10">
    363                           <select name="address[{{ address_row }}][country_id]" id="input-country{{ address_row }}" onchange="country(this, '{{ address_row }}', '{{ address.zone_id }}');" class="form-control">
    364                             <option value="">{{ text_select }}</option>
    365                             {% for country in countries %}
    366                             {% if country.country_id == address.country_id %}
    367                             <option value="{{ country.country_id }}" selected="selected">{{ country.name }}</option>
    368                             {% else %}
    369                             <option value="{{ country.country_id }}">{{ country.name }}</option>
    370                             {% endif %}
    371                             {% endfor %}
    372                           </select>
    373                           {% if error_address[address_row].country %}
    374                           <div class="text-danger">{{ error_address[address_row].country }}</div>
    375                           {% endif %}</div>
    376                       </div>
    377                       <div class="form-group required">
    378                         <label class="col-sm-2 control-label" for="input-zone{{ address_row }}">{{ entry_zone }}</label>
    379                         <div class="col-sm-10">
    380                           <select name="address[{{ address_row }}][zone_id]" id="input-zone{{ address_row }}" class="form-control">
    381                           </select>
    382                           {% if error_address[address_row].zone %}
    383                           <div class="text-danger">{{ error_address[address_row].zone }}</div>
    384                           {% endif %}</div>
    385                       </div>
    386                       {% for custom_field in custom_fields %}
    387                       {% if custom_field.location == 'address' %}
    388                       {% if custom_field.type == 'select' %}
    389                       <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order + 1 }}">
    390                         <label class="col-sm-2 control-label" for="input-address{{ address_row }}-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
    391                         <div class="col-sm-10">
    392                           <select name="address[{{ address_row }}][custom_field][{{ custom_field.custom_field_id }}]" id="input-address{{ address_row }}-custom-field{{ custom_field.custom_field_id }}" class="form-control">
    393                             <option value="">{{ text_select }}</option>
    394                             {% for custom_field_value in custom_field.custom_field_value %}
    395                             {% if address.custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id == address.custom_field[custom_field.custom_field_id] %}
    396                             <option value="{{ custom_field_value.custom_field_value_id }}" selected="selected">{{ custom_field_value.name }}</option>
    397                             {% else %}
    398                             <option value="{{ custom_field_value.custom_field_value_id }}">{{ custom_field_value.name }}</option>
    399                             {% endif %}
    400                             {% endfor %}
    401                           </select>
    402                           {% if error_address[address_row]['custom_field'][custom_field.custom_field_id] %}
    403                           <div class="text-danger">{{ error_address[address_row].custom_field[custom_field.custom_field_id] }}</div>
    404                           {% endif %}</div>
    405                       </div>
    406                       {% endif %}
    407                       {% if custom_field.type == 'radio' %}
    408                       <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order + 1 }}">
    409                         <label class="col-sm-2 control-label">{{ custom_field.name }}</label>
    410                         <div class="col-sm-10">
    411                           <div> {% for custom_field_value in custom_field.custom_field_value %}
    412                             <div class="radio"> {% if address.custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id == address.custom_field[custom_field.custom_field_id] %}
    413                               <label>
    414                                 <input type="radio" name="address[{{ address_row }}][custom_field][{{ custom_field.custom_field_id }}]" value="{{ custom_field_value.custom_field_value_id }}" checked="checked" />
    415                                 {{ custom_field_value.name }}</label>
    416                               {% else %}
    417                               <label>
    418                                 <input type="radio" name="address[{{ address_row }}][custom_field][{{ custom_field.custom_field_id }}]" value="{{ custom_field_value.custom_field_value_id }}" />
    419                                 {{ custom_field_value.name }}</label>
    420                               {% endif %}</div>
    421                             {% endfor %} </div>
    422                           {% if error_address[address_row].custom_field[custom_field.custom_field_id] %}
    423                           <div class="text-danger">{{ error_address[address_row].custom_field[custom_field.custom_field_id] }}</div>
    424                           {% endif %}</div>
    425                       </div>
    426                       {% endif %}
    427                       {% if custom_field.type == 'checkbox' %}
    428                       <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order + 1 }}">
    429                         <label class="col-sm-2 control-label">{{ custom_field.name }}</label>
    430                         <div class="col-sm-10">
    431                           <div> {% for custom_field_value in custom_field.custom_field_value %}
    432                             <div class="checkbox"> {% if address.custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id in address.custom_field[custom_field.custom_field_id] %}
    433                               <label>
    434                                 <input type="checkbox" name="address[{{ address_row }}][custom_field][{{ custom_field.custom_field_id }}][]" value="{{ custom_field_value.custom_field_value_id }}" checked="checked" />
    435                                 {{ custom_field_value.name }}</label>
    436                               {% else %}
    437                               <label>
    438                                 <input type="checkbox" name="address[{{ address_row }}][custom_field][{{ custom_field.custom_field_id }}][]" value="{{ custom_field_value.custom_field_value_id }}" />
    439                                 {{ custom_field_value.name }}</label>
    440                               {% endif %}</div>
    441                             {% endfor %} </div>
    442                           {% if error_address[address_row]['custom_field'][custom_field.custom_field_id] %}
    443                           <div class="text-danger">{{ error_address[address_row].custom_field[custom_field.custom_field_id] }}</div>
    444                           {% endif %}</div>
    445                       </div>
    446                       {% endif %}
    447                       {% if custom_field.type == 'text' %}
    448                       <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order + 1 }}">
    449                         <label class="col-sm-2 control-label" for="input-address{{ address_row }}-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
    450                         <div class="col-sm-10">
    451                           <input type="text" name="address[{{ address_row }}][custom_field][{{ custom_field.custom_field_id }}]" value="{{ address.custom_field[custom_field.custom_field_id] ? address.custom_field[custom_field.custom_field_id] : custom_field.value }}" placeholder="{{ custom_field.name }}" id="input-address{{ address_row }}-custom-field{{ custom_field.custom_field_id }}" class="form-control" />
    452                           {% if error_address[address_row]['custom_field'][custom_field.custom_field_id] %}
    453                           <div class="text-danger">{{ error_address[address_row].custom_field[custom_field.custom_field_id] }}</div>
    454                           {% endif %}</div>
    455                       </div>
    456                       {% endif %}
    457                       {% if custom_field.type == 'textarea' %}
    458                       <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order + 1 }}">
    459                         <label class="col-sm-2 control-label" for="input-address{{ address_row }}-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
    460                         <div class="col-sm-10">
    461                           <textarea name="address[{{ address_row }}][custom_field][{{ custom_field.custom_field_id }}]" rows="5" placeholder="{{ custom_field.name }}" id="input-address{{ address_row }}-custom-field{{ custom_field.custom_field_id }}" class="form-control">{{ address.custom_field[custom_field.custom_field_id] ? address.custom_field[custom_field.custom_field_id] : custom_field.value }}</textarea>
    462                           {% if error_address[address_row]['custom_field'][custom_field.custom_field_id] %}
    463                           <div class="text-danger">{{ error_address[address_row].custom_field[custom_field.custom_field_id] }}</div>
    464                           {% endif %}</div>
    465                       </div>
    466                       {% endif %}
    467                       {% if custom_field.type == 'file' %}
    468                       <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order + 1 }}">
    469                         <label class="col-sm-2 control-label">{{ custom_field.name }}</label>
    470                         <div class="col-sm-10">
    471                           <button type="button" id="button-address{{ address_row }}-custom-field{{ custom_field.custom_field_id }}" data-loading-text="{{ text_loading }}" class="btn btn-default"><i class="fa fa-upload"></i> {{ button_upload }}</button>
    472                           <input type="hidden" name="address[{{ address_row }}][custom_field][{{ custom_field.custom_field_id }}]" value="{{ address.custom_field[custom_field.custom_field_id] ? address.custom_field[custom_field.custom_field_id] }}" />
    473                           {% if error_address[address_row]['custom_field'][custom_field.custom_field_id] %}
    474                           <div class="text-danger">{{ error_address[address_row].custom_field[custom_field.custom_field_id] }}</div>
    475                           {% endif %}</div>
    476                       </div>
    477                       {% endif %}
    478                       {% if custom_field.type == 'date' %}
    479                       <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order + 1 }}">
    480                         <label class="col-sm-2 control-label" for="input-address{{ address_row }}-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
    481                         <div class="col-sm-10">
    482                           <div class="input-group date">
    483                             <input type="text" name="address[{{ address_row }}][custom_field][{{ custom_field.custom_field_id }}]" value="{{ address.custom_field[custom_field.custom_field_id] ? address.custom_field[custom_field.custom_field_id] : custom_field.value }}" placeholder="{{ custom_field.name }}" data-date-format="YYYY-MM-DD" id="input-address{{ address_row }}-custom-field{{ custom_field.custom_field_id }}" class="form-control" />
    484                             <span class="input-group-btn">
    485                             <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
    486                             </span></div>
    487                           {% if error_address[address_row]['custom_field'][custom_field.custom_field_id] %}
    488                           <div class="text-danger">{{ error_address[address_row].custom_field[custom_field.custom_field_id] }}</div>
    489                           {% endif %}</div>
    490                       </div>
    491                       {% endif %}
    492                       {% if custom_field.type == 'time' %}
    493                       <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order + 1 }}">
    494                         <label class="col-sm-2 control-label" for="input-address{{ address_row }}-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
    495                         <div class="col-sm-10">
    496                           <div class="input-group time">
    497                             <input type="text" name="address[{{ address_row }}][custom_field][{{ custom_field.custom_field_id }}]" value="{{ address.custom_field[custom_field.custom_field_id] ? address.custom_field[custom_field.custom_field_id] : custom_field.value }}" placeholder="{{ custom_field.name }}" data-date-format="HH:mm" id="input-address{{ address_row }}-custom-field{{ custom_field.custom_field_id }}" class="form-control" />
    498                             <span class="input-group-btn">
    499                             <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
    500                             </span></div>
    501                           {% if error_address[address_row]['custom_field'][custom_field.custom_field_id] %}
    502                           <div class="text-danger">{{ error_address[address_row].custom_field[custom_field.custom_field_id] }}</div>
    503                           {% endif %}</div>
    504                       </div>
    505                       {% endif %}
    506                       {% if custom_field.type == 'datetime' %}
    507                       <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order + 1 }}">
    508                         <label class="col-sm-2 control-label" for="input-address{{ address_row }}-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
    509                         <div class="col-sm-10">
    510                           <div class="input-group datetime">
    511                             <input type="text" name="address[{{ address_row }}][custom_field][{{ custom_field.custom_field_id }}]" value="{{ address.custom_field[custom_field.custom_field_id] ? address.custom_field[custom_field.custom_field_id] : custom_field.value }}" placeholder="{{ custom_field.name }}" data-date-format="YYYY-MM-DD HH:mm" id="input-address{{ address_row }}-custom-field{{ custom_field.custom_field_id }}" class="form-control" />
    512                             <span class="input-group-btn">
    513                             <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
    514                             </span> </div>
    515                           {% if error_address[address_row]['custom_field'][custom_field.custom_field_id] %}
    516                           <div class="text-danger">{{ error_address[address_row].custom_field[custom_field.custom_field_id] }}</div>
    517                           {% endif %}</div>
    518                       </div>
    519                       {% endif %}
    520                       {% endif %}
    521                       {% endfor %}
    522                       <div class="form-group">
    523                         <label class="col-sm-2 control-label">{{ entry_default }}</label>
    524                         <div class="col-sm-10">
    525                           <label class="radio">{% if address.address_id == address_id or not addresses %}
    526                             <input type="radio" name="address[{{ address_row }}][default]" value="{{ address_row }}" checked="checked" />
    527                             {% else %}
    528                             <input type="radio" name="address[{{ address_row }}][default]" value="{{ address_row }}" />
    529                             {% endif %}</label>
    530                         </div>
    531                       </div>
    532                     </div>
    533                     {% set address_row = address_row + 1 %}
    534                     {% endfor %}
    535                   </div>
    536                 </div>
    537               </div>
    538             </div>
    539             <div class="tab-pane" id="tab-affiliate">
    540               <fieldset>
    541                 <legend>{{ text_affiliate }}</legend>
    542                 <div class="form-group">
    543                   <label class="col-sm-2 control-label" for="input-company">{{ entry_company }}</label>
    544                   <div class="col-sm-10">
    545                     <input type="text" name="company" value="{{ company }}" placeholder="{{ entry_company }}" id="input-company" class="form-control" />
    546                   </div>
    547                 </div>
    548                 <div class="form-group">
    549                   <label class="col-sm-2 control-label" for="input-website">{{ entry_website }}</label>
    550                   <div class="col-sm-10">
    551                     <input type="text" name="website" value="{{ website }}" placeholder="{{ entry_website }}" id="input-website" class="form-control" />
    552                   </div>
    553                 </div>
    554                 <div class="form-group">
    555                   <label class="col-sm-2 control-label" for="input-tracking"><span data-toggle="tooltip" title="{{ help_tracking }}">{{ entry_tracking }}</span></label>
    556                   <div class="col-sm-10">
    557                     <input type="text" name="tracking" value="{{ tracking }}" placeholder="{{ entry_tracking }}" id="input-tracking" class="form-control" />
    558                   </div>
    559                 </div>
    560                 <div class="form-group">
    561                   <label class="col-sm-2 control-label" for="input-commission"><span data-toggle="tooltip" title="{{ help_commission }}">{{ entry_commission }}</span></label>
    562                   <div class="col-sm-10">
    563                     <input type="text" name="commission" value="{{ commission }}" placeholder="{{ entry_commission }}" id="input-commission" class="form-control" />
    564                   </div>
    565                 </div>
    566                 {% for custom_field in custom_fields %}
    567                 {% if custom_field.location == 'affiliate' %}
    568                 {% if custom_field.type == 'select' %}
    569                 <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
    570                   <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
    571                   <div class="col-sm-10">
    572                     <select name="custom_field[{{ custom_field.custom_field_id }}]" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control">
    573                       <option value="">{{ text_select }}</option>
    574                       {% for custom_field_value in custom_field.custom_field_value %}
    575                       {% if account_custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id == account_custom_field[custom_field.custom_field_id] %}
    576                       <option value="{{ custom_field_value.custom_field_value_id }}" selected="selected">{{ custom_field_value.name }}</option>
    577                       {% else %}
    578                       <option value="{{ custom_field_value.custom_field_value_id }}">{{ custom_field_value.name }}</option>
    579                       {% endif %}
    580                       {% endfor %}
    581                     </select>
    582                     {% if error_custom_field[custom_field.custom_field_id] %}
    583                     <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
    584                     {% endif %}</div>
    585                 </div>
    586                 {% endif %}
    587                 {% if custom_field.type == 'radio' %}
    588                 <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
    589                   <label class="col-sm-2 control-label">{{ custom_field.name }}</label>
    590                   <div class="col-sm-10">
    591                     <div> {% for custom_field_value in custom_field.custom_field_value %}
    592                       <div class="radio">{% if account_custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id == account_custom_field[custom_field.custom_field_id] %}
    593                         <label>
    594                           <input type="radio" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ custom_field_value.custom_field_value_id }}" checked="checked" />
    595                           {{ custom_field_value.name }}</label>
    596                         {% else %}
    597                         <label>
    598                           <input type="radio" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ custom_field_value.custom_field_value_id }}" />
    599                           {{ custom_field_value.name }}</label>
    600                         {% endif %}</div>
    601                       {% endfor %} </div>
    602                     {% if error_custom_field[custom_field.custom_field_id] %}
    603                     <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
    604                     {% endif %}</div>
    605                 </div>
    606                 {% endif %}
    607                 {% if custom_field.type == 'checkbox' %}
    608                 <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
    609                   <label class="col-sm-2 control-label">{{ custom_field.name }}</label>
    610                   <div class="col-sm-10">
    611                     <div> {% for custom_field_value in custom_field.custom_field_value %}
    612                       <div class="checkbox">{% if account_custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id in account_custom_field[custom_field.custom_field_id] %}
    613                         <label>
    614                           <input type="checkbox" name="custom_field[{{ custom_field.custom_field_id }}][]" value="{{ custom_field_value.custom_field_value_id }}" checked="checked" />
    615                           {{ custom_field_value.name }}</label>
    616                         {% else %}
    617                         <label>
    618                           <input type="checkbox" name="custom_field[{{ custom_field.custom_field_id }}][]" value="{{ custom_field_value.custom_field_value_id }}" />
    619                           {{ custom_field_value.name }}</label>
    620                         {% endif %}</div>
    621                       {% endfor %} </div>
    622                     {% if error_custom_field[custom_field.custom_field_id] %}
    623                     <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
    624                     {% endif %}</div>
    625                 </div>
    626                 {% endif %}
    627                 {% if custom_field.type == 'text' %}
    628                 <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
    629                   <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
    630                   <div class="col-sm-10">
    631                     <input type="text" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ account_custom_field[custom_field.custom_field_id] ? account_custom_field[custom_field.custom_field_id] : custom_field.value }}" placeholder="{{ custom_field.name }}" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control" />
    632                     {% if error_custom_field[custom_field.custom_field_id] %}
    633                     <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
    634                     {% endif %}</div>
    635                 </div>
    636                 {% endif %}
    637                 {% if custom_field.type == 'textarea' %}
    638                 <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
    639                   <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
    640                   <div class="col-sm-10">
    641                     <textarea name="custom_field[{{ custom_field.custom_field_id }}]" rows="5" placeholder="{{ custom_field.name }}" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control">{{ account_custom_field[custom_field.custom_field_id] ? account_custom_field[custom_field.custom_field_id] : custom_field.value }}</textarea>
    642                     {% if error_custom_field[custom_field.custom_field_id] %}
    643                     <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
    644                     {% endif %}</div>
    645                 </div>
    646                 {% endif %}
    647                 {% if custom_field.type == 'file' %}
    648                 <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
    649                   <label class="col-sm-2 control-label">{{ custom_field.name }}</label>
    650                   <div class="col-sm-10">
    651                     <button type="button" id="button-custom-field{{ custom_field.custom_field_id }}" data-loading-text="{{ text_loading }}" class="btn btn-default"><i class="fa fa-upload"></i> {{ button_upload }}</button>
    652                     <input type="hidden" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ account_custom_field[custom_field.custom_field_id] ? account_custom_field[custom_field.custom_field_id] }}" id="input-custom-field{{ custom_field.custom_field_id }}" />
    653                     {% if error_custom_field[custom_field.custom_field_id] %}
    654                     <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
    655                     {% endif %}</div>
    656                 </div>
    657                 {% endif %}
    658                 {% if custom_field.type == 'date' %}
    659                 <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
    660                   <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
    661                   <div class="col-sm-10">
    662                     <div class="input-group date">
    663                       <input type="text" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ account_custom_field[custom_field.custom_field_id] ? account_custom_field[custom_field.custom_field_id] : custom_field.value }}" placeholder="{{ custom_field.name }}" data-date-format="YYYY-MM-DD" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control" />
    664                       <span class="input-group-btn">
    665                       <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
    666                       </span></div>
    667                     {% if error_custom_field[custom_field.custom_field_id] %}
    668                     <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
    669                     {% endif %}</div>
    670                 </div>
    671                 {% endif %}
    672                 {% if custom_field.type == 'time' %}
    673                 <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
    674                   <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
    675                   <div class="col-sm-10">
    676                     <div class="input-group time">
    677                       <input type="text" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ account_custom_field[custom_field.custom_field_id] ? account_custom_field[custom_field.custom_field_id] : custom_field.value }}" placeholder="{{ custom_field.name }}" data-date-format="HH:mm" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control" />
    678                       <span class="input-group-btn">
    679                       <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
    680                       </span></div>
    681                     {% if error_custom_field[custom_field.custom_field_id] %}
    682                     <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
    683                     {% endif %}</div>
    684                 </div>
    685                 {% endif %}
    686                 {% if custom_field.type == 'datetime' %}
    687                 <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
    688                   <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
    689                   <div class="col-sm-10">
    690                     <div class="input-group datetime">
    691                       <input type="text" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ account_custom_field[custom_field.custom_field_id] ? account_custom_field[custom_field.custom_field_id] : custom_field.value }}" placeholder="{{ custom_field.name }}" data-date-format="YYYY-MM-DD HH:mm" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control" />
    692                       <span class="input-group-btn">
    693                       <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
    694                       </span></div>
    695                     {% if error_custom_field[custom_field.custom_field_id] %}
    696                     <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
    697                     {% endif %}</div>
    698                 </div>
    699                 {% endif %}
    700                 {% endif %}
    701                 {% endfor %}
    702               </fieldset>
    703               <fieldset>
    704                 <legend>{{ text_payment }}</legend>
    705                 <div class="form-group">
    706                   <label class="col-sm-2 control-label" for="input-tax">{{ entry_tax }}</label>
    707                   <div class="col-sm-10">
    708                     <input type="text" name="tax" value="{{ tax }}" placeholder="{{ entry_tax }}" id="input-tax" class="form-control" />
    709                   </div>
    710                 </div>
    711                 <div class="form-group">
    712                   <label class="col-sm-2 control-label">{{ entry_payment }}</label>
    713                   <div class="col-sm-10">
    714                     <div class="radio">
    715                       <label>{% if payment == 'cheque' %}
    716                         <input type="radio" name="payment" value="cheque" checked="checked" />
    717                         {% else %}
    718                         <input type="radio" name="payment" value="cheque" />
    719                         {% endif %}
    720                         {{ text_cheque }}</label>
    721                     </div>
    722                     <div class="radio">
    723                       <label> {% if payment == 'paypal' %}
    724                         <input type="radio" name="payment" value="paypal" checked="checked" />
    725                         {% else %}
    726                         <input type="radio" name="payment" value="paypal" />
    727                         {% endif %}
    728                         {{ text_paypal }}</label>
    729                     </div>
    730                     <div class="radio">
    731                       <label> {% if payment == 'bank' %}
    732                         <input type="radio" name="payment" value="bank" checked="checked" />
    733                         {% else %}
    734                         <input type="radio" name="payment" value="bank" />
    735                         {% endif %}
    736                         {{ text_bank }}</label>
    737                     </div>
    738                   </div>
    739                 </div>
    740                 <div id="payment-cheque" class="payment">
    741                   <div class="form-group required">
    742                     <label class="col-sm-2 control-label" for="input-cheque">{{ entry_cheque }}</label>
    743                     <div class="col-sm-10">
    744                       <input type="text" name="cheque" value="{{ cheque }}" placeholder="{{ entry_cheque }}" id="input-cheque" class="form-control" />
    745                       {% if error_cheque %}
    746                       <div class="text-danger">{{ error_cheque }}</div>
    747                       {% endif %}</div>
    748                   </div>
    749                 </div>
    750                 <div id="payment-paypal" class="payment">
    751                   <div class="form-group required">
    752                     <label class="col-sm-2 control-label" for="input-paypal">{{ entry_paypal }}</label>
    753                     <div class="col-sm-10">
    754                       <input type="text" name="paypal" value="{{ paypal }}" placeholder="{{ entry_paypal }}" id="input-paypal" class="form-control" />
    755                       {% if error_paypal %}
    756                       <div class="text-danger">{{ error_paypal }}</div>
    757                       {% endif %}</div>
    758                   </div>
    759                 </div>
    760                 <div id="payment-bank" class="payment">
    761                   <div class="form-group">
    762                     <label class="col-sm-2 control-label" for="input-bank-name">{{ entry_bank_name }}</label>
    763                     <div class="col-sm-10">
    764                       <input type="text" name="bank_name" value="{{ bank_name }}" placeholder="{{ entry_bank_name }}" id="input-bank-name" class="form-control" />
    765                     </div>
    766                   </div>
    767                   <div class="form-group">
    768                     <label class="col-sm-2 control-label" for="input-bank-branch-number">{{ entry_bank_branch_number }}</label>
    769                     <div class="col-sm-10">
    770                       <input type="text" name="bank_branch_number" value="{{ bank_branch_number }}" placeholder="{{ entry_bank_branch_number }}" id="input-bank-branch-number" class="form-control" />
    771                     </div>
    772                   </div>
    773                   <div class="form-group">
    774                     <label class="col-sm-2 control-label" for="input-bank-swift-code">{{ entry_bank_swift_code }}</label>
    775                     <div class="col-sm-10">
    776                       <input type="text" name="bank_swift_code" value="{{ bank_swift_code }}" placeholder="{{ entry_bank_swift_code }}" id="input-bank-swift-code" class="form-control" />
    777                     </div>
    778                   </div>
    779                   <div class="form-group required">
    780                     <label class="col-sm-2 control-label" for="input-bank-account-name">{{ entry_bank_account_name }}</label>
    781                     <div class="col-sm-10">
    782                       <input type="text" name="bank_account_name" value="{{ bank_account_name }}" placeholder="{{ entry_bank_account_name }}" id="input-bank-account-name" class="form-control" />
    783                       {% if error_bank_account_name %}
    784                       <div class="text-danger">{{ error_bank_account_name }}</div>
    785                       {% endif %}</div>
    786                   </div>
    787                   <div class="form-group required">
    788                     <label class="col-sm-2 control-label" for="input-bank-account-number">{{ entry_bank_account_number }}</label>
    789                     <div class="col-sm-10">
    790                       <input type="text" name="bank_account_number" value="{{ bank_account_number }}" placeholder="{{ entry_bank_account_number }}" id="input-bank-account-number" class="form-control" />
    791                       {% if error_bank_account_number %}
    792                       <div class="text-danger">{{ error_bank_account_number }}</div>
    793                       {% endif %}</div>
    794                   </div>
    795                 </div>
    796                 <div class="form-group">
    797                   <label class="col-sm-2 control-label" for="input-affiliate">{{ entry_status }}</label>
    798                   <div class="col-sm-10">
    799                     <select name="affiliate" id="input-affiliate" class="form-control">
    800                       {% if affiliate %}
    801                       <option value="1" selected="selected">{{ text_enabled }}</option>
    802                       <option value="0">{{ text_disabled }}</option>
    803                       {% else %}
    804                       <option value="1">{{ text_enabled }}</option>
    805                       <option value="0" selected="selected">{{ text_disabled }}</option>
    806                       {% endif %}
    807                      </select>
    808                   </div>
    809                 </div>
    810               </fieldset>           
    811             </div>         
    812             {% if customer_id %}
    813             <div class="tab-pane" id="tab-history">
    814               <fieldset>
    815                 <legend>{{ text_history }}</legend>
    816                 <div id="history"></div>
    817               </fieldset>
    818               <br />
    819               <fieldset>
    820                 <legend>{{ text_history_add }}</legend>
    821                 <div class="form-group">
    822                   <label class="col-sm-2 control-label" for="input-comment">{{ entry_comment }}</label>
    823                   <div class="col-sm-10">
    824                     <textarea name="comment" rows="8" placeholder="{{ entry_comment }}" id="input-comment" class="form-control"></textarea>
    825                   </div>
    826                 </div>
    827               </fieldset>
    828               <div class="text-right">
    829                 <button id="button-history" data-loading-text="{{ text_loading }}" class="btn btn-primary"><i class="fa fa-plus-circle"></i> {{ button_history_add }}</button>
    830               </div>
    831             </div>
    832             <div class="tab-pane" id="tab-transaction">
    833               <fieldset>
    834                 <legend>{{ text_transaction }}</legend>
    835                 <div id="transaction"></div>
    836               </fieldset>
    837               <br />
    838               <fieldset>
    839                 <legend>{{ text_transaction_add }}</legend>
    840                 <div class="form-group">
    841                   <label class="col-sm-2 control-label" for="input-transaction-description">{{ entry_description }}</label>
    842                   <div class="col-sm-10">
    843                     <input type="text" name="description" value="" placeholder="{{ entry_description }}" id="input-transaction-description" class="form-control" />
    844                   </div>
    845                 </div>
    846                 <div class="form-group">
    847                   <label class="col-sm-2 control-label" for="input-amount">{{ entry_amount }}</label>
    848                   <div class="col-sm-10">
    849                     <input type="text" name="amount" value="" placeholder="{{ entry_amount }}" id="input-amount" class="form-control" />
    850                   </div>
    851                 </div>
    852               </fieldset>
    853               <div class="text-right">
    854                 <button type="button" id="button-transaction" data-loading-text="{{ text_loading }}" class="btn btn-primary"><i class="fa fa-plus-circle"></i> {{ button_transaction_add }}</button>
    855               </div>
    856             </div>
    857             <div class="tab-pane" id="tab-reward">
    858               <fieldset>
    859                 <legend>{{ text_reward }}</legend>
    860                 <div id="reward"></div>
    861               </fieldset>
    862               <br />
    863               <fieldset>
    864                 <legend>{{ text_reward_add }}</legend>
    865                 <div class="form-group">
    866                   <label class="col-sm-2 control-label" for="input-reward-description">{{ entry_description }}</label>
    867                   <div class="col-sm-10">
    868                     <input type="text" name="description" value="" placeholder="{{ entry_description }}" id="input-reward-description" class="form-control" />
    869                   </div>
    870                 </div>
    871                 <div class="form-group">
    872                   <label class="col-sm-2 control-label" for="input-points"><span data-toggle="tooltip" title="{{ help_points }}">{{ entry_points }}</span></label>
    873                   <div class="col-sm-10">
    874                     <input type="text" name="points" value="" placeholder="{{ entry_points }}" id="input-points" class="form-control" />
    875                   </div>
    876                 </div>
    877               </fieldset>
    878               <div class="text-right">
    879                 <button type="button" id="button-reward" data-loading-text="{{ text_loading }}" class="btn btn-primary"><i class="fa fa-plus-circle"></i> {{ button_reward_add }}</button>
    880               </div>
    881             </div>
    882             {% endif %}
    883             <div class="tab-pane" id="tab-ip">
    884               <fieldset>
    885                 <legend>{{ text_ip }}</legend>
    886                 <div id="ip"></div>
    887               </fieldset>
    888             </div>
    889           </div>
    890         </form>
    891       </div>
    892     </div>
    893   </div>
    894 
    895   <script type="text/javascript"><!--
    896   $('input[name="affiliate"]').on('change', function() {
    897     if ($(this).val() == '1') { 
    898       $('#tab-affiliate :input').not('input[name="affiliate"]').prop('disabled', false);
    899     } else {
    900       $('#tab-affiliate :input').not('input[name="affiliate"]').prop('disabled', true);
    901     }
    902   }); 
    903 
    904   $('input[name=\'affiliate\']:checked').trigger('change');
    905   //--></script> 
    906   <script type="text/javascript"><!--
    907   $('select[name=\'customer_group_id\']').on('change', function() {
    908     $.ajax({
    909       url: 'index.php?route=customer/customer/customfield&user_token={{ user_token }}&customer_group_id=' + this.value,
    910       dataType: 'json',
    911       success: function(json) {
    912         $('.custom-field').hide();
    913         $('.custom-field').removeClass('required');
    914 
    915         for (i = 0; i < json.length; i++) {
    916           custom_field = json[i];
    917 
    918           $('.custom-field' + custom_field['custom_field_id']).show();
    919 
    920           if (custom_field['required']) {
    921             $('.custom-field' + custom_field['custom_field_id']).addClass('required');
    922           }
    923         }
    924       },
    925       error: function(xhr, ajaxOptions, thrownError) {
    926         alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
    927       }
    928     });
    929   });
    930 
    931   $('select[name=\'customer_group_id\']').trigger('change');
    932   //--></script> 
    933   <script type="text/javascript"><!--
    934   var address_row = {{ address_row }};
    935 
    936   function addAddress() {
    937     html  = '<div class="tab-pane" id="tab-address' + address_row + '">';
    938     html += '  <input type="hidden" name="address[' + address_row + '][address_id]" value="" />';
    939 
    940     html += '  <div class="form-group required">';
    941     html += '    <label class="col-sm-2 control-label" for="input-firstname' + address_row + '">{{ entry_firstname }}</label>';
    942     html += '    <div class="col-sm-10"><input type="text" name="address[' + address_row + '][firstname]" value="" placeholder="{{ entry_firstname }}" id="input-firstname' + address_row + '" class="form-control" /></div>';
    943     html += '  </div>';
    944 
    945     html += '  <div class="form-group required">';
    946     html += '    <label class="col-sm-2 control-label" for="input-lastname' + address_row + '">{{ entry_lastname }}</label>';
    947     html += '    <div class="col-sm-10"><input type="text" name="address[' + address_row + '][lastname]" value="" placeholder="{{ entry_lastname }}" id="input-lastname' + address_row + '" class="form-control" /></div>';
    948     html += '  </div>';
    949 
    950     html += '  <div class="form-group">';
    951     html += '    <label class="col-sm-2 control-label" for="input-company' + address_row + '">{{ entry_company }}</label>';
    952     html += '    <div class="col-sm-10"><input type="text" name="address[' + address_row + '][company]" value="" placeholder="{{ entry_company }}" id="input-company' + address_row + '" class="form-control" /></div>';
    953     html += '  </div>';
    954 
    955     html += '  <div class="form-group required">';
    956     html += '    <label class="col-sm-2 control-label" for="input-address-1' + address_row + '">{{ entry_address_1 }}</label>';
    957     html += '    <div class="col-sm-10"><input type="text" name="address[' + address_row + '][address_1]" value="" placeholder="{{ entry_address_1 }}" id="input-address-1' + address_row + '" class="form-control" /></div>';
    958     html += '  </div>';
    959 
    960     html += '  <div class="form-group">';
    961     html += '    <label class="col-sm-2 control-label" for="input-address-2' + address_row + '">{{ entry_address_2 }}</label>';
    962     html += '    <div class="col-sm-10"><input type="text" name="address[' + address_row + '][address_2]" value="" placeholder="{{ entry_address_2 }}" id="input-address-2' + address_row + '" class="form-control" /></div>';
    963     html += '  </div>';
    964 
    965     html += '  <div class="form-group required">';
    966     html += '    <label class="col-sm-2 control-label" for="input-city' + address_row + '">{{ entry_city }}</label>';
    967     html += '    <div class="col-sm-10"><input type="text" name="address[' + address_row + '][city]" value="" placeholder="{{ entry_city }}" id="input-city' + address_row + '" class="form-control" /></div>';
    968     html += '  </div>';
    969 
    970     html += '  <div class="form-group required">';
    971     html += '    <label class="col-sm-2 control-label" for="input-postcode' + address_row + '">{{ entry_postcode }}</label>';
    972     html += '    <div class="col-sm-10"><input type="text" name="address[' + address_row + '][postcode]" value="" placeholder="{{ entry_postcode }}" id="input-postcode' + address_row + '" class="form-control" /></div>';
    973     html += '  </div>';
    974 
    975     html += '  <div class="form-group required">';
    976     html += '    <label class="col-sm-2 control-label" for="input-country' + address_row + '">{{ entry_country }}</label>';
    977     html += '    <div class="col-sm-10"><select name="address[' + address_row + '][country_id]" id="input-country' + address_row + '" onchange="country(this, \'' + address_row + '\', \'0\');" class="form-control">';
    978       html += '         <option value="">{{ text_select }}</option>';
    979       {% for country in countries %}
    980       html += '         <option value="{{ country.country_id }}">{{ country.name|escape('js') }}</option>';
    981       {% endfor %}
    982       html += '      </select></div>';
    983     html += '  </div>';
    984 
    985     html += '  <div class="form-group required">';
    986     html += '    <label class="col-sm-2 control-label" for="input-zone' + address_row + '">{{ entry_zone }}</label>';
    987     html += '    <div class="col-sm-10"><select name="address[' + address_row + '][zone_id]" id="input-zone' + address_row + '" class="form-control"><option value="">{{ text_none }}</option></select></div>';
    988     html += '  </div>';
    989 
    990     // Custom Fields
    991     {% for custom_field in custom_fields %}
    992     {% if custom_field.location == 'address' %}
    993     {% if custom_field.type == 'select' %}
    994 
    995     html += '  <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order + 1 }}">';
    996     html += '  		<label class="col-sm-2 control-label" for="input-address' + address_row + '-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name|e('js') }}</label>';
    997     html += '  		<div class="col-sm-10">';
    998     html += '  		  <select name="address[' + address_row + '][custom_field][{{ custom_field.custom_field_id }}]" id="input-address' + address_row + '-custom-field{{ custom_field.custom_field_id }}" class="form-control">';
    999     html += '  			<option value="">{{ text_select }}</option>';
   1000 
   1001     {% for custom_field_value in custom_field.custom_field_value %}
   1002     html += '  			<option value="{{ custom_field_value.custom_field_value_id }}">{{ custom_field.name|e('js') }}</option>';
   1003     {% endfor %}
   1004 
   1005     html += '  		  </select>';
   1006     html += '  		</div>';
   1007     html += '  	  </div>';
   1008     {% endif %}
   1009 
   1010     {% if custom_field.type == 'radio' %}
   1011     html += '  	  <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}">';
   1012     html += '  		<label class="col-sm-2 control-label">{{ custom_field.name|e('js') }}</label>';
   1013     html += '  		<div class="col-sm-10">';
   1014     html += '  		  <div>';
   1015 
   1016     {% for custom_field_value in custom_field.custom_field_value %}
   1017     html += '  			<div class="radio"><label><input type="radio" name="address[' + address_row + '][custom_field][{{ custom_field.custom_field_id }}]" value="{{ custom_field_value.custom_field_value_id }}" /> {{ custom_field_value.name|e('js') }}</label></div>';
   1018     {% endfor %}
   1019 
   1020     html += '		  </div>';
   1021     html += '		</div>';
   1022     html += '	  </div>';
   1023     {% endif %}
   1024 
   1025     {% if custom_field.type == 'checkbox' %}
   1026     html += '	  <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order + 1 }}">';
   1027     html += '		<label class="col-sm-2 control-label">{{ custom_field.name|e('js') }}</label>';
   1028     html += '		<div class="col-sm-10">';
   1029     html += '		  <div>';
   1030 
   1031     {% for custom_field_value in custom_field.custom_field_value %}
   1032     html += '			<div class="checkbox"><label><input type="checkbox" name="address[{{ address_row }}][custom_field][{{ custom_field.custom_field_id }}][]" value="{{ custom_field_value.custom_field_value_id }}" /> {{ custom_field_value.name|e('js') }}</label></div>';
   1033     {% endfor %}
   1034 
   1035     html += '		  </div>';
   1036     html += '		</div>';
   1037     html += '	  </div>';
   1038     {% endif %}
   1039 
   1040     {% if custom_field.type == 'text' %}
   1041     html += '	  <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order + 1 }}">';
   1042     html += '		<label class="col-sm-2 control-label" for="input-address' + address_row + '-custom-field{{ custom_field.custom_field_id }}">{{ custom_field_value.name|e('js') }}</label>';
   1043     html += '		<div class="col-sm-10">';
   1044     html += '		  <input type="text" name="address[' + address_row + '][custom_field][{{ custom_field.custom_field_id }}]" value="{{ custom_field.value|e('js') }}" placeholder="{{ custom_field_value.name|e('js') }}" id="input-address' + address_row + '-custom-field{{ custom_field.custom_field_id }}" class="form-control" />';
   1045     html += '		</div>';
   1046     html += '	  </div>';
   1047     {% endif %}
   1048 
   1049     {% if custom_field.type == 'textarea' %}
   1050     html += '	  <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order + 1 }}">';
   1051     html += '		<label class="col-sm-2 control-label" for="input-address' + address_row + '-custom-field{{ custom_field.custom_field_id }}">{{ custom_field_value.name|e('js') }}</label>';
   1052     html += '		<div class="col-sm-10">';
   1053     html += '		  <textarea name="address[' + address_row + '][custom_field][{{ custom_field.custom_field_id }}]" rows="5" placeholder="{{ custom_field_value.name|e('js') }}" id="input-address' + address_row + '-custom-field{{ custom_field.custom_field_id }}" class="form-control">{{ custom_field.value|e('js') }}</textarea>';
   1054     html += '		</div>';
   1055     html += '	  </div>';
   1056     {% endif %}
   1057 
   1058     {% if custom_field.type == 'file' %}
   1059     html += '	  <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order + 1 }}">';
   1060     html += '		<label class="col-sm-2 control-label">{{ custom_field.name|e('js') }}</label>';
   1061     html += '		<div class="col-sm-10">';
   1062     html += '		  <button type="button" id="button-address' + address_row + '-custom-field{{ custom_field.custom_field_id }}" data-loading-text="{{ text_loading }}" class="btn btn-default"><i class="fa fa-upload"></i> {{ button_upload }}</button>';
   1063     html += '		  <input type="hidden" name="address[' + address_row + '][{{ custom_field.custom_field_id }}]" value="" id="input-address' + address_row + '-custom-field{{ custom_field.custom_field_id }}" />';
   1064     html += '		</div>';
   1065     html += '	  </div>';
   1066     {% endif %}
   1067 
   1068     {% if custom_field.type == 'date' %}
   1069     html += '	  <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order + 1 }}">';
   1070     html += '		<label class="col-sm-2 control-label" for="input-address' + address_row + '-custom-field{{ custom_field.custom_field_id }}">{{ custom_field_value.name|e('js') }}</label>';
   1071     html += '		<div class="col-sm-10">';
   1072     html += '		  <div class="input-group date"><input type="text" name="address[' + address_row + '][custom_field][{{ custom_field.custom_field_id }}]" value="{{ custom_field.value|e('js') }}" placeholder="{{ custom_field.name|e('js') }} data-date-format="YYYY-MM-DD" id="input-address' + address_row + '-custom-field{{ custom_field.custom_field_id }}" class="form-control" /><span class="input-group-btn"><button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button></span></div>';
   1073     html += '		</div>';
   1074     html += '	  </div>';
   1075     {% endif %}
   1076 
   1077     {% if custom_field.type == 'time' %}
   1078     html += '	  <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order + 1 }}">';
   1079     html += '		<label class="col-sm-2 control-label" for="input-address' + address_row + '-custom-field{{ custom_field.custom_field_id }}">{{ custom_field_value.name|e('js') }}</label>';
   1080     html += '		<div class="col-sm-10">';
   1081     html += '		  <div class="input-group time"><input type="text" name="address[' + address_row + '][custom_field][{{ custom_field.custom_field_id }}]" value="{{ custom_field.value|e('js') }}" placeholder="{{ custom_field.name|e('js') }}" data-date-format="HH:mm" id="input-address' + address_row + '-custom-field{{ custom_field.custom_field_id }}" class="form-control" /><span class="input-group-btn"><button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button></span></div>';
   1082     html += '		</div>';
   1083     html += '	  </div>';
   1084     {% endif %}
   1085 
   1086     {% if custom_field.type == 'datetime' %}
   1087     html += '	  <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order + 1 }}">';
   1088     html += '		<label class="col-sm-2 control-label" for="input-address' + address_row + '-custom-field{{ custom_field.custom_field_id }}">{{ custom_field_value.name|e('js') }}</label>';
   1089     html += '		<div class="col-sm-10">';
   1090     html += '		  <div class="input-group datetime"><input type="text" name="address[' + address_row + '][custom_field][{{ custom_field.custom_field_id }}]" value="{{ custom_field.value|e('js') }}" placeholder="{{ custom_field.name|e('js') }}" data-date-format="YYYY-MM-DD HH:mm" id="input-address' + address_row + '-custom-field{{ custom_field.custom_field_id }}" class="form-control" /><span class="input-group-btn"><button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button></span></div>';
   1091     html += '		</div>';
   1092     html += '	  </div>';
   1093     {% endif %}
   1094 
   1095     {% endif %}
   1096     {% endfor %}
   1097 
   1098     html += '  <div class="form-group">';
   1099     html += '    <label class="col-sm-2 control-label">{{ entry_default }}</label>';
   1100     html += '    <div class="col-sm-10"><label class="radio"><input type="radio" name="address[' + address_row + '][default]" value="1" /></label></div>';
   1101     html += '  </div>';
   1102 
   1103     html += '</div>';
   1104 
   1105     $('#tab-general .tab-content').append(html);
   1106 
   1107     $('select[name=\'customer_group_id\']').trigger('change');
   1108 
   1109     $('select[name=\'address[' + address_row + '][country_id]\']').trigger('change');
   1110 
   1111     $('#address-add').before('<li><a href="#tab-address' + address_row + '" data-toggle="tab"><i class="fa fa-minus-circle" onclick="$(\'#address a:first\').tab(\'show\'); $(\'a[href=\\\'#tab-address' + address_row + '\\\']\').parent().remove(); $(\'#tab-address' + address_row + '\').remove();"></i> {{ tab_address }} ' + address_row + '</a></li>');
   1112 
   1113     $('#address a[href=\'#tab-address' + address_row + '\']').tab('show');
   1114 
   1115     $('.date').datetimepicker({
   1116 		language: '{{ datepicker }}',
   1117 		pickTime: false
   1118     });
   1119 
   1120 	$('.datetime').datetimepicker({
   1121 		language: '{{ datepicker }}',
   1122 		pickDate: true,
   1123 		pickTime: true
   1124     });
   1125 
   1126     $('.time').datetimepicker({
   1127 		language: '{{ datepicker }}',
   1128 		pickDate: false
   1129     });
   1130 
   1131     $('#tab-address' + address_row + ' .form-group[data-sort]').detach().each(function() {
   1132 		if ($(this).attr('data-sort') >= 0 && $(this).attr('data-sort') <= $('#tab-address' + address_row + ' .form-group').length) {
   1133 			$('#tab-address' + address_row + ' .form-group').eq($(this).attr('data-sort')).before(this);
   1134 		}
   1135 		
   1136 		if ($(this).attr('data-sort') > $('#tab-address' + address_row + ' .form-group').length) {
   1137 			$('#tab-address' + address_row + ' .form-group:last').after(this);
   1138 		}
   1139 		
   1140 		if ($(this).attr('data-sort') < -$('#tab-address' + address_row + ' .form-group').length) {
   1141 			$('#tab-address' + address_row + ' .form-group:first').before(this);
   1142 		}
   1143     });
   1144 
   1145     address_row++;
   1146   }
   1147   //--></script> 
   1148   <script type="text/javascript"><!--
   1149   function country(element, index, zone_id) {
   1150     $.ajax({
   1151       url: 'index.php?route=localisation/country/country&user_token={{ user_token }}&country_id=' + element.value,
   1152       dataType: 'json',
   1153       beforeSend: function() {
   1154         $('select[name=\'address[' + index + '][country_id]\']').prop('disabled', true);
   1155       },
   1156       complete: function() {
   1157         $('select[name=\'address[' + index + '][country_id]\']').prop('disabled', false);
   1158       },
   1159       success: function(json) {
   1160         if (json['postcode_required'] == '1') {
   1161           $('input[name=\'address[' + index + '][postcode]\']').parent().parent().addClass('required');
   1162         } else {
   1163           $('input[name=\'address[' + index + '][postcode]\']').parent().parent().removeClass('required');
   1164         }
   1165 
   1166         html = '<option value="">{{ text_select }}</option>';
   1167 
   1168         if (json['zone'] && json['zone'] != '') {
   1169           for (i = 0; i < json['zone'].length; i++) {
   1170             html += '<option value="' + json['zone'][i]['zone_id'] + '"';
   1171 
   1172             if (json['zone'][i]['zone_id'] == zone_id) {
   1173               html += ' selected="selected"';
   1174             }
   1175 
   1176             html += '>' + json['zone'][i]['name'] + '</option>';
   1177           }
   1178         } else {
   1179           html += '<option value="0">{{ text_none }}</option>';
   1180         }
   1181 
   1182         $('select[name=\'address[' + index + '][zone_id]\']').html(html);
   1183       },
   1184       error: function(xhr, ajaxOptions, thrownError) {
   1185         alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
   1186       }
   1187     });
   1188   }
   1189 
   1190   $('select[name$=\'[country_id]\']').trigger('change');
   1191   //--></script> 
   1192   <script type="text/javascript"><!--
   1193   $('#history').delegate('.pagination a', 'click', function(e) {
   1194     e.preventDefault();
   1195 
   1196     $('#history').load(this.href);
   1197   });
   1198 
   1199   $('#history').load('index.php?route=customer/customer/history&user_token={{ user_token }}&customer_id={{ customer_id }}');
   1200 
   1201   $('#button-history').on('click', function(e) {
   1202     e.preventDefault();
   1203 
   1204     $.ajax({
   1205       url: 'index.php?route=customer/customer/addhistory&user_token={{ user_token }}&customer_id={{ customer_id }}',
   1206       type: 'post',
   1207       dataType: 'json',
   1208       data: 'comment=' + encodeURIComponent($('#tab-history textarea[name=\'comment\']').val()),
   1209       beforeSend: function() {
   1210         $('#button-history').button('loading');
   1211       },
   1212       complete: function() {
   1213         $('#button-history').button('reset');
   1214       },
   1215       success: function(json) {
   1216         $('.alert-dismissible').remove();
   1217 
   1218         if (json['error']) {
   1219            $('#tab-history').prepend('<div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> ' + json['error'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
   1220         }
   1221 
   1222         if (json['success']) {
   1223           $('#tab-history').prepend('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
   1224 
   1225           $('#history').load('index.php?route=customer/customer/history&user_token={{ user_token }}&customer_id={{ customer_id }}');
   1226 
   1227           $('#tab-history textarea[name=\'comment\']').val('');
   1228         }
   1229       },
   1230       error: function(xhr, ajaxOptions, thrownError) {
   1231         alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
   1232       }
   1233     });
   1234   });
   1235   //--></script> 
   1236   <script type="text/javascript"><!--
   1237   $('#transaction').delegate('.pagination a', 'click', function(e) {
   1238     e.preventDefault();
   1239 
   1240     $('#transaction').load(this.href);
   1241   });
   1242 
   1243   $('#transaction').load('index.php?route=customer/customer/transaction&user_token={{ user_token }}&customer_id={{ customer_id }}');
   1244 
   1245   $('#button-transaction').on('click', function(e) {
   1246     e.preventDefault();
   1247 
   1248     $.ajax({
   1249       url: 'index.php?route=customer/customer/addtransaction&user_token={{ user_token }}&customer_id={{ customer_id }}',
   1250       type: 'post',
   1251       dataType: 'json',
   1252       data: 'description=' + encodeURIComponent($('#tab-transaction input[name=\'description\']').val()) + '&amount=' + encodeURIComponent($('#tab-transaction input[name=\'amount\']').val()),
   1253       beforeSend: function() {
   1254         $('#button-transaction').button('loading');
   1255       },
   1256       complete: function() {
   1257         $('#button-transaction').button('reset');
   1258       },
   1259       success: function(json) {
   1260         $('.alert-dismissible').remove();
   1261 
   1262         if (json['error']) {
   1263            $('#tab-transaction').prepend('<div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> ' + json['error'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
   1264         }
   1265 
   1266         if (json['success']) {
   1267           $('#tab-transaction').prepend('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
   1268 
   1269           $('#transaction').load('index.php?route=customer/customer/transaction&user_token={{ user_token }}&customer_id={{ customer_id }}');
   1270 
   1271           $('#tab-transaction input[name=\'amount\']').val('');
   1272           $('#tab-transaction input[name=\'description\']').val('');
   1273         }
   1274       },
   1275       error: function(xhr, ajaxOptions, thrownError) {
   1276         alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
   1277       }
   1278     });
   1279   });
   1280   //--></script> 
   1281   <script type="text/javascript"><!--
   1282   $('#reward').delegate('.pagination a', 'click', function(e) {
   1283     e.preventDefault();
   1284 
   1285     $('#reward').load(this.href);
   1286   });
   1287 
   1288   $('#reward').load('index.php?route=customer/customer/reward&user_token={{ user_token }}&customer_id={{ customer_id }}');
   1289 
   1290   $('#button-reward').on('click', function(e) {
   1291     e.preventDefault();
   1292 
   1293     $.ajax({
   1294       url: 'index.php?route=customer/customer/addreward&user_token={{ user_token }}&customer_id={{ customer_id }}',
   1295       type: 'post',
   1296       dataType: 'json',
   1297       data: 'description=' + encodeURIComponent($('#tab-reward input[name=\'description\']').val()) + '&points=' + encodeURIComponent($('#tab-reward input[name=\'points\']').val()),
   1298       beforeSend: function() {
   1299         $('#button-reward').button('loading');
   1300       },
   1301       complete: function() {
   1302         $('#button-reward').button('reset');
   1303       },
   1304       success: function(json) {
   1305         $('.alert-dismissible').remove();
   1306 
   1307         if (json['error']) {
   1308            $('#tab-reward').prepend('<div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> ' + json['error'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
   1309         }
   1310 
   1311         if (json['success']) {
   1312           $('#tab-reward').prepend('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
   1313 
   1314           $('#reward').load('index.php?route=customer/customer/reward&user_token={{ user_token }}&customer_id={{ customer_id }}');
   1315 
   1316           $('#tab-reward input[name=\'points\']').val('');
   1317           $('#tab-reward input[name=\'description\']').val('');
   1318         }
   1319       },
   1320       error: function(xhr, ajaxOptions, thrownError) {
   1321         alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
   1322       }
   1323     });
   1324   });
   1325 
   1326   $('#ip').delegate('.pagination a', 'click', function(e) {
   1327     e.preventDefault();
   1328 
   1329     $('#ip').load(this.href);
   1330   });
   1331 
   1332   $('#ip').load('index.php?route=customer/customer/ip&user_token={{ user_token }}&customer_id={{ customer_id }}');
   1333 
   1334   $('#content').delegate('button[id^=\'button-custom-field\'], button[id^=\'button-address\']', 'click', function() {
   1335     var node = this;
   1336 
   1337     $('#form-upload').remove();
   1338 
   1339     $('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input type="file" name="file" /></form>');
   1340 
   1341     $('#form-upload input[name=\'file\']').trigger('click');
   1342 
   1343     if (typeof timer != 'undefined') {
   1344         clearInterval(timer);
   1345     }
   1346 
   1347     timer = setInterval(function() {
   1348       if ($('#form-upload input[name=\'file\']').val() != '') {
   1349         clearInterval(timer);
   1350 
   1351         $.ajax({
   1352           url: 'index.php?route=tool/upload/upload&user_token={{ user_token }}',
   1353           type: 'post',
   1354           dataType: 'json',
   1355           data: new FormData($('#form-upload')[0]),
   1356           cache: false,
   1357           contentType: false,
   1358           processData: false,
   1359           beforeSend: function() {
   1360             $(node).button('loading');
   1361           },
   1362           complete: function() {
   1363             $(node).button('reset');
   1364           },
   1365           success: function(json) {
   1366             $(node).parent().find('.text-danger').remove();
   1367 
   1368             if (json['error']) {
   1369               $(node).parent().find('input[type=\'hidden\']').after('<div class="text-danger">' + json['error'] + '</div>');
   1370             }
   1371 
   1372             if (json['success']) {
   1373               alert(json['success']);
   1374             }
   1375 
   1376             if (json['code']) {
   1377               $(node).parent().find('input[type=\'hidden\']').val(json['code']);
   1378             }
   1379           },
   1380           error: function(xhr, ajaxOptions, thrownError) {
   1381             alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
   1382           }
   1383         });
   1384       }
   1385     }, 500);
   1386   });
   1387 
   1388   $('.date').datetimepicker({
   1389     language: '{{ datepicker }}',
   1390     pickTime: false
   1391   });
   1392 
   1393   $('.datetime').datetimepicker({
   1394     language: '{{ datepicker }}',
   1395     pickDate: true,
   1396     pickTime: true
   1397   });
   1398 
   1399   $('.time').datetimepicker({
   1400     language: '{{ datepicker }}',
   1401     pickDate: false
   1402   });
   1403 
   1404   // Sort the custom fields
   1405   {% set address_row = 1 %}
   1406   {% for address in addresses %}
   1407   $('#tab-address{{ address_row }} .form-group[data-sort]').detach().each(function() {
   1408     if ($(this).attr('data-sort') >= 0 && $(this).attr('data-sort') <= $('#tab-address{{ address_row }} .form-group').length) {
   1409       $('#tab-address{{ address_row }} .form-group').eq($(this).attr('data-sort')).before(this);
   1410     }
   1411 
   1412     if ($(this).attr('data-sort') > $('#tab-address{{ address_row }} .form-group').length) {
   1413       $('#tab-address{{ address_row }} .form-group:last').after(this);
   1414     }
   1415 
   1416     if ($(this).attr('data-sort') < -$('#tab-address{{ address_row }} .form-group').length) {
   1417       $('#tab-address{{ address_row }} .form-group:first').before(this);
   1418     }
   1419   });
   1420   {% set address_row = address_row + 1 %}
   1421   {% endfor %}
   1422 
   1423   $('#tab-customer .form-group[data-sort]').detach().each(function() {
   1424     if ($(this).attr('data-sort') >= 0 && $(this).attr('data-sort') <= $('#tab-customer .form-group').length) {
   1425       $('#tab-customer .form-group').eq($(this).attr('data-sort')).before(this);
   1426     }
   1427 
   1428     if ($(this).attr('data-sort') > $('#tab-customer .form-group').length) {
   1429       $('#tab-customer .form-group:last').after(this);
   1430     }
   1431 
   1432     if ($(this).attr('data-sort') < -$('#tab-customer .form-group').length) {
   1433       $('#tab-customer .form-group:first').before(this);
   1434     }
   1435   });
   1436 
   1437   $('#tab-affiliate .form-group[data-sort]').detach().each(function() {
   1438     if ($(this).attr('data-sort') >= 0 && $(this).attr('data-sort') <= $('#tab-affiliate .form-group').length) {
   1439       $('#tab-affiliate .form-group').eq($(this).attr('data-sort')).before(this);
   1440     }
   1441 
   1442     if ($(this).attr('data-sort') > $('#tab-affiliate .form-group').length) {
   1443       $('#tab-affiliate .form-group:last').after(this);
   1444     }
   1445 
   1446     if ($(this).attr('data-sort') < -$('#tab-affiliate .form-group').length) {
   1447       $('#tab-affiliate .form-group:first').before(this);
   1448     }
   1449   });
   1450   //--></script> 
   1451   <script type="text/javascript"><!--
   1452   $('input[name=\'payment\']').on('change', function() {
   1453     $('.payment').hide();
   1454 
   1455     $('#payment-' + this.value).show();
   1456   });
   1457 
   1458   $('input[name=\'payment\']:checked').trigger('change');
   1459   //--></script> 
   1460 </div>
   1461 {{ footer }}