From 817ef8abdce23d3ed7f4e697a271beba0e85c7a4 Mon Sep 17 00:00:00 2001 From: Bj Date: Wed, 16 Nov 2016 20:27:04 -0500 Subject: [PATCH] [Cleanup] eslint `prefer-shorthand` --- app/adapters/application.js | 4 +- app/adapters/user.js | 20 ++-- app/admin/address/controller.js | 2 +- app/admin/address/route.js | 2 +- app/admin/loaddb/controller.js | 2 +- app/admin/loaddb/route.js | 4 +- app/admin/lookup/controller.js | 16 ++-- app/admin/lookup/edit/controller.js | 4 +- app/admin/lookup/route.js | 6 +- app/admin/query/controller.js | 2 +- app/admin/query/route.js | 2 +- app/admin/roles/controller.js | 2 +- app/admin/roles/route.js | 2 +- app/admin/workflow/controller.js | 2 +- app/admin/workflow/route.js | 2 +- app/appointments/edit/controller.js | 10 +- app/appointments/edit/route.js | 2 +- app/appointments/index/route.js | 6 +- app/appointments/route.js | 2 +- app/appointments/search/controller.js | 2 +- app/appointments/search/route.js | 4 +- app/appointments/today/route.js | 2 +- app/authenticators/custom.js | 20 ++-- app/components/action-checkbox.js | 2 +- app/components/checkbox-or-typeahead.js | 8 +- app/components/date-input.js | 10 +- app/components/edit-panel.js | 8 +- app/components/icd10-typeahead.js | 4 +- app/components/image-upload.js | 6 +- app/components/inventory-location-picker.js | 4 +- app/components/inventory-typeahead.js | 2 +- app/components/loading-message.js | 6 +- app/components/location-select.js | 2 +- app/components/modal-dialog.js | 8 +- app/components/nav-menu.js | 6 +- app/components/patient-summary.js | 4 +- app/components/patient-typeahead.js | 2 +- app/components/pricing-typeahead.js | 2 +- app/components/print-this.js | 2 +- app/components/quantity-calc.js | 4 +- app/components/search-listing.js | 2 +- app/components/take-photo.js | 32 +++---- app/components/text-search.js | 4 +- app/components/type-ahead.js | 8 +- app/controllers/abstract-delete-controller.js | 4 +- app/controllers/abstract-edit-controller.js | 20 ++-- app/controllers/abstract-paged-controller.js | 10 +- app/controllers/abstract-report-controller.js | 22 ++--- app/controllers/index.js | 2 +- app/controllers/login.js | 4 +- app/controllers/navigation.js | 12 +-- app/dialog/controller.js | 6 +- app/finishgauth/route.js | 4 +- app/imaging/delete/controller.js | 2 +- app/imaging/edit/controller.js | 6 +- app/imaging/edit/route.js | 4 +- app/imaging/index/route.js | 4 +- app/initializers/i18n.js | 2 +- app/inventory/adjust/controller.js | 4 +- app/inventory/barcode/controller.js | 2 +- app/inventory/barcode/route.js | 2 +- app/inventory/batch/controller.js | 22 ++--- app/inventory/batch/route.js | 4 +- app/inventory/edit/controller.js | 36 +++---- app/inventory/edit/route.js | 14 +-- app/inventory/index/route.js | 6 +- app/inventory/listing/route.js | 4 +- app/inventory/purchase/edit/controller.js | 4 +- app/inventory/quick-add/controller.js | 6 +- app/inventory/reports/controller.js | 70 +++++++------- app/inventory/reports/route.js | 2 +- app/inventory/request/controller.js | 16 ++-- app/inventory/request/route.js | 8 +- app/inventory/route.js | 10 +- app/inventory/transfer/controller.js | 4 +- app/invoices/add-line-item/controller.js | 4 +- app/invoices/edit/controller.js | 50 +++++----- app/invoices/edit/route.js | 12 +-- app/invoices/index/route.js | 4 +- app/invoices/payment/controller.js | 6 +- app/invoices/route.js | 8 +- app/labs/delete/controller.js | 2 +- app/labs/edit/controller.js | 6 +- app/labs/edit/route.js | 4 +- app/labs/index/route.js | 4 +- app/medication/delete/controller.js | 2 +- app/medication/edit/controller.js | 16 ++-- app/medication/edit/route.js | 6 +- app/medication/index/route.js | 4 +- app/medication/return/controller.js | 6 +- app/medication/return/route.js | 2 +- app/medication/route.js | 4 +- app/mixins/charge-actions.js | 26 ++--- app/mixins/charge-route.js | 6 +- app/mixins/date-format.js | 4 +- app/mixins/dob-days.js | 8 +- app/mixins/fulfill-request.js | 14 +-- app/mixins/inventory-id.js | 2 +- app/mixins/inventory-locations.js | 14 +-- app/mixins/location-name.js | 4 +- app/mixins/medication-details.js | 6 +- app/mixins/modal-helper.js | 10 +- app/mixins/number-format.js | 8 +- app/mixins/paging-actions.js | 8 +- app/mixins/patient-appointments.js | 2 +- app/mixins/patient-diagnosis.js | 6 +- app/mixins/patient-invoices.js | 2 +- app/mixins/patient-list-route.js | 8 +- app/mixins/patient-name.js | 4 +- app/mixins/patient-notes.js | 8 +- app/mixins/patient-submodule.js | 22 ++--- app/mixins/patient-visits.js | 2 +- app/mixins/pouch-adapter-utils.js | 2 +- app/mixins/progress-dialog.js | 8 +- app/mixins/result-validation.js | 2 +- app/mixins/user-session.js | 6 +- app/mixins/visit-types.js | 2 +- app/models/abstract.js | 2 +- app/models/appointment.js | 6 +- app/models/imaging.js | 2 +- app/models/inv-location.js | 4 +- app/models/inv-request.js | 6 +- app/models/inventory-batch.js | 8 +- app/models/inventory.js | 2 +- app/models/invoice.js | 4 +- app/models/lab.js | 2 +- app/models/medication.js | 10 +- app/models/photo.js | 2 +- app/models/proc-charge.js | 2 +- app/patients/add-contact/controller.js | 4 +- app/patients/admitted/route.js | 2 +- app/patients/delete/controller.js | 8 +- app/patients/edit/controller.js | 94 +++++++++---------- app/patients/edit/route.js | 22 ++--- app/patients/index/controller.js | 4 +- app/patients/index/route.js | 4 +- app/patients/notes/controller.js | 6 +- app/patients/photo/controller.js | 4 +- app/patients/quick-add/controller.js | 4 +- app/patients/reports/controller.js | 66 ++++++------- app/patients/reports/route.js | 2 +- app/patients/route.js | 2 +- app/patients/socialwork/expense/controller.js | 4 +- .../socialwork/family-info/controller.js | 4 +- app/pricing/edit/controller.js | 12 +-- app/pricing/edit/route.js | 6 +- app/pricing/imaging/route.js | 2 +- app/pricing/index/route.js | 6 +- app/pricing/lab/route.js | 2 +- app/pricing/override/controller.js | 4 +- app/pricing/procedure/route.js | 2 +- app/pricing/profiles/edit/controller.js | 4 +- app/pricing/profiles/route.js | 10 +- app/pricing/ward/route.js | 2 +- app/print/invoice/controller.js | 2 +- app/procedures/charge/controller.js | 4 +- app/procedures/edit/controller.js | 10 +- app/procedures/edit/route.js | 4 +- app/procedures/medication/controller.js | 4 +- app/routes/abstract-edit-route.js | 10 +- app/routes/abstract-index-route.js | 16 ++-- app/routes/abstract-module-route.js | 20 ++-- app/routes/abstract-search-route.js | 6 +- app/routes/application.js | 12 +-- app/routes/index.js | 2 +- app/routes/login.js | 2 +- app/serializers/user.js | 4 +- app/services/config.js | 6 +- app/services/database.js | 4 +- app/services/filesystem.js | 24 ++--- app/users/delete/controller.js | 2 +- app/users/edit/controller.js | 2 +- app/users/edit/route.js | 2 +- app/users/index/route.js | 2 +- app/users/route.js | 2 +- app/utils/date-sort.js | 2 +- app/utils/patient-validation.js | 2 +- app/utils/select-values.js | 8 +- app/visits/add-diagnosis/controller.js | 4 +- app/visits/edit/controller.js | 62 ++++++------ app/visits/edit/route.js | 6 +- app/visits/procedures/delete/controller.js | 2 +- app/visits/vitals/delete/controller.js | 2 +- app/visits/vitals/edit/controller.js | 4 +- tests/acceptance/admin-test.js | 4 +- tests/acceptance/appointments-test.js | 4 +- tests/acceptance/imaging-test.js | 4 +- tests/acceptance/inventory-test.js | 4 +- tests/acceptance/invoices-test.js | 4 +- tests/acceptance/labs-test.js | 4 +- tests/acceptance/login-test.js | 4 +- tests/acceptance/medication-test.js | 4 +- tests/acceptance/patient-notes-test.js | 4 +- tests/acceptance/patients-test.js | 4 +- tests/acceptance/pricing-test.js | 4 +- tests/acceptance/procedure-test.js | 4 +- tests/acceptance/role-test.js | 4 +- tests/acceptance/users-test.js | 4 +- tests/acceptance/visit-test.js | 4 +- 199 files changed, 754 insertions(+), 754 deletions(-) diff --git a/app/adapters/application.js b/app/adapters/application.js index f955f17e5b..552d639ea0 100644 --- a/app/adapters/application.js +++ b/app/adapters/application.js @@ -121,7 +121,7 @@ export default Adapter.extend(PouchAdapterUtils, { return haveSpecialCharacters; }, - _startChangesToStoreListener: function() { + _startChangesToStoreListener() { let db = this.get('db'); if (db) { this.changes = db.changes({ @@ -134,7 +134,7 @@ export default Adapter.extend(PouchAdapterUtils, { } }, - generateIdForRecord: function() { + generateIdForRecord() { return uuid.v4(); }, diff --git a/app/adapters/user.js b/app/adapters/user.js index a5c024812d..549c7e70c6 100644 --- a/app/adapters/user.js +++ b/app/adapters/user.js @@ -8,7 +8,7 @@ export default DS.RESTAdapter.extend(UserSession, { defaultSerializer: 'couchdb', oauthHeaders: Ember.computed.alias('database.oauthHeaders'), - ajaxError: function(jqXHR) { + ajaxError(jqXHR) { let error = this._super(jqXHR); if (jqXHR && jqXHR.status === 401) { let jsonErrors = Ember.$.parseJSON(jqXHR.responseText); @@ -27,7 +27,7 @@ export default DS.RESTAdapter.extend(UserSession, { @param {Object} options @return {Object} hash */ - ajaxOptions: function(url, type, options) { + ajaxOptions(url, type, options) { options = options || {}; options.xhrFields = { withCredentials: true }; return this._super(url, type, options); @@ -49,7 +49,7 @@ export default DS.RESTAdapter.extend(UserSession, { @param {DS.Model} record @returns {Promise} promise */ - createRecord: function(store, type, record) { + createRecord(store, type, record) { return this.updateRecord(store, type, record); }, @@ -61,7 +61,7 @@ export default DS.RESTAdapter.extend(UserSession, { @param {DS.Snapshot} record @returns {Promise} promise */ - deleteRecord: function(store, type, snapshot) { + deleteRecord(store, type, snapshot) { return this.updateRecord(store, type, snapshot, true); }, @@ -80,7 +80,7 @@ export default DS.RESTAdapter.extend(UserSession, { @param {String} id @returns {Promise} promise */ - find: function(store, type, id) { + find(store, type, id) { let findUrl = this.endpoint + id; return this.ajax(findUrl, 'GET'); }, @@ -111,7 +111,7 @@ export default DS.RESTAdapter.extend(UserSession, { @param {boolean} deleteUser true if we are deleting the user. @returns {Promise} promise */ - updateRecord: function(store, type, record, deleteUser) { + updateRecord(store, type, record, deleteUser) { let data = {}; let serializer = store.serializerFor(record.modelName); serializer.serializeIntoHash(data, type, record, { includeId: true }); @@ -127,7 +127,7 @@ export default DS.RESTAdapter.extend(UserSession, { data = this._cleanPasswordAttrs(data); let putURL = `${this.endpoint}${Ember.get(record, 'id')}`; return this.ajax(putURL, 'PUT', { - data: data + data }); }, @@ -145,7 +145,7 @@ export default DS.RESTAdapter.extend(UserSession, { @param {String} sinceToken //currently unused @returns {Promise} promise */ - findAll: function() { + findAll() { let ajaxData = { data: { include_docs: true, @@ -159,7 +159,7 @@ export default DS.RESTAdapter.extend(UserSession, { /** Remove null/empty password fields from payload sent to server */ - _cleanPasswordAttrs: function(data) { + _cleanPasswordAttrs(data) { let attrsToCheck = [ 'derived_key', 'password', @@ -176,7 +176,7 @@ export default DS.RESTAdapter.extend(UserSession, { return data; }, - shouldReloadAll: function() { + shouldReloadAll() { return true; } diff --git a/app/admin/address/controller.js b/app/admin/address/controller.js index f8fea7e317..c3c1fcbe7a 100644 --- a/app/admin/address/controller.js +++ b/app/admin/address/controller.js @@ -3,7 +3,7 @@ export default AbstractEditController.extend({ hideCancelButton: true, updateCapability: 'update_config', - afterUpdate: function() { + afterUpdate() { this.displayAlert(this.get('i18n').t('admin.address.titles.optionsSaved'), this.get('i18n').t('admin.address.messages.addressSaved')); } }); diff --git a/app/admin/address/route.js b/app/admin/address/route.js index dbf9f31e65..df0b357566 100644 --- a/app/admin/address/route.js +++ b/app/admin/address/route.js @@ -5,7 +5,7 @@ export default AbstractEditRoute.extend({ hideNewButton: true, newTitle: t('admin.address.newTitle'), editTitle: t('admin.address.editTitle'), - model: function() { + model() { return new Ember.RSVP.Promise(function(resolve) { this.get('store').find('option', 'address_options').then(function(addressOptions) { resolve(addressOptions); diff --git a/app/admin/loaddb/controller.js b/app/admin/loaddb/controller.js index 101be1c2dd..3bf3ded0e6 100644 --- a/app/admin/loaddb/controller.js +++ b/app/admin/loaddb/controller.js @@ -11,7 +11,7 @@ export default Ember.Controller.extend(ModalHelper, ProgressDialog, { fileImportedName: null, actions: { - loadFile: function() { + loadFile() { let fileSystem = this.get('fileSystem'); let fileToImport = this.get('importFile'); if (!fileToImport || !fileToImport.type) { diff --git a/app/admin/loaddb/route.js b/app/admin/loaddb/route.js index 3267d4ea05..6ddfc2b034 100644 --- a/app/admin/loaddb/route.js +++ b/app/admin/loaddb/route.js @@ -6,14 +6,14 @@ export default AbstractEditRoute.extend(UserSession, { hideNewButton: true, editTitle: t('admin.loaddb.editTitle'), - beforeModel: function() { + beforeModel() { if (!this.currentUserCan('load_db')) { this.transitionTo('application'); } }, // No model needed for import. - model: function() { + model() { return Ember.RSVP.resolve(Ember.Object.create({})); } }); diff --git a/app/admin/lookup/controller.js b/app/admin/lookup/controller.js index 7da34216c8..4ec9a59220 100644 --- a/app/admin/lookup/controller.js +++ b/app/admin/lookup/controller.js @@ -245,7 +245,7 @@ export default Ember.Controller.extend(BillingCategories, EKMixin, return (!Ember.isEmpty(lookupType) && lookupType.indexOf('pricing_types') > 0); }.property('model.lookupType'), - _canDeleteValue: function(value) { + _canDeleteValue(value) { let lookupType = this.get('model.lookupType'); switch (lookupType) { case 'inventory_types': { @@ -309,7 +309,7 @@ export default Ember.Controller.extend(BillingCategories, EKMixin, return true; }, - _sortValues: function(a, b) { + _sortValues(a, b) { return Ember.compare(a.toLowerCase(), b.toLowerCase()); }, @@ -323,12 +323,12 @@ export default Ember.Controller.extend(BillingCategories, EKMixin, }), actions: { - addValue: function() { + addValue() { this.send('openModal', 'admin.lookup.edit', Ember.Object.create({ isNew: true })); }, - deleteValue: function(value) { + deleteValue(value) { let lookupTypeList = this.get('lookupTypeList'); let lookupTypeValues = lookupTypeList.get('value'); if (this._canDeleteValue(value)) { @@ -336,7 +336,7 @@ export default Ember.Controller.extend(BillingCategories, EKMixin, lookupTypeList.save(); } }, - editValue: function(value) { + editValue(value) { if (!Ember.isEmpty(value)) { this.send('openModal', 'admin.lookup.edit', Ember.Object.create({ isNew: false, @@ -345,7 +345,7 @@ export default Ember.Controller.extend(BillingCategories, EKMixin, })); } }, - importList: function() { + importList() { let fileSystem = this.get('fileSystem'); let fileToImport = this.get('importFile'); let lookupTypeList = this.get('lookupTypeList'); @@ -377,7 +377,7 @@ export default Ember.Controller.extend(BillingCategories, EKMixin, }.bind(this)); } }, - updateList: function() { + updateList() { let lookupTypeList = this.get('lookupTypeList'); lookupTypeList.set('userCanAdd', this.get('model.userCanAdd')); lookupTypeList.set('organizeByType', this.get('model.organizeByType')); @@ -388,7 +388,7 @@ export default Ember.Controller.extend(BillingCategories, EKMixin, ); }.bind(this)); }, - updateValue: function(valueObject) { + updateValue(valueObject) { let updateList = false; let lookupTypeList = this.get('lookupTypeList'); let lookupTypeValues = this.get('lookupTypeValues'); diff --git a/app/admin/lookup/edit/controller.js b/app/admin/lookup/edit/controller.js index ef9d34ffc9..4afc99d588 100644 --- a/app/admin/lookup/edit/controller.js +++ b/app/admin/lookup/edit/controller.js @@ -15,11 +15,11 @@ export default Ember.Controller.extend(IsUpdateDisabled, { }.property('model.isNew'), actions: { - cancel: function() { + cancel() { this.send('closeModal'); }, - update: function() { + update() { if (!Ember.isEmpty(this.get('model.value'))) { this.get('editController').send('updateValue', this.get('model')); this.send('closeModal'); diff --git a/app/admin/lookup/route.js b/app/admin/lookup/route.js index 0cb5b34177..8be1ecd2a8 100644 --- a/app/admin/lookup/route.js +++ b/app/admin/lookup/route.js @@ -3,16 +3,16 @@ import { translationMacro as t } from 'ember-i18n'; export default AbstractIndexRoute.extend({ hideNewButton: true, pageTitle: t('admin.lookup.pageTitle'), - model: function() { + model() { return this.store.findAll('lookup'); }, - afterModel: function(model) { + afterModel(model) { model.set('lookupType', 'anesthesia_types'); }, actions: { - refreshLookupLists: function() { + refreshLookupLists() { this.refresh(); } } diff --git a/app/admin/query/controller.js b/app/admin/query/controller.js index 82e7098eff..faedb8c959 100644 --- a/app/admin/query/controller.js +++ b/app/admin/query/controller.js @@ -27,7 +27,7 @@ export default Ember.Controller.extend(EditPanelProps, { objectTypes: Ember.computed.map('objectTypeList', SelectValues.selectValuesMap), actions: { - query: function() { + query() { let fieldName = this.get('fieldName'); let objectType = this.get('objectType'); let queryValue = this.get('queryValue'); diff --git a/app/admin/query/route.js b/app/admin/query/route.js index 12b0ac29dc..5f071d77bb 100644 --- a/app/admin/query/route.js +++ b/app/admin/query/route.js @@ -2,7 +2,7 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout import Ember from 'ember'; import UserSession from 'hospitalrun/mixins/user-session'; export default Ember.Route.extend(UserSession, AuthenticatedRouteMixin, { - beforeModel: function() { + beforeModel() { if (!this.currentUserCan('query_db')) { this.transitionTo('application'); } diff --git a/app/admin/roles/controller.js b/app/admin/roles/controller.js index 3491e18c3e..40a5f30c8e 100644 --- a/app/admin/roles/controller.js +++ b/app/admin/roles/controller.js @@ -107,7 +107,7 @@ export default AbstractEditController.extend(UserRoles, UserSession, { let mappedCapabilities = []; section.capabilities.forEach((key) => { mappedCapabilities.push({ - key: key, + key, name: this.get('i18n').t(`admin.roles.capability.${key}`) }); }); diff --git a/app/admin/roles/route.js b/app/admin/roles/route.js index 8edf952607..2bccaa39fb 100644 --- a/app/admin/roles/route.js +++ b/app/admin/roles/route.js @@ -4,7 +4,7 @@ export default AbstractEditRoute.extend({ hideNewButton: true, newTitle: t('admin.userRoles'), editTitle: t('admin.userRoles'), - model: function() { + model() { return this.get('store').findAll('user-role'); } }); diff --git a/app/admin/workflow/controller.js b/app/admin/workflow/controller.js index 273f2820fb..afada008aa 100644 --- a/app/admin/workflow/controller.js +++ b/app/admin/workflow/controller.js @@ -3,7 +3,7 @@ export default AbstractEditController.extend({ hideCancelButton: true, updateCapability: 'update_config', - afterUpdate: function() { + afterUpdate() { this.displayAlert(this.get('i18n').t('admin.workflow.titles.optionsSaved'), this.get('i18n').t('admin.workflow.messages.optionsSaved')); } }); diff --git a/app/admin/workflow/route.js b/app/admin/workflow/route.js index 775a079003..05babaa3d6 100644 --- a/app/admin/workflow/route.js +++ b/app/admin/workflow/route.js @@ -4,7 +4,7 @@ export default AbstractEditRoute.extend({ hideNewButton: true, editTitle: t('admin.workflow.editTitle'), - model: function() { + model() { let store = this.get('store'); return store.find('option', 'workflow_options').catch(function() { // create a new workflow_option if none exists diff --git a/app/appointments/edit/controller.js b/app/appointments/edit/controller.js index c187815d02..08b038476f 100644 --- a/app/appointments/edit/controller.js +++ b/app/appointments/edit/controller.js @@ -80,11 +80,11 @@ export default AbstractEditController.extend(AppointmentStatuses, PatientSubmodu updateCapability: 'add_appointment', - afterUpdate: function() { + afterUpdate() { this.send(this.get('cancelAction')); }, - beforeUpdate: function() { + beforeUpdate() { this._updateAppointmentDates(); return Ember.RSVP.Promise.resolve(); }, @@ -130,14 +130,14 @@ export default AbstractEditController.extend(AppointmentStatuses, PatientSubmodu this._updateDate('startMinute', 'startDate'); }.observes('startMinute'), - _updateAllTimes: function() { + _updateAllTimes() { this.endHourChanged(); this.endMinuteChanged(); this.startMinuteChanged(); this.startHourChanged(); }, - _updateAppointmentDates: function() { + _updateAppointmentDates() { let allDay = this.get('model.allDay'); let isAdmissionAppointment = this.get('isAdmissionAppointment'); let appointmentDate = this.get('model.appointmentDate'); @@ -150,7 +150,7 @@ export default AbstractEditController.extend(AppointmentStatuses, PatientSubmodu } }, - _updateDate: function(fieldName, dateFieldName) { + _updateDate(fieldName, dateFieldName) { let model = this.get('model'); let fieldValue = this.get(fieldName); let dateToChange = model.get(dateFieldName); diff --git a/app/appointments/edit/route.js b/app/appointments/edit/route.js index 4b3e0a604b..be20c36b46 100644 --- a/app/appointments/edit/route.js +++ b/app/appointments/edit/route.js @@ -8,7 +8,7 @@ export default AbstractEditRoute.extend(PatientListRoute, { modelName: 'appointment', newTitle: t('appointments.newTitle'), - getNewData: function() { + getNewData() { return Ember.RSVP.resolve({ appointmentType: 'Admission', allDay: true, diff --git a/app/appointments/index/route.js b/app/appointments/index/route.js index 3233a072f0..29b5d3e612 100644 --- a/app/appointments/index/route.js +++ b/app/appointments/index/route.js @@ -6,7 +6,7 @@ export default AbstractIndexRoute.extend({ modelName: 'appointment', pageTitle: t('appointments.thisWeek'), - _getStartKeyFromItem: function(item) { + _getStartKeyFromItem(item) { let endDate = item.get('endDate'); let id = this._getPouchIdFromItem(item); let startDate = item.get('startDate'); @@ -26,7 +26,7 @@ export default AbstractIndexRoute.extend({ return [startDate, endDate, id]; }, - _modelQueryParams: function() { + _modelQueryParams() { let endOfWeek = moment().endOf('week').toDate().getTime(); let startOfWeek = moment().startOf('week').toDate().getTime(); let maxId = this._getMaxPouchId(); @@ -40,7 +40,7 @@ export default AbstractIndexRoute.extend({ }, actions: { - editAppointment: function(appointment) { + editAppointment(appointment) { appointment.set('returnTo', this.get('editReturn')); this.send('editItem', appointment); } diff --git a/app/appointments/route.js b/app/appointments/route.js index db7971d922..ffed931a17 100644 --- a/app/appointments/route.js +++ b/app/appointments/route.js @@ -13,7 +13,7 @@ export default AbstractModuleRoute.extend(UserSession, { sectionTitle: t('appointments.sectionTitle'), actions: { - createVisit: function(appointment) { + createVisit(appointment) { let visitProps = appointment.getProperties('startDate', 'endDate', 'location', 'patient'); visitProps.visitType = appointment.get('appointmentType'); visitProps.examiner = appointment.get('provider'); diff --git a/app/appointments/search/controller.js b/app/appointments/search/controller.js index d5385a0895..8b981ac2c5 100644 --- a/app/appointments/search/controller.js +++ b/app/appointments/search/controller.js @@ -22,7 +22,7 @@ export default AppointmentIndexController.extend(AppointmentStatuses, VisitTypes visitTypesList: Ember.computed.alias('appointmentsController.visitTypesList'), actions: { - search: function() { + search() { let appointmentType = this.get('model.selectedAppointmentType'); let fieldsToSet = { startKey: [], diff --git a/app/appointments/search/route.js b/app/appointments/search/route.js index 3d5f302a16..542b8ee2d7 100644 --- a/app/appointments/search/route.js +++ b/app/appointments/search/route.js @@ -17,7 +17,7 @@ export default AppointmentIndexRoute.extend(DateFormat, { startKey: { refreshModel: true } }, - _modelQueryParams: function(params) { + _modelQueryParams(params) { let { startDate } = params; let maxValue = this.get('maxValue'); if (Ember.isEmpty(startDate)) { @@ -36,7 +36,7 @@ export default AppointmentIndexRoute.extend(DateFormat, { }; }, - model: function(params) { + model(params) { return this._super(params).then(function(model) { model.setProperties({ selectedAppointmentType: params.appointmentType, diff --git a/app/appointments/today/route.js b/app/appointments/today/route.js index c96050acad..99bf32d9a1 100644 --- a/app/appointments/today/route.js +++ b/app/appointments/today/route.js @@ -5,7 +5,7 @@ export default AppointmentIndexRoute.extend({ modelName: 'appointment', pageTitle: t('appointments.todayTitle'), - _modelQueryParams: function() { + _modelQueryParams() { let endOfDay = moment().endOf('day').toDate().getTime(); let maxValue = this.get('maxValue'); let startOfDay = moment().startOf('day').toDate().getTime(); diff --git a/app/authenticators/custom.js b/app/authenticators/custom.js index bda9ea53b1..5004a8cf78 100644 --- a/app/authenticators/custom.js +++ b/app/authenticators/custom.js @@ -10,13 +10,13 @@ export default BaseAuthenticator.extend({ @method absolutizeExpirationTime @private */ - _absolutizeExpirationTime: function(expiresIn) { + _absolutizeExpirationTime(expiresIn) { if (!Ember.isEmpty(expiresIn)) { return new Date((new Date().getTime()) + (expiresIn - 5) * 1000).getTime(); } }, - _checkUser: function(user) { + _checkUser(user) { return new Ember.RSVP.Promise((resolve, reject) => { this._makeRequest('POST', { name: user.name }, '/chkuser').then((response) => { if (response.error) { @@ -33,7 +33,7 @@ export default BaseAuthenticator.extend({ }); }, - _getPromise: function(type, data) { + _getPromise(type, data) { return new Ember.RSVP.Promise(function(resolve, reject) { this._makeRequest(type, data).then(function(response) { Ember.run(function() { @@ -47,14 +47,14 @@ export default BaseAuthenticator.extend({ }.bind(this)); }, - _makeRequest: function(type, data, url) { + _makeRequest(type, data, url) { if (!url) { url = this.serverEndpoint; } return Ember.$.ajax({ - url: url, - type: type, - data: data, + url, + type, + data, dataType: 'json', contentType: 'application/x-www-form-urlencoded', xhrFields: { @@ -69,7 +69,7 @@ export default BaseAuthenticator.extend({ @param {Object} credentials The credentials to authenticate the session with @return {Ember.RSVP.Promise} A promise that resolves when an access token is successfully acquired from the server and rejects otherwise */ - authenticate: function(credentials) { + authenticate(credentials) { if (credentials.google_auth) { this.useGoogleAuth = true; let sessionCredentials = { @@ -106,7 +106,7 @@ export default BaseAuthenticator.extend({ }); }, - invalidate: function() { + invalidate() { if (this.useGoogleAuth) { return new Ember.RSVP.resolve(); } else { @@ -114,7 +114,7 @@ export default BaseAuthenticator.extend({ } }, - restore: function(data) { + restore(data) { return new Ember.RSVP.Promise((resolve, reject) => { let now = (new Date()).getTime(); if (!Ember.isEmpty(data.expires_at) && data.expires_at < now) { diff --git a/app/components/action-checkbox.js b/app/components/action-checkbox.js index 2cba369bc6..1dd85c2dd6 100644 --- a/app/components/action-checkbox.js +++ b/app/components/action-checkbox.js @@ -10,7 +10,7 @@ export default Ember.Component.extend({ this.set('checked', this.$().prop('checked')); }.on('didInsertElement'), - change: function() { + change() { this._updateElementValue(); this.sendAction('action', this.get('value'), this.get('checked')); } diff --git a/app/components/checkbox-or-typeahead.js b/app/components/checkbox-or-typeahead.js index 67ededdb38..eccd69f980 100644 --- a/app/components/checkbox-or-typeahead.js +++ b/app/components/checkbox-or-typeahead.js @@ -4,17 +4,17 @@ export default SelectOrTypeahead.extend({ checkboxesPerRow: 5, model: null, - _getLabelFromContent: function(object) { + _getLabelFromContent(object) { let optionLabelPath = this.get('optionLabelPath'); return Ember.get(object, optionLabelPath); }, - _getValueFromContent: function(object) { + _getValueFromContent(object) { let optionValuePath = this.get('optionValuePath'); return Ember.get(object, optionValuePath); }, - _mapCheckboxValues: function(value) { + _mapCheckboxValues(value) { return { label: this._getLabelFromContent(value), value: this._getValueFromContent(value) @@ -45,7 +45,7 @@ export default SelectOrTypeahead.extend({ }.property('content', 'checkboxesPerRow'), actions: { - checkboxChanged: function(value, checked) { + checkboxChanged(value, checked) { let property = this.get('property'); let propertyName = `model.${property}`; let selectedValues = this.get(propertyName); diff --git a/app/components/date-input.js b/app/components/date-input.js index 643dcccbe2..4b8630fa0d 100644 --- a/app/components/date-input.js +++ b/app/components/date-input.js @@ -3,13 +3,13 @@ import HtmlInput from 'ember-rapid-forms/components/html-input'; export default HtmlInput.extend({ _picker: null, - _shouldSetDate: function(currentDate, picker) { + _shouldSetDate(currentDate, picker) { return (picker && (Ember.isEmpty(currentDate) || Ember.isEmpty(picker.getDate()) || (currentDate.getTime && picker.getDate().getTime() !== currentDate.getTime()))); }, - currentDateChangedValue: function() { + currentDateChangedValue() { let currentDate = this.get('currentDate'); let picker = this.get('_picker'); if (!Ember.isEmpty(currentDate) && this._shouldSetDate(currentDate, picker)) { @@ -34,7 +34,7 @@ export default HtmlInput.extend({ } }.observes('mainComponent.showTime'), - dateSet: function() { + dateSet() { let currentDate = this.get('currentDate'); let picker = this.get('_picker'); if (this._shouldSetDate(currentDate, picker)) { @@ -42,7 +42,7 @@ export default HtmlInput.extend({ } }, - didInsertElement: function() { + didInsertElement() { let currentDate = this.get('currentDate'); let $input = this.$('input'); let picker = null; @@ -85,7 +85,7 @@ export default HtmlInput.extend({ Ember.Binding.from(`mainComponent.model.errors.${dateProperty}`).to(`mainComponent.model.errors.${displayPropertyName}`).connect(this); }, - willDestroyElement: function() { + willDestroyElement() { let picker = this.get('_picker'); if (picker) { picker.destroy(); diff --git a/app/components/edit-panel.js b/app/components/edit-panel.js index 6bb98fa21d..198f6d1823 100644 --- a/app/components/edit-panel.js +++ b/app/components/edit-panel.js @@ -4,17 +4,17 @@ export default Ember.Component.extend({ cancelAction: 'cancel', actions: { - cancel: function() { + cancel() { this.sendAction('cancelAction'); }, - disabledAction: function() { + disabledAction() { this.sendAction('editPanelProps.disabledAction'); }, - fireButtonAction: function(buttonAction) { + fireButtonAction(buttonAction) { this.set(buttonAction, buttonAction); this.sendAction(buttonAction); }, - updateButtonAction: function() { + updateButtonAction() { this.sendAction('editPanelProps.updateButtonAction'); } } diff --git a/app/components/icd10-typeahead.js b/app/components/icd10-typeahead.js index 6af2f51d4a..65443ad055 100644 --- a/app/components/icd10-typeahead.js +++ b/app/components/icd10-typeahead.js @@ -8,7 +8,7 @@ export default TypeAhead.extend({ header: '' }, - _sourceQuery: function(query, cb) { // Custom source function + _sourceQuery(query, cb) { // Custom source function // Get the data from the Blodhound engine and process it. this.bloodhound.get(query, function(suggestions) { cb(suggestions); @@ -18,7 +18,7 @@ export default TypeAhead.extend({ }.bind(this)); }, - _getSource: function() { + _getSource() { return this._sourceQuery.bind(this); } }); diff --git a/app/components/image-upload.js b/app/components/image-upload.js index 4c57f03a91..8b7935aa60 100644 --- a/app/components/image-upload.js +++ b/app/components/image-upload.js @@ -5,7 +5,7 @@ export default InputComponent.extend({ selectedFile: null, type: 'file', - _fileChanged: function() { + _fileChanged() { let inputEl = this.get('fileInputEl'); let resize = this.get('resizeFile'); @@ -31,7 +31,7 @@ export default InputComponent.extend({ * Resize the image to no larger than 1024px so that file sizes * are not too large. */ - _resizeImage: function(img) { + _resizeImage(img) { // Derived from https://github.com/josefrichter/resize/blob/master/public/preprocess.js let canvas = document.createElement('canvas'); let { height, width } = img; @@ -68,7 +68,7 @@ export default InputComponent.extend({ return new Blob([new Uint8Array(array)], { type: 'image/png' }); }, - didInsertElement: function() { + didInsertElement() { let $input = this.$('input'); this.set('fileInputEl', $input[0]); $input.on('change', this._fileChanged.bind(this)); diff --git a/app/components/inventory-location-picker.js b/app/components/inventory-location-picker.js index 2886b385b5..805b5d085c 100644 --- a/app/components/inventory-location-picker.js +++ b/app/components/inventory-location-picker.js @@ -7,7 +7,7 @@ export default Ember.Component.extend({ locationList: null, quantityRequested: null, - locationChange: function() { + locationChange() { let doingSetup = this.get('doingSetup'); let locationList = this.get('locationList'); let locationPickers = this.get('calculatedLocationPickers'); @@ -48,7 +48,7 @@ export default Ember.Component.extend({ Ember.Binding.from('selectedLocations').to('componentSelectedLocations').connect(this); }.on('init'), - _setupLocationPickers: function(locationPickers, locationList, setInitialLocation) { + _setupLocationPickers(locationPickers, locationList, setInitialLocation) { locationPickers.reduce(function(previousValue, item) { let selectedLocation = item.get('selectedLocation'); item.set('subLocationList', previousValue.map(SelectValues.selectObjectMap)); diff --git a/app/components/inventory-typeahead.js b/app/components/inventory-typeahead.js index f16671e996..c348b60654 100644 --- a/app/components/inventory-typeahead.js +++ b/app/components/inventory-typeahead.js @@ -4,7 +4,7 @@ export default TypeAhead.extend({ classNameBindings: ['haveInventoryItems'], displayKey: 'name', showQuantity: true, - _mapInventoryItems: function(item) { + _mapInventoryItems(item) { let returnObj = {}; if (this.get('showQuantity') && item.quantity) { returnObj.name = `${item.name} - ${item.friendlyId} (${item.quantity} available)`; diff --git a/app/components/loading-message.js b/app/components/loading-message.js index 833fc838b2..6896f3ffc1 100644 --- a/app/components/loading-message.js +++ b/app/components/loading-message.js @@ -18,18 +18,18 @@ export default Ember.Component.extend({ t('loading.messages.11') ], - _setRandomMessage: function() { + _setRandomMessage() { let loadingMessages = this.get('loadingMessages'); let idx = Math.floor(Math.random() * loadingMessages.length); this.set('message', loadingMessages[idx]); this.set('timer', Ember.run.later(this, this._setRandomMessage, 1000)); }, - didInsertElement: function() { + didInsertElement() { this._setRandomMessage(); }, - willDestroyElement: function() { + willDestroyElement() { let timer = this.get('timer'); if (!Ember.isEmpty(timer)) { Ember.run.cancel(timer); diff --git a/app/components/location-select.js b/app/components/location-select.js index 039ce46f30..1d44ebc8b0 100644 --- a/app/components/location-select.js +++ b/app/components/location-select.js @@ -6,7 +6,7 @@ export default Ember.Component.extend({ this.locationChange = this.currentLocationChanged.bind(this); }.on('init'), - currentLocationChanged: function(newLocation) { + currentLocationChanged(newLocation) { this.get('locationPicker').set('selectedLocation', newLocation); Ember.run.once(this, function() { this.get('parentView').locationChange(); diff --git a/app/components/modal-dialog.js b/app/components/modal-dialog.js index 6b935879e2..7fc90478d1 100644 --- a/app/components/modal-dialog.js +++ b/app/components/modal-dialog.js @@ -20,15 +20,15 @@ export default Ember.Component.extend({ } }.property('cancelButtonText'), actions: { - cancelAction: function() { + cancelAction() { this.sendAction('cancelAction'); }, - updateAction: function() { + updateAction() { this.sendAction('updateButtonAction'); } }, - didInsertElement: function() { + didInsertElement() { let $modal = this.$('.modal').modal(); $modal.on('hidden.bs.modal', function() { @@ -36,7 +36,7 @@ export default Ember.Component.extend({ }.bind(this)); }, - willDestroyElement: function() { + willDestroyElement() { let $modal = this.$('.modal'); $modal.off('hidden.bs.modal'); $modal.modal('hide'); diff --git a/app/components/nav-menu.js b/app/components/nav-menu.js index fc9bf21de5..d13b2614f3 100644 --- a/app/components/nav-menu.js +++ b/app/components/nav-menu.js @@ -21,7 +21,7 @@ export default Ember.Component.extend(UserSession, { this._setupSubNav(); }.on('init'), - _setupSubNav: function() { + _setupSubNav() { let nav = this.get('nav'); nav.subnav.forEach((item) => { item.show = this.currentUserCan(item.capability); @@ -32,12 +32,12 @@ export default Ember.Component.extend(UserSession, { callCloseSettings: 'closeSettings', actions: { - toggleContent: function() { + toggleContent() { this.set('isShowing', !this.get('isShowing')); this.sendAction('callNavAction', this.nav); }, - resetNav: function() { + resetNav() { this.sendAction('callCloseSettings'); } } diff --git a/app/components/patient-summary.js b/app/components/patient-summary.js index e805e26fb5..a376d5c404 100644 --- a/app/components/patient-summary.js +++ b/app/components/patient-summary.js @@ -40,7 +40,7 @@ export default Ember.Component.extend(PatientDiagnosis, { }.property('disablePatientLink'), actions: { - linkToPatient: function() { + linkToPatient() { let shouldLink = this.get('shouldLinkToPatient'); if (shouldLink) { let patient = this.get('patient'); @@ -51,7 +51,7 @@ export default Ember.Component.extend(PatientDiagnosis, { this.sendAction('showPatientAction', this.get('patient')); } }, - editProcedure: function(procedure) { + editProcedure(procedure) { procedure.set('returnToVisit', false); procedure.set('returnToPatient', true); procedure.set('patient', this.get('patient')); diff --git a/app/components/patient-typeahead.js b/app/components/patient-typeahead.js index bb5c057122..3be5e9b2c9 100644 --- a/app/components/patient-typeahead.js +++ b/app/components/patient-typeahead.js @@ -5,7 +5,7 @@ export default TypeAhead.extend(PatientName, { displayKey: 'name', setOnBlur: true, - _mapPatient: function(item) { + _mapPatient(item) { let returnObj = {}; returnObj.name = `${this.getPatientDisplayName(item)} - ${this.getPatientDisplayId(item)}`; returnObj[this.get('selectionKey')] = item; diff --git a/app/components/pricing-typeahead.js b/app/components/pricing-typeahead.js index ea2a9b5f16..6faef62d97 100644 --- a/app/components/pricing-typeahead.js +++ b/app/components/pricing-typeahead.js @@ -4,7 +4,7 @@ export default TypeAhead.extend({ displayKey: 'name', setOnBlur: true, - _mapContentItems: function() { + _mapContentItems() { let content = this.get('content'); if (content) { let mapped = content.filter(function(item) { diff --git a/app/components/print-this.js b/app/components/print-this.js index 0a08dc8147..a535c3e52d 100644 --- a/app/components/print-this.js +++ b/app/components/print-this.js @@ -1,6 +1,6 @@ import Ember from 'ember'; export default Ember.Component.extend({ - didInsertElement: function() { + didInsertElement() { Ember.run.scheduleOnce('afterRender', this, function() { window.print(); }); diff --git a/app/components/quantity-calc.js b/app/components/quantity-calc.js index c585e01ce3..a6d475bb6a 100644 --- a/app/components/quantity-calc.js +++ b/app/components/quantity-calc.js @@ -41,7 +41,7 @@ export default Ember.Component.extend({ return quantityGroups; }.property('quantityGroups', 'targetUnit'), - calculateTotal: function() { + calculateTotal() { let quantityGroups = this.get('quantityGroups'); let haveQuantities = false; let lastObject = quantityGroups.get('lastObject'); @@ -60,7 +60,7 @@ export default Ember.Component.extend({ } }, - updateCurrentUnit: function(selectedUnit, index) { + updateCurrentUnit(selectedUnit, index) { let targetUnit = this.get('targetUnit'); let quantityGroups = this.get('quantityGroups'); let groupLength = quantityGroups.length; diff --git a/app/components/search-listing.js b/app/components/search-listing.js index 8db01ccc65..9641b44268 100644 --- a/app/components/search-listing.js +++ b/app/components/search-listing.js @@ -2,7 +2,7 @@ import Ember from 'ember'; export default Ember.Component.extend({ action: 'allItems', actions: { - allItems: function() { + allItems() { this.sendAction(); } } diff --git a/app/components/take-photo.js b/app/components/take-photo.js index 7041bd0228..21f90b8182 100644 --- a/app/components/take-photo.js +++ b/app/components/take-photo.js @@ -24,7 +24,7 @@ export default Ember.Component.extend({ /** * Setup the specified camera */ - _cameraChange: function(selectedCamera) { + _cameraChange(selectedCamera) { this.set('selectedCamera', selectedCamera); let stream = this.get('stream'); let video = this.get('video'); @@ -43,14 +43,14 @@ export default Ember.Component.extend({ this._setupVideo(); }, - _errorCallback: function(error) { + _errorCallback(error) { console.log('navigator.getUserMedia error: ', error); }, /** * Callback for MediaStreamTrack.getSources */ - _gotSources: function(sourceInfos) { + _gotSources(sourceInfos) { let cameraCount = 0; let cameraLabel; let videoSources = []; @@ -77,7 +77,7 @@ export default Ember.Component.extend({ /** * Callback handler for getUserMedia. */ - _gotStream: function(stream) { + _gotStream(stream) { if (this.isDestroyed) { this._stopStream(stream); } else { @@ -88,7 +88,7 @@ export default Ember.Component.extend({ } }, - _photoSourceChanged: function(photoSource) { + _photoSourceChanged(photoSource) { let camera = this.$('.camera'); let fileUpload = this.$('.fileupload'); let setupCamera = this.get('setupCamera'); @@ -104,9 +104,9 @@ export default Ember.Component.extend({ let photo = this.$('img').get(0); let video = this.$('video').get(0); this.setProperties({ - canvas: canvas, - photo: photo, - video: video + canvas, + photo, + video }); if (typeof MediaStreamTrack === 'undefined' || MediaStreamTrack.getSources === 'undefined') { if (navigator.getUserMedia) { @@ -122,7 +122,7 @@ export default Ember.Component.extend({ } }, - _setupCanPlayListener: function(video) { + _setupCanPlayListener(video) { // Remove listener if it was already added before. video.removeEventListener('canplay', this._setupVideo.bind(this), false); video.addEventListener('canplay', this._setupVideo.bind(this), false); @@ -131,7 +131,7 @@ export default Ember.Component.extend({ /** * Setup the dimensions for the video preview and picture elements. */ - _setupVideo: function() { + _setupVideo() { let canvas = this.get('canvas'); let height = this.get('height'); let video = this.get('video'); @@ -142,8 +142,8 @@ export default Ember.Component.extend({ canvas.setAttribute('width', width); canvas.setAttribute('height', height); this.setProperties({ - height: height, - width: width + height, + width }); }, @@ -157,7 +157,7 @@ export default Ember.Component.extend({ this.set('photoSource', photoSource); }.on('init'), - _stopStream: function(stream) { + _stopStream(stream) { let streamToStop = stream || this.get('stream'); if (!Ember.isEmpty(streamToStop)) { if (typeof streamToStop.active === 'undefined') { @@ -170,7 +170,7 @@ export default Ember.Component.extend({ }, actions: { - takePhoto: function() { + takePhoto() { let canvas = this.get('canvas'); let height = this.get('height'); let video = this.get('video'); @@ -196,7 +196,7 @@ export default Ember.Component.extend({ } }.property(), - didInsertElement: function() { + didInsertElement() { let camera = this.$('.camera'); let fileUpload = this.$('.fileUpload'); if (camera.length === 1) { @@ -211,7 +211,7 @@ export default Ember.Component.extend({ return (photoSource === takeAPicture && videoSources && videoSources.length > 1); }.property('photoSource', 'videoSources'), - willDestroyElement: function() { + willDestroyElement() { this._stopStream(); } }); diff --git a/app/components/text-search.js b/app/components/text-search.js index ea9172fe7d..a7f51f9b32 100644 --- a/app/components/text-search.js +++ b/app/components/text-search.js @@ -1,11 +1,11 @@ import Ember from 'ember'; export default Ember.TextField.extend(Ember.TargetActionSupport, { - change: function() { + change() { this.triggerAction({ action: 'search' }); }, - didInsertElement: function() { + didInsertElement() { this.$().focus(); } }); diff --git a/app/components/type-ahead.js b/app/components/type-ahead.js index f62dc0b32d..2b7d7b49c6 100644 --- a/app/components/type-ahead.js +++ b/app/components/type-ahead.js @@ -2,7 +2,7 @@ import Ember from 'ember'; import DS from 'ember-data'; import InputComponent from 'ember-rapid-forms/components/em-input'; export default InputComponent.extend({ - _mapContentItems: function() { + _mapContentItems() { let content = this.get('content'); if (content) { let mapped = content.filter(function(item) { @@ -53,7 +53,7 @@ export default InputComponent.extend({ setOnBlur: true, templates: null, - _getSource: function() { + _getSource() { let typeAheadBloodhound = new Bloodhound({ datumTokenizer: Bloodhound.tokenizers.obj.whitespace(this.get('displayKey')), queryTokenizer: Bloodhound.tokenizers.whitespace, @@ -64,7 +64,7 @@ export default InputComponent.extend({ return typeAheadBloodhound.ttAdapter(); }, - didInsertElement: function() { + didInsertElement() { let $input = this.$('input'); this.set('inputElement', $input); let $typeahead = $input.typeahead({ @@ -136,7 +136,7 @@ export default InputComponent.extend({ } }, - willDestroyElement: function() { + willDestroyElement() { this.get('inputElement').typeahead('destroy'); } diff --git a/app/controllers/abstract-delete-controller.js b/app/controllers/abstract-delete-controller.js index f3bf71919c..241a3a40e9 100644 --- a/app/controllers/abstract-delete-controller.js +++ b/app/controllers/abstract-delete-controller.js @@ -8,11 +8,11 @@ export default Ember.Controller.extend({ isUpdateDisabled: false, actions: { - cancel: function() { + cancel() { this.send('closeModal'); }, - delete: function() { + delete() { let recordToDelete = this.get('model'); recordToDelete.set('archived', true); recordToDelete.save().then(function() { diff --git a/app/controllers/abstract-edit-controller.js b/app/controllers/abstract-edit-controller.js index 830b2f871d..488cc61d2a 100644 --- a/app/controllers/abstract-edit-controller.js +++ b/app/controllers/abstract-edit-controller.js @@ -60,7 +60,7 @@ export default Ember.Controller.extend(EditPanelProps, IsUpdateDisabled, ModalHe * @param listsToUpdate array the lookup lists that need to be saved. * @param listsName string name of the list to add the value to. */ - _addValueToLookupList: function(lookupList, value, listsToUpdate, listName) { + _addValueToLookupList(lookupList, value, listsToUpdate, listName) { let lookupListValues = lookupList.get('value'); if (!Ember.isArray(lookupListValues)) { lookupListValues = []; @@ -76,18 +76,18 @@ export default Ember.Controller.extend(EditPanelProps, IsUpdateDisabled, ModalHe } }, - _cancelUpdate: function() { + _cancelUpdate() { let cancelledItem = this.get('model'); cancelledItem.rollbackAttributes(); }, actions: { - cancel: function() { + cancel() { this._cancelUpdate(); this.send(this.get('cancelAction')); }, - returnTo: function() { + returnTo() { this._cancelUpdate(); let returnTo = this.get('model.returnTo'); let returnToContext = this.get('model.returnToContext'); @@ -98,7 +98,7 @@ export default Ember.Controller.extend(EditPanelProps, IsUpdateDisabled, ModalHe } }, - showDisabledDialog: function() { + showDisabledDialog() { this.displayAlert('Warning!!!!', 'Please fill in required fields (marked with *) and correct the errors before saving.'); }, @@ -107,7 +107,7 @@ export default Ember.Controller.extend(EditPanelProps, IsUpdateDisabled, ModalHe * @param skipAfterUpdate boolean (optional) indicating whether or not * to skip the afterUpdate call. */ - update: function(skipAfterUpdate) { + update(skipAfterUpdate) { try { this.beforeUpdate().then(() => { this.saveModel(skipAfterUpdate); @@ -126,13 +126,13 @@ export default Ember.Controller.extend(EditPanelProps, IsUpdateDisabled, ModalHe * Override this function to perform logic after record update * @param record the record that was just updated. */ - afterUpdate: function() {}, + afterUpdate() {}, /** * Override this function to perform logic before record update. * @returns {Promise} Promise that resolves after before update is done. */ - beforeUpdate: function() { + beforeUpdate() { return Ember.RSVP.Promise.resolve(); }, @@ -141,7 +141,7 @@ export default Ember.Controller.extend(EditPanelProps, IsUpdateDisabled, ModalHe * @param skipAfterUpdate boolean (optional) indicating whether or not * to skip the afterUpdate call. */ - saveModel: function(skipAfterUpdate) { + saveModel(skipAfterUpdate) { this.get('model').save().then(function(record) { this.updateLookupLists(); if (!skipAfterUpdate) { @@ -153,7 +153,7 @@ export default Ember.Controller.extend(EditPanelProps, IsUpdateDisabled, ModalHe /** * Update any new values added to a lookup list */ - updateLookupLists: function() { + updateLookupLists() { let lookupLists = this.get('lookupListsToUpdate'); let listsToUpdate = Ember.A(); if (!Ember.isEmpty(lookupLists)) { diff --git a/app/controllers/abstract-paged-controller.js b/app/controllers/abstract-paged-controller.js index 792a07d7ab..566aacb95c 100644 --- a/app/controllers/abstract-paged-controller.js +++ b/app/controllers/abstract-paged-controller.js @@ -55,7 +55,7 @@ export default Ember.Controller.extend(PaginationProps, ProgressDialog, UserSess }), actions: { - nextPage: function() { + nextPage() { let key = this.get('nextStartKey'); let previousStartKeys = this.get('previousStartKeys'); let firstKey = this.get('firstKey'); @@ -64,7 +64,7 @@ export default Ember.Controller.extend(PaginationProps, ProgressDialog, UserSess this.set('startKey', key); this.showProgressModal(); }, - previousPage: function() { + previousPage() { let key = this.get('previousStartKey'); let previousStartKeys = this.get('previousStartKeys'); previousStartKeys.pop(); @@ -73,12 +73,12 @@ export default Ember.Controller.extend(PaginationProps, ProgressDialog, UserSess this.set('previousStartKeys', previousStartKeys); this.showProgressModal(); }, - sortByKey: function(sortKey, sortDesc) { + sortByKey(sortKey, sortDesc) { this.setProperties({ previousStartKey: null, previousStartKeys: [], - sortDesc: sortDesc, - sortKey: sortKey, + sortDesc, + sortKey, startKey: null }); this.showProgressModal(); diff --git a/app/controllers/abstract-report-controller.js b/app/controllers/abstract-report-controller.js index cbb74cfd6d..a0b9fce2ce 100644 --- a/app/controllers/abstract-report-controller.js +++ b/app/controllers/abstract-report-controller.js @@ -30,7 +30,7 @@ export default Ember.Controller.extend(DateFormat, ModalHelper, NumberFormat, Pa * will be used. * @param reportAction {Object} action to fire on row when row is clicked. */ - _addReportRow: function(row, skipFormatting, reportColumns, rowAction) { + _addReportRow(row, skipFormatting, reportColumns, rowAction) { let columnValue; let reportRows = this.get('reportRows'); let reportRow = []; @@ -57,7 +57,7 @@ export default Ember.Controller.extend(DateFormat, ModalHelper, NumberFormat, Pa } if (rowAction) { reportRows.addObject({ - rowAction: rowAction, + rowAction, row: reportRow }); } else { @@ -71,7 +71,7 @@ export default Ember.Controller.extend(DateFormat, ModalHelper, NumberFormat, Pa * optional, if not set, the property reportColumns on the controller * will be used. */ - _finishReport: function(reportColumns) { + _finishReport(reportColumns) { this.set('showReportResults', true); this.set('offset', 0); this._setReportHeaders(reportColumns); @@ -80,7 +80,7 @@ export default Ember.Controller.extend(DateFormat, ModalHelper, NumberFormat, Pa this.closeProgressModal(); }, - _generateExport: function() { + _generateExport() { let csvRows = []; let reportHeaders = this.get('reportHeaders'); let dataArray = [reportHeaders]; @@ -111,14 +111,14 @@ export default Ember.Controller.extend(DateFormat, ModalHelper, NumberFormat, Pa this.set('csvExport', uriContent); }, - _notifyReportError: function(errorMessage) { + _notifyReportError(errorMessage) { let alertMessage = 'An error was encountered while generating the requested report. Please let your system administrator know that you have encountered an error.'; this.closeProgressModal(); this.displayAlert('Error Generating Report', alertMessage); throw new Error(errorMessage); }, - _setReportHeaders: function(reportColumns) { + _setReportHeaders(reportColumns) { let reportHeaders = []; if (Ember.isEmpty(reportColumns)) { reportColumns = this.get('reportColumns'); @@ -131,7 +131,7 @@ export default Ember.Controller.extend(DateFormat, ModalHelper, NumberFormat, Pa this.set('reportHeaders', reportHeaders); }, - _setReportTitle: function() { + _setReportTitle() { let endDate = this.get('endDate'); let formattedEndDate = ''; let formattedStartDate = ''; @@ -152,21 +152,21 @@ export default Ember.Controller.extend(DateFormat, ModalHelper, NumberFormat, Pa }, actions: { - firstPage: function() { + firstPage() { this.set('offset', 0); }, - nextPage: function() { + nextPage() { let limit = this.get('limit'); this.incrementProperty('offset', limit); }, - previousPage: function() { + previousPage() { let limit = this.get('limit'); this.decrementProperty('offset', limit); }, - lastPage: function() { + lastPage() { let reportRowLength = this.get('reportRows.length'); let limit = this.get('limit'); let pages = parseInt(reportRowLength / limit); diff --git a/app/controllers/index.js b/app/controllers/index.js index f44505e1d1..83268c0fc9 100644 --- a/app/controllers/index.js +++ b/app/controllers/index.js @@ -27,7 +27,7 @@ export default Ember.Controller.extend(UserSession, { let action = link.toLowerCase(); if (this.currentUserCan(action)) { activeLinks.push({ - action: action, + action, text: link }); } diff --git a/app/controllers/login.js b/app/controllers/login.js index d457403f33..6c2ee192d2 100644 --- a/app/controllers/login.js +++ b/app/controllers/login.js @@ -9,8 +9,8 @@ let LoginController = Ember.Controller.extend({ authenticate() { let { identification, password } = this.getProperties('identification', 'password'); this.get('session').authenticate('authenticator:custom', { - identification: identification, - password: password + identification, + password }).catch((error) => { this.set('errorMessage', error.reason); }); diff --git a/app/controllers/navigation.js b/app/controllers/navigation.js index b98cfcea19..9912ce926d 100644 --- a/app/controllers/navigation.js +++ b/app/controllers/navigation.js @@ -18,7 +18,7 @@ export default Ember.Controller.extend(HospitalRunVersion, ModalHelper, Progress currentOpenNav: null, actions: { - about: function() { + about() { let version = this.get('version'); this.get('ajax').request('/serverinfo').then((siteInfo) => { let message = `Version: ${version}`; @@ -29,14 +29,14 @@ export default Ember.Controller.extend(HospitalRunVersion, ModalHelper, Progress }); }, - invalidateSession: function() { + invalidateSession() { let session = this.get('session'); if (session.get('isAuthenticated')) { session.invalidate(); } }, - search: function() { + search() { if (this.allowSearch && this.searchRoute) { let currentRouteName = this.get('currentRouteName'); let currentSearchText = this.get('currentSearchText'); @@ -50,7 +50,7 @@ export default Ember.Controller.extend(HospitalRunVersion, ModalHelper, Progress } }, - navAction: function(nav) { + navAction(nav) { if (this.currentOpenNav && this.currentOpenNav.route !== nav.route) { this.currentOpenNav.closeSubnav(); } @@ -59,11 +59,11 @@ export default Ember.Controller.extend(HospitalRunVersion, ModalHelper, Progress this.set('isShowingSettings', false); }, - toggleSettings: function() { + toggleSettings() { this.toggleProperty('isShowingSettings'); }, - closeSettings: function() { + closeSettings() { this.set('isShowingSettings', false); } diff --git a/app/dialog/controller.js b/app/dialog/controller.js index cf46bff38a..0851e3c8d0 100644 --- a/app/dialog/controller.js +++ b/app/dialog/controller.js @@ -4,17 +4,17 @@ export default Ember.Controller.extend({ isUpdateDisabled: false, actions: { - cancel: function() { + cancel() { this.send('closeModal'); }, - confirm: function() { + confirm() { let confirmAction = this.getWithDefault('model.confirmAction', 'model.confirm'); this.send(confirmAction, this.get('model')); this.send('closeModal'); }, - ok: function() { + ok() { let okAction = this.get('model.okAction'); if (!Ember.isEmpty(okAction)) { this.send(okAction, this.get('model')); diff --git a/app/finishgauth/route.js b/app/finishgauth/route.js index fd2c009839..256d4e8bca 100644 --- a/app/finishgauth/route.js +++ b/app/finishgauth/route.js @@ -5,11 +5,11 @@ export default Ember.Route.extend(SetupUserRole, { config: Ember.inject.service(), database: Ember.inject.service(), session: Ember.inject.service(), - model: function(params) { + model(params) { if (params.k && params.s1 && params.s2 && params.t) { this.get('session').authenticate('authenticator:custom', { google_auth: true, - params: params + params }); let oauthConfigs = { config_consumer_key: params.k, diff --git a/app/imaging/delete/controller.js b/app/imaging/delete/controller.js index e8cc3a78f0..2daacbeaef 100644 --- a/app/imaging/delete/controller.js +++ b/app/imaging/delete/controller.js @@ -4,7 +4,7 @@ export default AbstractDeleteController.extend(PatientSubmodule, { title: 'Delete Request', actions: { - delete: function() { + delete() { this.deleteChildFromVisit('imaging'); } } diff --git a/app/imaging/edit/controller.js b/app/imaging/edit/controller.js index 3920877cb3..a462c94541 100644 --- a/app/imaging/edit/controller.js +++ b/app/imaging/edit/controller.js @@ -22,7 +22,7 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, { }.property('selectedImagingType.[]', 'model.imagingTypeName'), actions: { - completeImaging: function() { + completeImaging() { this.set('model.status', 'Completed'); this.get('model').validate().then(function() { if (this.get('model.isValid')) { @@ -35,7 +35,7 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, { /** * Save the imaging request(s), creating multiples when user selects multiple imaging tests. */ - update: function() { + update() { if (this.get('model.isNew')) { let newImaging = this.get('model'); let selectedImagingType = this.get('selectedImagingType'); @@ -97,7 +97,7 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, { updateCapability: 'add_imaging', - afterUpdate: function(saveResponse, multipleRecords) { + afterUpdate(saveResponse, multipleRecords) { let i18n = this.get('i18n'); this.updateLookupLists(); let afterDialogAction, diff --git a/app/imaging/edit/route.js b/app/imaging/edit/route.js index 76a3efa8ec..ce21fd1f7c 100644 --- a/app/imaging/edit/route.js +++ b/app/imaging/edit/route.js @@ -10,12 +10,12 @@ export default AbstractEditRoute.extend(ChargeRoute, PatientListRoute, { pricingCategory: 'Imaging', actions: { - returnToAllItems: function() { + returnToAllItems() { this.controller.send('returnToAllItems'); } }, - getNewData: function() { + getNewData() { return Ember.RSVP.resolve({ selectPatient: true, requestDate: moment().startOf('day').toDate() diff --git a/app/imaging/index/route.js b/app/imaging/index/route.js index b916321ede..828d94231c 100644 --- a/app/imaging/index/route.js +++ b/app/imaging/index/route.js @@ -5,14 +5,14 @@ export default AbstractIndexRoute.extend({ pageTitle: t('imaging.pageTitle'), searchStatus: 'Requested', - _getStartKeyFromItem: function(item) { + _getStartKeyFromItem(item) { let imagingDateAsTime = item.get('imagingDateAsTime'); let id = this._getPouchIdFromItem(item); let requestedDateAsTime = item.get('requestedDateAsTime'); let searchStatus = this.get('searchStatus'); return [searchStatus, requestedDateAsTime, imagingDateAsTime, id]; }, - _modelQueryParams: function() { + _modelQueryParams() { let maxId = this._getMaxPouchId(); let maxValue = this.get('maxValue'); let minId = this._getMinPouchId(); diff --git a/app/initializers/i18n.js b/app/initializers/i18n.js index 33056b782b..412abfd98e 100644 --- a/app/initializers/i18n.js +++ b/app/initializers/i18n.js @@ -3,7 +3,7 @@ export default { after: 'ember-i18n', - initialize: function(app) { + initialize(app) { app.inject('route', 'i18n', 'service:i18n'); app.inject('controller', 'i18n', 'service:i18n'); app.inject('mixin', 'i18n', 'service:i18n'); diff --git a/app/inventory/adjust/controller.js b/app/inventory/adjust/controller.js index 537be4f8c4..d080b803d3 100644 --- a/app/inventory/adjust/controller.js +++ b/app/inventory/adjust/controller.js @@ -24,11 +24,11 @@ export default AbstractEditController.extend(AdjustmentTypes, { updateCapability: 'adjust_inventory_location', actions: { - cancel: function() { + cancel() { this.send('closeModal'); }, - adjust: function() { + adjust() { this.send('adjustItems', this.get('model'), true); } } diff --git a/app/inventory/barcode/controller.js b/app/inventory/barcode/controller.js index 3fa7fb9bd8..a5ff8ab37f 100644 --- a/app/inventory/barcode/controller.js +++ b/app/inventory/barcode/controller.js @@ -37,7 +37,7 @@ export default Ember.Controller.extend({ }.property('printers'), actions: { - print: function() { + print() { let barcodeUri = this.get('barcodeUri'); let selectedPrinter = this.get('selectedPrinter'); if (!selectedPrinter) { diff --git a/app/inventory/barcode/route.js b/app/inventory/barcode/route.js index 8dfef34bb3..f42cc05b2f 100644 --- a/app/inventory/barcode/route.js +++ b/app/inventory/barcode/route.js @@ -1,6 +1,6 @@ import Ember from 'ember'; export default Ember.Route.extend({ - model: function(params) { + model(params) { return this.store.find('inventory', params.inventory_id); } diff --git a/app/inventory/batch/controller.js b/app/inventory/batch/controller.js index 6cde545a6b..b0ef3c0155 100755 --- a/app/inventory/batch/controller.js +++ b/app/inventory/batch/controller.js @@ -72,7 +72,7 @@ export default AbstractEditController.extend(InventoryId, InventoryLocations, In updateCapability: 'add_inventory_item', - _addNewInventoryItem: function() { + _addNewInventoryItem() { this.generateId().then(function(inventoryId) { let inventoryItem = this.store.createRecord('inventory', { id: inventoryId, @@ -84,7 +84,7 @@ export default AbstractEditController.extend(InventoryId, InventoryLocations, In }.bind(this)); }, - _addInventoryItem: function() { + _addInventoryItem() { let model = this.get('model'); let inventoryItemTypeAhead = this.get('model.inventoryItemTypeAhead'); let purchaseCost = this.get('model.purchaseCost'); @@ -105,7 +105,7 @@ export default AbstractEditController.extend(InventoryId, InventoryLocations, In }.bind(this)); }, - _addInvoiceItem: function() { + _addInvoiceItem() { let model = this.get('model'); let invoiceItems = model.get('invoiceItems'); let itemProperties = model.getProperties(this.get('purchaseAttributes')); @@ -121,7 +121,7 @@ export default AbstractEditController.extend(InventoryId, InventoryLocations, In model.set('vendorItemNo'); }, - _findInventoryItem: function(purchase) { + _findInventoryItem(purchase) { let invoiceItems = this.get('model.invoiceItems'); let inventoryId = purchase.get('inventoryItem'); if (!Ember.isEmpty(inventoryId)) { @@ -134,7 +134,7 @@ export default AbstractEditController.extend(InventoryId, InventoryLocations, In } }, - _haveValidInventoryItem: function() { + _haveValidInventoryItem() { let inventoryItemTypeAhead = this.get('model.inventoryItemTypeAhead'); let inventoryItem = this.get('model.inventoryItem'); if (Ember.isEmpty(inventoryItemTypeAhead) || Ember.isEmpty(inventoryItem)) { @@ -150,7 +150,7 @@ export default AbstractEditController.extend(InventoryId, InventoryLocations, In } }, - _savePurchases: function() { + _savePurchases() { let model = this.get('model'); let purchaseDefaults = model.getProperties([ 'dateReceived', @@ -200,11 +200,11 @@ export default AbstractEditController.extend(InventoryId, InventoryLocations, In }, actions: { - addInventoryItem: function() { + addInventoryItem() { this._addInventoryItem(); }, - addedNewInventoryItem: function(inventoryItem) { + addedNewInventoryItem(inventoryItem) { this.set('model.inventoryItem', inventoryItem); this._addInvoiceItem(); this.send('closeModal'); @@ -213,14 +213,14 @@ export default AbstractEditController.extend(InventoryId, InventoryLocations, In } }, - removeItem: function(removeInfo) { + removeItem(removeInfo) { let invoiceItems = this.get('model.invoiceItems'); let item = removeInfo.itemToRemove; invoiceItems.removeObject(item); this.send('closeModal'); }, - showRemoveItem: function(item) { + showRemoveItem(item) { let message = this.get('i18n').t('inventory.messages.removeItem'); let model = Ember.Object.create({ itemToRemove: item @@ -232,7 +232,7 @@ export default AbstractEditController.extend(InventoryId, InventoryLocations, In /** * Update the model */ - update: function() { + update() { this.set('doingUpdate', true); this._addInventoryItem().then(function(addingNewInventory) { if (!addingNewInventory) { diff --git a/app/inventory/batch/route.js b/app/inventory/batch/route.js index 682bffd10c..63586586e2 100755 --- a/app/inventory/batch/route.js +++ b/app/inventory/batch/route.js @@ -5,7 +5,7 @@ export default InventoryRequestRoute.extend({ editTitle: t('navigation.subnav.inventoryReceived'), modelName: 'inventory-batch', newTitle: t('navigation.subnav.inventoryReceived'), - getNewData: function() { + getNewData() { return Ember.RSVP.resolve({ invoiceItems: [], dateReceived: new Date() @@ -13,7 +13,7 @@ export default InventoryRequestRoute.extend({ }, actions: { - addedNewInventoryItem: function(model) { + addedNewInventoryItem(model) { this.controller.send('addedNewInventoryItem', model); } } diff --git a/app/inventory/edit/controller.js b/app/inventory/edit/controller.js index 1626bf15cc..b54ecfc60e 100644 --- a/app/inventory/edit/controller.js +++ b/app/inventory/edit/controller.js @@ -14,7 +14,7 @@ export default AbstractEditController.extend(InventoryLocations, InventoryTypeLi return this.currentUserCan('add_inventory_purchase'); }.property(), - canAdjustLocation: function() { + canAdjustLocation() { return this.currentUserCan('adjust_inventory_location'); }, @@ -94,7 +94,7 @@ export default AbstractEditController.extend(InventoryLocations, InventoryTypeLi updateCapability: 'add_inventory_item', actions: { - adjustItems: function(inventoryLocation) { + adjustItems(inventoryLocation) { let adjustmentQuantity = parseInt(inventoryLocation.get('adjustmentQuantity')); let inventoryItem = this.get('model'); let transactionType = inventoryLocation.get('transactionType'); @@ -102,9 +102,9 @@ export default AbstractEditController.extend(InventoryLocations, InventoryTypeLi adjustPurchases: true, dateCompleted: inventoryLocation.get('dateCompleted'), expenseAccount: inventoryLocation.get('expenseAccount'), - inventoryItem: inventoryItem, + inventoryItem, quantity: adjustmentQuantity, - transactionType: transactionType, + transactionType, reason: inventoryLocation.get('reason'), deliveryAisle: inventoryLocation.get('aisleLocation'), deliveryLocation: inventoryLocation.get('location') @@ -121,11 +121,11 @@ export default AbstractEditController.extend(InventoryLocations, InventoryTypeLi }.bind(this)); }, - editNewItem: function() { + editNewItem() { this.send('editItem', this.get('model.id')); }, - showAdjustment: function(inventoryLocation) { + showAdjustment(inventoryLocation) { inventoryLocation.setProperties({ dateCompleted: new Date(), adjustmentItem: this.get('model'), @@ -137,19 +137,19 @@ export default AbstractEditController.extend(InventoryLocations, InventoryTypeLi this.send('openModal', 'inventory.adjust', inventoryLocation); }, - showTransfer: function(inventoryLocation) { + showTransfer(inventoryLocation) { inventoryLocation.set('adjustmentQuantity'); inventoryLocation.set('transferItem', this.get('model')); inventoryLocation.set('dateCompleted', new Date()); this.send('openModal', 'inventory.transfer', inventoryLocation); }, - transferItems: function(inventoryLocation) { + transferItems(inventoryLocation) { let inventoryItem = this.get('model'); let request = this.get('store').createRecord('inv-request', { adjustPurchases: false, dateCompleted: inventoryLocation.get('dateCompleted'), - inventoryItem: inventoryItem, + inventoryItem, quantity: inventoryLocation.get('adjustmentQuantity'), deliveryAisle: inventoryLocation.get('transferAisleLocation'), deliveryLocation: inventoryLocation.get('transferLocation'), @@ -173,7 +173,7 @@ export default AbstractEditController.extend(InventoryLocations, InventoryTypeLi }.bind(this)); }, - updatePurchase: function(purchase, updateQuantity) { + updatePurchase(purchase, updateQuantity) { if (updateQuantity) { this.get('model').updateQuantity(); this.send('update', true); @@ -182,7 +182,7 @@ export default AbstractEditController.extend(InventoryLocations, InventoryTypeLi } }, - _completeBeforeUpdate: function(sequence, resolve, reject) { + _completeBeforeUpdate(sequence, resolve, reject) { let sequenceValue = null; let friendlyId = sequence.get('prefix'); let promises = []; @@ -215,7 +215,7 @@ export default AbstractEditController.extend(InventoryLocations, InventoryTypeLi }); }, - _findSequence: function(inventoryType, resolve, reject) { + _findSequence(inventoryType, resolve, reject) { let sequenceFinder = new Ember.RSVP.Promise(function(resolve) { this._checkNextSequence(resolve, inventoryType, 0); }.bind(this)); @@ -230,7 +230,7 @@ export default AbstractEditController.extend(InventoryLocations, InventoryTypeLi }.bind(this)); }, - _findSequenceByPrefix: function(inventoryType, prefixChars) { + _findSequenceByPrefix(inventoryType, prefixChars) { let database = this.get('database'); let sequenceQuery = { key: inventoryType.toLowerCase().substr(0, prefixChars) @@ -238,7 +238,7 @@ export default AbstractEditController.extend(InventoryLocations, InventoryTypeLi return database.queryMainDB(sequenceQuery, 'sequence_by_prefix'); }, - _checkNextSequence: function(resolve, inventoryType, prefixChars) { + _checkNextSequence(resolve, inventoryType, prefixChars) { prefixChars++; this._findSequenceByPrefix(inventoryType, prefixChars).then(function(records) { if (Ember.isEmpty(records.rows)) { @@ -254,7 +254,7 @@ export default AbstractEditController.extend(InventoryLocations, InventoryTypeLi /** * Saves the specified request, then updates the inventory item and closes the modal. */ - _saveRequest: function(request) { + _saveRequest(request) { request.set('status', 'Completed'); request.set('completedBy', request.getUserName()); request.save().then(function() { @@ -264,7 +264,7 @@ export default AbstractEditController.extend(InventoryLocations, InventoryTypeLi }.bind(this)); }, - getTransactions: function() { + getTransactions() { let inventoryId = this.get('model.id'); this.set('transactions', null); this.store.query('inv-request', { @@ -279,7 +279,7 @@ export default AbstractEditController.extend(InventoryLocations, InventoryTypeLi }.bind(this)); }, - beforeUpdate: function() { + beforeUpdate() { if (this.get('model.isNew')) { let model = this.get('model'); let inventoryType = model.get('inventoryType'); @@ -305,7 +305,7 @@ export default AbstractEditController.extend(InventoryLocations, InventoryTypeLi } }, - afterUpdate: function() { + afterUpdate() { let afterUpdateAction = null; if (this.get('savingNewItem')) { afterUpdateAction = 'editNewItem'; diff --git a/app/inventory/edit/route.js b/app/inventory/edit/route.js index 04bcf97ceb..fc31add0bf 100644 --- a/app/inventory/edit/route.js +++ b/app/inventory/edit/route.js @@ -8,34 +8,34 @@ export default AbstractEditRoute.extend(InventoryId, { newTitle: t('inventory.labels.newItem'), actions: { - adjustItems: function(inventoryLocation) { + adjustItems(inventoryLocation) { this.controller.send('adjustItems', inventoryLocation); }, - doneFulfillRequest: function() { + doneFulfillRequest() { this.controller.getTransactions(); }, - editNewItem: function() { + editNewItem() { this.controller.send('editNewItem'); }, - transferItems: function(inventoryLocation) { + transferItems(inventoryLocation) { this.controller.send('transferItems', inventoryLocation); }, - updatePurchase: function(purchase, updateQuantity) { + updatePurchase(purchase, updateQuantity) { this.controller.send('updatePurchase', purchase, updateQuantity); } }, - getNewData: function() { + getNewData() { return Ember.RSVP.resolve({ dateReceived: new Date() }); }, - setupController: function(controller, model) { + setupController(controller, model) { this._super(controller, model); controller.getTransactions(); } diff --git a/app/inventory/index/route.js b/app/inventory/index/route.js index d28bd31a6f..cf3808aced 100644 --- a/app/inventory/index/route.js +++ b/app/inventory/index/route.js @@ -13,12 +13,12 @@ export default AbstractIndexRoute.extend(UserSession, { newButtonText: t('buttons.newRequestPlus'), pageTitle: t('navigation.subnav.requests'), - _getStartKeyFromItem: function(item) { + _getStartKeyFromItem(item) { let itemId = this._getPouchIdFromItem(item); return ['Requested', null, itemId]; }, - _modelQueryParams: function() { + _modelQueryParams() { let maxValue = this.get('maxValue'); return { options: { @@ -30,7 +30,7 @@ export default AbstractIndexRoute.extend(UserSession, { }, actions: { - fulfill: function(item) { + fulfill(item) { item.set('dateCompleted', new Date()); this.transitionTo('inventory.request', item); } diff --git a/app/inventory/listing/route.js b/app/inventory/listing/route.js index 458300d34f..591bca9725 100644 --- a/app/inventory/listing/route.js +++ b/app/inventory/listing/route.js @@ -13,13 +13,13 @@ export default AbstractIndexRoute.extend(UserSession, { newButtonText: t('buttons.newItem'), pageTitle: t('inventory.labels.items'), - _modelQueryParams: function() { + _modelQueryParams() { return { mapReduce: 'inventory_by_name' }; }, - _getStartKeyFromItem: function(item) { + _getStartKeyFromItem(item) { let inventoryId = this._getPouchIdFromItem(item); return [item.get('name'), inventoryId]; } diff --git a/app/inventory/purchase/edit/controller.js b/app/inventory/purchase/edit/controller.js index bc94018f32..48db4d0318 100644 --- a/app/inventory/purchase/edit/controller.js +++ b/app/inventory/purchase/edit/controller.js @@ -49,7 +49,7 @@ export default AbstractEditController.extend(UnitTypes, { return i18n.t('inventory.titles.editPurchase'); }.property('model.isNew'), - beforeUpdate: function() { + beforeUpdate() { let isNew = this.get('model.isNew'); let changedAttributes = this.get('model').changedAttributes(); if (changedAttributes.originalQuantity) { @@ -64,7 +64,7 @@ export default AbstractEditController.extend(UnitTypes, { return Ember.RSVP.Promise.resolve(); }, - afterUpdate: function(record) { + afterUpdate(record) { if (this.get('newPurchase')) { this.send('addPurchase', record); } else { diff --git a/app/inventory/quick-add/controller.js b/app/inventory/quick-add/controller.js index 5f684c76ad..c88f7cae2b 100644 --- a/app/inventory/quick-add/controller.js +++ b/app/inventory/quick-add/controller.js @@ -6,19 +6,19 @@ export default InventoryEditController.extend({ updateCapability: 'add_inventory_item', actions: { - cancel: function() { + cancel() { this.send('closeModal'); } }, - beforeUpdate: function() { + beforeUpdate() { if (this.get('model.skipSavePurchase')) { this.set('model.quantity', null); } return this._super(); }, - afterUpdate: function(record) { + afterUpdate(record) { this.send('addedNewInventoryItem', record); } }); diff --git a/app/inventory/reports/controller.js b/app/inventory/reports/controller.js index ec904bb5b8..160afd95e1 100644 --- a/app/inventory/reports/controller.js +++ b/app/inventory/reports/controller.js @@ -277,7 +277,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number return (reportType !== 'expiration' && reportType !== 'summaryFinance'); }.property('reportType'), - _addAisleColumn: function(locations) { + _addAisleColumn(locations) { if (!Ember.isEmpty(locations)) { return locations.map(function(location) { if (location.name.indexOf(':') > -1) { @@ -287,7 +287,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number } }, - _addLocationColumn: function(locations) { + _addLocationColumn(locations) { if (!Ember.isEmpty(locations)) { let returnLocations = []; locations.forEach(function(location) { @@ -305,7 +305,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number } }, - _addReportRow: function(row, skipNumberFormatting, reportColumns, rowAction) { + _addReportRow(row, skipNumberFormatting, reportColumns, rowAction) { if (Ember.isEmpty(rowAction) && !Ember.isEmpty(row.inventoryItem) && !Ember.isEmpty(row.inventoryItem.id)) { rowAction = { action: 'viewInventory', @@ -315,7 +315,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number this._super(row, skipNumberFormatting, reportColumns, rowAction); }, - _addTotalsRow: function(label, summaryCost, summaryQuantity) { + _addTotalsRow(label, summaryCost, summaryQuantity) { if (summaryQuantity > 0) { this._addReportRow({ totalCost: label + this._numberFormat(summaryCost), @@ -332,7 +332,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number * @param {integer} quantity the quantity to adjust. * @param {boolean} increment boolean indicating if the adjustment is an increment; or false if decrement. */ - _adjustLocation: function(locations, locationName, quantity, increment) { + _adjustLocation(locations, locationName, quantity, increment) { let locationToUpdate = locations.findBy('name', locationName); if (Ember.isEmpty(locationToUpdate)) { locationToUpdate = { @@ -355,7 +355,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number * @param {integer} quantity the quantity to adjust. * @param {boolean} increment boolean indicating if the adjustment is an increment; or false if decrement. */ - _adjustPurchase: function(purchases, purchaseId, quantity, increment) { + _adjustPurchase(purchases, purchaseId, quantity, increment) { let purchaseToAdjust = purchases.findBy('id', purchaseId); if (!Ember.isEmpty(purchaseToAdjust)) { let { calculatedQuantity } = purchaseToAdjust; @@ -368,7 +368,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number } }, - _calculateCosts: function(inventoryPurchases, row) { + _calculateCosts(inventoryPurchases, row) { // Calculate quantity and cost per unit for the row if (!Ember.isEmpty(inventoryPurchases)) { inventoryPurchases.forEach(function(purchase) { @@ -386,7 +386,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number return row; }, - _calculateUsage: function(inventoryPurchases, row) { + _calculateUsage(inventoryPurchases, row) { // Calculate quantity and cost per unit for the row if (!Ember.isEmpty(inventoryPurchases)) { inventoryPurchases.forEach(function(purchase) { @@ -404,7 +404,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number return row; }, - _calculateCostPerUnit: function(purchase) { + _calculateCostPerUnit(purchase) { let { purchaseCost } = purchase; let quantity = parseInt(purchase.originalQuantity); if (Ember.isEmpty(purchaseCost) || Ember.isEmpty(quantity)) { @@ -413,7 +413,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number return Number((purchaseCost / quantity).toFixed(2)); }, - _findInventoryItems: function(queryParams, view, inventoryList, childName) { + _findInventoryItems(queryParams, view, inventoryList, childName) { if (Ember.isEmpty(inventoryList)) { inventoryList = {}; } @@ -451,7 +451,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number }.bind(this)); }, - _findInventoryItemsByPurchase: function(reportTimes, inventoryMap) { + _findInventoryItemsByPurchase(reportTimes, inventoryMap) { return this._findInventoryItems({ startkey: [reportTimes.startTime, 'invPurchase_'], endkey: [reportTimes.endTime, 'invPurchase_\uffff'], @@ -459,7 +459,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number }, 'inventory_purchase_by_date_received', inventoryMap, 'purchaseObjects'); }, - _findInventoryItemsByRequest: function(reportTimes, inventoryMap) { + _findInventoryItemsByRequest(reportTimes, inventoryMap) { return this._findInventoryItems({ startkey: ['Completed', reportTimes.startTime, 'invRequest_'], endkey: ['Completed', reportTimes.endTime, 'invRequest_\uffff'], @@ -467,7 +467,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number }, 'inventory_request_by_status', inventoryMap, 'requestObjects'); }, - _finishExpenseReport: function(reportType) { + _finishExpenseReport(reportType) { let expenseCategories = this.get('expenseCategories'); let expenseMap = this.get('expenseMap'); let i18n = this.get('i18n'); @@ -490,7 +490,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number } else { expenseAccountName = expenseAccount.name; } - totalLabel = i18n.t('inventory.reports.rows.subtotalFor', { category: category, account: expenseAccountName }); + totalLabel = i18n.t('inventory.reports.rows.subtotalFor', { category, account: expenseAccountName }); this._addReportRow({ totalCost: totalLabel + this._numberFormat(expenseAccount.total) }, true); @@ -507,7 +507,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number }, true); }, - _finishLocationReport: function() { + _finishLocationReport() { let currentLocation = ''; let locationCost = 0; let locationSummary = this.get('locationSummary'); @@ -550,7 +550,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number } }, - _generateExpirationReport: function() { + _generateExpirationReport() { let grandQuantity = 0; let database = this.get('database'); let reportRows = this.get('reportRows'); @@ -601,7 +601,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number }, - _generateFinancialSummaryReport: function() { + _generateFinancialSummaryReport() { let reportTimes = this._getDateQueryParams(); /* step 1: find the valuation as of start date, @@ -627,7 +627,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number }.bind(this)); }, - _generateSummaries: function(reportTimes) { + _generateSummaries(reportTimes) { return new Ember.RSVP.Promise(function(resolve, reject) { let adjustedValue = 0; let i18n = this.get('i18n'); @@ -745,7 +745,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number }.bind(this)); }, - _calculateBeginningBalance: function(reportTimes) { + _calculateBeginningBalance(reportTimes) { return new Ember.RSVP.Promise(function(resolve, reject) { let startingValueReportTimes = { startTime: null, @@ -813,7 +813,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number }.bind(this)); }, - _generateInventoryReport: function() { + _generateInventoryReport() { this.set('grandCost', 0); this.set('grandQuantity', 0); this.set('locationSummary', []); @@ -917,7 +917,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number totalCost: 0 }); locationToUpdate.items[item.id] = { - item: item, + item, quantity: this._getValidNumber(location.quantity), giftInKind: row.giftInKind, totalCost: (this._getValidNumber(costData.unitCost) * this._getValidNumber(location.quantity)), @@ -981,9 +981,9 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number inventoryItem: row.inventoryItem, quantity: request.quantity, transactionType: request.transactionType, - locations: locations, + locations, unitCost: request.costPerUnit, - totalCost: totalCost + totalCost }; if (reportType === 'detailedExpense' || reportType === 'summaryExpense') { this._updateExpenseMap(request, reportRow); @@ -1034,7 +1034,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number } this._addReportRow({ date: moment(new Date(purchase.dateReceived)).format('l'), - giftInKind: giftInKind, + giftInKind, inventoryItem: row.inventoryItem, quantity: purchase.originalQuantity, unitCost: purchase.costPerUnit, @@ -1111,7 +1111,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number }.bind(this)); }, - _getDateQueryParams: function() { + _getDateQueryParams() { let endDate = this.get('endDate'); let endTime = this.get('maxValue'); let startDate = this.get('startDate'); @@ -1123,12 +1123,12 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number startTime = moment(startDate).startOf('day').toDate().getTime(); } return { - endTime: endTime, - startTime: startTime + endTime, + startTime }; }, - _getInventoryItems: function(inventoryIds, inventoryMap) { + _getInventoryItems(inventoryIds, inventoryMap) { let database = this.get('database'); return new Ember.RSVP.Promise(function(resolve, reject) { if (Ember.isEmpty(inventoryMap)) { @@ -1153,7 +1153,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number * @param {string} locationName the formatted location name. * @return {string} the warehouse name. */ - _getWarehouseLocationName: function(locationName) { + _getWarehouseLocationName(locationName) { let returnLocation = ''; if (locationName.indexOf(':') > -1) { returnLocation = locationName.split(':')[0].trim(); @@ -1168,7 +1168,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number * @param {array} locations list of location objects to check. * @return {boolean} true if any of the locations match the filter; otherwise false. */ - _hasIncludedLocation: function(locations) { + _hasIncludedLocation(locations) { let hasIncludedLocation = false; locations.forEach(function(location) { let locationName = this._getWarehouseLocationName(location.name); @@ -1184,7 +1184,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number * @param {string} location the location to check for inclusion * @return {boolean} true if the location should be included. */ - _includeLocation: function(location) { + _includeLocation(location) { let filterLocation = this.get('filterLocation'); return Ember.isEmpty(filterLocation) || location === filterLocation; }, @@ -1196,7 +1196,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number * @param {string} transactionType the transaction type * @return {boolean} true if the transaction should be included. */ - _includeTransaction: function(reportType, transactionType) { + _includeTransaction(reportType, transactionType) { let detailed = (reportType.indexOf('detailed') === 0); let includeForReportType; if (reportType === 'detailedExpense' || reportType === 'summaryExpense') { @@ -1230,7 +1230,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number return (reportType === includeForReportType); }, - _updateExpenseMap: function(request, reportRow) { + _updateExpenseMap(request, reportRow) { let categoryToUpdate; let expenseMap = this.get('expenseMap'); let isGiftInKind = (reportRow.giftInKind === 'Y'); @@ -1286,7 +1286,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number }, actions: { - generateReport: function() { + generateReport() { let endDate = this.get('endDate'); let reportRows = this.get('reportRows'); let reportType = this.get('reportType'); @@ -1326,7 +1326,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number } }, - viewInventory: function(id) { + viewInventory(id) { this.store.find('inventory', id).then(function(item) { item.set('returnTo', 'inventory.reports'); this.transitionToRoute('inventory.edit', item); diff --git a/app/inventory/reports/route.js b/app/inventory/reports/route.js index e80df5a70c..5a04994999 100644 --- a/app/inventory/reports/route.js +++ b/app/inventory/reports/route.js @@ -5,7 +5,7 @@ export default AbstractIndexRoute.extend({ pageTitle: t('inventory.titles.inventoryReport'), // No model for reports; data gets retrieved when report is run. - model: function() { + model() { return Ember.RSVP.resolve(Ember.Object.create({})); } diff --git a/app/inventory/request/controller.js b/app/inventory/request/controller.js index 24f4650bb1..4163b56988 100755 --- a/app/inventory/request/controller.js +++ b/app/inventory/request/controller.js @@ -88,7 +88,7 @@ export default AbstractEditController.extend(FulfillRequest, InventoryLocations, updateCapability: 'add_inventory_request', actions: { - addInventoryItem: function() { + addInventoryItem() { let model = this.get('model'); let inventoryItem = model.get('inventoryItem'); let requestedItems = model.get('requestedItems'); @@ -97,7 +97,7 @@ export default AbstractEditController.extend(FulfillRequest, InventoryLocations, if (model.get('isValid') && !Ember.isEmpty(inventoryItem) && !Ember.isEmpty(quantity)) { let requestedItem = Ember.Object.create({ item: inventoryItem.get('content'), - quantity: quantity + quantity }); requestedItems.addObject(requestedItem); model.set('inventoryItem'); @@ -108,18 +108,18 @@ export default AbstractEditController.extend(FulfillRequest, InventoryLocations, }.bind(this)).catch(Ember.K); }, - allRequests: function() { + allRequests() { this.transitionToRoute('inventory.index'); }, - removeItem: function(removeInfo) { + removeItem(removeInfo) { let requestedItems = this.get('model.requestedItems'); let item = removeInfo.itemToRemove; requestedItems.removeObject(item); this.send('closeModal'); }, - showRemoveItem: function(item) { + showRemoveItem(item) { let message = this.get('i18n').t('inventory.messages.removeItemRequest'); let model = Ember.Object.create({ itemToRemove: item @@ -133,7 +133,7 @@ export default AbstractEditController.extend(FulfillRequest, InventoryLocations, * @param skipAfterUpdate boolean (optional) indicating whether or not * to skip the afterUpdate call. */ - update: function(skipAfterUpdate) { + update(skipAfterUpdate) { this.beforeUpdate().then(function() { let updateViaFulfillRequest = this.get('updateViaFulfillRequest'); if (updateViaFulfillRequest) { @@ -187,7 +187,7 @@ export default AbstractEditController.extend(FulfillRequest, InventoryLocations, } }, - afterUpdate: function() { + afterUpdate() { let updateViaFulfillRequest = this.get('updateViaFulfillRequest'); if (updateViaFulfillRequest) { this.displayAlert(this.get('i18n').t('inventory.titles.requestFulfilled'), this.get('i18n').t('inventory.messages.requestFulfilled'), 'allRequests'); @@ -196,7 +196,7 @@ export default AbstractEditController.extend(FulfillRequest, InventoryLocations, } }, - beforeUpdate: function() { + beforeUpdate() { if (this.get('isFulfilling')) { this.set('updateViaFulfillRequest', true); } else { diff --git a/app/inventory/request/route.js b/app/inventory/request/route.js index f87720f902..ed6644d8aa 100755 --- a/app/inventory/request/route.js +++ b/app/inventory/request/route.js @@ -6,7 +6,7 @@ export default AbstractEditRoute.extend({ modelName: 'inv-request', newTitle: t('inventory.titles.addRequest'), database: Ember.inject.service(), - getNewData: function() { + getNewData() { return Ember.RSVP.resolve({ transactionType: 'Request', requestedItems: [] @@ -14,11 +14,11 @@ export default AbstractEditRoute.extend({ }, actions: { - allRequests: function(model) { + allRequests(model) { this.controller.send('allRequests', model); }, - removeItem: function(model) { + removeItem(model) { this.controller.send('removeItem', model); } }, @@ -26,7 +26,7 @@ export default AbstractEditRoute.extend({ /** * Lazily load inventory items so that it doesn't impact performance. */ - setupController: function(controller, model) { + setupController(controller, model) { this._super(controller, model); let inventoryQuery = { startkey: 'inventory_', diff --git a/app/inventory/route.js b/app/inventory/route.js index b97a5f5734..14d742f3f5 100644 --- a/app/inventory/route.js +++ b/app/inventory/route.js @@ -41,7 +41,7 @@ export default AbstractModuleRoute.extend(FulfillRequest, InventoryId, Inventory sectionTitle: 'Inventory', actions: { - addPurchase: function(newPurchase) { + addPurchase(newPurchase) { let currentItem = this.get('currentItem'); let purchases = currentItem.get('purchases'); purchases.addObject(newPurchase); @@ -53,21 +53,21 @@ export default AbstractModuleRoute.extend(FulfillRequest, InventoryId, Inventory }.bind(this)); }, - newInventoryBatch: function() { + newInventoryBatch() { if (this.currentUserCan(this.get('addCapability'))) { this.transitionTo('inventory.batch', 'new'); } }, - newRequest: function() { + newRequest() { this.transitionTo('inventory.request', 'new'); }, - allItems: function() { + allItems() { this.transitionTo('inventory.listing'); }, - showAddPurchase: function(inventoryItem) { + showAddPurchase(inventoryItem) { let newPurchase = this.get('store').createRecord('inv-purchase', { dateReceived: new Date(), distributionUnit: inventoryItem.get('distributionUnit'), diff --git a/app/inventory/transfer/controller.js b/app/inventory/transfer/controller.js index 0b22bb4773..8d8c097190 100644 --- a/app/inventory/transfer/controller.js +++ b/app/inventory/transfer/controller.js @@ -23,11 +23,11 @@ export default AbstractEditController.extend({ updateCapability: 'adjust_inventory_location', actions: { - cancel: function() { + cancel() { this.send('closeModal'); }, - transfer: function() { + transfer() { this.updateLookupLists(); this.send('transferItems', this.get('model'), true); } diff --git a/app/invoices/add-line-item/controller.js b/app/invoices/add-line-item/controller.js index 759d4ae68d..86e3a7e6d3 100644 --- a/app/invoices/add-line-item/controller.js +++ b/app/invoices/add-line-item/controller.js @@ -13,11 +13,11 @@ export default Ember.Controller.extend(BillingCategories, IsUpdateDisabled, { showUpdateButton: true, actions: { - cancel: function() { + cancel() { this.send('closeModal'); }, - add: function() { + add() { this.get('model').save().then(function(record) { this.get('editController').send('addLineItem', record); }.bind(this)); diff --git a/app/invoices/edit/controller.js b/app/invoices/edit/controller.js index eed8a95f85..a388131959 100644 --- a/app/invoices/edit/controller.js +++ b/app/invoices/edit/controller.js @@ -58,7 +58,7 @@ export default AbstractEditController.extend(NumberFormat, PatientSubmodule, Pub }.property('expenseAccountList.value'), actions: { - addItemCharge: function(lineItem) { + addItemCharge(lineItem) { let details = lineItem.get('details'); let detail = this.store.createRecord('line-item-detail', { id: uuid.v4() @@ -66,22 +66,22 @@ export default AbstractEditController.extend(NumberFormat, PatientSubmodule, Pub details.addObject(detail); }, - addLineItem: function(lineItem) { + addLineItem(lineItem) { let lineItems = this.get('model.lineItems'); lineItems.addObject(lineItem); this.send('update', true); this.send('closeModal'); }, - deleteCharge: function(deleteInfo) { + deleteCharge(deleteInfo) { this._deleteObject(deleteInfo.itemToDelete, deleteInfo.deleteFrom); }, - deleteLineItem: function(deleteInfo) { + deleteLineItem(deleteInfo) { this._deleteObject(deleteInfo.itemToDelete, this.get('model.lineItems')); }, - finalizeInvoice: function() { + finalizeInvoice() { let currentInvoice = this.get('model'); let invoicePayments = currentInvoice.get('payments'); let paymentsToSave = []; @@ -101,11 +101,11 @@ export default AbstractEditController.extend(NumberFormat, PatientSubmodule, Pub }.bind(this)); }, - printInvoice: function() { + printInvoice() { this.transitionToRoute('print.invoice', this.get('model')); }, - removePayment: function(removeInfo) { + removePayment(removeInfo) { let payments = this.get('model.payments'); let payment = removeInfo.itemToRemove; payment.set('invoice'); @@ -114,22 +114,22 @@ export default AbstractEditController.extend(NumberFormat, PatientSubmodule, Pub this.send('closeModal'); }, - showAddLineItem: function() { + showAddLineItem() { let newLineItem = this.store.createRecord('billing-line-item', { id: uuid.v4() }); this.send('openModal', 'invoices.add-line-item', newLineItem); }, - showDeleteItem: function(itemToDelete, deleteFrom) { + showDeleteItem(itemToDelete, deleteFrom) { this.showDeleteModal(itemToDelete, Ember.Object.create({ confirmAction: 'deleteCharge', - deleteFrom: deleteFrom, + deleteFrom, title: 'Delete Charge' })); }, - showDeleteLineItem: function(item) { + showDeleteLineItem(item) { this.showDeleteModal(item, Ember.Object.create({ confirmAction: 'deleteLineItem', title: 'Delete Line Item' @@ -146,7 +146,7 @@ export default AbstractEditController.extend(NumberFormat, PatientSubmodule, Pub this.send('openModal', 'dialog', options); }, - showRemovePayment: function(payment) { + showRemovePayment(payment) { let message = 'Are you sure you want to remove this payment from this invoice?'; let model = Ember.Object.create({ itemToRemove: payment @@ -155,7 +155,7 @@ export default AbstractEditController.extend(NumberFormat, PatientSubmodule, Pub this.displayConfirm(title, message, 'removePayment', model); }, - toggleDetails: function(item) { + toggleDetails(item) { item.toggleProperty('showDetails'); } }, @@ -232,7 +232,7 @@ export default AbstractEditController.extend(NumberFormat, PatientSubmodule, Pub } }.observes('model.visit'), - _addPharmacyCharge: function(charge, medicationItemName) { + _addPharmacyCharge(charge, medicationItemName) { return charge.getMedicationDetails(medicationItemName).then((medicationDetails) => { let quantity = charge.get('quantity'); let pharmacyCharges = this.get('pharmacyCharges'); @@ -240,7 +240,7 @@ export default AbstractEditController.extend(NumberFormat, PatientSubmodule, Pub let pharmacyCharge = this.store.createRecord('line-item-detail', { id: uuid.v4(), name: medicationDetails.name, - quantity: quantity, + quantity, price: medicationDetails.price, department: 'Pharmacy', expenseAccount: pharmacyExpenseAccount @@ -249,20 +249,20 @@ export default AbstractEditController.extend(NumberFormat, PatientSubmodule, Pub }); }, - _addSupplyCharge: function(charge, department) { + _addSupplyCharge(charge, department) { let supplyCharges = this.get('supplyCharges'); let supplyCharge = this._createChargeItem(charge, department); supplyCharges.addObject(supplyCharge); }, - _createChargeItem: function(charge, department) { + _createChargeItem(charge, department) { let chargeItem = this.store.createRecord('line-item-detail', { id: uuid.v4(), name: charge.get('pricingItem.name'), expenseAccount: charge.get('pricingItem.expenseAccount'), quantity: charge.get('quantity'), price: charge.get('pricingItem.price'), - department: department, + department, pricingItem: charge.get('pricingItem') }); return chargeItem; @@ -273,7 +273,7 @@ export default AbstractEditController.extend(NumberFormat, PatientSubmodule, Pub * @param objectToDelete {object} - the object to remove * @param deleteFrom {Array} - the array to remove the object from. */ - _deleteObject: function(objectToDelete, deleteFrom) { + _deleteObject(objectToDelete, deleteFrom) { deleteFrom.removeObject(objectToDelete); if (!objectToDelete.get('isNew')) { objectToDelete.destroyRecord(); @@ -282,11 +282,11 @@ export default AbstractEditController.extend(NumberFormat, PatientSubmodule, Pub this.send('closeModal'); }, - _mapWardCharge: function(charge) { + _mapWardCharge(charge) { return this._createChargeItem(charge, 'Ward'); }, - _completeBeforeUpdate: function(sequence, resolve, reject) { + _completeBeforeUpdate(sequence, resolve, reject) { let invoiceId = 'inv'; let sequenceValue; sequence.incrementProperty('value', 1); @@ -300,7 +300,7 @@ export default AbstractEditController.extend(NumberFormat, PatientSubmodule, Pub sequence.save().then(resolve, reject); }, - _generateLineItems: function(visit, visitChildren) { + _generateLineItems(visit, visitChildren) { let endDate = visit.get('endDate'); let imaging = visitChildren[0].value; let labs = visitChildren[1].value; @@ -420,7 +420,7 @@ export default AbstractEditController.extend(NumberFormat, PatientSubmodule, Pub }); }, - _resolveVisitDescendents: function(results, childNameToResolve) { + _resolveVisitDescendents(results, childNameToResolve) { let promises = []; results.forEach(function(result) { if (!Ember.isEmpty(result.value)) { @@ -438,7 +438,7 @@ export default AbstractEditController.extend(NumberFormat, PatientSubmodule, Pub return promises; }, - beforeUpdate: function() { + beforeUpdate() { return new Ember.RSVP.Promise(function(resolve, reject) { let lineItems = this.get('model.lineItems'); let savePromises = []; @@ -467,7 +467,7 @@ export default AbstractEditController.extend(NumberFormat, PatientSubmodule, Pub }.bind(this)); }, - afterUpdate: function() { + afterUpdate() { let message = 'The invoice record has been saved.'; this.displayAlert('Invoice Saved', message); } diff --git a/app/invoices/edit/route.js b/app/invoices/edit/route.js index 059548fd10..47dfc53aa8 100644 --- a/app/invoices/edit/route.js +++ b/app/invoices/edit/route.js @@ -6,20 +6,20 @@ export default AbstractEditRoute.extend({ newTitle: 'New Invoice', actions: { - deleteCharge: function(model) { + deleteCharge(model) { this.controller.send('deleteCharge', model); }, - deleteLineItem: function(model) { + deleteLineItem(model) { this.controller.send('deleteLineItem', model); }, - removePayment: function(model) { + removePayment(model) { this.controller.send('removePayment', model); } }, - afterModel: function(model) { + afterModel(model) { return new Ember.RSVP.Promise(function(resolve, reject) { let lineItems = model.get('lineItems'); let promises = []; @@ -38,14 +38,14 @@ export default AbstractEditRoute.extend({ }); }, - getNewData: function() { + getNewData() { return Ember.RSVP.resolve({ billDate: new Date(), status: 'Draft' }); }, - setupController: function(controller, model) { + setupController(controller, model) { model.set('originalPaymentProfileId', model.get('paymentProfile.id')); this._super(controller, model); let lineItems = model.get('lineItems'); diff --git a/app/invoices/index/route.js b/app/invoices/index/route.js index 91f33e3858..baabc1c1be 100644 --- a/app/invoices/index/route.js +++ b/app/invoices/index/route.js @@ -4,14 +4,14 @@ export default AbstractIndexRoute.extend({ modelName: 'invoice', pageTitle: 'Invoice Listing', - _getStartKeyFromItem: function(item) { + _getStartKeyFromItem(item) { let billDateAsTime = item.get('billDateAsTime'); let id = this._getPouchIdFromItem(item); let searchStatus = item.get('status'); return [searchStatus, billDateAsTime, id]; }, - _modelQueryParams: function(params) { + _modelQueryParams(params) { let queryParams; let maxId = this._getMaxPouchId(); let maxValue = this.get('maxValue'); diff --git a/app/invoices/payment/controller.js b/app/invoices/payment/controller.js index 7778425088..072c42ddfa 100644 --- a/app/invoices/payment/controller.js +++ b/app/invoices/payment/controller.js @@ -11,7 +11,7 @@ export default AbstractEditController.extend(PatientSubmodule, { expenseAccountList: Ember.computed.alias('invoiceController.expenseAccountList'), patientList: Ember.computed.alias('invoiceController.patientList'), - _finishUpdate: function(message, title) { + _finishUpdate(message, title) { this.send('closeModal'); this.displayAlert(title, message); }, @@ -41,7 +41,7 @@ export default AbstractEditController.extend(PatientSubmodule, { return (isNew && type === 'Deposit'); }.property('model.isNew', 'model.paymentType'), - beforeUpdate: function() { + beforeUpdate() { if (this.get('model.isNew')) { this.set('newPayment', true); } else { @@ -52,7 +52,7 @@ export default AbstractEditController.extend(PatientSubmodule, { return Ember.RSVP.resolve(); }, - afterUpdate: function() { + afterUpdate() { this.get('model').save().then(function(record) { if (this.get('newPayment')) { let patient = this.get('currentPatient'); diff --git a/app/invoices/route.js b/app/invoices/route.js index 46b5781950..ca834524b5 100644 --- a/app/invoices/route.js +++ b/app/invoices/route.js @@ -33,7 +33,7 @@ export default AbstractModuleRoute.extend(ModalHelper, PatientListRoute, { }], actions: { - showAddDeposit: function() { + showAddDeposit() { let payment = this.store.createRecord('payment', { paymentType: 'Deposit', datePaid: new Date() @@ -41,16 +41,16 @@ export default AbstractModuleRoute.extend(ModalHelper, PatientListRoute, { this.send('openModal', 'invoices.payment', payment); }, - showAddPayment: function(invoice) { + showAddPayment(invoice) { let payment = this.store.createRecord('payment', { - invoice: invoice, + invoice, paymentType: 'Payment', datePaid: new Date() }); this.send('openModal', 'invoices.payment', payment); }, - showEditPayment: function(payment) { + showEditPayment(payment) { if (this.currentUserCan('add_payment')) { this.send('openModal', 'invoices.payment', payment); } diff --git a/app/labs/delete/controller.js b/app/labs/delete/controller.js index f36abf3a43..66e369ed76 100644 --- a/app/labs/delete/controller.js +++ b/app/labs/delete/controller.js @@ -6,7 +6,7 @@ export default AbstractDeleteController.extend(PatientSubmodule, { title: t('labs.deleteTitle'), actions: { - delete: function() { + delete() { this.deleteChildFromVisit('labs'); } } diff --git a/app/labs/edit/controller.js b/app/labs/edit/controller.js index 7a652a77f0..c08448a2a8 100644 --- a/app/labs/edit/controller.js +++ b/app/labs/edit/controller.js @@ -21,7 +21,7 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, { }.property('selectedLabType.[]', 'model.labTypeName'), actions: { - completeLab: function() { + completeLab() { this.set('model.status', 'Completed'); this.get('model').validate().then(function() { if (this.get('model.isValid')) { @@ -34,7 +34,7 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, { /** * Update the model and perform the before update and after update */ - update: function() { + update() { if (this.get('model.isNew')) { let newLab = this.get('model'); let selectedLabType = this.get('selectedLabType'); @@ -88,7 +88,7 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, { updateCapability: 'add_lab', - afterUpdate: function(saveResponse, multipleRecords) { + afterUpdate(saveResponse, multipleRecords) { let i18n = this.get('i18n'); let afterDialogAction, alertMessage, alertTitle; if (this.get('model.status') === 'Completed') { diff --git a/app/labs/edit/route.js b/app/labs/edit/route.js index 3d586ebea3..6484205461 100644 --- a/app/labs/edit/route.js +++ b/app/labs/edit/route.js @@ -11,12 +11,12 @@ export default AbstractEditRoute.extend(ChargeRoute, PatientListRoute, { pricingCategory: 'Lab', actions: { - returnToAllItems: function() { + returnToAllItems() { this.controller.send('returnToAllItems'); } }, - getNewData: function() { + getNewData() { return Ember.RSVP.resolve({ selectPatient: true, requestDate: moment().startOf('day').toDate() diff --git a/app/labs/index/route.js b/app/labs/index/route.js index 02700e7fad..91e92aa8b6 100644 --- a/app/labs/index/route.js +++ b/app/labs/index/route.js @@ -6,7 +6,7 @@ export default AbstractIndexRoute.extend({ pageTitle: t('labs.requestsTitle'), searchStatus: 'Requested', - _getStartKeyFromItem: function(item) { + _getStartKeyFromItem(item) { let labDateAsTime = item.get('labDateAsTime'); let id = this._getPouchIdFromItem(item); let requestedDateAsTime = item.get('requestedDateAsTime'); @@ -14,7 +14,7 @@ export default AbstractIndexRoute.extend({ return [searchStatus, requestedDateAsTime, labDateAsTime, id]; }, - _modelQueryParams: function() { + _modelQueryParams() { let maxId = this._getMaxPouchId(); let maxValue = this.get('maxValue'); let minId = this._getMinPouchId(); diff --git a/app/medication/delete/controller.js b/app/medication/delete/controller.js index 187b59a1fa..bbcff0400d 100644 --- a/app/medication/delete/controller.js +++ b/app/medication/delete/controller.js @@ -5,7 +5,7 @@ export default AbstractDeleteController.extend(PatientSubmodule, { title: t('labels.delete_request'), actions: { - delete: function() { + delete() { this.deleteChildFromVisit('medication'); } } diff --git a/app/medication/edit/controller.js b/app/medication/edit/controller.js index 4e237120b1..6c16909c5d 100644 --- a/app/medication/edit/controller.js +++ b/app/medication/edit/controller.js @@ -69,7 +69,7 @@ export default AbstractEditController.extend(InventorySelection, FulfillRequest, medicationList: [], updateCapability: 'add_medication', - afterUpdate: function() { + afterUpdate() { let i18n = this.get('i18n'); let alertTitle, alertMessage; let isFulfilled = this.get('isFulfilled'); @@ -84,14 +84,14 @@ export default AbstractEditController.extend(InventorySelection, FulfillRequest, this.saveVisitIfNeeded(alertTitle, alertMessage); }, - _addNewPatient: function() { + _addNewPatient() { let i18n = this.get('i18n'); this.displayAlert(i18n.t('alerts.pleaseWait'), i18n.t('messages.newPatientHasToBeCreated')); this._getNewPatientId().then(function(friendlyId) { let patientTypeAhead = this.get('model.patientTypeAhead'); let nameParts = patientTypeAhead.split(' '); let patientDetails = { - friendlyId: friendlyId, + friendlyId, patientFullName: patientTypeAhead, requestingController: this }; @@ -111,7 +111,7 @@ export default AbstractEditController.extend(InventorySelection, FulfillRequest, }.bind(this)); }, - _getNewPatientId: function() { + _getNewPatientId() { let newPatientId = this.get('newPatientId'); if (Ember.isEmpty(newPatientId)) { return new Ember.RSVP.Promise(function(resolve, reject) { @@ -125,7 +125,7 @@ export default AbstractEditController.extend(InventorySelection, FulfillRequest, } }, - beforeUpdate: function() { + beforeUpdate() { let isFulfilling = this.get('isFulfilling'); let isNew = this.get('model.isNew'); if (isNew || isFulfilling) { @@ -167,14 +167,14 @@ export default AbstractEditController.extend(InventorySelection, FulfillRequest, } }, - finishBeforeUpdate: function(isFulfilling, resolve) { + finishBeforeUpdate(isFulfilling, resolve) { if (isFulfilling) { let inventoryLocations = this.get('model.inventoryLocations'); let inventoryRequest = this.get('store').createRecord('inv-request', { expenseAccount: this.get('model.expenseAccount'), dateCompleted: new Date(), inventoryItem: this.get('model.inventoryItem'), - inventoryLocations: inventoryLocations, + inventoryLocations, quantity: this.get('model.quantity'), transactionType: 'Fulfillment', patient: this.get('model.patient'), @@ -209,7 +209,7 @@ export default AbstractEditController.extend(InventorySelection, FulfillRequest, }.property('model.isNew', 'isFulfilling', 'model.hideFulfillRequest'), actions: { - addedNewPatient: function(record) { + addedNewPatient(record) { this.send('closeModal'); this.set('model.patient', record); this.set('newPatientId'); diff --git a/app/medication/edit/route.js b/app/medication/edit/route.js index 4fd7885cee..b901adaa68 100644 --- a/app/medication/edit/route.js +++ b/app/medication/edit/route.js @@ -9,7 +9,7 @@ export default AbstractEditRoute.extend(FulfillRequest, InventoryLocations, Pati modelName: 'medication', newTitle: t('medication.titles.newMedicationRequest'), database: Ember.inject.service(), - getNewData: function(params) { + getNewData(params) { let idParam = this.get('idParam'); let newData = { selectPatient: true, @@ -23,7 +23,7 @@ export default AbstractEditRoute.extend(FulfillRequest, InventoryLocations, Pati return Ember.RSVP.resolve(newData); }, - model: function(params) { + model(params) { let idParam = this.get('idParam'); if (!Ember.isEmpty(idParam) && params[idParam] === 'new' || params[idParam] === 'dispense') { return this._createNewRecord(params); @@ -32,7 +32,7 @@ export default AbstractEditRoute.extend(FulfillRequest, InventoryLocations, Pati } }, - setupController: function(controller, model) { + setupController(controller, model) { this._super(controller, model); let inventoryQuery = { key: 'Medication', diff --git a/app/medication/index/route.js b/app/medication/index/route.js index 5a8611a045..89d72a1c3c 100644 --- a/app/medication/index/route.js +++ b/app/medication/index/route.js @@ -5,7 +5,7 @@ export default AbstractIndexRoute.extend({ pageTitle: t('medication.pageTitle'), searchStatus: 'Requested', - _getStartKeyFromItem: function(item) { + _getStartKeyFromItem(item) { let prescriptionDateAsTime = item.get('prescriptionDateAsTime'); let id = this._getPouchIdFromItem(item); let requestedDateAsTime = item.get('requestedDateAsTime'); @@ -13,7 +13,7 @@ export default AbstractIndexRoute.extend({ return [searchStatus, requestedDateAsTime, prescriptionDateAsTime, id]; }, - _modelQueryParams: function() { + _modelQueryParams() { let maxId = this._getMaxPouchId(); let maxValue = this.get('maxValue'); let minId = this._getMinPouchId(); diff --git a/app/medication/return/controller.js b/app/medication/return/controller.js index ddd5511d99..1ccd1f084d 100644 --- a/app/medication/return/controller.js +++ b/app/medication/return/controller.js @@ -76,7 +76,7 @@ export default AbstractEditController.extend(FulfillRequest, InventoryLocations, return this.get('patientMedicationList'); }.property('setNewMedicationList', 'model.patient', 'model.visit'), - _finishUpdate: function() { + _finishUpdate() { let aisle = this.get('model.deliveryAisle'); let location = this.get('model.deliveryLocation'); let inventoryItem = this.get('model.inventoryItem'); @@ -94,12 +94,12 @@ export default AbstractEditController.extend(FulfillRequest, InventoryLocations, }, actions: { - doneFulfillRequest: function() { + doneFulfillRequest() { let i18n = this.get('i18n'); this.updateLookupLists(); this.displayAlert(i18n.t('medication.alerts.returnedTitle'), i18n.t('medication.alerts.returnedMessage'), 'allItems'); }, - update: function() { + update() { let medication = this.get('model.medication'); let quantity = this.get('model.quantity'); if (!Ember.isEmpty(medication)) { diff --git a/app/medication/return/route.js b/app/medication/return/route.js index 5c28ebac29..945f6e51dc 100644 --- a/app/medication/return/route.js +++ b/app/medication/return/route.js @@ -6,7 +6,7 @@ export default MedicationEditRoute.extend({ editTitle: t('medication.returnMedication'), modelName: 'inv-request', newTitle: t('medication.returnMedication'), - getNewData: function() { + getNewData() { return Ember.RSVP.resolve({ dateCompleted: new Date(), selectPatient: true, diff --git a/app/medication/route.js b/app/medication/route.js index e4077cd73e..86b9978ae9 100644 --- a/app/medication/route.js +++ b/app/medication/route.js @@ -46,13 +46,13 @@ export default AbstractModuleRoute.extend({ }], actions: { - dispenseMedication: function() { + dispenseMedication() { if (this.currentUserCan('fulfill_medication')) { this.transitionTo('medication.edit', 'dispense'); } }, - returnMedication: function() { + returnMedication() { if (this.currentUserCan(this.get('addCapability'))) { this.transitionTo('medication.return', 'new'); } diff --git a/app/mixins/charge-actions.js b/app/mixins/charge-actions.js index 5da6af0b6c..c16f1044b7 100644 --- a/app/mixins/charge-actions.js +++ b/app/mixins/charge-actions.js @@ -4,7 +4,7 @@ export default Ember.Mixin.create({ pricingList: null, pricingTypeForObjectType: null, pricingTypes: null, - _createNewChargeRecord: function(quantityCharged, pricingId) { + _createNewChargeRecord(quantityCharged, pricingId) { return new Ember.RSVP.Promise(function(resolve, reject) { this.store.find('pricing', pricingId).then(function(item) { let newCharge = this.store.createRecord('proc-charge', { @@ -22,14 +22,14 @@ export default Ember.Mixin.create({ }, actions: { - addCharge: function(charge) { + addCharge(charge) { let charges = this.get('model.charges'); charges.addObject(charge); this.send('update', true); this.send('closeModal'); }, - deleteCharge: function(model) { + deleteCharge(model) { let chargeToDelete = model.get('chargeToDelete'); let charges = this.get('model.charges'); charges.removeObject(chargeToDelete); @@ -38,7 +38,7 @@ export default Ember.Mixin.create({ this.send('closeModal'); }, - showAddCharge: function() { + showAddCharge() { let newCharge = this.get('store').createRecord('proc-charge', { dateCharged: new Date(), quantity: 1, @@ -47,13 +47,13 @@ export default Ember.Mixin.create({ this.send('openModal', this.get('chargeRoute'), newCharge); }, - showEditCharge: function(charge) { + showEditCharge(charge) { charge.set('itemName', charge.get('pricingItem.name')); charge.set('pricingCategory', this.get('chargePricingCategory')); this.send('openModal', this.get('chargeRoute'), charge); }, - showDeleteCharge: function(charge) { + showDeleteCharge(charge) { this.send('openModal', 'dialog', Ember.Object.create({ confirmAction: 'deleteCharge', title: 'Delete Charge Item', @@ -64,7 +64,7 @@ export default Ember.Mixin.create({ })); }, - setChargeQuantity: function(id, quantity) { + setChargeQuantity(id, quantity) { let model = this.get('model'); model.set(id, quantity); } @@ -89,7 +89,7 @@ export default Ember.Mixin.create({ chargeRoute: null, - findChargeForPricingItem: function(pricingItem, charges) { + findChargeForPricingItem(pricingItem, charges) { let chargeForItem = charges.find(function(charge) { let chargePricingItemId = charge.get('pricingItem.id'); return (pricingItem.id === chargePricingItemId); @@ -145,7 +145,7 @@ export default Ember.Mixin.create({ * @param {string} newVisitType if a new visit needs to be created, what type of visit * should be created. */ - createMultipleRequests: function(pricingRecords, pricingField, visitChildName, newVisitType) { + createMultipleRequests(pricingRecords, pricingField, visitChildName, newVisitType) { let firstRecord = pricingRecords.get('firstObject'); let modelToSave = this.get('model'); modelToSave.set(pricingField, firstRecord); @@ -156,7 +156,7 @@ export default Ember.Mixin.create({ }.bind(this)); }, - _finishCreateMultipleRequests: function(pricingRecords, pricingField, visitChildName, newVisitType, visit) { + _finishCreateMultipleRequests(pricingRecords, pricingField, visitChildName, newVisitType, visit) { let attributesToSave = {}; let baseModel = this.get('model'); let modelToSave; @@ -190,7 +190,7 @@ export default Ember.Mixin.create({ }.bind(this)); }, - saveNewPricing: function(pricingName, pricingCategory, priceObjectToSet) { + saveNewPricing(pricingName, pricingCategory, priceObjectToSet) { return new Ember.RSVP.Promise(function(resolve, reject) { let newPricing; let pricingTypeForObjectType = this.get('pricingTypeForObjectType'); @@ -210,7 +210,7 @@ export default Ember.Mixin.create({ }.bind(this), `saveNewPricing for: ${pricingName}`); }, - getSelectedPricing: function(selectedField) { + getSelectedPricing(selectedField) { let selectedItem = this.get(selectedField); if (!Ember.isEmpty(selectedItem)) { return new Ember.RSVP.Promise(function(resolve, reject) { @@ -262,7 +262,7 @@ export default Ember.Mixin.create({ /** * When using organizeByType charges need to be mapped over from the price lists */ - updateCharges: function() { + updateCharges() { let charges = this.get('model.charges'); let organizeByType = this.get('organizeByType'); let pricingList = this.get('pricingList'); diff --git a/app/mixins/charge-route.js b/app/mixins/charge-route.js index 1acccb6a2d..4b55c5ce2d 100644 --- a/app/mixins/charge-route.js +++ b/app/mixins/charge-route.js @@ -2,13 +2,13 @@ import Ember from 'ember'; export default Ember.Mixin.create({ database: Ember.inject.service(), actions: { - deleteCharge: function(model) { + deleteCharge(model) { this.controller.send('deleteCharge', model); } }, pricingList: null, - afterModel: function() { + afterModel() { return new Ember.RSVP.Promise(function(resolve, reject) { let database = this.get('database'); let maxId = database.getPouchId({}, 'pricing'); @@ -29,7 +29,7 @@ export default Ember.Mixin.create({ }.bind(this)); }, - setupController: function(controller, model) { + setupController(controller, model) { this._super(controller, model); controller.set('pricingList', this.get('pricingList')); } diff --git a/app/mixins/date-format.js b/app/mixins/date-format.js index 4190b50f10..c08c6be0fb 100644 --- a/app/mixins/date-format.js +++ b/app/mixins/date-format.js @@ -1,6 +1,6 @@ import Ember from 'ember'; export default Ember.Mixin.create({ - _dateFormat: function(value, dateFormat) { + _dateFormat(value, dateFormat) { if (Ember.isEmpty(dateFormat)) { dateFormat = 'l'; } @@ -9,7 +9,7 @@ export default Ember.Mixin.create({ } }, - dateToTime: function(date) { + dateToTime(date) { if (!Ember.isEmpty(date) && date.getTime) { return date.getTime(); } diff --git a/app/mixins/dob-days.js b/app/mixins/dob-days.js index 293ebe06e9..0547bc3b91 100644 --- a/app/mixins/dob-days.js +++ b/app/mixins/dob-days.js @@ -1,6 +1,6 @@ import Ember from 'ember'; export default Ember.Mixin.create({ - convertDOBToText: function(birthDate, shortFormat, omitDays) { + convertDOBToText(birthDate, shortFormat, omitDays) { let today = new Date(); let years = 0; let months = 0; @@ -45,9 +45,9 @@ export default Ember.Mixin.create({ let formatString = ''; let options = { - years: years, - days: days, - months: months + years, + days, + months }; let i18n = this.get('i18n'); if (shortFormat) { diff --git a/app/mixins/fulfill-request.js b/app/mixins/fulfill-request.js index c3f1ec1638..0157e31661 100644 --- a/app/mixins/fulfill-request.js +++ b/app/mixins/fulfill-request.js @@ -2,16 +2,16 @@ import Ember from 'ember'; // NOTE!!! inventory-locations mixin is needed for fulfill-request mixin! export default Ember.Mixin.create({ actions: { - doneFulfillRequest: function() { + doneFulfillRequest() { // Placeholder function; override if you need to know when fulfillrequest is complete. }, - fulfillRequest: function(request, closeModal, increment, skipTransition) { + fulfillRequest(request, closeModal, increment, skipTransition) { this.performFulfillRequest(request, closeModal, increment, skipTransition); } }, - performFulfillRequest: function(request, closeModal, increment, skipTransition) { + performFulfillRequest(request, closeModal, increment, skipTransition) { return new Ember.RSVP.Promise(function(resolve, reject) { let markAsConsumed = request.get('markAsConsumed'); let transactionType = request.get('transactionType'); @@ -43,7 +43,7 @@ export default Ember.Mixin.create({ /** * @private */ - _findQuantity: function(request, purchases, item, increment) { + _findQuantity(request, purchases, item, increment) { let costPerUnit; let requestPurchases = []; let quantityOnHand = item.get('quantity'); @@ -116,7 +116,7 @@ export default Ember.Mixin.create({ * @param {boolean} increment if the request should increment, not decrement * @param {boolean} skipTransition if the transition should not run after fulfillment. */ - _finishFulfillRequest: function(request, inventoryItem, closeModal, increment, skipTransition) { + _finishFulfillRequest(request, inventoryItem, closeModal, increment, skipTransition) { let inventoryLocations = request.get('inventoryLocations'); let locationsAffected = []; let markAsConsumed = request.get('markAsConsumed'); @@ -129,7 +129,7 @@ export default Ember.Mixin.create({ promises.push(locationToIncrement.save()); locationsAffected.push({ name: locationToIncrement.get('locationName'), - quantity: quantity + quantity }); } else { inventoryLocations.reduce(function(quantityNeeded, location) { @@ -206,7 +206,7 @@ export default Ember.Mixin.create({ * @returns true if the request is fulfilled; false if it cannot be fulfilled due to a lack * of stock. */ - _performFulfillment: function(request, inventoryItem, increment) { + _performFulfillment(request, inventoryItem, increment) { return new Ember.RSVP.Promise(function(resolve, reject) { let purchases = inventoryItem.get('purchases'); let quantityOnHand = inventoryItem.get('quantity'); diff --git a/app/mixins/inventory-id.js b/app/mixins/inventory-id.js index 5b4adbd4ef..3eea40851b 100644 --- a/app/mixins/inventory-id.js +++ b/app/mixins/inventory-id.js @@ -4,7 +4,7 @@ export default Ember.Mixin.create({ * Calculate a new id based on time stamp and randomized number * @return a generated id in base 36 so that its a shorter barcode. */ - generateId: function() { + generateId() { let min = 1; let max = 999; let part1 = new Date().getTime(); diff --git a/app/mixins/inventory-locations.js b/app/mixins/inventory-locations.js index 407382f169..3ee426d74a 100644 --- a/app/mixins/inventory-locations.js +++ b/app/mixins/inventory-locations.js @@ -3,7 +3,7 @@ export default Ember.Mixin.create({ aisleToFind: null, locationToFind: null, - _addQuantityToLocation: function(inventoryItem, quantity, location, aisle) { + _addQuantityToLocation(inventoryItem, quantity, location, aisle) { return new Ember.RSVP.Promise(function(resolve, reject) { this._findOrCreateLocation(inventoryItem, location, aisle).then(function(foundLocation) { foundLocation.incrementProperty('quantity', quantity); @@ -12,7 +12,7 @@ export default Ember.Mixin.create({ }.bind(this)); }, - _findOrCreateLocation: function(inventoryItem, location, aisle) { + _findOrCreateLocation(inventoryItem, location, aisle) { return new Ember.RSVP.Promise(function(resolve, reject) { let foundLocation = false; let locations = inventoryItem.get('locations'); @@ -26,7 +26,7 @@ export default Ember.Mixin.create({ let locationRecord = this.get('store').createRecord('inv-location', { id: uuid.v4(), aisleLocation: aisle, - location: location, + location, quantity: 0 }); locations.addObject(locationRecord); @@ -37,7 +37,7 @@ export default Ember.Mixin.create({ }.bind(this)); }, - findLocation: function(inventoryLocation) { + findLocation(inventoryLocation) { let aisleLocation = inventoryLocation.get('aisleLocation'); let aisleToFind = this.get('aisleToFind'); let itemLocation = inventoryLocation.get('location'); @@ -53,7 +53,7 @@ export default Ember.Mixin.create({ * with the number of items available. * @returns {Promise} a promise that fulfills once location has been updated. */ - newPurchaseAdded: function(inventoryItem, newPurchase) { + newPurchaseAdded(inventoryItem, newPurchase) { return new Ember.RSVP.Promise(function(resolve, reject) { let aisle = newPurchase.get('aisleLocation'); let location = newPurchase.get('location'); @@ -68,7 +68,7 @@ export default Ember.Mixin.create({ * @param {Object} inventoryItem the inventory item the location belongs to. * @return {Promise} promise for save or remove */ - saveLocation: function(location, inventoryItem) { + saveLocation(location, inventoryItem) { if (location.get('quantity') === 0) { let locations = inventoryItem.get('locations'); locations.removeObject(location); @@ -85,7 +85,7 @@ export default Ember.Mixin.create({ * attributes about where to transfer to. * @returns {Promise} a promise that fulfills once the transfer to location has been saved. */ - transferToLocation: function(inventoryItem, transferLocation) { + transferToLocation(inventoryItem, transferLocation) { let aisle = transferLocation.get('transferAisleLocation'); let location = transferLocation.get('transferLocation'); let quantity = parseInt(transferLocation.get('adjustmentQuantity')); diff --git a/app/mixins/location-name.js b/app/mixins/location-name.js index 9c425173e4..a26cadc93b 100644 --- a/app/mixins/location-name.js +++ b/app/mixins/location-name.js @@ -1,6 +1,6 @@ import Ember from 'ember'; export default Ember.Mixin.create({ - getDisplayLocationName: function(location, aisleLocation) { + getDisplayLocationName(location, aisleLocation) { let locationName = this.formatLocationName(location, aisleLocation); if (Ember.isEmpty(locationName)) { locationName = 'No Location'; @@ -8,7 +8,7 @@ export default Ember.Mixin.create({ return locationName; }, - formatLocationName: function(location, aisleLocation) { + formatLocationName(location, aisleLocation) { let locationName = ''; if (!Ember.isEmpty(location)) { locationName += location; diff --git a/app/mixins/medication-details.js b/app/mixins/medication-details.js index 21d67e30af..7b70fa36bf 100644 --- a/app/mixins/medication-details.js +++ b/app/mixins/medication-details.js @@ -2,7 +2,7 @@ import Ember from 'ember'; import DS from 'ember-data'; export default Ember.Mixin.create({ // Denormalized medication details so that inventory records do not need to be retrieved - getMedicationName: function(inventoryAttribute) { + getMedicationName(inventoryAttribute) { let medicationTitle = this.get('medicationTitle'); if (!Ember.isEmpty(medicationTitle)) { return medicationTitle; @@ -18,7 +18,7 @@ export default Ember.Mixin.create({ } }, - getMedicationPrice: function(inventoryAttribute) { + getMedicationPrice(inventoryAttribute) { let priceOfMedication = this.get('priceOfMedication'); if (!Ember.isEmpty(priceOfMedication)) { return priceOfMedication; @@ -29,7 +29,7 @@ export default Ember.Mixin.create({ } }, - getMedicationDetails: function(inventoryAttribute) { + getMedicationDetails(inventoryAttribute) { return new Ember.RSVP.Promise((resolve) => { let medicationTitle = this.get('medicationTitle'); let priceOfMedication = this.get('priceOfMedication'); diff --git a/app/mixins/modal-helper.js b/app/mixins/modal-helper.js index 81f0946c0d..4bb6075e80 100644 --- a/app/mixins/modal-helper.js +++ b/app/mixins/modal-helper.js @@ -5,21 +5,21 @@ export default Ember.Mixin.create({ * @param title string containing the title to display. * @param message string containing the message to display. */ - displayAlert: function(title, message, okAction) { + displayAlert(title, message, okAction) { let i18n = this.get('i18n'); let modalOptions = Ember.Object.extend({ updateButtonText: i18n.t('buttons.ok') }); this.send('openModal', 'dialog', modalOptions.create({ - title: title, - message: message, - okAction: okAction, + title, + message, + okAction, hideCancelButton: true, updateButtonAction: 'ok' })); }, - displayConfirm: function(title, message, confirmAction, model) { + displayConfirm(title, message, confirmAction, model) { if (Ember.isEmpty(model)) { model = Ember.Object.create(); } diff --git a/app/mixins/number-format.js b/app/mixins/number-format.js index 0ee307b131..581d968ee0 100644 --- a/app/mixins/number-format.js +++ b/app/mixins/number-format.js @@ -6,7 +6,7 @@ export default Ember.Mixin.create({ * @param propertyName String the property name in the array values to total. * @param number that contains at most two decimal places. */ - _calculateTotal: function(array, propertyName) { + _calculateTotal(array, propertyName) { let arrayItems; let total = 0; if (Ember.isArray(array)) { @@ -25,7 +25,7 @@ export default Ember.Mixin.create({ * @param number the number to valdiate. * @returns number a valid number. */ - _getValidNumber: function(number) { + _getValidNumber(number) { if (Ember.isEmpty(number) || isNaN(number)) { return 0; } else { @@ -40,7 +40,7 @@ export default Ember.Mixin.create({ * as a number instead of a string * @returns String|Number a formatted String or number containing the formatted number. */ - _numberFormat: function(value, returnAsNumber) { + _numberFormat(value, returnAsNumber) { let returnValue; if (!Ember.isEmpty(value)) { if (isNaN(value)) { @@ -59,7 +59,7 @@ export default Ember.Mixin.create({ } }, - _validNumber: function(number) { + _validNumber(number) { return (!Ember.isEmpty(number) && !isNaN(number) && number > 0); } diff --git a/app/mixins/paging-actions.js b/app/mixins/paging-actions.js index d9138ec706..8b89029126 100644 --- a/app/mixins/paging-actions.js +++ b/app/mixins/paging-actions.js @@ -5,16 +5,16 @@ export default Ember.Mixin.create({ nextPage: 'nextPage', previousPage: 'previousPage', actions: { - firstPage: function() { + firstPage() { this.sendAction('firstPage'); }, - lastPage: function() { + lastPage() { this.sendAction('lastPage'); }, - nextPage: function() { + nextPage() { this.sendAction('nextPage'); }, - previousPage: function() { + previousPage() { this.sendAction('previousPage'); } } diff --git a/app/mixins/patient-appointments.js b/app/mixins/patient-appointments.js index 8c022b2abf..77cea05644 100644 --- a/app/mixins/patient-appointments.js +++ b/app/mixins/patient-appointments.js @@ -2,7 +2,7 @@ import Ember from 'ember'; import PouchDbMixin from 'hospitalrun/mixins/pouchdb'; export default Ember.Mixin.create(PouchDbMixin, { - getPatientAppointments: function(patient) { + getPatientAppointments(patient) { let patientId = patient.get('id'); let maxValue = this.get('maxValue'); return this.store.query('appointment', { diff --git a/app/mixins/patient-diagnosis.js b/app/mixins/patient-diagnosis.js index 966b197287..44cfddf659 100644 --- a/app/mixins/patient-diagnosis.js +++ b/app/mixins/patient-diagnosis.js @@ -1,6 +1,6 @@ import Ember from 'ember'; export default Ember.Mixin.create({ - _addDiagnosisToList: function(diagnosis, diagnosesList, visit) { + _addDiagnosisToList(diagnosis, diagnosesList, visit) { if (!Ember.isEmpty(diagnosis)) { if (Ember.isEmpty(diagnosesList.findBy('description', diagnosis))) { diagnosesList.addObject({ @@ -11,7 +11,7 @@ export default Ember.Mixin.create({ } }, - getPrimaryDiagnoses: function(visits) { + getPrimaryDiagnoses(visits) { let diagnosesList = []; if (!Ember.isEmpty(visits)) { visits.forEach(function(visit) { @@ -26,7 +26,7 @@ export default Ember.Mixin.create({ return diagnosesList; }, - getSecondaryDiagnoses: function(visits) { + getSecondaryDiagnoses(visits) { let diagnosesList = []; if (!Ember.isEmpty(visits)) { visits.forEach(function(visit) { diff --git a/app/mixins/patient-invoices.js b/app/mixins/patient-invoices.js index 325732ddcd..e8af2bc941 100644 --- a/app/mixins/patient-invoices.js +++ b/app/mixins/patient-invoices.js @@ -2,7 +2,7 @@ import Ember from 'ember'; import PouchDbMixin from 'hospitalrun/mixins/pouchdb'; export default Ember.Mixin.create(PouchDbMixin, { - getPatientInvoices: function(patient) { + getPatientInvoices(patient) { let patientId = patient.get('id'); return this.store.query('invoice', { options: { diff --git a/app/mixins/patient-list-route.js b/app/mixins/patient-list-route.js index 0702da07df..66de40cbe5 100644 --- a/app/mixins/patient-list-route.js +++ b/app/mixins/patient-list-route.js @@ -5,7 +5,7 @@ export default Ember.Mixin.create({ /** * Lazily load patient list so that it doesn't impact performance. */ - _fetchPatientList: function(controller) { + _fetchPatientList(controller) { let patientQuery = { startkey: 'patient_', endkey: 'patient_\uffff', @@ -23,17 +23,17 @@ export default Ember.Mixin.create({ }, actions: { - returnToPatient: function() { + returnToPatient() { this.controller.send('returnToPatient'); this.controller.send('closeModal'); }, - returnToVisit: function() { + returnToVisit() { this.controller.send('returnToVisit'); } }, - setupController: function(controller, model) { + setupController(controller, model) { this._super(controller, model); this._fetchPatientList(controller); } diff --git a/app/mixins/patient-name.js b/app/mixins/patient-name.js index acedd7d3e3..e74f36a646 100644 --- a/app/mixins/patient-name.js +++ b/app/mixins/patient-name.js @@ -1,6 +1,6 @@ import Ember from 'ember'; export default Ember.Mixin.create({ - getPatientDisplayId: function(patient) { + getPatientDisplayId(patient) { let externalPatientId = Ember.get(patient, 'externalPatientId'); let friendlyId = Ember.get(patient, 'friendlyId'); let id = Ember.get(patient, 'id'); @@ -13,7 +13,7 @@ export default Ember.Mixin.create({ } }, - getPatientDisplayName: function(patient) { + getPatientDisplayName(patient) { let firstName = Ember.get(patient, 'firstName'); let lastName = Ember.get(patient, 'lastName'); let middleName = Ember.get(patient, 'middleName'); diff --git a/app/mixins/patient-notes.js b/app/mixins/patient-notes.js index 58b94be30d..92af1580a2 100644 --- a/app/mixins/patient-notes.js +++ b/app/mixins/patient-notes.js @@ -1,15 +1,15 @@ import Ember from 'ember'; export default Ember.Mixin.create({ - canAddNote: function() { + canAddNote() { return this.currentUserCan('add_note') && (!Ember.isEmpty(this.get('visits')) || !Ember.isEmpty(this.get('model.visits'))); }, - canDeleteNote: function() { + canDeleteNote() { return this.currentUserCan('delete_note'); }, - _computeNoteType: function(visit) { + _computeNoteType(visit) { switch (visit.get('visitType')) { case 'Admission': if (Ember.isEmpty(visit.get('procedures'))) { @@ -25,7 +25,7 @@ export default Ember.Mixin.create({ } }, - _setNoteType: function() { + _setNoteType() { let model = this.get('model'); if (model.get('noteType') == null) { model.set('noteType', this._computeNoteType(model.get('visit'))); diff --git a/app/mixins/patient-submodule.js b/app/mixins/patient-submodule.js index e29ecaf638..0a43904449 100644 --- a/app/mixins/patient-submodule.js +++ b/app/mixins/patient-submodule.js @@ -10,19 +10,19 @@ export default Ember.Mixin.create(PatientVisits, { newVisitAdded: null, actions: { - showPatient: function(patient) { + showPatient(patient) { this.transitionToRoute('patients.edit', patient); }, - returnToAllItems: function() { + returnToAllItems() { this._cancelUpdate(); this.send('allItems'); }, - returnToPatient: function() { + returnToPatient() { this._cancelUpdate(); this.transitionToRoute('patients.edit', this.get('returnPatientId')); }, - returnToVisit: function() { + returnToVisit() { this._cancelUpdate(); this.transitionToRoute('visits.edit', this.get('returnVisitId')); } @@ -38,7 +38,7 @@ export default Ember.Mixin.create(PatientVisits, { * @returns {Promise} promise that will resolve or reject depending on whether or * not the add and subsequent saves were successful. */ - addChildToVisit: function(objectToAdd, childName, newVisitType) { + addChildToVisit(objectToAdd, childName, newVisitType) { return new Ember.RSVP.Promise(function(resolve, reject) { let visit = this.get('model.visit'); if (Ember.isEmpty(visit)) { @@ -51,7 +51,7 @@ export default Ember.Mixin.create(PatientVisits, { }.bind(this)); }, - _finishAddChildToVisit: function(objectToAdd, childName, visit, resolve, reject) { + _finishAddChildToVisit(objectToAdd, childName, visit, resolve, reject) { visit.get(childName).then(function(visitChildren) { visitChildren.addObject(objectToAdd); this.set('needToUpdateVisit', true); @@ -71,7 +71,7 @@ export default Ember.Mixin.create(PatientVisits, { } }.property('model.returnToPatient', 'model.returnToVisit'), - createNewVisit: function(newVisitType) { + createNewVisit(newVisitType) { return new Ember.RSVP.Promise(function(resolve, reject) { let model = this.get('model'); let patient = model.get('patient'); @@ -79,7 +79,7 @@ export default Ember.Mixin.create(PatientVisits, { startDate: new Date(), endDate: new Date(), outPatient: true, - patient: patient, + patient, visitType: newVisitType }); model.set('visit', visit); @@ -161,7 +161,7 @@ export default Ember.Mixin.create(PatientVisits, { * @returns {Promise} promise that will resolve or reject depending on whether or * not the remove and subsequent save were successful. */ - removeChildFromVisit: function(objectToRemove, childName) { + removeChildFromVisit(objectToRemove, childName) { return new Ember.RSVP.Promise(function(resolve, reject) { let childPromises = []; let visit = this.get('model.visit'); @@ -180,7 +180,7 @@ export default Ember.Mixin.create(PatientVisits, { * @returns {array} of promises which can be used to ensure * all relationships have resolved. */ - resolveVisitChildren: function() { + resolveVisitChildren() { let promises = []; let visit = this.get('model.visit'); if (!Ember.isEmpty(visit)) { @@ -200,7 +200,7 @@ export default Ember.Mixin.create(PatientVisits, { * @param alertTitle String the title to use on the alert. * @param alertMessage String the message to display in the alert. */ - saveVisitIfNeeded: function(alertTitle, alertMessage, alertAction) { + saveVisitIfNeeded(alertTitle, alertMessage, alertAction) { if (this.get('needToUpdateVisit')) { this.get('model.visit').save().then(function() { this.set('needToUpdateVisit', false); diff --git a/app/mixins/patient-visits.js b/app/mixins/patient-visits.js index cb596f4c02..8da328ae09 100644 --- a/app/mixins/patient-visits.js +++ b/app/mixins/patient-visits.js @@ -1,7 +1,7 @@ import Ember from 'ember'; import PouchDbMixin from 'hospitalrun/mixins/pouchdb'; export default Ember.Mixin.create(PouchDbMixin, { - getPatientVisits: function(patient) { + getPatientVisits(patient) { let maxValue = this.get('maxValue'); let patientId = patient.get('id'); return this.store.query('visit', { diff --git a/app/mixins/pouch-adapter-utils.js b/app/mixins/pouch-adapter-utils.js index 6e58a42d25..371d0d4f4b 100644 --- a/app/mixins/pouch-adapter-utils.js +++ b/app/mixins/pouch-adapter-utils.js @@ -1,7 +1,7 @@ import Ember from 'ember'; export default Ember.Mixin.create({ session: Ember.inject.service(), - _pouchError: function(reject) { + _pouchError(reject) { return function(err) { if (err.status === 401) { // User is unauthorized; reload to force login. diff --git a/app/mixins/progress-dialog.js b/app/mixins/progress-dialog.js index 07ecf01a0e..61a4459740 100644 --- a/app/mixins/progress-dialog.js +++ b/app/mixins/progress-dialog.js @@ -13,14 +13,14 @@ export default Ember.Mixin.create({ progressTimer: null, progressTitle: null, - scheduleProgress: function(f) { + scheduleProgress(f) { return Ember.run.later(this, function() { f.apply(this); this.set('progressTimer', this.scheduleProgress(f)); }, this.get('progressInterval')); }, - updateProgressBar: function() { + updateProgressBar() { let progressDialog = this.get('progressDialog'); let progressBarValue = progressDialog.get('progressBarValue'); progressBarValue += 10; @@ -32,12 +32,12 @@ export default Ember.Mixin.create({ progressDialog.set('progressBarStyle', progressBarStyle); }, - closeProgressModal: function() { + closeProgressModal() { Ember.run.cancel(this.get('progressTimer')); this.send('closeModal'); }, - showProgressModal: function() { + showProgressModal() { let progressDialog = Ember.Object.create(this.get('progressDialogDefaults')); progressDialog.progressBarStyle = new Ember.String.htmlSafe(progressDialog.progressBarStyle); progressDialog.set('title', this.get('progressTitle')); diff --git a/app/mixins/result-validation.js b/app/mixins/result-validation.js index 394a43c763..51ae0cde75 100644 --- a/app/mixins/result-validation.js +++ b/app/mixins/result-validation.js @@ -6,7 +6,7 @@ export default Ember.Mixin.create({ result: { acceptance: { accept: true, - if: function(object) { + if(object) { if (!object.get('hasDirtyAttributes')) { return false; } diff --git a/app/mixins/user-session.js b/app/mixins/user-session.js index e4605abb78..e7ae580126 100644 --- a/app/mixins/user-session.js +++ b/app/mixins/user-session.js @@ -451,14 +451,14 @@ export default Ember.Mixin.create({ ] }, - _getUserSessionVars: function() { + _getUserSessionVars() { let session = this.get('session'); if (!Ember.isEmpty(session) && session.get('isAuthenticated')) { return session.get('data.authenticated'); } }, - currentUserCan: function(capability) { + currentUserCan(capability) { let sessionVars = this._getUserSessionVars(); if (!Ember.isEmpty(sessionVars) && !Ember.isEmpty(sessionVars.role)) { let userCaps = this.get('session').get('data.authenticated.userCaps'); @@ -481,7 +481,7 @@ export default Ember.Mixin.create({ * @param {boolean} returnUserName if true, always return the username instead * of the display name even if the display name is set. */ - getUserName: function(returnUserName) { + getUserName(returnUserName) { let returnName; let sessionVars = this._getUserSessionVars(); if (!Ember.isEmpty(sessionVars)) { diff --git a/app/mixins/visit-types.js b/app/mixins/visit-types.js index e569ae364f..ab44d01362 100644 --- a/app/mixins/visit-types.js +++ b/app/mixins/visit-types.js @@ -10,7 +10,7 @@ export default Ember.Mixin.create({ 'Pharmacy' ], - _getVisitTypes: function(includeEmpty) { + _getVisitTypes(includeEmpty) { let defaultVisitTypes = this.get('defaultVisitTypes'); let visitTypesList = this.get('visitTypesList'); let visitList; diff --git a/app/models/abstract.js b/app/models/abstract.js index 0af60f185c..324a439e3a 100644 --- a/app/models/abstract.js +++ b/app/models/abstract.js @@ -15,7 +15,7 @@ export default Model.extend(UserSession, EmberValidations, { * Also, if the save failed because of a conflict, reload the record and reapply the changed attributes and * attempt to save again. */ - save: function(options) { + save(options) { let attribute; let changedAttributes = this.changedAttributes(); let modifiedDate = new Date(); diff --git a/app/models/appointment.js b/app/models/appointment.js index 19bbd892df..74e88eed97 100644 --- a/app/models/appointment.js +++ b/app/models/appointment.js @@ -21,7 +21,7 @@ export default AbstractModel.extend({ shortDateFormat: 'l', timeFormat: 'h:mm A', - _getDateSpan: function(startDate, endDate, format) { + _getDateSpan(startDate, endDate, format) { let formattedStart = startDate.format(format); let formattedEnd = endDate.format(format); return `${formattedStart} - ${formattedEnd}`; @@ -67,7 +67,7 @@ export default AbstractModel.extend({ validations: { appointmentDate: { presence: { - if: function(object) { + if(object) { let appointmentType = object.get('appointmentType'); return appointmentType !== 'Admission'; } @@ -91,7 +91,7 @@ export default AbstractModel.extend({ endDate: { acceptance: { accept: true, - if: function(object) { + if(object) { if (!object.get('hasDirtyAttributes')) { return false; } diff --git a/app/models/imaging.js b/app/models/imaging.js index 1cd6832613..f7c41736ca 100644 --- a/app/models/imaging.js +++ b/app/models/imaging.js @@ -37,7 +37,7 @@ export default AbstractModel.extend(CanEditRequested, DateFormat, ResultValidati validations: { imagingTypeName: { presence: { - 'if': function(object) { + 'if'(object) { if (object.get('isNew')) { return true; } diff --git a/app/models/inv-location.js b/app/models/inv-location.js index 225e7b7c55..008a51b100 100644 --- a/app/models/inv-location.js +++ b/app/models/inv-location.js @@ -32,7 +32,7 @@ let InventoryLocation = AbstractModel.extend(LocationName, { * Validate that the adjustment quantity is a number and that if a deduction there are enough items to deduct */ accept: true, - if: function(object) { + if(object) { let adjustmentQuantity = object.get('adjustmentQuantity'); let transactionType = object.get('transactionType'); let locationQuantity = object.get('quantity'); @@ -57,7 +57,7 @@ let InventoryLocation = AbstractModel.extend(LocationName, { transferLocation: { acceptance: { accept: true, - if: function(object) { + if(object) { let transferLocation = object.get('transferLocation'); let transferItem = object.get('transferItem'); // If we don't have a transfer item, then a transfer is not occurring. diff --git a/app/models/inv-request.js b/app/models/inv-request.js index e62b83d18a..115ebe7dfb 100755 --- a/app/models/inv-request.js +++ b/app/models/inv-request.js @@ -71,7 +71,7 @@ let InventoryRequest = AbstractModel.extend(AdjustmentTypes, LocationName, { inventoryItemTypeAhead: { acceptance: { accept: true, - if: function(object) { + if(object) { if (!object.get('hasDirtyAttributes')) { return false; } @@ -105,14 +105,14 @@ let InventoryRequest = AbstractModel.extend(AdjustmentTypes, LocationName, { messages: { greaterThan: 'must be greater than 0' }, - if: function(object) { + if(object) { let requestedItems = object.get('requestedItems'); return (Ember.isEmpty(requestedItems)); } }, acceptance: { accept: true, - if: function(object) { + if(object) { let isNew = object.get('isNew'); let requestQuantity = parseInt(object.get('quantity')); let transactionType = object.get('transactionType'); diff --git a/app/models/inventory-batch.js b/app/models/inventory-batch.js index bf147d9032..a84c3b55e8 100644 --- a/app/models/inventory-batch.js +++ b/app/models/inventory-batch.js @@ -5,7 +5,7 @@ import Ember from 'ember'; * Model to represent a request for inventory items. */ export default AbstractModel.extend({ - haveInvoiceItems: function() { + haveInvoiceItems() { let invoiceItems = this.get('invoiceItems'); return (Ember.isEmpty(invoiceItems)); }, @@ -16,7 +16,7 @@ export default AbstractModel.extend({ }, inventoryItemTypeAhead: { presence: { - if: function(object) { + if(object) { return object.haveInvoiceItems(); } } @@ -27,7 +27,7 @@ export default AbstractModel.extend({ messages: { greaterThan: 'must be greater than 0' }, - if: function(object) { + if(object) { return object.haveInvoiceItems(); } } @@ -38,7 +38,7 @@ export default AbstractModel.extend({ messages: { greaterThan: 'must be greater than 0' }, - if: function(object) { + if(object) { return object.haveInvoiceItems(); } } diff --git a/app/models/inventory.js b/app/models/inventory.js index a415c0225e..3161ab47d1 100644 --- a/app/models/inventory.js +++ b/app/models/inventory.js @@ -97,7 +97,7 @@ export default AbstractModel.extend(LocationName, { } }, - updateQuantity: function() { + updateQuantity() { let purchases = this.get('purchases'); let newQuantity = purchases.reduce((previousItem, currentItem) => { let currentQuantity = 0; diff --git a/app/models/invoice.js b/app/models/invoice.js index b01c6560f5..48802b09f4 100644 --- a/app/models/invoice.js +++ b/app/models/invoice.js @@ -30,7 +30,7 @@ export default AbstractModel.extend(DateFormat, NumberFormat, { async: false }), - addPayment: function(payment) { + addPayment(payment) { let payments = this.get('payments'); payments.addObject(payment); this.paymentAmountChanged(); @@ -80,7 +80,7 @@ export default AbstractModel.extend(DateFormat, NumberFormat, { let categoryList = byCategory.findBy('category', category); if (Ember.isEmpty(categoryList)) { categoryList = { - category: category, + category, items: [] }; byCategory.push(categoryList); diff --git a/app/models/lab.js b/app/models/lab.js index 052b014c11..41567f12e9 100644 --- a/app/models/lab.js +++ b/app/models/lab.js @@ -36,7 +36,7 @@ export default AbstractModel.extend(CanEditRequested, DateFormat, ResultValidati validations: { labTypeName: { presence: { - 'if': function(object) { + 'if'(object) { if (object.get('isNew')) { return true; } diff --git a/app/models/medication.js b/app/models/medication.js index 0df3019dfd..fd369f286c 100644 --- a/app/models/medication.js +++ b/app/models/medication.js @@ -49,7 +49,7 @@ export default AbstractModel.extend(CanEditRequested, DateFormat, MedicationDeta prescription: { acceptance: { accept: true, - if: function(object) { + if(object) { if (!object.get('hasDirtyAttributes') || object.get('isFulfilling')) { return false; } @@ -69,7 +69,7 @@ export default AbstractModel.extend(CanEditRequested, DateFormat, MedicationDeta inventoryItemTypeAhead: { acceptance: { accept: true, - if: function(object) { + if(object) { if (!object.get('hasDirtyAttributes') || !object.get('isNew')) { return false; } @@ -93,7 +93,7 @@ export default AbstractModel.extend(CanEditRequested, DateFormat, MedicationDeta patientTypeAhead: { presence: { - if: function(object) { + if(object) { return (object.get('selectPatient')); } } @@ -108,14 +108,14 @@ export default AbstractModel.extend(CanEditRequested, DateFormat, MedicationDeta } }, presence: { - if: function(object) { + if(object) { let isFulfilling = object.get('isFulfilling'); return isFulfilling; } }, acceptance: { accept: true, - if: function(object) { + if(object) { let isFulfilling = object.get('isFulfilling'); let requestQuantity = parseInt(object.get('quantity')); let quantityToCompare = null; diff --git a/app/models/photo.js b/app/models/photo.js index c2c2cab60d..e1c20827f0 100644 --- a/app/models/photo.js +++ b/app/models/photo.js @@ -13,7 +13,7 @@ export default AbstractModel.extend({ caption: DS.attr('string'), url: DS.attr('string'), - downloadImageFromServer: function(imageRecord) { + downloadImageFromServer(imageRecord) { let me = this; let url = imageRecord.get('url'); let xhr = new XMLHttpRequest(); diff --git a/app/models/proc-charge.js b/app/models/proc-charge.js index fb3f70e040..a3b58e09e3 100644 --- a/app/models/proc-charge.js +++ b/app/models/proc-charge.js @@ -35,7 +35,7 @@ export default AbstractModel.extend(MedicationDetails, { presence: true, acceptance: { accept: true, - if: function(object) { + if(object) { let medicationCharge = object.get('medicationCharge'); if (!medicationCharge || !object.get('hasDirtyAttributes')) { return false; diff --git a/app/patients/add-contact/controller.js b/app/patients/add-contact/controller.js index e7fe18b48e..e68093ddcf 100644 --- a/app/patients/add-contact/controller.js +++ b/app/patients/add-contact/controller.js @@ -11,11 +11,11 @@ export default Ember.Controller.extend(IsUpdateDisabled, { showUpdateButton: true, actions: { - cancel: function() { + cancel() { this.send('closeModal'); }, - add: function() { + add() { let newContact = this.getProperties('name', 'phone', 'email', 'relationship'); this.get('editController').send('addContact', newContact); } diff --git a/app/patients/admitted/route.js b/app/patients/admitted/route.js index eb41cccacb..19db472e92 100644 --- a/app/patients/admitted/route.js +++ b/app/patients/admitted/route.js @@ -3,7 +3,7 @@ import PatientsIndexRoute from 'hospitalrun/patients/index/route'; export default PatientsIndexRoute.extend({ pageTitle: t('patients.titles.admittedPatients'), - _modelQueryParams: function() { + _modelQueryParams() { return { mapReduce: 'patient_by_admission' }; diff --git a/app/patients/delete/controller.js b/app/patients/delete/controller.js index 5700c592b8..71ec0d466a 100644 --- a/app/patients/delete/controller.js +++ b/app/patients/delete/controller.js @@ -37,7 +37,7 @@ export default AbstractDeleteController.extend(PatientVisitsMixin, PatientInvoic // Override delete action on controller; we must delete // all related records before deleting patient record // otherwise errors will occur - deletePatient: function() { + deletePatient() { let controller = this; let patient = this.get('model'); let visits = this.getPatientVisits(patient); @@ -58,7 +58,7 @@ export default AbstractDeleteController.extend(PatientVisitsMixin, PatientInvoic }); }, - deleteVisits: function(visits) { + deleteVisits(visits) { let promises = []; visits.forEach(function(visit) { let labs = visit.get('labs'); @@ -90,7 +90,7 @@ export default AbstractDeleteController.extend(PatientVisitsMixin, PatientInvoic }); }, - deleteInvoices: function(patientInvoices) { + deleteInvoices(patientInvoices) { return Ember.RSVP.resolve(patientInvoices).then(function(invoices) { let lineItems = Ember.A(); invoices.forEach(function(i) { @@ -108,7 +108,7 @@ export default AbstractDeleteController.extend(PatientVisitsMixin, PatientInvoic actions: { // delete related records without modal dialogs - delete: function(patient) { + delete(patient) { let controller = this; this.send('closeModal'); this.showProgressModal(); diff --git a/app/patients/edit/controller.js b/app/patients/edit/controller.js index eee09df143..a8163550a4 100644 --- a/app/patients/edit/controller.js +++ b/app/patients/edit/controller.js @@ -165,7 +165,7 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession, updateCapability: 'add_patient', actions: { - addContact: function(newContact) { + addContact(newContact) { let additionalContacts = this.getWithDefault('model.additionalContacts', []); let model = this.get('model'); additionalContacts.addObject(newContact); @@ -173,7 +173,7 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession, this.send('update', true); this.send('closeModal'); }, - returnToPatient: function() { + returnToPatient() { this.transitionToRoute('patients.index'); }, /** @@ -182,15 +182,15 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession, * @param {String} caption the caption to store with the photo. * @param {boolean} coverImage flag indicating if image should be marked as the cover image (currently unused). */ - addPhoto: function(photoFile, caption, coverImage) { + addPhoto(photoFile, caption, coverImage) { let dirToSaveTo = `${this.get('model.id')}/photos/`; let fileSystem = this.get('filesystem'); let photos = this.get('model.photos'); let newPatientPhoto = this.get('store').createRecord('photo', { patient: this.get('model'), localFile: true, - caption: caption, - coverImage: coverImage + caption, + coverImage }); newPatientPhoto.save().then(function(savedPhotoRecord) { let pouchDbId = this.get('database').getPouchId(savedPhotoRecord.get('id'), 'photo'); @@ -218,34 +218,34 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession, }.bind(this)); }, - appointmentDeleted: function(deletedAppointment) { + appointmentDeleted(deletedAppointment) { let appointments = this.get('model.appointments'); appointments.removeObject(deletedAppointment); this.send('closeModal'); }, - deleteContact: function(model) { + deleteContact(model) { let contact = model.get('contactToDelete'); let additionalContacts = this.get('model.additionalContacts'); additionalContacts.removeObject(contact); this.send('update', true); }, - deleteExpense: function(model) { + deleteExpense(model) { let expense = model.get('expenseToDelete'); let expenses = this.get('model.expenses'); expenses.removeObject(expense); this.send('update', true); }, - deleteFamily: function(model) { + deleteFamily(model) { let family = model.get('familyToDelete'); let familyInfo = this.get('model.familyInfo'); familyInfo.removeObject(family); this.send('update', true); }, - deletePhoto: function(model) { + deletePhoto(model) { let photo = model.get('photoToDelete'); let photoId = photo.get('id'); let photos = this.get('model.photos'); @@ -261,7 +261,7 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession, }.bind(this)); }, - editAppointment: function(appointment) { + editAppointment(appointment) { if (this.get('canAddAppointment')) { appointment.set('returnToPatient', true); appointment.set('returnTo', null); @@ -269,7 +269,7 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession, } }, - editImaging: function(imaging) { + editImaging(imaging) { if (this.get('canAddImaging')) { if (imaging.get('canEdit')) { imaging.setProperties({ @@ -280,7 +280,7 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession, } }, - editLab: function(lab) { + editLab(lab) { if (this.get('canAddLab')) { if (lab.get('canEdit')) { lab.setProperties({ @@ -291,7 +291,7 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession, } }, - editMedication: function(medication) { + editMedication(medication) { if (this.get('canAddMedication')) { if (medication.get('canEdit')) { medication.set('returnToPatient', true); @@ -300,11 +300,11 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession, } }, - editPhoto: function(photo) { + editPhoto(photo) { this.send('openModal', 'patients.photo', photo); }, - editProcedure: function(procedure) { + editProcedure(procedure) { if (this.get('canAddVisit')) { procedure.set('patient', this.get('model')); procedure.set('returnToVisit', false); @@ -313,45 +313,45 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession, } }, - editVisit: function(visit) { + editVisit(visit) { if (this.get('canAddVisit')) { this.transitionToRoute('visits.edit', visit); } }, - newAppointment: function() { + newAppointment() { this._addChildObject('appointments.edit'); }, - newImaging: function() { + newImaging() { this._addChildObject('imaging.edit'); }, - newLab: function() { + newLab() { this._addChildObject('labs.edit'); }, - newMedication: function() { + newMedication() { this._addChildObject('medication.edit'); }, - newVisit: function() { + newVisit() { let patient = this.get('model'); let visits = this.get('model.visits'); this.send('createNewVisit', patient, visits); }, - showAddContact: function() { + showAddContact() { this.send('openModal', 'patients.add-contact', {}); }, - showAddPhoto: function() { + showAddPhoto() { this.send('openModal', 'patients.photo', { isNew: true }); }, - showAddPatientNote: function(model) { + showAddPatientNote(model) { if (this.get('canAddNote')) { if (Ember.isEmpty(model)) { model = this.get('store').createRecord('patient-note', { @@ -363,12 +363,12 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession, } }, - showDeleteAppointment: function(appointment) { + showDeleteAppointment(appointment) { appointment.set('deleteFromPatient', true); this.send('openModal', 'appointments.delete', appointment); }, - showDeleteContact: function(contact) { + showDeleteContact(contact) { this.send('openModal', 'dialog', Ember.Object.create({ confirmAction: 'deleteContact', title: this.get('i18n').t('patients.titles.deleteContact'), @@ -379,7 +379,7 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession, })); }, - showDeleteExpense: function(expense) { + showDeleteExpense(expense) { this.send('openModal', 'dialog', Ember.Object.create({ confirmAction: 'deleteExpense', title: this.get('i18n').t('patients.titles.deleteExpense'), @@ -390,7 +390,7 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession, })); }, - showDeleteFamily: function(familyInfo) { + showDeleteFamily(familyInfo) { this.send('openModal', 'dialog', Ember.Object.create({ confirmAction: 'deleteFamily', title: this.get('i18n').t('patients.titles.deleteFamilyMember'), @@ -402,19 +402,19 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession, }, - showDeleteImaging: function(imaging) { + showDeleteImaging(imaging) { this.send('openModal', 'imaging.delete', imaging); }, - showDeleteLab: function(lab) { + showDeleteLab(lab) { this.send('openModal', 'labs.delete', lab); }, - showDeleteMedication: function(medication) { + showDeleteMedication(medication) { this.send('openModal', 'medication.delete', medication); }, - showDeletePhoto: function(photo) { + showDeletePhoto(photo) { this.send('openModal', 'dialog', Ember.Object.create({ confirmAction: 'deletePhoto', title: this.get('i18n').t('patients.titles.deletePhoto'), @@ -425,34 +425,34 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession, })); }, - showDeleteVisit: function(visit) { + showDeleteVisit(visit) { visit.set('deleteFromPatient', true); this.send('openModal', 'visits.delete', visit); }, - showEditExpense: function(expenseInfo) { + showEditExpense(expenseInfo) { this._showEditSocial(expenseInfo, 'social-expense', 'expense'); }, - showEditFamily: function(familyInfo) { + showEditFamily(familyInfo) { this._showEditSocial(familyInfo, 'family-info', 'family-info'); }, - updateExpense: function(model) { + updateExpense(model) { this._updateSocialRecord(model, 'expenses'); }, - updateFamilyInfo: function(model) { + updateFamilyInfo(model) { this._updateSocialRecord(model, 'familyInfo'); }, - updatePhoto: function(photo) { + updatePhoto(photo) { photo.save().then(function() { this.send('closeModal'); }.bind(this)); }, - visitDeleted: function(deletedVisit) { + visitDeleted(deletedVisit) { let visits = this.get('model.visits'); let patient = this.get('model'); let patientAdmitted = patient.get('admitted'); @@ -467,7 +467,7 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession, }, - _addChildObject: function(route) { + _addChildObject(route) { this.transitionToRoute(route, 'new').then(function(newRoute) { newRoute.currentModel.setProperties({ patient: this.get('model'), @@ -477,7 +477,7 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession, }.bind(this)); }, - _showEditSocial: function(editAttributes, modelName, route) { + _showEditSocial(editAttributes, modelName, route) { let model; if (Ember.isEmpty(editAttributes)) { model = this.get('store').createRecord(modelName, { @@ -495,7 +495,7 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession, this.send('openModal', `patients.socialwork.${route}`, model); }, - _getVisitCollection: function(name) { + _getVisitCollection(name) { let returnList = []; let visits = this.get('model.visits'); if (!Ember.isEmpty(visits)) { @@ -511,7 +511,7 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession, return returnList; }, - _updateSocialRecord: function(recordToUpdate, name) { + _updateSocialRecord(recordToUpdate, name) { let socialRecords = this.getWithDefault(`model.${name}`, []); let isNew = recordToUpdate.get('isNew'); let patient = this.get('model'); @@ -528,7 +528,7 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession, this.send('closeModal'); }, - _updateSequence: function(record) { + _updateSequence(record) { let config = this.get('config'); let friendlyId = record.get('friendlyId'); return config.getPatientPrefix().then((prefix) => { @@ -547,7 +547,7 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession, }); }, - beforeUpdate: function() { + beforeUpdate() { if (!this.get('model.isNew')) { return Ember.RSVP.resolve(); } @@ -571,7 +571,7 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession, }); }, - afterUpdate: function(record) { + afterUpdate(record) { this._updateSequence(record).then(() => { this.send('openModal', 'dialog', Ember.Object.create({ title: this.get('i18n').t('patients.titles.savedPatient'), diff --git a/app/patients/edit/route.js b/app/patients/edit/route.js index 17e2cf44af..91bf58f102 100644 --- a/app/patients/edit/route.js +++ b/app/patients/edit/route.js @@ -13,42 +13,42 @@ export default AbstractEditRoute.extend(PatientId, PatientVisits, PouchDbMixin, photos: null, actions: { - updateNote: function(note) { + updateNote(note) { note.get('visit').save().then(function() { // noop }); }, - appointmentDeleted: function(model) { + appointmentDeleted(model) { this.controller.send('appointmentDeleted', model); }, - returnToPatient: function() { + returnToPatient() { this.controller.send('returnToPatient'); }, - deleteContact: function(model) { + deleteContact(model) { this.controller.send('deleteContact', model); }, - deleteExpense: function(model) { + deleteExpense(model) { this.controller.send('deleteExpense', model); }, - deleteFamily: function(model) { + deleteFamily(model) { this.controller.send('deleteFamily', model); }, - deletePhoto: function(model) { + deletePhoto(model) { this.controller.send('deletePhoto', model); }, - updateExpense: function(model) { + updateExpense(model) { this.controller.send('updateExpense', model); }, - updateFamilyInfo: function(model) { + updateFamilyInfo(model) { this.controller.send('updateFamilyInfo', model); }, - visitDeleted: function(model) { + visitDeleted(model) { this.controller.send('visitDeleted', model); } }, @@ -59,7 +59,7 @@ export default AbstractEditRoute.extend(PatientId, PatientVisits, PouchDbMixin, }); }, - setupController: function(controller, model) { + setupController(controller, model) { // Load appointments, photos and visits asynchronously. let friendlyId = model.get('friendlyId'); let externalId = model.get('externalPatientId'); diff --git a/app/patients/index/controller.js b/app/patients/index/controller.js index 0065e2f18c..cd49cb46c1 100644 --- a/app/patients/index/controller.js +++ b/app/patients/index/controller.js @@ -13,14 +13,14 @@ export default AbstractPagedController.extend(PatientVisits, { startKey: [], actions: { - admitPatient: function(patient) { + admitPatient(patient) { this.getPatientVisits(patient).then(function(visits) { this.send('createNewVisit', patient, visits); }.bind(this)); }, - dischargePatient: function(patient) { + dischargePatient(patient) { this.getPatientVisits(patient).then(function(visits) { let visitToDischarge = visits.findBy('status', 'Admitted'); if (visitToDischarge) { diff --git a/app/patients/index/route.js b/app/patients/index/route.js index 952b3cb4d8..2ba52bce65 100644 --- a/app/patients/index/route.js +++ b/app/patients/index/route.js @@ -5,13 +5,13 @@ export default AbstractIndexRoute.extend({ modelName: 'patient', pageTitle: t('patients.titles.patientListing'), - _getStartKeyFromItem: function(item) { + _getStartKeyFromItem(item) { let displayPatientId = item.get('displayPatientId'); let id = this._getPouchIdFromItem(item); return [displayPatientId, id]; }, - _modelQueryParams: function() { + _modelQueryParams() { return { mapReduce: 'patient_by_display_id' }; diff --git a/app/patients/notes/controller.js b/app/patients/notes/controller.js index 28e9904ab6..bb37d024b5 100644 --- a/app/patients/notes/controller.js +++ b/app/patients/notes/controller.js @@ -22,17 +22,17 @@ export default AbstractEditController.extend(IsUpdateDisabled, UserSession, Pati } }.property('model.patient.displayName'), updateCapability: 'add_note', - beforeUpdate: function() { + beforeUpdate() { this.set('model.date', new Date()); this.set('model.createdBy', this.getUserName()); return Ember.RSVP.Promise.resolve(); }, - afterUpdate: function() { + afterUpdate() { this.send(this.get('updateAction'), this.get('model')); this.send(this.get('cancelAction')); }, actions: { - changeVisit: function() { + changeVisit() { let selectEl = $('select[name="note-visits"]').get(0); let { selectedIndex } = selectEl; let content = this.get('patientVisitsForSelect'); diff --git a/app/patients/photo/controller.js b/app/patients/photo/controller.js index 6cc2d085c8..7835568fa1 100644 --- a/app/patients/photo/controller.js +++ b/app/patients/photo/controller.js @@ -26,11 +26,11 @@ export default Ember.Controller.extend({ editController: Ember.computed.alias('patientsEdit'), actions: { - cancel: function() { + cancel() { this.send('closeModal'); }, - update: function() { + update() { let caption = this.get('model.caption'); let isNew = this.get('model.isNew'); let photoFile = this.get('model.photoFile'); diff --git a/app/patients/quick-add/controller.js b/app/patients/quick-add/controller.js index f39322c53e..3a88dc17ac 100644 --- a/app/patients/quick-add/controller.js +++ b/app/patients/quick-add/controller.js @@ -10,12 +10,12 @@ export default AbstractEditController.extend({ updateCapability: 'add_patient', actions: { - cancel: function() { + cancel() { this.send('closeModal'); } }, - afterUpdate: function(record) { + afterUpdate(record) { let requestingController = this.get('model.requestingController'); requestingController.send('addedNewPatient', record); } diff --git a/app/patients/reports/controller.js b/app/patients/reports/controller.js index 8d336d99d9..ac674ddc93 100644 --- a/app/patients/reports/controller.js +++ b/app/patients/reports/controller.js @@ -278,7 +278,7 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits, return (reportType === 'visit'); }.property('reportType'), - _addContactToList: function(phone, email, prefix, contactList) { + _addContactToList(phone, email, prefix, contactList) { let contactArray = []; if (!Ember.isEmpty(email) || !Ember.isEmpty(phone)) { if (!Ember.isEmpty(phone)) { @@ -291,7 +291,7 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits, } }, - _addReportRow: function(row, skipFormatting, reportColumns, rowAction) { + _addReportRow(row, skipFormatting, reportColumns, rowAction) { if (Ember.isEmpty(rowAction) && !Ember.isEmpty(row.patient)) { let patientId = null; if (row.get) { @@ -316,14 +316,14 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits, * @param totalLabel {String} the label for the grand total. * @param reportColumns */ - _addRowsByType: function(records, typeField, totalLabel, reportColumns) { + _addRowsByType(records, typeField, totalLabel, reportColumns) { let types = this._totalByType(records, typeField, totalLabel); types.forEach(function(type) { this._addReportRow(type, true, reportColumns); }.bind(this)); }, - _addPatientProcedureRows: function(procedureTotals, reportColumns) { + _addPatientProcedureRows(procedureTotals, reportColumns) { procedureTotals.forEach(function(procedureTotal) { if (!Ember.isEmpty(procedureTotal.records)) { procedureTotal.records.forEach(function(patientProcedure, index) { @@ -346,7 +346,7 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits, }.bind(this)); }, - _contactListToString: function(patient) { + _contactListToString(patient) { let additionalContacts = patient.get('additionalContacts'); let contactDesc; let contactList = []; @@ -374,17 +374,17 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits, return contactList.join(';\n'); }, - _dateTimeFormat: function(value) { + _dateTimeFormat(value) { return this._dateFormat(value, 'l h:mm A'); }, - _diagnosisListToString: function(diagnoses) { + _diagnosisListToString(diagnoses) { return this._listToString(diagnoses, 'description', 'date'); }, /** * Find diagnostics by the specified dates and the record's start and (optional) end dates. */ - _findDiagnosticsByDate: function() { + _findDiagnosticsByDate() { let filterEndDate = this.get('endDate'); let filterStartDate = this.get('startDate'); let findParams = { @@ -416,7 +416,7 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits, /** * Find procedures by the specified dates and the record's start and (optional) end dates. */ - _findPatientsByStatus: function() { + _findPatientsByStatus() { let status = this.get('status'); let findParams = { options: { @@ -432,7 +432,7 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits, /** * Find procedures by the specified dates and the record's start and (optional) end dates. */ - _findProceduresByDate: function() { + _findProceduresByDate() { let filterEndDate = this.get('endDate'); let filterStartDate = this.get('startDate'); let findParams = { @@ -455,7 +455,7 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits, * Find visits by the specified dates and the record's start and (optional) end dates. * @param {String} reportType the type of report to find visits for. */ - _findVisitsByDate: function() { + _findVisitsByDate() { let filterEndDate = this.get('endDate'); let filterStartDate = this.get('startDate'); let findParams = { @@ -488,7 +488,7 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits, }.bind(this)); }, - _filterByLike: function(records, field, likeCondition) { + _filterByLike(records, field, likeCondition) { return records.filter(function(record) { let fieldValue = record.get('field'); if (Ember.isEmpty(fieldValue)) { @@ -506,13 +506,13 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits, }); }, - _filterInPatientVisit: function(visit) { + _filterInPatientVisit(visit) { let outPatient = visit.get('outPatient'); let status = visit.get('status'); return !outPatient && !Ember.isEmpty(status); }, - _finishVisitReport: function(visits) { + _finishVisitReport(visits) { let visitTypes = this._totalByType(visits, 'visitType', 'total'); visitTypes.forEach(function(visitType) { if (visitType.type === 'total') { @@ -530,17 +530,17 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits, }.bind(this)); this._finishReport(); }, - _formatPrimaryDiagnosis: function(visits) { + _formatPrimaryDiagnosis(visits) { let primaryDiagnoses = this.getPrimaryDiagnoses(visits); return this._diagnosisListToString(primaryDiagnoses); }, - _formatSecondaryDiagnosis: function(visits) { + _formatSecondaryDiagnosis(visits) { let secondaryDiagnoses = this.getSecondaryDiagnoses(visits); return this._diagnosisListToString(secondaryDiagnoses); }, - _generateAdmissionOrDischargeReport: function(visits, reportType) { + _generateAdmissionOrDischargeReport(visits, reportType) { let detailedReport = false; let reportColumns; let patientBySex = {}; @@ -593,7 +593,7 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits, patientBySex[sex].rows.forEach(addPatientBySexRows); this._addReportRow({ patientId: `${sex} Total: ${patientBySex[sex].count}` }, true, reportColumns); } else { - this._addReportRow({ sex: sex, total: patientBySex[sex].count }, true, reportColumns); + this._addReportRow({ sex, total: patientBySex[sex].count }, true, reportColumns); } sexTotal += patientBySex[sex].count; } @@ -601,7 +601,7 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits, this._finishReport(reportColumns); }, - _generateDiagnosticReport: function() { + _generateDiagnosticReport() { this._findDiagnosticsByDate().then(function(diagnostics) { let reportColumns = this.get('diagnosticReportColumns'); this._addRowsByType(diagnostics.imaging, 'imagingType.name', 'Total for imaging: ', reportColumns); @@ -612,7 +612,7 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits, }.bind(this)); }, - _generatePatientDaysReport: function(visits, reportType) { + _generatePatientDaysReport(visits, reportType) { visits = visits.filter(this._filterInPatientVisit); let detailed = (reportType.indexOf('detailed') === 0); let reportEndDate = this.get('endDate'); @@ -673,7 +673,7 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits, this._finishReport(reportColumns); }, - _generateProcedureReport: function(reportType) { + _generateProcedureReport(reportType) { this._findProceduresByDate().then(function(procedures) { let reportColumns; procedures = procedures.filter(function(procedure) { @@ -702,13 +702,13 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits, }.bind(this)); }, - _generateStatusReport: function() { + _generateStatusReport() { this._findPatientsByStatus().then(function(patients) { let reportColumns = this.get('statusReportColumns'); let sortedPatients = patients.sortBy('lastName', 'firstName'); this._getPatientVisits(sortedPatients).then(function(resolvedPatients) { resolvedPatients.forEach(function(patient) { - this._addReportRow({ patient: patient }, false, reportColumns); + this._addReportRow({ patient }, false, reportColumns); }.bind(this)); this._finishReport(reportColumns); }.bind(this)).catch(function(err) { @@ -719,7 +719,7 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits, }.bind(this)); }, - _generateVisitReport: function(visits) { + _generateVisitReport(visits) { let reportColumns = this.get('reportColumns'); let visitFilters = this.getProperties( 'examiner', 'visitDate', 'visitType', 'location', 'clinic', @@ -755,7 +755,7 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits, } }, - _getPatientVisits: function(patients) { + _getPatientVisits(patients) { return new Ember.RSVP.Promise(function(resolve, reject) { let visitHash = { }; @@ -771,11 +771,11 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits, }.bind(this)); }, - _haveLikeValue: function(valueToCompare, likeCondition) { + _haveLikeValue(valueToCompare, likeCondition) { return (valueToCompare.toLowerCase().indexOf(likeCondition.toLowerCase()) > -1); }, - _listToString: function(items, descField, dateField) { + _listToString(items, descField, dateField) { let itemList = []; if (!Ember.isEmpty(items)) { itemList = items.map(function(item) { @@ -792,7 +792,7 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits, * @param totalLabel {String} the label for the grand total. * @param reportColumns */ - _totalByType: function(records, typeField, totalLabel) { + _totalByType(records, typeField, totalLabel) { let total = 0; let types = []; records.forEach(function(record) { @@ -817,15 +817,15 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits, } }); types = types.sortBy('type'); - types.push({ type: totalLabel, total: total }); + types.push({ type: totalLabel, total }); return types; }, - _procedureListToString: function(procedures) { + _procedureListToString(procedures) { return this._listToString(procedures, 'description', 'procedureDate'); }, - _validateDates: function() { + _validateDates() { let alertMessage; let endDate = this.get('endDate'); let isValid = true; @@ -848,7 +848,7 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits, }, actions: { - generateReport: function() { + generateReport() { if (this._validateDates()) { let reportRows = this.get('reportRows'); let reportType = this.get('reportType'); @@ -902,7 +902,7 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits, } } }, - viewPatient: function(id) { + viewPatient(id) { this.store.find('patient', id).then(function(item) { item.set('returnTo', 'patients.reports'); this.transitionToRoute('patients.edit', item); diff --git a/app/patients/reports/route.js b/app/patients/reports/route.js index ab1e7923e3..253fd6965b 100644 --- a/app/patients/reports/route.js +++ b/app/patients/reports/route.js @@ -6,7 +6,7 @@ export default AbstractIndexRoute.extend({ pageTitle: t('patients.titles.patientReport'), // No model for reports; data gets retrieved when report is run. - model: function() { + model() { return Ember.RSVP.resolve(Ember.Object.create({})); } diff --git a/app/patients/route.js b/app/patients/route.js index 9f4f64c17b..d18b50d470 100644 --- a/app/patients/route.js +++ b/app/patients/route.js @@ -41,7 +41,7 @@ export default AbstractModuleRoute.extend(PatientId, { }], actions: { - createNewVisit: function(patient, visits) { + createNewVisit(patient, visits) { let lastVisit = visits.get('lastObject'); let propertiesToSet = {}; diff --git a/app/patients/socialwork/expense/controller.js b/app/patients/socialwork/expense/controller.js index e6eb771ab1..f0e6d24ff9 100644 --- a/app/patients/socialwork/expense/controller.js +++ b/app/patients/socialwork/expense/controller.js @@ -33,11 +33,11 @@ export default Ember.Controller.extend(IsUpdateDisabled, { }.property('model.isNew'), actions: { - cancel: function() { + cancel() { this.send('closeModal'); }, - update: function() { + update() { let model = this.get('model'); this.get('editController').send('updateExpense', model); } diff --git a/app/patients/socialwork/family-info/controller.js b/app/patients/socialwork/family-info/controller.js index ab7cf027db..6eb3809573 100644 --- a/app/patients/socialwork/family-info/controller.js +++ b/app/patients/socialwork/family-info/controller.js @@ -19,11 +19,11 @@ export default Ember.Controller.extend(IsUpdateDisabled, { }.property('model.isNew'), actions: { - cancel: function() { + cancel() { this.send('closeModal'); }, - update: function() { + update() { let model = this.get('model'); this.get('editController').send('updateFamilyInfo', model); } diff --git a/app/pricing/edit/controller.js b/app/pricing/edit/controller.js index 05c28c0640..a14e61c521 100644 --- a/app/pricing/edit/controller.js +++ b/app/pricing/edit/controller.js @@ -8,13 +8,13 @@ export default AbstractEditController.extend(LabPricingTypes, ImagingPricingType pricingController: Ember.inject.controller('pricing'), actions: { - addOverride: function(override) { + addOverride(override) { let pricingOverrides = this.get('model.pricingOverrides'); pricingOverrides.addObject(override); this.send('update', true); this.send('closeModal'); }, - deleteOverride: function(model) { + deleteOverride(model) { let { overrideToDelete } = model; let pricingOverrides = this.get('model.pricingOverrides'); pricingOverrides.removeObject(overrideToDelete); @@ -23,16 +23,16 @@ export default AbstractEditController.extend(LabPricingTypes, ImagingPricingType this.send('closeModal'); }.bind(this)); }, - editOverride: function(overrideToEdit) { + editOverride(overrideToEdit) { if (Ember.isEmpty(overrideToEdit)) { overrideToEdit = this.store.createRecord('override-price'); } this.send('openModal', 'pricing.override', overrideToEdit); }, - showDeleteOverride: function(overrideToDelete) { + showDeleteOverride(overrideToDelete) { let message = 'Are you sure you want to delete this override?'; let model = Ember.Object.create({ - overrideToDelete: overrideToDelete + overrideToDelete }); let title = 'Delete Override'; this.displayConfirm(title, message, 'deleteOverride', model); @@ -83,7 +83,7 @@ export default AbstractEditController.extend(LabPricingTypes, ImagingPricingType updateCapability: 'add_pricing', - afterUpdate: function(record) { + afterUpdate(record) { let message = `The pricing record for ${record.get('name')} has been saved.`; this.displayAlert('Pricing Item Saved', message); } diff --git a/app/pricing/edit/route.js b/app/pricing/edit/route.js index 1818b595b9..159211e9ba 100644 --- a/app/pricing/edit/route.js +++ b/app/pricing/edit/route.js @@ -6,12 +6,12 @@ export default AbstractEditRoute.extend({ newTitle: 'New Pricing Item', actions: { - deleteOverride: function(overrideToDelete) { + deleteOverride(overrideToDelete) { this.controller.send('deleteOverride', overrideToDelete); } }, - getNewData: function(params) { + getNewData(params) { let newCategory = params.pricing_id.substr(3); if (Ember.isEmpty(newCategory)) { newCategory = 'Imaging'; @@ -21,7 +21,7 @@ export default AbstractEditRoute.extend({ }); }, - model: function(params) { + model(params) { let idParam = this.get('idParam'); if (!Ember.isEmpty(idParam) && params[idParam].indexOf('new') === 0) { return this._createNewRecord(params); diff --git a/app/pricing/imaging/route.js b/app/pricing/imaging/route.js index 4f61391058..e32e2584bd 100755 --- a/app/pricing/imaging/route.js +++ b/app/pricing/imaging/route.js @@ -4,7 +4,7 @@ export default PricingIndexRoute.extend({ pageTitle: 'Imaging Pricing', actions: { - editItem: function(item) { + editItem(item) { item.set('returnTo', 'pricing.imaging'); this.transitionTo('pricing.edit', item); } diff --git a/app/pricing/index/route.js b/app/pricing/index/route.js index 1d0a99296b..5af3db6ea1 100644 --- a/app/pricing/index/route.js +++ b/app/pricing/index/route.js @@ -6,7 +6,7 @@ export default AbstractIndexRoute.extend(UserSession, { modelName: 'pricing', pageTitle: 'All Pricing Items', - _getStartKeyFromItem: function(item) { + _getStartKeyFromItem(item) { let category = item.get('category'); let id = this._getPouchIdFromItem(item); let name = item.get('name'); @@ -14,7 +14,7 @@ export default AbstractIndexRoute.extend(UserSession, { return [category, name, pricingType, id]; }, - _modelQueryParams: function() { + _modelQueryParams() { let category = this.get('category'); let maxId = this._getMaxPouchId(); let queryParams = { @@ -30,7 +30,7 @@ export default AbstractIndexRoute.extend(UserSession, { }, actions: { - newItem: function() { + newItem() { if (this.currentUserCan('add_pricing')) { let routeId = 'new'; let routeParts = this.routeName.split('.'); diff --git a/app/pricing/lab/route.js b/app/pricing/lab/route.js index 303dd93f59..d096e1a78e 100755 --- a/app/pricing/lab/route.js +++ b/app/pricing/lab/route.js @@ -4,7 +4,7 @@ export default PricingIndexRoute.extend({ pageTitle: 'Lab Pricing', actions: { - editItem: function(item) { + editItem(item) { item.set('returnTo', 'pricing.lab'); this.transitionTo('pricing.edit', item); } diff --git a/app/pricing/override/controller.js b/app/pricing/override/controller.js index 03df9e854e..e48c9a71ef 100644 --- a/app/pricing/override/controller.js +++ b/app/pricing/override/controller.js @@ -6,12 +6,12 @@ export default Ember.Controller.extend(IsUpdateDisabled, { pricingController: Ember.inject.controller('pricing'), actions: { - cancel: function() { + cancel() { this.get('model').rollbackAttributes(); this.send('closeModal'); }, - update: function() { + update() { let isNew = this.get('model.isNew'); let override = this.get('model'); override.save().then(function() { diff --git a/app/pricing/procedure/route.js b/app/pricing/procedure/route.js index f34949c95d..bfc8487672 100755 --- a/app/pricing/procedure/route.js +++ b/app/pricing/procedure/route.js @@ -4,7 +4,7 @@ export default PricingIndexRoute.extend({ pageTitle: 'Procedure Pricing', actions: { - editItem: function(item) { + editItem(item) { item.set('returnTo', 'pricing.procedure'); this.transitionTo('pricing.edit', item); } diff --git a/app/pricing/profiles/edit/controller.js b/app/pricing/profiles/edit/controller.js index 542e7fa34e..4e15fac901 100644 --- a/app/pricing/profiles/edit/controller.js +++ b/app/pricing/profiles/edit/controller.js @@ -1,12 +1,12 @@ import AbstractEditController from 'hospitalrun/controllers/abstract-edit-controller'; export default AbstractEditController.extend({ actions: { - cancel: function() { + cancel() { this.send('closeModal'); } }, - afterUpdate: function(record) { + afterUpdate(record) { let message = `The pricing profile ${record.get('name')} has been saved.`; this.displayAlert('Pricing Profile Saved', message, 'refreshProfiles'); }, diff --git a/app/pricing/profiles/route.js b/app/pricing/profiles/route.js index 06db0b7882..7ab8ff35bc 100644 --- a/app/pricing/profiles/route.js +++ b/app/pricing/profiles/route.js @@ -7,11 +7,11 @@ export default AbstractIndexRoute.extend(ModalHelper, { pageTitle: 'Pricing Profiles', actions: { - editItem: function(item) { + editItem(item) { this.send('openModal', 'pricing.profiles.edit', item); }, - deleteItem: function(item) { + deleteItem(item) { let message = 'Are you sure you want to delete this profile?'; let model = Ember.Object.create({ itemToDelete: item @@ -20,19 +20,19 @@ export default AbstractIndexRoute.extend(ModalHelper, { this.displayConfirm(title, message, 'deletePricingProfile', model); }, - deletePricingProfile: function(model) { + deletePricingProfile(model) { model.itemToDelete.set('archived', true); model.itemToDelete.save().then(()=> { model.itemToDelete.unloadRecord(); }); }, - newItem: function() { + newItem() { let newItem = this.store.createRecord('price-profile'); this.send('openModal', 'pricing.profiles.edit', newItem); }, - refreshProfiles: function() { + refreshProfiles() { this.refresh(); } } diff --git a/app/pricing/ward/route.js b/app/pricing/ward/route.js index 89d3ac5b65..c1f1c09098 100755 --- a/app/pricing/ward/route.js +++ b/app/pricing/ward/route.js @@ -4,7 +4,7 @@ export default PricingIndexRoute.extend({ pageTitle: 'Ward Pricing', actions: { - editItem: function(item) { + editItem(item) { item.set('returnTo', 'pricing.ward'); this.transitionTo('pricing.edit', item); } diff --git a/app/print/invoice/controller.js b/app/print/invoice/controller.js index 46594ca9c1..d3c7e2b094 100644 --- a/app/print/invoice/controller.js +++ b/app/print/invoice/controller.js @@ -1,7 +1,7 @@ import Ember from 'ember'; export default Ember.Controller.extend({ actions: { - returnToInvoice: function() { + returnToInvoice() { this.transitionTo('invoices.edit', this.get('model')); } } diff --git a/app/procedures/charge/controller.js b/app/procedures/charge/controller.js index ac571c5123..6f0103c33f 100644 --- a/app/procedures/charge/controller.js +++ b/app/procedures/charge/controller.js @@ -19,7 +19,7 @@ export default AbstractEditController.extend({ return this.get('i18n').t('procedures.titles.editChargeItem'); }.property('model.isNew'), - beforeUpdate: function() { + beforeUpdate() { let isNew = this.get('model.isNew'); if (isNew) { this.set('newCharge', true); @@ -71,7 +71,7 @@ export default AbstractEditController.extend({ }); }, - afterUpdate: function(record) { + afterUpdate(record) { if (this.get('newCharge')) { this.get('requestingController').send('addCharge', record); } else { diff --git a/app/procedures/edit/controller.js b/app/procedures/edit/controller.js index f1d249111c..d4f7aa3d23 100644 --- a/app/procedures/edit/controller.js +++ b/app/procedures/edit/controller.js @@ -62,7 +62,7 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, { updateCapability: 'add_procedure', actions: { - showAddMedication: function() { + showAddMedication() { let newCharge = this.get('store').createRecord('proc-charge', { dateCharged: new Date(), newMedicationCharge: true, @@ -71,14 +71,14 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, { this.send('openModal', 'procedures.medication', newCharge); }, - showEditMedication: function(charge) { + showEditMedication(charge) { let medicationList = this.get('medicationList'); let selectedMedication = medicationList.findBy('id', charge.get('medication.id')); charge.set('itemName', selectedMedication.name); this.send('openModal', 'procedures.medication', charge); }, - showDeleteMedication: function(charge) { + showDeleteMedication(charge) { this.send('openModal', 'dialog', Ember.Object.create({ confirmAction: 'deleteCharge', title: this.get('i18n').t('procedures.titles.deleteMedicationUsed'), @@ -90,7 +90,7 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, { } }, - beforeUpdate: function() { + beforeUpdate() { return new Ember.RSVP.Promise(function(resolve, reject) { this.updateCharges().then(function() { if (this.get('model.isNew')) { @@ -102,7 +102,7 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, { }.bind(this)); }, - afterUpdate: function() { + afterUpdate() { let alertTitle = this.get('i18n').t('procedures.titles.saved'); let alertMessage = this.get('i18n').t('procedures.messages.saved'); this.saveVisitIfNeeded(alertTitle, alertMessage); diff --git a/app/procedures/edit/route.js b/app/procedures/edit/route.js index fca3811757..cfac071baf 100644 --- a/app/procedures/edit/route.js +++ b/app/procedures/edit/route.js @@ -10,13 +10,13 @@ export default AbstractEditRoute.extend(ChargeRoute, { pricingCategory: 'Procedure', database: Ember.inject.service(), - getNewData: function() { + getNewData() { return Ember.RSVP.resolve({ procedureDate: new Date() }); }, - setupController: function(controller, model) { + setupController(controller, model) { this._super(controller, model); let medicationQuery = { key: 'Medication', diff --git a/app/procedures/medication/controller.js b/app/procedures/medication/controller.js index aa7cc05865..cbc55dcfb8 100644 --- a/app/procedures/medication/controller.js +++ b/app/procedures/medication/controller.js @@ -18,7 +18,7 @@ export default AbstractEditController.extend(InventorySelection, { return this.get('i18n').t('procedures.titles.editMedicationUsed'); }.property('model.isNew'), - beforeUpdate: function() { + beforeUpdate() { let isNew = this.get('model.isNew'); if (isNew) { this.set('newCharge', true); @@ -31,7 +31,7 @@ export default AbstractEditController.extend(InventorySelection, { return Ember.RSVP.Promise.resolve(); }, - afterUpdate: function(record) { + afterUpdate(record) { if (this.get('newCharge')) { this.get('requestingController').send('addCharge', record); } else { diff --git a/app/routes/abstract-edit-route.js b/app/routes/abstract-edit-route.js index f842f44449..5d32177214 100644 --- a/app/routes/abstract-edit-route.js +++ b/app/routes/abstract-edit-route.js @@ -6,7 +6,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, { modelName: null, newTitle: null, - _createNewRecord: function(params) { + _createNewRecord(params) { return new Ember.RSVP.Promise(function(resolve) { this.generateId().then(function(newId) { this.getNewData(params).then(function(data) { @@ -34,7 +34,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, { * @return a promise that will resolved to a generated id;default is null which means that an * id will be automatically generated via Ember data. */ - generateId: function() { + generateId() { return Ember.RSVP.resolve(null); }, @@ -42,11 +42,11 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, { * Override this function to define what data a new model should be instantiated with. * @return a promise that will resolve with the data for a new record; defaults to empty object. */ - getNewData: function() { + getNewData() { return Ember.RSVP.resolve({}); }, - model: function(params) { + model(params) { let idParam = this.get('idParam'); if (!Ember.isEmpty(idParam) && params[idParam] === 'new') { return this._createNewRecord(params); @@ -55,7 +55,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, { } }, - setupController: function(controller, model) { + setupController(controller, model) { let sectionDetails = {}; if (model.get('isNew')) { sectionDetails.currentScreenTitle = this.get('newTitle'); diff --git a/app/routes/abstract-index-route.js b/app/routes/abstract-index-route.js index 971437c963..c2297852c3 100644 --- a/app/routes/abstract-index-route.js +++ b/app/routes/abstract-index-route.js @@ -14,7 +14,7 @@ export default Ember.Route.extend(PouchDbMixin, ProgressDialog, AuthenticatedRou nextStartKey: null, pageTitle: null, - _getFilterParams: function(params) { + _getFilterParams(params) { let filterByList = []; let filterParams = this.get('filterParams'); if (!Ember.isEmpty(filterParams)) { @@ -30,27 +30,27 @@ export default Ember.Route.extend(PouchDbMixin, ProgressDialog, AuthenticatedRou return filterByList; }, - _getMaxPouchId: function() { + _getMaxPouchId() { return this.get('database').getPouchId({}, this.get('modelName').camelize()); }, - _getMinPouchId: function() { + _getMinPouchId() { return this.get('database').getPouchId(null, this.get('modelName').camelize()); }, - _getPouchIdFromItem: function(item) { + _getPouchIdFromItem(item) { return this.get('database').getPouchId(item.get('id'), this.get('modelName').camelize()); }, - _getStartKeyFromItem: function(item) { + _getStartKeyFromItem(item) { return item.get('id'); }, - _modelQueryParams: function() { + _modelQueryParams() { return {}; }, - model: function(params) { + model(params) { return new Ember.RSVP.Promise(function(resolve, reject) { let filterParams = this._getFilterParams(params); let modelName = this.get('modelName'); @@ -93,7 +93,7 @@ export default Ember.Route.extend(PouchDbMixin, ProgressDialog, AuthenticatedRou startKey: { refreshModel: true } }, - setupController: function(controller, model) { + setupController(controller, model) { let props = this.getProperties('firstKey', 'nextStartKey'); controller.setProperties(props); let sectionDetails = { diff --git a/app/routes/abstract-module-route.js b/app/routes/abstract-module-route.js index 56fee45213..5c837f29e1 100644 --- a/app/routes/abstract-module-route.js +++ b/app/routes/abstract-module-route.js @@ -38,17 +38,17 @@ export default Ember.Route.extend(UserSession, AuthenticatedRouteMixin, { }.property('moduleName'), actions: { - allItems: function() { + allItems() { this.transitionTo(`${this.get('moduleName')}.index`); }, - deleteItem: function(item) { + deleteItem(item) { let deletePath = this.get('deletePath'); this.send('openModal', deletePath, item); }, - editItem: function(item) { + editItem(item) { this.transitionTo(this.get('editPath'), item); }, - newItem: function() { + newItem() { if (this.currentUserCan(this.get('addCapability'))) { this.transitionTo(this.get('editPath'), 'new'); } @@ -62,7 +62,7 @@ export default Ember.Route.extend(UserSession, AuthenticatedRouteMixin, { * - newButtonText - The text to display for the "new" button. * - newButtonAction - The action to fire for the "new" button. */ - setSectionHeader: function(details) { + setSectionHeader(details) { let currentController = this.controllerFor(this.get('moduleName')); currentController.setProperties(details); } @@ -72,7 +72,7 @@ export default Ember.Route.extend(UserSession, AuthenticatedRouteMixin, { /** * Make sure the user has permissions to the module; if not reroute to index. */ - beforeModel: function(transition) { + beforeModel(transition) { let moduleName = this.get('moduleName'); if (this.currentUserCan(moduleName)) { return this._super(transition); @@ -87,11 +87,11 @@ export default Ember.Route.extend(UserSession, AuthenticatedRouteMixin, { * @return a promise that will resolved to a generated id;default is null which means that an * id will be automatically generated via Ember data. */ - generateId: function() { + generateId() { return Ember.RSVP.resolve(null); }, - model: function() { + model() { if (!Ember.isEmpty(this.additionalModels)) { return new Ember.RSVP.Promise(function(resolve, reject) { let promises = this.additionalModels.map(function(modelMap) { @@ -115,11 +115,11 @@ export default Ember.Route.extend(UserSession, AuthenticatedRouteMixin, { } }, - renderTemplate: function() { + renderTemplate() { this.render('section'); }, - setupController: function(controller, model) { + setupController(controller, model) { let navigationController = this.controllerFor('navigation'); if (this.get('allowSearch') === true) { navigationController.set('allowSearch', true); diff --git a/app/routes/abstract-search-route.js b/app/routes/abstract-search-route.js index cdd5c6a3c7..46d9897a38 100644 --- a/app/routes/abstract-search-route.js +++ b/app/routes/abstract-search-route.js @@ -7,7 +7,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, { searchModel: null, searchText: null, - _findByContains: function(searchText) { + _findByContains(searchText) { let searchKeys = this.get('searchKeys'); let searchModel = this.get('searchModel'); let queryParams = { @@ -19,7 +19,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, { return this.store.query(searchModel, queryParams); }, - model: function(params) { + model(params) { return new Ember.RSVP.Promise(function(resolve) { let searchText = params.search_text; this.controllerFor('navigation').set('currentSearchText', searchText); @@ -31,7 +31,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, { }.bind(this)); }, - setupController: function(controller, model) { + setupController(controller, model) { this._super(controller, model); if (!Ember.isEmpty(model)) { controller.set('hasRecords', (model.get('length') > 0)); diff --git a/app/routes/application.js b/app/routes/application.js index 4918c4b589..f38e117b05 100644 --- a/app/routes/application.js +++ b/app/routes/application.js @@ -11,7 +11,7 @@ let ApplicationRoute = Route.extend(ApplicationRouteMixin, SetupUserRole, { shouldSetupUserRole: true, actions: { - closeModal: function() { + closeModal() { this.disconnectOutlet({ parentView: 'application', outlet: 'modal' @@ -22,7 +22,7 @@ let ApplicationRoute = Route.extend(ApplicationRouteMixin, SetupUserRole, { * @param modalPath the path to use for the controller and template. * @param model (optional) the model to set on the controller for the modal. */ - openModal: function(modalPath, model) { + openModal(modalPath, model) { if (model) { this.controllerFor(modalPath).set('model', model); } @@ -34,12 +34,12 @@ let ApplicationRoute = Route.extend(ApplicationRouteMixin, SetupUserRole, { * @param modalPath the path to use for the controller and template. * @param model (optional) the model to set on the controller for the modal. */ - updateModal: function(modalPath, model) { + updateModal(modalPath, model) { this.controllerFor(modalPath).set('model', model); } }, - model: function(params, transition) { + model(params, transition) { let session = this.get('session'); let isAuthenticated = session && session.get('isAuthenticated'); return this.get('config').setup().then(function(configs) { @@ -58,12 +58,12 @@ let ApplicationRoute = Route.extend(ApplicationRouteMixin, SetupUserRole, { }.bind(this)); }, - afterModel: function() { + afterModel() { this.controllerFor('navigation').set('allowSearch', false); $('#apploading').remove(); }, - renderModal: function(template) { + renderModal(template) { this.render(template, { into: 'application', outlet: 'modal' diff --git a/app/routes/index.js b/app/routes/index.js index 3ab29fb397..99f37d5a76 100644 --- a/app/routes/index.js +++ b/app/routes/index.js @@ -1,7 +1,7 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; import Ember from 'ember'; export default Ember.Route.extend(AuthenticatedRouteMixin, { - afterModel: function() { + afterModel() { this.controllerFor('navigation').set('allowSearch', false); } }); diff --git a/app/routes/login.js b/app/routes/login.js index 886028d506..a2fed44d7e 100644 --- a/app/routes/login.js +++ b/app/routes/login.js @@ -2,7 +2,7 @@ import Ember from 'ember'; import UnauthenticatedRouteMixin from 'ember-simple-auth/mixins/unauthenticated-route-mixin'; export default Ember.Route.extend(UnauthenticatedRouteMixin, { config: Ember.inject.service(), - beforeModel: function(transition) { + beforeModel(transition) { if (this.get('session').get('isAuthenticated')) { this._super(transition); } else { diff --git a/app/serializers/user.js b/app/serializers/user.js index ac059ca60f..f25b22163a 100644 --- a/app/serializers/user.js +++ b/app/serializers/user.js @@ -7,14 +7,14 @@ let couchSerializer = DS.JSONSerializer.extend({ isNewSerializerAPI: true, - normalizeArrayResponse: function(store, primaryModelClass, payload, id, requestType) { + normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) { let newPayload = payload.rows.map(function(row) { return row.doc; }.bind(this)); return this._super(store, primaryModelClass, newPayload, id, requestType); }, - normalizeSaveResponse: function(store, primaryModelClass, payload) { + normalizeSaveResponse(store, primaryModelClass, payload) { return { data: { id: payload.id, diff --git a/app/services/config.js b/app/services/config.js index 4c1858b0ab..b8e534f1ff 100644 --- a/app/services/config.js +++ b/app/services/config.js @@ -84,7 +84,7 @@ export default Ember.Service.extend({ }); }); }, - saveOauthConfigs: function(configs) { + saveOauthConfigs(configs) { let configDB = this.get('configDB'); let configKeys = Object.keys(configs); let savePromises = []; @@ -129,7 +129,7 @@ export default Ember.Service.extend({ }, `get ${id} from config database`); }, - _getOauthConfigs: function(configKeys) { + _getOauthConfigs(configKeys) { let configDB = this.get('configDB'); let options = { include_docs: true, @@ -138,7 +138,7 @@ export default Ember.Service.extend({ return configDB.allDocs(options); }, - setCurrentUser: function(userName) { + setCurrentUser(userName) { let config = this.get('configDB'); let sessionData = this.get('sessionData'); if (!userName && sessionData.authenticated) { diff --git a/app/services/database.js b/app/services/database.js index ef3b41ac4c..b634add2c6 100644 --- a/app/services/database.js +++ b/app/services/database.js @@ -116,7 +116,7 @@ export default Ember.Service.extend(PouchAdapterUtils, { getPouchId(emberId, type) { return this.get('mainDB').rel.makeDocID({ id: emberId, - type: type + type }); }, @@ -125,7 +125,7 @@ export default Ember.Service.extend(PouchAdapterUtils, { * @param {String} dbDump A couchdb dump string produced by pouchdb-dump-cli. * @returns {Promise} A promise that resolves once the dump has been loaded. */ - loadDBFromDump: function(dbDump) { + loadDBFromDump(dbDump) { return new Ember.RSVP.Promise((resolve, reject) => { let db = new PouchDB('dbdump', { adapter: 'memory' diff --git a/app/services/filesystem.js b/app/services/filesystem.js index d8c9cad32d..15ce1bd21e 100644 --- a/app/services/filesystem.js +++ b/app/services/filesystem.js @@ -5,11 +5,11 @@ export default Ember.Service.extend({ filer: null, // Injected via initializer fileSystemSize: (1024 * 1024 * 1024 * 8), // 8GB max size for local filesystem;chrome only, - _onError: function(e) { + _onError(e) { console.log(`Filer filesystem error: ${e}`); }, - _downloadFiles: function() { + _downloadFiles() { this.store.find('photo').then(function(photos) { photos.forEach(function(photo) { this.downloadIfNeeded(photo); @@ -21,7 +21,7 @@ export default Ember.Service.extend({ * Downloads the file from the server and saves it to the local filesystem. * @param {Object} fileRecord Record to use to download the file. */ - _downloadFileFromServer: function(fileRecord) { + _downloadFileFromServer(fileRecord) { let fileName = Ember.get(fileRecord, 'fileName'); let pouchDbId = Ember.get(fileRecord, 'id'); let url = Ember.get(fileRecord, 'url'); @@ -37,10 +37,10 @@ export default Ember.Service.extend({ } }, - setup: function() { + setup() { let size = this.get('fileSystemSize'); let filer = new Filer(); - filer.init({ persistent: true, size: size }, function() { + filer.init({ persistent: true, size }, function() { try { this.set('filer', filer); } catch(ignored) { @@ -58,7 +58,7 @@ export default Ember.Service.extend({ * prefixed by 'patient_'. * @returns {Promise} returns a Promise that resolves once the file is saved. */ - addFile: function(file, path, pouchDbId) { + addFile(file, path, pouchDbId) { return new Ember.RSVP.Promise(function(resolve, reject) { let currentDate = new Date(); let filer = this.get('filer'); @@ -120,7 +120,7 @@ export default Ember.Service.extend({ * prefixed by 'patient_'. * @returns {Promise} returns a Promise that resolves once the file is deleted. */ - deleteFile: function(filePath, pouchDbId) { + deleteFile(filePath, pouchDbId) { return new Ember.RSVP.Promise(function(resolve, reject) { let filer = this.get('filer'); let config = this.get('config'); @@ -135,7 +135,7 @@ export default Ember.Service.extend({ }.bind(this)); }, - downloadIfNeeded: function(fileRecord) { + downloadIfNeeded(fileRecord) { let fileName = Ember.get(fileRecord, 'fileName'); this.fileExists(fileName).then(function(exists) { if (!exists) { @@ -150,7 +150,7 @@ export default Ember.Service.extend({ * @returns {Promise} returns a Promise that resolves with a boolean indicating * if the file exists. */ - fileExists: function(filePath) { + fileExists(filePath) { return new Ember.RSVP.Promise(function(resolve) { let filer = this.get('filer'); filer.fs.root.getFile(filePath, {}, function() { @@ -168,7 +168,7 @@ export default Ember.Service.extend({ * @returns {Promise} returns a Promise that resolves with the data url * for the file. */ - fileToDataURL: function(file) { + fileToDataURL(file) { return new Ember.RSVP.Promise(function(resolve) { let reader = new FileReader(); reader.onloadend = function(e) { @@ -184,7 +184,7 @@ export default Ember.Service.extend({ * @returns {Promise} returns a Promise that resolves with the data url * for the file. */ - fileToString: function(file) { + fileToString(file) { return new Ember.RSVP.Promise(function(resolve) { let reader = new FileReader(); reader.onloadend = function(e) { @@ -208,7 +208,7 @@ export default Ember.Service.extend({ * @returns {Promise} returns a Promise that resolves with the file system * url or null if the file doesn't exist. */ - pathToFileSystemURL: function(path) { + pathToFileSystemURL(path) { return new Ember.RSVP.Promise(function(resolve) { let filer = this.get('filer'); filer.fs.root.getFile(path, {}, function(fileEntry) { diff --git a/app/users/delete/controller.js b/app/users/delete/controller.js index aea6675c50..4f7c3612ea 100644 --- a/app/users/delete/controller.js +++ b/app/users/delete/controller.js @@ -4,7 +4,7 @@ export default AbstractDeleteController.extend({ title: t('labels.deleteUser'), actions: { - delete: function() { + delete() { let recordToDelete = this.get('model'); this.get('model').destroyRecord().then(() => { this.send('closeModal', recordToDelete); diff --git a/app/users/edit/controller.js b/app/users/edit/controller.js index e4a2ccab92..6ce0b4ff51 100644 --- a/app/users/edit/controller.js +++ b/app/users/edit/controller.js @@ -9,7 +9,7 @@ export default AbstractEditController.extend(UserRoles, { users: Ember.computed.alias('usersController.model'), actions: { - update: function() { + update() { let updateModel = this.get('model'); let users = this.get('users'); diff --git a/app/users/edit/route.js b/app/users/edit/route.js index 8de1780dbe..9608fd805e 100644 --- a/app/users/edit/route.js +++ b/app/users/edit/route.js @@ -6,7 +6,7 @@ export default AbstractEditRoute.extend({ modelName: 'user', newTitle: t('labels.newUser'), - getNewData: function() { + getNewData() { return Ember.RSVP.resolve({ roles: ['Data Entry', 'user'] }); diff --git a/app/users/index/route.js b/app/users/index/route.js index 501007afee..44a2f64f86 100644 --- a/app/users/index/route.js +++ b/app/users/index/route.js @@ -11,7 +11,7 @@ export default AbstractIndexRoute.extend(UserSession, { }.property(), newButtonText: t('user.plusNewUser'), pageTitle: t('user.usersPageTile'), - model: function() { + model() { return this.store.findAll('user'); } }); diff --git a/app/users/route.js b/app/users/route.js index f5eac96b24..7db2581379 100644 --- a/app/users/route.js +++ b/app/users/route.js @@ -2,7 +2,7 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout import Ember from 'ember'; export default Ember.Route.extend(AuthenticatedRouteMixin, { actions: { - allItems: function() { + allItems() { this.transitionTo('users.index'); } } diff --git a/app/utils/date-sort.js b/app/utils/date-sort.js index bb4b5403b1..17e999a38e 100644 --- a/app/utils/date-sort.js +++ b/app/utils/date-sort.js @@ -1,6 +1,6 @@ import Ember from 'ember'; export default { - sortByDate: function(firstItem, secondItem, compareAttribute) { + sortByDate(firstItem, secondItem, compareAttribute) { let firstDate = firstItem.get(compareAttribute); let secondDate = secondItem.get(compareAttribute); return Ember.compare(firstDate.getTime(), secondDate.getTime()); diff --git a/app/utils/patient-validation.js b/app/utils/patient-validation.js index 774849edd5..ac5872cbd3 100644 --- a/app/utils/patient-validation.js +++ b/app/utils/patient-validation.js @@ -3,7 +3,7 @@ export default { patientTypeAhead: { acceptance: { accept: true, - if: function(object) { + if(object) { if (!object.get('selectPatient')) { return false; } diff --git a/app/utils/select-values.js b/app/utils/select-values.js index 211ff67749..08268fef2a 100644 --- a/app/utils/select-values.js +++ b/app/utils/select-values.js @@ -1,7 +1,7 @@ function selectValuesMap(value) { return { id: value, - value: value + value }; } @@ -12,20 +12,20 @@ export default { * @param {object} object the object to map * @returns {object} the mapped object */ - selectObjectMap: function(selectValue) { + selectObjectMap(selectValue) { return Ember.Object.create({ selectObject: selectValue }); }, - selectValuesMap: selectValuesMap, + selectValuesMap, /** Map an array of strings to objects with id and value set to the string values * so that the array can be used for em-select * @param {Array} array to map. * @param {boolean} includeEmpty if there should be an empty item added to the select list */ - selectValues: function(array, includeEmpty) { + selectValues(array, includeEmpty) { if (Ember.isArray(array)) { let arrayToMap = new Array(array); if (includeEmpty) { diff --git a/app/visits/add-diagnosis/controller.js b/app/visits/add-diagnosis/controller.js index 69355e3344..a3abb297f5 100644 --- a/app/visits/add-diagnosis/controller.js +++ b/app/visits/add-diagnosis/controller.js @@ -16,11 +16,11 @@ export default AbstractEditController.extend({ showUpdateButton: true, actions: { - cancel: function() { + cancel() { this.send('closeModal'); }, - add: function() { + add() { this.updateLookupLists(); let newDiag = { date: new Date(), diff --git a/app/visits/edit/controller.js b/app/visits/edit/controller.js index 095a19e1a9..3266e85b78 100644 --- a/app/visits/edit/controller.js +++ b/app/visits/edit/controller.js @@ -128,7 +128,7 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, Pa updateCapability: 'add_visit', - _addChildObject: function(route) { + _addChildObject(route) { this.transitionToRoute(route, 'new').then(function(newRoute) { newRoute.currentModel.setProperties({ patient: this.get('model.patient'), @@ -139,7 +139,7 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, Pa }.bind(this)); }, - _finishAfterUpdate: function() { + _finishAfterUpdate() { this.displayAlert('Visit Saved', 'The visit record has been saved.'); }, @@ -147,7 +147,7 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, Pa return !Ember.isEmpty(this.get('model.additionalDiagnoses')); }.property('model.additionalDiagnoses.[]'), - afterUpdate: function() { + afterUpdate() { let patient = this.get('model.patient'); let patientAdmitted = patient.get('admitted'); let status = this.get('model.status'); @@ -168,7 +168,7 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, Pa } }, - beforeUpdate: function() { + beforeUpdate() { if (this.get('model.isNew')) { this.set('newVisit', true); } @@ -185,7 +185,7 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, Pa * @param {boolean} removeObject If true remove the object from the list; * otherwise add the specified object to the list. */ - updateList: function(listName, listObject, removeObject) { + updateList(listName, listObject, removeObject) { let model = this.get('model'); model.get(listName).then(function(list) { if (removeObject) { @@ -199,7 +199,7 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, Pa }, actions: { - addDiagnosis: function(newDiagnosis) { + addDiagnosis(newDiagnosis) { let additionalDiagnoses = this.get('model.additionalDiagnoses'); let visit = this.get('model'); if (!Ember.isArray(additionalDiagnoses)) { @@ -211,7 +211,7 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, Pa this.send('closeModal'); }, - deleteDiagnosis: function(diagnosis) { + deleteDiagnosis(diagnosis) { let additionalDiagnoses = this.get('model.additionalDiagnoses'); let visit = this.get('model'); additionalDiagnoses.removeObject(diagnosis); @@ -219,11 +219,11 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, Pa this.send('update', true); }, - addVitals: function(newVitals) { + addVitals(newVitals) { this.updateList('vitals', newVitals); }, - cancel: function() { + cancel() { let cancelledItem = this.get('model'); if (this.get('model.isNew')) { cancelledItem.deleteRecord(); @@ -233,15 +233,15 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, Pa this.send(this.get('cancelAction')); }, - deleteProcedure: function(procedure) { + deleteProcedure(procedure) { this.updateList('procedures', procedure, true); }, - deleteVitals: function(vitals) { + deleteVitals(vitals) { this.updateList('vitals', vitals, true); }, - editImaging: function(imaging) { + editImaging(imaging) { if (imaging.get('canEdit')) { imaging.setProperties({ 'returnToVisit': true @@ -250,7 +250,7 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, Pa this.transitionToRoute('imaging.edit', imaging); }, - editLab: function(lab) { + editLab(lab) { if (lab.get('canEdit')) { lab.setProperties({ 'returnToVisit': true @@ -259,21 +259,21 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, Pa } }, - editMedication: function(medication) { + editMedication(medication) { if (medication.get('canEdit')) { medication.set('returnToVisit', true); this.transitionToRoute('medication.edit', medication); } }, - showAddVitals: function() { + showAddVitals() { let newVitals = this.get('store').createRecord('vital', { dateRecorded: new Date() }); this.send('openModal', 'visits.vitals.edit', newVitals); }, - showAddPatientNote: function(model) { + showAddPatientNote(model) { if (Ember.isEmpty(model)) { model = this.get('store').createRecord('patient-note', { visit: this.get('model'), @@ -285,52 +285,52 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, Pa this.send('openModal', 'patients.notes', model); }, - newAppointment: function() { + newAppointment() { this._addChildObject('appointments.edit'); }, - newImaging: function() { + newImaging() { this._addChildObject('imaging.edit'); }, - newLab: function() { + newLab() { this._addChildObject('labs.edit'); }, - newMedication: function() { + newMedication() { this._addChildObject('medication.edit'); }, - showAddDiagnosis: function() { + showAddDiagnosis() { let newDiagnosis = this.get('store').createRecord('add-diagnosis'); this.send('openModal', 'visits.add-diagnosis', newDiagnosis); }, - showAddProcedure: function() { + showAddProcedure() { this._addChildObject('procedures.edit'); }, - showDeleteImaging: function(imaging) { + showDeleteImaging(imaging) { this.send('openModal', 'imaging.delete', imaging); }, - showDeleteLab: function(lab) { + showDeleteLab(lab) { this.send('openModal', 'labs.delete', lab); }, - showDeleteMedication: function(medication) { + showDeleteMedication(medication) { this.send('openModal', 'medication.delete', medication); }, - showDeleteProcedure: function(procedure) { + showDeleteProcedure(procedure) { this.send('openModal', 'visits.procedures.delete', procedure); }, - showDeleteVitals: function(vitals) { + showDeleteVitals(vitals) { this.send('openModal', 'visits.vitals.delete', vitals); }, - showEditProcedure: function(procedure) { + showEditProcedure(procedure) { if (Ember.isEmpty(procedure.get('visit'))) { procedure.set('visit', this.get('model')); } @@ -339,11 +339,11 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, Pa this.transitionToRoute('procedures.edit', procedure); }, - showEditVitals: function(vitals) { + showEditVitals(vitals) { this.send('openModal', 'visits.vitals.edit', vitals); }, - showDeletePatientNote: function(note) { + showDeletePatientNote(note) { this.send('openModal', 'dialog', Ember.Object.create({ confirmAction: 'deletePatientNote', title: 'Delete Note', @@ -354,7 +354,7 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, Pa })); }, - deletePatientNote: function(model) { + deletePatientNote(model) { let note = model.get('noteToDelete'); let patientNotes = this.get('model.patientNotes'); patientNotes.removeObject(note); diff --git a/app/visits/edit/route.js b/app/visits/edit/route.js index ccbe9dfeec..943ec7a8ec 100644 --- a/app/visits/edit/route.js +++ b/app/visits/edit/route.js @@ -7,7 +7,7 @@ export default AbstractEditRoute.extend(ChargeRoute, { newTitle: 'New Visit', pricingCategory: 'Ward', - getNewData: function() { + getNewData() { return Ember.RSVP.resolve({ visitType: 'Admission', startDate: new Date(), @@ -16,10 +16,10 @@ export default AbstractEditRoute.extend(ChargeRoute, { }, actions: { - updateNote: function() { + updateNote() { this.controller.send('update', true); }, - deletePatientNote: function(model) { + deletePatientNote(model) { this.controller.send('deletePatientNote', model); } } diff --git a/app/visits/procedures/delete/controller.js b/app/visits/procedures/delete/controller.js index fa160cc3dd..aa1b268d30 100644 --- a/app/visits/procedures/delete/controller.js +++ b/app/visits/procedures/delete/controller.js @@ -6,7 +6,7 @@ export default AbstractDeleteController.extend({ title: 'Delete Procedure', actions: { - notifyProcedureDelete: function() { + notifyProcedureDelete() { this.send('closeModal'); this.get('editController').send('deleteProcedure', this.get('model')); } diff --git a/app/visits/vitals/delete/controller.js b/app/visits/vitals/delete/controller.js index ea81fb5d43..5262c7af94 100644 --- a/app/visits/vitals/delete/controller.js +++ b/app/visits/vitals/delete/controller.js @@ -6,7 +6,7 @@ export default AbstractDeleteController.extend({ title: 'Delete Vitals', actions: { - notifyVitalsDelete: function() { + notifyVitalsDelete() { this.send('closeModal'); this.get('editController').send('deleteVitals', this.get('model')); } diff --git a/app/visits/vitals/edit/controller.js b/app/visits/vitals/edit/controller.js index 4d7a5a7b5b..86eb41c9a5 100644 --- a/app/visits/vitals/edit/controller.js +++ b/app/visits/vitals/edit/controller.js @@ -20,14 +20,14 @@ export default AbstractEditController.extend({ updateCapability: 'add_vitals', - beforeUpdate: function() { + beforeUpdate() { if (this.get('model.isNew')) { this.set('newVitals', true); } return Ember.RSVP.Promise.resolve(); }, - afterUpdate: function(vitals) { + afterUpdate(vitals) { if (this.get('newVitals')) { this.get('editController').send('addVitals', vitals); } else { diff --git a/tests/acceptance/admin-test.js b/tests/acceptance/admin-test.js index 4db81f87d3..d03b704b34 100644 --- a/tests/acceptance/admin-test.js +++ b/tests/acceptance/admin-test.js @@ -3,11 +3,11 @@ import { module, test } from 'qunit'; import startApp from 'hospitalrun/tests/helpers/start-app'; module('Acceptance | admin', { - beforeEach: function() { + beforeEach() { this.application = startApp(); }, - afterEach: function() { + afterEach() { Ember.run(this.application, 'destroy'); } }); diff --git a/tests/acceptance/appointments-test.js b/tests/acceptance/appointments-test.js index 4ad28195f9..b983bb392c 100644 --- a/tests/acceptance/appointments-test.js +++ b/tests/acceptance/appointments-test.js @@ -3,11 +3,11 @@ import { module, test } from 'qunit'; import startApp from 'hospitalrun/tests/helpers/start-app'; module('Acceptance | appointments', { - beforeEach: function() { + beforeEach() { this.application = startApp(); }, - afterEach: function() { + afterEach() { Ember.run(this.application, 'destroy'); } }); diff --git a/tests/acceptance/imaging-test.js b/tests/acceptance/imaging-test.js index f9f6c4370d..27b7e62e4a 100644 --- a/tests/acceptance/imaging-test.js +++ b/tests/acceptance/imaging-test.js @@ -3,11 +3,11 @@ import { module, test } from 'qunit'; import startApp from 'hospitalrun/tests/helpers/start-app'; module('Acceptance | imaging', { - beforeEach: function() { + beforeEach() { this.application = startApp(); }, - afterEach: function() { + afterEach() { Ember.run(this.application, 'destroy'); } }); diff --git a/tests/acceptance/inventory-test.js b/tests/acceptance/inventory-test.js index 3aba795fa3..3ad2201e88 100644 --- a/tests/acceptance/inventory-test.js +++ b/tests/acceptance/inventory-test.js @@ -3,11 +3,11 @@ import { module, test } from 'qunit'; import startApp from 'hospitalrun/tests/helpers/start-app'; module('Acceptance | inventory', { - beforeEach: function() { + beforeEach() { this.application = startApp(); }, - afterEach: function() { + afterEach() { Ember.run(this.application, 'destroy'); } }); diff --git a/tests/acceptance/invoices-test.js b/tests/acceptance/invoices-test.js index 84a4ad5b7a..e967f978a8 100644 --- a/tests/acceptance/invoices-test.js +++ b/tests/acceptance/invoices-test.js @@ -3,11 +3,11 @@ import { module, test } from 'qunit'; import startApp from 'hospitalrun/tests/helpers/start-app'; module('Acceptance | invoices', { - beforeEach: function() { + beforeEach() { this.application = startApp(); }, - afterEach: function() { + afterEach() { Ember.run(this.application, 'destroy'); } }); diff --git a/tests/acceptance/labs-test.js b/tests/acceptance/labs-test.js index f1e77d4e7c..a136840889 100644 --- a/tests/acceptance/labs-test.js +++ b/tests/acceptance/labs-test.js @@ -3,11 +3,11 @@ import { module, test } from 'qunit'; import startApp from 'hospitalrun/tests/helpers/start-app'; module('Acceptance | labs', { - beforeEach: function() { + beforeEach() { this.application = startApp(); }, - afterEach: function() { + afterEach() { Ember.run(this.application, 'destroy'); } }); diff --git a/tests/acceptance/login-test.js b/tests/acceptance/login-test.js index 578c72c024..c36f7ff964 100644 --- a/tests/acceptance/login-test.js +++ b/tests/acceptance/login-test.js @@ -4,12 +4,12 @@ import startApp from 'hospitalrun/tests/helpers/start-app'; import FakeServer, { stubRequest } from 'ember-cli-fake-server'; module('Acceptance | login', { - beforeEach: function() { + beforeEach() { FakeServer.start(); this.application = startApp(); }, - afterEach: function() { + afterEach() { FakeServer.stop(); Ember.run(this.application, 'destroy'); } diff --git a/tests/acceptance/medication-test.js b/tests/acceptance/medication-test.js index 76b6354214..8f1b363681 100644 --- a/tests/acceptance/medication-test.js +++ b/tests/acceptance/medication-test.js @@ -3,11 +3,11 @@ import { module, test } from 'qunit'; import startApp from 'hospitalrun/tests/helpers/start-app'; module('Acceptance | medication', { - beforeEach: function() { + beforeEach() { this.application = startApp(); }, - afterEach: function() { + afterEach() { Ember.run(this.application, 'destroy'); } }); diff --git a/tests/acceptance/patient-notes-test.js b/tests/acceptance/patient-notes-test.js index 4699ee7eb3..0598e92ec2 100644 --- a/tests/acceptance/patient-notes-test.js +++ b/tests/acceptance/patient-notes-test.js @@ -3,11 +3,11 @@ import { module, test } from 'qunit'; import startApp from 'hospitalrun/tests/helpers/start-app'; module('Acceptance | patient notes', { - beforeEach: function() { + beforeEach() { this.application = startApp(); }, - afterEach: function() { + afterEach() { Ember.run(this.application, 'destroy'); } }); diff --git a/tests/acceptance/patients-test.js b/tests/acceptance/patients-test.js index dabd7b5d03..756deab0fa 100644 --- a/tests/acceptance/patients-test.js +++ b/tests/acceptance/patients-test.js @@ -3,11 +3,11 @@ import { module, test } from 'qunit'; import startApp from 'hospitalrun/tests/helpers/start-app'; module('Acceptance | patients', { - beforeEach: function() { + beforeEach() { this.application = startApp(); }, - afterEach: function() { + afterEach() { Ember.run(this.application, 'destroy'); } }); diff --git a/tests/acceptance/pricing-test.js b/tests/acceptance/pricing-test.js index 210a3f9043..eb79f3b6f9 100644 --- a/tests/acceptance/pricing-test.js +++ b/tests/acceptance/pricing-test.js @@ -20,11 +20,11 @@ function verifyPricingLists(path, includesPrices, excludesPrices, assert) { } module('Acceptance | pricing', { - beforeEach: function() { + beforeEach() { this.application = startApp(); }, - afterEach: function() { + afterEach() { Ember.run(this.application, 'destroy'); } }); diff --git a/tests/acceptance/procedure-test.js b/tests/acceptance/procedure-test.js index f1548393a7..504603f35f 100644 --- a/tests/acceptance/procedure-test.js +++ b/tests/acceptance/procedure-test.js @@ -3,11 +3,11 @@ import { module, test } from 'qunit'; import startApp from 'hospitalrun/tests/helpers/start-app'; module('Acceptance | procedures', { - beforeEach: function() { + beforeEach() { this.application = startApp(); }, - afterEach: function() { + afterEach() { Ember.run(this.application, 'destroy'); } }); diff --git a/tests/acceptance/role-test.js b/tests/acceptance/role-test.js index 37673f3f6d..0a6bfda1f6 100644 --- a/tests/acceptance/role-test.js +++ b/tests/acceptance/role-test.js @@ -3,11 +3,11 @@ import { module, test } from 'qunit'; import startApp from 'hospitalrun/tests/helpers/start-app'; module('Acceptance | roles', { - beforeEach: function() { + beforeEach() { this.application = startApp(); }, - afterEach: function() { + afterEach() { Ember.run(this.application, 'destroy'); } }); diff --git a/tests/acceptance/users-test.js b/tests/acceptance/users-test.js index 976fdf8b46..d1105e6db1 100644 --- a/tests/acceptance/users-test.js +++ b/tests/acceptance/users-test.js @@ -57,12 +57,12 @@ function addAllUsers(assert) { } module('Acceptance | users', { - beforeEach: function() { + beforeEach() { FakeServer.start(); this.application = startApp(); }, - afterEach: function() { + afterEach() { FakeServer.stop(); Ember.run(this.application, 'destroy'); } diff --git a/tests/acceptance/visit-test.js b/tests/acceptance/visit-test.js index b179685ffe..37e4d306a2 100644 --- a/tests/acceptance/visit-test.js +++ b/tests/acceptance/visit-test.js @@ -3,11 +3,11 @@ import { module, test } from 'qunit'; import startApp from 'hospitalrun/tests/helpers/start-app'; module('Acceptance | visits', { - beforeEach: function() { + beforeEach() { this.application = startApp(); }, - afterEach: function() { + afterEach() { Ember.run(this.application, 'destroy'); } });