| 27187 |
amit.gupta |
1 |
var customerId;
|
| 24440 |
amit.gupta |
2 |
function formLoaded() {
|
| 27187 |
amit.gupta |
3 |
$("form#cd input").each(function(){
|
| 22245 |
ashik.ali |
4 |
$(this).attr('autocomplete', 'off');
|
|
|
5 |
});
|
| 27187 |
amit.gupta |
6 |
$('form#cd').validate({
|
|
|
7 |
rules:{
|
|
|
8 |
name:{
|
|
|
9 |
required:true
|
|
|
10 |
},
|
|
|
11 |
email:{
|
|
|
12 |
required:true,
|
|
|
13 |
email:true
|
|
|
14 |
},
|
|
|
15 |
line1:{
|
|
|
16 |
required:true
|
|
|
17 |
},
|
|
|
18 |
state:{
|
|
|
19 |
required:true
|
|
|
20 |
},
|
|
|
21 |
city:{
|
|
|
22 |
required:true
|
|
|
23 |
},
|
|
|
24 |
pincode:{
|
|
|
25 |
required:true,
|
|
|
26 |
digits:true,
|
|
|
27 |
minlength: 6,
|
|
|
28 |
maxlength: 6,
|
|
|
29 |
},
|
|
|
30 |
phone:{
|
|
|
31 |
required:true,
|
|
|
32 |
minlength:10,
|
|
|
33 |
maxlength:10,
|
|
|
34 |
digits:true
|
|
|
35 |
},
|
|
|
36 |
},
|
|
|
37 |
messages:{
|
|
|
38 |
name:{
|
|
|
39 |
required:"Required"
|
|
|
40 |
},
|
|
|
41 |
line1:{
|
|
|
42 |
required:"Required"
|
|
|
43 |
},
|
|
|
44 |
state:{
|
|
|
45 |
required: "State required"
|
|
|
46 |
},
|
|
|
47 |
city:{
|
|
|
48 |
required: "City required"
|
|
|
49 |
},
|
|
|
50 |
email:{
|
|
|
51 |
require: "Required"
|
|
|
52 |
},
|
|
|
53 |
pincode:{
|
|
|
54 |
required: "Required",
|
|
|
55 |
digits:"Invalid pin"
|
|
|
56 |
},
|
|
|
57 |
phone:{
|
|
|
58 |
required: "Required",
|
|
|
59 |
digits:"Invalid number",
|
|
|
60 |
minlength:"Number should be of 10 digits"
|
|
|
61 |
}
|
|
|
62 |
},
|
|
|
63 |
submitHandler: function (form, event) {
|
|
|
64 |
event.preventDefault();
|
|
|
65 |
var payload = orderDetailsPayload();
|
|
|
66 |
if(!validateOrderDetails()){
|
|
|
67 |
alert("Please fix highlighted errors");
|
|
|
68 |
return false;
|
|
|
69 |
}
|
|
|
70 |
doPostAjaxRequestWithJsonHandler(context+"/create-order", payload, function(response){
|
|
|
71 |
emptyBag();
|
|
|
72 |
$('#main-content').html(response);
|
| 23353 |
ashik.ali |
73 |
});
|
| 27187 |
amit.gupta |
74 |
return false; // required to block normal submit since you used
|
|
|
75 |
// ajax
|
|
|
76 |
}
|
|
|
77 |
});
|
|
|
78 |
|
|
|
79 |
$("input.unitPrice").on('change', function() {
|
|
|
80 |
var $element = $(this);
|
|
|
81 |
var unitPrice = parseFloat($element.val());
|
|
|
82 |
if(!isNaN(unitPrice)) {
|
|
|
83 |
var itemType = parseFloat($(this).closest('tr').find('.serialNumber').attr("itemType"));
|
|
|
84 |
var mopPrice = parseFloat($(this).attr('mopPrice'));
|
|
|
85 |
var dp = parseFloat($(this).attr('dp'));
|
|
|
86 |
var mrp = parseFloat($(this).attr('mrp'));
|
|
|
87 |
if(mrp != 0 && unitPrice > mrp) {
|
|
|
88 |
alert("Selling Price should not be greater than MRP");
|
|
|
89 |
$element.addClass("border-highlight");
|
|
|
90 |
} else if(!accessoriesDeals && unitPrice < mopPrice){
|
|
|
91 |
alert("Selling Price must be greater than equal to MOP");
|
|
|
92 |
$element.addClass("border-highlight");
|
|
|
93 |
}else if(itemType=='SERIALIZED' && unitPrice < mopPrice){
|
|
|
94 |
alert("Selling Price must be greater than equal to MOP");
|
|
|
95 |
$element.addClass("border-highlight");
|
|
|
96 |
}else if(itemType=='NON_SERIALIZED' && unitPrice < dp){
|
|
|
97 |
alert("Selling Price must be greater than equal to DP");
|
|
|
98 |
$element.addClass("border-highlight");
|
|
|
99 |
}else{
|
|
|
100 |
$element.removeClass("border-highlight");
|
|
|
101 |
}
|
|
|
102 |
// Clear insurance values if price changes
|
|
|
103 |
$(this).closest('tr').find('.insuranceid').val("");
|
|
|
104 |
$(this).closest('tr').find('.insuranceamount').val("0");
|
|
|
105 |
}
|
|
|
106 |
calculateTotalAmount();
|
|
|
107 |
});
|
|
|
108 |
customerInfo = $("div.customerinfo").html();
|
|
|
109 |
billingInfo = $("div.billinginfo").html();
|
|
|
110 |
|
|
|
111 |
$( "input.search-phone").change(function() {
|
|
|
112 |
resetInputs();
|
| 22354 |
ashik.ali |
113 |
var mobileNumber = $(this).val();
|
| 27187 |
amit.gupta |
114 |
if(mobileNumber.length < 10) {
|
| 23405 |
amit.gupta |
115 |
return;
|
|
|
116 |
}
|
| 22354 |
ashik.ali |
117 |
writeOldCustomerDetailsByMobileNumber(mobileNumber);
|
|
|
118 |
});
|
| 27187 |
amit.gupta |
119 |
|
|
|
120 |
$('button.new-address-btn').live('click', function() {
|
|
|
121 |
$('#newaddressModal').modal({show: true});
|
|
|
122 |
});
|
|
|
123 |
|
|
|
124 |
$('button.mk_add_customer').live('click', function() {
|
|
|
125 |
customerObj = {}
|
|
|
126 |
if($("input.firstName").val().length==0) {
|
|
|
127 |
alert("First Name is required");
|
|
|
128 |
return false;
|
|
|
129 |
}
|
|
|
130 |
customerObj['firstName'] = $("input.firstName").val();
|
|
|
131 |
customerObj['lastName'] = $("input.lastName").val();
|
|
|
132 |
customerObj['emailId'] = $("#email").val();
|
|
|
133 |
customerObj['mobileNumber'] = $("input.phone").val();
|
|
|
134 |
doPostAjaxRequestWithJsonHandler(`${context}/customer/add`, JSON.stringify(customerObj), function(response){
|
|
|
135 |
alert("Customer added");
|
|
|
136 |
$( "input.search-phone").val(customerObj['mobileNumber']).change();
|
|
|
137 |
});
|
|
|
138 |
|
|
|
139 |
|
|
|
140 |
});
|
|
|
141 |
$('a.select-address').live('click', function() {
|
|
|
142 |
$(this).closest('table').data("addressselected", "true").find('td').css("font-weight", "normal");
|
|
|
143 |
$(this).closest('tr').find('td').css("font-weight", "bold");
|
|
|
144 |
selectedAddressId = $(this).data("addressid");
|
|
|
145 |
});
|
|
|
146 |
$('button.btn-add-address').live('click', function(){
|
|
|
147 |
var customerAddress = {};
|
|
|
148 |
customerAddress['name'] = $("#firstName").val();
|
|
|
149 |
customerAddress['lastName'] = $("#lastName").val();
|
|
|
150 |
customerAddress['line1'] = $("#line1").val();
|
|
|
151 |
customerAddress['line2'] = $("#line2").val();
|
|
|
152 |
customerAddress['landmark'] = $("#landmark").val();
|
|
|
153 |
customerAddress['city'] = $("#city").val();
|
|
|
154 |
customerAddress['state'] = $('select[name=state] option:selected').val();
|
|
|
155 |
customerAddress['pinCode'] = $("#pinCode").val();
|
|
|
156 |
customerAddress['phoneNumber'] = $("#alternatePhone").val();
|
|
|
157 |
customerAddress['country'] = "India";
|
|
|
158 |
console.log(customerAddress);
|
|
|
159 |
doPostAjaxRequestWithJsonHandler(`${context}/customer/address?customerId=${customerId}`, JSON.stringify(customerAddress), function(response){
|
|
|
160 |
$("#address-body").prepend(getAddressTr(response.response));
|
|
|
161 |
$('#newaddressModal').modal('toggle');
|
|
|
162 |
$("#address-body").find('a.select-address').click();
|
|
|
163 |
});
|
|
|
164 |
});
|
|
|
165 |
|
| 24440 |
amit.gupta |
166 |
}
|
| 27187 |
amit.gupta |
167 |
function validateOrderDetails(){
|
| 23343 |
ashik.ali |
168 |
var sNumbers = [];
|
|
|
169 |
var error = false;
|
| 27187 |
amit.gupta |
170 |
$("form#cd input.serialNumber").each(function(){
|
| 23343 |
ashik.ali |
171 |
var input = $(this).val().trim();
|
| 27187 |
amit.gupta |
172 |
var itemType = $(this).attr("itemType");
|
| 23343 |
ashik.ali |
173 |
$(this).removeClass("border-highlight");
|
| 27187 |
amit.gupta |
174 |
if (sNumbers.indexOf(input) !=-1 || (itemType ==='SERIALIZED' && !input)){
|
| 23343 |
ashik.ali |
175 |
error = true;
|
|
|
176 |
$(this).addClass("border-highlight");
|
|
|
177 |
}
|
| 27187 |
amit.gupta |
178 |
sNumbers.push(input);
|
| 23343 |
ashik.ali |
179 |
});
|
| 27187 |
amit.gupta |
180 |
|
|
|
181 |
$("form#cd input.unitPrice").each(function(){
|
|
|
182 |
var input = $(this).val().trim();
|
|
|
183 |
$(this).removeClass("border-highlight");
|
|
|
184 |
if (!input || parseInt(input)<=0 || isNaN(input)){
|
|
|
185 |
error=true;
|
|
|
186 |
$(this).addClass("border-highlight");
|
|
|
187 |
}
|
|
|
188 |
});
|
|
|
189 |
|
| 23370 |
ashik.ali |
190 |
var gstNumber = $("form#cd input[name=gstNumber]").val();
|
|
|
191 |
$("form#cd input[name=gstNumber]").removeClass("border-highlight");
|
| 27187 |
amit.gupta |
192 |
if(gstNumber.length > 0 && gstNumber.length != 15){
|
| 23370 |
ashik.ali |
193 |
alert("Please provide valid gstNumber");
|
|
|
194 |
error = true;
|
|
|
195 |
$("form#cd input[name=gstNumber]").addClass("border-highlight");
|
|
|
196 |
}
|
| 27187 |
amit.gupta |
197 |
|
| 23343 |
ashik.ali |
198 |
var amount = 0;
|
|
|
199 |
var netPayableAmount = parseFloat($("form#cd input.netPayableAmount").val());
|
| 27187 |
amit.gupta |
200 |
$("form#cd input.amount").each(function(){
|
|
|
201 |
if ($(this).val() == ""){
|
| 23343 |
ashik.ali |
202 |
$(this).val(0);
|
|
|
203 |
}
|
|
|
204 |
var tmpAmount = parseFloat($(this).val());
|
|
|
205 |
amount = amount + tmpAmount;
|
|
|
206 |
});
|
| 27187 |
amit.gupta |
207 |
|
| 23343 |
ashik.ali |
208 |
console.log(amount);
|
|
|
209 |
console.log(netPayableAmount);
|
| 27187 |
amit.gupta |
210 |
|
|
|
211 |
if (amount != netPayableAmount){
|
|
|
212 |
if(amount < netPayableAmount){
|
|
|
213 |
alert("[" + (netPayableAmount - amount) + "] is more required to complete the payment");
|
|
|
214 |
}else{
|
|
|
215 |
alert("[" + (amount - netPayableAmount) + "] is extra amount, please reduce the amount");
|
| 23343 |
ashik.ali |
216 |
}
|
| 27187 |
amit.gupta |
217 |
$("form#cd input.netPayableAmount").each(function(){
|
| 23343 |
ashik.ali |
218 |
$(this).addClass("border-highlight");
|
|
|
219 |
});
|
|
|
220 |
error = true;
|
|
|
221 |
}
|
| 27187 |
amit.gupta |
222 |
|
|
|
223 |
if (error){
|
| 23343 |
ashik.ali |
224 |
return false;
|
|
|
225 |
}
|
|
|
226 |
return true;
|
| 27187 |
amit.gupta |
227 |
|
| 23347 |
ashik.ali |
228 |
}
|
|
|
229 |
|
| 27187 |
amit.gupta |
230 |
|
|
|
231 |
function getSerialNumbersFromOrder($el){
|
| 23347 |
ashik.ali |
232 |
var $serialNumberElement = $el.find('.serialNumber');
|
| 27187 |
amit.gupta |
233 |
if($serialNumberElement.val() == ''){
|
| 23347 |
ashik.ali |
234 |
return null;
|
|
|
235 |
}
|
| 24440 |
amit.gupta |
236 |
var insuranceAmount = parseFloat($el.find('.insuranceamount').val());
|
| 27187 |
amit.gupta |
237 |
if(insuranceAmount > 0){
|
| 23347 |
ashik.ali |
238 |
insurance = true;
|
|
|
239 |
globalInsurace = true;
|
| 27187 |
amit.gupta |
240 |
}else{
|
| 23347 |
ashik.ali |
241 |
insurance = false;
|
|
|
242 |
}
|
| 27187 |
amit.gupta |
243 |
return {'serialNumber':$serialNumberElement.val(),'insurance':insurance,'amount':insuranceAmount}
|
| 23347 |
ashik.ali |
244 |
}
|
|
|
245 |
|
| 27187 |
amit.gupta |
246 |
function orderDetailsPayload(){
|
| 23419 |
ashik.ali |
247 |
var orderObj = {};
|
|
|
248 |
var priceQtyArray = [];
|
|
|
249 |
var customerObj = {};
|
|
|
250 |
var paymentOptionIdAmount = [];
|
|
|
251 |
var globalInsurance = false;
|
| 27187 |
amit.gupta |
252 |
|
|
|
253 |
$("form#cd input.serialNumber").each(function(){
|
| 23419 |
ashik.ali |
254 |
var itemId = parseInt($(this).attr("itemId"));
|
| 27187 |
amit.gupta |
255 |
if (orderObj.hasOwnProperty('fofoOrderItems')){
|
| 23419 |
ashik.ali |
256 |
var itemDetails = orderObj['fofoOrderItems'];
|
| 27187 |
amit.gupta |
257 |
if (itemDetails.hasOwnProperty(itemId)){
|
| 23419 |
ashik.ali |
258 |
var serialNumbers = itemDetails[itemId];
|
|
|
259 |
serialNumbers.push($(this).val());
|
|
|
260 |
itemDetails[itemId] = serialNumbers;
|
| 27187 |
amit.gupta |
261 |
}else{
|
| 23347 |
ashik.ali |
262 |
var serialNumbers = [];
|
|
|
263 |
serialNumbers.push($(this).val());
|
| 23419 |
ashik.ali |
264 |
itemDetails[itemId] = serialNumbers;
|
| 23347 |
ashik.ali |
265 |
}
|
| 27187 |
amit.gupta |
266 |
}else{
|
| 23419 |
ashik.ali |
267 |
var serialNumbers = [];
|
|
|
268 |
serialNumbers.push($(this).val());
|
| 27187 |
amit.gupta |
269 |
var tmp ={};
|
|
|
270 |
tmp[itemId] = serialNumbers;
|
| 23419 |
ashik.ali |
271 |
orderObj['fofoOrderItems'] = tmp;
|
|
|
272 |
}
|
|
|
273 |
});
|
| 27187 |
amit.gupta |
274 |
console.log( JSON.stringify(orderObj));
|
|
|
275 |
$("#order-items").find("tr:not(:first-child)").each(function(index, el){
|
|
|
276 |
// console.log(el);
|
|
|
277 |
// console.log(index);
|
|
|
278 |
var $el = $(el);
|
|
|
279 |
var $unitPriceElement = $el.find('.unitPrice');
|
|
|
280 |
|
|
|
281 |
var itemId = parseInt($unitPriceElement.attr("itemId"));
|
|
|
282 |
var unitPrice = parseFloat($unitPriceElement.val());
|
|
|
283 |
var qty = parseInt($unitPriceElement.attr("quantity"));
|
|
|
284 |
var tmpObj = {'itemId':itemId,'sellingPrice':unitPrice,'quantity':qty};
|
| 23873 |
amit.gupta |
285 |
|
| 27187 |
amit.gupta |
286 |
if (orderObj['fofoOrderItems'][itemId] === undefined){
|
|
|
287 |
tmpObj['serialNumberDetails'] =[];
|
|
|
288 |
}else{
|
|
|
289 |
// tmpObj['serialNumbers'] = orderObj['fofoLineItems'][itemId];
|
|
|
290 |
tmpObj['serialNumberDetails'] = [];
|
|
|
291 |
}
|
|
|
292 |
var found = false;
|
|
|
293 |
for(var i = 0; i < priceQtyArray.length; i++){
|
|
|
294 |
if (priceQtyArray[i]["itemId"] == itemId){
|
|
|
295 |
priceQtyArray[i]["quantity"] = priceQtyArray[i]["quantity"] + 1;
|
|
|
296 |
found = true;
|
|
|
297 |
break;
|
|
|
298 |
}
|
|
|
299 |
}
|
|
|
300 |
if(!found){
|
|
|
301 |
priceQtyArray.push(tmpObj);
|
|
|
302 |
}
|
|
|
303 |
});
|
|
|
304 |
|
|
|
305 |
$("#order-items").find("tr:not(:first-child)").each(function(index,el){
|
| 24440 |
amit.gupta |
306 |
// console.log(el);
|
|
|
307 |
// console.log(index);
|
| 23419 |
ashik.ali |
308 |
var $serialNumberElement = $(el).find('.serialNumber');
|
|
|
309 |
var itemId = parseInt($serialNumberElement.attr("itemId"));
|
| 24440 |
amit.gupta |
310 |
var insuranceEle = $(el).find('.insuranceamount');
|
|
|
311 |
var insuranceAmount = 0;
|
| 27187 |
amit.gupta |
312 |
if(insuranceEle.length > 0) {
|
| 24440 |
amit.gupta |
313 |
insuranceAmount = parseFloat(insuranceEle.val());
|
|
|
314 |
}
|
|
|
315 |
var insuranceId = "";
|
| 27187 |
amit.gupta |
316 |
if(insuranceAmount > 0) {
|
| 24440 |
amit.gupta |
317 |
insuranceId = $(el).find('.insuranceid').val();
|
|
|
318 |
}
|
| 27187 |
amit.gupta |
319 |
var ram = $(el).find('.ram').val();
|
|
|
320 |
var memory = $(el).find('.memory').val();
|
|
|
321 |
var mfgdate = $(el).find('.mfgdate').val();
|
|
|
322 |
var serialNumberDetails = {'serialNumber':$serialNumberElement.val(),'insurance':insuranceId,'amount':insuranceAmount,
|
|
|
323 |
'ram' :ram, 'memory' : memory, 'mfgDate':mfgdate};
|
| 24440 |
amit.gupta |
324 |
priceQtyArray[index]['serialNumberDetails'].push(serialNumberDetails);
|
| 27187 |
amit.gupta |
325 |
|
| 23419 |
ashik.ali |
326 |
});
|
| 27187 |
amit.gupta |
327 |
|
| 23419 |
ashik.ali |
328 |
customerObj['gstNumber'] = $("form#cd input[name=gstNumber]").val();
|
| 27187 |
amit.gupta |
329 |
if(customerId==undefined) {
|
|
|
330 |
alert("Please choose customer");
|
|
|
331 |
return false;
|
|
|
332 |
}
|
|
|
333 |
if($("#customer-address").data("addressselected")=="true") {
|
|
|
334 |
alert("Please select address");
|
|
|
335 |
return false;
|
|
|
336 |
}
|
|
|
337 |
customerObj['customerId'] = customerId;
|
|
|
338 |
customerObj['customerAddressId'] = selectedAddressId;
|
| 24440 |
amit.gupta |
339 |
customerObj['gender'] = $("#gender").val();
|
|
|
340 |
customerObj['dateOfBirth'] = startDate;
|
| 27187 |
amit.gupta |
341 |
|
|
|
342 |
|
|
|
343 |
var paymentOptionSize = parseInt($('#payment-option-id-amount-container').attr("paymentOptionSize"));
|
| 24440 |
amit.gupta |
344 |
// console.log("paymentOptionSize = "+paymentOptionSize);
|
| 27187 |
amit.gupta |
345 |
for(var index = 0; index < paymentOptionSize; index++){
|
| 23419 |
ashik.ali |
346 |
var paymentOptionAmount = 0.0;
|
| 27187 |
amit.gupta |
347 |
if($('#paymentOptionIdAmount'+index).val() != ""){
|
|
|
348 |
paymentOptionAmount = parseFloat($('#paymentOptionIdAmount'+index).val());
|
| 23367 |
ashik.ali |
349 |
}
|
| 27187 |
amit.gupta |
350 |
var paymentOptionId = $('#paymentOptionIdAmount'+index).attr("paymentOptionId");
|
| 23419 |
ashik.ali |
351 |
var paymentOptionIdAmountObject = {};
|
|
|
352 |
paymentOptionIdAmountObject['paymentOptionId'] = paymentOptionId;
|
|
|
353 |
paymentOptionIdAmountObject['amount'] = paymentOptionAmount;
|
|
|
354 |
paymentOptionIdAmount.push(paymentOptionIdAmountObject);
|
|
|
355 |
}
|
|
|
356 |
var retObj = {};
|
|
|
357 |
retObj['fofoOrderItems'] = (priceQtyArray);
|
|
|
358 |
retObj['customer'] = (customerObj);
|
| 27187 |
amit.gupta |
359 |
retObj['paymentOptions'] = (paymentOptionIdAmount);
|
| 23419 |
ashik.ali |
360 |
|
|
|
361 |
console.log(retObj);
|
| 27187 |
amit.gupta |
362 |
return JSON.stringify(retObj);
|
| 23347 |
ashik.ali |
363 |
}
|
|
|
364 |
|
| 27187 |
amit.gupta |
365 |
function resetInputs() {
|
|
|
366 |
$("div.customerinfo").html(customerInfo);
|
|
|
367 |
$("div.billinginfo").html(billingInfo).hide();
|
|
|
368 |
}
|
|
|
369 |
function writeOldCustomerDetailsByMobileNumber(mobileNumber){
|
|
|
370 |
doAjaxRequestHandler(context+"/customer/mobileNumber?mobileNumber="+mobileNumber, "GET", function(response){
|
|
|
371 |
if(response.response=='') {
|
| 24087 |
amit.gupta |
372 |
return;
|
|
|
373 |
}
|
| 23353 |
ashik.ali |
374 |
var customer = response.response;
|
| 27187 |
amit.gupta |
375 |
if(customer==null) {
|
|
|
376 |
$('input.phone').attr('value', mobileNumber).attr('readonly', true);
|
|
|
377 |
$('button.mk_add_customer').show();
|
|
|
378 |
|
|
|
379 |
return;
|
|
|
380 |
}
|
|
|
381 |
$('input.firstName').attr('value', customer.firstName).attr('readonly', true);
|
|
|
382 |
$('input.lastName').attr('value', customer.lastName).attr('readonly', true);
|
|
|
383 |
$('input.phone').attr('value', customer.mobileNumber).attr('readonly', true);
|
|
|
384 |
if(customer.emailId!=null) {
|
|
|
385 |
$('#email').attr('value', customer.emailId).attr('readonly', true);
|
|
|
386 |
}
|
| 26804 |
amit.gupta |
387 |
$('#firstName').attr('value', customer.firstName);
|
|
|
388 |
$('#lastName').attr('value', customer.lastName);
|
| 27187 |
amit.gupta |
389 |
$('#alternatePhone').attr('value', customer.mobileNumber);
|
|
|
390 |
customerId = customer.customerId;
|
|
|
391 |
$("div.billinginfo").show();
|
|
|
392 |
trs = [];
|
|
|
393 |
if(customer.addresses != null) {
|
|
|
394 |
for(address of customer.addresses) {
|
|
|
395 |
if(typeof pendingPO !="undefined") {
|
|
|
396 |
if(pendingPO.customerAddressId==address.id) {
|
|
|
397 |
trs.push(getAddressTr(address));
|
|
|
398 |
}
|
|
|
399 |
} else {
|
|
|
400 |
trs.push(getAddressTr(address));
|
|
|
401 |
}
|
|
|
402 |
}
|
|
|
403 |
}
|
|
|
404 |
$("#address-body").html(trs.join(""));
|
|
|
405 |
|
| 23353 |
ashik.ali |
406 |
});
|
| 27187 |
amit.gupta |
407 |
}
|
|
|
408 |
function getAddressTr(address) {
|
|
|
409 |
var tr = [];
|
|
|
410 |
tr.push(`<tr><td>${address.name} ${address.lastName}</td>`);
|
|
|
411 |
tr.push(`<td>${address.line1}, ${address.line2}</td>`);
|
|
|
412 |
tr.push(`<td>${address.city}</td>`);
|
|
|
413 |
tr.push(`<td>${address.state}</td>`);
|
|
|
414 |
tr.push(`<td>${address.pinCode}</td>`);
|
|
|
415 |
tr.push(`<td>${address.phoneNumber}</td>`);
|
|
|
416 |
tr.push(`<td><a class="select-address" href="javascript:void(0);" data-addressid="${address.id}">Select address</a></td></tr>`);
|
|
|
417 |
return tr.join("");
|
| 23343 |
ashik.ali |
418 |
}
|