2017-03-10 04:08:47 +01:00
|
|
|
|
angular
|
|
|
|
|
.module('bit.organization')
|
|
|
|
|
|
2017-04-27 15:33:12 +02:00
|
|
|
|
.controller('organizationCollectionsAddController', function ($scope, $state, $uibModalInstance, apiService, cipherService,
|
2017-03-10 04:08:47 +01:00
|
|
|
|
$analytics) {
|
2017-04-27 15:33:12 +02:00
|
|
|
|
$analytics.eventTrack('organizationCollectionsAddController', { category: 'Modal' });
|
2017-04-26 16:32:14 +02:00
|
|
|
|
|
2017-03-10 04:08:47 +01:00
|
|
|
|
$scope.submit = function (model) {
|
2017-04-27 15:33:12 +02:00
|
|
|
|
var collection = cipherService.encryptCollection(model, $state.params.orgId);
|
|
|
|
|
$scope.submitPromise = apiService.collections.post({ orgId: $state.params.orgId }, collection, function (response) {
|
|
|
|
|
$analytics.eventTrack('Created Collection');
|
|
|
|
|
var decCollection = cipherService.decryptCollection(response, $state.params.orgId, true);
|
|
|
|
|
$uibModalInstance.close(decCollection);
|
2017-03-10 04:08:47 +01:00
|
|
|
|
}).$promise;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.close = function () {
|
|
|
|
|
$uibModalInstance.dismiss('cancel');
|
|
|
|
|
};
|
|
|
|
|
});
|