diff --git a/app/index.html b/app/index.html index 65b3c2e..24e5dc2 100644 --- a/app/index.html +++ b/app/index.html @@ -176,6 +176,8 @@ + + diff --git a/app/indexios.html b/app/indexios.html index 1959171..c9c9ec2 100644 --- a/app/indexios.html +++ b/app/indexios.html @@ -181,6 +181,8 @@ + + diff --git a/app/scripts/controllers/accountInfoController.js b/app/scripts/controllers/accountInfoController.js index 4792d82..10d1ae2 100644 --- a/app/scripts/controllers/accountInfoController.js +++ b/app/scripts/controllers/accountInfoController.js @@ -1,10 +1,24 @@ App.controller('accountinfoController', ['$scope', 'RESTService', '$rootScope', '$timeout', 'Organization', 'AUTH_EVENTS', 'Session', 'Directory', '$location', function($scope, RESTService, $rootScope, $timeout, Organization, AUTH_EVENTS, Session, Directory, $location){ $scope.session = Session; $scope.updatedInfo = false; - $scope.item = Session.me; - $scope.checkAlumni = Session.perms == 'alumni'; - if ($scope.item.dob){ - $scope.item.dob = moment($scope.item.dob).format('MM/DD/YYYY'); + initialize(); + $scope.checkAlumni = Session.perms === 'alumni'; + + function initialize(){ + var me = JSON.parse(JSON.stringify(Session.me)); + if(me.dob){ + me.dob = moment(me.dob).format('MM/DD/YYYY'); + } + if(me.phone){ + me.phone = me.phone.replace(/[^0-9.]/g, ''); + if (me.phone.length === 10){ + me.phone = me.phone.slice(0, 3) + '-' + me.phone.slice(3, 6) + '-' + me.phone.slice(6, 10); + } + else{ + me.phone = ""; + } + } + $scope.item = me; } $scope.changePassword = function(old_pass, new_pass) { @@ -34,20 +48,24 @@ App.controller('accountinfoController', ['$scope', 'RESTService', '$rootScope', $location.path('app/directory/'+Session.user_name); } - $scope.checkAlumni = function(){ + $scope.checkAlumni = function() { return Session.perms != 'alumni'; } $scope.updateAccount = function(isValid){ - console.log(isValid); + debugger; + var to_send = JSON.parse(JSON.stringify($scope.item)); + to_send.phone = to_send.phone.replace(/[^0-9.]/g, ''); + if(isValid){ - RESTService.post(ENDPOINTS_DOMAIN + '/_ah/api/netegreek/v1/user/update_user_directory_info', $scope.item) + RESTService.post(ENDPOINTS_DOMAIN + '/_ah/api/netegreek/v1/user/update_user_directory_info', to_send) .success(function(data){ if (!RESTService.hasErrors(data)) { $scope.updatedInfo = true; - Directory.updateMe($scope.item); + Directory.updateMe(to_send); + Session.updateMe(to_send); } else { diff --git a/app/scripts/controllers/calendarController.js b/app/scripts/controllers/calendarController.js index 51ecdfd..5cff31c 100644 --- a/app/scripts/controllers/calendarController.js +++ b/app/scripts/controllers/calendarController.js @@ -82,8 +82,9 @@ App.controller('calendarController', ['Session', '$scope', 'RESTService', '$root } }; - $scope.goToEvent = function(event) { - $location.path('app/events/' + event); + $scope.goToEvent = function(key) { + $location.path('app/events/' + key); + }; $scope.$watch('search', function() { diff --git a/app/scripts/controllers/memberProfileController.js b/app/scripts/controllers/memberProfileController.js index 6ddb47a..557dd9e 100644 --- a/app/scripts/controllers/memberProfileController.js +++ b/app/scripts/controllers/memberProfileController.js @@ -154,7 +154,7 @@ App.controller('memberprofileController', ['$scope', '$rootScope', '$stateParams $scope.lastName = $scope.member.last_name; $scope.email = $scope.member.email; $scope.birthday = $scope.member.dob; - $scope.phone = $scope.member.phone; + $scope.phone = $scope.member.phone.replace(/[^0-9.]/g, ''); $scope.currentAddress = $scope.member.address + " " + $scope.member.city + " " + $scope.member.state + " " + $scope.member.zip; $scope.position = $scope.member.position; $scope.permanentAddress = $scope.member.perm_address + " " + $scope.member.perm_city + " " + $scope.member.perm_state + " " + $scope.member.perm_zip; diff --git a/app/scripts/filters/phoneNumberFilter.js b/app/scripts/filters/phoneNumberFilter.js new file mode 100644 index 0000000..518bfaa --- /dev/null +++ b/app/scripts/filters/phoneNumberFilter.js @@ -0,0 +1,13 @@ +App.filter('phoneNumber', function() { + return function(number) { + if (number){ + if (number.length === 10) { + return number.slice(0, 3) + '-' + number.slice(3, 6) + '-' + number.slice(6, 10); + } + else{ + return number; + } + } + return number; + }; +}); \ No newline at end of file diff --git a/app/scripts/ios/pushNotificationConfig.js b/app/scripts/ios/pushNotificationConfig.js index eb6c3ff..b0d648b 100644 --- a/app/scripts/ios/pushNotificationConfig.js +++ b/app/scripts/ios/pushNotificationConfig.js @@ -36,4 +36,23 @@ angular.module("App").run(function($rootScope, AUTH_EVENTS) { alert('error = ' + error); } }); + + // $rootScope.$on('sendSMS', function(event, data){ + // var parsed = JSON.parse(data); + // var number = parsed.number; + + // //CONFIGURATION + // var options = { + // replaceLineBreaks: false, // true to replace \n by a new line, false by default + // android: { + // intent: 'INTENT' // send SMS with the native android SMS messaging + // //intent: '' // send SMS without open any other app + // } + // }; + + // var success = function () { alert('Message sent successfully'); }; + // var error = function (e) { alert('Message Failed:' + e); }; + // sms.send(number, message, options, success, error); + // } + // }); }); \ No newline at end of file diff --git a/app/views/accountinfo.html b/app/views/accountinfo.html index 5d347e8..cae60bb 100644 --- a/app/views/accountinfo.html +++ b/app/views/accountinfo.html @@ -62,7 +62,7 @@
Please select a valid phone number.