Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Fixes #278: Localization for Medication module
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpelan committed Mar 2, 2016
1 parent a5fcfeb commit 27b36ea
Show file tree
Hide file tree
Showing 14 changed files with 141 additions and 68 deletions.
63 changes: 60 additions & 3 deletions app/locales/en/translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,13 @@ export default {
patient: 'Patient',
quantity: 'Quantity',
requested_on: 'Requested On',
date: 'Date',
date_requested: 'Date Requested',
date_completed: 'Date Completed',
requested_by: 'Requested By',
fulfill: 'Fulfill',
fulfill_request: 'Fulfill Request',
fulfill_request_now: 'Fulfill Request Now',
actions: 'Actions',
action: 'Action',
notes: 'Notes',
Expand Down Expand Up @@ -134,7 +137,16 @@ export default {
password: 'Password',
edit_user: 'Edit User',
new_user: 'New User',
delete_user: 'Delete User'
delete_user: 'Delete User',
medication: 'Medication',
status: 'Status',
add_new_outpatient_visit: '--Add New Outpatient Visit--',
prescription: 'Prescription',
prescription_date: 'Prescription Date',
bill_to: 'Bill To',
pull_from: 'Pull From',
fulfilled: 'Fulfilled',
delete_request: 'Delete Request'
},
messages: {
no_items_found: 'No items found.',
Expand All @@ -143,7 +155,11 @@ export default {
no_users_found: 'No users found.',
are_you_sure_delete: 'Are you sure you wish to delete the user ',
user_has_been_saved: 'The user has been saved.',
user_saved: 'User Saved'
user_saved: 'User Saved',
new_patient_has_to_be_created: 'A new patient needs to be created...Please wait..'
},
alerts: {
please_wait: 'Please Wait'
},
buttons: {
complete: 'Complete',
Expand All @@ -156,7 +172,10 @@ export default {
new_user: 'New User',
add_value: 'Add Value',
import: 'Import',
load_file: 'Load File'
load_file: 'Load File',
new_request: 'New Request',
all_requests: 'All Requests',
dispense: 'Dispense'
},
login: {
messages: {
Expand Down Expand Up @@ -199,5 +218,43 @@ export default {
saved_title: 'Imaging Request Saved',
saved_message: 'The imaging request has been saved.'
}
},
medication: {
page_title: 'Medication Requests',
section_title: 'Medication',
return_medication: 'Return Medication',
buttons: {
dispense_medication: 'dispense medication',
new_button: '+ new request',
return_medication: 'return medication'
},
titles: {
completed_medication: 'Completed Medication',
edit_medication_request: 'Edit Medication Request',
new_medication_request: 'New Medication Request'
},
messages: {
create_new: 'Create a new medication request?',
confirm_deletion: 'Are you sure you wish to delete this medication request?'
},
labels: {
refills: 'Refills',
quantity_requested: 'Quantity Requested',
quantity_dispensed: 'Quantity Dispensed',
quantity_distributed: 'Quantity Distributed',
quantity_to_return: 'Quantity To Return',
return_location: 'Return Location',
return_aisle: 'Return Aisle',
return_reason: 'Return Reason/Notes',
adjustment_date: 'Adjustment Date',
credit_to_account: 'Credit To Account'
},
alerts: {
returned_title: 'Medication Returned',
returned_message: 'The medication has been marked as returned.',
saved_title: 'Medication Request Saved',
saved_message: 'The medication record has been saved.',
fulfilled_title: 'Medication Request Fulfilled'
}
}
};
3 changes: 2 additions & 1 deletion app/medication/completed/route.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { translationMacro as t } from 'ember-i18n';
import MedicationIndexRoute from 'hospitalrun/medication/index/route';
export default MedicationIndexRoute.extend({
modelName: 'medication',
pageTitle: 'Completed Medication',
pageTitle: t('medication.titles.completed_medication'),
searchStatus: 'Fulfilled'
});
3 changes: 2 additions & 1 deletion app/medication/delete/controller.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { translationMacro as t } from 'ember-i18n';
import AbstractDeleteController from 'hospitalrun/controllers/abstract-delete-controller';
import PatientSubmodule from 'hospitalrun/mixins/patient-submodule';
export default AbstractDeleteController.extend(PatientSubmodule, {
title: 'Delete Request',
title: t('labels.delete_request'),

actions: {
delete: function() {
Expand Down
2 changes: 1 addition & 1 deletion app/medication/delete/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
updateButtonText=updateButtonText }}
<div class="alert alert-danger">
<span class="glyphicon glyphicon-warning-sign"></span>
Are you sure you wish to delete this medication request?
{{t 'medication.messages.confirm_deletion'}}
</div>
{{/modal-dialog}}
30 changes: 17 additions & 13 deletions app/medication/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,14 @@ export default AbstractEditController.extend(InventorySelection, FulfillRequest,
}.property('isFulfilling', 'model.prescription'),

quantityLabel: function() {
var returnLabel = 'Quantity Requested',
let i18n = this.get('i18n');
var returnLabel = i18n.t('medication.labels.quantity_requested'),
isFulfilled = this.get('isFulfilled'),
isFulfilling = this.get('isFulfilling');
if (isFulfilling) {
returnLabel = 'Quantity Dispensed';
returnLabel = i18n.t('medication.labels.quantity_dispensed');
} else if (isFulfilled) {
returnLabel = 'Quantity Distributed';
returnLabel = i18n.t('medication.labels.quantity_distributed');
}
return returnLabel;
}.property('isFulfilled'),
Expand All @@ -69,22 +70,24 @@ export default AbstractEditController.extend(InventorySelection, FulfillRequest,
updateCapability: 'add_medication',

afterUpdate: function() {
var alertTitle = 'Medication Request Saved',
alertMessage = 'The medication record has been saved.',
let i18n = this.get('i18n');
var alertTitle,
alertMessage,
isFulfilled = this.get('isFulfilled');
if (isFulfilled) {
alertTitle = 'Medication Request Fulfilled';
alertTitle = i18n.t('medication.alerts.fulfilled_title');
alertMessage = 'The medication request has been fulfilled.';
this.set('model.selectPatient', false);
} else {
alertTitle = 'Medication Request Saved';
alertMessage = 'The medication record has been saved.';
alertTitle = i18n.t('medication.alerts.saved_title');
alertMessage = i18n.t('medication.alerts.saved_message');
}
this.saveVisitIfNeeded(alertTitle, alertMessage);
},

_addNewPatient: function() {
this.displayAlert('Please Wait', 'A new patient needs to be created...Please wait..');
let i18n = this.get('i18n');
this.displayAlert(i18n.t('alerts.please_wait'), i18n.t('messages.new_patient_has_to_be_created'));
this._getNewPatientId().then(function(friendlyId) {
var patientTypeAhead = this.get('model.patientTypeAhead'),
nameParts = patientTypeAhead.split(' '),
Expand Down Expand Up @@ -197,14 +200,15 @@ export default AbstractEditController.extend(InventorySelection, FulfillRequest,
}.property('updateCapability', 'isFulfilled'),

updateButtonText: function() {
let i18n = this.get('i18n');
if (this.get('model.hideFulfillRequest')) {
return 'Dispense';
return i18n.t('buttons.dispense');
} else if (this.get('isFulfilling')) {
return 'Fulfill';
return i18n.t('labels.fulfill');
} else if (this.get('model.isNew')) {
return 'Add';
return i18n.t('buttons.add');
} else {
return 'Update';
return i18n.t('buttons.update');
}
}.property('model.isNew', 'isFulfilling', 'model.hideFulfillRequest'),

Expand Down
5 changes: 3 additions & 2 deletions app/medication/edit/route.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { translationMacro as t } from 'ember-i18n';
import AbstractEditRoute from 'hospitalrun/routes/abstract-edit-route';
import Ember from 'ember';
import FulfillRequest from 'hospitalrun/mixins/fulfill-request';
import InventoryLocations from 'hospitalrun/mixins/inventory-locations'; // inventory-locations mixin is needed for fulfill-request mixin!
import PatientListRoute from 'hospitalrun/mixins/patient-list-route';
export default AbstractEditRoute.extend(FulfillRequest, InventoryLocations, PatientListRoute, {
editTitle: 'Edit Medication Request',
editTitle: t('medication.titles.edit_medication_request'),
modelName: 'medication',
newTitle: 'New Medication Request',
newTitle: t('medication.titles.new_medication_request'),
database: Ember.inject.service(),
getNewData: function(params) {
var idParam = this.get('idParam'),
Expand Down
32 changes: 16 additions & 16 deletions app/medication/edit/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,61 +5,61 @@
{{/unless}}
<div class="row">
{{#if model.selectPatient}}
{{patient-typeahead property="patientTypeAhead" label="Patient" content=patientList selection=selectedPatient class="col-xs-6 required test-patient-input"}}
{{patient-typeahead property="patientTypeAhead" label=(t 'labels.patient') content=patientList selection=selectedPatient class="col-xs-6 required test-patient-input"}}
{{/if}}
{{#if model.isNew}}
{{em-select class="col-xs-4 required test-add-visit" label="Visit"
{{em-select class="col-xs-4 required test-add-visit" label=(t 'labels.visit')
property="visit" content=patientVisitsForSelect
optionValuePath="selectObject" optionLabelPath="selectObject.visitDescription"
prompt="--Add New Outpatient Visit--"
prompt=(t 'labels.add_new_outpatient_visit')
selected=model.visit
}}
{{else}}
<div class="form-group col-xs-3">
<label>Visit</label>
<label>{{t 'labels.visit'}}</label>
<p class="form-control-static">{{model.visit.visitDescription}}</p>
</div>
{{/if}}
</div>
{{#if isFulfilledOrRequested}}
<div class="form-group">
<label class="control-label">Medication</label>
<label class="control-label">{{t 'labels.medication'}}</label>
<p class="form-control-static">{{model.medicationName}}</p>
</div>
{{else}}
{{inventory-typeahead property="inventoryItemTypeAhead" label="Medication" content=medicationList selection=selectedInventoryItem class="required test-medication-input"}}
{{inventory-typeahead property="inventoryItemTypeAhead" label=(t 'labels.medication') content=medicationList selection=selectedInventoryItem class="required test-medication-input"}}
{{/if}}
{{#if isFulfilled}}
{{static-text label="Prescription" value=model.prescription }}
{{static-text label=(t 'labels.prescription') value=model.prescription }}
<div class="row">
{{#static-text label="Prescription Date" class="col-xs-4"}}
{{#static-text label=(t 'labels.prescription_date') class="col-xs-4"}}
{{date-format model.prescriptionDate}}
{{/static-text}}
{{static-text label=quantityLabel class="col-xs-3" value=model.quantity }}
{{static-text label="Refills" class="col-xs-3" value=model.refills }}
{{static-text label=(t 'medication.labels.refills') class="col-xs-3" value=model.refills }}
</div>
{{else}}
{{em-text property="prescription" label="Prescription" rows="3" class=prescriptionClass }}
{{em-text property="prescription" label=(t 'labels.prescription')rows="3" class=prescriptionClass }}
<div class="row">
{{date-picker property="prescriptionDate" label="Prescription Date" class="col-sm-4"}}
{{date-picker property="prescriptionDate" label=(t 'labels.prescription_date') class="col-sm-4"}}
</div>
<div class="row">
{{em-input property="quantity" label=quantityLabel class=quantityClass }}
{{em-input property="refills" label="Refills" class="col-xs-3"}}
{{em-input property="refills" label=(t 'medication.labels.refills') class="col-xs-3"}}
</div>
{{#unless model.hideFulfillRequest}}
{{#if model.isNew}}
{{#if canFulfill}}
<div class="form-group">
<label class="control-label">Fulfill Request</label>
<label class="control-label">{{t 'labels.fulfill_request'}}</label>
</div>
{{em-checkbox label="Fulfill Request Now" property="shouldFulfillRequest"}}
{{em-checkbox label=(t 'labels.fulfill_request_now') property="shouldFulfillRequest"}}
{{/if}}
{{/if}}
{{/unless}}
{{#if isFulfilling}}
{{select-or-typeahead property="expenseAccount" label="Bill To" list=expenseAccountList selection=model.expenseAccount }}
{{inventory-location-picker label="Pull From" quantityRequested=model.quantity
{{select-or-typeahead property="expenseAccount" label=(t 'labels.bill_to') list=expenseAccountList selection=model.expenseAccount }}
{{inventory-location-picker label=(t 'labels.pull_from') quantityRequested=model.quantity
locationList= model.inventoryItem.availableLocations
selectedLocations=model.inventoryLocations
}}
Expand Down
3 changes: 2 additions & 1 deletion app/medication/index/route.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { translationMacro as t } from 'ember-i18n';
import AbstractIndexRoute from 'hospitalrun/routes/abstract-index-route';
export default AbstractIndexRoute.extend({
modelName: 'medication',
pageTitle: 'Medication Requests',
pageTitle: t('medication.page_title'),
searchStatus: 'Requested',

_getStartKeyFromItem: function(item) {
Expand Down
8 changes: 4 additions & 4 deletions app/medication/index/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
{{#if model}}
<table class="table">
<tr class="table-header">
<th>Date</th>
<th>{{t 'labels.date'}}</th>
<th>{{t 'labels.patient'}}</th>
<th>Medication</th>
<th>{{t 'labels.medication'}}</th>
<th>{{t 'labels.quantity'}}</th>
<th>Status</th>
<th>{{t 'labels.status'}}</th>
{{#if showActions}}
<th>{{t 'labels.actions'}}</th>
{{/if}}
Expand All @@ -28,7 +28,7 @@
</table>
{{else}}
<div class="alert alert-info">
<p>No items found. {{#if canAdd}}<a href="#" {{action 'newItem'}}>Create a new medication request?</a>{{/if}}</p>
<p>{{t 'messages.no_items_found'}} {{#if canAdd}}<a href="#" {{action 'newItem'}}>{{t 'medication.messages.create_new'}}</a>{{/if}}</p>
</div>
{{/if}}
{{/item-listing}}
6 changes: 4 additions & 2 deletions app/medication/return/controller.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { translationMacro as t } from 'ember-i18n';
import AbstractEditController from 'hospitalrun/controllers/abstract-edit-controller';
import Ember from 'ember';
import FulfillRequest from 'hospitalrun/mixins/fulfill-request';
Expand Down Expand Up @@ -94,8 +95,9 @@ export default AbstractEditController.extend(FulfillRequest, InventoryLocations,

actions: {
doneFulfillRequest: function() {
let i18n = this.get('i18n');
this.updateLookupLists();
this.displayAlert('Medication Returned', 'The medication has been marked as returned.', 'allItems');
this.displayAlert(i18n.t('medication.alerts.returned_title'), i18n.t('medication.alerts.returned_message'), 'allItems');
},
update: function() {
var medication = this.get('model.medication'),
Expand All @@ -114,5 +116,5 @@ export default AbstractEditController.extend(FulfillRequest, InventoryLocations,
}
},

updateButtonText: 'Return Medication'
updateButtonText: t('medication.return_medication')
});
5 changes: 3 additions & 2 deletions app/medication/return/route.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { translationMacro as t } from 'ember-i18n';
import MedicationEditRoute from '../edit/route';
import Ember from 'ember';

export default MedicationEditRoute.extend({
editTitle: 'Return Medication',
editTitle: t('medication.return_medication'),
modelName: 'inv-request',
newTitle: 'Return Medication',
newTitle: t('medication.return_medication'),
getNewData: function() {
return Ember.RSVP.resolve({
dateCompleted: new Date(),
Expand Down
Loading

0 comments on commit 27b36ea

Please sign in to comment.