From df81a13370cee25a406a89e18a760b812abde5c8 Mon Sep 17 00:00:00 2001 From: chima1707 Date: Thu, 2 Mar 2017 12:13:39 +0100 Subject: [PATCH 1/5] fix: fixed translation lables for next appointments --- app/locales/en/translations.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/locales/en/translations.js b/app/locales/en/translations.js index 444619422d..aa101a46fe 100644 --- a/app/locales/en/translations.js +++ b/app/locales/en/translations.js @@ -1118,7 +1118,8 @@ export default { labs: 'Labs', images: 'Images', medications: 'Medications', - nextAppointmentDate: 'Date Of Next Appointment', + nextAppointment: 'Next Appointment', + nextAppointments: 'Next Appointments', operativePlan: { title: 'Operative Plans', description: 'Operation Description', From de35e4432ab63c98731e3c416665680a28822364 Mon Sep 17 00:00:00 2001 From: chima1707 Date: Thu, 2 Mar 2017 12:14:59 +0100 Subject: [PATCH 2/5] fix: modified get futureAppointment to work for list of appointments --- app/mixins/patient-visits.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/mixins/patient-visits.js b/app/mixins/patient-visits.js index bf1dc2bc06..1f244935bd 100644 --- a/app/mixins/patient-visits.js +++ b/app/mixins/patient-visits.js @@ -21,7 +21,7 @@ export default Ember.Mixin.create(PouchDbMixin, { }); }, - getPatientFutureAppointment(visit) { + getPatientFutureAppointment(visit, outPatient) { let patientId = visit.get('patient.id'); let visitDate = visit.get('startDate'); let maxValue = this.get('maxValue'); @@ -39,11 +39,16 @@ export default Ember.Mixin.create(PouchDbMixin, { if (!futureAppointments.length) { return ''; } - let [appointment] = futureAppointments; - let res = appointment.get('startDate'); - return res; + if (!outPatient) { + let [appointment] = futureAppointments; + return appointment; + } else { + let res = futureAppointments.slice(0, 3); + return res; + } + }); - return DS.PromiseObject.create({ promise }); + return (outPatient) ? DS.PromiseArray.create({ promise}) : DS.PromiseObject.create({ promise }); }, checkoutVisit(visit, status) { From bbdbd654d2ff1e173f74d9aea273a73b92f8258d Mon Sep 17 00:00:00 2001 From: chima1707 Date: Thu, 2 Mar 2017 12:15:56 +0100 Subject: [PATCH 3/5] fix: implemented next appointments on both template and controller --- app/reports/edit/controller.js | 6 ++++-- app/reports/edit/template.hbs | 35 ++++++++++++++++++++++++++++------ 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/app/reports/edit/controller.js b/app/reports/edit/controller.js index 719b082992..00607cba5c 100644 --- a/app/reports/edit/controller.js +++ b/app/reports/edit/controller.js @@ -30,6 +30,10 @@ export default AbstractEditController.extend(PatientSubmodule, PatientDiagnosis, return this.getPatientFutureAppointment(this.get('model.visit')); }), + nextAppointments: Ember.computed('model', function() { + return this.getPatientFutureAppointment(this.get('model.visit'), true); + }), + additionalButtons: Ember.computed('model.{isNew}', function() { let isNew = this.get('model.isNew'); if (!isNew) { @@ -47,8 +51,6 @@ export default AbstractEditController.extend(PatientSubmodule, PatientDiagnosis, beforeUpdate() { return new Ember.RSVP.Promise(function(resolve) { if (this.get('model.isNew')) { - let appointmentDate = this.get('nextAppointment').get('content'); - this.get('model').set('nextAppointment', appointmentDate); if (this.get('model.visit.outPatient')) { this.get('model').set('reportType', 'OPD Report'); } else { diff --git a/app/reports/edit/template.hbs b/app/reports/edit/template.hbs index cca704e8e3..b2f77d2378 100644 --- a/app/reports/edit/template.hbs +++ b/app/reports/edit/template.hbs @@ -108,12 +108,35 @@ {{/if}} - {{#if nextAppointment}} -
- - {{date-format nextAppointment format="DD/MM/YYYY hh:mm a"}} -
- {{/if}} + {{log nextAppointment}} + {{#if model.visit.outPatient}} + {{#if nextAppointments.length}} +
+ + {{#each nextAppointments as |appointment|}} + {{date-format appointment.startDate format="DD/MM/YYYY hh:mm a"}} + {{#if appointment.appointmentType}} + ({{appointment.appointmentType}}) + {{/if}}, + {{/each}} +
+ {{/if}} + + {{else}} + + {{#if nextAppointment}} +
+ + {{date-format nextAppointment.startDate format="DD/MM/YYYY hh:mm a"}} + {{#if nextAppointment.location}} + ({{nextAppointment.location}}) + {{/if}} +
+ {{/if}} + + {{/if}} + + {{#if model.visit.patient.operativePlans.length}}
From f91deccd223e08f4ab5fc72a07bdd2ce57cdc4a9 Mon Sep 17 00:00:00 2001 From: chima1707 Date: Thu, 2 Mar 2017 12:18:44 +0100 Subject: [PATCH 4/5] fix: fix lint --- app/mixins/patient-visits.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/mixins/patient-visits.js b/app/mixins/patient-visits.js index 1f244935bd..4e93a6a12d 100644 --- a/app/mixins/patient-visits.js +++ b/app/mixins/patient-visits.js @@ -48,7 +48,7 @@ export default Ember.Mixin.create(PouchDbMixin, { } }); - return (outPatient) ? DS.PromiseArray.create({ promise}) : DS.PromiseObject.create({ promise }); + return (outPatient) ? DS.PromiseArray.create({ promise }) : DS.PromiseObject.create({ promise }); }, checkoutVisit(visit, status) { From 9765327483425e890ff80683d14b3b5fb901471c Mon Sep 17 00:00:00 2001 From: Adeola Badmus Date: Thu, 2 Mar 2017 13:05:20 +0100 Subject: [PATCH 5/5] FIx next appointments display --- app/reports/edit/template.hbs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/app/reports/edit/template.hbs b/app/reports/edit/template.hbs index b2f77d2378..01d1c37e8b 100644 --- a/app/reports/edit/template.hbs +++ b/app/reports/edit/template.hbs @@ -108,17 +108,20 @@
{{/if}} - {{log nextAppointment}} {{#if model.visit.outPatient}} {{#if nextAppointments.length}}
- - {{#each nextAppointments as |appointment|}} - {{date-format appointment.startDate format="DD/MM/YYYY hh:mm a"}} - {{#if appointment.appointmentType}} - ({{appointment.appointmentType}}) - {{/if}}, - {{/each}} + +
    + {{#each nextAppointments as |appointment|}} +
  • + {{date-format appointment.startDate format="DD/MM/YYYY hh:mm a"}} + {{#if appointment.appointmentType}} + ({{appointment.appointmentType}}) + {{/if}} +
  • + {{/each}} +
{{/if}}