shop.balmet.com

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

custom_field_form.twig (19389B)


      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-custom-field" 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-custom-field" class="form-horizontal">
     27                       <fieldset>
     28               <legend>{{ text_custom_field }}</legend>
     29           
     30           <div class="form-group required">
     31             <label class="col-sm-2 control-label">{{ entry_name }}</label>
     32             <div class="col-sm-10"> {% for language in languages %}
     33               <div class="input-group"><span class="input-group-addon"><img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /></span>
     34                 <input type="text" name="custom_field_description[{{ language.language_id }}][name]" value="{{ custom_field_description[language.language_id] ? custom_field_description[language.language_id].name }}" placeholder="{{ entry_name }}" class="form-control" />
     35               </div>
     36               {% if error_name[language.language_id] %}
     37               <div class="text-danger">{{ error_name[language.language_id] }}</div>
     38               {% endif %}
     39               {% endfor %}
     40             </div>
     41           </div>
     42           <div class="form-group">
     43             <label class="col-sm-2 control-label" for="input-location">{{ entry_location }}</label>
     44             <div class="col-sm-10">
     45               <select name="location" id="input-location" class="form-control">
     46                 
     47                 
     48 
     49                 {% if location == 'account' %}
     50 
     51                 
     52                 
     53                 <option value="account" selected="selected">{{ text_account }}</option>
     54                 
     55                 
     56 
     57                 {% else %}
     58 
     59                 
     60                 
     61                 <option value="account">{{ text_account }}</option>
     62                 
     63                 
     64 
     65                 {% endif %}
     66                 {% if location == 'address' %}
     67 
     68                 
     69                 
     70                 <option value="address" selected="selected">{{ text_address }}</option>
     71                 
     72                 
     73 
     74                 {% else %}
     75 
     76                 
     77                 
     78                 <option value="address">{{ text_address }}</option>
     79                 
     80                 
     81 
     82                 {% endif %}
     83 
     84 
     85                 {% if location == 'affiliate' %}
     86 
     87                 
     88                 
     89                 <option value="affiliate" selected="selected">{{ text_affiliate }}</option>
     90                 
     91                 
     92 
     93                 {% else %}
     94 
     95                 
     96                 
     97                 <option value="affiliate">{{ text_affiliate }}</option>
     98                 
     99                 
    100 
    101                 {% endif %}
    102 
    103 
    104               
    105               
    106               </select>
    107             </div>
    108           </div>
    109           <div class="form-group">
    110             <label class="col-sm-2 control-label" for="input-type">{{ entry_type }}</label>
    111             <div class="col-sm-10">
    112               <select name="type" id="input-type" class="form-control">
    113                 <optgroup label="{{ text_choose }}">
    114                 {% if type == 'select' %}
    115 
    116                 
    117                 
    118                 <option value="select" selected="selected">{{ text_select }}</option>
    119                 
    120                 
    121 
    122                 {% else %}
    123 
    124                 
    125                 
    126                 <option value="select">{{ text_select }}</option>
    127                 
    128                 
    129 
    130                 {% endif %}
    131                 {% if type == 'radio' %}
    132 
    133                 
    134                 
    135                 <option value="radio" selected="selected">{{ text_radio }}</option>
    136                 
    137                 
    138 
    139                 {% else %}
    140 
    141                 
    142                 
    143                 <option value="radio">{{ text_radio }}</option>
    144                 
    145                 
    146 
    147                 {% endif %}
    148                 {% if type == 'checkbox' %}
    149 
    150                 
    151                 
    152                 <option value="checkbox" selected="selected">{{ text_checkbox }}</option>
    153                 
    154                 
    155 
    156                 {% else %}
    157 
    158                 
    159                 
    160                 <option value="checkbox">{{ text_checkbox }}</option>
    161                 
    162                 
    163 
    164                 {% endif %}
    165                 </optgroup>
    166                 <optgroup label="{{ text_input }}">
    167                 {% if type == 'text' %}
    168 
    169                 
    170                 
    171                 <option value="text" selected="selected">{{ text_text }}</option>
    172                 
    173                 
    174 
    175                 {% else %}
    176 
    177                 
    178                 
    179                 <option value="text">{{ text_text }}</option>
    180                 
    181                 
    182 
    183                 {% endif %}
    184                 {% if type == 'textarea' %}
    185 
    186                 
    187                 
    188                 <option value="textarea" selected="selected">{{ text_textarea }}</option>
    189                 
    190                 
    191 
    192                 {% else %}
    193 
    194                 
    195                 
    196                 <option value="textarea">{{ text_textarea }}</option>
    197                 
    198                 
    199 
    200                 {% endif %}
    201                 </optgroup>
    202                 <optgroup label="{{ text_file }}">
    203                 {% if type == 'file' %}
    204 
    205                 
    206                 
    207                 <option value="file" selected="selected">{{ text_file }}</option>
    208                 
    209                 
    210 
    211                 {% else %}
    212 
    213                 
    214                 
    215                 <option value="file">{{ text_file }}</option>
    216                 
    217                 
    218 
    219                 {% endif %}
    220                 </optgroup>
    221                 <optgroup label="{{ text_date }}">
    222                 {% if type == 'date' %}
    223 
    224                 
    225                 
    226                 <option value="date" selected="selected">{{ text_date }}</option>
    227                 
    228                 
    229 
    230                 {% else %}
    231 
    232                 
    233                 
    234                 <option value="date">{{ text_date }}</option>
    235                 
    236                 
    237 
    238                 {% endif %}
    239                 {% if type == 'time' %}
    240 
    241                 
    242                 
    243                 <option value="time" selected="selected">{{ text_time }}</option>
    244                 
    245                 
    246 
    247                 {% else %}
    248 
    249                 
    250                 
    251                 <option value="time">{{ text_time }}</option>
    252                 
    253                 
    254 
    255                 {% endif %}
    256                 {% if type == 'datetime' %}
    257 
    258                 
    259                 
    260                 <option value="datetime" selected="selected">{{ text_datetime }}</option>
    261                 
    262                 
    263 
    264                 {% else %}
    265 
    266                 
    267                 
    268                 <option value="datetime">{{ text_datetime }}</option>
    269                 
    270                 
    271 
    272                 {% endif %}
    273                 </optgroup>
    274               </select>
    275             </div>
    276           </div>
    277           <div class="form-group" id="display-value">
    278             <label class="col-sm-2 control-label" for="input-value">{{ entry_value }}</label>
    279             <div class="col-sm-10">
    280               <input type="text" name="value" value="{{ value }}" placeholder="{{ entry_value }}" id="input-value" class="form-control" />
    281             </div>
    282           </div>
    283           <div class="form-group" id="display-validation">
    284             <label class="col-sm-2 control-label" for="input-validation"><span data-toggle="tooltip" title="{{ help_regex }}">{{ entry_validation }}</span></label>
    285             <div class="col-sm-10">
    286               <input type="text" name="validation" id="input-validation" value="{{ validation }}" placeholder="{{ text_regex }}"  class="form-control"/>
    287             </div>
    288           </div>
    289           <div class="form-group">
    290             <label class="col-sm-2 control-label">{{ entry_customer_group }}</label>
    291             <div class="col-sm-10">{% set customer_group_row = 0 %}
    292               {% for customer_group in customer_groups %}
    293               <div class="checkbox">
    294                 <label> {% if customer_group.customer_group_id in custom_field_customer_group %}
    295                   <input type="checkbox" name="custom_field_customer_group[{{ customer_group_row }}][customer_group_id]" value="{{ customer_group.customer_group_id }}" checked="checked" />
    296                   {{ customer_group.name }}
    297                   {% else %}
    298                   <input type="checkbox" name="custom_field_customer_group[{{ customer_group_row }}][customer_group_id]" value="{{ customer_group.customer_group_id }}" />
    299                   {{ customer_group.name }}
    300                   {% endif %} </label>
    301               </div>
    302               {% set customer_group_row = customer_group_row + 1 %}
    303               {% endfor %}</div>
    304           </div>
    305           <div class="form-group">
    306             <label class="col-sm-2 control-label">{{ entry_required }}</label>
    307             <div class="col-sm-10">{% set customer_group_row = 0 %}
    308               {% for customer_group in customer_groups %}
    309               <div class="checkbox">
    310                 <label> {% if customer_group.customer_group_id in custom_field_required %}
    311                   <input type="checkbox" name="custom_field_customer_group[{{ customer_group_row }}][required]" value="{{ customer_group.customer_group_id }}" checked="checked" />
    312                   {{ customer_group.name }}
    313                   {% else %}
    314                   <input type="checkbox" name="custom_field_customer_group[{{ customer_group_row }}][required]" value="{{ customer_group.customer_group_id }}" />
    315                   {{ customer_group.name }}
    316                   {% endif %}</label>
    317               </div>
    318               {% set customer_group_row = customer_group_row + 1 %}
    319               {% endfor %}</div>
    320           </div>
    321           <div class="form-group">
    322             <label class="col-sm-2 control-label" for="input-status">{{ entry_status }}</label>
    323             <div class="col-sm-10">
    324               <select name="status" id="input-status" class="form-control">
    325                 
    326                 
    327 
    328                 {% if status %}
    329 
    330                 
    331                 
    332                 <option value="1" selected="selected">{{ text_enabled }}</option>
    333                 <option value="0">{{ text_disabled }}</option>
    334                 
    335                 
    336 
    337                 {% else %}
    338 
    339                 
    340                 
    341                 <option value="1">{{ text_enabled }}</option>
    342                 <option value="0" selected="selected">{{ text_disabled }}</option>
    343                 
    344                 
    345 
    346                 {% endif %}
    347 
    348               
    349               
    350               </select>
    351             </div>
    352           </div>
    353           <div class="form-group">
    354             <label class="col-sm-2 control-label" for="input-sort-order"><span data-toggle="tooltip" title="{{ help_sort_order }}">{{ entry_sort_order }}</span></label>
    355             <div class="col-sm-10">
    356               <input type="text" name="sort_order" value="{{ sort_order }}" placeholder="{{ entry_sort_order }}" id="input-sort-order" class="form-control" />
    357             </div>
    358           </div>
    359           </fieldset>
    360           <br />
    361           <div id="custom-field-value">
    362             <fieldset>
    363               <legend>{{ text_value }}</legend>
    364               <table class="table table-striped table-bordered table-hover">
    365                 <thead>
    366                   <tr>
    367                     <td class="text-left required">{{ entry_custom_value }}</td>
    368                     <td class="text-right">{{ entry_sort_order }}</td>
    369                     <td></td>
    370                   </tr>
    371                 </thead>
    372                 <tbody>
    373                 
    374                 {% set custom_field_value_row = 0 %}
    375                 {% for custom_field_value in custom_field_values %}
    376                 <tr id="custom-field-value-row{{ custom_field_value_row }}">
    377                   <td class="text-left" style="width: 70%;"><input type="hidden" name="custom_field_value[{{ custom_field_value_row }}][custom_field_value_id]" value="{{ custom_field_value.custom_field_value_id }}" />
    378                     {% for language in languages %}
    379                     <div class="input-group"> <span class="input-group-addon"><img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /></span>
    380                       <input type="text" name="custom_field_value[{{ custom_field_value_row }}][custom_field_value_description][{{ language.language_id }}][name]" value="{{ custom_field_value.custom_field_value_description[language.language_id] ? custom_field_value.custom_field_value_description[language.language_id].name }}" placeholder="{{ entry_custom_value }}" class="form-control" />
    381                     </div>
    382                     {% if error_custom_field_value[custom_field_value_row][language.language_id] %}
    383                     <div class="text-danger">{{ error_custom_field_value[custom_field_value_row][language.language_id] }}</div>
    384                     {% endif %}
    385                     {% endfor %}</td>
    386                   <td class="text-right"><input type="text" name="custom_field_value[{{ custom_field_value_row }}][sort_order]" value="{{ custom_field_value.sort_order }}" placeholder="{{ entry_sort_order }}" class="form-control" /></td>
    387                   <td class="text-left"><button onclick="$('#custom-field-value-row{{ custom_field_value_row }}').remove();" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>
    388                 </tr>
    389                 {% set custom_field_value_row = custom_field_value_row + 1 %}
    390                 {% endfor %}
    391                   </tbody>
    392                 
    393                 <tfoot>
    394                   <tr>
    395                     <td colspan="2"></td>
    396                     <td class="text-left"><button type="button" onclick="addCustomFieldValue();" data-toggle="tooltip" title="{{ button_custom_field_value_add }}" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></td>
    397                   </tr>
    398                 </tfoot>
    399               </table>
    400             </fieldset>
    401           </div>
    402         </form>
    403       </div>
    404     </div>
    405   </div>
    406   <script type="text/javascript"><!--
    407 $('select[name=\'type\']').on('change', function() {
    408 	if (this.value == 'select' || this.value == 'radio' || this.value == 'checkbox') {
    409 		$('#custom-field-value').show();
    410 		$('#display-value, #display-validation').hide();
    411 	} else {
    412 		$('#custom-field-value').hide();
    413 		$('#display-value, #display-validation').show();
    414 	}
    415 
    416 	if (this.value == 'date') {
    417 		$('#display-value > div').html('<div class="input-group date"><input type="text" name="value" value="' + $('#input-value').val() + '" placeholder="{{ entry_value }}" data-date-format="YYYY-MM-DD" id="input-value" class="form-control" /><span class="input-group-btn"><button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button></span></div>');
    418 	} else if (this.value == 'time') {
    419 		$('#display-value > div').html('<div class="input-group time"><input type="text" name="value" value="' + $('#input-value').val() + '" placeholder="{{ entry_value }}" data-date-format="HH:mm" id="input-value" class="form-control" /><span class="input-group-btn"><button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button></span></div>');
    420 	} else if (this.value == 'datetime') {
    421 		$('#display-value > div').html('<div class="input-group datetime"><input type="text" name="value" value="' + $('#input-value').val() + '" placeholder="{{ entry_value }}" data-date-format="YYYY-MM-DD HH:mm" id="input-value" class="form-control" /><span class="input-group-btn"><button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button></span></div>');
    422 	} else if (this.value == 'textarea') {
    423 		$('#display-value > div').html('<textarea name="value" placeholder="{{ entry_value }}" id="input-value" class="form-control">' + $('#input-value').val() + '</textarea>');
    424 	} else {
    425 		$('#display-value > div').html('<input type="text" name="value" value="' + $('#input-value').val() + '" placeholder="{{ entry_value }}" id="input-value" class="form-control" />');
    426 	}
    427 
    428 	$('.date').datetimepicker({
    429 		language: '{{ datepicker }}',
    430 		pickTime: false
    431 	});
    432 
    433 	$('.time').datetimepicker({
    434 		language: '{{ datepicker }}',
    435 		pickDate: false
    436 	});
    437 
    438 	$('.datetime').datetimepicker({
    439 		language: '{{ datepicker }}',
    440 		pickDate: true,
    441 		pickTime: true
    442 	});
    443 });
    444 
    445 $('select[name=\'type\']').trigger('change');
    446 
    447 var custom_field_value_row = {{ custom_field_value_row }};
    448 
    449 function addCustomFieldValue() {
    450 	html  = '<tr id="custom-field-value-row' + custom_field_value_row + '">';
    451     html += '  <td class="text-left" style="width: 70%;"><input type="hidden" name="custom_field_value[' + custom_field_value_row + '][custom_field_value_id]" value="" />';
    452 	{% for language in languages %}
    453 	html += '    <div class="input-group">';
    454 	html += '      <span class="input-group-addon"><img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /></span><input type="text" name="custom_field_value[' + custom_field_value_row + '][custom_field_value_description][{{ language.language_id }}][name]" value="" placeholder="{{ entry_custom_value }}" class="form-control" />';
    455     html += '    </div>';
    456 	{% endfor %}
    457 	html += '  </td>';
    458 	html += '  <td class="text-right"><input type="text" name="custom_field_value[' + custom_field_value_row + '][sort_order]" value="" placeholder="{{ entry_sort_order }}" class="form-control" /></td>';
    459 	html += '  <td class="text-left"><button type="button" onclick="$(\'#custom-field-value-row' + custom_field_value_row + '\').remove();" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>';
    460 	html += '</tr>';
    461 
    462 	$('#custom-field-value tbody').append(html);
    463 
    464 	custom_field_value_row++;
    465 }
    466 //--></script></div>
    467 {{ footer }}