Skip to content

Commit

Permalink
[OPAL-560] Delete cart should also have a loder
Browse files Browse the repository at this point in the history
  • Loading branch information
MAhsenArif committed Sep 5, 2018
1 parent fa5bf14 commit 87204b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/app/views/provisioning/subscriptions.controller.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ angular.module 'mnoEnterpriseAngular'
vm = this
vm.isLoading = true
vm.isCartSubmitting = false
vm.isCartDeleting = false
vm.cartSubscriptions = $stateParams.subType == 'cart'
vm.skipPriceSelection = ProvisioningHelper.skipPriceSelection

Expand All @@ -20,15 +21,18 @@ angular.module 'mnoEnterpriseAngular'
MnoeProvisioning.getSubscriptions(params)

vm.deleteCart = ->
return if vm.isCartSubmitting || vm.isCartDeleting
vm.isCartDeleting = true
MnoeProvisioning.deleteCartSubscriptions().then(
(response) ->
MnoeProvisioning.emptyCartSubscriptions()
toastr.info('mno_enterprise.templates.dashboard.provisioning.subscriptions.cart.delete_cart.toastr')
vm.isCartDeleting = false
$state.go("home.marketplace")
)

vm.submitCart = ->
return if vm.isCartSubmitting
return if vm.isCartSubmitting || vm.isCartDeleting
vm.isCartSubmitting = true
MnoeProvisioning.submitCartSubscriptions().then(
(response) ->
Expand Down
5 changes: 3 additions & 2 deletions src/app/views/provisioning/subscriptions.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ <h2 class="section-title" ng-hide="vm.cartSubscriptions" translate>

<div id="provisioning-subscriptions" class="row top-buffer-2">
<div ng-show="vm.cartSubscriptions" class='text-right bottom-buffer-1'>
<button class='btn btn-primary' ng-click="vm.deleteCart()">
<button class='btn btn-primary' ng-disabled="vm.isCartDeleting || vm.isCartSubmitting" ng-click="vm.deleteCart()">
<span ng-show="vm.isCartDeleting"><i class='fa fa-spinner fa-pulse fa-fw'></i></span>
{{ 'mno_enterprise.templates.dashboard.provisioning.subscriptions.cart.delete_cart.title' | translate }}
</button>
<button class='btn btn-primary' ng-disabled="vm.isCartSubmitting" ng-click="vm.submitCart()">
<button class='btn btn-primary' ng-disabled="vm.isCartDeleting || vm.isCartSubmitting" ng-click="vm.submitCart()">
<span ng-show="vm.isCartSubmitting"><i class='fa fa-spinner fa-pulse fa-fw'></i></span>
{{ 'mno_enterprise.templates.dashboard.provisioning.subscriptions.cart.submit_cart.title' | translate }}
</button>
Expand Down

0 comments on commit 87204b9

Please sign in to comment.