From 5a60565c36b875230ebfb27c2deecf703c9fb0e8 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Thu, 29 Oct 2015 16:07:32 -0400 Subject: [PATCH] Deprecation fixes for imaging. Fixes #186 --- app/imaging/charge/controller.js | 5 ++-- app/imaging/charge/template.hbs | 2 -- app/imaging/delete/template.hbs | 2 -- app/imaging/edit/controller.js | 42 +++++++++++++++++--------------- app/imaging/edit/template.hbs | 14 +++++------ 5 files changed, 31 insertions(+), 34 deletions(-) diff --git a/app/imaging/charge/controller.js b/app/imaging/charge/controller.js index 4adfff78a3..b7198020c8 100644 --- a/app/imaging/charge/controller.js +++ b/app/imaging/charge/controller.js @@ -2,9 +2,8 @@ import ProcedureChargeController from 'hospitalrun/procedures/charge/controller' import Ember from 'ember'; export default ProcedureChargeController.extend({ - needs: ['imaging/edit'], cancelAction: 'closeModal', newPricingItem: false, - requestingController: Ember.computed.alias('controllers.imaging/edit'), - pricingList: Ember.computed.alias('controllers.imaging/edit.chargesPricingList') + requestingController: Ember.inject.controllers('imaging/edit'), + pricingList: Ember.computed.alias('requestingController.chargesPricingList') }); diff --git a/app/imaging/charge/template.hbs b/app/imaging/charge/template.hbs index 36ff0c30bd..d863af105c 100644 --- a/app/imaging/charge/template.hbs +++ b/app/imaging/charge/template.hbs @@ -1,6 +1,4 @@ {{#modal-dialog - hideCancelButton=hideCancelButton - hideUpdateButton=hideUpdateButton isUpdateDisabled=isUpdateDisabled title=title updateButtonAction=updateButtonAction diff --git a/app/imaging/delete/template.hbs b/app/imaging/delete/template.hbs index 13717a97b0..41af09e873 100644 --- a/app/imaging/delete/template.hbs +++ b/app/imaging/delete/template.hbs @@ -1,6 +1,4 @@ {{#modal-dialog - hideCancelButton=hideCancelButton - hideUpdateButton=hideUpdateButton isUpdateDisabled=isUpdateDisabled title=title updateButtonAction=updateButtonAction diff --git a/app/imaging/edit/controller.js b/app/imaging/edit/controller.js index de409fb37e..067ccb6958 100644 --- a/app/imaging/edit/controller.js +++ b/app/imaging/edit/controller.js @@ -4,7 +4,8 @@ import Ember from 'ember'; import PatientSubmodule from 'hospitalrun/mixins/patient-submodule'; export default AbstractEditController.extend(ChargeActions, PatientSubmodule, { - needs: ['imaging'], + imagingController: Ember.inject.controller('imaging'), + chargePricingCategory: 'Imaging', chargeRoute: 'imaging.charge', selectedImagingType: null, @@ -22,38 +23,39 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, { actions: { completeImaging: function() { - this.set('status', 'Completed'); - this.get('model').validate().catch(Ember.K); - if (this.get('isValid')) { - this.set('imagingDate', new Date()); - this.send('update'); - } + this.set('model.status', 'Completed'); + this.get('model').validate().then(function() { + if (this.get('model.isValid')) { + this.set('model.imagingDate', new Date()); + this.send('update'); + } + }.bind(this)).catch(Ember.K); }, /** * Save the imaging request(s), creating multiples when user selects multiple imaging tests. */ update: function() { - if (this.get('isNew')) { + if (this.get('model.isNew')) { var newImaging = this.get('model'), selectedImagingType = this.get('selectedImagingType'); - if (Ember.isEmpty(this.get('status'))) { - this.set('status', 'Requested'); + if (Ember.isEmpty(this.get('model.status'))) { + this.set('model.status', 'Requested'); } - this.set('requestedBy', newImaging.getUserName()); - this.set('requestedDate', new Date()); + this.set('model.requestedBy', newImaging.getUserName()); + this.set('model.requestedDate', new Date()); if (Ember.isEmpty(selectedImagingType)) { - this.saveNewPricing(this.get('imagingTypeName'), 'Imaging', 'imagingType').then(function() { + this.saveNewPricing(this.get('model.imagingTypeName'), 'Imaging', 'model.imagingType').then(function() { this.addChildToVisit(newImaging, 'imaging', 'Imaging').then(function() { this.saveModel(); }.bind(this)); }.bind(this)); } else { - this.getSelectedPricing('model.selectedImagingType').then(function(pricingRecords) { + this.getSelectedPricing('selectedImagingType').then(function(pricingRecords) { if (Ember.isArray(pricingRecords)) { this.createMultipleRequests(pricingRecords, 'imagingType', 'imaging', 'Imaging'); } else { - this.set('imagingType', pricingRecords); + this.set('model.imagingType', pricingRecords); this.addChildToVisit(newImaging, 'imaging', 'Imaging').then(function() { this.saveModel(); }.bind(this)); @@ -81,16 +83,16 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, { lookupListsToUpdate: [{ name: 'radiologistList', - property: 'radiologist', + property: 'model.radiologist', id: 'radiologists' }], pricingTypeForObjectType: 'Imaging Procedure', - pricingTypes: Ember.computed.alias('controllers.imaging.imagingPricingTypes'), + pricingTypes: Ember.computed.alias('imagingController.imagingPricingTypes'), pricingList: null, // This gets filled in by the route - radiologistList: Ember.computed.alias('controllers.imaging.radiologistList'), + radiologistList: Ember.computed.alias('imagingController.radiologistList'), updateCapability: 'add_imaging', @@ -99,7 +101,7 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, { var afterDialogAction, alertTitle, alertMessage; - if (this.get('status') === 'Completed') { + if (this.get('model.status') === 'Completed') { alertTitle = 'Imaging Request Completed'; alertMessage = 'The imaging request has been completed.'; } else { @@ -110,7 +112,7 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, { afterDialogAction = this.get('cancelAction'); } this.saveVisitIfNeeded(alertTitle, alertMessage, afterDialogAction); - this.set('selectPatient', false); + this.set('model.selectPatient', false); } }); diff --git a/app/imaging/edit/template.hbs b/app/imaging/edit/template.hbs index 5b0c30962a..4c46a296e1 100644 --- a/app/imaging/edit/template.hbs +++ b/app/imaging/edit/template.hbs @@ -1,17 +1,17 @@ {{#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 patient-input"}} {{else}} - {{patient-summary patient=patient returnTo='imaging.edit' returnToContext=id disablePatientLink=isNew }} + {{patient-summary patient=model.patient returnTo='imaging.edit' returnToContext=model.id disablePatientLink=model.isNew }} {{/if}} - {{#if isNew}} + {{#if model.isNew}}
{{em-select class="col-xs-3 required" label="Visit" property="visit" content=patientVisitsForSelect optionValuePath="selectObject" optionLabelPath="selectObject.visitDescription" prompt="--Add New Visit--" - selected=visit + selected=model.visit }}
{{checkbox-or-typeahead property="imagingTypeName" @@ -28,11 +28,11 @@
-

{{visit.visitDate}}

+

{{model.visit.visitDate}}

-

{{imagingType.name}}

+

{{model.imagingType.name}}

{{/if}}