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

Commit

Permalink
add cashier role in roles (#1027)
Browse files Browse the repository at this point in the history
* add cashier role in roles

* change capabilities in navigation bar

* add unit test for cashier role and finalize the role
  • Loading branch information
baoqchau authored and jkleinsc committed Apr 12, 2017
1 parent 400314f commit 6d0b1d8
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 15 deletions.
4 changes: 3 additions & 1 deletion app/admin/roles/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export default AbstractEditController.extend(UserRoles, UserSession, {
'editInvoice',
'invoices',
'overrideInvoice',
'pricing'
'pricing',
'cashier',
'listPaidInvoices'
]
}, {
name: 'patients',
Expand Down
2 changes: 1 addition & 1 deletion app/invoices/edit/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
<th colspan="2" class="col-xs-6">{{t 'labels.name'}}</th>
<th class="col-xs-1">{{t 'labels.quantity'}}</th>
<th class="col-xs-1">{{t 'labels.price'}}</th>
<th class="col-xs-1">{{t 'labels.expense_to'}}</th>
<th class="col-xs-1">{{t 'labels.expenseTo'}}</th>
<th class="col-xs-1 text-right">{{t 'labels.total'}}</th>
<th class="col-xs-2">
{{#if canAddCharge}}
Expand Down
12 changes: 7 additions & 5 deletions app/invoices/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,13 @@ export default AbstractModuleRoute.extend(ModalHelper, PatientListRoute, {
statusQuery: 'All'
});
}
actions.push({
text: 'Paid',
linkTo: 'invoices.index',
statusQuery: 'Paid'
});
if (this.currentUserCan('list_paid_invoices')) {
actions.push({
text: 'Paid',
linkTo: 'invoices.index',
statusQuery: 'Paid'
});
}
return actions;
}.property()

Expand Down
4 changes: 4 additions & 0 deletions app/locales/en/translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default {
columns: 'Columns',
customForm: 'Custom Form',
dischargeReportFormType: 'Discharge Report',
expenseTo: 'Expense To',
formName: 'Form Name',
formType: 'Form Type',
incidentFormType: 'Incident',
Expand Down Expand Up @@ -161,6 +162,7 @@ export default {
admitPatient: 'Admit Patient',
appointments: 'Appointments',
billing: 'Billing',
cashier: 'Cashier',
completeImaging: 'Complete Imaging',
completeLab: 'Complete Lab',
defineUserRoles: 'Define User Roles',
Expand Down Expand Up @@ -192,6 +194,7 @@ export default {
inventory: 'Inventory',
invoices: 'Invoices',
labs: 'Labs',
listPaidInvoices: 'List Paid Invoices',
loadDb: 'Load Database',
manageIncidents: 'Manage Incidents',
medication: 'Medication',
Expand Down Expand Up @@ -1065,6 +1068,7 @@ export default {
appointmentSearch: 'Appointment Search',
appointmentsCalendar: 'Appointments Calendar',
appointmentsThisWeek: 'Appointments This Week',
cashier: 'Cashier',
completed: 'Completed',
currentIncidents: 'Current Incidents',
customForms: 'Custom Forms',
Expand Down
8 changes: 7 additions & 1 deletion app/mixins/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,18 @@ export default Ember.Mixin.create({
title: 'Prices',
iconClass: 'octicon-chevron-right',
route: 'pricing.index',
capability: 'invoices'
capability: 'pricing'
},
{
title: 'Price Profiles',
iconClass: 'octicon-chevron-right',
route: 'pricing.profiles',
capability: 'pricing'
},
{
title: 'Cashier',
iconClass: 'octicon-chevron-right',
route: 'invoices.cashier',
capability: 'invoices'
}
]
Expand Down
3 changes: 2 additions & 1 deletion app/mixins/user-roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export const PREDEFINED_USER_ROLES = [
{ name: 'Pharmacist', roles: ['Pharmacist', 'user'], defaultRoute: 'medication.index' },
{ name: 'Social Worker', roles: ['Social Worker', 'user'], defaultRoute: 'patients.index' },
{ name: 'System Administrator', roles: ['System Administrator', 'admin', 'user'], defaultRoute: 'patients.index' },
{ name: 'User Administrator', roles: ['User Administrator', 'admin', 'user'], defaultRoute: 'users' }
{ name: 'User Administrator', roles: ['User Administrator', 'admin', 'user'], defaultRoute: 'users' },
{ name: 'Cashier', roles: ['Cashier', 'user'], defaultRoute: 'invoices.index' }
];

export default Ember.Mixin.create({
Expand Down
29 changes: 23 additions & 6 deletions app/mixins/user-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export default Ember.Mixin.create({
'Medical Records Officer',
'Patient Administration',
'Social Worker',
'System Administrator'
'System Administrator',
'Cashier'
],
add_appointment: [
'Data Entry',
Expand All @@ -31,7 +32,8 @@ export default Ember.Mixin.create({
'Medical Records Officer',
'Patient Administration',
'Social Worker',
'System Administrator'
'System Administrator',
'Cashier'
],
add_charge: [
'Data Entry',
Expand Down Expand Up @@ -151,12 +153,14 @@ export default Ember.Mixin.create({
'Data Entry',
'Hospital Administrator',
'Medical Records Officer',
'System Administrator'
'System Administrator',
'Cashier'
],
add_payment: [
'Hospital Administrator',
'Medical Records Officer',
'System Administrator'
'System Administrator',
'Cashier'
],
add_procedure: [
'Data Entry',
Expand Down Expand Up @@ -228,6 +232,11 @@ export default Ember.Mixin.create({
'Hospital Administrator',
'Finance',
'Finance Manager',
'System Administrator',
'Cashier'
],
cashier: [
'Cashier',
'System Administrator'
],
complete_imaging: [
Expand Down Expand Up @@ -396,7 +405,8 @@ export default Ember.Mixin.create({
'Hospital Administrator',
'Finance',
'Finance Manager',
'System Administrator'
'System Administrator',
'Cashier'
],
labs: [
'Data Entry',
Expand All @@ -406,6 +416,12 @@ export default Ember.Mixin.create({
'Medical Records Officer',
'System Administrator'
],
list_paid_invoices: [
'Data Entry',
'Hospital Administrator',
'Medical Records Officer',
'System Administrator'
],
medication: [
'Data Entry',
'Doctor',
Expand All @@ -428,7 +444,8 @@ export default Ember.Mixin.create({
],
override_invoice: [
'Hospital Administrator',
'System Administrator'
'System Administrator',
'Cashier'
],
query_db: [
'System Administrator'
Expand Down
1 change: 1 addition & 0 deletions app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Router.map(function() {
});

this.route('invoices', function() {
this.route('cashier');
this.route('edit', { path: '/edit/:invoice_id' });
this.route('search', { path: '/search/:search_text' });
});
Expand Down
26 changes: 26 additions & 0 deletions tests/acceptance/invoices-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,29 @@ test('add deposit', function(assert) {
});
});
});

test('cashier role', function(assert) {
runWithPouchDump('billing', function() {
authenticateUser({
name: '[email protected]',
roles: ['Cashier', 'user'],
role: 'Cashier',
prefix: 'p1'
});
visit('/invoices');
andThen(function() {
assert.equal(currentURL(), '/invoices');
assert.equal(find('.primary-section-link').length, 2, 'Should have 2 navigations');
assert.equal(find('.primary-section-link:contains(Scheduling)').length, 1, 'should see Scheduling navigation');
assert.equal(find('.primary-section-link:contains(Billing)').length, 1, 'should see Billing navigation');

assert.equal(find('li:contains(Billed)').length, 1, 'should see Billed selection');
assert.equal(find('li:contains(Drafts)').length, 1, 'should see Drafts selection');
assert.equal(find('li:contains(All Invoices)').length, 1, 'should see All Invoices selection');
});
click('a:contains(Billing)');
andThen(function() {
assert.equal(find('.category-sub-item').length, 3, 'Should have 3 sub navigations');
});
});
});

0 comments on commit 6d0b1d8

Please sign in to comment.