shop.balmet.com

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

payment_address.twig (16800B)


      1 <form class="form-horizontal">
      2   {% if addresses %}
      3   <div class="radio">
      4     <label>
      5       <input type="radio" name="payment_address" value="existing" checked="checked" />
      6       {{ text_address_existing }}</label>
      7   </div>
      8   <div id="payment-existing">
      9     <select name="address_id" class="form-control">
     10      {% for address in addresses %}
     11       {% if address['address_id'] == address_id %}
     12       <option value="{{ address.address_id }}" selected="selected">{{ address.firstname }} {{ address.lastname }}, {{ address.address_1 }}, {{ address.city }}, {{ address.zone }}, {{ address.country }}</option>
     13       {% else %}
     14       <option value="{{ address.address_id }}">{{ address.firstname }} {{ address.lastname }}, {{ address.address_1 }}, {{ address.city }}, {{ address.zone }}, {{ address.country }}</option>
     15       {% endif %}
     16       {% endfor %}
     17     </select>
     18   </div>
     19   <div class="radio">
     20     <label>
     21       <input type="radio" name="payment_address" value="new" />
     22       {{ text_address_new }}</label>
     23   </div>
     24   {% endif %}
     25   <br />
     26   <div id="payment-new" style="display: {% if addresses %}none{% else %}block{% endif %};">
     27     <div class="form-group required">
     28       <label class="col-sm-2 control-label" for="input-payment-firstname">{{ entry_firstname }}</label>
     29       <div class="col-sm-10">
     30         <input type="text" name="firstname" value="" placeholder="{{ entry_firstname }}" id="input-payment-firstname" class="form-control" />
     31       </div>
     32     </div>
     33     <div class="form-group required">
     34       <label class="col-sm-2 control-label" for="input-payment-lastname">{{ entry_lastname }}</label>
     35       <div class="col-sm-10">
     36         <input type="text" name="lastname" value="" placeholder="{{ entry_lastname }}" id="input-payment-lastname" class="form-control" />
     37       </div>
     38     </div>
     39     <div class="form-group">
     40       <label class="col-sm-2 control-label" for="input-payment-company">{{ entry_company }}</label>
     41       <div class="col-sm-10">
     42         <input type="text" name="company" value="" placeholder="{{ entry_company }}" id="input-payment-company" class="form-control" />
     43       </div>
     44     </div>
     45     <div class="form-group required">
     46       <label class="col-sm-2 control-label" for="input-payment-address-1">{{ entry_address_1 }}</label>
     47       <div class="col-sm-10">
     48         <input type="text" name="address_1" value="" placeholder="{{ entry_address_1 }}" id="input-payment-address-1" class="form-control" />
     49       </div>
     50     </div>
     51     <div class="form-group">
     52       <label class="col-sm-2 control-label" for="input-payment-address-2">{{ entry_address_2 }}</label>
     53       <div class="col-sm-10">
     54         <input type="text" name="address_2" value="" placeholder="{{ entry_address_2 }}" id="input-payment-address-2" class="form-control" />
     55       </div>
     56     </div>
     57     <div class="form-group required">
     58       <label class="col-sm-2 control-label" for="input-payment-city">{{ entry_city }}</label>
     59       <div class="col-sm-10">
     60         <input type="text" name="city" value="" placeholder="{{ entry_city }}" id="input-payment-city" class="form-control" />
     61       </div>
     62     </div>
     63     <div class="form-group required">
     64       <label class="col-sm-2 control-label" for="input-payment-postcode">{{ entry_postcode }}</label>
     65       <div class="col-sm-10">
     66         <input type="text" name="postcode" value="" placeholder="{{ entry_postcode }}" id="input-payment-postcode" class="form-control" />
     67       </div>
     68     </div>
     69     <div class="form-group required">
     70       <label class="col-sm-2 control-label" for="input-payment-country">{{ entry_country }}</label>
     71       <div class="col-sm-10">
     72         <select name="country_id" id="input-payment-country" class="form-control">
     73           <option value="">{{ text_select }}</option>
     74          {% for country in countries %}
     75           {% if country.country_id == country_id %}
     76           <option value="{{ country.country_id }}" selected="selected">{{ country.name }}</option>
     77           {% else %}
     78           <option value="{{ country.country_id }}">{{ country.name }}</option>
     79           {% endif %}
     80           {% endfor %}
     81         </select>
     82       </div>
     83     </div>
     84     <div class="form-group required">
     85       <label class="col-sm-2 control-label" for="input-payment-zone">{{ entry_zone }}</label>
     86       <div class="col-sm-10">
     87         <select name="zone_id" id="input-payment-zone" class="form-control">
     88         </select>
     89       </div>
     90     </div>
     91     {% for custom_field in custom_fields %}
     92     {% if custom_field.type == 'select' %}
     93     <div class="form-group{% if custom_field.required %} required {% endif %} custom-field" data-sort="{{ custom_field.sort_order }}">
     94       <label class="col-sm-2 control-label" for="input-payment-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
     95       <div class="col-sm-10">
     96         <select name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" id="input-payment-custom-field{{ custom_field.custom_field_id }}" class="form-control">
     97           <option value="">{{ text_select }}</option>
     98           {% for custom_field_value in custom_field.custom_field_value %}
     99           <option value="{{ custom_field_value.custom_field_value_id }}">{{ custom_field_value.name }}</option>
    100           {% endfor %}
    101         </select>
    102       </div>
    103     </div>
    104     {% endif %}
    105     {% if custom_field.type == 'radio' %}
    106     <div class="form-group{% if custom_field.required %} required {% endif %} custom-field" data-sort="{{ custom_field.sort_order }}">
    107       <label class="col-sm-2 control-label">{{ custom_field.name }}</label>
    108       <div class="col-sm-10">
    109         <div id="input-payment-custom-field{{ custom_field.custom_field_id }}">
    110           {% for custom_field_value in custom_field.custom_field_value %}
    111           <div class="radio">
    112             <label>
    113               <input type="radio" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{{ custom_field_value.custom_field_value_id }}" />
    114               {{ custom_field_value.name }}</label>
    115           </div>
    116           {% endfor %}
    117         </div>
    118       </div>
    119     </div>
    120     {% endif %}
    121     {% if custom_field.type == 'checkbox' %}
    122     <div class="form-group{% if custom_field.required %} required {% endif %} custom-field" data-sort="{{ custom_field.sort_order }}">
    123       <label class="col-sm-2 control-label">{{ custom_field.name }}</label>
    124       <div class="col-sm-10">
    125         <div id="input-payment-custom-field{{ custom_field.custom_field_id }}">
    126           {% for custom_field_value in custom_field.custom_field_value %}
    127           <div class="checkbox">
    128             <label>
    129               <input type="checkbox" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}][]" value="{{ custom_field_value.custom_field_value_id }}" />
    130               {{ custom_field_value.name }}</label>
    131           </div>
    132           {% endfor %}
    133         </div>
    134       </div>
    135     </div>
    136     {% endif %}
    137     {% if custom_field.type == 'text' %}
    138     <div class="form-group{% if custom_field.required %} required {% endif %} custom-field" data-sort="{{ custom_field.sort_order }}">
    139       <label class="col-sm-2 control-label" for="input-payment-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
    140       <div class="col-sm-10">
    141         <input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{{ custom_field.value }}" placeholder="{{ custom_field.name }}" id="input-payment-custom-field{{ custom_field.custom_field_id }}" class="form-control" />
    142       </div>
    143     </div>
    144     {% endif %}
    145     {% if custom_field.type == 'textarea' %}
    146     <div class="form-group{% if custom_field.required %} required {% endif %} custom-field" data-sort="{{ custom_field.sort_order }}">
    147       <label class="col-sm-2 control-label" for="input-payment-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
    148       <div class="col-sm-10">
    149         <textarea name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" rows="5" placeholder="{{ custom_field.name }}" id="input-payment-custom-field{{ custom_field.custom_field_id }}" class="form-control">{{ custom_field.value }}</textarea>
    150       </div>
    151     </div>
    152     {% endif %}
    153     {% if custom_field.type == 'file' %}
    154     <div class="form-group{% if custom_field.required %} required {% endif %} custom-field" data-sort="{{ custom_field.sort_order }}">
    155       <label class="col-sm-2 control-label">{{ custom_field.name }}</label>
    156       <div class="col-sm-10">
    157         <button type="button" id="button-payment-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>
    158         <input type="hidden" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="" id="input-payment-custom-field{{ custom_field.custom_field_id }}" />
    159       </div>
    160     </div>
    161     {% endif %}
    162     {% if custom_field.type == 'date' %}
    163     <div class="form-group{% if custom_field.required %} required {% endif %} custom-field" data-sort="{{ custom_field.sort_order }}">
    164       <label class="col-sm-2 control-label" for="input-payment-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
    165       <div class="col-sm-10">
    166         <div class="input-group date">
    167           <input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{{ custom_field.value }}" placeholder="{{ custom_field.name }}" data-date-format="YYYY-MM-DD" id="input-payment-custom-field{{ custom_field.custom_field_id }}" class="form-control" />
    168           <span class="input-group-btn">
    169           <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
    170           </span></div>
    171       </div>
    172     </div>
    173     {% endif %}
    174     {% if custom_field.type == 'time' %}
    175     <div class="form-group{% if custom_field.required %} required {% endif %} custom-field" data-sort="{{ custom_field.sort_order }}">
    176       <label class="col-sm-2 control-label" for="input-payment-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
    177       <div class="col-sm-10">
    178         <div class="input-group time">
    179           <input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{{ custom_field.value }}" placeholder="{{ custom_field.name }}" data-date-format="HH:mm" id="input-payment-custom-field{{ custom_field.custom_field_id }}" class="form-control" />
    180           <span class="input-group-btn">
    181           <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
    182           </span></div>
    183       </div>
    184     </div>
    185     {% endif %}
    186     {% if custom_field.type == 'time' %}
    187     <div class="form-group{% if custom_field.required %} required {% endif %} custom-field" data-sort="{{ custom_field.sort_order }}">
    188       <label class="col-sm-2 control-label" for="input-payment-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
    189       <div class="col-sm-10">
    190         <div class="input-group datetime">
    191           <input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{{ custom_field.value }}" placeholder="{{ custom_field.name }}" data-date-format="YYYY-MM-DD HH:mm" id="input-payment-custom-field{{ custom_field.custom_field_id }}" class="form-control" />
    192           <span class="input-group-btn">
    193           <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
    194           </span></div>
    195       </div>
    196     </div>
    197     {% endif %}
    198     {% endfor %}
    199   </div>
    200   <div class="buttons clearfix">
    201     <div class="pull-right">
    202       <input type="button" value="{{ button_continue }}" id="button-payment-address" data-loading-text="{{ text_loading }}" class="btn btn-primary" />
    203     </div>
    204   </div>
    205 </form>
    206 <script type="text/javascript"><!--
    207 $('input[name=\'payment_address\']').on('change', function() {
    208 	if (this.value == 'new') {
    209 		$('#payment-existing').hide();
    210 		$('#payment-new').show();
    211 	} else {
    212 		$('#payment-existing').show();
    213 		$('#payment-new').hide();
    214 	}
    215 });
    216 //--></script>
    217 <script type="text/javascript"><!--
    218 // Sort the custom fields
    219 $('#collapse-payment-address .form-group[data-sort]').detach().each(function() {
    220 	if ($(this).attr('data-sort') >= 0 && $(this).attr('data-sort') <= $('#collapse-payment-address .form-group').length-2) {
    221 		$('#collapse-payment-address .form-group').eq(parseInt($(this).attr('data-sort'))+2).before(this);
    222 	}
    223 
    224 	if ($(this).attr('data-sort') > $('#collapse-payment-address .form-group').length-2) {
    225 		$('#collapse-payment-address .form-group:last').after(this);
    226 	}
    227 
    228 	if ($(this).attr('data-sort') == $('#collapse-payment-address .form-group').length-2) {
    229 		$('#collapse-payment-address .form-group:last').after(this);
    230 	}
    231 
    232 	if ($(this).attr('data-sort') < -$('#collapse-payment-address .form-group').length-2) {
    233 		$('#collapse-payment-address .form-group:first').before(this);
    234 	}
    235 });
    236 //--></script>
    237 <script type="text/javascript"><!--
    238 $('#collapse-payment-address button[id^=\'button-payment-custom-field\']').on('click', function() {
    239 	var element = this;
    240 
    241 	$('#form-upload').remove();
    242 
    243 	$('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input type="file" name="file" /></form>');
    244 
    245 	$('#form-upload input[name=\'file\']').trigger('click');
    246 
    247 	if (typeof timer != 'undefined') {
    248     	clearInterval(timer);
    249 	}
    250 
    251 	timer = setInterval(function() {
    252 		if ($('#form-upload input[name=\'file\']').val() != '') {
    253 			clearInterval(timer);
    254 
    255 			$.ajax({
    256 				url: 'index.php?route=tool/upload',
    257 				type: 'post',
    258 				dataType: 'json',
    259 				data: new FormData($('#form-upload')[0]),
    260 				cache: false,
    261 				contentType: false,
    262 				processData: false,
    263 				beforeSend: function() {
    264 					$(element).button('loading');
    265 				},
    266 				complete: function() {
    267 					$(element).button('reset');
    268 				},
    269 				success: function(json) {
    270 					$(element).parent().find('.text-danger').remove();
    271 
    272 					if (json['error']) {
    273 						$(element).parent().find('input[name^=\'custom_field\']').after('<div class="text-danger">' + json['error'] + '</div>');
    274 					}
    275 
    276 					if (json['success']) {
    277 						alert(json['success']);
    278 
    279 						$(element).parent().find('input[name^=\'custom_field\']').val(json['code']);
    280 					}
    281 				},
    282 				error: function(xhr, ajaxOptions, thrownError) {
    283 					alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
    284 				}
    285 			});
    286 		}
    287 	}, 500);
    288 });
    289 //--></script>
    290 <script type="text/javascript"><!--
    291 $('.date').datetimepicker({
    292 	language: '{{ datepicker }}',
    293 	pickTime: false
    294 });
    295 
    296 $('.time').datetimepicker({
    297 	language: '{{ datepicker }}',
    298 	pickDate: false
    299 });
    300 
    301 $('.datetime').datetimepicker({
    302 	language: '{{ datepicker }}',
    303 	pickDate: true,
    304 	pickTime: true
    305 });
    306 //--></script>
    307 <script type="text/javascript"><!--
    308 $('#collapse-payment-address select[name=\'country_id\']').on('change', function() {
    309 	$.ajax({
    310 		url: 'index.php?route=checkout/checkout/country&country_id=' + this.value,
    311 		dataType: 'json',
    312 		beforeSend: function() {
    313 			$('#collapse-payment-address select[name=\'country_id\']').prop('disabled', true);
    314 		},
    315 		complete: function() {
    316 			$('#collapse-payment-address select[name=\'country_id\']').prop('disabled', false);
    317 		},
    318 		success: function(json) {
    319 			if (json['postcode_required'] == '1') {
    320 				$('#collapse-payment-address input[name=\'postcode\']').parent().parent().addClass('required');
    321 			} else {
    322 				$('#collapse-payment-address input[name=\'postcode\']').parent().parent().removeClass('required');
    323 			}
    324 
    325 			html = '<option value="">{{ text_select }}</option>';
    326 
    327 			if (json['zone'] && json['zone'] != '') {
    328 				for (i = 0; i < json['zone'].length; i++) {
    329 					html += '<option value="' + json['zone'][i]['zone_id'] + '"';
    330 
    331 					if (json['zone'][i]['zone_id'] == '{{ zone_id }}') {
    332 						html += ' selected="selected"';
    333 					}
    334 
    335 					html += '>' + json['zone'][i]['name'] + '</option>';
    336 				}
    337 			} else {
    338 				html += '<option value="0" selected="selected">{{ text_none }}</option>';
    339 			}
    340 
    341 			$('#collapse-payment-address select[name=\'zone_id\']').html(html);
    342 		},
    343 		error: function(xhr, ajaxOptions, thrownError) {
    344 			alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
    345 		}
    346 	});
    347 });
    348 
    349 $('#collapse-payment-address select[name=\'country_id\']').trigger('change');
    350 //--></script>