From 71adf31f7b666b23e6403c878c4b6c672743655b Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 7 Apr 2017 12:32:15 -0400 Subject: [PATCH] org create form on it's own page instead of modal --- src/app/config.js | 6 + src/app/settings/settingsController.js | 8 - .../settingsCreateOrganizationController.js | 30 +- src/app/settings/views/settings.html | 4 +- .../views/settingsCreateOrganization.html | 939 +++++++++--------- src/app/views/userLayout.html | 12 +- src/less/vault.less | 46 +- 7 files changed, 547 insertions(+), 498 deletions(-) diff --git a/src/app/config.js b/src/app/config.js index 4c74a02f61..338ffeb909 100644 --- a/src/app/config.js +++ b/src/app/config.js @@ -111,6 +111,12 @@ angular controller: 'settingsDomainsController', data: { pageTitle: 'Domain Settings' } }) + .state('backend.user.settingsCreateOrg', { + url: '^/settings/create-organization', + templateUrl: 'app/settings/views/settingsCreateOrganization.html', + controller: 'settingsCreateOrganizationController', + data: { pageTitle: 'Create Organization' } + }) .state('backend.user.tools', { url: '^/tools', templateUrl: 'app/tools/views/tools.html', diff --git a/src/app/settings/settingsController.js b/src/app/settings/settingsController.js index bbde1c3fb9..012484c4cb 100644 --- a/src/app/settings/settingsController.js +++ b/src/app/settings/settingsController.js @@ -73,14 +73,6 @@ }); }; - $scope.createOrganization = function () { - $uibModal.open({ - animation: true, - templateUrl: 'app/settings/views/settingsCreateOrganization.html', - controller: 'settingsCreateOrganizationController' - }); - }; - $scope.viewOrganization = function (id) { $state.go('backend.org.dashboard', { orgId: id }); }; diff --git a/src/app/settings/settingsCreateOrganizationController.js b/src/app/settings/settingsCreateOrganizationController.js index 58b884a1b0..dfb1af7a7a 100644 --- a/src/app/settings/settingsCreateOrganizationController.js +++ b/src/app/settings/settingsCreateOrganizationController.js @@ -1,10 +1,8 @@ angular .module('bit.settings') - .controller('settingsCreateOrganizationController', function ($scope, $state, apiService, $uibModalInstance, cryptoService, + .controller('settingsCreateOrganizationController', function ($scope, $state, apiService, cryptoService, toastr, $analytics, authService, stripe) { - $analytics.eventTrack('settingsCreateOrganizationController', { category: 'Modal' }); - $scope.plans = { free: { basePrice: 0 @@ -30,7 +28,24 @@ $scope.model = { plan: 'personal', additionalUsers: 0, - interval: 'annually' + interval: 'year' + }; + + $scope.totalPrice = function () { + if ($scope.model.interval === 'month') { + return ($scope.model.additionalUsers || 0) * $scope.plans[$scope.model.plan].monthlyUserPrice + + $scope.plans[$scope.model.plan].monthlyBasePrice; + } + else { + return ($scope.model.additionalUsers || 0) * $scope.plans[$scope.model.plan].annualUserPrice + + $scope.plans[$scope.model.plan].annualBasePrice; + } + }; + + $scope.changedPlan = function () { + if ($scope.model.plan !== 'teams') { + $scope.model.interval = 'year'; + } }; $scope.submit = function (model) { @@ -45,14 +60,13 @@ additionalUsers: model.additionalUsers, billingEmail: model.billingEmail, businessName: model.ownedBusiness ? model.businessName : null, - monthly: model.interval === 'monthly' + monthly: model.interval === 'month' }; return apiService.organizations.post(request).$promise; }).then(function (result) { $scope.model.card = null; - $uibModalInstance.dismiss('cancel'); $analytics.eventTrack('Created Organization'); authService.addProfileOrganizationOwner(result, shareKey); $state.go('backend.org.dashboard', { orgId: result.Id }).then(function () { @@ -60,8 +74,4 @@ }); }); }; - - $scope.close = function () { - $uibModalInstance.dismiss('cancel'); - }; }); diff --git a/src/app/settings/views/settings.html b/src/app/settings/views/settings.html index e8595a809a..838037115b 100644 --- a/src/app/settings/views/settings.html +++ b/src/app/settings/views/settings.html @@ -122,9 +122,9 @@
diff --git a/src/app/settings/views/settingsCreateOrganization.html b/src/app/settings/views/settingsCreateOrganization.html index 64d261ddea..077e9769df 100644 --- a/src/app/settings/views/settingsCreateOrganization.html +++ b/src/app/settings/views/settingsCreateOrganization.html @@ -1,474 +1,495 @@ - -
-