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