1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 00:33:44 +00:00

org create form on it's own page instead of modal

This commit is contained in:
Kyle Spearrin
2017-04-07 12:32:15 -04:00
parent d39d49fb8f
commit 71adf31f7b
7 changed files with 547 additions and 498 deletions

View File

@@ -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');
};
});