| 7068 |
anupam.sin |
1 |
$(function() {
|
| 7160 |
amit.gupta |
2 |
$(document).ready(function(){
|
|
|
3 |
var rechargeType = $('input.rechargetype:checked').val();
|
|
|
4 |
if(rechargeType == 2) {
|
|
|
5 |
if($('input.devicetype:checked').val() == 2) {
|
|
|
6 |
$('input.rechargetype:unchecked').attr('checked', 'checked');
|
|
|
7 |
alert('New DTH Connections are not supported');
|
|
|
8 |
return false;
|
|
|
9 |
} else {
|
|
|
10 |
$('#frc-div').slideDown(100);
|
|
|
11 |
}
|
|
|
12 |
}
|
|
|
13 |
});
|
| 7125 |
amit.gupta |
14 |
oldValue = "";
|
|
|
15 |
$('.rechargetype').click(function (){
|
|
|
16 |
$('div.mk_amount_row .input-div').html('<input type="text" name="amount" class="inputbox rupee padding48">');
|
|
|
17 |
$('#discountText').remove();
|
| 7068 |
anupam.sin |
18 |
var rechargeType = $('input.rechargetype:checked').val();
|
|
|
19 |
//1 is for Normal
|
|
|
20 |
//2 for New Connection(FRC)
|
|
|
21 |
if(rechargeType == 1) {
|
|
|
22 |
$('#frc-div').slideUp(100);
|
|
|
23 |
}
|
|
|
24 |
if(rechargeType == 2) {
|
| 7096 |
anupam.sin |
25 |
if($('input.devicetype:checked').val() == 2) {
|
|
|
26 |
$('input.rechargetype:unchecked').attr('checked', 'checked');
|
|
|
27 |
alert('New DTH Connections are not supported');
|
|
|
28 |
return false;
|
|
|
29 |
} else {
|
|
|
30 |
$('#frc-div').slideDown(100);
|
|
|
31 |
}
|
| 7068 |
anupam.sin |
32 |
}
|
|
|
33 |
});
|
|
|
34 |
|
|
|
35 |
$('.devicetype').change(function (){
|
|
|
36 |
var devicetype = $('input.devicetype:checked').val();
|
|
|
37 |
//1 is for Mobile
|
|
|
38 |
//2 for DTH
|
|
|
39 |
if(devicetype == 1) {
|
|
|
40 |
var deviceNumberInput = $('.inputbox[name=number]')
|
|
|
41 |
deviceNumberInput.removeClass('padding15');
|
|
|
42 |
deviceNumberInput.addClass('num-prefix padding48');
|
| 7073 |
anupam.sin |
43 |
$('#dthSelector').hide();
|
|
|
44 |
$('#mobileSelector').show();
|
| 7068 |
anupam.sin |
45 |
}
|
|
|
46 |
if(devicetype == 2) {
|
| 7096 |
anupam.sin |
47 |
if($('input.rechargetype:checked').val() == 2) {
|
|
|
48 |
$('input.devicetype:unchecked').attr('checked', 'checked');
|
|
|
49 |
alert('New DTH Connections are not supported');
|
|
|
50 |
return false;
|
|
|
51 |
}
|
| 7068 |
anupam.sin |
52 |
var deviceNumberInput = $('.inputbox[name=number]')
|
|
|
53 |
deviceNumberInput.removeClass('num-prefix padding48');
|
|
|
54 |
deviceNumberInput.addClass('padding15');
|
| 7073 |
anupam.sin |
55 |
$('#mobileSelector').hide();
|
|
|
56 |
$('#dthSelector').show();
|
| 7068 |
anupam.sin |
57 |
}
|
|
|
58 |
});
|
| 7073 |
anupam.sin |
59 |
|
| 7080 |
anupam.sin |
60 |
$('#recharge-button').click(function() {
|
| 7096 |
anupam.sin |
61 |
$('#confirmForm').attr('action', '/rch/confirm!createRecharge');
|
| 7080 |
anupam.sin |
62 |
$('#confirmForm').submit();
|
|
|
63 |
});
|
|
|
64 |
|
| 7151 |
amit.gupta |
65 |
/*$('#edit-button').click(function() {
|
| 7096 |
anupam.sin |
66 |
$('#confirmForm').attr('action', '/rch/home!editRecharge');
|
| 7080 |
anupam.sin |
67 |
$('#confirmForm').submit();
|
| 7151 |
amit.gupta |
68 |
});*/
|
| 7080 |
anupam.sin |
69 |
|
| 7073 |
anupam.sin |
70 |
$('#rechargeDetailsForm input[name="number"]').unbind('keyup blur').bind('keyup blur', function(){
|
|
|
71 |
var numvalue = $(this).val().substring(0,4);
|
|
|
72 |
var count = $(this).val().length;
|
|
|
73 |
if(count==10 && oldValue != numvalue){
|
|
|
74 |
getRechargeProvider(numvalue, 1);
|
|
|
75 |
//$(this).unbind('keyup');
|
|
|
76 |
}
|
|
|
77 |
});
|
| 7125 |
amit.gupta |
78 |
$('#mobileSelector').change(function(){
|
|
|
79 |
var selectedOperator = $('#mobileSelector').val();
|
|
|
80 |
if($('input.rechargetype:checked').val() == "2") {
|
|
|
81 |
if(selectedOperator != 0) {
|
|
|
82 |
return $.ajax({
|
|
|
83 |
type: "POST",
|
|
|
84 |
dataType:"json",
|
|
|
85 |
url: "/rch/home!getFRC?operatorId=" + selectedOperator,
|
|
|
86 |
success:function(msg) {
|
|
|
87 |
if(msg.length != 0) {
|
| 7140 |
amit.gupta |
88 |
$('div.mk_amount_row .input-div').html('<select id="newConDis" style="height:30px;font-size:18px;"><option>Custom</option></select>' +
|
| 7125 |
amit.gupta |
89 |
'<input type="text" name="amount" class="inputbox rupee padding48" style="width:120px">');
|
|
|
90 |
$.each(msg,function(index,obj){
|
|
|
91 |
$("#newConDis").append('<option disc="' + obj.maxDiscount + '" >' + obj.denomination +'</option>');
|
|
|
92 |
});
|
|
|
93 |
console.log($('div.mk_discount_row').append('<div id="discountText" style="text-align: left;font-size: 15px;width: 340px;color: blue;" class="text"></div>'));
|
|
|
94 |
} else {
|
|
|
95 |
$('div.mk_amount_row .input-div').html('<input type="text" name="amount" class="inputbox rupee padding48">');
|
|
|
96 |
$('#discountText').remove();
|
|
|
97 |
}
|
|
|
98 |
}
|
|
|
99 |
});
|
|
|
100 |
}
|
|
|
101 |
}
|
|
|
102 |
});
|
| 7073 |
anupam.sin |
103 |
|
| 7125 |
amit.gupta |
104 |
$("#newConDis").live('change', function(){
|
|
|
105 |
if(this.selectedIndex == 0){
|
|
|
106 |
$('div.mk_discount_row :last').html('');
|
|
|
107 |
$('#rechargeDetailsForm [name="amount"]').show().val('');
|
|
|
108 |
}else {
|
|
|
109 |
var discount = $(this).find(":selected").attr("disc");
|
|
|
110 |
$('#rechargeDetailsForm [name="amount"]').val($(this).val()).hide();
|
| 7160 |
amit.gupta |
111 |
$('div.mk_discount_row :last').html('Discount more than rupees' + discount + ' is not allowed');
|
| 7125 |
amit.gupta |
112 |
}
|
|
|
113 |
});
|
| 7151 |
amit.gupta |
114 |
|
|
|
115 |
$("#dateselector").change(function() {
|
|
|
116 |
if($(this).val()=="3"){
|
|
|
117 |
$("#daterange").show();
|
|
|
118 |
}else {
|
|
|
119 |
$("#daterange").hide();
|
|
|
120 |
}
|
|
|
121 |
});
|
|
|
122 |
|
| 7073 |
anupam.sin |
123 |
function getRechargeProvider(deviceNumber, deviceType){
|
|
|
124 |
return $.ajax({
|
|
|
125 |
type: "POST",
|
| 7096 |
anupam.sin |
126 |
url: "/rch/home!getServiceProvider?deviceNumber=" + deviceNumber + "&deviceType=" + deviceType,
|
| 7073 |
anupam.sin |
127 |
success:function(msg){
|
|
|
128 |
if(msg != ""){
|
|
|
129 |
var deviceNumberInfo = msg.split(":");
|
| 7125 |
amit.gupta |
130 |
if($.trim(deviceNumberInfo[0]) == -1) {
|
|
|
131 |
alert ("Service not reachable or invalid number");
|
|
|
132 |
}
|
|
|
133 |
if($('input.rechargetype:checked').val() == "2"){
|
|
|
134 |
if(storeCircleCode != $.trim(deviceNumberInfo[1])){
|
|
|
135 |
$('input[name="number"]').val("");
|
|
|
136 |
alert('This number does not belong to your circle');
|
|
|
137 |
return false;
|
|
|
138 |
}
|
|
|
139 |
}
|
| 7073 |
anupam.sin |
140 |
$('#rechargeDetailsForm select[name="mobileOperator"]').val($.trim(deviceNumberInfo[0]));
|
| 7096 |
anupam.sin |
141 |
$('#circlecode').val($.trim(deviceNumberInfo[1]));
|
| 7073 |
anupam.sin |
142 |
$('#mobileSelector').trigger('change');
|
| 7125 |
amit.gupta |
143 |
oldValue = deviceNumber;
|
| 7073 |
anupam.sin |
144 |
}
|
| 7125 |
amit.gupta |
145 |
},
|
|
|
146 |
complete : function(){
|
|
|
147 |
$('#rechargeDetailsForm input[name="number"]').bind('keyup blur', function(){
|
|
|
148 |
var numvalue = $(this).val().substring(0,4);
|
|
|
149 |
var count = $(this).val().length;
|
|
|
150 |
if(count==10 && oldValue != numvalue){
|
|
|
151 |
getRechargeProvider(numvalue, 1);
|
|
|
152 |
}
|
|
|
153 |
});
|
|
|
154 |
},
|
|
|
155 |
beforeSend : function(){
|
|
|
156 |
$('#rechargeDetailsForm input[name="number"]').unbind('keyup blur');
|
| 7073 |
anupam.sin |
157 |
}
|
|
|
158 |
});
|
|
|
159 |
}
|
| 7096 |
anupam.sin |
160 |
});
|
|
|
161 |
|
|
|
162 |
function validateAllFields() {
|
|
|
163 |
var rechargeType = $('input.rechargetype:checked').val();
|
|
|
164 |
//1 is for Normal
|
|
|
165 |
//2 for New Connection(FRC)
|
|
|
166 |
var devicetype = $('input.devicetype:checked').val();
|
|
|
167 |
//1 is for Mobile
|
|
|
168 |
//2 for DTH
|
|
|
169 |
if($('input[name=number]').val() === ""){
|
|
|
170 |
alert('Please enter device number');
|
|
|
171 |
return false;
|
|
|
172 |
}
|
|
|
173 |
if($('input[name=name]').val() === ""){
|
|
|
174 |
alert('Please enter customer name');
|
|
|
175 |
return false;
|
|
|
176 |
}
|
| 7151 |
amit.gupta |
177 |
if($('input[name=number]').val() != $('input[name=repeat]').val()){
|
|
|
178 |
alert('Please confirm the device number.');
|
|
|
179 |
return false;
|
|
|
180 |
}
|
| 7096 |
anupam.sin |
181 |
if($('input[name=amount]').val() === ""){
|
|
|
182 |
alert('Please enter amount');
|
|
|
183 |
return false;
|
|
|
184 |
}
|
| 7073 |
anupam.sin |
185 |
|
| 7096 |
anupam.sin |
186 |
if(deviceType == 1 && $('#mobileSelector').val() === 0) {
|
|
|
187 |
alert('Please select operator');
|
|
|
188 |
return false;
|
|
|
189 |
}
|
|
|
190 |
|
|
|
191 |
if(deviceType == 2 && $('#dthSelector').val() === 0) {
|
|
|
192 |
alert('Please select operator');
|
|
|
193 |
return false;
|
|
|
194 |
}
|
|
|
195 |
|
|
|
196 |
if(rechargeType == 2) {
|
|
|
197 |
if($('input[name=sim]').val() === ""){
|
|
|
198 |
alert('Please enter SIM number');
|
| 7073 |
anupam.sin |
199 |
return false;
|
|
|
200 |
}
|
| 7096 |
anupam.sin |
201 |
if($('input[name=caf]').val() === ""){
|
|
|
202 |
alert('Please enter CAF number');
|
| 7073 |
anupam.sin |
203 |
return false;
|
|
|
204 |
}
|
| 7096 |
anupam.sin |
205 |
if($('input[name=alternate]').val() === ""){
|
|
|
206 |
alert('Please enter alternate number');
|
| 7073 |
anupam.sin |
207 |
return false;
|
|
|
208 |
}
|
|
|
209 |
}
|
| 7096 |
anupam.sin |
210 |
}
|