diff --git a/README.md b/README.md index 7c49fbc..e58d65d 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,6 @@ The following configuration parameters are available: | GROUP_V5_API_URL | URL of the v5 Groups API | | LOOKUP_V5_API_URL | URL of the v5 Devices API | | TERMS_V5_API_URL | URL of the v5 Terms API | -| AGREEABILITY_TYPES | List of Agreeable types and its UUID from Database | | AGREE_FOR_DOCUSIGN_TEMPLATE | UUID from Database of the `"DocuSign Template"` Agreeable type | | AGREE_ELECTRONICALLY | UUID from Database of the `Electronically` Agreeable Type | | DEFAULT_TERMS_TYPE_ID | The default terms type id | diff --git a/config.json b/config.json index 8d908f3..10de42d 100644 --- a/config.json +++ b/config.json @@ -15,24 +15,6 @@ "GROUP_V5_API_URL": "http://localhost:3000/v5", "LOOKUP_V5_API_URL": "http://localhost:3000/v5", "TERMS_V5_API_URL": "http://localhost:3000/v5", - "AGREEABILITY_TYPES": [ - { - "id": "f3cb81fa-d1ed-4231-b6c6-770f4f1ce8a4", - "name": "Non-agreeable" - }, - { - "id": "208779bf-72ce-4e97-a398-13fa62c0414a", - "name": "Non-electronically-agreeable" - }, - { - "id": "5b2798b2-ae82-4210-9b4d-5d6428125ccb", - "name": "Electronically-agreeable" - }, - { - "id": "999a26ad-b334-453c-8425-165d4cf496d7", - "name": "Docusign-template" - } - ], "AGREE_FOR_DOCUSIGN_TEMPLATE": "999a26ad-b334-453c-8425-165d4cf496d7", "AGREE_ELECTRONICALLY": "5b2798b2-ae82-4210-9b4d-5d6428125ccb", "DEFAULT_TERMS_TYPE_ID": 5 @@ -53,24 +35,6 @@ "GROUP_V5_API_URL": "https://api.topcoder-dev.com/v5", "LOOKUP_V5_API_URL": "https://api.topcoder-dev.com/v5", "TERMS_V5_API_URL": "https://api.topcoder-dev.com/v5", - "AGREEABILITY_TYPES": [ - { - "id": "f3cb81fa-d1ed-4231-b6c6-770f4f1ce8a4", - "name": "Non-agreeable" - }, - { - "id": "208779bf-72ce-4e97-a398-13fa62c0414a", - "name": "Non-electronically-agreeable" - }, - { - "id": "5b2798b2-ae82-4210-9b4d-5d6428125ccb", - "name": "Electronically-agreeable" - }, - { - "id": "999a26ad-b334-453c-8425-165d4cf496d7", - "name": "Docusign-template" - } - ], "AGREE_FOR_DOCUSIGN_TEMPLATE": "999a26ad-b334-453c-8425-165d4cf496d7", "AGREE_ELECTRONICALLY": "5b2798b2-ae82-4210-9b4d-5d6428125ccb", "DEFAULT_TERMS_TYPE_ID": 5 @@ -91,24 +55,6 @@ "GROUP_V5_API_URL": "http://localhost:9000", "LOOKUP_V5_API_URL": "http://localhost:3000/v5", "TERMS_V5_API_URL": "http://localhost:3000/v5", - "AGREEABILITY_TYPES": [ - { - "id": "f3cb81fa-d1ed-4231-b6c6-770f4f1ce8a4", - "name": "Non-agreeable" - }, - { - "id": "208779bf-72ce-4e97-a398-13fa62c0414a", - "name": "Non-electronically-agreeable" - }, - { - "id": "5b2798b2-ae82-4210-9b4d-5d6428125ccb", - "name": "Electronically-agreeable" - }, - { - "id": "999a26ad-b334-453c-8425-165d4cf496d7", - "name": "Docusign-template" - } - ], "AGREE_FOR_DOCUSIGN_TEMPLATE": "999a26ad-b334-453c-8425-165d4cf496d7", "AGREE_ELECTRONICALLY": "5b2798b2-ae82-4210-9b4d-5d6428125ccb", "DEFAULT_TERMS_TYPE_ID": 5 @@ -129,24 +75,6 @@ "GROUP_V5_API_URL": "https://api.topcoder.com/v5", "LOOKUP_V5_API_URL": "https://api.topcoder.com/v5", "TERMS_V5_API_URL": "https://api.topcoder.com/v5", - "AGREEABILITY_TYPES": [ - { - "id": "f3cb81fa-d1ed-4231-b6c6-770f4f1ce8a4", - "name": "Non-agreeable" - }, - { - "id": "208779bf-72ce-4e97-a398-13fa62c0414a", - "name": "Non-electronically-agreeable" - }, - { - "id": "5b2798b2-ae82-4210-9b4d-5d6428125ccb", - "name": "Electronically-agreeable" - }, - { - "id": "999a26ad-b334-453c-8425-165d4cf496d7", - "name": "Docusign-template" - } - ], "AGREE_FOR_DOCUSIGN_TEMPLATE": "999a26ad-b334-453c-8425-165d4cf496d7", "AGREE_ELECTRONICALLY": "5b2798b2-ae82-4210-9b4d-5d6428125ccb", "DEFAULT_TERMS_TYPE_ID": 5 diff --git a/src/app/terms/terms.edit.controller.js b/src/app/terms/terms.edit.controller.js index 816329b..b576421 100644 --- a/src/app/terms/terms.edit.controller.js +++ b/src/app/terms/terms.edit.controller.js @@ -5,18 +5,25 @@ var module = angular.module('supportAdminApp'); /** * Controller for edit terms of use view */ -module.controller('terms.EditTermsController', ['$scope', '$rootScope', 'AGREEABILITY_TYPES', 'AGREE_FOR_DOCUSIGN_TEMPLATE', '$log', +module.controller('terms.EditTermsController', ['$scope', '$rootScope', 'AGREE_FOR_DOCUSIGN_TEMPLATE', '$log', 'TermsService', 'Alert', '$state', '$stateParams', 'AGREE_ELECTRONICALLY', - function ($scope, $rootScope, agreeabilityTypeList, docusignTypeId, $log, TermsService, $alert, $state, $stateParams, electronicallyAgreeableId) { + function ($scope, $rootScope, docusignTypeId, $log, TermsService, $alert, $state, $stateParams, electronicallyAgreeableId) { // init variables $scope.processing = false; $scope.editTerms = { }; - $scope.agreeabilityTypes = agreeabilityTypeList; + $scope.agreeabilityTypes = []; $scope.isDocuSignFieldEnabled = false; $scope.isUrlEnabled = false; $scope.termTypes = []; $scope.signedUsers = { total: 0, deleteDisabled: true }; + // gets the agreeability types + TermsService.getAgreeabilityTypes().then(function (data) { + $scope.agreeabilityTypes = data; + }).catch(function (error) { + $alert.error(error.error, $rootScope); + }); + /** * handles the agreebility type change. * @param {string} agreeabilityTypeId the agreebility type id. diff --git a/src/app/terms/terms.new.controller.js b/src/app/terms/terms.new.controller.js index f5eb139..b6e4697 100644 --- a/src/app/terms/terms.new.controller.js +++ b/src/app/terms/terms.new.controller.js @@ -3,12 +3,12 @@ var module = angular.module('supportAdminApp'); module.controller('terms.NewTermsController', ['$rootScope', '$scope', 'TermsService', 'Alert', - 'AGREEABILITY_TYPES', 'AGREE_FOR_DOCUSIGN_TEMPLATE', 'AGREE_ELECTRONICALLY', '$state', 'DEFAULT_TERMS_TYPE_ID', - function ($rootScope, $scope, TermsService, $alert, agreeabilityTypeList, docusignTypeId, electronicallyAgreeableId, $state, defaultTermTypeId) { + 'AGREE_FOR_DOCUSIGN_TEMPLATE', 'AGREE_ELECTRONICALLY', '$state', 'DEFAULT_TERMS_TYPE_ID', + function ($rootScope, $scope, TermsService, $alert, docusignTypeId, electronicallyAgreeableId, $state, defaultTermTypeId) { // init variables $scope.newTerms = {}; $scope.processing = false; - $scope.agreeabilityTypes = agreeabilityTypeList; + $scope.agreeabilityTypes = []; $scope.isDocuSignFieldEnabled = false; $scope.isUrlEnabled = false; $scope.termTypes = []; @@ -16,6 +16,13 @@ module.controller('terms.NewTermsController', ['$rootScope', '$scope', 'TermsSer // clear the alert $alert.clear(); + // gets the agreeability types + TermsService.getAgreeabilityTypes().then(function (data) { + $scope.agreeabilityTypes = data; + }).catch(function (error) { + $alert.error(error.error, $rootScope); + }); + // get term types TermsService.getTypes().then(function (response) { $scope.termTypes = response; diff --git a/src/app/terms/terms.service.js b/src/app/terms/terms.service.js index a737951..b034fe5 100644 --- a/src/app/terms/terms.service.js +++ b/src/app/terms/terms.service.js @@ -279,5 +279,23 @@ angular.module('supportAdminApp') return deferred.promise; }; + /** + * gets all agreeability types. + * @returns {Promise} the agreeability types. + */ + TermsService.getAgreeabilityTypes = function () { + var deferred = $q.defer(); + var request = $http({ + method: 'GET', + url: TermsService.getBasePath() + '/terms/agreeability-types' + }); + request.then(function (response) { + deferred.resolve(response.data); + }).catch(function (error) { + TermsService.handleError(error, deferred); + }) + return deferred.promise; + }; + return TermsService; }]);