| 10582 |
lgm |
1 |
var operatorId;
|
|
|
2 |
var circleCode;
|
|
|
3 |
function operator(){
|
|
|
4 |
var number = document.getElementById('mobile-number').value;
|
|
|
5 |
if(number.length == 10)
|
|
|
6 |
{
|
|
|
7 |
debugger;
|
|
|
8 |
var url = base_url+'recharge/operator/'+number;
|
|
|
9 |
//window.location.href = a;
|
|
|
10 |
microAjax(url, function (res) {
|
|
|
11 |
debugger;
|
|
|
12 |
if(res != ''){
|
|
|
13 |
debugger;
|
|
|
14 |
var data = JSON.parse(res);
|
|
|
15 |
var planId;
|
|
|
16 |
operatorId = data.operatorId;
|
|
|
17 |
circleCode = data.circleCode;
|
|
|
18 |
var dropdownlistbox = document.getElementById("mobile-operator");
|
|
|
19 |
for(var x=0;x < dropdownlistbox.length -1 ; x++)
|
|
|
20 |
{
|
|
|
21 |
if(data.operatorName == dropdownlistbox.options[x].text)
|
|
|
22 |
{
|
|
|
23 |
dropdownlistbox.selectedIndex = x;
|
|
|
24 |
var opids ='';
|
|
|
25 |
for(var i=0;i<plan.length;i++){
|
|
|
26 |
if(plan[i].operatorId == operatorId){
|
|
|
27 |
var planId = plan[i].operatorId;
|
|
|
28 |
opids += '<option value='+plan[i].Name+'>'+plan[i].displayName+'</option>';
|
|
|
29 |
}
|
|
|
30 |
}
|
|
|
31 |
if(planId == operatorId){
|
|
|
32 |
document.getElementById('plans').style.display = 'block';
|
|
|
33 |
}else{
|
|
|
34 |
document.getElementById('plans').style.display = 'none';
|
|
|
35 |
}
|
|
|
36 |
if(special.indexOf(operatorId) != -1){
|
|
|
37 |
document.getElementById('operatorName').innerHTML = data.operatorName;
|
|
|
38 |
document.getElementById('special').style.display = 'block';
|
|
|
39 |
}
|
|
|
40 |
else{
|
|
|
41 |
document.getElementById('special').style.display = 'none';
|
|
|
42 |
}
|
|
|
43 |
break;
|
|
|
44 |
}
|
|
|
45 |
}
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
});
|
|
|
49 |
}
|
|
|
50 |
}
|
|
|
51 |
|
|
|
52 |
function changeOperator(e){
|
|
|
53 |
debugger;
|
|
|
54 |
var Id = e.currentTarget.value;
|
|
|
55 |
var opids ='';
|
|
|
56 |
for(var i=0;i<plan.length;i++){
|
|
|
57 |
if(plan[i].operatorId == Id){
|
|
|
58 |
var planId = plan[i].operatorId;
|
|
|
59 |
opids += '<option value='+plan[i].Name+'>'+plan[i].displayName+'</option>';
|
|
|
60 |
}
|
|
|
61 |
}
|
|
|
62 |
if(planId == Id){
|
|
|
63 |
document.getElementById('plans').style.display = 'block';
|
|
|
64 |
}else{
|
|
|
65 |
document.getElementById('plans').style.display = 'none';
|
|
|
66 |
}
|
|
|
67 |
document.getElementById('operator-palns').innerHTML = opids;
|
|
|
68 |
if(special.indexOf(parseInt(Id)) != -1){
|
|
|
69 |
var dropdownlistbox = document.getElementById("mobile-operator");
|
|
|
70 |
var index = e.currentTarget.selectedIndex;
|
|
|
71 |
document.getElementById('operatorName').innerHTML = dropdownlistbox.options[index].text;;
|
|
|
72 |
document.getElementById('special').style.display = 'block';
|
|
|
73 |
}
|
|
|
74 |
else{
|
|
|
75 |
document.getElementById('special').style.display = 'none';
|
|
|
76 |
}
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
function topup(e){
|
|
|
80 |
debugger;
|
|
|
81 |
var Id = e.currentTarget.id;
|
|
|
82 |
var url = base_url+'recharge/topupSpecial/'+Id+'/'+operatorId+'/'+circleCode;
|
|
|
83 |
microAjax(url, function (res) {
|
|
|
84 |
debugger;
|
|
|
85 |
if(res != '')
|
|
|
86 |
{
|
|
|
87 |
document.getElementsByClassName('rech-cont')[0].style.display = 'none';
|
|
|
88 |
document.getElementsByClassName('topup-cont')[0].style.display = 'block';
|
|
|
89 |
var appenddata = document.getElementById('appendlist');
|
|
|
90 |
appenddata.innerHTML= appenddata.innerHTML + res;
|
|
|
91 |
}
|
|
|
92 |
});
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
function closePlan(){
|
|
|
96 |
//debugger;
|
|
|
97 |
document.getElementsByClassName('rech-cont')[0].style.display = 'block';
|
|
|
98 |
document.getElementsByClassName('topup-cont')[0].style.display = 'none';
|
|
|
99 |
}
|
|
|
100 |
function fillAmount(e){
|
|
|
101 |
//debugger;
|
|
|
102 |
var amount = e.currentTarget.innerHTML;
|
|
|
103 |
document.getElementById('mobile-amount').value = amount;
|
|
|
104 |
document.getElementsByClassName('rech-cont')[0].style.display = 'block';
|
|
|
105 |
document.getElementsByClassName('topup-cont')[0].style.display = 'none';
|
|
|
106 |
}
|
|
|
107 |
function changeName(e){
|
|
|
108 |
//debugger;
|
|
|
109 |
var id = e.currentTarget.value;
|
|
|
110 |
var name = dthIdMap[id];
|
|
|
111 |
document.getElementById('accountName').innerHTML = name;
|
|
|
112 |
}
|
|
|
113 |
function mobileValidation(){
|
|
|
114 |
debugger;
|
|
|
115 |
var operator = document.getElementById('mobile-operator');
|
|
|
116 |
var number = document.getElementById('mobile-number').value;
|
|
|
117 |
var amount = document.getElementById('mobile-amount').value;
|
|
|
118 |
var email = document.getElementById("emailId").value;
|
|
|
119 |
document.getElementById('operator_hidden').value = operator[operator.selectedIndex].text;
|
|
|
120 |
email = email.trim();
|
|
|
121 |
var atpos = email.indexOf("@");
|
|
|
122 |
var dotpos = email.lastIndexOf(".");
|
|
|
123 |
if(number ==''){
|
|
|
124 |
document.getElementById('error').style.display = "block";
|
|
|
125 |
document.getElementById('error').innerHTML ='Please fill Your Mobile Number!';
|
|
|
126 |
window.scrollTo(0,0); return false;
|
|
|
127 |
}
|
|
|
128 |
if(!number.match(/^\d+/)){
|
|
|
129 |
document.getElementById('error').style.display = "block";
|
|
|
130 |
document.getElementById('error').innerHTML ='Please Use numbers only for Mobile Number!';
|
|
|
131 |
window.scrollTo(0,0); return false;
|
|
|
132 |
}
|
|
|
133 |
if(number.length != 10){
|
|
|
134 |
document.getElementById('error').style.display = "block";
|
|
|
135 |
document.getElementById('error').innerHTML ='Mobile Number should be of 10 digits';
|
|
|
136 |
window.scrollTo(0,0); return false;
|
|
|
137 |
}
|
|
|
138 |
if(operator.selectedIndex == 0){
|
|
|
139 |
document.getElementById('error').style.display = "block";
|
|
|
140 |
document.getElementById('error').innerHTML ='Please select your operator!';
|
|
|
141 |
window.scrollTo(0,0); return false;
|
|
|
142 |
}
|
|
|
143 |
if(amount ==''){
|
|
|
144 |
document.getElementById('error').style.display = "block";
|
|
|
145 |
document.getElementById('error').innerHTML ='Please fill recharge amount!';
|
|
|
146 |
window.scrollTo(0,0); return false;
|
|
|
147 |
}
|
| 10748 |
lgm |
148 |
if(!/^\d+$/.test(amount)){
|
| 10582 |
lgm |
149 |
document.getElementById('error').style.display = "block";
|
|
|
150 |
document.getElementById('error').innerHTML ='Please Use numbers only!';
|
|
|
151 |
window.scrollTo(0,0); return false;
|
|
|
152 |
}
|
|
|
153 |
if((parseInt(amount) < 10) || (parseInt(amount) > 1000)){
|
|
|
154 |
document.getElementById('error').style.display = "block";
|
|
|
155 |
document.getElementById('error').innerHTML ='Recharge amount should be between Rs. 10-1000';
|
|
|
156 |
window.scrollTo(0,0); return false;
|
|
|
157 |
}
|
|
|
158 |
|
|
|
159 |
if(email ==''){
|
|
|
160 |
document.getElementById('error').style.display = "block";
|
|
|
161 |
document.getElementById('error').innerHTML ='Please fill email field!';
|
|
|
162 |
window.scrollTo(0,0); return false;}
|
|
|
163 |
if((atpos<1) || (dotpos < atpos+2) || (dotpos+2 >= email.length)){
|
|
|
164 |
document.getElementById('error').style.display = "block";
|
|
|
165 |
document.getElementById('error').innerHTML ='Please fill email in correct format!';
|
|
|
166 |
window.scrollTo(0,0); return false;
|
|
|
167 |
}
|
|
|
168 |
if(email.length> 50){
|
|
|
169 |
document.getElementById('error').style.display = "block";
|
|
|
170 |
document.getElementById('error').innerHTML ='Please enter less than 50 characters in email field!';
|
|
|
171 |
window.scrollTo(0,0); return false;
|
|
|
172 |
}
|
|
|
173 |
if(email.indexOf(' ') != -1){
|
|
|
174 |
document.getElementById('error').style.display = "block";
|
|
|
175 |
document.getElementById('error').innerHTML ='Please remove space from email field!';
|
|
|
176 |
window.scrollTo(0,0); return false;
|
|
|
177 |
}
|
| 10748 |
lgm |
178 |
if(email != email.trim()){
|
|
|
179 |
document.getElementById('error').style.display = "block";
|
|
|
180 |
document.getElementById('error').innerHTML ='Please remove space from email field!';
|
|
|
181 |
window.scrollTo(0,0); return false;
|
|
|
182 |
}
|
| 10582 |
lgm |
183 |
|
|
|
184 |
}
|
|
|
185 |
function dthValidation(){
|
|
|
186 |
debugger;
|
|
|
187 |
var operator = document.getElementById('dth-operator');
|
|
|
188 |
var number = document.getElementById('dth-number').value;
|
|
|
189 |
var amount = document.getElementById('dth-amount').value;
|
|
|
190 |
var email = document.getElementById("dth-email").value;
|
|
|
191 |
document.getElementById('dth_hidden').value = operator[operator.selectedIndex].text;
|
|
|
192 |
email = email.trim();
|
|
|
193 |
var atpos = email.indexOf("@");
|
|
|
194 |
var dotpos = email.lastIndexOf(".");
|
|
|
195 |
if(operator.selectedIndex == 0){
|
|
|
196 |
document.getElementById('error').style.display = "block";
|
|
|
197 |
document.getElementById('error').innerHTML ='Please select your operator!';
|
|
|
198 |
window.scrollTo(0,0); return false;
|
|
|
199 |
}
|
|
|
200 |
if(number ==''){
|
|
|
201 |
document.getElementById('error').style.display = "block";
|
|
|
202 |
document.getElementById('error').innerHTML ='Please enter the DTH number!';
|
|
|
203 |
window.scrollTo(0,0); return false;
|
|
|
204 |
}
|
| 10748 |
lgm |
205 |
if(!/^\d+$/.test(number)){
|
|
|
206 |
document.getElementById('error').style.display = "block";
|
|
|
207 |
document.getElementById('error').innerHTML ='Please Use numbers only for Mobile Number!';
|
|
|
208 |
window.scrollTo(0,0); return false;
|
|
|
209 |
}
|
| 10582 |
lgm |
210 |
if(amount ==''){
|
|
|
211 |
document.getElementById('error').style.display = "block";
|
|
|
212 |
document.getElementById('error').innerHTML ='Please fill recharge amount!';
|
|
|
213 |
window.scrollTo(0,0); return false;
|
|
|
214 |
}
|
| 10748 |
lgm |
215 |
if(!/^\d+$/.test(amount)){
|
| 10582 |
lgm |
216 |
document.getElementById('error').style.display = "block";
|
|
|
217 |
document.getElementById('error').innerHTML ='Please Use numbers only!';
|
|
|
218 |
window.scrollTo(0,0); return false;
|
|
|
219 |
}
|
|
|
220 |
if((parseInt(amount) < 200) || (parseInt(amount) > 2000)){
|
|
|
221 |
document.getElementById('error').style.display = "block";
|
|
|
222 |
document.getElementById('error').innerHTML ='Recharge amount should be between Rs. 200-2000';
|
|
|
223 |
window.scrollTo(0,0); return false;
|
|
|
224 |
}
|
|
|
225 |
|
|
|
226 |
if(email ==''){
|
|
|
227 |
document.getElementById('error').style.display = "block";
|
|
|
228 |
document.getElementById('error').innerHTML ='Please fill email field!';
|
|
|
229 |
window.scrollTo(0,0); return false;}
|
|
|
230 |
if((atpos<1) || (dotpos < atpos+2) || (dotpos+2 >= email.length)){
|
|
|
231 |
document.getElementById('error').style.display = "block";
|
|
|
232 |
document.getElementById('error').innerHTML ='Please fill email in correct format!';
|
|
|
233 |
window.scrollTo(0,0); return false;
|
|
|
234 |
}
|
|
|
235 |
if(email.length> 50){
|
|
|
236 |
document.getElementById('error').style.display = "block";
|
|
|
237 |
document.getElementById('error').innerHTML ='Please enter less than 50 characters in email field!';
|
|
|
238 |
window.scrollTo(0,0); return false;
|
|
|
239 |
}
|
|
|
240 |
if(email.indexOf(' ') != -1){
|
|
|
241 |
document.getElementById('error').style.display = "block";
|
|
|
242 |
document.getElementById('error').innerHTML ='Please remove space from email field!';
|
|
|
243 |
window.scrollTo(0,0); return false;
|
|
|
244 |
}
|
|
|
245 |
|
|
|
246 |
}
|
|
|
247 |
|
|
|
248 |
function recahrgeAmount(){
|
|
|
249 |
debugger;
|
|
|
250 |
var couponCode = document.getElementById('couponCode').value;
|
|
|
251 |
var recharge_Amount = document.getElementById('recharge_Amount').innerHTML;
|
|
|
252 |
var rechargeOperator = document.getElementById('rechargeOperator').innerHTML;
|
|
|
253 |
if(couponCode.length !=0){
|
|
|
254 |
var url = base_url+'recharge/rechargeAmount/'+recharge_Amount+'/'+couponCode;
|
|
|
255 |
microAjax(url, function (res) {
|
|
|
256 |
debugger;
|
|
|
257 |
if(res != '')
|
|
|
258 |
{
|
|
|
259 |
var data = JSON.parse(res);
|
|
|
260 |
if(parseInt(data.couponAmount) == 0){
|
|
|
261 |
document.getElementById('error').style.display = "block";
|
|
|
262 |
document.getElementById('error').innerHTML ='Invalid Coupon Code!';
|
|
|
263 |
}
|
|
|
264 |
else{
|
|
|
265 |
if(data.payAmount == 0){
|
|
|
266 |
if(document.getElementById('captcha').style.display == 'none'){
|
|
|
267 |
changeCaptcha();
|
|
|
268 |
}
|
|
|
269 |
//document.getElementById('amount').value = parseInt(data.payAmount);
|
|
|
270 |
document.getElementById('recharge_Amount').innerHTML = parseInt(data.payAmount);
|
|
|
271 |
document.getElementById('payAmount').innerHTML = parseInt(data.payAmount);
|
|
|
272 |
if(document.getElementById('walletAmount')){
|
|
|
273 |
document.getElementById('walletAmount').innerHTML = parseInt(data.walletAmount);
|
|
|
274 |
}
|
|
|
275 |
if(document.getElementById('walletAmountLeft')){
|
|
|
276 |
document.getElementById('walletAmountLeft').innerHTML = parseInt(data.walletAmountLeft);
|
|
|
277 |
}
|
|
|
278 |
document.getElementById('coupon_code').value = document.getElementById('couponCode').value;
|
|
|
279 |
document.getElementById('payAmount').value = parseInt(data.payAmount);
|
|
|
280 |
document.getElementById('coupon').style.display = "none";
|
|
|
281 |
document.getElementById('coupon_msg').innerHTML ='Coupon Code applied!';
|
|
|
282 |
document.getElementById('submit').value ='Recharge Now';
|
|
|
283 |
}else{
|
|
|
284 |
//document.getElementById('amount').value = parseInt(data.payAmount);
|
|
|
285 |
document.getElementById('recharge_Amount').innerHTML = parseInt(data.payAmount);
|
|
|
286 |
document.getElementById('payAmount').innerHTML = parseInt(data.payAmount);
|
|
|
287 |
document.getElementById('coupon_code').value = document.getElementById('couponCode').value;
|
|
|
288 |
document.getElementById('payAmount').value = parseInt(data.payAmount);
|
|
|
289 |
document.getElementById('coupon').style.display = "none";
|
|
|
290 |
document.getElementById('coupon_msg').innerHTML ='Coupon Code applied!';
|
|
|
291 |
}
|
|
|
292 |
}
|
|
|
293 |
}
|
|
|
294 |
});
|
|
|
295 |
}
|
|
|
296 |
else{
|
|
|
297 |
document.getElementById('error').style.display = "block";
|
|
|
298 |
document.getElementById('error').innerHTML ='Please enter a Coupon Code!';
|
|
|
299 |
}
|
|
|
300 |
}
|
|
|
301 |
|
|
|
302 |
function clearError(){
|
|
|
303 |
if(document.getElementById('error').style.display == "block"){
|
|
|
304 |
document.getElementById('error').style.display = "none";
|
|
|
305 |
}
|
|
|
306 |
}
|
|
|
307 |
window.onload=function(){
|
|
|
308 |
var value = localStorage.getItem('rechargeValue');
|
|
|
309 |
if(parseInt(value) == 2){
|
|
|
310 |
if(document.getElementsByClassName('mobile-recharge')[0]){
|
|
|
311 |
document.getElementsByClassName('mobile-recharge')[0].style.display = 'none';
|
|
|
312 |
document.getElementsByClassName('dth-recharge')[0].style.display = 'block';
|
|
|
313 |
document.getElementsByClassName('mobile-re')[0].className = 'mobile-re';
|
|
|
314 |
document.getElementsByClassName('dth-re')[0].className += ' selected';
|
|
|
315 |
}
|
|
|
316 |
}
|
|
|
317 |
};
|
|
|
318 |
function changePayment(e){
|
|
|
319 |
debugger;
|
|
|
320 |
var Id = e.currentTarget.id;
|
|
|
321 |
var defaultId = defaultPayment.id;
|
|
|
322 |
if(defaultId != Id){
|
|
|
323 |
document.getElementById(defaultId).className = 'card';
|
|
|
324 |
defaultPayment.nextElementSibling.style.display = 'none';
|
|
|
325 |
defaultPayment.children[0].innerHTML = '+';
|
|
|
326 |
document.getElementById(Id).className += ' selected';
|
|
|
327 |
document.getElementById(Id).children[0].innerHTML = '-';
|
|
|
328 |
e.currentTarget.nextElementSibling.style.display = 'block';
|
|
|
329 |
//document.getElementById(Id).style.display = 'block';
|
|
|
330 |
defaultPayment = e.currentTarget;
|
|
|
331 |
}
|
|
|
332 |
}
|
|
|
333 |
var previousDebit;
|
|
|
334 |
function selectDebitCard(e){
|
|
|
335 |
debugger;
|
|
|
336 |
var Id = e.currentTarget.id;
|
|
|
337 |
if(previousDebit == undefined){
|
|
|
338 |
document.getElementById(Id).className = 'selected';
|
|
|
339 |
}
|
|
|
340 |
else if(previousDebit != undefined){
|
|
|
341 |
document.getElementById(previousDebit).className = '';
|
|
|
342 |
document.getElementById(Id).className = 'selected';
|
|
|
343 |
}
|
|
|
344 |
document.getElementById('pay-debit').value = Id;
|
|
|
345 |
previousDebit = Id;
|
|
|
346 |
}
|
|
|
347 |
var previousCard;
|
|
|
348 |
function selectCard(e){
|
|
|
349 |
debugger;
|
|
|
350 |
var Id = e.currentTarget.id;
|
|
|
351 |
if(previousCard == undefined){
|
|
|
352 |
document.getElementById(Id).className = 'selected';
|
|
|
353 |
}
|
|
|
354 |
else if(previousCard != undefined){
|
|
|
355 |
document.getElementById(previousCard).className = '';
|
|
|
356 |
document.getElementById(Id).className = 'selected';
|
|
|
357 |
}
|
|
|
358 |
document.getElementById('pay-credit').value = Id;
|
|
|
359 |
previousCard = Id;
|
|
|
360 |
}
|
| 10678 |
lgm |
361 |
var netBanking;
|
| 10582 |
lgm |
362 |
function changeNetBanking(e){
|
|
|
363 |
debugger;
|
| 10678 |
lgm |
364 |
var Id;
|
|
|
365 |
Id = e.currentTarget.value;
|
|
|
366 |
if(Id == undefined){
|
|
|
367 |
Id = e.currentTarget.id;
|
|
|
368 |
}
|
|
|
369 |
if(netBanking == undefined){
|
|
|
370 |
document.getElementById(Id).className = 'selected';
|
|
|
371 |
}
|
|
|
372 |
else if(netBanking != undefined){
|
|
|
373 |
document.getElementById(netBanking).className = '';
|
|
|
374 |
document.getElementById(Id).className = 'selected';
|
|
|
375 |
}
|
| 10582 |
lgm |
376 |
document.getElementById('pay-net').value = Id;
|
| 10678 |
lgm |
377 |
netBanking = Id;
|
|
|
378 |
var title = e.currentTarget.getAttribute('data-parent');
|
|
|
379 |
title = title+'-'+Id;
|
|
|
380 |
//ga('send', 'event', 'Payment Option', 'Payment option tab-payotion selected',title);
|
| 10582 |
lgm |
381 |
}
|
|
|
382 |
function submitform(){
|
|
|
383 |
debugger
|
|
|
384 |
if(parseInt(document.getElementById('payAmount').value) == 0 ){
|
|
|
385 |
if(document.getElementById('captcha_response_box').value == ''){
|
|
|
386 |
// document.forms['recharge-confirm'].submit();
|
|
|
387 |
// }else{
|
|
|
388 |
var bRed = document.getElementById('captcha_response_box');
|
|
|
389 |
bRed.style.border = 'red solid 1px';
|
|
|
390 |
bRed.style.color = 'red';
|
|
|
391 |
bRed.value = 'Please enter the captcha'
|
|
|
392 |
setTimeout(function(){
|
|
|
393 |
bRed.style.border = '';
|
|
|
394 |
bRed.style.color = '';
|
|
|
395 |
bRed.value = '';
|
|
|
396 |
},3000);
|
|
|
397 |
return false;
|
|
|
398 |
}
|
|
|
399 |
}
|
|
|
400 |
var value = localStorage.getItem('rechargeValue');
|
|
|
401 |
if(parseInt(value) == 1){
|
|
|
402 |
ga('send', 'event', 'Recharge', 'Confirm','Mobile');
|
|
|
403 |
}else if(parseInt(value) == 2){
|
|
|
404 |
ga('send', 'event', 'Recharge', 'Confirm','DTH');
|
|
|
405 |
}
|
|
|
406 |
}
|
|
|
407 |
function addressValidation(e){
|
|
|
408 |
debugger;
|
|
|
409 |
var Id = e.currentTarget.id;
|
|
|
410 |
if(Id == 'creditcard'){
|
|
|
411 |
if(previousCard == undefined){
|
|
|
412 |
document.getElementById('error').style.display = "block";
|
|
|
413 |
document.getElementById('error').innerHTML ='Please select payment method!';
|
|
|
414 |
window.scrollTo(0,0); return false;
|
|
|
415 |
}
|
|
|
416 |
}else if(Id == 'debitcard'){
|
|
|
417 |
if(previousDebit == undefined){
|
|
|
418 |
document.getElementById('error').style.display = "block";
|
|
|
419 |
document.getElementById('error').innerHTML ='Please select payment method!';
|
|
|
420 |
window.scrollTo(0,0); return false;
|
|
|
421 |
}
|
|
|
422 |
}else if(Id == 'netbanking'){
|
|
|
423 |
var payOption = document.getElementById('pay-net').value;
|
|
|
424 |
if(payOption == undefined || payOption ==""){
|
|
|
425 |
document.getElementById('error').style.display = "block";
|
|
|
426 |
document.getElementById('error').innerHTML ='Please select payment method!';
|
|
|
427 |
window.scrollTo(0,0); return false;
|
|
|
428 |
}
|
|
|
429 |
}
|
|
|
430 |
if(document.getElementById('ccAddress')){
|
|
|
431 |
var error = Id+'error';
|
|
|
432 |
var fname = document.getElementById(Id).name.value;
|
|
|
433 |
var street1 = document.getElementById(Id).line1.value;
|
|
|
434 |
var street2 = document.getElementById(Id).line2.value;
|
|
|
435 |
var city = document.getElementById(Id).city.value;
|
|
|
436 |
var state = document.getElementById(Id).state.value;
|
|
|
437 |
var zipcode = document.getElementById(Id).pincode.value;
|
|
|
438 |
var phone = document.getElementById(Id).phone.value;
|
| 10742 |
lgm |
439 |
if(fname =='')
|
| 10678 |
lgm |
440 |
{
|
|
|
441 |
document.getElementById('error').style.display = "block";
|
|
|
442 |
document.getElementById('error').innerHTML ='Please fill name field!';
|
|
|
443 |
window.scrollTo(0,0); return false;}
|
| 10742 |
lgm |
444 |
if(!removeScript(fname))
|
|
|
445 |
{
|
|
|
446 |
document.getElementById('error').style.display = "block";
|
|
|
447 |
document.getElementById('error').innerHTML ='Please remove script tags!';
|
|
|
448 |
window.scrollTo(0,0); return false;}
|
|
|
449 |
if(fname.length> 50)
|
|
|
450 |
{
|
|
|
451 |
document.getElementById('error').style.display = "block";
|
|
|
452 |
document.getElementById('error').innerHTML ='Please Enter Less Than 50 Characters in name field!';
|
|
|
453 |
window.scrollTo(0,0); return false;}
|
|
|
454 |
if(fname !== fname.trim())
|
|
|
455 |
{
|
|
|
456 |
document.getElementById('error').style.display = "block";
|
|
|
457 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from name field!';
|
|
|
458 |
window.scrollTo(0,0); return false;}
|
|
|
459 |
if(fname !== fname.replace(/\s+/g, ' '))
|
|
|
460 |
{
|
|
|
461 |
document.getElementById('error').style.display = "block";
|
|
|
462 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from name field!';
|
|
|
463 |
window.scrollTo(0,0); return false;}
|
|
|
464 |
if(street1 =='')
|
|
|
465 |
{
|
|
|
466 |
document.getElementById('error').style.display = "block";
|
|
|
467 |
document.getElementById('error').innerHTML ='Please fill address field!';
|
|
|
468 |
window.scrollTo(0,0); return false;}
|
|
|
469 |
if(street1 != street1.trim())
|
|
|
470 |
{
|
|
|
471 |
document.getElementById('error').style.display = "block";
|
|
|
472 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from address field!';
|
|
|
473 |
window.scrollTo(0,0); return false;}
|
|
|
474 |
if(street1 != street1.replace(/\s+/g, ' '))
|
|
|
475 |
{
|
|
|
476 |
document.getElementById('error').style.display = "block";
|
|
|
477 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from address field!';
|
|
|
478 |
window.scrollTo(0,0); return false;}
|
|
|
479 |
if(!removeScript(street1))
|
|
|
480 |
{
|
|
|
481 |
document.getElementById('error').style.display = "block";
|
|
|
482 |
document.getElementById('error').innerHTML ='Please remove script tags!';
|
|
|
483 |
window.scrollTo(0,0); return false;}
|
|
|
484 |
if(street2 != street2.trim())
|
|
|
485 |
{
|
|
|
486 |
document.getElementById('error').style.display = "block";
|
|
|
487 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from address field!';
|
|
|
488 |
window.scrollTo(0,0); return false;}
|
|
|
489 |
if(street2 != street2.replace(/\s+/g, ' '))
|
|
|
490 |
{
|
|
|
491 |
document.getElementById('error').style.display = "block";
|
|
|
492 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from address field!';
|
|
|
493 |
window.scrollTo(0,0); return false;}
|
|
|
494 |
if(!removeScript(street2))
|
|
|
495 |
{
|
|
|
496 |
document.getElementById('error').style.display = "block";
|
|
|
497 |
document.getElementById('error').innerHTML ='Please remove script tags!';
|
|
|
498 |
window.scrollTo(0,0); return false;}
|
|
|
499 |
if(state == -1)
|
|
|
500 |
{
|
|
|
501 |
document.getElementById('error').style.display = "block";
|
|
|
502 |
document.getElementById('error').innerHTML ='Please fill state field!';
|
|
|
503 |
window.scrollTo(0,0); return false;}
|
|
|
504 |
if(!removeScript(state))
|
|
|
505 |
{
|
|
|
506 |
document.getElementById('error').style.display = "block";
|
|
|
507 |
document.getElementById('error').innerHTML ='Please remove script tags!';
|
|
|
508 |
window.scrollTo(0,0); return false;}
|
|
|
509 |
if(city =='')
|
|
|
510 |
{
|
|
|
511 |
document.getElementById('error').style.display = "block";
|
|
|
512 |
document.getElementById('error').innerHTML ='Please fill City field!';
|
|
|
513 |
window.scrollTo(0,0); return false;}
|
|
|
514 |
if(!removeScript(city))
|
|
|
515 |
{
|
|
|
516 |
document.getElementById('error').style.display = "block";
|
|
|
517 |
document.getElementById('error').innerHTML ='Please remove script tags!';
|
|
|
518 |
window.scrollTo(0,0); return false;}
|
|
|
519 |
if(city != city.trim())
|
|
|
520 |
{
|
|
|
521 |
document.getElementById('error').style.display = "block";
|
|
|
522 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from city!';
|
|
|
523 |
window.scrollTo(0,0); return false;}
|
|
|
524 |
if(city != city.replace(/\s+/g, ' '))
|
|
|
525 |
{
|
|
|
526 |
document.getElementById('error').style.display = "block";
|
|
|
527 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from city!';
|
|
|
528 |
window.scrollTo(0,0); return false;}
|
|
|
529 |
if(zipcode =='')
|
|
|
530 |
{
|
|
|
531 |
document.getElementById('error').style.display = "block";
|
|
|
532 |
document.getElementById('error').innerHTML ='Please fill pincode field!';
|
|
|
533 |
window.scrollTo(0,0); return false;}
|
|
|
534 |
if(zipcode.length !=6)
|
|
|
535 |
{
|
|
|
536 |
document.getElementById('error').style.display = "block";
|
|
|
537 |
document.getElementById('error').innerHTML ='Pincode should be 6 digits long';
|
|
|
538 |
window.scrollTo(0,0); return false;}
|
|
|
539 |
if(!zipcode.match(/^\d+/))
|
|
|
540 |
{
|
|
|
541 |
document.getElementById('error').style.display = "block";
|
|
|
542 |
document.getElementById('error').innerHTML ='Please Use numbers only for pincode!';
|
|
|
543 |
window.scrollTo(0,0); return false;}
|
|
|
544 |
if(zipcode != zipcode.trim())
|
|
|
545 |
{
|
|
|
546 |
document.getElementById('error').style.display = "block";
|
|
|
547 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from pincode!';
|
|
|
548 |
window.scrollTo(0,0); return false;}
|
|
|
549 |
if(zipcode != zipcode.replace(/\s+/g, ' '))
|
|
|
550 |
{
|
|
|
551 |
document.getElementById('error').style.display = "block";
|
|
|
552 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from pincode!';
|
|
|
553 |
window.scrollTo(0,0); return false;}
|
|
|
554 |
if(phone =='')
|
|
|
555 |
{
|
|
|
556 |
document.getElementById('error').style.display = "block";
|
|
|
557 |
document.getElementById('error').innerHTML ='Please fill phone number field!';
|
|
|
558 |
window.scrollTo(0,0); return false;}
|
|
|
559 |
if(!phone.match(/^\d+/))
|
|
|
560 |
{ document.getElementById('error').style.display = "block";
|
|
|
561 |
document.getElementById('error').innerHTML ='Please Use numbers only for Mobile Number!';
|
|
|
562 |
window.scrollTo(0,0); return false;}
|
|
|
563 |
if(phone.length != 10)
|
|
|
564 |
{ document.getElementById('error').style.display = "block";
|
|
|
565 |
document.getElementById('error').innerHTML ='Mobile number should be of 10 digits!';
|
|
|
566 |
window.scrollTo(0,0); return false;}
|
|
|
567 |
if(phone != phone.trim())
|
|
|
568 |
{
|
|
|
569 |
document.getElementById('error').style.display = "block";
|
|
|
570 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from phone number!';
|
|
|
571 |
window.scrollTo(0,0); return false;}
|
|
|
572 |
if(phone != phone.replace(/\s+/g, ' '))
|
|
|
573 |
{
|
|
|
574 |
document.getElementById('error').style.display = "block";
|
|
|
575 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from phone number!';
|
|
|
576 |
window.scrollTo(0,0); return false;}
|
| 10678 |
lgm |
577 |
}
|
| 10582 |
lgm |
578 |
var value = localStorage.getItem('rechargeValue');
|
|
|
579 |
if(parseInt(value) == 1){
|
|
|
580 |
ga('send', 'event', 'Recharge', 'Recharge','Mobile');
|
|
|
581 |
}else if(parseInt(value) == 2){
|
|
|
582 |
ga('send', 'event', 'Recharge', 'Pay Now','DTH');
|
|
|
583 |
}
|
|
|
584 |
}
|
|
|
585 |
var url;
|
|
|
586 |
url = document.URL;
|
|
|
587 |
if(url.indexOf('recharge-result') != -1){
|
|
|
588 |
if(orderConfirmation != undefined){
|
|
|
589 |
ga('require', 'ecommerce', 'ecommerce.js');
|
|
|
590 |
var amount = parseFloat(orderConfirmation['response'].totalAmount).toFixed(2);
|
|
|
591 |
var orderId = orderConfirmation['response'].rechargeDisplayId;
|
|
|
592 |
var deviceNumber = orderConfirmation['response'].rechargeDeviceNumber;
|
|
|
593 |
ga('ecommerce:addTransaction', {
|
|
|
594 |
'id': orderId, // Transaction ID. Required.
|
|
|
595 |
'affiliation': 'shop2020', // Affiliation or store name.
|
|
|
596 |
'revenue': amount, // Grand Total.
|
|
|
597 |
'shipping': '0', // Shipping.
|
|
|
598 |
'tax': '0', // Tax.
|
|
|
599 |
'city':"",
|
|
|
600 |
'state':"",
|
|
|
601 |
'country':"India"
|
|
|
602 |
});
|
|
|
603 |
ga('ecommerce:addItem', {
|
|
|
604 |
'id': orderId, // Transaction ID. Required.
|
|
|
605 |
'name': orderConfirmation['response'].rechargeProvider, // Product name. Required.
|
|
|
606 |
'sku': deviceNumber, // SKU/code.
|
|
|
607 |
'category': 'Digital', // Category or variation.
|
|
|
608 |
'price': amount, // Unit price.
|
|
|
609 |
'quantity': '1' // Quantity.
|
|
|
610 |
});
|
|
|
611 |
ga('ecommerce:send');
|
|
|
612 |
}
|
|
|
613 |
}
|