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

Commit

Permalink
Fixed deprecations in appointments
Browse files Browse the repository at this point in the history
Resolves #185
  • Loading branch information
jkleinsc committed Oct 22, 2015
1 parent 0d46bf0 commit cb3186e
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 36 deletions.
4 changes: 2 additions & 2 deletions app/appointments/delete/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
});
2 changes: 0 additions & 2 deletions app/appointments/delete/template.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{{#modal-dialog
hideCancelButton=hideCancelButton
hideUpdateButton=hideUpdateButton
isUpdateDisabled=isUpdateDisabled
title=title
updateButtonAction=updateButtonAction
Expand Down
25 changes: 13 additions & 12 deletions app/appointments/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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'
}],

Expand All @@ -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',

Expand Down Expand Up @@ -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) {
Expand Down
10 changes: 5 additions & 5 deletions app/appointments/edit/template.hbs
Original file line number Diff line number Diff line change
@@ -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}}
<div class="row">
{{#if isAdmissionAppointment}}
Expand Down Expand Up @@ -67,13 +67,13 @@
}}
{{select-or-typeahead className="col-sm-6" property="provider"
label="With" list=physicianList
selection=provider
selection=model.provider
}}
</div>
<div class="row">
{{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
Expand Down
20 changes: 11 additions & 9 deletions app/appointments/search/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions app/appointments/search/template.hbs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{{#item-listing paginationProps=paginationProps }}
<div class="panel panel-info">
<div class="panel-body">
{{#em-form model=this submitButton=false }}
{{#em-form model=model submitButton=false }}
<div class="row">
{{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
}}
</div>
<div calss="row">
{{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
}}
</div>
Expand Down

0 comments on commit cb3186e

Please sign in to comment.