This repository has been archived by the owner on Jan 17, 2024. It is now read-only.
forked from 18F/dol-whd-14c
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
admin summary section to change application status
- Loading branch information
Kyle Linden
committed
Nov 22, 2016
1 parent
e77dace
commit 49d824c
Showing
10 changed files
with
116 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
DOL.WHD.Section14c.Web/src/modules/components/sectionAdminSummary/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'use strict'; | ||
|
||
module.exports = function(ngModule) { | ||
require('./sectionAdminSummaryController')(ngModule); | ||
require('./sectionAdminSummaryDirective')(ngModule); | ||
}; |
18 changes: 18 additions & 0 deletions
18
...ection14c.Web/src/modules/components/sectionAdminSummary/sectionAdminSummaryController.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict'; | ||
|
||
module.exports = function(ngModule) { | ||
ngModule.controller('sectionAdminSummaryController', function($scope, stateService, statusesService, apiService) { | ||
'ngInject'; | ||
'use strict'; | ||
|
||
var vm = this; | ||
|
||
statusesService.getStatuses().then((data) => { | ||
vm.statuses = data; | ||
}); | ||
|
||
vm.updateStatus = () => { | ||
apiService.changeApplicationStatus(stateService.access_token, $scope.appid, $scope.appData.statusId); | ||
}; | ||
}); | ||
}; |
15 changes: 15 additions & 0 deletions
15
...Section14c.Web/src/modules/components/sectionAdminSummary/sectionAdminSummaryDirective.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
|
||
module.exports = function(ngModule) { | ||
ngModule.directive('sectionAdminSummary', function() { | ||
|
||
'use strict'; | ||
|
||
return { | ||
restrict: 'EA', | ||
template: require('./sectionAdminSummaryTemplate.html'), | ||
controller: 'sectionAdminSummaryController', | ||
controllerAs: 'vm' | ||
}; | ||
}); | ||
} |
14 changes: 14 additions & 0 deletions
14
...ection14c.Web/src/modules/components/sectionAdminSummary/sectionAdminSummaryTemplate.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<div class="admin-page"> | ||
|
||
<h1>Summary</h1> | ||
<hr> | ||
|
||
<div class="answer-block"> | ||
<div class="answer-question">Application Status</div> | ||
<div class="answer-answer"> | ||
<select ng-model="appData.statusId" ng-options="status.id as status.name for status in vm.statuses"></select> | ||
</div> | ||
</div> | ||
|
||
<button class="green-button nomargin" ng-click="vm.updateStatus()">Update Status</button> | ||
</div> |
1 change: 1 addition & 0 deletions
1
...tion14c.Web/src/modules/components/sectionAdminWorkSites/adminWorkSiteDetailTemplate.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...on14c.Web/src/modules/components/sectionAdminWorkSites/sectionAdminWorkSitesTemplate.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
DOL.WHD.Section14c.Web/src/modules/services/statusesService.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'use strict'; | ||
|
||
import * as _ from 'lodash' | ||
|
||
module.exports = function(ngModule) { | ||
ngModule.service('statusesService', function($http, _env, $q) { | ||
'ngInject'; | ||
'useStrict'; | ||
|
||
var statuses; | ||
var url = `${_env.api_url}/api/status`; | ||
|
||
this.getStatuses = function() { | ||
|
||
let d = $q.defer(); | ||
|
||
if(statuses) | ||
{ | ||
// load cached data | ||
d.resolve(statuses); | ||
} | ||
else | ||
{ | ||
// get data from server | ||
$http({ | ||
method: 'GET', | ||
url: url | ||
}).then(function successCallback (data) { | ||
// cache data | ||
statuses = data.data; | ||
d.resolve(data.data); | ||
}, function errorCallback (error) { | ||
d.reject(error); | ||
}); | ||
} | ||
|
||
return d.promise; | ||
}; | ||
}) | ||
} | ||
|