Commit d122fec29cd021a6d7981e3e933236567755ea7e

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

modify

Showing 1 changed file with 119 additions and 120 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','angular-google-analytics']); 2 var scotchApp = angular.module('scotchApp', ['ngRoute','angular-google-analytics']);
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 registration page 14 // route for the registration page
15 .when('/registration', { 15 .when('/registration', {
16 templateUrl: 'pages/registration.html', 16 templateUrl: 'pages/registration.html',
17 controller: 'mainController' 17 controller: 'mainController'
18 }) 18 })
19 19
20 // route for the paymentVerify page 20 // route for the paymentVerify page
21 .when('/pendingPayment/:id', { 21 .when('/pendingPayment/:id', {
22 templateUrl: 'pages/verify.html', 22 templateUrl: 'pages/verify.html',
23 controller: 'verifyController' 23 controller: 'verifyController'
24 }) 24 })
25 25
26 // route for the ambassador page 26 // route for the ambassador page
27 .when('/ambassador', { 27 .when('/ambassador', {
28 templateUrl: 'pages/ambassador.html', 28 templateUrl: 'pages/ambassador.html',
29 controller: 'ambassadorController' 29 controller: 'ambassadorController'
30 }) 30 })
31 31
32 // route for the confirmation page 32 // route for the confirmation page
33 .when('/confirmation', { 33 .when('/confirmation', {
34 templateUrl: 'pages/confirmation.html', 34 templateUrl: 'pages/confirmation.html',
35 controller: 'mainController' 35 controller: 'mainController'
36 }) 36 })
37 37
38 }); 38 });
39 39
40 scotchApp.config(['AnalyticsProvider', function (AnalyticsProvider) { 40 scotchApp.config(['AnalyticsProvider', function (AnalyticsProvider) {
41 // Add configuration code as desired 41 // Add configuration code as desired
42 AnalyticsProvider.setAccount('UA-106416759-1'); //UU-XXXXXXX-X should be your tracking code 42 AnalyticsProvider.setAccount('UA-106416759-1'); //UU-XXXXXXX-X should be your tracking code
43 43
44 // Track all routes (default is true). 44 // Track all routes (default is true).
45 AnalyticsProvider.trackPages(true); 45 AnalyticsProvider.trackPages(true);
46 46
47 // Track all URL query params (default is false). 47 // Track all URL query params (default is false).
48 AnalyticsProvider.trackUrlParams(true); 48 AnalyticsProvider.trackUrlParams(true);
49 49
50 }]).run(['Analytics', function(Analytics) { }]); 50 }]).run(['Analytics', function(Analytics) { }]);
51 51
52 scotchApp.constant("BASE_URL", "http://139.59.68.74:4001/api") 52 scotchApp.constant("BASE_URL", "http://139.59.68.74:4001/api")
53 //scotchApp.constant("BASE_URL", "http://0.0.0.0:4001/api") 53 //scotchApp.constant("BASE_URL", "http://0.0.0.0:4001/api")
54 54
55 // create the controller and inject Angular's $scope 55 // create the controller and inject Angular's $scope
56 scotchApp.controller('mainController', function($scope, $http, $location, $route, $rootScope, BASE_URL, Analytics) { 56 scotchApp.controller('mainController', function($scope, $http, $location, $route, $rootScope, BASE_URL, Analytics) {
57 $scope.data = { 57 $scope.data = {
58 show: true, 58 show: true,
59 hide: false 59 hide: false
60 }; 60 };
61 61
62 $scope.infoForm = false; /*THIS CODE FOR HIDE STEP 2 FORM*/ 62 $scope.infoForm = false; /*THIS CODE FOR HIDE STEP 2 FORM*/
63 // $scope.Textshow = "yes" 63 // $scope.Textshow = "yes"
64 $scope.max = 100; 64 $scope.max = 100;
65 $scope.current = 0; 65 $scope.current = 0;
66 $scope.payingAmnt = 0; 66 $scope.payingAmnt = 0;
67 if ($scope.data.stage == 'select') { 67 if ($scope.data.stage == 'select') {
68 68
69 } 69 }
70 70
71 //$scope.author = 'Swarn Singh'; 71 //$scope.author = 'Swarn Singh';
72 $scope.data = {}; 72 $scope.data = {};
73 $scope.data.stage = 'Idea'; 73 $scope.data.stage = 'Idea';
74 $scope.discountAmount = 0; 74 $scope.discountAmount = 0;
75 $scope.check = false; 75 $scope.check = false;
76 $scope.numberCheck = false; 76 $scope.numberCheck = false;
77 $scope.paymentResult = {}; 77 $scope.paymentResult = {};
78 var data = { 78 var data = {
79 "amount": $scope.payingAmnt, 79 "amount": $scope.payingAmnt,
80 "currency": "INR", 80 "currency": "INR",
81 "status": "pending" 81 "status": "pending"
82 } 82 }
83 83
84 /*open videos in modal*/ 84 /*open videos in modal*/
85 // $scope.openyoutube16 = function(){ 85 // $scope.openyoutube16 = function(){
86 // $('#videoModel').modal('show'); 86 // $('#videoModel').modal('show');
87 // } 87 // }
88 88
89 // $scope.openyoutube17 = function(){ 89 // $scope.openyoutube17 = function(){
90 // $('#videoModels').modal('show'); 90 // $('#videoModels').modal('show');
91 // } 91 // }
92 92
93 // $scope.closeModal = function(){ 93 // $scope.closeModal = function(){
94 // var url = $('#youtubePlayer').attr('src'); 94 // var url = $('#youtubePlayer').attr('src');
95 // $('#youtubePlayer').attr('src', ''); 95 // $('#youtubePlayer').attr('src', '');
96 // $('#youtubePlayer').attr('src', url); 96 // $('#youtubePlayer').attr('src', url);
97 // } 97 // }
98 98
99 99
100 // $scope.closed = function(){ 100 // $scope.closed = function(){
101 // var url = $('#youtubePlayersss').attr('src'); 101 // var url = $('#youtubePlayersss').attr('src');
102 // $('#youtubePlayersss').attr('src', ''); 102 // $('#youtubePlayersss').attr('src', '');
103 // $('#youtubePlayersss').attr('src', url); 103 // $('#youtubePlayersss').attr('src', url);
104 // } 104 // }
105 /*open videos ends here*/ 105 /*open videos ends here*/
106 $scope.apply = function() { 106 $scope.apply = function() {
107 Analytics.trackEvent('register', 'click', 'django.mp4'); 107 Analytics.trackEvent('register', 'click', 'django.mp4');
108 $location.path("/registration") 108 $location.path("/registration")
109 } 109 }
110 110
111 $scope.removeError = function() { 111 $scope.removeError = function() {
112 $('#invalidEmail').css('display', 'none'); 112 $('#invalidEmail').css('display', 'none');
113 $('#alreadyExist').css('display', 'none'); 113 $('#alreadyExist').css('display', 'none');
114 }; 114 };
115 115
116 $scope.emailcheck = function(val) { 116 $scope.emailcheck = function(val) {
117 if (val == undefined) { 117 if (val == undefined) {
118 $('#invalidEmail').css('display', 'block'); 118 $('#invalidEmail').css('display', 'block');
119 } else { 119 } else {
120 $http({ 120 $http({
121 method: 'GET', 121 method: 'GET',
122 url: BASE_URL + '/applicants?filter={"where": {"email": {"like":"%25' + $scope.data.email + '%25"}}}', 122 url: BASE_URL + '/applicants?filter={"where": {"email": {"like":"%25' + $scope.data.email + '%25"}}}',
123 headers: {} 123 headers: {}
124 }).then(function mySuccess(searchResult) { 124 }).then(function mySuccess(searchResult) {
125 console.log("searchResult1===>", searchResult) 125 console.log("searchResult1===>", searchResult)
126 if (searchResult.data.length == 0) { 126 if (searchResult.data.length == 0) {
127 $scope.check = false; 127 $scope.check = false;
128 } else { 128 } else {
129 $scope.check = true; 129 $scope.check = true;
130 $('#alreadyExist').css('display', 'block'); 130 $('#alreadyExist').css('display', 'block');
131 } 131 }
132 }, function myError(error) {}); 132 }, function myError(error) {});
133 } 133 }
134 }; 134 };
135 135
136 $scope.removeNoError = function() { 136 $scope.removeNoError = function() {
137 $('#noExist').css('display', 'none'); 137 $('#noExist').css('display', 'none');
138 }; 138 };
139 139
140 $scope.numbercheck = function(number) { 140 $scope.numbercheck = function(number) {
141 $http({ 141 $http({
142 method: 'GET', 142 method: 'GET',
143 url: BASE_URL + '/applicants?filter={"where": {"phone": {"like":"%25' + number + '%25"}}}', 143 url: BASE_URL + '/applicants?filter={"where": {"phone": {"like":"%25' + number + '%25"}}}',
144 data: $scope.data, 144 data: $scope.data,
145 headers: {} 145 headers: {}
146 }).then(function mySuccess(searchResult) { 146 }).then(function mySuccess(searchResult) {
147 console.log("searchResult===>", searchResult) 147 console.log("searchResult===>", searchResult)
148 if (searchResult.data.length == 0) { 148 if (searchResult.data.length == 0) {
149 $scope.numberCheck = false; 149 $scope.numberCheck = false;
150 150
151 } else { 151 } else {
152 $scope.numberCheck = true; 152 $scope.numberCheck = true;
153 $('#noExist').css('display', 'block'); 153 $('#noExist').css('display', 'block');
154 } 154 }
155 }, function myError(error) {}); 155 }, function myError(error) {});
156 }; 156 };
157 157
158 $rootScope.tokenCall = function(val) { 158 $rootScope.tokenCall = function(val) {
159 console.log('val-------->', val); 159 console.log('val-------->', val);
160 if (val == undefined) { 160 if (val == undefined) {
161 $('#invalidEmail').css('display', 'block'); 161 $('#invalidEmail').css('display', 'block');
162 } else { 162 } else {
163 val = val.toUpperCase(); 163 val = val.toUpperCase();
164 $http.get(BASE_URL + '/ambassadors?filter={"where": {"referalToken": {"like":"%25' + val + '%25"}}}') 164 $http.get(BASE_URL + '/ambassadors?filter={"where": {"referalToken": {"like":"%25' + val + '%25"}}}')
165 .then(function(searchResult) { 165 .then(function(searchResult) {
166 if (searchResult.data.length == 0) { 166 if (searchResult.data.length == 0) {
167 $scope.tokencheck = false; 167 $scope.tokencheck = false;
168 $scope.discountAmount = 0; 168 $scope.discountAmount = 0;
169 } else { 169 } else {
170 $scope.tokencheck = true; 170 $scope.tokencheck = true;
171 } 171 }
172 },function(err){ 172 },function(err){
173 console.log(err) 173 console.log(err)
174 }); 174 });
175 175
176 } 176 }
177 }; 177 };
178 178
179 179
180 /*THIS CODE FOR ENABLED SUBMIT BUTTON AFTER UPLOAD IMAGE*/ 180 /*THIS CODE FOR ENABLED SUBMIT BUTTON AFTER UPLOAD IMAGE*/
181 $(document).ready( 181 $(document).ready(
182 function() { 182 function() {
183 $('input:submit').attr('disabled', true); 183 $('input:submit').attr('disabled', true);
184 $('input:file').change( 184 $('input:file').change(
185 function() { 185 function() {
186 if ($("#picture").val()) { 186 if ($("#picture").val()) {
187 $('input:submit').removeAttr('disabled'); 187 $('input:submit').removeAttr('disabled');
188 } else { 188 } else {
189 $('input:submit').attr('disabled', true); 189 $('input:submit').attr('disabled', true);
190 } 190 }
191 }); 191 });
192 }); 192 });
193 193
194 /*****THIS IS FOR STEP ONE FORM ******/ 194 /*****THIS IS FOR STEP ONE FORM ******/
195 // $scope.next = function() { 195 // $scope.next = function() {
196 // $scope.data.status = null 196 // $scope.data.status = null
197 // if ($scope.data.stage == undefined || $scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined || $scope.data.city == undefined) { 197 // if ($scope.data.stage == undefined || $scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined || $scope.data.city == undefined) {
198 // var x = document.getElementById("snackbar") 198 // var x = document.getElementById("snackbar")
199 // x.className = "show"; 199 // x.className = "show";
200 // setTimeout(function() { 200 // setTimeout(function() {
201 // x.className = x.className.replace("show", ""); 201 // x.className = x.className.replace("show", "");
202 // }, 3000); 202 // }, 3000);
203 // } else if ($scope.data.stage != undefined && $scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined && $scope.data.city != undefined) { 203 // } else if ($scope.data.stage != undefined && $scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined && $scope.data.city != undefined) {
204 // $scope.infoForm = true; 204 // $scope.infoForm = true;
205 // console.log("sdasdasdsa"); 205 // console.log("sdasdasdsa");
206 // $scope.data.stage = $scope.data.stage; 206 // $scope.data.stage = $scope.data.stage;
207 // $scope.detail = {}; 207 // $scope.detail = {};
208 // $scope.data.phone = "+91" + $scope.data.number; 208 // $scope.data.phone = "+91" + $scope.data.number;
209 // $http({ 209 // $http({
210 // method: 'POST', 210 // method: 'POST',
211 // url: BASE_URL + '/information', 211 // url: BASE_URL + '/information',
212 // data: $scope.data, 212 // data: $scope.data,
213 // headers: {} 213 // headers: {}
214 // }).then(function mySuccess(result) { 214 // }).then(function mySuccess(result) {
215 // Analytics.trackEvent('information', 'click', 'django.mp4'); 215 // Analytics.trackEvent('information', 'click', 'django.mp4');
216 // console.log("result", result) 216 // console.log("result", result)
217 // $scope.detail = result; 217 // $scope.detail = result;
218 // data.applicantId = result.data.id; 218 // data.applicantId = result.data.id;
219 // $scope.userId = result.data.id; 219 // $scope.userId = result.data.id;
220 220
221 // }, function myError(error) {}); 221 // }, function myError(error) {});
222 222
223 // } 223 // }
224 224
225 // } 225 // }
226 226
227 $scope.calculateAmount = function(){ 227 $scope.calculateAmount = function(){
228 if ($scope.data.stage == undefined || $scope.data.firstName == undefined || $scope.data.email == undefined || $scope.data.number == undefined || $scope.data.city == undefined) { 228 if ($scope.data.stage == undefined || $scope.data.firstName == undefined || $scope.data.email == undefined || $scope.data.number == undefined || $scope.data.city == undefined) {
229 var x = document.getElementById("snackbar") 229 var x = document.getElementById("snackbar")
230 x.className = "show"; 230 x.className = "show";
231 setTimeout(function() { 231 setTimeout(function() {
232 x.className = x.className.replace("show", ""); 232 x.className = x.className.replace("show", "");
233 }, 3000); 233 }, 3000);
234 } else if ($scope.data.stage != undefined && $scope.data.firstName != undefined && $scope.data.email != undefined && $scope.data.number != undefined && $scope.data.city != undefined) { 234 } else if ($scope.data.stage != undefined && $scope.data.firstName != undefined && $scope.data.email != undefined && $scope.data.number != undefined && $scope.data.city != undefined) {
235 $scope.infoForm = true; 235 $scope.infoForm = true;
236 console.log("sdasdasdsa"); 236 console.log("sdasdasdsa");
237 $scope.data.stage = $scope.data.stage; 237 $scope.data.stage = $scope.data.stage;
238 $scope.detail = {}; 238 $scope.detail = {};
239 $scope.data.phone = "+91" + $scope.data.number; 239 $scope.data.phone = "+91" + $scope.data.number;
240 $http({ 240 $http({
241 method: 'POST', 241 method: 'POST',
242 url: BASE_URL + '/applicants', 242 url: BASE_URL + '/applicants',
243 data: $scope.data, 243 data: $scope.data,
244 headers: {} 244 headers: {}
245 }).then(function mySuccess(result) { 245 }).then(function mySuccess(result) {
246 Analytics.trackEvent('applicants', 'click', 'django.mp4'); 246 Analytics.trackEvent('applicants', 'click', 'django.mp4');
247 console.log("result", result) 247 console.log("result", result)
248 $scope.detail = result; 248 $scope.detail = result;
249 data.applicantId = result.data.id; 249 data.applicantId = result.data.id;
250 $scope.userId = result.data.id; 250 //$scope.userId = result.data.id;
251 251
252 }, function myError(error) {}); 252 if ($scope.data.stage == "Idea") {
253 } 253 console.log("$scope.data", $scope.data)
254 254 $scope.ticketAmnt = 500;
255 if ($scope.data.stage == "Idea") { 255 }
256 console.log("$scope.data", $scope.data) 256
257 $scope.ticketAmnt = 500; 257 if ($scope.data.stage == "Product") {
258 } 258 $scope.ticketAmnt = 1000;
259 259 }
260 if ($scope.data.stage == "Product") { 260
261 $scope.ticketAmnt = 1000; 261 if ($scope.data.stage == "Growth") {
262 } 262 $scope.ticketAmnt = 1000;
263 263 }
264 if ($scope.data.stage == "Growth") { 264 var amount = $scope.ticketAmnt * 100
265 $scope.ticketAmnt = 1000; 265 if($scope.tokencheck == true){
266 } 266 var amount = $scope.ticketAmnt
267 var amount = $scope.ticketAmnt * 100 267 // $scope.discountAmount = (amount * 10)/100
268 if($scope.tokencheck == true){ 268 console.log("finalAmount====>",$scope.payingAmnt)
269 var amount = $scope.ticketAmnt 269 }
270 // $scope.discountAmount = (amount * 10)/100 270
271 console.log("finalAmount====>",$scope.payingAmnt) 271 var taxAmount = $scope.ticketAmnt
272 } 272 // $scope.taxTotal = (taxAmount * 18)/100
273 273 $scope.payingAmnt = taxAmount
274 var taxAmount = $scope.ticketAmnt 274 console.log("taxincludedamount----", $scope.payingAmnt)
275 // $scope.taxTotal = (taxAmount * 18)/100 275 // }
276 $scope.payingAmnt = taxAmount 276
277 console.log("taxincludedamount----", $scope.payingAmnt) 277 /*****THIS IS FOR STEP THREE FORM ******/
278 // } 278 // $scope.create = function() {
279 279 // if ($scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined) {
280 /*****THIS IS FOR STEP THREE FORM ******/ 280 // var x = document.getElementById("snackbar")
281 // $scope.create = function() { 281 // x.className = "show";
282 // if ($scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined) { 282 // setTimeout(function() {
283 // var x = document.getElementById("snackbar") 283 // x.className = x.className.replace("show", "");
284 // x.className = "show"; 284 // }, 3000);
285 // setTimeout(function() { 285 // } else if ($scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined) {
286 // x.className = x.className.replace("show", ""); 286 // $scope.infoForm = true;
287 // }, 3000); 287 // console.log("sdasdasdsa");
288 // } else if ($scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined) { 288 // $scope.data.stage = $scope.data.stage;
289 // $scope.infoForm = true; 289 // $scope.detail = {};
290 // console.log("sdasdasdsa"); 290 // $scope.data.phone = "+91" + $scope.data.number;
291 // $scope.data.stage = $scope.data.stage; 291 // $http({
292 // $scope.detail = {}; 292 // method: 'POST',
293 // $scope.data.phone = "+91" + $scope.data.number; 293 // url: BASE_URL + '/applicants',
294 // $http({ 294 // data: $scope.data,
295 // method: 'POST', 295 // headers: {}
296 // url: BASE_URL + '/applicants', 296 // }).then(function mySuccess(result) {
297 // data: $scope.data, 297
298 // headers: {} 298 // console.log("=====result=====", result)
299 // }).then(function mySuccess(result) { 299 // $scope.detail = result;
300 300 // data.applicantId = result.data.id;
301 // console.log("=====result=====", result) 301 // $scope.userId = result.data.id;
302 // $scope.detail = result; 302 // console.log("=====data=====", data)
303 // data.applicantId = result.data.id; 303 data.amount = $scope.payingAmnt;
304 // $scope.userId = result.data.id; 304 if ($scope.detail != null) {
305 // console.log("=====data=====", data) 305 $http({
306 data.amount = $scope.payingAmnt; 306 method: 'POST',
307 if ($scope.detail != null) { 307 url: BASE_URL + '/payments',
308 $http({ 308 data: data,
309 method: 'POST', 309 headers: {}
310 url: BASE_URL + '/payments', 310 }).then(function mySuccess(paymentResult) {
311 data: data, 311 Analytics.trackEvent('payments', 'click', 'django.mp4');
312 headers: {} 312 console.log("paymentResult",paymentResult)
313 }).then(function mySuccess(paymentResult) { 313 $scope.paymentResult = paymentResult;
314 Analytics.trackEvent('payments', 'click', 'django.mp4'); 314 }, function myError(error) {});
315 console.log("paymentResult",paymentResult) 315 }
316 $scope.paymentResult = paymentResult; 316 var i = 0;
317 }, function myError(error) {}); 317 $scope.payingAmnt = $scope.payingAmnt * 100;
318 } 318 var options = {
319 var i = 0; 319 "key": "rzp_live_mhSE1uOBlXvFyJ",
320 $scope.payingAmnt = $scope.payingAmnt * 100; 320 "amount": $scope.payingAmnt,
321 var options = { 321
322 "key": "rzp_live_mhSE1uOBlXvFyJ", 322 "name": "Startup Jalsa",
323 "amount": $scope.payingAmnt, 323 "description": "amount",
324 324 "currency": "INR",
325 "name": "Startup Jalsa", 325 "status": "done",
326 "description": "amount", 326
327 "currency": "INR", 327 "theme": {
328 "status": "done", 328 "color": "#2196f3 ",
329 329 "image_padding": "NO"
330 "theme": { 330 },
331 "color": "#2196f3 ", 331 "modal": {
332 "image_padding": "NO" 332 "ondismiss": function() {}
333 }, 333 },
334 "modal": { 334 "handler": function(response) {
335 "ondismiss": function() {} 335 createPayment(response);
336 }, 336 }
337 "handler": function(response) { 337 };
338 createPayment(response); 338 var rzp1 = new Razorpay(options);
339 } 339 rzp1.open();
340 }; 340 $scope.paymentResponse = {};
341 var rzp1 = new Razorpay(options); 341
342 rzp1.open(); 342 function createPayment(response) {
343 $scope.paymentResponse = {}; 343 Analytics.trackEvent('payments', 'click', 'django.mp4');
344 344 console.log("response====from===razorpay",response)
345 function createPayment(response) { 345 $route.reload();
346 Analytics.trackEvent('payments', 'click', 'django.mp4'); 346 $scope.paymentResponse.razorPaymentId = response.razorpay_payment_id;
347 console.log("response====from===razorpay",response) 347 $scope.paymentResponse.razorOrderId = $scope.paymentResult.data.razorOrderId;
348 $route.reload(); 348 $scope.paymentResponse.amount = data.amount;
349 $scope.paymentResponse.razorPaymentId = response.razorpay_payment_id; 349 $scope.paymentResponse.currency = "INR";
350 $scope.paymentResponse.razorOrderId = $scope.paymentResult.data.razorOrderId; 350 $scope.paymentResponse.status = $scope.paymentResult.data.status;
351 $scope.paymentResponse.amount = data.amount; 351 $http({
352 $scope.paymentResponse.currency = "INR"; 352 method: 'PUT',
353 $scope.paymentResponse.status = $scope.paymentResult.data.status; 353 url: BASE_URL + '/payments/' + $scope.paymentResult.data.id,
354 $http({ 354 data: $scope.paymentResponse,
355 method: 'PUT', 355 headers: {}
356 url: BASE_URL + '/payments/' + $scope.paymentResult.data.id, 356 }).then(function mySuccess(searchResult) {
357 data: $scope.paymentResponse, 357 Analytics.trackEvent('payments', 'click', 'django.mp4');
358 headers: {} 358 console.log("searchResult", searchResult)
359 }).then(function mySuccess(searchResult) { 359 $location.path("/confirmation")
360 Analytics.trackEvent('payments', 'click', 'django.mp4'); 360 //$scope.showToastr()
361 console.log("searchResult", searchResult) 361 //toaster.success("Registration done successfully");
362 $location.path("/confirmation") 362
363 //$scope.showToastr() 363 }, function myError(error) {});
364 //toaster.success("Registration done successfully"); 364 }
365 365 }, function myError(error) {});
366 }, function myError(error) {}); 366 }
367 } 367
368 368 }
369 }
370 369
371 //}, function myError(error) {}); 370 //}, function myError(error) {});
372 //} 371 //}
373 372
374 //} 373 //}
375 374
376 // $scope.showToastr = function() { 375 // $scope.showToastr = function() {
377 // console.log("called toast") 376 // console.log("called toast")
378 // var x = document.getElementById("snacsskbar") 377 // var x = document.getElementById("snacsskbar")
379 // x.className = "show"; 378 // x.className = "show";
380 // setTimeout(function() { 379 // setTimeout(function() {
381 // x.className = x.className.replace("show", ""); 380 // x.className = x.className.replace("show", "");
382 // }, 3000); 381 // }, 3000);
383 // } 382 // }
384 383
385 /*kk***This code for change data when click to chooses stages***/ 384 /*kk***This code for change data when click to chooses stages***/
386 $scope.proto = true; 385 $scope.proto = true;
387 $scope.businessmodel = true; 386 $scope.businessmodel = true;
388 $scope.Idea = true; 387 $scope.Idea = true;
389 $scope.current = true; 388 $scope.current = true;
390 389
391 $scope.stage = function(stage) { 390 $scope.stage = function(stage) {
392 $scope.stagekeyPress(); 391 $scope.stagekeyPress();
393 console.log("stage--2",stage) 392 console.log("stage--2",stage)
394 if (stage == 'Idea') { 393 if (stage == 'Idea') {
395 $scope.current = 10; 394 $scope.current = 10;
396 $scope.proto = true; 395 $scope.proto = true;
397 $scope.prototyp = false; 396 $scope.prototyp = false;
398 $scope.market = false; 397 $scope.market = false;
399 $scope.risks = false; 398 $scope.risks = false;
400 $scope.team = false; 399 $scope.team = false;
401 $scope.pitch = false; 400 $scope.pitch = false;
402 $scope.financials = false; 401 $scope.financials = false;
403 $scope.businessmodel = true; 402 $scope.businessmodel = true;
404 $scope.data.stage = stage; 403 $scope.data.stage = stage;
405 // for right content 404 // for right content
406 $scope.Idea = true; 405 $scope.Idea = true;
407 $scope.Product = false; 406 $scope.Product = false;
408 $scope.Growth = false; 407 $scope.Growth = false;
409 } else if (stage == 'Product') { 408 } else if (stage == 'Product') {
410 $scope.current = 10; 409 $scope.current = 10;
411 $scope.proto = true; 410 $scope.proto = true;
412 $scope.prototyp = true; 411 $scope.prototyp = true;
413 $scope.market = true; 412 $scope.market = true;
414 $scope.risks = true; 413 $scope.risks = true;
415 $scope.team = true; 414 $scope.team = true;
416 $scope.pitch = true; 415 $scope.pitch = true;
417 $scope.financials = true; 416 $scope.financials = true;
418 $scope.businessmodel = false; 417 $scope.businessmodel = false;
419 $scope.data.stage = stage; 418 $scope.data.stage = stage;
420 // for right content 419 // for right content
421 $scope.Idea = false; 420 $scope.Idea = false;
422 $scope.Product = true; 421 $scope.Product = true;
423 $scope.Growth = false; 422 $scope.Growth = false;
424 } else if (stage == 'Growth') { 423 } else if (stage == 'Growth') {
425 $scope.current = 10; 424 $scope.current = 10;
426 $scope.proto = false; 425 $scope.proto = false;
427 $scope.prototyp = true; 426 $scope.prototyp = true;
428 $scope.market = true; 427 $scope.market = true;
429 $scope.risks = true; 428 $scope.risks = true;
430 $scope.team = true; 429 $scope.team = true;
431 $scope.pitch = true; 430 $scope.pitch = true;
432 $scope.financials = true; 431 $scope.financials = true;
433 $scope.businessmodel = false; 432 $scope.businessmodel = false;
434 // for right content 433 // for right content
435 $scope.Idea = false; 434 $scope.Idea = false;
436 $scope.Product = false; 435 $scope.Product = false;
437 $scope.Growth = true; 436 $scope.Growth = true;
438 $scope.data.stage = stage; 437 $scope.data.stage = stage;
439 } 438 }
440 } 439 }
441 // $scope.enterbusiness = function(business) { 440 // $scope.enterbusiness = function(business) {
442 // console.log("business", business); 441 // console.log("business", business);
443 // if (name == undefined) { 442 // if (name == undefined) {
444 // $scope.current = false; 443 // $scope.current = false;
445 444
446 // } else if (name != undefined) { 445 // } else if (name != undefined) {
447 // $scope.current = true; 446 // $scope.current = true;
448 // } 447 // }
449 // } 448 // }
450 /*******FOR FILL THE DATA AND SHOWS ICON GREEN*/ 449 /*******FOR FILL THE DATA AND SHOWS ICON GREEN*/
451 $scope.stagekeyPress = function() { 450 $scope.stagekeyPress = function() {
452 $('.icon-circle-a').css('background-color', 'rgb(66, 181, 73)'); 451 $('.icon-circle-a').css('background-color', 'rgb(66, 181, 73)');
453 } 452 }
454 $scope.sectorkeyPress = function() { 453 $scope.sectorkeyPress = function() {
455 $('.icon-circle-b').css('background-color', 'rgb(66, 181, 73)'); 454 $('.icon-circle-b').css('background-color', 'rgb(66, 181, 73)');
456 } 455 }
457 456
458 $scope.productLaunchkeyPress = function() { 457 $scope.productLaunchkeyPress = function() {
459 $('.icon-circle-ab').css('background-color', 'rgb(66, 181, 73)'); 458 $('.icon-circle-ab').css('background-color', 'rgb(66, 181, 73)');
460 } 459 }
461 460
462 $scope.launchPeriodkeyPress = function() { 461 $scope.launchPeriodkeyPress = function() {
463 $('.icon-circle-abc').css('background-color', 'rgb(66, 181, 73)'); 462 $('.icon-circle-abc').css('background-color', 'rgb(66, 181, 73)');
464 } 463 }
465 464
466 $scope.industrykeyPress = function() { 465 $scope.industrykeyPress = function() {
467 $scope.addOther = false; 466 $scope.addOther = false;
468 $scope.hideSelectBox = true; 467 $scope.hideSelectBox = true;
469 $('.icon-circle-abcdefg').css('background-color', 'rgb(66, 181, 73)'); 468 $('.icon-circle-abcdefg').css('background-color', 'rgb(66, 181, 73)');
470 var e = document.getElementById("dataIndustry"); 469 var e = document.getElementById("dataIndustry");
471 var dataIndustry = e.options[e.selectedIndex].value; 470 var dataIndustry = e.options[e.selectedIndex].value;
472 if(dataIndustry == "others") { 471 if(dataIndustry == "others") {
473 $scope.addOther = true; 472 $scope.addOther = true;
474 $scope.hideSelectBox = false; 473 $scope.hideSelectBox = false;
475 } 474 }
476 } 475 }
477 476
478 $scope.industryNamekeyPress = function(firstName) { 477 $scope.industryNamekeyPress = function(firstName) {
479 console.log("lastName==", firstName); 478 console.log("lastName==", firstName);
480 if (firstName == undefined) { 479 if (firstName == undefined) {
481 $('.icon-circle-o').css('background-color', 'rgb(102, 102, 102)'); 480 $('.icon-circle-o').css('background-color', 'rgb(102, 102, 102)');
482 } else { 481 } else {
483 $('.icon-circle-o').css('background-color', 'rgb(66, 181, 73)'); 482 $('.icon-circle-o').css('background-color', 'rgb(66, 181, 73)');
484 } 483 }
485 } 484 }
486 485
487 $scope.amountkeyPress = function() { 486 $scope.amountkeyPress = function() {
488 $('.icon-circle-bc').css('background-color', 'rgb(66, 181, 73)'); 487 $('.icon-circle-bc').css('background-color', 'rgb(66, 181, 73)');
489 } 488 }
490 489
491 $scope.firstNamekeyPress = function(firstName) { 490 $scope.firstNamekeyPress = function(firstName) {
492 console.log("lastName==", firstName); 491 console.log("lastName==", firstName);
493 if (firstName == undefined) { 492 if (firstName == undefined) {
494 $('.icon-circle-c').css('background-color', 'rgb(102, 102, 102)'); 493 $('.icon-circle-c').css('background-color', 'rgb(102, 102, 102)');
495 } else { 494 } else {
496 $('.icon-circle-c').css('background-color', 'rgb(66, 181, 73)'); 495 $('.icon-circle-c').css('background-color', 'rgb(66, 181, 73)');
497 } 496 }
498 } 497 }
499 498
500 $scope.emailkeyPress = function(email) { 499 $scope.emailkeyPress = function(email) {
501 console.log("email", email); 500 console.log("email", email);
502 if (email == undefined) { 501 if (email == undefined) {
503 $('.icon-circle-d').css('background-color', 'rgb(102, 102, 102)'); 502 $('.icon-circle-d').css('background-color', 'rgb(102, 102, 102)');
504 } else { 503 } else {
505 $('.icon-circle-d').css('background-color', 'rgb(66, 181, 73)'); 504 $('.icon-circle-d').css('background-color', 'rgb(66, 181, 73)');
506 } 505 }
507 } 506 }
508 507
509 $scope.textCheck = function(){ 508 $scope.textCheck = function(){
510 console.log("Val1:::", $scope.textCheck); 509 console.log("Val1:::", $scope.textCheck);
511 var e = document.getElementById("fundingDiv"); 510 var e = document.getElementById("fundingDiv");
512 var funding = e.options[e.selectedIndex].value; 511 var funding = e.options[e.selectedIndex].value;
513 $scope.Textshow = "no"; 512 $scope.Textshow = "no";
514 if(funding == "yes") { 513 if(funding == "yes") {
515 $scope.Textshow = "yes"; 514 $scope.Textshow = "yes";
516 console.log("Val:::", $scope.Textshow); 515 console.log("Val:::", $scope.Textshow);
517 } 516 }
518 517
519 } 518 }
520 519
521 $scope.productCheck = function(){ 520 $scope.productCheck = function(){
522 console.log("Val2:::", $scope.productCheck); 521 console.log("Val2:::", $scope.productCheck);
523 var e = document.getElementById("productDiv"); 522 var e = document.getElementById("productDiv");
524 var product = e.options[e.selectedIndex].value; 523 var product = e.options[e.selectedIndex].value;
525 $scope.Productshow = "no"; 524 $scope.Productshow = "no";
526 if(product == "yes") { 525 if(product == "yes") {
527 $scope.Productshow = "yes"; 526 $scope.Productshow = "yes";
528 console.log("Val1:::", $scope.Productshow); 527 console.log("Val1:::", $scope.Productshow);
529 } 528 }
530 529
531 } 530 }
532 531
533 $scope.phonekeyPress = function(number) { 532 $scope.phonekeyPress = function(number) {
534 console.log("number", number); 533 console.log("number", number);
535 if (number == undefined || number == '') { 534 if (number == undefined || number == '') {
536 $('.icon-circle-e').css('background-color', 'rgb(102, 102, 102)'); 535 $('.icon-circle-e').css('background-color', 'rgb(102, 102, 102)');
537 } else { 536 } else {
538 $('.icon-circle-e').css('background-color', 'rgb(66, 181, 73)'); 537 $('.icon-circle-e').css('background-color', 'rgb(66, 181, 73)');
539 } 538 }
540 } 539 }
541 540
542 $scope.citykeyPress = function(city) { 541 $scope.citykeyPress = function(city) {
543 console.log("city", city); 542 console.log("city", city);
544 if (city == undefined) { 543 if (city == undefined) {
545 $('.icon-circle-f').css('background-color', 'rgb(102, 102, 102)'); 544 $('.icon-circle-f').css('background-color', 'rgb(102, 102, 102)');
546 } else { 545 } else {
547 $('.icon-circle-f').css('background-color', 'rgb(66, 181, 73)'); 546 $('.icon-circle-f').css('background-color', 'rgb(66, 181, 73)');
548 } 547 }
549 } 548 }
550 549
551 $scope.lastNamekeyPress = function(q) { 550 $scope.lastNamekeyPress = function(q) {
552 if (q == undefined) { 551 if (q == undefined) {
553 $('.icon-circle-x').css('background-color', 'rgb(102, 102, 102)'); 552 $('.icon-circle-x').css('background-color', 'rgb(102, 102, 102)');
554 } else { 553 } else {
555 $('.icon-circle-x').css('background-color', 'rgb(66, 181, 73)'); 554 $('.icon-circle-x').css('background-color', 'rgb(66, 181, 73)');
556 } 555 }
557 } 556 }
558 557
559 $scope.linkedInkeyPress = function(technology) { 558 $scope.linkedInkeyPress = function(technology) {
560 if (technology == undefined || technology == '') { 559 if (technology == undefined || technology == '') {
561 $('.icon-circle-h').css('background-color', 'rgb(102, 102, 102)'); 560 $('.icon-circle-h').css('background-color', 'rgb(102, 102, 102)');
562 } else { 561 } else {
563 $('.icon-circle-h').css('background-color', 'rgb(66, 181, 73)'); 562 $('.icon-circle-h').css('background-color', 'rgb(66, 181, 73)');
564 } 563 }
565 } 564 }
566 $scope.companykeyPress = function(problem) { 565 $scope.companykeyPress = function(problem) {
567 if (problem == undefined) { 566 if (problem == undefined) {
568 $('.icon-circle-i').css('background-color', 'rgb(102, 102, 102)'); 567 $('.icon-circle-i').css('background-color', 'rgb(102, 102, 102)');
569 } else { 568 } else {
570 $('.icon-circle-i').css('background-color', 'rgb(66, 181, 73)'); 569 $('.icon-circle-i').css('background-color', 'rgb(66, 181, 73)');
571 } 570 }
572 } 571 }
573 $scope.productNamekeyPress = function(solution) { 572 $scope.productNamekeyPress = function(solution) {
574 if (solution == undefined) { 573 if (solution == undefined) {
575 $('.icon-circle-j').css('background-color', 'rgb(102, 102, 102)'); 574 $('.icon-circle-j').css('background-color', 'rgb(102, 102, 102)');
576 } else { 575 } else {
577 $('.icon-circle-j').css('background-color', 'rgb(66, 181, 73)'); 576 $('.icon-circle-j').css('background-color', 'rgb(66, 181, 73)');
578 } 577 }
579 } 578 }
580 $scope.businesskeyPress = function(business) { 579 $scope.businesskeyPress = function(business) {
581 $('.icon-circle-p').css('background-color', 'rgb(66, 181, 73)'); 580 $('.icon-circle-p').css('background-color', 'rgb(66, 181, 73)');
582 } 581 }
583 582
584 $scope.websitekeyPress = function(prototype) { 583 $scope.websitekeyPress = function(prototype) {
585 if (prototype == undefined || prototype == '') { 584 if (prototype == undefined || prototype == '') {
586 $('.icon-circle-k').css('background-color', 'rgb(102, 102, 102)'); 585 $('.icon-circle-k').css('background-color', 'rgb(102, 102, 102)');
587 } else { 586 } else {
588 $('.icon-circle-k').css('background-color', 'rgb(66, 181, 73)'); 587 $('.icon-circle-k').css('background-color', 'rgb(66, 181, 73)');
589 } 588 }
590 } 589 }
591 590
592 $scope.employeekeyPress = function(market) { 591 $scope.employeekeyPress = function(market) {
593 if (market == undefined || market == '') { 592 if (market == undefined || market == '') {
594 $('.icon-circle-l').css('background-color', 'rgb(102, 102, 102)'); 593 $('.icon-circle-l').css('background-color', 'rgb(102, 102, 102)');
595 } else { 594 } else {
596 $('.icon-circle-l').css('background-color', 'rgb(66, 181, 73)'); 595 $('.icon-circle-l').css('background-color', 'rgb(66, 181, 73)');
597 } 596 }
598 } 597 }
599 598
600 $scope.annualkeyPress = function(risk) { 599 $scope.annualkeyPress = function(risk) {
601 if (risk == undefined || risk == '') { 600 if (risk == undefined || risk == '') {
602 $('.icon-circle-m').css('background-color', 'rgb(102, 102, 102)'); 601 $('.icon-circle-m').css('background-color', 'rgb(102, 102, 102)');
603 } else { 602 } else {
604 $('.icon-circle-m').css('background-color', 'rgb(66, 181, 73)'); 603 $('.icon-circle-m').css('background-color', 'rgb(66, 181, 73)');
605 } 604 }
606 } 605 }
607 606
608 $scope.revenuekeyPress = function(team) { 607 $scope.revenuekeyPress = function(team) {
609 if (team == undefined || team == '') { 608 if (team == undefined || team == '') {
610 $('.icon-circle-n').css('background-color', 'rgb(102, 102, 102)'); 609 $('.icon-circle-n').css('background-color', 'rgb(102, 102, 102)');
611 } else { 610 } else {
612 $('.icon-circle-n').css('background-color', 'rgb(66, 181, 73)'); 611 $('.icon-circle-n').css('background-color', 'rgb(66, 181, 73)');
613 } 612 }
614 } 613 }
615 614
616 $scope.descriptionkeyPress = function(pitch) { 615 $scope.descriptionkeyPress = function(pitch) {
617 if (pitch == undefined) { 616 if (pitch == undefined) {
618 $('.icon-circle-z').css('background-color', 'rgb(102, 102, 102)'); 617 $('.icon-circle-z').css('background-color', 'rgb(102, 102, 102)');
619 } else { 618 } else {
620 $('.icon-circle-z').css('background-color', 'rgb(66, 181, 73)'); 619 $('.icon-circle-z').css('background-color', 'rgb(66, 181, 73)');
621 } 620 }
622 } 621 }
623 622
624 $scope.ideakeyPress = function(financial) { 623 $scope.ideakeyPress = function(financial) {
625 console.log("financial", financial); 624 console.log("financial", financial);
626 if (financial == undefined) { 625 if (financial == undefined) {
627 $('.icon-circle-q').css('background-color', 'rgb(102, 102, 102)'); 626 $('.icon-circle-q').css('background-color', 'rgb(102, 102, 102)');
628 } else { 627 } else {
629 $('.icon-circle-q').css('background-color', 'rgb(66, 181, 73)'); 628 $('.icon-circle-q').css('background-color', 'rgb(66, 181, 73)');
630 } 629 }
631 } 630 }
632 631
633 $scope.fundkeyPress = function(financial) { 632 $scope.fundkeyPress = function(financial) {
634 console.log("financial", financial); 633 console.log("financial", financial);
635 if (financial == undefined) { 634 if (financial == undefined) {
636 $('.icon-circle-y').css('background-color', 'rgb(102, 102, 102)'); 635 $('.icon-circle-y').css('background-color', 'rgb(102, 102, 102)');
637 } else { 636 } else {
638 $('.icon-circle-y').css('background-color', 'rgb(66, 181, 73)'); 637 $('.icon-circle-y').css('background-color', 'rgb(66, 181, 73)');
639 } 638 }
640 } 639 }
641 640
642 $scope.changeReferalIconColor = function(referalToken){ 641 $scope.changeReferalIconColor = function(referalToken){
643 if (referalToken == undefined || referalToken == '') { 642 if (referalToken == undefined || referalToken == '') {
644 $('.referel-icon').css('background-color', 'rgb(102, 102, 102)'); 643 $('.referel-icon').css('background-color', 'rgb(102, 102, 102)');
645 }else { 644 }else {
646 $('.referel-icon').css('background-color', 'rgb(66, 181, 73)'); 645 $('.referel-icon').css('background-color', 'rgb(66, 181, 73)');
647 } 646 }
648 } 647 }
649 648
650 }); 649 });
651 650
652 scotchApp.controller('verifyController', function($scope, $http, $location, $route,BASE_URL) { 651 scotchApp.controller('verifyController', function($scope, $http, $location, $route,BASE_URL) {
653 $scope.pendingPaymentId = $route.current.params.id 652 $scope.pendingPaymentId = $route.current.params.id
654 $http({ 653 $http({
655 method: "GET", 654 method: "GET",
656 url: BASE_URL + '/applicants/' + $scope.pendingPaymentId, 655 url: BASE_URL + '/applicants/' + $scope.pendingPaymentId,
657 }).then(function mySuccess(response) { 656 }).then(function mySuccess(response) {
658 $scope.data = response.data; 657 $scope.data = response.data;
659 console.log("response-1", response); 658 console.log("response-1", response);
660 $scope.pendingPaymentId = $route.current.params.id; 659 $scope.pendingPaymentId = $route.current.params.id;
661 660
662 $http({ 661 $http({
663 method: "GET", 662 method: "GET",
664 url: BASE_URL + '/payments?filter={"where":{"applicantId":' + $scope.pendingPaymentId + '}}', 663 url: BASE_URL + '/payments?filter={"where":{"applicantId":' + $scope.pendingPaymentId + '}}',
665 }).then(function mySuccess(response) { 664 }).then(function mySuccess(response) {
666 $scope.paymentRecord = response.data; 665 $scope.paymentRecord = response.data;
667 }, function myError(response) { 666 }, function myError(response) {
668 }); 667 });
669 }, function myError(response) { 668 }, function myError(response) {
670 $scope.myWelcome = response.statusText; 669 $scope.myWelcome = response.statusText;
671 }); 670 });
672 671
673 $scope.checkView = false; 672 $scope.checkView = false;
674 $scope.verifyView = false; 673 $scope.verifyView = false;
675 674
676 $scope.pendingPaymentId = ''; 675 $scope.pendingPaymentId = '';
677 676
678 $scope.update = function() { 677 $scope.update = function() {
679 678
680 $http({ 679 $http({
681 method: 'GET', 680 method: 'GET',
682 url: BASE_URL + '/payments?filter={"where":{"applicantId": ' + $scope.pendingPaymentId + '}}', 681 url: BASE_URL + '/payments?filter={"where":{"applicantId": ' + $scope.pendingPaymentId + '}}',
683 headers: {} 682 headers: {}
684 }).then(function mySuccess(searchResult) { 683 }).then(function mySuccess(searchResult) {
685 if (searchResult.data[0].status == "created") { 684 if (searchResult.data[0].status == "created") {
686 $scope.checkView = true; 685 $scope.checkView = true;
687 $scope.verifyView = false; 686 $scope.verifyView = false;
688 $scope.amount = searchResult.data[0].amount; 687 $scope.amount = searchResult.data[0].amount;
689 $scope.searchResult = searchResult.data[0]; 688 $scope.searchResult = searchResult.data[0];
690 console.log('====searchResult===', searchResult); 689 console.log('====searchResult===', searchResult);
691 console.log("searchResult=====",searchResult.data[0].razorOrderId) 690 console.log("searchResult=====",searchResult.data[0].razorOrderId)
692 var i = 0; 691 var i = 0;
693 $scope.amount = $scope.amount * 100; 692 $scope.amount = $scope.amount * 100;
694 var options = { 693 var options = {
695 "key": "rzp_live_mhSE1uOBlXvFyJ", 694 "key": "rzp_live_mhSE1uOBlXvFyJ",
696 //"key" : "rzp_test_YwHsVFiDIQ2WUQ", 695 //"key" : "rzp_test_YwHsVFiDIQ2WUQ",
697 "amount": $scope.amount, 696 "amount": $scope.amount,
698 697
699 "name": "Startup Jalsa", 698 "name": "Startup Jalsa",
700 "description": "amount", 699 "description": "amount",
701 "currency": "INR", 700 "currency": "INR",
702 "status": "done", 701 "status": "done",
703 702
704 "theme": { 703 "theme": {
705 "color": "#2196f3 ", 704 "color": "#2196f3 ",
706 "image_padding": "NO" 705 "image_padding": "NO"
707 }, 706 },
708 "modal": { 707 "modal": {
709 "ondismiss": function() {} 708 "ondismiss": function() {}
710 }, 709 },
711 "handler": function(response) { 710 "handler": function(response) {
712 createPayment(response); 711 createPayment(response);
713 } 712 }
714 }; 713 };
715 var rzp1 = new Razorpay(options); 714 var rzp1 = new Razorpay(options);
716 rzp1.open(); 715 rzp1.open();
717 $scope.paymentResponse = {}; 716 $scope.paymentResponse = {};
718 function createPayment(response) { 717 function createPayment(response) {
719 $scope.amount = $scope.amount / 100; 718 $scope.amount = $scope.amount / 100;
720 console.log("response======retepaymen",response); 719 console.log("response======retepaymen",response);
721 $scope.paymentResponse.razorPaymentId = response.razorpay_payment_id; 720 $scope.paymentResponse.razorPaymentId = response.razorpay_payment_id;
722 $scope.paymentResponse.razorOrderId = $scope.searchResult.razorOrderId; 721 $scope.paymentResponse.razorOrderId = $scope.searchResult.razorOrderId;
723 $scope.paymentResponse.amount = $scope.amount; 722 $scope.paymentResponse.amount = $scope.amount;
724 $scope.paymentResponse.currency = $scope.searchResult.currency; 723 $scope.paymentResponse.currency = $scope.searchResult.currency;
725 $scope.paymentResponse.status = $scope.searchResult.status; 724 $scope.paymentResponse.status = $scope.searchResult.status;
726 $scope.paymentResponse.applicantId = $scope.searchResult.applicantId; 725 $scope.paymentResponse.applicantId = $scope.searchResult.applicantId;
727 console.log("$scope.paymentResponse", $scope.paymentResponse) 726 console.log("$scope.paymentResponse", $scope.paymentResponse)
728 $http({ 727 $http({
729 method: 'PUT', 728 method: 'PUT',
730 url: BASE_URL + '/payments/' + $scope.searchResult.id, 729 url: BASE_URL + '/payments/' + $scope.searchResult.id,
731 data: $scope.paymentResponse, 730 data: $scope.paymentResponse,
732 headers: {} 731 headers: {}
733 }).then(function mySuccess(searchResult) { 732 }).then(function mySuccess(searchResult) {
734 console.log("finalsearchResult",searchResult) 733 console.log("finalsearchResult",searchResult)
735 $location.path("/confirmation") 734 $location.path("/confirmation")
736 }, function myError(error) { 735 }, function myError(error) {
737 736
738 }); 737 });
739 } 738 }
740 } else { 739 } else {
741 740
742 } 741 }
743 742
744 }, function myError(error) {}); 743 }, function myError(error) {});
745 } 744 }
746 }); 745 });
747 746
748 scotchApp.controller('ambassadorController', function($scope, $http, $location, $route,BASE_URL) { 747 scotchApp.controller('ambassadorController', function($scope, $http, $location, $route,BASE_URL) {
749 $scope.data = {}; 748 $scope.data = {};
750 $scope.check = false; 749 $scope.check = false;
751 $scope.numberCheck = false; 750 $scope.numberCheck = false;
752 751
753 /*open videos in modal*/ 752 /*open videos in modal*/
754 $scope.openyoutube16 = function(){ 753 $scope.openyoutube16 = function(){
755 $('#videoModel').modal('show'); 754 $('#videoModel').modal('show');
756 } 755 }
757 756
758 $scope.openyoutube17 = function(){ 757 $scope.openyoutube17 = function(){
759 $('#videoModels').modal('show'); 758 $('#videoModels').modal('show');
760 } 759 }
761 760
762 $scope.closeModal = function(){ 761 $scope.closeModal = function(){
763 var url = $('#youtubePlayer').attr('src'); 762 var url = $('#youtubePlayer').attr('src');
764 $('#youtubePlayer').attr('src', ''); 763 $('#youtubePlayer').attr('src', '');
765 $('#youtubePlayer').attr('src', url); 764 $('#youtubePlayer').attr('src', url);
766 } 765 }
767 /*open videos ends here*/ 766 /*open videos ends here*/
768 767
769 $scope.removeError = function() { 768 $scope.removeError = function() {
770 $('#invalidEmail').css('display', 'none'); 769 $('#invalidEmail').css('display', 'none');
771 $('#alreadyExist').css('display', 'none'); 770 $('#alreadyExist').css('display', 'none');
772 }; 771 };
773 772
774 $scope.emailcheck = function(val) { 773 $scope.emailcheck = function(val) {
775 if (val == undefined) { 774 if (val == undefined) {
776 $('#invalidEmail').css('display', 'block'); 775 $('#invalidEmail').css('display', 'block');
777 } else { 776 } else {
778 $http({ 777 $http({
779 method: 'GET', 778 method: 'GET',
780 url: BASE_URL + '/ambassadors?filter={"where": {"email": {"like":"%25' + $scope.data.email + '%25"}}}', 779 url: BASE_URL + '/ambassadors?filter={"where": {"email": {"like":"%25' + $scope.data.email + '%25"}}}',
781 headers: {} 780 headers: {}
782 }).then(function mySuccess(searchResult) { 781 }).then(function mySuccess(searchResult) {
783 console.log("searchResult1===>", searchResult) 782 console.log("searchResult1===>", searchResult)
784 if (searchResult.data.length == 0) { 783 if (searchResult.data.length == 0) {
785 $scope.check = false; 784 $scope.check = false;
786 } else { 785 } else {
787 $scope.check = true; 786 $scope.check = true;
788 $('#alreadyExist').css('display', 'block'); 787 $('#alreadyExist').css('display', 'block');
789 } 788 }
790 }, function myError(error) {}); 789 }, function myError(error) {});
791 } 790 }
792 }; 791 };
793 792
794 $scope.removeNoError = function() { 793 $scope.removeNoError = function() {
795 $('#invalidNumber').css('display', 'none'); 794 $('#invalidNumber').css('display', 'none');
796 $('#noExist').css('display', 'none'); 795 $('#noExist').css('display', 'none');
797 }; 796 };
798 797
799 $scope.numbercheck = function(number) { 798 $scope.numbercheck = function(number) {
800 // if (val == undefined) { 799 // if (val == undefined) {
801 // $('#invalidNumber').css('display', 'block'); 800 // $('#invalidNumber').css('display', 'block');
802 // } else { 801 // } else {
803 $http({ 802 $http({
804 method: 'GET', 803 method: 'GET',
805 url: BASE_URL + '/ambassadors?filter={"where": {"mobile": {"like":"%25' + number + '%25"}}}', 804 url: BASE_URL + '/ambassadors?filter={"where": {"mobile": {"like":"%25' + number + '%25"}}}',
806 data: $scope.data, 805 data: $scope.data,
807 headers: {} 806 headers: {}
808 }).then(function mySuccess(searchResult) { 807 }).then(function mySuccess(searchResult) {
809 console.log("searchResult===>", searchResult) 808 console.log("searchResult===>", searchResult)
810 if (searchResult.data.length == 0) { 809 if (searchResult.data.length == 0) {
811 $scope.numberCheck = false; 810 $scope.numberCheck = false;
812 } else { 811 } else {
813 $scope.numberCheck = true; 812 $scope.numberCheck = true;
814 $('#noExist').css('display', 'block'); 813 $('#noExist').css('display', 'block');
815 } 814 }
816 }, function myError(error) {}); 815 }, function myError(error) {});
817 //} 816 //}
818 817
819 }; 818 };
820 819
821 $scope.submit = function() { 820 $scope.submit = function() {
822 console.log($scope.data.name) 821 console.log($scope.data.name)
823 var randomNumber = ""+Math.random(); 822 var randomNumber = ""+Math.random();
824 var nameSpliced = $scope.data.name.slice(0,3); 823 var nameSpliced = $scope.data.name.slice(0,3);
825 var numberSpliced = randomNumber.slice(2,5); 824 var numberSpliced = randomNumber.slice(2,5);
826 $scope.data.referalToken = nameSpliced+numberSpliced; 825 $scope.data.referalToken = nameSpliced+numberSpliced;
827 $scope.data.referalToken = $scope.data.referalToken.toUpperCase(); 826 $scope.data.referalToken = $scope.data.referalToken.toUpperCase();
828 827
829 $http({ 828 $http({
830 method: 'POST', 829 method: 'POST',
831 url: BASE_URL + '/ambassadors', 830 url: BASE_URL + '/ambassadors',
832 data: $scope.data, 831 data: $scope.data,
833 headers: {} 832 headers: {}
834 }).then(function mySuccess(result) { 833 }).then(function mySuccess(result) {
835 console.log("result", result) 834 console.log("result", result)
836 $scope.detail = result; 835 $scope.detail = result;
837 $('#myModal').modal('show'); 836 $('#myModal').modal('show');
838 $scope.data.name = ''; 837 $scope.data.name = '';
839 $scope.data.email = ''; 838 $scope.data.email = '';
840 $scope.data.mobile = ''; 839 $scope.data.mobile = '';
841 840
842 }, function myError(error) { 841 }, function myError(error) {
843 console.log(error) 842 console.log(error)
844 console.log(error.data.error.message) 843 console.log(error.data.error.message)
845 }); 844 });
846 console.log($scope.data) 845 console.log($scope.data)
847 } 846 }
848 }); 847 });
849 848
850 849