diff --git a/src/app/settings/settingsController.js b/src/app/settings/settingsController.js index 97ba72e59b..df30021dcc 100644 --- a/src/app/settings/settingsController.js +++ b/src/app/settings/settingsController.js @@ -18,6 +18,18 @@ email: user.Email, twoFactorEnabled: user.TwoFactorEnabled }; + + if (user.Organizations) { + var orgs = []; + for (var i = 0; i < user.Organizations.length; i++) { + orgs.push({ + id: user.Organizations[i].Id, + name: user.Organizations[i].Name + }); + } + + $scope.model.organizations = orgs; + } }); $scope.generalSave = function () { @@ -50,6 +62,14 @@ }); }; + $scope.createOrganization = function () { + $uibModal.open({ + animation: true, + templateUrl: 'app/settings/views/settingsCreateOrganization.html', + controller: 'settingsCreateOrganizationController' + }); + }; + $scope.twoFactor = function () { var twoFactorModal = $uibModal.open({ animation: true, diff --git a/src/app/settings/settingsCreateOrganizationController.js b/src/app/settings/settingsCreateOrganizationController.js new file mode 100644 index 0000000000..a355f99b6a --- /dev/null +++ b/src/app/settings/settingsCreateOrganizationController.js @@ -0,0 +1,21 @@ +angular + .module('bit.settings') + + .controller('settingsCreateOrganizationController', function ($scope, apiService, $uibModalInstance, cryptoService, + authService, toastr, $analytics) { + $analytics.eventTrack('settingsCreateOrganizationController', { category: 'Modal' }); + $scope.submit = function (model) { + var request = { + masterPasswordHash: cryptoService.hashPassword(model.masterPassword) + }; + + $scope.submitPromise = apiService.organizations.post(request, function () { + $uibModalInstance.dismiss('cancel'); + $analytics.eventTrack('Created Organization'); + }).$promise; + }; + + $scope.close = function () { + $uibModalInstance.dismiss('cancel'); + }; + }); diff --git a/src/app/settings/views/settings.html b/src/app/settings/views/settings.html index 18deb51e9d..9a18299294 100644 --- a/src/app/settings/views/settings.html +++ b/src/app/settings/views/settings.html @@ -113,26 +113,32 @@

Organizations

-
-
+
+
+ No organizations yet for your account. +
+
- - + - - +
NamePlan
sdfsdfdfd{{org.Name}}
+
diff --git a/src/app/settings/views/settingsCreateOrganization.html b/src/app/settings/views/settingsCreateOrganization.html new file mode 100644 index 0000000000..8ca99b7c49 --- /dev/null +++ b/src/app/settings/views/settingsCreateOrganization.html @@ -0,0 +1,26 @@ + +
+ + +
diff --git a/src/index.html b/src/index.html index e1ce02d057..ae459763c2 100644 --- a/src/index.html +++ b/src/index.html @@ -132,6 +132,7 @@ +