Skip to content

Commit

Permalink
fix: implemented next appointments on both template and controller
Browse files Browse the repository at this point in the history
  • Loading branch information
Chima1707 committed Mar 2, 2017
1 parent de35e44 commit bbdbd65
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 8 deletions.
6 changes: 4 additions & 2 deletions app/reports/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 {
Expand Down
35 changes: 29 additions & 6 deletions app/reports/edit/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,35 @@
</div>
{{/if}}

{{#if nextAppointment}}
<div class="ps-info-group">
<label class="ps-info-label">{{t 'reports.form.nextAppointmentDate' }}:</label>
{{date-format nextAppointment format="DD/MM/YYYY hh:mm a"}}
</div>
{{/if}}
{{log nextAppointment}}
{{#if model.visit.outPatient}}
{{#if nextAppointments.length}}
<div class="ps-info-group">
<label class="ps-info-label">{{t 'reports.form.nextAppointments' }}:</label>
{{#each nextAppointments as |appointment|}}
{{date-format appointment.startDate format="DD/MM/YYYY hh:mm a"}}
{{#if appointment.appointmentType}}
({{appointment.appointmentType}})
{{/if}},
{{/each}}
</div>
{{/if}}

{{else}}

{{#if nextAppointment}}
<div class="ps-info-group">
<label class="ps-info-label">{{t 'reports.form.nextAppointment' }}:</label>
{{date-format nextAppointment.startDate format="DD/MM/YYYY hh:mm a"}}
{{#if nextAppointment.location}}
({{nextAppointment.location}})
{{/if}}
</div>
{{/if}}

{{/if}}



{{#if model.visit.patient.operativePlans.length}}
<div class="ps-info-group">
Expand Down

0 comments on commit bbdbd65

Please sign in to comment.