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

Commit

Permalink
Refactor showDeleteLineItem and showDeleteItem to share code
Browse files Browse the repository at this point in the history
  • Loading branch information
billybonks committed Jun 30, 2016
1 parent a34991f commit 7993077
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions app/invoices/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,26 +122,28 @@ export default AbstractEditController.extend(NumberFormat, PatientSubmodule, Pub
},

showDeleteItem: function(itemToDelete, deleteFrom) {
this.send('openModal', 'dialog', Ember.Object.create({
this.showDeleteModal(itemToDelete, Ember.Object.create({
confirmAction: 'deleteCharge',
deleteFrom: deleteFrom,
title: 'Delete Charge',
message: `Are you sure you want to delete ${itemToDelete.get('name')}?`,
itemToDelete: itemToDelete,
updateButtonAction: 'confirm',
updateButtonText: 'Ok'
}));
},

showDeleteLineItem: function(item) {
this.send('openModal', 'dialog', Ember.Object.create({
this.showDeleteModal(item, Ember.Object.create({
confirmAction: 'deleteLineItem',
title: 'Delete Line Item',
title: 'Delete Line Item'
}));
},

showDeleteModal(item, options) {
options = Ember.merge(options, Ember.Object.create({
message: `Are you sure you want to delete ${item.get('name')}?`,
itemToDelete: item,
updateButtonAction: 'confirm',
updateButtonText: 'Ok'
}));
this.send('openModal', 'dialog', options);
},

showRemovePayment: function(payment) {
Expand Down

0 comments on commit 7993077

Please sign in to comment.