Skip to content

Commit

Permalink
BAH-1123: Patient ID as configurable hyperlink on Appointments List V…
Browse files Browse the repository at this point in the history
…iew (#152)

* Patient ID as configurable hyperlink on Appointments List View

* Open patient dashboard on new window

* Reviewed configurable patient link to use alias substitution

* Bump version from 0.0.2 to 0.0.3

* Updated patient link URL
  • Loading branch information
icrc-psousa committed Jan 21, 2021
1 parent 44a8727 commit 0b64050
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion config/ng-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
"customLocaleURL": "/bahmni_config/openmrs/i18n/",
"loginPageUrl": "../../bahmni/home/index.html#/login",
"patientsURL": "/bahmni/clinical/index.html#/default/patient/",
"patientsURLGeneralInformationTab": "/dashboard?currentTab=DASHBOARD_TAB_GENERAL_KEY"
"patientsURLGeneralInformationTab": "/dashboard?currentTab=DASHBOARD_TAB_GENERAL_KEY",
"appointmentsListPatientLink": "/bahmni/clinical/index.html#/default/patient/{{patientId}}/dashboard?currentTab=DASHBOARD_TAB_GENERAL_KEY"
}
},
"Appointments": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openmrs-module-appointments-frontend",
"version": "0.0.2",
"version": "0.0.3",
"description": "An appointment app for bahmni/openmrs.",
"license": "AGPLv3",
"scripts": {
Expand Down
5 changes: 5 additions & 0 deletions src/controllers/manage/list/appointmentsListViewController.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ angular.module('bahmni.appointments')
$scope.manageAppointmentPrivilege = Bahmni.Appointments.Constants.privilegeManageAppointments;
$scope.ownAppointmentPrivilege = Bahmni.Appointments.Constants.privilegeOwnAppointments;
$scope.resetAppointmentStatusPrivilege = Bahmni.Appointments.Constants.privilegeResetAppointmentStatus;
$scope.shouldShowAppointmentsListPatientLink = !!Bahmni.Common.Constants.appointmentsListPatientLink;
$scope.searchedPatient = false;
var autoRefreshIntervalInSeconds = parseInt(appService.getAppDescriptor().getConfigValue('autoRefreshIntervalInSeconds'));
var enableAutoRefresh = !isNaN(autoRefreshIntervalInSeconds);
Expand Down Expand Up @@ -216,6 +217,10 @@ angular.module('bahmni.appointments')
});
};

$scope.generateAppointmentsListPatientLink = function (appointment) {
return appService.getAppDescriptor().formatUrl(Bahmni.Common.Constants.appointmentsListPatientLink, { patientId: appointment.patient.uuid });
}

function isNullOrEmpty(obj) {
return obj === null || obj === undefined || Object.keys(obj).length === 0;
}
Expand Down
5 changes: 4 additions & 1 deletion src/views/manage/list/listView.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
</thead>
<tbody>
<tr ng-repeat="appointment in filteredAppointments" ng-click="select(appointment)" ng-style="{'background-color': colorsForListView[appointment.status]}" ng-class="{'selected' : isSelected(appointment)}">
<td>{{::appointment.patient.identifier}}</td>
<td>
<a ng-show="shouldShowAppointmentsListPatientLink" href="#" target="_blank" ng-click="$event.stopPropagation()" ng-href="{{generateAppointmentsListPatientLink(appointment)}}">{{::appointment.patient.identifier}}</a>
<span ng-hide="shouldShowAppointmentsListPatientLink">{{::appointment.patient.identifier}}</span>
</td>
<td class="table-mid-width">{{::appointment.patient.name | titleCase}}</td>
<td>{{::appointment.startDateTime | bahmniDate}}</td>
<td>{{::appointment.startDateTime | bahmniTime}}</td>
Expand Down
2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-appointments-frontend",
"version": "0.0.2",
"version": "0.0.3",
"description": "React Appointments Frontend",
"main": "dist/reactAngularAdaptor.js",
"directories": {
Expand Down

0 comments on commit 0b64050

Please sign in to comment.