diff --git a/app/appointments/search/route.js b/app/appointments/search/route.js index 0b84eb3d8c..3d5f302a16 100644 --- a/app/appointments/search/route.js +++ b/app/appointments/search/route.js @@ -18,7 +18,7 @@ export default AppointmentIndexRoute.extend(DateFormat, { }, _modelQueryParams: function(params) { - let startDate = params.startDate; + let { startDate } = params; let maxValue = this.get('maxValue'); if (Ember.isEmpty(startDate)) { startDate = moment(); @@ -43,7 +43,7 @@ export default AppointmentIndexRoute.extend(DateFormat, { selectedProvider: params.provider, selectedStatus: params.status }); - let startDate = params.startDate; + let { startDate } = params; startDate = new Date(); if (!Ember.isEmpty(params.startDate)) { startDate.setTime(params.startDate); diff --git a/app/components/custom-form.js b/app/components/custom-form.js index dd47cdab89..83082fa1ab 100644 --- a/app/components/custom-form.js +++ b/app/components/custom-form.js @@ -6,7 +6,7 @@ export default Ember.Component.extend(SelectValues, { let rows = []; let form = this.get('form'); if (!Ember.isEmpty(form)) { - let fields = form.fields; + let { fields } = form; let numberOfColumns = this.getWithDefault('form.columns', 1); let currentRow = []; diff --git a/app/components/image-upload.js b/app/components/image-upload.js index 1c76670530..4c57f03a91 100644 --- a/app/components/image-upload.js +++ b/app/components/image-upload.js @@ -34,8 +34,7 @@ export default InputComponent.extend({ _resizeImage: function(img) { // Derived from https://github.com/josefrichter/resize/blob/master/public/preprocess.js let canvas = document.createElement('canvas'); - let height = img.height; - let width = img.width; + let { height, width } = img; let maxHeight = 1024; let maxWidth = 1024; diff --git a/app/components/price-list.js b/app/components/price-list.js index b276e1d2a5..93a5ffae8b 100644 --- a/app/components/price-list.js +++ b/app/components/price-list.js @@ -31,7 +31,7 @@ export default Ember.Component.extend(ChargeActions, { return pricingItem; }.bind(this)); let offset = 0; - let length = pricingList.length; + let { length } = pricingList; while (offset < length) { rows.push(pricingList.slice(offset, offset + 6)); offset += 6; diff --git a/app/components/quantity-calc.js b/app/components/quantity-calc.js index e4571f4c19..c585e01ce3 100644 --- a/app/components/quantity-calc.js +++ b/app/components/quantity-calc.js @@ -47,8 +47,7 @@ export default Ember.Component.extend({ let lastObject = quantityGroups.get('lastObject'); let targetUnit = this.get('targetUnit'); haveQuantities = quantityGroups.every(function(item) { - let quantity = item.quantity; - let unit = item.unit; + let { quantity, unit } = item; return (!Ember.isEmpty(quantity) && !Ember.isEmpty(unit) && !isNaN(quantity)); }); if (haveQuantities && lastObject.unit === targetUnit) { diff --git a/app/components/role-select.js b/app/components/role-select.js index 9ff872bf68..d518e9e13d 100644 --- a/app/components/role-select.js +++ b/app/components/role-select.js @@ -20,8 +20,8 @@ export default Ember.Component.extend({ actions: { change() { - let selectEl = this.$('select')[0]; - let selectedIndex = selectEl.selectedIndex; + let selectEl = this.$('select').get(0); + let { selectedIndex } = selectEl; let content = this.get('content'); // decrement index by 1 if we have a prompt diff --git a/app/components/take-photo.js b/app/components/take-photo.js index 43af524ea3..7041bd0228 100644 --- a/app/components/take-photo.js +++ b/app/components/take-photo.js @@ -100,9 +100,9 @@ export default Ember.Component.extend({ fileUpload.hide(); camera.show(); if (!setupCamera) { - let canvas = this.$('canvas')[0]; - let photo = this.$('img')[0]; - let video = this.$('video')[0]; + let canvas = this.$('canvas').get(0); + let photo = this.$('img').get(0); + let video = this.$('video').get(0); this.setProperties({ canvas: canvas, photo: photo, @@ -163,7 +163,7 @@ export default Ember.Component.extend({ if (typeof streamToStop.active === 'undefined') { streamToStop.stop(); } else { - let track = streamToStop.getTracks()[0]; + let [track] = streamToStop.getTracks(); track.stop(); } } diff --git a/app/helpers/date-format.js b/app/helpers/date-format.js index 373db26345..0ea014d301 100644 --- a/app/helpers/date-format.js +++ b/app/helpers/date-format.js @@ -2,7 +2,7 @@ import Ember from 'ember'; export default Ember.Helper.helper(function(params, hash) { if (!Ember.isEmpty(params[0])) { let dateFormat = 'l'; - let date = params[0]; + let [date] = params; if (hash && hash.format) { dateFormat = hash.format; } diff --git a/app/inventory/reports/controller.js b/app/inventory/reports/controller.js index 263a4d70ff..490d231ebf 100644 --- a/app/inventory/reports/controller.js +++ b/app/inventory/reports/controller.js @@ -358,7 +358,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number _adjustPurchase: function(purchases, purchaseId, quantity, increment) { let purchaseToAdjust = purchases.findBy('id', purchaseId); if (!Ember.isEmpty(purchaseToAdjust)) { - let calculatedQuantity = purchaseToAdjust.calculatedQuantity; + let { calculatedQuantity } = purchaseToAdjust; if (increment) { calculatedQuantity += quantity; } else { @@ -405,7 +405,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number }, _calculateCostPerUnit: function(purchase) { - let purchaseCost = purchase.purchaseCost; + let { purchaseCost } = purchase; let quantity = parseInt(purchase.originalQuantity); if (Ember.isEmpty(purchaseCost) || Ember.isEmpty(quantity)) { return 0; @@ -572,7 +572,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number this._getInventoryItems(inventoryIds).then(function(inventoryMap) { let i18n = this.get('i18n'); purchaseDocs.forEach(function(purchase) { - let currentQuantity = purchase.currentQuantity; + let { currentQuantity } = purchase; let expirationDate = new Date(purchase.expirationDate); let inventoryItem = inventoryMap[purchase.inventoryItem]; if (inventoryItem && this._includeLocation(purchase.location)) { @@ -782,10 +782,10 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number } if (!Ember.isEmpty(inventoryRequests)) { inventoryRequests.forEach(function(request) { - let adjustPurchases = request.adjustPurchases; + let { adjustPurchases } = request; let increment = false; let purchases = request.purchasesAffected; - let transactionType = request.transactionType; + let { transactionType } = request; increment = (transactionType === 'Adjustment (Add)' || transactionType === 'Return'); if (adjustPurchases) { if (!Ember.isEmpty(purchases) && !Ember.isEmpty(inventoryPurchases)) { @@ -873,11 +873,10 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number if (!Ember.isEmpty(inventoryRequests)) { inventoryRequests.forEach(function(request) { - let adjustPurchases = request.adjustPurchases; + let { adjustPurchases, transactionType } = request; let increment = false; let locations = request.locationsAffected; let purchases = request.purchasesAffected; - let transactionType = request.transactionType; increment = (transactionType === 'Adjustment (Add)' || transactionType === 'Return'); if (adjustPurchases) { diff --git a/app/patients/notes/controller.js b/app/patients/notes/controller.js index f806cc7f5c..28e9904ab6 100644 --- a/app/patients/notes/controller.js +++ b/app/patients/notes/controller.js @@ -33,8 +33,8 @@ export default AbstractEditController.extend(IsUpdateDisabled, UserSession, Pati }, actions: { changeVisit: function() { - let selectEl = $('select[name="note-visits"]')[0]; - let selectedIndex = selectEl.selectedIndex; + let selectEl = $('select[name="note-visits"]').get(0); + let { selectedIndex } = selectEl; let content = this.get('patientVisitsForSelect'); // decrement index by 1 if we have a prompt diff --git a/app/pricing/edit/controller.js b/app/pricing/edit/controller.js index 984b851323..05c28c0640 100644 --- a/app/pricing/edit/controller.js +++ b/app/pricing/edit/controller.js @@ -15,7 +15,7 @@ export default AbstractEditController.extend(LabPricingTypes, ImagingPricingType this.send('closeModal'); }, deleteOverride: function(model) { - let overrideToDelete = model.overrideToDelete; + let { overrideToDelete } = model; let pricingOverrides = this.get('model.pricingOverrides'); pricingOverrides.removeObject(overrideToDelete); overrideToDelete.destroyRecord().then(function() {