1var App = function() { 2 3 this.init = function() { 4 this.initDropForm(); 5 } 6 7 this.initDropForm = function() { 8 var _this = this; 9 $('#button-drop').click(function() { 10 _this.sendDropForm(); 11 }); 12 } 13 14 this.sendDropForm = function() { 15 var data = this.validateDropForm(); 16 17 if(data == null) return; 18 19 $.ajax({ 20 url: 'index.php?route=information/information/write&information_id=7', 21 type: 'post', 22 data: data, 23 dataType: 'json', 24 cache: false, 25 success: function(json) { 26 $('.alert-dismissible').remove(); 27 28 if (json['error']) { 29 let errorOption = ''; 30 31 $.each(json['error'], function(i, val) { 32 $('#form-drop [name="' + i + '"]').addClass('error_style'); 33 errorOption += '<div class="alert-text-item">' + val + '</div>'; 34 }); 35 36 fmNotify('danger', errorOption); 37 } 38 39 if (json['success']) { 40 fmNotify('success', json['success']); 41 $('input[name=\'name\']').val(''); 42 $('input[name=\'surname\']').val(''); 43 $('input[name=\'namea\']').val(''); 44 $('input[name=\'phone\']').val(''); 45 $('input[name=\'email\']').val(''); 46 $('input[name=\'work\']:checked').prop('checked', false); 47 $('input[name=\'where\']:checked').prop('checked', false); 48 dataLayer.push({'event': 'button3-drop-opt'}); 49 } 50 } 51 }); 52 } 53 54 this.validateDropForm = function() { 55 var where = []; 56 $('input[name=\'where\']:checked').each(function(index, el) { 57 where.push($(el).val()); 58 }); 59 var data = { 60 name: $('input[name=\'name\']').val(), 61 surname: $('input[name=\'surname\']').val(), 62 namea: $('input[name=\'namea\']').val(), 63 phone: $('input[name=\'phone\']').val(), 64 email: $('input[name=\'email\']').val(), 65 work: $('input[name=\'work\']:checked').val(), 66 where: where 67 } 68 69 if(data.name === '') { fmNotify('danger', $('#error_name').html()); return null; } 70 if(data.surname === '') { fmNotify('danger', $('#error_surname').html()); return null; } 71 if(data.namea === '') { fmNotify('danger', $('#error_namea').html()); return null; } 72 if(data.phone === '') { fmNotify('danger', $('#error_phone').html()); return null; } 73 if(data.email === '') { fmNotify('danger', $('#error_email').html()); return null; } 74 75 return data; 76 } 77 78 this.updateCart = function() { 79 80 } 81 82 this.setOnlyVouchers = function() { 83 $('input[name=shipping_method]').val('samsklad.samsklad'); 84 $('#simplecheckout_shipping').hide(); 85 $('#simplecheckout_shipping_address').hide(); 86 console.log("Only voucher in cart"); 87 } 88 89} 90 91var app = new App(); 92 93$(function() { 94 app.init(); 95});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.