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

organization signup plan details

This commit is contained in:
Kyle Spearrin
2017-04-04 12:57:31 -04:00
parent ebb1044c43
commit 8098ab50e8
2 changed files with 438 additions and 342 deletions

View File

@@ -1,37 +1,65 @@
angular
.module('bit.settings')
.controller('settingsCreateOrganizationController', function($scope, $state, apiService, $uibModalInstance, cryptoService,
.controller('settingsCreateOrganizationController', function ($scope, $state, apiService, $uibModalInstance, cryptoService,
toastr, $analytics, authService, stripe) {
$analytics.eventTrack('settingsCreateOrganizationController', { category: 'Modal' });
$scope.model = {
plan: 'Personal'
$scope.plans = {
free: {
basePrice: 0
},
personal: {
basePrice: 1,
annualBasePrice: 12,
baseUsers: 3,
userPrice: 1,
annualUserPrice: 12
},
teams: {
basePrice: 5,
annualBasePrice: 60,
monthlyBasePrice: 8,
baseUsers: 5,
userPrice: 2,
annualUserPrice: 24,
monthlyUserPrice: 2.5
}
};
$scope.submit = function(model) {
$scope.submitPromise = stripe.card.createToken(model.card).then(function(response) {
$scope.model = {
plan: 'personal',
additionalUsers: 0,
interval: 'annually'
};
$scope.submit = function (model) {
$scope.submitPromise = stripe.card.createToken(model.card).then(function (response) {
var request = {
name: model.name,
planType: model.plan,
key: cryptoService.makeShareKey(),
cardToken: response.id
cardToken: response.id,
additionalUsers: model.additionalUsers,
billingEmail: model.billingEmail,
businessName: model.ownedBusiness ? model.businessName : null,
monthly: model.interval === 'monthly'
};
return apiService.organizations.post(request).$promise;
}).then(function(result) {
}).then(function (result) {
$scope.model.card = null;
$uibModalInstance.dismiss('cancel');
$analytics.eventTrack('Created Organization');
authService.addProfileOrganization(result);
$state.go('backend.org.dashboard', { orgId: result.Id }).then(function() {
$state.go('backend.org.dashboard', { orgId: result.Id }).then(function () {
toastr.success('Your new organization is ready to go!', 'Organization Created');
});
});
};
$scope.close = function() {
$scope.close = function () {
$uibModalInstance.dismiss('cancel');
};
});