| 7068 |
anupam.sin |
1 |
$(function() {
|
|
|
2 |
$('.rechargetype').change(function (){
|
|
|
3 |
var rechargeType = $('input.rechargetype:checked').val();
|
|
|
4 |
//1 is for Normal
|
|
|
5 |
//2 for New Connection(FRC)
|
|
|
6 |
if(rechargeType == 1) {
|
|
|
7 |
$('#frc-div').slideUp(100);
|
|
|
8 |
}
|
|
|
9 |
if(rechargeType == 2) {
|
|
|
10 |
$('#frc-div').slideDown(100);
|
|
|
11 |
}
|
|
|
12 |
});
|
|
|
13 |
|
|
|
14 |
$('.devicetype').change(function (){
|
|
|
15 |
var devicetype = $('input.devicetype:checked').val();
|
|
|
16 |
//1 is for Mobile
|
|
|
17 |
//2 for DTH
|
|
|
18 |
if(devicetype == 1) {
|
|
|
19 |
var deviceNumberInput = $('.inputbox[name=number]')
|
|
|
20 |
deviceNumberInput.removeClass('padding15');
|
|
|
21 |
deviceNumberInput.addClass('num-prefix padding48');
|
| 7073 |
anupam.sin |
22 |
$('#dthSelector').hide();
|
|
|
23 |
$('#mobileSelector').show();
|
| 7068 |
anupam.sin |
24 |
}
|
|
|
25 |
if(devicetype == 2) {
|
|
|
26 |
var deviceNumberInput = $('.inputbox[name=number]')
|
|
|
27 |
deviceNumberInput.removeClass('num-prefix padding48');
|
|
|
28 |
deviceNumberInput.addClass('padding15');
|
| 7073 |
anupam.sin |
29 |
$('#mobileSelector').hide();
|
|
|
30 |
$('#dthSelector').show();
|
| 7068 |
anupam.sin |
31 |
}
|
|
|
32 |
});
|
| 7073 |
anupam.sin |
33 |
|
|
|
34 |
oldValue = "";
|
|
|
35 |
$('#rechargeDetailsForm input[name="number"]').unbind('keyup blur').bind('keyup blur', function(){
|
|
|
36 |
var numvalue = $(this).val().substring(0,4);
|
|
|
37 |
var count = $(this).val().length;
|
|
|
38 |
if(count==10 && oldValue != numvalue){
|
|
|
39 |
getRechargeProvider(numvalue, 1);
|
|
|
40 |
oldValue = numvalue;
|
|
|
41 |
//$(this).unbind('keyup');
|
|
|
42 |
}
|
|
|
43 |
});
|
|
|
44 |
|
|
|
45 |
function getRechargeProvider(deviceNumber, deviceType){
|
|
|
46 |
return $.ajax({
|
|
|
47 |
type: "POST",
|
|
|
48 |
url: "!getServiceProvider?deviceNumber=" + deviceNumber + "&serviceType=" + deviceType,
|
|
|
49 |
success:function(msg){
|
|
|
50 |
if(msg != ""){
|
|
|
51 |
var deviceNumberInfo = msg.split(":");
|
|
|
52 |
$('#rechargeDetailsForm select[name="mobileOperator"]').val($.trim(deviceNumberInfo[0]));
|
|
|
53 |
$('#mobileSelector').trigger('change');
|
|
|
54 |
}
|
|
|
55 |
}
|
|
|
56 |
});
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
function validateAllFields() {
|
|
|
60 |
var rechargeType = $('input.rechargetype:checked').val();
|
|
|
61 |
//1 is for Normal
|
|
|
62 |
//2 for New Connection(FRC)
|
|
|
63 |
var devicetype = $('input.devicetype:checked').val();
|
|
|
64 |
//1 is for Mobile
|
|
|
65 |
//2 for DTH
|
|
|
66 |
if($('input[name=number]').val() === ""){
|
|
|
67 |
alert('Please enter device number');
|
|
|
68 |
return false;
|
|
|
69 |
}
|
|
|
70 |
if($('input[name=name]').val() === ""){
|
|
|
71 |
alert('Please enter customer name');
|
|
|
72 |
return false;
|
|
|
73 |
}
|
|
|
74 |
if($('input[name=amount]').val() === ""){
|
|
|
75 |
alert('Please enter amount');
|
|
|
76 |
return false;
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
if(deviceType == 1 && $('#mobileSelector').val() === 0) {
|
|
|
80 |
alert('Please select operator');
|
|
|
81 |
return false;
|
|
|
82 |
}
|
|
|
83 |
|
|
|
84 |
if(deviceType == 2 && $('#dthSelector').val() === 0) {
|
|
|
85 |
alert('Please select operator');
|
|
|
86 |
return false;
|
|
|
87 |
}
|
|
|
88 |
|
|
|
89 |
if(rechargeType == 2) {
|
|
|
90 |
if($('input[name=sim]').val() === ""){
|
|
|
91 |
alert('Please enter SIM number');
|
|
|
92 |
return false;
|
|
|
93 |
}
|
|
|
94 |
if($('input[name=caf]').val() === ""){
|
|
|
95 |
alert('Please enter CAF number');
|
|
|
96 |
return false;
|
|
|
97 |
}
|
|
|
98 |
if($('input[name=alternate]').val() === ""){
|
|
|
99 |
alert('Please enter alternate number');
|
|
|
100 |
return false;
|
|
|
101 |
}
|
|
|
102 |
}
|
|
|
103 |
}
|
| 7068 |
anupam.sin |
104 |
});
|