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