Commit 8e25d825bc0a8cfa31ba0b1b0c40196dbd679f2b

Authored by Palak Handa
1 parent 8d58b37daa
Exists in master and in 1 other branch paytm

changes the rajorpayment

Showing 1 changed file with 54 additions and 5 deletions   Show diff stats
1 // create the module and name it scotchApp 1 // create the module and name it scotchApp
2 var scotchApp = angular.module('scotchApp', ['ngRoute']); 2 var scotchApp = angular.module('scotchApp', ['ngRoute']);
3 3
4 // configure our routes 4 // configure our routes
5 scotchApp.config(function($routeProvider) { 5 scotchApp.config(function($routeProvider) {
6 $routeProvider 6 $routeProvider
7 7
8 // route for the home page 8 // route for the home page
9 .when('/', { 9 .when('/', {
10 templateUrl: 'pages/home.html', 10 templateUrl: 'pages/home.html',
11 controller: 'mainController' 11 controller: 'mainController'
12 }) 12 })
13 13
14 // route for the paymentVerify page 14 // route for the paymentVerify page
15 .when('/paymentVerification/:id', { 15 .when('/paymentVerification/:id', {
16 templateUrl: 'pages/verify.html', 16 templateUrl: 'pages/verify.html',
17 controller: 'verifyController' 17 controller: 'verifyController'
18 }) 18 })
19 19
20 // route for the ambassador page 20 // route for the ambassador page
21 .when('/ambassador', { 21 .when('/ambassador', {
22 templateUrl: 'pages/ambassador.html', 22 templateUrl: 'pages/ambassador.html',
23 controller: 'ambassadorController' 23 controller: 'ambassadorController'
24 }) 24 })
25 }); 25 });
26 26
27 scotchApp.constant("BASE_URL", "http://0.0.0.0:4001/api") 27 scotchApp.constant("BASE_URL", "http://139.59.68.74:4001/api")
28 28
29 // create the controller and inject Angular's $scope 29 // create the controller and inject Angular's $scope
30 scotchApp.controller('mainController', function($scope, $http, $location, $route, $rootScope, BASE_URL) { 30 scotchApp.controller('mainController', function($scope, $http, $location, $route, $rootScope, BASE_URL) {
31 $scope.data = { 31 $scope.data = {
32 show: true, 32 show: true,
33 hide: false 33 hide: false
34 }; 34 };
35 35
36 $scope.infoForm = false; /*THIS CODE FOR HIDE STEP 2 FORM*/ 36 $scope.infoForm = false; /*THIS CODE FOR HIDE STEP 2 FORM*/
37 37
38 $scope.max = 100; 38 $scope.max = 100;
39 $scope.current = 0; 39 $scope.current = 0;
40 $scope.payingAmnt = 0; 40 $scope.payingAmnt = 0;
41 if ($scope.data.stage == 'select') { 41 if ($scope.data.stage == 'select') {
42 console.log("sdsaasd"); 42 console.log("sdsaasd");
43 43
44 } 44 }
45 45
46 $scope.author = 'Swarn Singh'; 46 $scope.author = 'Swarn Singh';
47 $scope.data = {}; 47 $scope.data = {};
48 $scope.data.stage = 'Idea'; 48 $scope.data.stage = 'Idea';
49 $scope.discountAmount = 0; 49 $scope.discountAmount = 0;
50 $scope.check = false; 50 $scope.check = false;
51 $scope.numberCheck = false; 51 $scope.numberCheck = false;
52 $scope.paymentResult = {}; 52 $scope.paymentResult = {};
53 var data = { 53 var data = {
54 "amount": $scope.payingAmnt, 54 "amount": $scope.payingAmnt,
55 "currency": "INR", 55 "currency": "INR",
56 "status": "pending" 56 "status": "pending"
57 } 57 }
58 58
59 $scope.removeError = function() { 59 $scope.removeError = function() {
60 $('#invalidEmail').css('display', 'none'); 60 $('#invalidEmail').css('display', 'none');
61 $('#alreadyExist').css('display', 'none'); 61 $('#alreadyExist').css('display', 'none');
62 }; 62 };
63 63
64 $scope.emailcheck = function(val) { 64 $scope.emailcheck = function(val) {
65 if (val == undefined) { 65 if (val == undefined) {
66 $('#invalidEmail').css('display', 'block'); 66 $('#invalidEmail').css('display', 'block');
67 } else { 67 } else {
68 $http({ 68 $http({
69 method: 'GET', 69 method: 'GET',
70 url: BASE_URL + '/applicants?filter={"where": {"email": {"like":"%25' + $scope.data.email + '%25"}}}', 70 url: BASE_URL + '/applicants?filter={"where": {"email": {"like":"%25' + $scope.data.email + '%25"}}}',
71 headers: {} 71 headers: {}
72 }).then(function mySuccess(searchResult) { 72 }).then(function mySuccess(searchResult) {
73 console.log("searchResult1===>", searchResult) 73 console.log("searchResult1===>", searchResult)
74 if (searchResult.data.length == 0) { 74 if (searchResult.data.length == 0) {
75 $scope.check = false; 75 $scope.check = false;
76 } else { 76 } else {
77 $scope.check = true; 77 $scope.check = true;
78 $('#alreadyExist').css('display', 'block'); 78 $('#alreadyExist').css('display', 'block');
79 } 79 }
80 }, function myError(error) {}); 80 }, function myError(error) {});
81 } 81 }
82 }; 82 };
83 83
84 $scope.removeNoError = function() { 84 $scope.removeNoError = function() {
85 $('#noExist').css('display', 'none'); 85 $('#noExist').css('display', 'none');
86 }; 86 };
87 87
88 $scope.numbercheck = function(number) { 88 $scope.numbercheck = function(number) {
89 $http({ 89 $http({
90 method: 'GET', 90 method: 'GET',
91 url: BASE_URL + '/applicants?filter={"where": {"phone": {"like":"%25' + number + '%25"}}}', 91 url: BASE_URL + '/applicants?filter={"where": {"phone": {"like":"%25' + number + '%25"}}}',
92 data: $scope.data, 92 data: $scope.data,
93 headers: {} 93 headers: {}
94 }).then(function mySuccess(searchResult) { 94 }).then(function mySuccess(searchResult) {
95 console.log("searchResult===>", searchResult) 95 console.log("searchResult===>", searchResult)
96 if (searchResult.data.length == 0) { 96 if (searchResult.data.length == 0) {
97 $scope.numberCheck = false; 97 $scope.numberCheck = false;
98 98
99 } else { 99 } else {
100 $scope.numberCheck = true; 100 $scope.numberCheck = true;
101 $('#noExist').css('display', 'block'); 101 $('#noExist').css('display', 'block');
102 } 102 }
103 }, function myError(error) {}); 103 }, function myError(error) {});
104 }; 104 };
105 105
106 $rootScope.tokenCall = function(val) { 106 $rootScope.tokenCall = function(val) {
107 console.log('val-------->', val); 107 console.log('val-------->', val);
108 if (val == undefined) { 108 if (val == undefined) {
109 $('#invalidEmail').css('display', 'block'); 109 $('#invalidEmail').css('display', 'block');
110 } else { 110 } else {
111 val = val.toUpperCase(); 111 val = val.toUpperCase();
112 $http.get(BASE_URL + '/ambassadors?filter={"where": {"referalToken": {"like":"%25' + val + '%25"}}}') 112 $http.get(BASE_URL + '/ambassadors?filter={"where": {"referalToken": {"like":"%25' + val + '%25"}}}')
113 .then(function(searchResult) { 113 .then(function(searchResult) {
114 if (searchResult.data.length == 0) { 114 if (searchResult.data.length == 0) {
115 $scope.tokencheck = false; 115 $scope.tokencheck = false;
116 $scope.discountAmount = 0; 116 $scope.discountAmount = 0;
117 } else { 117 } else {
118 $scope.tokencheck = true; 118 $scope.tokencheck = true;
119 } 119 }
120 },function(err){ 120 },function(err){
121 console.log(err) 121 console.log(err)
122 }); 122 });
123 123
124 } 124 }
125 }; 125 };
126 126
127 /*THIS CODE FOR ENABLED SUBMIT BUTTON AFTER UPLOAD IMAGE*/ 127 /*THIS CODE FOR ENABLED SUBMIT BUTTON AFTER UPLOAD IMAGE*/
128 $(document).ready( 128 $(document).ready(
129 function() { 129 function() {
130 $('input:submit').attr('disabled', true); 130 $('input:submit').attr('disabled', true);
131 $('input:file').change( 131 $('input:file').change(
132 function() { 132 function() {
133 if ($("#picture").val()) { 133 if ($("#picture").val()) {
134 $('input:submit').removeAttr('disabled'); 134 $('input:submit').removeAttr('disabled');
135 } else { 135 } else {
136 $('input:submit').attr('disabled', true); 136 $('input:submit').attr('disabled', true);
137 } 137 }
138 }); 138 });
139 }); 139 });
140 140
141 /*****THIS IS FOR STEP ONE FORM ******/ 141 /*****THIS IS FOR STEP ONE FORM ******/
142 $scope.next = function() { 142 $scope.next = function() {
143 $scope.data.status = null 143 $scope.data.status = null
144 if ($scope.data.stage == undefined || $scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined || $scope.data.city == undefined) { 144 if ($scope.data.stage == undefined || $scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined || $scope.data.city == undefined) {
145 var x = document.getElementById("snackbar") 145 var x = document.getElementById("snackbar")
146 x.className = "show"; 146 x.className = "show";
147 setTimeout(function() { 147 setTimeout(function() {
148 x.className = x.className.replace("show", ""); 148 x.className = x.className.replace("show", "");
149 }, 3000); 149 }, 3000);
150 } else if ($scope.data.stage != undefined && $scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined && $scope.data.city != undefined) { 150 } else if ($scope.data.stage != undefined && $scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined && $scope.data.city != undefined) {
151 $scope.infoForm = true; 151 $scope.infoForm = true;
152 console.log("sdasdasdsa"); 152 console.log("sdasdasdsa");
153 $scope.data.stage = $scope.data.stage; 153 $scope.data.stage = $scope.data.stage;
154 $scope.detail = {}; 154 $scope.detail = {};
155 $scope.data.phone = "+91" + $scope.data.number; 155 $scope.data.phone = "+91" + $scope.data.number;
156 $http({ 156 $http({
157 method: 'POST', 157 method: 'POST',
158 url: BASE_URL + '/information', 158 url: BASE_URL + '/information',
159 data: $scope.data, 159 data: $scope.data,
160 headers: {} 160 headers: {}
161 }).then(function mySuccess(result) { 161 }).then(function mySuccess(result) {
162 console.log("result", result) 162 console.log("result", result)
163 $scope.detail = result; 163 $scope.detail = result;
164 data.applicantId = result.data.id; 164 data.applicantId = result.data.id;
165 $scope.userId = result.data.id; 165 $scope.userId = result.data.id;
166 166
167 }, function myError(error) {}); 167 }, function myError(error) {});
168 } 168 }
169 169
170 } 170 }
171 171
172 $scope.calculateAmount = function(){ 172 $scope.calculateAmount = function(){
173 if ($scope.data.stage == "Idea") { 173 if ($scope.data.stage == "Idea") {
174 console.log("$scope.data", $scope.data) 174 console.log("$scope.data", $scope.data)
175 $scope.ticketAmnt = 500; 175 $scope.ticketAmnt = 500;
176 } 176 }
177 177
178 if ($scope.data.stage == "Product") { 178 if ($scope.data.stage == "Product") {
179 $scope.ticketAmnt = 1000; 179 $scope.ticketAmnt = 1000;
180 } 180 }
181 181
182 if ($scope.data.stage == "Growth") { 182 if ($scope.data.stage == "Growth") {
183 $scope.ticketAmnt = 2000; 183 $scope.ticketAmnt = 2000;
184 } 184 }
185 185
186 if($scope.tokencheck == true){ 186 if($scope.tokencheck == true){
187 var amount = $scope.ticketAmnt 187 var amount = $scope.ticketAmnt
188 $scope.discountAmount = (amount * 10)/100 188 $scope.discountAmount = (amount * 10)/100
189 console.log("finalAmount====>",$scope.payingAmnt) 189 console.log("finalAmount====>",$scope.payingAmnt)
190 } 190 }
191 191
192 var taxAmount = $scope.ticketAmnt - $scope.discountAmount 192 var taxAmount = $scope.ticketAmnt - $scope.discountAmount
193 $scope.taxTotal = (taxAmount * 18)/100 193 $scope.taxTotal = (taxAmount * 18)/100
194 $scope.payingAmnt = taxAmount + $scope.taxTotal 194 $scope.payingAmnt = taxAmount + $scope.taxTotal
195 console.log("taxincludedamount----", $scope.payingAmnt) 195 console.log("taxincludedamount----", $scope.payingAmnt)
196 } 196 }
197 197
198 /*****THIS IS FOR STEP THREE FORM ******/ 198 /*****THIS IS FOR STEP THREE FORM ******/
199 $scope.create = function() { 199 $scope.create = function() {
200 if ($scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined) { 200 if ($scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined) {
201 var x = document.getElementById("snackbar") 201 var x = document.getElementById("snackbar")
202 x.className = "show"; 202 x.className = "show";
203 setTimeout(function() { 203 setTimeout(function() {
204 x.className = x.className.replace("show", ""); 204 x.className = x.className.replace("show", "");
205 }, 3000); 205 }, 3000);
206 } else if ($scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined) { 206 } else if ($scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined) {
207 $scope.infoForm = true; 207 $scope.infoForm = true;
208 console.log("sdasdasdsa"); 208 console.log("sdasdasdsa");
209 $scope.data.stage = $scope.data.stage; 209 $scope.data.stage = $scope.data.stage;
210 $scope.detail = {}; 210 $scope.detail = {};
211 $scope.data.phone = "+91" + $scope.data.number; 211 $scope.data.phone = "+91" + $scope.data.number;
212 $http({ 212 $http({
213 method: 'POST', 213 method: 'POST',
214 url: BASE_URL + '/applicants', 214 url: BASE_URL + '/applicants',
215 data: $scope.data, 215 data: $scope.data,
216 headers: {} 216 headers: {}
217 }).then(function mySuccess(result) { 217 }).then(function mySuccess(result) {
218 218
219 console.log("=====result=====", result) 219 console.log("=====result=====", result)
220 $scope.detail = result; 220 $scope.detail = result;
221 data.applicantId = result.data.id; 221 data.applicantId = result.data.id;
222 $scope.userId = result.data.id; 222 $scope.userId = result.data.id;
223 console.log("=====data=====", data) 223 console.log("=====data=====", data)
224 data.amount = $scope.payingAmnt; 224 data.amount = $scope.payingAmnt;
225 if ($scope.detail != null) { 225 if ($scope.detail != null) {
226 $http({ 226 $http({
227 method: 'POST', 227 method: 'POST',
228 url: BASE_URL + '/payments', 228 url: BASE_URL + '/payments',
229 data: data, 229 data: data,
230 headers: {} 230 headers: {}
231 }).then(function mySuccess(paymentResult) { 231 }).then(function mySuccess(paymentResult) {
232 console.log("paymentResult",paymentResult)
232 $scope.paymentResult = paymentResult; 233 $scope.paymentResult = paymentResult;
233 }, function myError(error) {}); 234 }, function myError(error) {});
234 } 235 }
235 var i = 0; 236 var i = 0;
236 $scope.payingAmnt = $scope.payingAmnt * 100; 237 $scope.payingAmnt = $scope.payingAmnt * 100;
237 var options = { 238 var options = {
238 "key": "rzp_live_mhSE1uOBlXvFyJ", 239 "key": "rzp_test_YwHsVFiDIQ2WUQ",
239 "amount": $scope.payingAmnt, 240 "amount": $scope.payingAmnt,
240 241
241 "name": "Startup Jalsa", 242 "name": "Startup Jalsa",
242 "description": "amount", 243 "description": "amount",
243 "currency": "INR", 244 "currency": "INR",
244 "status": "done", 245 "status": "done",
245 246
246 "theme": { 247 "theme": {
247 "color": "#2196f3 ", 248 "color": "#2196f3 ",
248 "image_padding": "NO" 249 "image_padding": "NO"
249 }, 250 },
250 "modal": { 251 "modal": {
251 "ondismiss": function() {} 252 "ondismiss": function() {}
252 }, 253 },
253 "handler": function(response) { 254 "handler": function(response) {
254 createPayment(response); 255 createPayment(response);
255 } 256 }
256 }; 257 };
257 var rzp1 = new Razorpay(options); 258 var rzp1 = new Razorpay(options);
258 rzp1.open(); 259 rzp1.open();
259 $scope.paymentResponse = {}; 260 $scope.paymentResponse = {};
260 261
261 function createPayment(response) { 262 function createPayment(response) {
263 console.log("response====from===razorpay",response)
262 $route.reload(); 264 $route.reload();
263 $scope.paymentResponse.razorPaymentId = response.razorpay_payment_id; 265 $scope.paymentResponse.razorPaymentId = response.razorpay_payment_id;
264 $scope.paymentResponse.razorOrderId = $scope.paymentResult.data.razorOrderId; 266 $scope.paymentResponse.razorOrderId = $scope.paymentResult.data.razorOrderId;
265 $scope.paymentResponse.amount = data.amount; 267 $scope.paymentResponse.amount = data.amount;
266 $scope.paymentResponse.currency = "INR"; 268 $scope.paymentResponse.currency = "INR";
267 $scope.paymentResponse.status = "captured"; 269 $scope.paymentResponse.status = $scope.paymentResult.data.status;
268 $http({ 270 $http({
269 method: 'PUT', 271 method: 'PUT',
270 url: BASE_URL + '/payments/' + $scope.paymentResult.data.id, 272 url: BASE_URL + '/payments/' + $scope.paymentResult.data.id,
271 data: $scope.paymentResponse, 273 data: $scope.paymentResponse,
272 headers: {} 274 headers: {}
273 }).then(function mySuccess(searchResult) { 275 }).then(function mySuccess(searchResult) {
274 console.log("searchResult", searchResult) 276 console.log("searchResult", searchResult)
275 $scope.showToastr() 277 $scope.showToastr()
276 //toaster.success("Registration done successfully"); 278 //toaster.success("Registration done successfully");
277 279
278 }, function myError(error) {}); 280 }, function myError(error) {});
279 } 281 }
280 282
281 }, function myError(error) {}); 283 }, function myError(error) {});
282 } 284 }
283 285
284 } 286 }
285 287
286 $scope.showToastr = function() { 288 $scope.showToastr = function() {
287 console.log("called toast") 289 console.log("called toast")
288 var x = document.getElementById("snacsskbar") 290 var x = document.getElementById("snacsskbar")
289 x.className = "show"; 291 x.className = "show";
290 setTimeout(function() { 292 setTimeout(function() {
291 x.className = x.className.replace("show", ""); 293 x.className = x.className.replace("show", "");
292 }, 3000); 294 }, 3000);
293 } 295 }
294 296
295 /*kk***This code for change data when click to chooses stages***/ 297 /*kk***This code for change data when click to chooses stages***/
296 $scope.businessmodel = true; 298 $scope.businessmodel = true;
297 $scope.Idea = true; 299 $scope.Idea = true;
298 $scope.current = true; 300 $scope.current = true;
299 301
300 $scope.stage = function(stage) { 302 $scope.stage = function(stage) {
301 $scope.stagekeyPress(); 303 $scope.stagekeyPress();
302 console.log("stage--2",stage) 304 console.log("stage--2",stage)
303 if (stage == 'Idea') { 305 if (stage == 'Idea') {
304 $scope.current = 10; 306 $scope.current = 10;
305 $scope.prototyp = false; 307 $scope.prototyp = false;
306 $scope.market = false; 308 $scope.market = false;
307 $scope.risks = false; 309 $scope.risks = false;
308 $scope.team = false; 310 $scope.team = false;
309 $scope.pitch = false; 311 $scope.pitch = false;
310 $scope.financials = false; 312 $scope.financials = false;
311 $scope.businessmodel = true; 313 $scope.businessmodel = true;
312 $scope.data.stage = stage; 314 $scope.data.stage = stage;
313 // for right content 315 // for right content
314 $scope.Idea = true; 316 $scope.Idea = true;
315 $scope.Product = false; 317 $scope.Product = false;
316 $scope.Growth = false; 318 $scope.Growth = false;
317 } else if (stage == 'Product') { 319 } else if (stage == 'Product') {
318 $scope.current = 10; 320 $scope.current = 10;
319 $scope.prototyp = true; 321 $scope.prototyp = true;
320 $scope.market = true; 322 $scope.market = true;
321 $scope.risks = true; 323 $scope.risks = true;
322 $scope.team = true; 324 $scope.team = true;
323 $scope.pitch = true; 325 $scope.pitch = true;
324 $scope.financials = true; 326 $scope.financials = true;
325 $scope.businessmodel = false; 327 $scope.businessmodel = false;
326 $scope.data.stage = stage; 328 $scope.data.stage = stage;
327 // for right content 329 // for right content
328 $scope.Idea = false; 330 $scope.Idea = false;
329 $scope.Product = true; 331 $scope.Product = true;
330 $scope.Growth = false; 332 $scope.Growth = false;
331 } else if (stage == 'Growth') { 333 } else if (stage == 'Growth') {
332 $scope.current = 10; 334 $scope.current = 10;
333 $scope.prototyp = true; 335 $scope.prototyp = true;
334 $scope.market = true; 336 $scope.market = true;
335 $scope.risks = true; 337 $scope.risks = true;
336 $scope.team = true; 338 $scope.team = true;
337 $scope.pitch = true; 339 $scope.pitch = true;
338 $scope.financials = true; 340 $scope.financials = true;
339 $scope.businessmodel = false; 341 $scope.businessmodel = false;
340 // for right content 342 // for right content
341 $scope.Idea = false; 343 $scope.Idea = false;
342 $scope.Product = false; 344 $scope.Product = false;
343 $scope.Growth = true; 345 $scope.Growth = true;
344 $scope.data.stage = stage; 346 $scope.data.stage = stage;
345 } 347 }
346 } 348 }
347 $scope.enterbusiness = function(business) { 349 $scope.enterbusiness = function(business) {
348 console.log("business", business); 350 console.log("business", business);
349 if (name == undefined) { 351 if (name == undefined) {
350 $scope.current = false; 352 $scope.current = false;
351 353
352 } else if (name != undefined) { 354 } else if (name != undefined) {
353 $scope.current = true; 355 $scope.current = true;
354 } 356 }
355 } 357 }
356 /*******FOR FILL THE DATA AND SHOWS ICON GREEN*/ 358 /*******FOR FILL THE DATA AND SHOWS ICON GREEN*/
357 $scope.stagekeyPress = function() { 359 $scope.stagekeyPress = function() {
358 $('.icon-circle-a').css('background-color', 'rgb(66, 181, 73)'); 360 $('.icon-circle-a').css('background-color', 'rgb(66, 181, 73)');
359 } 361 }
360 $scope.sectorkeyPress = function() { 362 $scope.sectorkeyPress = function() {
361 $('.icon-circle-b').css('background-color', 'rgb(66, 181, 73)'); 363 $('.icon-circle-b').css('background-color', 'rgb(66, 181, 73)');
362 } 364 }
363 365
364 $scope.studentkeyPress = function() { 366 $scope.studentkeyPress = function() {
365 $('.icon-circle-ab').css('background-color', 'rgb(66, 181, 73)'); 367 $('.icon-circle-ab').css('background-color', 'rgb(66, 181, 73)');
366 } 368 }
367 369
368 $scope.namekeyPress = function(name) { 370 $scope.namekeyPress = function(name) {
369 console.log("name", name); 371 console.log("name", name);
370 if (name == undefined) { 372 if (name == undefined) {
371 $('.icon-circle-c').css('background-color', 'rgb(102, 102, 102)'); 373 $('.icon-circle-c').css('background-color', 'rgb(102, 102, 102)');
372 } else { 374 } else {
373 $('.icon-circle-c').css('background-color', 'rgb(66, 181, 73)'); 375 $('.icon-circle-c').css('background-color', 'rgb(66, 181, 73)');
374 } 376 }
375 } 377 }
376 $scope.emailkeyPress = function(email) { 378 $scope.emailkeyPress = function(email) {
377 console.log("email", email); 379 console.log("email", email);
378 if (email == undefined) { 380 if (email == undefined) {
379 $('.icon-circle-d').css('background-color', 'rgb(102, 102, 102)'); 381 $('.icon-circle-d').css('background-color', 'rgb(102, 102, 102)');
380 } else { 382 } else {
381 $('.icon-circle-d').css('background-color', 'rgb(66, 181, 73)'); 383 $('.icon-circle-d').css('background-color', 'rgb(66, 181, 73)');
382 } 384 }
383 } 385 }
384 386
385 387
386 $scope.phonekeyPress = function(number) { 388 $scope.phonekeyPress = function(number) {
387 console.log("number", number); 389 console.log("number", number);
388 if (number == undefined) { 390 if (number == undefined) {
389 $('.icon-circle-e').css('background-color', 'rgb(102, 102, 102)'); 391 $('.icon-circle-e').css('background-color', 'rgb(102, 102, 102)');
390 } else { 392 } else {
391 $('.icon-circle-e').css('background-color', 'rgb(66, 181, 73)'); 393 $('.icon-circle-e').css('background-color', 'rgb(66, 181, 73)');
392 } 394 }
393 } 395 }
394 396
395 $scope.citykeyPress = function(city) { 397 $scope.citykeyPress = function(city) {
396 console.log("city", city); 398 console.log("city", city);
397 if (city == undefined) { 399 if (city == undefined) {
398 $('.icon-circle-f').css('background-color', 'rgb(102, 102, 102)'); 400 $('.icon-circle-f').css('background-color', 'rgb(102, 102, 102)');
399 } else { 401 } else {
400 $('.icon-circle-f').css('background-color', 'rgb(66, 181, 73)'); 402 $('.icon-circle-f').css('background-color', 'rgb(66, 181, 73)');
401 } 403 }
402 } 404 }
403 405
404 $scope.questionkeyPress = function(q) { 406 $scope.questionkeyPress = function(q) {
405 if (q == undefined) { 407 if (q == undefined) {
406 $('.icon-circle-x').css('background-color', 'rgb(102, 102, 102)'); 408 $('.icon-circle-x').css('background-color', 'rgb(102, 102, 102)');
407 } else { 409 } else {
408 $('.icon-circle-x').css('background-color', 'rgb(66, 181, 73)'); 410 $('.icon-circle-x').css('background-color', 'rgb(66, 181, 73)');
409 } 411 }
410 } 412 }
411 413
412 $scope.technologykeyPress = function(technology) { 414 $scope.technologykeyPress = function(technology) {
413 if (technology == undefined) { 415 if (technology == undefined) {
414 $('.icon-circle-h').css('background-color', 'rgb(102, 102, 102)'); 416 $('.icon-circle-h').css('background-color', 'rgb(102, 102, 102)');
415 } else { 417 } else {
416 $('.icon-circle-h').css('background-color', 'rgb(66, 181, 73)'); 418 $('.icon-circle-h').css('background-color', 'rgb(66, 181, 73)');
417 } 419 }
418 } 420 }
419 $scope.problemkeyPress = function(problem) { 421 $scope.problemkeyPress = function(problem) {
420 if (problem == undefined) { 422 if (problem == undefined) {
421 $('.icon-circle-i').css('background-color', 'rgb(102, 102, 102)'); 423 $('.icon-circle-i').css('background-color', 'rgb(102, 102, 102)');
422 } else { 424 } else {
423 $('.icon-circle-i').css('background-color', 'rgb(66, 181, 73)'); 425 $('.icon-circle-i').css('background-color', 'rgb(66, 181, 73)');
424 } 426 }
425 } 427 }
426 $scope.solutionkeyPress = function(solution) { 428 $scope.solutionkeyPress = function(solution) {
427 if (solution == undefined) { 429 if (solution == undefined) {
428 $('.icon-circle-j').css('background-color', 'rgb(102, 102, 102)'); 430 $('.icon-circle-j').css('background-color', 'rgb(102, 102, 102)');
429 } else { 431 } else {
430 $('.icon-circle-j').css('background-color', 'rgb(66, 181, 73)'); 432 $('.icon-circle-j').css('background-color', 'rgb(66, 181, 73)');
431 } 433 }
432 } 434 }
433 $scope.businesskeyPress = function(business) { 435 $scope.businesskeyPress = function(business) {
434 $('.icon-circle-p').css('background-color', 'rgb(66, 181, 73)'); 436 $('.icon-circle-p').css('background-color', 'rgb(66, 181, 73)');
435 } 437 }
436 438
437 $scope.prototypekeyPress = function(prototype) { 439 $scope.prototypekeyPress = function(prototype) {
438 if (prototype == undefined) { 440 if (prototype == undefined) {
439 $('.icon-circle-k').css('background-color', 'rgb(102, 102, 102)'); 441 $('.icon-circle-k').css('background-color', 'rgb(102, 102, 102)');
440 } else { 442 } else {
441 $('.icon-circle-k').css('background-color', 'rgb(66, 181, 73)'); 443 $('.icon-circle-k').css('background-color', 'rgb(66, 181, 73)');
442 } 444 }
443 } 445 }
444 446
445 $scope.marketkeyPress = function(market) { 447 $scope.marketkeyPress = function(market) {
446 if (market == undefined) { 448 if (market == undefined) {
447 $('.icon-circle-l').css('background-color', 'rgb(102, 102, 102)'); 449 $('.icon-circle-l').css('background-color', 'rgb(102, 102, 102)');
448 } else { 450 } else {
449 $('.icon-circle-l').css('background-color', 'rgb(66, 181, 73)'); 451 $('.icon-circle-l').css('background-color', 'rgb(66, 181, 73)');
450 } 452 }
451 } 453 }
452 454
453 $scope.riskkeyPress = function(risk) { 455 $scope.riskkeyPress = function(risk) {
454 if (risk == undefined) { 456 if (risk == undefined) {
455 $('.icon-circle-m').css('background-color', 'rgb(102, 102, 102)'); 457 $('.icon-circle-m').css('background-color', 'rgb(102, 102, 102)');
456 } else { 458 } else {
457 $('.icon-circle-m').css('background-color', 'rgb(66, 181, 73)'); 459 $('.icon-circle-m').css('background-color', 'rgb(66, 181, 73)');
458 } 460 }
459 } 461 }
460 462
461 $scope.teamkeyPress = function(team) { 463 $scope.teamkeyPress = function(team) {
462 if (team == undefined) { 464 if (team == undefined) {
463 $('.icon-circle-n').css('background-color', 'rgb(102, 102, 102)'); 465 $('.icon-circle-n').css('background-color', 'rgb(102, 102, 102)');
464 } else { 466 } else {
465 $('.icon-circle-n').css('background-color', 'rgb(66, 181, 73)'); 467 $('.icon-circle-n').css('background-color', 'rgb(66, 181, 73)');
466 } 468 }
467 } 469 }
468 470
469 $scope.pitchkeyPress = function(pitch) { 471 $scope.pitchkeyPress = function(pitch) {
470 if (pitch == undefined) { 472 if (pitch == undefined) {
471 $('.icon-circle-z').css('background-color', 'rgb(102, 102, 102)'); 473 $('.icon-circle-z').css('background-color', 'rgb(102, 102, 102)');
472 } else { 474 } else {
473 $('.icon-circle-z').css('background-color', 'rgb(66, 181, 73)'); 475 $('.icon-circle-z').css('background-color', 'rgb(66, 181, 73)');
474 } 476 }
475 } 477 }
476 478
477 $scope.financialskeyPress = function(financial) { 479 $scope.financialskeyPress = function(financial) {
478 console.log("financial", financial); 480 console.log("financial", financial);
479 if (financial == undefined) { 481 if (financial == undefined) {
480 $('.icon-circle-q').css('background-color', 'rgb(102, 102, 102)'); 482 $('.icon-circle-q').css('background-color', 'rgb(102, 102, 102)');
481 } else { 483 } else {
482 $('.icon-circle-q').css('background-color', 'rgb(66, 181, 73)'); 484 $('.icon-circle-q').css('background-color', 'rgb(66, 181, 73)');
483 } 485 }
484 } 486 }
485 $scope.changeReferalIconColor = function(referalToken){ 487 $scope.changeReferalIconColor = function(referalToken){
486 if (referalToken == undefined || referalToken == '') { 488 if (referalToken == undefined || referalToken == '') {
487 $('.referel-icon').css('background-color', 'rgb(102, 102, 102)'); 489 $('.referel-icon').css('background-color', 'rgb(102, 102, 102)');
488 }else { 490 }else {
489 $('.referel-icon').css('background-color', 'rgb(66, 181, 73)'); 491 $('.referel-icon').css('background-color', 'rgb(66, 181, 73)');
490 } 492 }
491 } 493 }
492 494
493 }); 495 });
494 496
495 scotchApp.controller('verifyController', function($scope, $http, $location, $route,BASE_URL) { 497 scotchApp.controller('verifyController', function($scope, $http, $location, $route,BASE_URL) {
496 $scope.pendingPaymentId = $route.current.params.id 498 $scope.pendingPaymentId = $route.current.params.id
497 $http({ 499 $http({
498 method: "GET", 500 method: "GET",
499 url: BASE_URL + '/applicants/' + $scope.pendingPaymentId, 501 url: BASE_URL + '/applicants/' + $scope.pendingPaymentId,
500 }).then(function mySuccess(response) { 502 }).then(function mySuccess(response) {
501 $scope.data = response.data; 503 $scope.data = response.data;
502 console.log("response-1", response); 504 console.log("response-1", response);
503 $scope.pendingPaymentId = $route.current.params.id; 505 $scope.pendingPaymentId = $route.current.params.id;
504 506
505 $http({ 507 $http({
506 method: "GET", 508 method: "GET",
507 url: BASE_URL + '/payments?filter={"where":{"applicantId":' + $scope.pendingPaymentId + '}}', 509 url: BASE_URL + '/payments?filter={"where":{"applicantId":' + $scope.pendingPaymentId + '}}',
508 }).then(function mySuccess(response) { 510 }).then(function mySuccess(response) {
509 $scope.paymentRecord = response.data; 511 $scope.paymentRecord = response.data;
510 }, function myError(response) { 512 }, function myError(response) {
511 }); 513 });
512 }, function myError(response) { 514 }, function myError(response) {
513 $scope.myWelcome = response.statusText; 515 $scope.myWelcome = response.statusText;
514 }); 516 });
515 517
516 $scope.checkView = false; 518 $scope.checkView = false;
517 $scope.verifyView = false; 519 $scope.verifyView = false;
518 520
519 $scope.pendingPaymentId = ''; 521 $scope.pendingPaymentId = '';
520 522
521 $scope.update = function() { 523 $scope.update = function() {
522 524
523 $http({ 525 $http({
524 method: 'GET', 526 method: 'GET',
525 url: BASE_URL + '/payments?filter={"where":{"applicantId": ' + $scope.pendingPaymentId + '}}', 527 url: BASE_URL + '/payments?filter={"where":{"applicantId": ' + $scope.pendingPaymentId + '}}',
526 headers: {} 528 headers: {}
527 }).then(function mySuccess(searchResult) { 529 }).then(function mySuccess(searchResult) {
528 if (searchResult.data[0].status == "pending") { 530 if (searchResult.data[0].status == "pending") {
529 $scope.checkView = true; 531 $scope.checkView = true;
530 $scope.verifyView = false; 532 $scope.verifyView = false;
531 $scope.amount = searchResult.data[0].amount * 100; 533 $scope.amount = searchResult.data[0].amount * 100;
532 console.log('pending data', searchResult); 534 console.log('pending data', searchResult);
533 var i = 0; 535 var i = 0;
534 var options = { 536 var options = {
535 "key": "rzp_live_mhSE1uOBlXvFyJ", 537 // "key": "rzp_live_mhSE1uOBlXvFyJ",
538 "key" : "rzp_test_YwHsVFiDIQ2WUQ",
536 "amount": $scope.amount, 539 "amount": $scope.amount,
537 540
538 "name": "Startup Jalsa", 541 "name": "Startup Jalsa",
539 "description": "amount", 542 "description": "amount",
540 "currency": "INR", 543 "currency": "INR",
541 "status": "done", 544 "status": "done",
542 545
543 "theme": { 546 "theme": {
544 "color": "#2196f3 ", 547 "color": "#2196f3 ",
545 "image_padding": "NO" 548 "image_padding": "NO"
546 }, 549 },
547 "modal": { 550 "modal": {
548 "ondismiss": function() {} 551 "ondismiss": function() {}
549 }, 552 },
550 "handler": function(response) { 553 "handler": function(response) {
551 createPayment(response); 554 createPayment(response);
552 } 555 }
553 }; 556 };
554 var rzp1 = new Razorpay(options); 557 var rzp1 = new Razorpay(options);
555 rzp1.open(); 558 rzp1.open();
556 $scope.paymentResponse = {}; 559 $scope.paymentResponse = {};
557 560
558 function createPayment(response) { 561 function createPayment(response) {
562 console.log("response",response);
559 $scope.paymentResponse.razorPaymentId = response.razorpay_payment_id; 563 $scope.paymentResponse.razorPaymentId = response.razorpay_payment_id;
560 $scope.paymentResponse.razorOrderId = $scope.paymentResult.data.razorOrderId; 564 $scope.paymentResponse.razorOrderId = $scope.paymentResult.data.razorOrderId;
561 $scope.paymentResponse.amount = $scope.amount; 565 $scope.paymentResponse.amount = $scope.amount;
562 $scope.paymentResponse.currency = "INR"; 566 $scope.paymentResponse.currency = "INR";
563 $scope.paymentResponse.status = "captured"; 567 $scope.paymentResponse.status = "captured";
564 $scope.paymentResponse.applicantId = $scope.userId; 568 $scope.paymentResponse.applicantId = $scope.userId;
565 console.log("$scope.paymentResponse", $scope.paymentResponse) 569 console.log("$scope.paymentResponse", $scope.paymentResponse)
566 $http({ 570 $http({
567 method: 'PUT', 571 method: 'PUT',
568 url: BASE_URL + '/payments/' + $scope.paymentResult.data.id, 572 url: BASE_URL + '/payments/' + $scope.paymentResult.data.id,
569 data: $scope.paymentResponse, 573 data: $scope.paymentResponse,
570 headers: {} 574 headers: {}
571 }).then(function mySuccess(searchResult) { 575 }).then(function mySuccess(searchResult) {
572 576 console.log("finalsearchResult",searchResult)
573 }, function myError(error) { 577 }, function myError(error) {
574 578
575 }); 579 });
576 } 580 }
577 } else { 581 } else {
578 582
579 } 583 }
580 584
581 }, function myError(error) {}); 585 }, function myError(error) {});
582 } 586 }
583 }); 587 });
584 588
585 scotchApp.controller('ambassadorController', function($scope, $http, $location, $route,BASE_URL) { 589 scotchApp.controller('ambassadorController', function($scope, $http, $location, $route,BASE_URL) {
586 $scope.data = {}; 590 $scope.data = {};
591 $scope.check = false;
592 $scope.numberCheck = false;
593
594 $scope.emailcheck = function(val) {
595 if (val == undefined) {
596 $('#invalidEmail').css('display', 'block');
597 } else {
598 $http({
599 method: 'GET',
600 url: BASE_URL + '/ambassadors?filter={"where": {"email": {"like":"%25' + $scope.data.email + '%25"}}}',
601 headers: {}
602 }).then(function mySuccess(searchResult) {
603 console.log("searchResult1===>", searchResult)
604 if (searchResult.data.length == 0) {
605 $scope.check = false;
606 } else {
607 $scope.check = true;
608 $('#alreadyExist').css('display', 'block');
609 }
610 }, function myError(error) {});
611 }
612 };
613
614 $scope.removeNoError = function() {
615 $('#noExist').css('display', 'none');
616 };
617
618 $scope.numbercheck = function(number) {
619 $http({
620 method: 'GET',
621 url: BASE_URL + '/ambassadors?filter={"where": {"phone": {"like":"%25' + number + '%25"}}}',
622 data: $scope.data,
623 headers: {}
624 }).then(function mySuccess(searchResult) {
625 console.log("searchResult===>", searchResult)
626 if (searchResult.data.length == 0) {
627 $scope.numberCheck = false;
628
629 } else {
630 $scope.numberCheck = true;
631 $('#noExist').css('display', 'block');
632 }
633 }, function myError(error) {});
634 };
635
587 $scope.submit = function() { 636 $scope.submit = function() {
588 console.log($scope.data.name) 637 console.log($scope.data.name)
589 var randomNumber = ""+Math.random(); 638 var randomNumber = ""+Math.random();
590 var nameSpliced = $scope.data.name.slice(0,3); 639 var nameSpliced = $scope.data.name.slice(0,3);
591 var numberSpliced = randomNumber.slice(2,5); 640 var numberSpliced = randomNumber.slice(2,5);
592 $scope.data.referalToken = nameSpliced+numberSpliced; 641 $scope.data.referalToken = nameSpliced+numberSpliced;
593 $scope.data.referalToken = $scope.data.referalToken.toUpperCase(); 642 $scope.data.referalToken = $scope.data.referalToken.toUpperCase();
594 643
595 $http({ 644 $http({
596 method: 'POST', 645 method: 'POST',
597 url: BASE_URL + '/ambassadors', 646 url: BASE_URL + '/ambassadors',
598 data: $scope.data, 647 data: $scope.data,
599 headers: {} 648 headers: {}
600 }).then(function mySuccess(result) { 649 }).then(function mySuccess(result) {
601 console.log("result", result) 650 console.log("result", result)
602 $scope.detail = result; 651 $scope.detail = result;
603 $('#myModal').modal('show'); 652 $('#myModal').modal('show');
604 $scope.data.name = ''; 653 $scope.data.name = '';
605 $scope.data.email = ''; 654 $scope.data.email = '';
606 $scope.data.mobile = ''; 655 $scope.data.mobile = '';
607 656
608 }, function myError(error) {}); 657 }, function myError(error) {});
609 console.log($scope.data) 658 console.log($scope.data)
610 } 659 }
611 }); 660 });
612 661
613 662