-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(billing services): delete modal + deep link
This commit adds the ability to deep link deletes via ui-router's state. Delete now operates like update, using `/billing_services/:id/delete` to open a generic delete modal to perform the delete request. This commit completes the functionality of the billing_services module. However, it needs polishing. A review issue will be made to mention the following things specfically: 1. Bad Delete Modal UI - this should be improved as we use it in multiple places. 2. The "create" button is in a terribly chosen place - should this be a dropdown? 3. (Server) error handling needs to be decided on and adopted by the whole team uniformly. 4. Better alert system (scroll to and highlight) for ui-grid on create and update. This commit officially closes #206.
- Loading branch information
Showing
15 changed files
with
430 additions
and
361 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
angular.module('bhima.controllers') | ||
.controller('BillingServicesDeleteController', BillingServicesDeleteController); | ||
|
||
BillingServicesDeleteController.$inject = ['$state', '$uibModalInstance', 'BillingServicesService' ]; | ||
|
||
/** | ||
* Billing Services Delete Controller | ||
* | ||
* This is a super simple controller to ensure that errors are properly handled | ||
* and translated on the billing services modal. It leverages the shared | ||
* ConfirmModal template. | ||
* | ||
* This controller is instantiated in a modal. | ||
*/ | ||
function BillingServicesDeleteController($state, Instance, BillingServices) { | ||
var vm = this; | ||
|
||
// bind methods to the view | ||
vm.dismiss = Instance.dismiss; | ||
vm.submit = submit; | ||
|
||
// submit a delete request to the server | ||
function submit() { | ||
// clear the error, if it exists | ||
delete vm.error; | ||
|
||
// attempt to delete the billing service | ||
return BillingServices.delete($state.params.id) | ||
.then(function () { | ||
|
||
// if successful, close the modal instance | ||
Instance.close(); | ||
}) | ||
.catch(function (response) { | ||
|
||
// bind the error to the view | ||
vm.error = response.data; | ||
}); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.