Subversion Repositories SmartDukaan

Rev

Rev 30599 | Rev 31274 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 30599 Rev 31083
Line 1... Line 1...
1
var customerId;
1
var customerId;
-
 
2
 
2
function formLoaded() {
3
function formLoaded() {
3
	$("form#cd input").each(function() {
4
	$("form#cd input").each(function () {
4
		$(this).attr('autocomplete', 'off');
5
		$(this).attr('autocomplete', 'off');
5
	});
6
	});
6
	$('form#cd').validate({
7
	$('form#cd').validate({
7
		rules: {
8
		rules: {
8
			name: {
9
			name: {
Line 58... Line 59...
58
				required: "Required",
59
				required: "Required",
59
				digits: "Invalid number",
60
				digits: "Invalid number",
60
				minlength: "Number should be of 10 digits"
61
				minlength: "Number should be of 10 digits"
61
			}
62
			}
62
		},
63
		},
63
		submitHandler: function(form, event) {
64
		submitHandler: function (form, event) {
64
			event.preventDefault();
65
			event.preventDefault();
65
			var payload = orderDetailsPayload();
66
			var payload = orderDetailsPayload();
66
			if (!validateOrderDetails()) {
67
			if (!validateOrderDetails()) {
67
				alert("Please fix highlighted errors");
68
				alert("Please fix highlighted errors");
68
				return false;
69
				return false;
69
			}
70
			}
70
			doPostAjaxRequestWithJsonHandler(context + "/create-order", payload, function(response) {
71
			doPostAjaxRequestWithJsonHandler(context + "/create-order", payload, function (response) {
71
				emptyBag();
72
				emptyBag();
72
				$('#main-content').html(response);
73
				$('#main-content').html(response);
73
			});
74
			});
74
			return false; // required to block normal submit since you used
75
			return false; // required to block normal submit since you used
75
			// ajax
76
			// ajax
76
		}
77
		}
-
 
78
 
77
	});
79
	});
78
 
80
 
-
 
81
	$('form#newaddress').validate({
-
 
82
		rules: {
-
 
83
			firstName: {
-
 
84
				required: true
-
 
85
			},
-
 
86
			line1: {
-
 
87
				required: true
-
 
88
			},
-
 
89
			state: {
-
 
90
				required: true
-
 
91
			},
-
 
92
			city: {
-
 
93
				required: true
-
 
94
			},
-
 
95
			pinCode: {
-
 
96
				required: true,
-
 
97
				digits: true,
-
 
98
				minlength: 6,
-
 
99
				maxlength: 6,
-
 
100
			},
-
 
101
			alternatePhone: {
-
 
102
				required: true,
-
 
103
				minlength: 10,
-
 
104
				maxlength: 10,
-
 
105
				digits: true
-
 
106
			},
-
 
107
		},
-
 
108
		messages: {
-
 
109
			firstName: {
-
 
110
				required: "Required"
-
 
111
			},
-
 
112
			line1: {
-
 
113
				required: "Required"
-
 
114
			},
-
 
115
			state: {
-
 
116
				required: "State required"
-
 
117
			},
-
 
118
			city: {
-
 
119
				required: "City required"
-
 
120
			},
-
 
121
			pinCode: {
-
 
122
				required: "Required",
-
 
123
				digits: "Invalid pin"
-
 
124
			},
-
 
125
			alternatePhone: {
-
 
126
				required: "Required",
-
 
127
				digits: "Invalid number",
-
 
128
				minlength: "Number should be of 10 digits"
-
 
129
			}
-
 
130
		},
-
 
131
		submitHandler: function (form, event) {
-
 
132
			event.preventDefault();
-
 
133
			let customerAddress = {};
-
 
134
			customerAddress['name'] = $("#firstName").val();
-
 
135
			customerAddress['lastName'] = $("#lastName").val();
-
 
136
			customerAddress['line1'] = $("#line1").val();
-
 
137
			customerAddress['line2'] = $("#line2").val();
-
 
138
			customerAddress['landmark'] = $("#landmark").val();
-
 
139
			customerAddress['city'] = $("#city").val();
-
 
140
			customerAddress['state'] = $('select[name=state] option:selected').val();
-
 
141
			customerAddress['pinCode'] = $("#pinCode").val();
-
 
142
			customerAddress['phoneNumber'] = $("#alternatePhone").val();
-
 
143
			customerAddress['country'] = "India";
-
 
144
			doPostAjaxRequestWithJsonHandler(`${context}/customer/address?customerId=${customerId}`, JSON.stringify(customerAddress), function (response) {
-
 
145
				$("#address-body").prepend(getAddressTr(response.response));
-
 
146
				$('#newaddressModal').modal('toggle');
-
 
147
				$("#address-body").find('a.select-address').click();
-
 
148
			});
-
 
149
		}
-
 
150
 
-
 
151
	});
-
 
152
 
79
	$("input.unitPrice").on('change', function() {
153
	$("input.unitPrice").on('change', function () {
80
		var $element = $(this);
154
		var $element = $(this);
81
		var unitPrice = parseFloat($element.val());
155
		var unitPrice = parseFloat($element.val());
82
		if (!isNaN(unitPrice)) {
156
		if (!isNaN(unitPrice)) {
83
			var itemType = parseFloat($(this).closest('tr').find('.serialNumber').attr("itemType"));
157
			var itemType = parseFloat($(this).closest('tr').find('.serialNumber').attr("itemType"));
84
			var mopPrice = parseFloat($(this).attr('mopPrice'));
158
			var mopPrice = parseFloat($(this).attr('mopPrice'));
Line 90... Line 164...
90
				$element.addClass("border-highlight");
164
				$element.addClass("border-highlight");
91
			} else if (!accessoriesDeals && unitPrice < mopPrice) {
165
			} else if (!accessoriesDeals && unitPrice < mopPrice) {
92
				alert("Selling Price must be greater than equal to MOP");
166
				alert("Selling Price must be greater than equal to MOP");
93
				$element.addClass("border-highlight");
167
				$element.addClass("border-highlight");
94
			} else if (itemType == 'SERIALIZED' && unitPrice < mopPrice) {
168
			} else if (itemType == 'SERIALIZED' && unitPrice < mopPrice) {
95
				if(isMop) {
169
				if (isMop) {
96
					alert("Selling Price must be greater than equal to MOP");
170
					alert("Selling Price must be greater than equal to MOP");
97
					$element.addClass("border-highlight");
171
					$element.addClass("border-highlight");
98
				}
172
				}
99
			} else if (itemType == 'NON_SERIALIZED' && unitPrice < dp) {
173
			} else if (itemType == 'NON_SERIALIZED' && unitPrice < dp) {
100
				alert("Selling Price must be greater than equal to DP");
174
				alert("Selling Price must be greater than equal to DP");
Line 109... Line 183...
109
		calculateTotalAmount();
183
		calculateTotalAmount();
110
	});
184
	});
111
	customerInfo = $("div.customerinfo").html();
185
	customerInfo = $("div.customerinfo").html();
112
	billingInfo = $("div.billinginfo").html();
186
	billingInfo = $("div.billinginfo").html();
113
 
187
 
114
	$("input.search-phone").change(function() {
188
	$("input.search-phone").change(function () {
115
		resetInputs();
189
		resetInputs();
116
		var mobileNumber = $(this).val();
190
		var mobileNumber = $(this).val();
117
		console.log(mobileNumber)
191
		console.log(mobileNumber)
118
		if (mobileNumber.length < 10 || mobileNumber.length > 10 ) {
192
		if (mobileNumber.length < 10 || mobileNumber.length > 10) {
119
			alert("Mobile Number is must be 10 digits");
193
			alert("Mobile Number is must be 10 digits");
120
			return false;
194
			return false;
121
		}
-
 
122
		else {
195
		} else {
123
				writeOldCustomerDetailsByMobileNumber(mobileNumber);
196
			writeOldCustomerDetailsByMobileNumber(mobileNumber);
124
		}
197
		}
125
	});
198
	});
126
 
199
 
127
	$(document).on('click', 'button.new-address-btn', function() {
200
	$(document).on('click', 'button.new-address-btn', function () {
128
		$('#newaddressModal').modal({ show: true });
201
		$('#newaddressModal').modal({show: true});
129
	});
202
	});
130
 
203
 
131
	$(document).on('click', 'button.mk_add_email', function() {
204
	$(document).on('click', 'button.mk_add_email', function () {
132
		let customerObj = {};
205
		let customerObj = {};
133
		customerObj['customerId'] = customerId;
206
		customerObj['customerId'] = customerId;
134
		customerObj['emailId'] = $("#emailId").val();
207
		customerObj['emailId'] = $("#emailId").val();
135
		if (validateEmail(customerObj['emailId'])) {
208
		if (validateEmail(customerObj['emailId'])) {
136
			doPostAjaxRequestWithJsonHandler(`${context}/customer/add-email`, JSON.stringify(customerObj), function(response) {
209
			doPostAjaxRequestWithJsonHandler(`${context}/customer/add-email`, JSON.stringify(customerObj), function (response) {
137
				alert("Email added");
210
				alert("Email added");
138
				$("input.search-phone").val(customerObj['mobileNumber']).change();
211
				$("input.search-phone").val(customerObj['mobileNumber']).change();
139
			});
212
			});
140
		} else {
213
		} else {
141
			alert("Invalid email id");
214
			alert("Invalid email id");
142
		}
215
		}
143
 
216
 
144
	});
217
	});
145
	$(document).on('click', 'button.mk_add_customer', function() {
218
	$(document).on('click', 'button.mk_add_customer', function () {
146
		customerObj = {}
219
		customerObj = {}
147
		if ($("input.firstName").val().length == 0) {
220
		if ($("input.firstName").val().length == 0) {
148
			alert("First Name is required");
221
			alert("First Name is required");
149
			return false;
222
			return false;
150
		}
223
		}
Line 152... Line 225...
152
		customerObj['lastName'] = $("input.lastName").val();
225
		customerObj['lastName'] = $("input.lastName").val();
153
		customerObj['emailId'] = $("#emailId").val();
226
		customerObj['emailId'] = $("#emailId").val();
154
 
227
 
155
		console.log(customerObj['emailId']);
228
		console.log(customerObj['emailId']);
156
		customerObj['mobileNumber'] = $("input.phone").val();
229
		customerObj['mobileNumber'] = $("input.phone").val();
157
		doPostAjaxRequestWithJsonHandler(`${context}/customer/add`, JSON.stringify(customerObj), function(response) {
230
		doPostAjaxRequestWithJsonHandler(`${context}/customer/add`, JSON.stringify(customerObj), function (response) {
158
			alert("Customer added");
231
			alert("Customer added");
159
			$("input.search-phone").change();
232
			$("input.search-phone").change();
160
		});
233
		});
161
 
234
 
162
 
235
 
163
	});
236
	});
164
	$(document).on('click', 'a.select-address', function() {
237
	$(document).on('click', 'a.select-address', function () {
165
		$(this).closest('table').data("addressselected", "true").find('td').css("font-weight", "normal");
238
		$(this).closest('table').data("addressselected", "true").find('td').css("font-weight", "normal");
166
		$(this).closest('tr').find('td').css("font-weight", "bold");
239
		$(this).closest('tr').find('td').css("font-weight", "bold");
167
		selectedAddressId = $(this).data("addressid");
240
		selectedAddressId = $(this).data("addressid");
168
	});
241
	});
169
	$(document).on('click', 'button.btn-add-address', function() {
242
	$(document).on('click', 'button.btn-add-address', function() {
170
		var customerAddress = {};
-
 
171
		customerAddress['name'] = $("#firstName").val();
-
 
172
		customerAddress['lastName'] = $("#lastName").val();
-
 
173
		customerAddress['line1'] = $("#line1").val();
-
 
174
		customerAddress['line2'] = $("#line2").val();
-
 
175
		customerAddress['landmark'] = $("#landmark").val();
-
 
176
		customerAddress['city'] = $("#city").val();
-
 
177
		customerAddress['state'] = $('select[name=state] option:selected').val();
-
 
178
		customerAddress['pinCode'] = $("#pinCode").val();
-
 
179
		customerAddress['phoneNumber'] = $("#alternatePhone").val();
-
 
180
		customerAddress['country'] = "India";
-
 
181
		console.log(customerAddress);
-
 
182
		doPostAjaxRequestWithJsonHandler(`${context}/customer/address?customerId=${customerId}`, JSON.stringify(customerAddress), function(response) {
-
 
183
			$("#address-body").prepend(getAddressTr(response.response));
-
 
184
			$('#newaddressModal').modal('toggle');
243
		$("form#newaddress").submit();
185
			$("#address-body").find('a.select-address').click();
-
 
186
		});
-
 
187
	});
244
	});
188
 
245
 
189
}
246
}
190
function validateOrderDetails() {
247
function validateOrderDetails() {
191
	var sNumbers = [];
248
	var sNumbers = [];
192
	var error = false;
249
	var error = false;
193
	$("form#cd input.serialNumber").each(function() {
250
	$("form#cd input.serialNumber").each(function () {
194
		var input = $(this).val().trim();
251
		var input = $(this).val().trim();
195
		var itemType = $(this).attr("itemType");
252
		var itemType = $(this).attr("itemType");
196
		$(this).removeClass("border-highlight");
253
		$(this).removeClass("border-highlight");
197
		if (sNumbers.indexOf(input) != -1 || (itemType === 'SERIALIZED' && !input)) {
254
		if (sNumbers.indexOf(input) != -1 || (itemType === 'SERIALIZED' && !input)) {
198
			error = true;
255
			error = true;
199
			$(this).addClass("border-highlight");
256
			$(this).addClass("border-highlight");
200
		}
257
		}
201
		sNumbers.push(input);
258
		sNumbers.push(input);
202
	});
259
	});
203
 
260
 
204
	$("form#cd input.unitPrice").each(function() {
261
	$("form#cd input.unitPrice").each(function () {
205
		var input = $(this).val().trim();
262
		var input = $(this).val().trim();
206
		$(this).removeClass("border-highlight");
263
		$(this).removeClass("border-highlight");
207
		if (!input || parseInt(input) <= 0 || isNaN(input)) {
264
		if (!input || parseInt(input) <= 0 || isNaN(input)) {
208
			error = true;
265
			error = true;
209
			$(this).addClass("border-highlight");
266
			$(this).addClass("border-highlight");
Line 218... Line 275...
218
		$("form#cd input[name=gstNumber]").addClass("border-highlight");
275
		$("form#cd input[name=gstNumber]").addClass("border-highlight");
219
	}
276
	}
220
 
277
 
221
	var amount = 0;
278
	var amount = 0;
222
	var netPayableAmount = parseFloat($("form#cd input.netPayableAmount").val());
279
	var netPayableAmount = parseFloat($("form#cd input.netPayableAmount").val());
223
	$("form#cd input.amount").each(function() {
280
	$("form#cd input.amount").each(function () {
224
		if ($(this).val() == "") {
281
		if ($(this).val() == "") {
225
			$(this).val(0);
282
			$(this).val(0);
226
		}
283
		}
227
		var tmpAmount = parseFloat($(this).val());
284
		var tmpAmount = parseFloat($(this).val());
228
		amount = amount + tmpAmount;
285
		amount = amount + tmpAmount;
Line 235... Line 292...
235
		if (amount < netPayableAmount) {
292
		if (amount < netPayableAmount) {
236
			alert("[" + (netPayableAmount - amount) + "] is more required to complete the payment");
293
			alert("[" + (netPayableAmount - amount) + "] is more required to complete the payment");
237
		} else {
294
		} else {
238
			alert("[" + (amount - netPayableAmount) + "] is extra amount, please reduce the amount");
295
			alert("[" + (amount - netPayableAmount) + "] is extra amount, please reduce the amount");
239
		}
296
		}
240
		$("form#cd input.netPayableAmount").each(function() {
297
		$("form#cd input.netPayableAmount").each(function () {
241
			$(this).addClass("border-highlight");
298
			$(this).addClass("border-highlight");
242
		});
299
		});
243
		error = true;
300
		error = true;
244
	}
301
	}
245
 
302
 
Line 261... Line 318...
261
		insurance = true;
318
		insurance = true;
262
		globalInsurace = true;
319
		globalInsurace = true;
263
	} else {
320
	} else {
264
		insurance = false;
321
		insurance = false;
265
	}
322
	}
266
	return { 'serialNumber': $serialNumberElement.val(), 'insurance': insurance, 'amount': insuranceAmount }
323
	return {'serialNumber': $serialNumberElement.val(), 'insurance': insurance, 'amount': insuranceAmount}
267
}
324
}
268
 
325
 
269
function orderDetailsPayload() {
326
function orderDetailsPayload() {
270
	var orderObj = {};
327
	var orderObj = {};
271
	var priceQtyArray = [];
328
	var priceQtyArray = [];
272
	var customerObj = {};
329
	var customerObj = {};
273
	var paymentOptionIdAmount = [];
330
	var paymentOptionIdAmount = [];
274
	var globalInsurance = false;
331
	var globalInsurance = false;
275
 
332
 
276
	$("form#cd input.serialNumber").each(function() {
333
	$("form#cd input.serialNumber").each(function () {
277
		var itemId = parseInt($(this).attr("itemId"));
334
		var itemId = parseInt($(this).attr("itemId"));
278
		if (orderObj.hasOwnProperty('fofoOrderItems')) {
335
		if (orderObj.hasOwnProperty('fofoOrderItems')) {
279
			var itemDetails = orderObj['fofoOrderItems'];
336
			var itemDetails = orderObj['fofoOrderItems'];
280
			if (itemDetails.hasOwnProperty(itemId)) {
337
			if (itemDetails.hasOwnProperty(itemId)) {
281
				var serialNumbers = itemDetails[itemId];
338
				var serialNumbers = itemDetails[itemId];
Line 293... Line 350...
293
			tmp[itemId] = serialNumbers;
350
			tmp[itemId] = serialNumbers;
294
			orderObj['fofoOrderItems'] = tmp;
351
			orderObj['fofoOrderItems'] = tmp;
295
		}
352
		}
296
	});
353
	});
297
	console.log(JSON.stringify(orderObj));
354
	console.log(JSON.stringify(orderObj));
298
	$("#order-items").find("tr:not(:first-child)").each(function(index, el) {
355
	$("#order-items").find("tr:not(:first-child)").each(function (index, el) {
299
		// console.log(el);
356
		// console.log(el);
300
		// console.log(index);
357
		// console.log(index);
301
		var $el = $(el);
358
		var $el = $(el);
302
		var $unitPriceElement = $el.find('.unitPrice');
359
		var $unitPriceElement = $el.find('.unitPrice');
303
		var $discountElement = $el.find('.discount');
360
		var $discountElement = $el.find('.discount');
304
 
361
 
305
		var itemId = parseInt($unitPriceElement.attr("itemId"));
362
		var itemId = parseInt($unitPriceElement.attr("itemId"));
306
		var unitPrice = parseFloat($unitPriceElement.val());
363
		var unitPrice = parseFloat($unitPriceElement.val());
307
		var discount = parseFloat($discountElement.val());
364
		var discount = parseFloat($discountElement.val());
308
		if(isNaN(discount)) {
365
		if (isNaN(discount)) {
309
			discount = 0;
366
			discount = 0;
310
		}
367
		}
311
		var qty = parseInt($unitPriceElement.attr("quantity"));
368
		var qty = parseInt($unitPriceElement.attr("quantity"));
-
 
369
		var tmpObj = {
-
 
370
			'itemId': itemId,
312
		var tmpObj = { 'itemId': itemId, 'sellingPrice': unitPrice-discount, 'quantity': qty, 'discountAmount' : discount };
371
			'sellingPrice': unitPrice - discount,
-
 
372
			'quantity': qty,
-
 
373
			'discountAmount': discount
-
 
374
		};
313
 
375
 
314
		if (orderObj['fofoOrderItems'][itemId] === undefined) {
376
		if (orderObj['fofoOrderItems'][itemId] === undefined) {
315
			tmpObj['serialNumberDetails'] = [];
377
			tmpObj['serialNumberDetails'] = [];
316
		} else {
378
		} else {
317
			// tmpObj['serialNumbers'] = orderObj['fofoLineItems'][itemId];
379
			// tmpObj['serialNumbers'] = orderObj['fofoLineItems'][itemId];
Line 328... Line 390...
328
		if (!found) {
390
		if (!found) {
329
			priceQtyArray.push(tmpObj);
391
			priceQtyArray.push(tmpObj);
330
		}
392
		}
331
	});
393
	});
332
 
394
 
333
	$("#order-items").find("tr:not(:first-child)").each(function(index, el) {
395
	$("#order-items").find("tr:not(:first-child)").each(function (index, el) {
334
		// console.log(el);
396
		// console.log(el);
335
		// console.log(index);
397
		// console.log(index);
336
		var $serialNumberElement = $(el).find('.serialNumber');
398
		var $serialNumberElement = $(el).find('.serialNumber');
337
		var itemId = parseInt($serialNumberElement.attr("itemId"));
399
		var itemId = parseInt($serialNumberElement.attr("itemId"));
338
		var insuranceEle = $(el).find('.insuranceamount');
400
		var insuranceEle = $(el).find('.insuranceamount');
Line 397... Line 459...
397
 
459
 
398
function resetInputs() {
460
function resetInputs() {
399
	$("div.customerinfo").html(customerInfo);
461
	$("div.customerinfo").html(customerInfo);
400
	$("div.billinginfo").html(billingInfo).hide();
462
	$("div.billinginfo").html(billingInfo).hide();
401
}
463
}
-
 
464
 
402
function writeOldCustomerDetailsByMobileNumber(mobileNumber) {
465
function writeOldCustomerDetailsByMobileNumber(mobileNumber) {
403
	doAjaxRequestHandler(context + "/customer/mobileNumber?mobileNumber=" + mobileNumber, "GET", function(response) {
466
	doAjaxRequestHandler(context + "/customer/mobileNumber?mobileNumber=" + mobileNumber, "GET", function (response) {
404
		if (response.response == '') {
467
		if (response.response == '') {
405
			return;
468
			return;
406
		}
469
		}
407
		var customer = response.response;
470
		var customer = response.response;
408
		if (customer == null) {
471
		if (customer == null) {
Line 418... Line 481...
418
			$('#emailId').attr('value', customer.emailId).attr('readonly', true);
481
			$('#emailId').attr('value', customer.emailId).attr('readonly', true);
419
			console.log('helo');
482
			console.log('helo');
420
		} else {
483
		} else {
421
			$('button.mk_add_email').show();
484
			$('button.mk_add_email').show();
422
		}
485
		}
423
		$('#firstName').attr('value', customer.firstName);
486
		$('#firstName').val(customer.firstName);
424
		$('#lastName').attr('value', customer.lastName);
487
		$('#lastName').val(customer.lastName);
425
		$('#alternatePhone').attr('value', customer.mobileNumber);
488
		$('#alternatePhone').val(customer.mobileNumber);
426
		customerId = customer.customerId;
489
		customerId = customer.customerId;
427
		$("div.billinginfo").show();
490
		$("div.billinginfo").show();
428
		trs = [];
491
		trs = [];
429
		if (customer.addresses != null) {
492
		if (customer.addresses != null) {
430
			for (address of customer.addresses) {
493
			for (address of customer.addresses) {
Line 440... Line 503...
440
		}
503
		}
441
		$("#address-body").html(trs.join(""));
504
		$("#address-body").html(trs.join(""));
442
 
505
 
443
	});
506
	});
444
}
507
}
-
 
508
 
445
function getAddressTr(address) {
509
function getAddressTr(address) {
446
	var tr = [];
510
	var tr = [];
447
	tr.push(`<tr><td>${address.name} ${address.lastName}</td>`);
511
	tr.push(`<tr><td>${address.name} ${address.lastName}</td>`);
448
	tr.push(`<td>${address.line1}, ${address.line2}</td>`);
512
	tr.push(`<td>${address.line1}, ${address.line2}</td>`);
449
	tr.push(`<td>${address.city}</td>`);
513
	tr.push(`<td>${address.city}</td>`);
Line 451... Line 515...
451
	tr.push(`<td>${address.pinCode}</td>`);
515
	tr.push(`<td>${address.pinCode}</td>`);
452
	tr.push(`<td>${address.phoneNumber}</td>`);
516
	tr.push(`<td>${address.phoneNumber}</td>`);
453
	tr.push(`<td><a class="select-address" href="javascript:void(0);" data-addressid="${address.id}">Select address</a></td></tr>`);
517
	tr.push(`<td><a class="select-address" href="javascript:void(0);" data-addressid="${address.id}">Select address</a></td></tr>`);
454
	return tr.join("");
518
	return tr.join("");
455
}
519
}
-
 
520
 
456
function validateEmail(email) {
521
function validateEmail(email) {
457
	const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
522
	const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
458
	return re.test(String(email).toLowerCase());
523
	return re.test(String(email).toLowerCase());
459
}
-
 
460
524
}
-
 
525