| 10629 |
lgm |
1 |
function shippingform(){
|
|
|
2 |
debugger;
|
|
|
3 |
var fname = document.getElementById("name").value;
|
|
|
4 |
var street1 = document.getElementById("line1").value;
|
|
|
5 |
var street2 = document.getElementById("line2").value;
|
|
|
6 |
var city = document.getElementById("city").value;
|
| 10657 |
lgm |
7 |
var state = document.getElementById("state");
|
|
|
8 |
state = state.options[state.selectedIndex].text;
|
| 10629 |
lgm |
9 |
var zipcode = document.getElementById("pin").value;
|
|
|
10 |
var phone = document.getElementById("phone").value;
|
| 10675 |
lgm |
11 |
var chckfname = removeScript(fname);
|
| 10629 |
lgm |
12 |
if(fname =='')
|
|
|
13 |
{
|
|
|
14 |
document.getElementById('error').style.display = "block";
|
|
|
15 |
document.getElementById('error').innerHTML ='Please fill name field!';
|
|
|
16 |
window.scrollTo(0,0); return false;}
|
| 10675 |
lgm |
17 |
if(!removeScript(fname))
|
|
|
18 |
{
|
|
|
19 |
document.getElementById('error').style.display = "block";
|
|
|
20 |
document.getElementById('error').innerHTML ='Please remove script tags!';
|
|
|
21 |
window.scrollTo(0,0); return false;}
|
| 10629 |
lgm |
22 |
if(fname.length> 50)
|
|
|
23 |
{
|
|
|
24 |
document.getElementById('error').style.display = "block";
|
|
|
25 |
document.getElementById('error').innerHTML ='Please Enter Less Than 50 Characters in name field!';
|
|
|
26 |
window.scrollTo(0,0); return false;}
|
|
|
27 |
if(street1 =='')
|
|
|
28 |
{
|
|
|
29 |
document.getElementById('error').style.display = "block";
|
|
|
30 |
document.getElementById('error').innerHTML ='Please fill address field!';
|
|
|
31 |
window.scrollTo(0,0); return false;}
|
| 10675 |
lgm |
32 |
if(street2 =='')
|
|
|
33 |
{
|
|
|
34 |
document.getElementById('error').style.display = "block";
|
|
|
35 |
document.getElementById('error').innerHTML ='Please fill address field!';
|
|
|
36 |
window.scrollTo(0,0); return false;}
|
|
|
37 |
if(!removeScript(street1))
|
|
|
38 |
{
|
|
|
39 |
document.getElementById('error').style.display = "block";
|
|
|
40 |
document.getElementById('error').innerHTML ='Please remove script tags!';
|
|
|
41 |
window.scrollTo(0,0); return false;}
|
| 10629 |
lgm |
42 |
if(city =='')
|
|
|
43 |
{
|
|
|
44 |
document.getElementById('error').style.display = "block";
|
|
|
45 |
document.getElementById('error').innerHTML ='Please fill City field!';
|
|
|
46 |
window.scrollTo(0,0); return false;}
|
| 10675 |
lgm |
47 |
if(!removeScript(city))
|
|
|
48 |
{
|
|
|
49 |
document.getElementById('error').style.display = "block";
|
|
|
50 |
document.getElementById('error').innerHTML ='Please remove script tags!';
|
|
|
51 |
window.scrollTo(0,0); return false;}
|
| 10657 |
lgm |
52 |
if(state =='')
|
|
|
53 |
{
|
|
|
54 |
document.getElementById('error').style.display = "block";
|
|
|
55 |
document.getElementById('error').innerHTML ='Please fill state field!';
|
|
|
56 |
window.scrollTo(0,0); return false;}
|
| 10675 |
lgm |
57 |
if(!removeScript(state))
|
|
|
58 |
{
|
|
|
59 |
document.getElementById('error').style.display = "block";
|
|
|
60 |
document.getElementById('error').innerHTML ='Please remove script tags!';
|
|
|
61 |
window.scrollTo(0,0); return false;}
|
| 10629 |
lgm |
62 |
if(zipcode =='')
|
|
|
63 |
{
|
|
|
64 |
document.getElementById('error').style.display = "block";
|
|
|
65 |
document.getElementById('error').innerHTML ='Please fill pincode field!';
|
|
|
66 |
window.scrollTo(0,0); return false;}
|
|
|
67 |
if(zipcode.length !=6)
|
|
|
68 |
{
|
|
|
69 |
document.getElementById('error').style.display = "block";
|
|
|
70 |
document.getElementById('error').innerHTML ='Pincode should be 6 digits long';
|
|
|
71 |
window.scrollTo(0,0); return false;}
|
|
|
72 |
if(!zipcode.match(/^\d+/))
|
|
|
73 |
{
|
|
|
74 |
document.getElementById('error').style.display = "block";
|
|
|
75 |
document.getElementById('error').innerHTML ='Please Use numbers only for pincode!';
|
|
|
76 |
window.scrollTo(0,0); return false;}
|
|
|
77 |
if(phone =='')
|
|
|
78 |
{
|
|
|
79 |
document.getElementById('error').style.display = "block";
|
|
|
80 |
document.getElementById('error').innerHTML ='Please fill phone number field!';
|
|
|
81 |
window.scrollTo(0,0); return false;}
|
|
|
82 |
if(!phone.match(/^\d+/))
|
|
|
83 |
{ document.getElementById('error').style.display = "block";
|
|
|
84 |
document.getElementById('error').innerHTML ='Please Use numbers only for Mobile Number!';
|
|
|
85 |
window.scrollTo(0,0); return false;}
|
|
|
86 |
if(phone.length != 10)
|
|
|
87 |
{ document.getElementById('error').style.display = "block";
|
|
|
88 |
document.getElementById('error').innerHTML ='Mobile number should be of 10 digits!';
|
|
|
89 |
window.scrollTo(0,0); return false;}
|
|
|
90 |
|
|
|
91 |
}
|
|
|
92 |
function showForm(){
|
|
|
93 |
document.getElementsByClassName("address-form")[0].style.display = 'block';
|
|
|
94 |
document.getElementsByClassName("delivery-cont")[0].style.display = 'none';
|
|
|
95 |
}
|
|
|
96 |
|
| 10716 |
lgm |
97 |
function deleteAddress(e){
|
| 10629 |
lgm |
98 |
debugger;
|
| 10716 |
lgm |
99 |
var addressId = e.currentTarget.id;
|
| 10629 |
lgm |
100 |
var url = base_url+'checkout/delete/'+addressId;
|
|
|
101 |
microAjax(url, function (res) {
|
|
|
102 |
debugger;
|
|
|
103 |
if(res != ''){
|
|
|
104 |
document.getElementById(addressId).style.display = 'none';
|
|
|
105 |
}
|
|
|
106 |
});
|
| 10716 |
lgm |
107 |
e.stopPropagation();
|
| 10629 |
lgm |
108 |
}
|
|
|
109 |
|
|
|
110 |
function changeAddress(addressId,type){
|
|
|
111 |
debugger;
|
|
|
112 |
if(defaultAddress != addressId){
|
|
|
113 |
var url = base_url+'checkout/changeAddress/'+addressId+'/'+type;
|
|
|
114 |
microAjax(url, function (res) {
|
|
|
115 |
debugger;
|
|
|
116 |
if(res == ''){
|
|
|
117 |
document.getElementById(defaultAddress).className = 'deliver-address';
|
|
|
118 |
document.getElementById(addressId).className += ' selected-add';
|
|
|
119 |
defaultAddress = addressId;
|
|
|
120 |
}
|
|
|
121 |
else{
|
|
|
122 |
return false;
|
|
|
123 |
}
|
|
|
124 |
});
|
|
|
125 |
}
|
|
|
126 |
}
|
|
|
127 |
|
|
|
128 |
function changePayment(e){
|
|
|
129 |
debugger;
|
|
|
130 |
var Id = e.currentTarget.id;
|
|
|
131 |
var defaultId = defaultPayment.id;
|
|
|
132 |
if(defaultId != Id){
|
|
|
133 |
var title = e.currentTarget.textContent.split('+')[0];
|
|
|
134 |
document.getElementById(defaultId).className = 'card';
|
|
|
135 |
defaultPayment.nextElementSibling.style.display = 'none';
|
|
|
136 |
defaultPayment.children[0].innerHTML = '+';
|
|
|
137 |
document.getElementById(Id).className += ' selected';
|
|
|
138 |
document.getElementById(Id).children[0].innerHTML = '-';
|
|
|
139 |
e.currentTarget.nextElementSibling.style.display = 'block';
|
|
|
140 |
//document.getElementById(Id).style.display = 'block';
|
|
|
141 |
defaultPayment = e.currentTarget;
|
|
|
142 |
ga('send', 'event', 'Payment Option', 'Payment option tab clicked',title);
|
|
|
143 |
}
|
|
|
144 |
}
|
|
|
145 |
if(typeof bankInfo != 'undefined'){
|
|
|
146 |
var defaultBank = bankInfo.Id;
|
|
|
147 |
}
|
|
|
148 |
function changeBank(e){
|
|
|
149 |
debugger;
|
|
|
150 |
var Id = e.currentTarget.value;
|
|
|
151 |
var payOption = document.getElementById(Id).children[0].id;
|
|
|
152 |
document.getElementById(defaultBank).style.display = 'none';
|
|
|
153 |
document.getElementById(Id).style.display = 'block';
|
|
|
154 |
document.getElementById('pay-emi').value = payOption;
|
|
|
155 |
defaultBank = Id;
|
|
|
156 |
var id = e.currentTarget.id;
|
|
|
157 |
var a = document.getElementById(id);
|
|
|
158 |
var bankName = a.options[a.selectedIndex].text;
|
|
|
159 |
ga('send', 'event', 'EMI', 'Bank Selection',bankName);
|
|
|
160 |
}
|
|
|
161 |
function changePay(e){
|
|
|
162 |
debugger;
|
|
|
163 |
var Id = e.currentTarget.id;
|
|
|
164 |
var payOption = document.getElementById('pay-emi').value;
|
|
|
165 |
document.getElementById(payOption).className = 'emi-body clearfix';
|
|
|
166 |
document.getElementById(Id).className += ' selected';
|
|
|
167 |
document.getElementById('pay-emi').value = Id;
|
|
|
168 |
var bankName = e.currentTarget.getAttribute('data-bank');
|
|
|
169 |
var tenure = e.currentTarget.getAttribute('data-tenure');
|
|
|
170 |
bankName = bankName+'-'+tenure;
|
|
|
171 |
ga('send', 'event', 'EMI', 'Plan Selection',bankName);
|
|
|
172 |
}
|
| 10657 |
lgm |
173 |
var netBanking;
|
| 10629 |
lgm |
174 |
function changeNetBanking(e){
|
|
|
175 |
debugger;
|
| 10657 |
lgm |
176 |
var Id;
|
|
|
177 |
Id = e.currentTarget.value;
|
|
|
178 |
if(Id == undefined){
|
|
|
179 |
Id = e.currentTarget.id;
|
|
|
180 |
}
|
|
|
181 |
if(netBanking == undefined){
|
|
|
182 |
document.getElementById(Id).className = 'selected';
|
|
|
183 |
}
|
|
|
184 |
else if(netBanking != undefined){
|
|
|
185 |
document.getElementById(netBanking).className = '';
|
|
|
186 |
document.getElementById(Id).className = 'selected';
|
|
|
187 |
}
|
| 10629 |
lgm |
188 |
document.getElementById('pay-net').value = Id;
|
| 10657 |
lgm |
189 |
netBanking = Id;
|
| 10629 |
lgm |
190 |
var title = e.currentTarget.getAttribute('data-parent');
|
|
|
191 |
title = title+'-'+Id;
|
|
|
192 |
ga('send', 'event', 'Payment Option', 'Payment option tab-payotion selected',title);
|
|
|
193 |
}
|
|
|
194 |
function changeCountry(e){
|
|
|
195 |
debugger;
|
|
|
196 |
var Id = e.currentTarget.id;
|
|
|
197 |
if(Id == 'india'){
|
|
|
198 |
document.getElementById('india').className = 'selected';
|
|
|
199 |
document.getElementById('outside').className = '';
|
|
|
200 |
document.getElementsByClassName('in-india')[0].style.display = 'block';
|
|
|
201 |
document.getElementsByClassName('out-india')[0].style.display = 'none';
|
|
|
202 |
}
|
|
|
203 |
if(Id == 'outside'){
|
|
|
204 |
document.getElementById('outside').className = 'selected';
|
|
|
205 |
document.getElementById('india').className = '';
|
|
|
206 |
document.getElementsByClassName('out-india')[0].style.display = 'block';
|
|
|
207 |
document.getElementsByClassName('in-india')[0].style.display = 'none';
|
|
|
208 |
}
|
|
|
209 |
}
|
|
|
210 |
var previousCard;
|
|
|
211 |
function selectCard(e){
|
|
|
212 |
debugger;
|
|
|
213 |
var Id = e.currentTarget.id;
|
|
|
214 |
if(previousCard == undefined){
|
|
|
215 |
document.getElementById(Id).className = 'selected';
|
|
|
216 |
}
|
|
|
217 |
else if(previousCard != undefined){
|
|
|
218 |
document.getElementById(previousCard).className = '';
|
|
|
219 |
document.getElementById(Id).className = 'selected';
|
|
|
220 |
}
|
|
|
221 |
document.getElementById('pay-credit').value = Id;
|
|
|
222 |
previousCard = Id;
|
|
|
223 |
var title = e.currentTarget.getAttribute('data-parent');
|
|
|
224 |
title = title+'-'+Id;
|
|
|
225 |
ga('send', 'event', 'Payment Option', 'Payment option tab-payotion selected',title);
|
|
|
226 |
}
|
|
|
227 |
var previousDebit;
|
|
|
228 |
function selectDebitCard(e){
|
|
|
229 |
debugger;
|
|
|
230 |
var Id = e.currentTarget.id;
|
|
|
231 |
if(previousDebit == undefined){
|
|
|
232 |
document.getElementById(Id).className = 'selected';
|
|
|
233 |
}
|
|
|
234 |
else if(previousDebit != undefined){
|
|
|
235 |
document.getElementById(previousDebit).className = '';
|
|
|
236 |
document.getElementById(Id).className = 'selected';
|
|
|
237 |
}
|
|
|
238 |
document.getElementById('pay-debit').value = Id;
|
|
|
239 |
previousDebit = Id;
|
|
|
240 |
var title = e.currentTarget.getAttribute('data-parent');
|
|
|
241 |
title = title+'-'+Id;
|
|
|
242 |
ga('send', 'event', 'Payment Option', 'Payment option tab-payoption selected',title);
|
|
|
243 |
}
|
|
|
244 |
var previousCC;
|
|
|
245 |
function selectCashCard(e){
|
|
|
246 |
debugger;
|
|
|
247 |
var Id = e.currentTarget.id;
|
|
|
248 |
if(previousCC == undefined){
|
|
|
249 |
document.getElementById(Id).className = 'selected';
|
|
|
250 |
}
|
|
|
251 |
else if(previousCC != undefined){
|
|
|
252 |
document.getElementById(previousCC).className = '';
|
|
|
253 |
document.getElementById(Id).className = 'selected';
|
|
|
254 |
}
|
|
|
255 |
document.getElementById('pay-cc').value = Id;
|
|
|
256 |
previousCC = Id;
|
|
|
257 |
var title = e.currentTarget.getAttribute('data-parent');
|
|
|
258 |
title = title+'-'+Id;
|
|
|
259 |
ga('send', 'event', 'Payment Option', 'Payment option tab-payoption selected',title);
|
|
|
260 |
}
|
|
|
261 |
// function changeCaptcha(){
|
|
|
262 |
// var url = base_url+'checkout/changeCaptcha';
|
|
|
263 |
// microAjax(url, function (res) {
|
|
|
264 |
// debugger;
|
|
|
265 |
// if(res != ''){
|
|
|
266 |
// debugger;
|
|
|
267 |
// data = JSON.parse(res);
|
|
|
268 |
// document.getElementById('captcha').innerHTML = data.image;
|
|
|
269 |
// }
|
|
|
270 |
// else{
|
|
|
271 |
// return false;
|
|
|
272 |
// }
|
|
|
273 |
// });
|
|
|
274 |
// }
|
|
|
275 |
function infoPage(){
|
|
|
276 |
document.getElementsByClassName("address-form")[0].style.display = 'none';
|
|
|
277 |
document.getElementsByClassName("delivery-cont")[0].style.display = 'block';
|
|
|
278 |
}
|
|
|
279 |
|
|
|
280 |
function togglepicup(e){
|
|
|
281 |
debugger;
|
|
|
282 |
if(e.currentTarget.className == 'pick-up'){
|
|
|
283 |
e.currentTarget.className += ' selected';
|
|
|
284 |
document.getElementsByClassName("deliverhere")[0].setAttribute('class','deliverhere');
|
|
|
285 |
document.getElementsByClassName("pickup")[0].style.display = 'block';
|
|
|
286 |
document.getElementsByClassName("deliver-here")[0].style.display = 'none';
|
|
|
287 |
}else{
|
|
|
288 |
e.currentTarget.className += ' selected';
|
|
|
289 |
document.getElementsByClassName("pick-up")[0].setAttribute('class','pick-up');
|
|
|
290 |
document.getElementsByClassName("deliver-here")[0].style.display = 'block';
|
|
|
291 |
document.getElementsByClassName("pickup")[0].style.display = 'none';
|
| 10582 |
lgm |
292 |
|
| 10629 |
lgm |
293 |
}
|
|
|
294 |
}
|
|
|
295 |
var prevZone;
|
|
|
296 |
function changeZone(e){
|
|
|
297 |
debugger;
|
|
|
298 |
var value = e.currentTarget.value;
|
|
|
299 |
var currentStore = storeInfo[value];
|
|
|
300 |
var storeAddress = '';
|
|
|
301 |
if(prevZone == undefined || prevZone != value){
|
|
|
302 |
for(i=0;i<currentStore.length;i++){
|
|
|
303 |
storeAddress +='<div class="pickup-spot" id="'+currentStore[i].id+'" data-key="'+currentStore[i].hotspotId+'" onclick=selectStore(event)><div>'+currentStore[i].name+'</div><div>'+currentStore[i].line1+'</div><div>'+currentStore[i].line2+'</div><div>'+currentStore[i].city+'</div><div>'+currentStore[i].state+'</div><div>Pin: '+currentStore[i].pin+'</div><div>Phone: '+currentStore[i].phone+'</div></div>';
|
|
|
304 |
}
|
|
|
305 |
document.getElementById('appendData').innerHTML = storeAddress;
|
|
|
306 |
prevZone = value;
|
|
|
307 |
ga('send', 'event', 'InStore Pickup Region', 'Store Zone',value);
|
|
|
308 |
}
|
|
|
309 |
}
|
|
|
310 |
var shopId;
|
|
|
311 |
var inStoreDelivery;
|
|
|
312 |
function selectStore(e){
|
|
|
313 |
debugger;
|
|
|
314 |
var id = e.currentTarget.id;
|
|
|
315 |
var hotspotId = e.currentTarget;
|
|
|
316 |
if(shopId == undefined){
|
|
|
317 |
document.getElementById(id).className += ' selected-add';
|
|
|
318 |
shopId = id;
|
|
|
319 |
}else if(shopId != id){
|
|
|
320 |
document.getElementById(shopId).className += 'pickup-spot';
|
|
|
321 |
document.getElementById(id).className += ' selected-add';
|
|
|
322 |
shopId = id;
|
|
|
323 |
inStoreDelivery = true;
|
|
|
324 |
}
|
|
|
325 |
var url = base_url+'checkout/pickupSpot/'+id;
|
|
|
326 |
microAjax(url,function(res){
|
| 10582 |
lgm |
327 |
debugger;
|
| 10629 |
lgm |
328 |
if(res != ''){
|
|
|
329 |
}else{
|
|
|
330 |
window.location.href = document.URL;
|
|
|
331 |
}
|
|
|
332 |
});
|
|
|
333 |
document.getElementById('hotSpot').value = id;
|
|
|
334 |
}
|
|
|
335 |
if(insuranceInfo != undefined){
|
|
|
336 |
var insuranceInfo = insuranceInfo;
|
|
|
337 |
}
|
|
|
338 |
function validateInsurance(type){
|
|
|
339 |
debugger;
|
|
|
340 |
var type = type;
|
|
|
341 |
if(document.getElementById('ccAddress') && insuranceInfo == 1){
|
|
|
342 |
var bday = document.getElementById('bday').value;
|
|
|
343 |
var gname = document.getElementById('gName').value;
|
|
|
344 |
if(gname == '')
|
|
|
345 |
{
|
|
|
346 |
document.getElementById('error1').style.display = "block";
|
|
|
347 |
document.getElementById('error1').innerHTML ='Please fill name field!';
|
|
|
348 |
return false;}
|
|
|
349 |
if(gname.length> 50)
|
|
|
350 |
{
|
|
|
351 |
document.getElementById('error1').style.display = "block";
|
|
|
352 |
document.getElementById('error1').innerHTML ='Please Enter Less Than 50 Characters in name field!';
|
|
|
353 |
return false;}
|
|
|
354 |
// if(bday =='')
|
|
|
355 |
// {
|
|
|
356 |
// document.getElementById('error1').style.display = "block";
|
|
|
357 |
// document.getElementById('error1').innerHTML ='Please fill birthday field!';
|
|
|
358 |
// return false;}
|
|
|
359 |
var validformat=/^\d{2}\/\d{2}\/\d{4}$/ //Basic check for format validity
|
|
|
360 |
var returnval=false
|
|
|
361 |
if (!validformat.test(bday)){
|
|
|
362 |
document.getElementById('error1').style.display = "block";
|
|
|
363 |
document.getElementById('error1').innerHTML ='Please Enter valid date';
|
|
|
364 |
return false;
|
|
|
365 |
}else if(validformat.test(bday)){ //Detailed check for valid date ranges
|
|
|
366 |
var monthfield=bday.split("/")[0]
|
|
|
367 |
var dayfield=bday.split("/")[1]
|
|
|
368 |
var yearfield=bday.split("/")[2]
|
|
|
369 |
var dayobj = new Date(yearfield, monthfield-1, dayfield)
|
|
|
370 |
if ((dayobj.getMonth()+1!=monthfield)||(dayobj.getDate()!=dayfield)||(dayobj.getFullYear()!=yearfield)){
|
|
|
371 |
document.getElementById('error1').style.display = "block";
|
|
|
372 |
document.getElementById('error1').innerHTML ='Invalid Day, Month, or Year range detected. Please correct and submit again.';
|
|
|
373 |
return false;
|
|
|
374 |
}
|
|
|
375 |
}
|
|
|
376 |
if(type == 1){
|
|
|
377 |
var bday = bday.replace(/\//g, '-');
|
|
|
378 |
gname = gname.replace(/\ /g,'-');
|
|
|
379 |
var url = base_url+'checkout/insuranceInfo/'+bday+'/'+gname+'/'+insuranceAddressId;
|
|
|
380 |
microAjax(url,function(res){
|
|
|
381 |
debugger;
|
|
|
382 |
if(res != ''){
|
|
|
383 |
debugger;
|
|
|
384 |
var data = JSON.parse(res);
|
|
|
385 |
if(data['response'].status == 'SUCCESS'){
|
|
|
386 |
if(document.getElementById('ccAddress').style.display == ''){
|
|
|
387 |
document.getElementById('ccAddress').style.display = 'none';
|
|
|
388 |
}
|
|
|
389 |
}
|
|
|
390 |
else{
|
|
|
391 |
document.getElementById('error1').style.display = "block";
|
|
|
392 |
document.getElementById('error1').innerHTML ='Request could not be completed.Please try again!';
|
|
|
393 |
}
|
|
|
394 |
}
|
|
|
395 |
});
|
|
|
396 |
}
|
|
|
397 |
if(type == 2){
|
|
|
398 |
if(inStoreDelivery == true){
|
|
|
399 |
ga('send','event','Delivery Type','In-Store Pickup');
|
|
|
400 |
}else{
|
|
|
401 |
ga('send','event','Delivery Type','Deliver to address');
|
|
|
402 |
}
|
|
|
403 |
ga('send','event','Order','Proceed To Pay');
|
|
|
404 |
window.location.href = base_url+'payment';
|
|
|
405 |
}
|
|
|
406 |
}else{
|
|
|
407 |
if(inStoreDelivery == true){
|
|
|
408 |
ga('send','event','Delivery Type','In-Store Pickup');
|
|
|
409 |
}else{
|
|
|
410 |
ga('send','event','Delivery Type','Deliver to address');
|
|
|
411 |
}
|
|
|
412 |
ga('send','event','Order','Proceed To Pay');
|
|
|
413 |
window.location.href = base_url+'payment';
|
|
|
414 |
}
|
|
|
415 |
}
|
|
|
416 |
function paymentValidation(e){
|
|
|
417 |
debugger;
|
|
|
418 |
var Id = e.currentTarget.id;
|
|
|
419 |
if(Id == 'creditcard'){
|
|
|
420 |
if(previousCard == undefined){
|
|
|
421 |
document.getElementById('error').style.display = "block";
|
|
|
422 |
document.getElementById('error').innerHTML ='Please select payment method!';
|
|
|
423 |
window.scrollTo(0,0); return false;
|
|
|
424 |
}
|
|
|
425 |
var paymentTitle = e.currentTarget.getAttribute('data-key');
|
|
|
426 |
ga('send', 'event', 'Payment Option', 'Form Submission',paymentTitle);
|
|
|
427 |
|
|
|
428 |
}else if(Id == 'debitcard'){
|
|
|
429 |
if(previousDebit == undefined){
|
|
|
430 |
document.getElementById('error').style.display = "block";
|
|
|
431 |
document.getElementById('error').innerHTML ='Please select payment method!';
|
|
|
432 |
window.scrollTo(0,0); return false;
|
|
|
433 |
}
|
|
|
434 |
var paymentTitle = e.currentTarget.getAttribute('data-key');
|
|
|
435 |
ga('send', 'event', 'Payment Option', 'Form Submission',paymentTitle);
|
|
|
436 |
}else if(Id == 'netbanking'){
|
|
|
437 |
var payOption = document.getElementById('pay-net').value;
|
|
|
438 |
if(payOption == undefined || payOption ==""){
|
|
|
439 |
document.getElementById('error').style.display = "block";
|
|
|
440 |
document.getElementById('error').innerHTML ='Please select payment method!';
|
|
|
441 |
window.scrollTo(0,0); return false;
|
|
|
442 |
}
|
|
|
443 |
var paymentTitle = e.currentTarget.getAttribute('data-key');
|
|
|
444 |
ga('send', 'event', 'Payment Option', 'Form Submission',paymentTitle);
|
|
|
445 |
}else if(Id == 'cashcards'){
|
|
|
446 |
if(previousCC == undefined){
|
|
|
447 |
document.getElementById('error').style.display = "block";
|
|
|
448 |
document.getElementById('error').innerHTML ='Please select payment method!';
|
|
|
449 |
window.scrollTo(0,0); return false;
|
|
|
450 |
}
|
|
|
451 |
var paymentTitle = e.currentTarget.getAttribute('data-key');
|
|
|
452 |
ga('send', 'event', 'Payment Option', 'Form Submission',paymentTitle);
|
|
|
453 |
}else if(Id == 'emiform'){
|
|
|
454 |
var payOption = document.getElementById('pay-emi').value;
|
|
|
455 |
if(payOption == undefined || payOption ==""){
|
|
|
456 |
document.getElementById('error').style.display = "block";
|
|
|
457 |
document.getElementById('error').innerHTML ='Please select payment method!';
|
|
|
458 |
window.scrollTo(0,0); return false;
|
|
|
459 |
}
|
|
|
460 |
var paymentTitle = e.currentTarget.getAttribute('data-key');
|
|
|
461 |
ga('send', 'event', 'Payment Option', 'Form Submission',paymentTitle);
|
|
|
462 |
}else if(Id == 'cod'){
|
|
|
463 |
if(document.getElementById('captcha_response_box').value == ''){
|
|
|
464 |
// document.forms['recharge-confirm'].submit();
|
|
|
465 |
// }else{
|
|
|
466 |
var bRed = document.getElementById('captcha_response_box');
|
|
|
467 |
bRed.style.border = 'red solid 1px';
|
|
|
468 |
bRed.style.color = 'red';
|
|
|
469 |
bRed.value = 'Please enter the captcha'
|
|
|
470 |
setTimeout(function(){
|
|
|
471 |
bRed.style.border = '';
|
|
|
472 |
bRed.style.color = '';
|
|
|
473 |
bRed.value = '';
|
|
|
474 |
},3000);
|
|
|
475 |
return false;
|
|
|
476 |
}
|
|
|
477 |
var paymentTitle = e.currentTarget.getAttribute('data-key');
|
|
|
478 |
ga('send', 'event', 'Payment Option', 'Form Submission',paymentTitle);
|
|
|
479 |
}else if(Id == 'zod'){
|
|
|
480 |
if(document.getElementById('captcha_response_box').value == ''){
|
|
|
481 |
// document.forms['recharge-confirm'].submit();
|
|
|
482 |
// }else{
|
|
|
483 |
var bRed = document.getElementById('captcha_response_box');
|
|
|
484 |
bRed.style.border = 'red solid 1px';
|
|
|
485 |
bRed.style.color = 'red';
|
|
|
486 |
bRed.value = 'Please enter the captcha'
|
|
|
487 |
setTimeout(function(){
|
|
|
488 |
bRed.style.border = '';
|
|
|
489 |
bRed.style.color = '';
|
|
|
490 |
bRed.value = '';
|
|
|
491 |
},3000);
|
|
|
492 |
return false;
|
|
|
493 |
}
|
|
|
494 |
var paymentTitle = e.currentTarget.getAttribute('data-key');
|
|
|
495 |
ga('send', 'event', 'Payment Option', 'Form Submission',paymentTitle);
|
|
|
496 |
}
|
| 10675 |
lgm |
497 |
}
|
| 10696 |
lgm |
498 |
var url;
|
|
|
499 |
url = document.URL;
|
|
|
500 |
if(url.indexOf('pay-success') != -1){
|
|
|
501 |
if(orderConfirmation != undefined){
|
|
|
502 |
debugger;
|
|
|
503 |
ga('require', 'ecommerce', 'ecommerce.js');
|
|
|
504 |
var orders = orderConfirmation['result']['orders'];
|
|
|
505 |
for(i=0;i<orders.length;i++){
|
|
|
506 |
debugger
|
|
|
507 |
var amount = orders[i].totalAmount.replace(',','');
|
|
|
508 |
amount = parseFloat(amount).toFixed(2);
|
|
|
509 |
var orderId = orders[i].orderId;
|
|
|
510 |
ga('ecommerce:addTransaction', {
|
|
|
511 |
'id': orderId, // Transaction ID. Required.
|
|
|
512 |
'affiliation': 'shop2020', // Affiliation or store name.
|
|
|
513 |
'revenue': amount, // Grand Total.
|
|
|
514 |
'shipping': '0', // Shipping.
|
|
|
515 |
'tax': '0', // Tax.
|
|
|
516 |
'city':"",
|
|
|
517 |
'state':"",
|
|
|
518 |
'country':"India"
|
|
|
519 |
});
|
|
|
520 |
ga('ecommerce:addItem', {
|
|
|
521 |
'id': orderId, // Transaction ID. Required.
|
|
|
522 |
'name': orders[i].itemName, // Product name. Required.
|
|
|
523 |
'sku': orders[i].itemName, // SKU/code.
|
|
|
524 |
'category': 'Physical', // Category or variation.
|
|
|
525 |
'price': amount, // Unit price.
|
|
|
526 |
'quantity': orders[i].quantity // Quantity.
|
|
|
527 |
});
|
|
|
528 |
}
|
|
|
529 |
ga('ecommerce:send');
|
|
|
530 |
}
|
|
|
531 |
}
|