From cb3186ed6b0a3f7df8609de748b882c229c22a71 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Thu, 22 Oct 2015 12:00:36 -0400 Subject: [PATCH] Fixed deprecations in appointments Resolves #185 --- app/appointments/delete/controller.js | 4 ++-- app/appointments/delete/template.hbs | 2 -- app/appointments/edit/controller.js | 25 +++++++++++++------------ app/appointments/edit/template.hbs | 10 +++++----- app/appointments/search/controller.js | 20 +++++++++++--------- app/appointments/search/template.hbs | 12 ++++++------ 6 files changed, 37 insertions(+), 36 deletions(-) diff --git a/app/appointments/delete/controller.js b/app/appointments/delete/controller.js index c1334b204a..e895cac8af 100644 --- a/app/appointments/delete/controller.js +++ b/app/appointments/delete/controller.js @@ -3,11 +3,11 @@ export default AbstractDeleteController.extend({ title: 'Delete Appointment', afterDeleteAction: function() { - var deleteFromPatient = this.get('deleteFromPatient'); + var deleteFromPatient = this.get('model.deleteFromPatient'); if (deleteFromPatient) { return 'appointmentDeleted'; } else { return 'closeModal'; } - }.property('deleteFromPatient') + }.property('model.deleteFromPatient') }); diff --git a/app/appointments/delete/template.hbs b/app/appointments/delete/template.hbs index b4d0c9627d..5683883911 100644 --- a/app/appointments/delete/template.hbs +++ b/app/appointments/delete/template.hbs @@ -1,6 +1,4 @@ {{#modal-dialog - hideCancelButton=hideCancelButton - hideUpdateButton=hideUpdateButton isUpdateDisabled=isUpdateDisabled title=title updateButtonAction=updateButtonAction diff --git a/app/appointments/edit/controller.js b/app/appointments/edit/controller.js index 29441152dd..c88a81cea5 100644 --- a/app/appointments/edit/controller.js +++ b/app/appointments/edit/controller.js @@ -5,7 +5,7 @@ import PatientSubmodule from 'hospitalrun/mixins/patient-submodule'; import VisitTypes from 'hospitalrun/mixins/visit-types'; export default AbstractEditController.extend(AppointmentStatuses, PatientSubmodule, VisitTypes, { - needs: ['appointments'], + appointmentsController: Ember.inject.controller('appointments'), dateFormat: 'l h:mm A', findPatientVisits: false, @@ -28,15 +28,15 @@ export default AbstractEditController.extend(AppointmentStatuses, PatientSubmodu return hourList; }.property(), - locationList: Ember.computed.alias('controllers.appointments.locationList'), + locationList: Ember.computed.alias('appointmentsController.locationList'), lookupListsToUpdate: [{ name: 'physicianList', - property: 'provider', + property: 'model.provider', id: 'physician_list' }, { name: 'locationList', - property: 'location', + property: 'model.location', id: 'visit_location_list' }], @@ -49,27 +49,28 @@ export default AbstractEditController.extend(AppointmentStatuses, PatientSubmodu return minuteList; }.property(), - physicianList: Ember.computed.alias('controllers.appointments.physicianList'), + physicianList: Ember.computed.alias('appointmentsController.physicianList'), showTime: true, - visitTypesList: Ember.computed.alias('controllers.appointments.visitTypeList'), + visitTypesList: Ember.computed.alias('appointmentsController.visitTypeList'), cancelAction: function() { - var returnTo = this.get('returnTo'); + var returnTo = this.get('model.returnTo'); if (Ember.isEmpty(returnTo)) { return this._super(); } else { return 'returnTo'; } - }.property('returnTo'), + }.property('model.returnTo'), isAdmissionAppointment: function() { - var appointmentType = this.get('appointmentType'), + var model = this.get('model'), + appointmentType = model.get('appointmentType'), isAdmissionAppointment = (appointmentType === 'Admission'); if (!isAdmissionAppointment) { - this.set('allDay', true); + model.set('allDay', true); } return isAdmissionAppointment; - }.property('appointmentType'), + }.property('model.appointmentType'), updateCapability: 'add_appointment', @@ -134,7 +135,7 @@ export default AbstractEditController.extend(AppointmentStatuses, PatientSubmodu }, _updateAppointmentDates: function() { - var allDay = this.get('allDay'), + var allDay = this.get('model.allDay'), isAdmissionAppointment = this.get('isAdmissionAppointment'), appointmentDate = this.get('model.appointmentDate'); if (!isAdmissionAppointment) { diff --git a/app/appointments/edit/template.hbs b/app/appointments/edit/template.hbs index 743dc4d32f..308e18160a 100644 --- a/app/appointments/edit/template.hbs +++ b/app/appointments/edit/template.hbs @@ -1,9 +1,9 @@ {{#edit-panel editPanelProps=editPanelProps}} - {{#em-form model=this submitButton=false }} - {{#if selectPatient}} + {{#em-form model=model submitButton=false }} + {{#if model.selectPatient}} {{patient-typeahead property="patientTypeAhead" label="Patient" content=patientList selection=selectedPatient class="required"}} {{else}} - {{patient-summary patient=patient returnTo='appointments.edit' returnToContext=id disablePatientLink=isNew }} + {{patient-summary patient=model.patient returnTo='appointments.edit' returnToContext=model.id disablePatientLink=model.isNew }} {{/if}}
{{#if isAdmissionAppointment}} @@ -67,13 +67,13 @@ }} {{select-or-typeahead className="col-sm-6" property="provider" label="With" list=physicianList - selection=provider + selection=model.provider }}
{{select-or-typeahead className="col-sm-6 required" property="location" label="Location" list=locationList - selection=location + selection=model.location }} {{em-select class="col-sm-3" property="status" label="Status" content=appointmentStatuses diff --git a/app/appointments/search/controller.js b/app/appointments/search/controller.js index 29a2e92ebf..6157d75eb1 100644 --- a/app/appointments/search/controller.js +++ b/app/appointments/search/controller.js @@ -4,32 +4,34 @@ import Ember from 'ember'; import SelectValues from 'hospitalrun/utils/select-values'; import VisitTypes from 'hospitalrun/mixins/visit-types'; export default AppointmentIndexController.extend(AppointmentStatuses, VisitTypes, { - needs: 'appointments', + appointmentsController: Ember.inject.controller('appointments'), appointmentType: null, - physicianList: Ember.computed.map('controllers.appointments.physicianList.value', SelectValues.selectValuesMap), + physicians: Ember.computed.alias('appointmentsController.physicianList.value'), + physicianList: function() { + return SelectValues.selectValues(this.get('physicians'), true); + }.property('physicians'), provider: null, queryParams: ['appointmentType', 'provider', 'status', 'startKey', 'startDate'], - searchFields: ['selectedAppointmentType', 'selectedProvider', 'selectedStatus', 'selectedStartDate'], selectedProvider: null, - selectedStartingDate: new Date(), selectedStatus: null, sortProperties: null, + startDate: null, startKey: [], status: null, - visitTypesList: Ember.computed.alias('controllers.appointments.visitTypeList'), + visitTypesList: Ember.computed.alias('appointmentsController.visitTypeList'), actions: { search: function() { - var appointmentType = this.get('selectedAppointmentType'), + var appointmentType = this.get('model.selectedAppointmentType'), fieldsToSet = { startKey: [], previousStartKey: null, previousStartKeys: [] }, - provider = this.get('selectedProvider'), - status = this.get('selectedStatus'), - startDate = this.get('selectedStartingDate'); + provider = this.get('model.selectedProvider'), + status = this.get('model.selectedStatus'), + startDate = this.get('model.selectedStartingDate'); if (Ember.isEmpty(appointmentType)) { fieldsToSet.appointmentType = null; diff --git a/app/appointments/search/template.hbs b/app/appointments/search/template.hbs index d0b51f2da8..3b4e53189f 100644 --- a/app/appointments/search/template.hbs +++ b/app/appointments/search/template.hbs @@ -1,18 +1,18 @@ {{#item-listing paginationProps=paginationProps }}
- {{#em-form model=this submitButton=false }} + {{#em-form model=model submitButton=false }}
{{date-picker property="selectedStartingDate" label="Show Appointments On Or After" class="col-sm-3"}} - {{em-select class="col-sm-3" prompt=" " property="selectedStatus" - label="Status" content=appointmentStatuses + {{em-select class="col-sm-3" property="selectedStatus" + label="Status" content=appointmentStatusesWithEmpty }}
- {{em-select class="col-sm-3" prompt=" " label="Type" - property="selectedAppointmentType" content=visitTypes + {{em-select class="col-sm-3" label="Type" + property="selectedAppointmentType" content=visitTypesWithEmpty }} - {{em-select class="col-sm-3" prompt=" " property="selectedProvider" + {{em-select class="col-sm-3" property="selectedProvider" label="With" content=physicianList }}