diff --git a/app/appointments/missed/controller.js b/app/appointments/missed/controller.js
new file mode 100644
index 0000000000..99ba561b6b
--- /dev/null
+++ b/app/appointments/missed/controller.js
@@ -0,0 +1,20 @@
+import AbstractPagedController from 'hospitalrun/controllers/abstract-paged-controller';
+import UserSession from 'hospitalrun/mixins/user-session';
+export default AbstractPagedController.extend(UserSession, {
+ startKey: [],
+ canAddVisit: function() {
+ return this.currentUserCan('add_visit');
+ }.property(),
+
+ canEdit: function() {
+ // Add and edit are the same capability
+ return this.currentUserCan('add_appointment');
+ }.property(),
+
+ canDelete: function() {
+ return this.currentUserCan('delete_appointment');
+ }.property(),
+
+ sortProperties: ['startDate', 'endDate'],
+ sortAscending: true
+});
diff --git a/app/appointments/missed/route.js b/app/appointments/missed/route.js
new file mode 100644
index 0000000000..d39f65a913
--- /dev/null
+++ b/app/appointments/missed/route.js
@@ -0,0 +1,8 @@
+import AbstractIndexRoute from 'hospitalrun/routes/abstract-index-route';
+import { translationMacro as t } from 'ember-i18n';
+
+export default AbstractIndexRoute.extend({
+ editReturn: 'appointments.missed',
+ modelName: 'appointment',
+ pageTitle: t('appointments.missed')
+});
\ No newline at end of file
diff --git a/app/appointments/missed/template.hbs b/app/appointments/missed/template.hbs
new file mode 100644
index 0000000000..092239d10a
--- /dev/null
+++ b/app/appointments/missed/template.hbs
@@ -0,0 +1,16 @@
+{{#item-listing paginationProps=paginationProps }}
+
+
+ {{#each model as |appointment|}}
+ {{partial 'appointments/item'}}
+ {{/each}}
+
+{{/item-listing}}
diff --git a/app/locales/en/translations.js b/app/locales/en/translations.js
index 7e994a6d44..f38163c8f4 100644
--- a/app/locales/en/translations.js
+++ b/app/locales/en/translations.js
@@ -511,6 +511,7 @@ export default {
new_title: 'New Appointment',
section_title: 'Appointments',
this_week: 'Appointments This Week',
+ missed: 'Missed Appointments',
search_title: 'Search Appointments',
today_title: 'Today\'s Appointments',
messages: {
diff --git a/app/mixins/navigation.js b/app/mixins/navigation.js
index 5c5fed1a66..d09b4d875d 100644
--- a/app/mixins/navigation.js
+++ b/app/mixins/navigation.js
@@ -88,6 +88,12 @@ export default Ember.Mixin.create({
route: 'appointments.today',
capability: 'appointments'
},
+ {
+ title: 'Missed',
+ iconClass: 'octicon-chevron-right',
+ route: 'appointments.missed',
+ capability: 'appointments'
+ },
{
title: 'Search',
iconClass: 'octicon-search',
diff --git a/app/router.js b/app/router.js
index 43016d7747..fdd0dd8b5b 100755
--- a/app/router.js
+++ b/app/router.js
@@ -26,6 +26,7 @@ Router.map(function() {
this.route('edit', { path: '/edit/:appointment_id' });
this.route('search');
this.route('today');
+ this.route('missed');
});
this.route('finishgauth', { path: '/finishgauth/:s1/:s2/:k/:t/:i/:p' });
diff --git a/tests/acceptance/appointments-test.js b/tests/acceptance/appointments-test.js
index 3b66d62975..5311a18a38 100644
--- a/tests/acceptance/appointments-test.js
+++ b/tests/acceptance/appointments-test.js
@@ -24,6 +24,22 @@ test('visiting /appointments', function(assert) {
});
});
+test('visiting /appointments/missed', function(assert) {
+ runWithPouchDump('appointments', function() {
+ authenticateUser();
+ let shortFormat = 'l';
+ // create an apointmet scheduled in the past
+ let lastWeek = moment().subtract(7, 'days');
+ let sixDaysAgo = moment().subtract(6, 'days');
+ createAppointment(lastWeek.toDate(), sixDaysAgo.toDate());
+ visit('/appointments/missed');
+ andThen(function() {
+ assert.equal(currentURL(), '/appointments/missed');
+ findWithAssert(`.appointment-date:contains(${moment(lastWeek).format(shortFormat)} - ${moment(sixDaysAgo).format(shortFormat)})`);
+ });
+ });
+});
+
test('Creating a new appointment', function(assert) {
runWithPouchDump('appointments', function() {
authenticateUser();
@@ -35,20 +51,7 @@ test('Creating a new appointment', function(assert) {
findWithAssert('button:contains(Add)');
});
- fillIn('.test-patient-input .tt-input', 'Lennex Zinyando - P00017');
- triggerEvent('.test-patient-input .tt-input', 'input');
- triggerEvent('.test-patient-input .tt-input', 'blur');
- select('.test-appointment-type', 'Followup');
- waitToAppear('.test-appointment-date input');
- andThen(function() {
- selectDate('.test-appointment-date input', new Date());
- });
- fillIn('.test-appointment-location .tt-input', 'Harare');
- triggerEvent('.test-appointment-location .tt-input', 'input');
- triggerEvent('.test-appointment-location .tt-input', 'blur');
- fillIn('.test-appointment-with', 'Dr Test');
- click('button:contains(Add)');
- waitToAppear('.table-header');
+ createAppointment();
andThen(() => {
assert.equal(currentURL(), '/appointments');
@@ -133,7 +136,7 @@ test('Delete an appointment', function(assert) {
});
});
-function createAppointment() {
+function createAppointment(startDate=(new Date()), endDate=(moment().add(1, 'day').toDate())) {
visit('/appointments/edit/new');
fillIn('.test-patient-input .tt-input', 'Lennex Zinyando - P00017');
triggerEvent('.test-patient-input .tt-input', 'input');
@@ -141,10 +144,10 @@ function createAppointment() {
select('.test-appointment-type', 'Admission');
waitToAppear('.test-appointment-start input');
andThen(function() {
- selectDate('.test-appointment-start input', new Date());
+ selectDate('.test-appointment-start input', startDate);
});
andThen(function() {
- selectDate('.test-appointment-end input', moment().add(1, 'day').toDate());
+ selectDate('.test-appointment-end input', endDate);
});
fillIn('.test-appointment-location .tt-input', 'Harare');
triggerEvent('.test-appointment-location .tt-input', 'input');
diff --git a/tests/unit/appointments/missed/route-test.js b/tests/unit/appointments/missed/route-test.js
new file mode 100644
index 0000000000..c1f28bc024
--- /dev/null
+++ b/tests/unit/appointments/missed/route-test.js
@@ -0,0 +1,11 @@
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:appointments/missed', 'Unit | Route | appointments/missed', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+test('it exists', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+});