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