diff --git a/src/app/components/dashboard-company-deletion/dashboard-company-deletion.coffee b/src/app/components/dashboard-company-deletion/dashboard-company-deletion.coffee new file mode 100644 index 00000000..64a72299 --- /dev/null +++ b/src/app/components/dashboard-company-deletion/dashboard-company-deletion.coffee @@ -0,0 +1,21 @@ +angular.module 'mnoEnterpriseAngular' + .component('dashboardCompanyDeletion', { + restrict: 'EA' + templateUrl: 'app/components/dashboard-company-deletion/dashboard-company-deletion.html', + controllerAs: "DashboardCompanyDeletionCtrl" + controller: ($uibModal, MnoeCurrentUser, MnoeOrganizations, MnoeAppInstances, MnoConfirm) -> + vm = this + vm.isDeletionOpen = false + + vm.proceed = (reason, password) -> + MnoeOrganizations.freeze(reason, password) + + vm.requestDeletion = () -> + modalInstance = $uibModal.open( + component: "dashboardDeletionConfirm", + size: "lg", + resolve: + actionCb: () -> vm.proceed + ) + return + }) diff --git a/src/app/components/dashboard-company-deletion/dashboard-company-deletion.html b/src/app/components/dashboard-company-deletion/dashboard-company-deletion.html new file mode 100644 index 00000000..5f7cf69d --- /dev/null +++ b/src/app/components/dashboard-company-deletion/dashboard-company-deletion.html @@ -0,0 +1,11 @@ +
+
+
+ {{ 'mno_enterprise.templates.dashboard.organization.settings.deletion.company_deletion' | translate }} +
+
+ +
+
diff --git a/src/app/components/dashboard-company-selectbox/dashboard-company-selectbox.coffee b/src/app/components/dashboard-company-selectbox/dashboard-company-selectbox.coffee index e8f127ef..626dad59 100644 --- a/src/app/components/dashboard-company-selectbox/dashboard-company-selectbox.coffee +++ b/src/app/components/dashboard-company-selectbox/dashboard-company-selectbox.coffee @@ -23,7 +23,9 @@ DashboardCompanySelectboxCtrl = ($scope, $state, $stateParams, $uibModal, MnoeCu # Switch to selected company MnoeAppInstances.emptyAppInstances() MnoeAppInstances.clearCache() - MnoeOrganizations.get(organization.id) + MnoeOrganizations.get(organization.id).then((org) -> + $state.go('home.company') unless org.organization.active + ) selectBox.close() selectOrganization = -> diff --git a/src/app/components/dashboard-deletion-confirm/dashboard-deletion-confirm.coffee b/src/app/components/dashboard-deletion-confirm/dashboard-deletion-confirm.coffee new file mode 100644 index 00000000..8e03adcb --- /dev/null +++ b/src/app/components/dashboard-deletion-confirm/dashboard-deletion-confirm.coffee @@ -0,0 +1,33 @@ +angular.module 'mnoEnterpriseAngular' + .component('dashboardDeletionConfirm', { + templateUrl: 'app/components/dashboard-deletion-confirm/dashboard-deletion-confirm.html', + bindings: { + resolve: '<' + close: '&' + dismiss: '&' + } + controller: ($log, $state, toastr) -> + ctrl = this + ctrl.password = "" + ctrl.delReasons = "" + ctrl.isLoading = false + + ctrl.cancel = () -> + ctrl.dismiss({$value: "cancel"}) + + ctrl.ok = () -> + ctrl.isLoading = true + + # Launch Cb + ctrl.resolve.actionCb(ctrl.delReasons, ctrl.password).then( + (response) -> + toastr.success('mno_enterprise.templates.dashboard.organization.settings.deletion.toastr_success') + # Reload the state to block access to Impac!, marketplace, ... + $state.reload() + ctrl.close(response) + (errors) -> + $log.error(errors) + toastr.error(errors.statusText, "mno_enterprise.templates.dashboard.organization.settings.deletion.toastr_error") + ).finally(-> ctrl.isLoading = false) + return + }) diff --git a/src/app/components/dashboard-deletion-confirm/dashboard-deletion-confirm.html b/src/app/components/dashboard-deletion-confirm/dashboard-deletion-confirm.html new file mode 100644 index 00000000..bc76e029 --- /dev/null +++ b/src/app/components/dashboard-deletion-confirm/dashboard-deletion-confirm.html @@ -0,0 +1,22 @@ + + diff --git a/src/app/components/dashboard-menu/dashboard-menu.controller.coffee b/src/app/components/dashboard-menu/dashboard-menu.controller.coffee index 0f378150..0f85a31d 100644 --- a/src/app/components/dashboard-menu/dashboard-menu.controller.coffee +++ b/src/app/components/dashboard-menu/dashboard-menu.controller.coffee @@ -20,6 +20,7 @@ angular.module 'mnoEnterpriseAngular' MnoeCurrentUser.get().then( (response) -> selectedOrg = _.find(response.organizations, {id: newValue}) + $scope.isCompanyActive = selectedOrg.active $scope.isAdmin = MnoeOrganizations.role.atLeastAdmin(selectedOrg.current_user_role) ) if newValue? ) diff --git a/src/app/components/dashboard-menu/dashboard-menu.html b/src/app/components/dashboard-menu/dashboard-menu.html index 9e91e5b0..882e3afe 100644 --- a/src/app/components/dashboard-menu/dashboard-menu.html +++ b/src/app/components/dashboard-menu/dashboard-menu.html @@ -17,18 +17,19 @@ -
  • - {{ 'mno_enterprise.templates.dashboard.menu.dashboard' | translate }} + +
  • + {{ 'mno_enterprise.templates.dashboard.menu.dashboard' | translate }}
  • -
  • +
  • {{ 'mno_enterprise.templates.dashboard.menu.dashboard' | translate }}
  • -
  • +
  • {{ 'mno_enterprise.templates.dashboard.menu.impac' | translate }}
  • -
  • +
  • {{ 'mno_enterprise.templates.dashboard.menu.dashboard' | translate }}
  • @@ -40,11 +41,11 @@ {{ 'mno_enterprise.templates.dashboard.menu.company' | translate }} -
  • +
  • {{ 'mno_enterprise.templates.dashboard.menu.subscriptions' | translate }}
  • -
  • +
  • {{ 'mno_enterprise.templates.dashboard.menu.marketplace' | translate }}
  • @@ -66,17 +67,17 @@