diff --git a/Source/App/Client/Client.zip b/Source/App/Client/Client.zip deleted file mode 100644 index 2301e14..0000000 Binary files a/Source/App/Client/Client.zip and /dev/null differ diff --git a/Source/App/Client/app/scripts/auth/auth.controller.js b/Source/App/Client/app/scripts/auth/auth.controller.js index bf9da57..8da47de 100644 --- a/Source/App/Client/app/scripts/auth/auth.controller.js +++ b/Source/App/Client/app/scripts/auth/auth.controller.js @@ -1,7 +1,7 @@ angular.module("dentalApp") .controller("LoginController", [ - "$rootScope", "$scope", "$state", "AuthService", "LocalDataStorageService", "AppService", "AlertService", - function ($rootScope, $scope, $state, authService, localDataStorageService, appService, alertService) { + "$rootScope", "$scope", "$state", "AuthService", "AppService", "toaster", + function ($rootScope, $scope, $state, authService, appService, toaster) { "use strict"; $scope.credentials = { Username: "", Password: "", grant_type: "password" }; @@ -25,6 +25,8 @@ var successCallback = function(response) { console.log(response); + toaster.pop("success", "Successfully sign in...") + var success = function(response) { console.log(response); changeRoute(true); @@ -37,7 +39,8 @@ }; var errorCallback = function(error) { console.log(error); - alertService.showAlert(alertService.alertType.danger, "Login Faield! invalid USERNAME or PASSWORD detected!", true); + //alertService.showAlert(alertService.alertType.danger, "Login Faield! invalid USERNAME or PASSWORD detected!", true); + toaster.pop("error", "Failed to signin! Please tray again.") changeRoute(false); }; $scope.promise = authService.authenticate($scope.credentials).then(successCallback, errorCallback); @@ -68,8 +71,8 @@ angular.module("dentalApp") angular.module("dentalApp") .controller("ProfileController", [ - "$scope", "UrlService", "LocalDataStorageService", "HttpService", "AlertService", "AuthService", - function ($scope, urlService, localDataStorageService, httpService, alertService, authService) { + "$scope", "UrlService", "LocalDataStorageService", "$rootScope", "$state", "HttpService", "AuthService", "toaster", + function ($scope, urlService, localDataStorageService, $rootScope, $state, httpService, authService, toaster) { var init = function () { $scope.model = []; @@ -91,13 +94,19 @@ angular.module("dentalApp") $scope.updateProfile = function() { var success = function(data) { console.log(data); - if (data.Result.Succeeded) alertService.showAlert(alertService.alertType.success, "Success", false); - else alertService.showAlert(alertService.alertType.danger, "Failed! Please try agian", true); + if (data.Result.Succeeded) { + //alertService.showAlert(alertService.alertType.success, "Success", false); + toaster.pop("success", "Profile update successfully"); + } + else { + //alertService.showAlert(alertService.alertType.danger, "Failed! Please try agian", true); + toaster.pop("error", "Failed to update profile! Please try again."); + } $scope.loadProfile(); }; var error = function(error) { console.log(error); - alert("User Profile Update Faield!"); + toaster.pop("error","User Profile Update Faield!"); }; $scope.promise = httpService.add(urlService.ProfileUrl + "/UpdateProfile", $scope.model).then(success, error); }; @@ -111,17 +120,32 @@ angular.module("dentalApp") var success = function(data) { console.log(data); - if (data) alertService.showAlert(alertService.alertType.success, "Success", false); - else alertService.showAlert(alertService.alertType.danger, "Failed! Please try agian", true); - $scope.loadProfile(); + if (data) { + //alertService.showAlert(alertService.alertType.success, "Success", false); + toaster.pop("success", "Password changed successfully"); + + $scope.logout(); + } + else { + //alertService.showAlert(alertService.alertType.danger, "Failed! Please try agian", true); + toaster.pop("error", "Failed to change password! Please tray again."); + } + //$scope.loadProfile(); }; var error = function(error) { console.log(error); - alertService.showAlert(alertService.alertType.danger, "Failed! Please try agian", true); + //alertService.showAlert(alertService.alertType.danger, "Failed! Please try agian", true); + toaster.pop("error", "Failed to change password! Please tray again."); }; $scope.promise = httpService.add(urlService.ProfileUrl + "/UpdatePassword", requestModel).then(success, error); }; + $scope.logout = function () { + + localDataStorageService.logout(); + $rootScope.$broadcast('loggedOut'); + $state.go("root.login", {}, { reload: true }); + } init(); } diff --git a/Source/App/Client/app/scripts/patient/patient.controller.js b/Source/App/Client/app/scripts/patient/patient.controller.js index 5bf6f1f..1f2016a 100644 --- a/Source/App/Client/app/scripts/patient/patient.controller.js +++ b/Source/App/Client/app/scripts/patient/patient.controller.js @@ -33,13 +33,15 @@ if ($scope.key === undefined) { $scope.loadPatientGridData(); } else { - var request = { SearchKey: $scope.key, FilterId: $scope.filterId }; - $http.get(urlService.PatientUrl + "/Search", { params: { request: request } }).then(function(response) { - console.log(response); - $scope.myData = response.data; - }, function(error) { - console.log(error); - }); + if ($scope.key.length > 2) { + var request = { SearchKey: $scope.key, FilterId: $scope.filterId }; + $http.get(urlService.PatientUrl + "/Search", { params: { request: request } }).then(function (response) { + console.log(response); + $scope.myData = response.data; + }, function (error) { + console.log(error); + }); + } } }; @@ -53,6 +55,7 @@ { field: "Name", displayName: "Patient Name" }, { field: "Phone", displayName: "Phone" }, { field: "Age", displayName: "Age" }, + { field: "Gender", displayName: "Gender" }, { field: "LastVisitingDate", displayName: "Last Visiting Date", cellTemplate: "
" diff --git a/Source/App/Client/app/views/auth/profile.tpl.html b/Source/App/Client/app/views/auth/profile.tpl.html index 314106a..3e4df54 100644 --- a/Source/App/Client/app/views/auth/profile.tpl.html +++ b/Source/App/Client/app/views/auth/profile.tpl.html @@ -1,7 +1,7 @@