pyc-website
main website for pyc inc.
git clone https://9o.is/git/pyc-website.git
PhoneVerification.js
(1473B)
1 angular.module("PhoneVerification", ['Forms', 'ngAlert', 'mgo-angular-wizard'])
2
3 .controller('PhoneVerificationAlert', ['$scope', '$controller', function($scope, $controller) {
4 $controller('AlertCtrl', {$scope: $scope});
5
6 $scope.$on('alertPhoneVerification', function(event, alert) {
7 $scope.addAlert(alert);
8 });
9 }])
10
11 .controller('PhoneVerificationCtrl', ['$scope', '$controller', '$rootScope', 'WizardHandler', function($scope, $controller, $rootScope, WizardHandler) {
12 $controller('AutoUpdateFormCtrl', {$scope: $scope, $controller: $controller, $rootScope: $rootScope});
13 $scope.init('PhoneVerification', 'init');
14
15 $scope.sentsms = false;
16
17 $scope.sendsms = function() {
18 var success = function() {
19 $scope.sentsms = true;
20 $rootScope.$broadcast('alertPhoneVerification', {
21 msg_type: "success",
22 msg: "SMS Private Code has been sent. Input the private code to verify.",
23 timeout: 4000
24 });
25 };
26
27 var failure = function(alert) {
28 $rootScope.$broadcast('alertPhoneVerification', alert);
29 };
30
31 $scope.submit('PhoneVerification', 'sendsms', success, failure);
32 };
33
34 $scope.verifyphone = function () {
35 var success = function(data) {
36 $rootScope.purchaseLimit = data.data.purchaseLimit;
37 WizardHandler.wizard().next();
38 };
39
40 var failure = function(alert) {
41 $rootScope.$broadcast('alertPhoneVerification', alert);
42 };
43
44 $scope.submit('PhoneVerification', 'verifyphone', success, failure);
45 };
46 }]);