Skip to content

Commit c722304

Browse files
authored
Merge pull request #168 from anonymousjaggu/changes-165
changes for #165
2 parents c7e44e7 + bf6733a commit c722304

File tree

5 files changed

+38
-79
lines changed

5 files changed

+38
-79
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ The following configuration parameters are available:
4141
| GROUP_V5_API_URL | URL of the v5 Groups API |
4242
| LOOKUP_V5_API_URL | URL of the v5 Devices API |
4343
| TERMS_V5_API_URL | URL of the v5 Terms API |
44-
| AGREEABILITY_TYPES | List of Agreeable types and its UUID from Database |
4544
| AGREE_FOR_DOCUSIGN_TEMPLATE | UUID from Database of the `"DocuSign Template"` Agreeable type |
4645
| AGREE_ELECTRONICALLY | UUID from Database of the `Electronically` Agreeable Type |
4746
| DEFAULT_TERMS_TYPE_ID | The default terms type id |

config.json

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,6 @@
1515
"GROUP_V5_API_URL": "http://localhost:3000/v5",
1616
"LOOKUP_V5_API_URL": "http://localhost:3000/v5",
1717
"TERMS_V5_API_URL": "http://localhost:3000/v5",
18-
"AGREEABILITY_TYPES": [
19-
{
20-
"id": "f3cb81fa-d1ed-4231-b6c6-770f4f1ce8a4",
21-
"name": "Non-agreeable"
22-
},
23-
{
24-
"id": "208779bf-72ce-4e97-a398-13fa62c0414a",
25-
"name": "Non-electronically-agreeable"
26-
},
27-
{
28-
"id": "5b2798b2-ae82-4210-9b4d-5d6428125ccb",
29-
"name": "Electronically-agreeable"
30-
},
31-
{
32-
"id": "999a26ad-b334-453c-8425-165d4cf496d7",
33-
"name": "Docusign-template"
34-
}
35-
],
3618
"AGREE_FOR_DOCUSIGN_TEMPLATE": "999a26ad-b334-453c-8425-165d4cf496d7",
3719
"AGREE_ELECTRONICALLY": "5b2798b2-ae82-4210-9b4d-5d6428125ccb",
3820
"DEFAULT_TERMS_TYPE_ID": 5
@@ -53,24 +35,6 @@
5335
"GROUP_V5_API_URL": "https://api.topcoder-dev.com/v5",
5436
"LOOKUP_V5_API_URL": "https://api.topcoder-dev.com/v5",
5537
"TERMS_V5_API_URL": "https://api.topcoder-dev.com/v5",
56-
"AGREEABILITY_TYPES": [
57-
{
58-
"id": "f3cb81fa-d1ed-4231-b6c6-770f4f1ce8a4",
59-
"name": "Non-agreeable"
60-
},
61-
{
62-
"id": "208779bf-72ce-4e97-a398-13fa62c0414a",
63-
"name": "Non-electronically-agreeable"
64-
},
65-
{
66-
"id": "5b2798b2-ae82-4210-9b4d-5d6428125ccb",
67-
"name": "Electronically-agreeable"
68-
},
69-
{
70-
"id": "999a26ad-b334-453c-8425-165d4cf496d7",
71-
"name": "Docusign-template"
72-
}
73-
],
7438
"AGREE_FOR_DOCUSIGN_TEMPLATE": "999a26ad-b334-453c-8425-165d4cf496d7",
7539
"AGREE_ELECTRONICALLY": "5b2798b2-ae82-4210-9b4d-5d6428125ccb",
7640
"DEFAULT_TERMS_TYPE_ID": 5
@@ -91,24 +55,6 @@
9155
"GROUP_V5_API_URL": "http://localhost:9000",
9256
"LOOKUP_V5_API_URL": "http://localhost:3000/v5",
9357
"TERMS_V5_API_URL": "http://localhost:3000/v5",
94-
"AGREEABILITY_TYPES": [
95-
{
96-
"id": "f3cb81fa-d1ed-4231-b6c6-770f4f1ce8a4",
97-
"name": "Non-agreeable"
98-
},
99-
{
100-
"id": "208779bf-72ce-4e97-a398-13fa62c0414a",
101-
"name": "Non-electronically-agreeable"
102-
},
103-
{
104-
"id": "5b2798b2-ae82-4210-9b4d-5d6428125ccb",
105-
"name": "Electronically-agreeable"
106-
},
107-
{
108-
"id": "999a26ad-b334-453c-8425-165d4cf496d7",
109-
"name": "Docusign-template"
110-
}
111-
],
11258
"AGREE_FOR_DOCUSIGN_TEMPLATE": "999a26ad-b334-453c-8425-165d4cf496d7",
11359
"AGREE_ELECTRONICALLY": "5b2798b2-ae82-4210-9b4d-5d6428125ccb",
11460
"DEFAULT_TERMS_TYPE_ID": 5
@@ -129,24 +75,6 @@
12975
"GROUP_V5_API_URL": "https://api.topcoder.com/v5",
13076
"LOOKUP_V5_API_URL": "https://api.topcoder.com/v5",
13177
"TERMS_V5_API_URL": "https://api.topcoder.com/v5",
132-
"AGREEABILITY_TYPES": [
133-
{
134-
"id": "f3cb81fa-d1ed-4231-b6c6-770f4f1ce8a4",
135-
"name": "Non-agreeable"
136-
},
137-
{
138-
"id": "208779bf-72ce-4e97-a398-13fa62c0414a",
139-
"name": "Non-electronically-agreeable"
140-
},
141-
{
142-
"id": "5b2798b2-ae82-4210-9b4d-5d6428125ccb",
143-
"name": "Electronically-agreeable"
144-
},
145-
{
146-
"id": "999a26ad-b334-453c-8425-165d4cf496d7",
147-
"name": "Docusign-template"
148-
}
149-
],
15078
"AGREE_FOR_DOCUSIGN_TEMPLATE": "999a26ad-b334-453c-8425-165d4cf496d7",
15179
"AGREE_ELECTRONICALLY": "5b2798b2-ae82-4210-9b4d-5d6428125ccb",
15280
"DEFAULT_TERMS_TYPE_ID": 5

src/app/terms/terms.edit.controller.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,25 @@ var module = angular.module('supportAdminApp');
55
/**
66
* Controller for edit terms of use view
77
*/
8-
module.controller('terms.EditTermsController', ['$scope', '$rootScope', 'AGREEABILITY_TYPES', 'AGREE_FOR_DOCUSIGN_TEMPLATE', '$log',
8+
module.controller('terms.EditTermsController', ['$scope', '$rootScope', 'AGREE_FOR_DOCUSIGN_TEMPLATE', '$log',
99
'TermsService', 'Alert', '$state', '$stateParams', 'AGREE_ELECTRONICALLY',
10-
function ($scope, $rootScope, agreeabilityTypeList, docusignTypeId, $log, TermsService, $alert, $state, $stateParams, electronicallyAgreeableId) {
10+
function ($scope, $rootScope, docusignTypeId, $log, TermsService, $alert, $state, $stateParams, electronicallyAgreeableId) {
1111
// init variables
1212
$scope.processing = false;
1313
$scope.editTerms = { };
14-
$scope.agreeabilityTypes = agreeabilityTypeList;
14+
$scope.agreeabilityTypes = [];
1515
$scope.isDocuSignFieldEnabled = false;
1616
$scope.isUrlEnabled = false;
1717
$scope.termTypes = [];
1818
$scope.signedUsers = { total: 0, deleteDisabled: true };
1919

20+
// gets the agreeability types
21+
TermsService.getAgreeabilityTypes().then(function (data) {
22+
$scope.agreeabilityTypes = data;
23+
}).catch(function (error) {
24+
$alert.error(error.error, $rootScope);
25+
});
26+
2027
/**
2128
* handles the agreebility type change.
2229
* @param {string} agreeabilityTypeId the agreebility type id.

src/app/terms/terms.new.controller.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,26 @@
33
var module = angular.module('supportAdminApp');
44

55
module.controller('terms.NewTermsController', ['$rootScope', '$scope', 'TermsService', 'Alert',
6-
'AGREEABILITY_TYPES', 'AGREE_FOR_DOCUSIGN_TEMPLATE', 'AGREE_ELECTRONICALLY', '$state', 'DEFAULT_TERMS_TYPE_ID',
7-
function ($rootScope, $scope, TermsService, $alert, agreeabilityTypeList, docusignTypeId, electronicallyAgreeableId, $state, defaultTermTypeId) {
6+
'AGREE_FOR_DOCUSIGN_TEMPLATE', 'AGREE_ELECTRONICALLY', '$state', 'DEFAULT_TERMS_TYPE_ID',
7+
function ($rootScope, $scope, TermsService, $alert, docusignTypeId, electronicallyAgreeableId, $state, defaultTermTypeId) {
88
// init variables
99
$scope.newTerms = {};
1010
$scope.processing = false;
11-
$scope.agreeabilityTypes = agreeabilityTypeList;
11+
$scope.agreeabilityTypes = [];
1212
$scope.isDocuSignFieldEnabled = false;
1313
$scope.isUrlEnabled = false;
1414
$scope.termTypes = [];
1515

1616
// clear the alert
1717
$alert.clear();
1818

19+
// gets the agreeability types
20+
TermsService.getAgreeabilityTypes().then(function (data) {
21+
$scope.agreeabilityTypes = data;
22+
}).catch(function (error) {
23+
$alert.error(error.error, $rootScope);
24+
});
25+
1926
// get term types
2027
TermsService.getTypes().then(function (response) {
2128
$scope.termTypes = response;

src/app/terms/terms.service.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,5 +279,23 @@ angular.module('supportAdminApp')
279279
return deferred.promise;
280280
};
281281

282+
/**
283+
* gets all agreeability types.
284+
* @returns {Promise} the agreeability types.
285+
*/
286+
TermsService.getAgreeabilityTypes = function () {
287+
var deferred = $q.defer();
288+
var request = $http({
289+
method: 'GET',
290+
url: TermsService.getBasePath() + '/terms/agreeability-types'
291+
});
292+
request.then(function (response) {
293+
deferred.resolve(response.data);
294+
}).catch(function (error) {
295+
TermsService.handleError(error, deferred);
296+
})
297+
return deferred.promise;
298+
};
299+
282300
return TermsService;
283301
}]);

0 commit comments

Comments
 (0)