Skip to content

Commit

Permalink
patient filter by phone number implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
sabbiryan committed Sep 3, 2023
1 parent 9c0204e commit e381b67
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 24 deletions.
Binary file removed Source/App/Client/Client.zip
Binary file not shown.
48 changes: 36 additions & 12 deletions Source/App/Client/app/scripts/auth/auth.controller.js
Original file line number Diff line number Diff line change
@@ -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" };
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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 = [];
Expand All @@ -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);
};
Expand All @@ -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();
}
Expand Down
17 changes: 10 additions & 7 deletions Source/App/Client/app/scripts/patient/patient.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}
}
};

Expand All @@ -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: "<div style=\"padding-left: 5px\" ng-bind=\"row.getProperty(col.field) | date: 'dd MMMM yyyy'\"></div>"
Expand Down
9 changes: 5 additions & 4 deletions Source/App/Client/app/views/auth/profile.tpl.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="row">

<div>
<button ui-sref="root.dashboard" class="btn btn-link" data-toggle="tooltip" data-placement="right" title="Back"><span class="glyphicon glyphicon-arrow-left"></span></button>
<button ui-sref="root.patient" class="btn btn-link" data-toggle="tooltip" data-placement="right" title="Back"><span class="glyphicon glyphicon-arrow-left"></span></button>
</div>

<div class="col col-xs-12 col-sm-6 col-md-6 col-lg-6">
Expand Down Expand Up @@ -50,7 +50,8 @@ <h3 class="panel-title">User Profile</h3>
<div class="form-group">
<label class="control-label col col-xs-12 col-sm-4 col-md-4 col-lg-4">&nbsp;</label>
<div class="col col-xs-12 col-sm-8 col-md-8 col-lg-8">
<button type="submit" class="btn btn-floating btn-info">Update</button>
<button ng-if="!isDemoUser" type="submit" class="btn btn-floating btn-info">Update</button>
<span ng-if="isDemoUser" class="text-warning">Demo user are unauthorize to use this feature</span>
</div>
</div>
</form>
Expand Down Expand Up @@ -91,8 +92,8 @@ <h3 class="panel-title">Change Password</h3>
<div class="form-group">
<label class="control-label col col-xs-12 col-sm-4 col-md-4 col-lg-4">&nbsp;</label>
<div class="col col-xs-12 col-sm-8 col-md-8 col-lg-8">
<button ng-disabled="isDemoUser" type="submit" class="btn btn-floating btn-info">Update Password</button><br/>
<span class="text-warning">Demo user are unauthorize to use this feature</span>
<button ng-if="!isDemoUser" ng-disabled="isDemoUser" type="submit" class="btn btn-floating btn-info">Update Password</button><br/>
<span ng-if="isDemoUser" class="text-warning">Demo user are unauthorize to use this feature</span>

</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion Source/App/Client/app/views/patient/patient.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="col col-xs-12 col-sm-4 col-md-4 col-lg-4" style="padding-bottom: 10px">
<form class="form" ng-submit="search()">
<div class="input-group">
<input class="form-control input-field" type="text" placeholder="Search By Patient Name, Patient Id" required="required" ng-model="key" ng-change="search()" />
<input class="form-control input-field" type="text" placeholder="Search By Patient Name, Patient Id, Phone, etc." required="required" ng-model="key" ng-change="search()" autocomplete="off"/>
<span type="submit" class="input-group-addon"><a style="cursor: pointer; text-decoration: none" class="glyphicon glyphicon-search btn-floating" ng-click="search()"></a></span>
</div>
</form>
Expand Down
2 changes: 2 additions & 0 deletions Source/App/DM.Server/Controllers/PatientController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ public IHttpActionResult Search(string request)
Id = patient.Id,
Code = patient.Code,
Name = patient.Name,
Phone = patient.Phone,
Age = patient.Age,
Gender = patient.Gender,
LastVisitingDate = prescription.LastUpdate,
TotalPayable = prescription.TotalPayable,
TotalPaid = prescription.TotalPaid,
Expand Down

0 comments on commit e381b67

Please sign in to comment.