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.
Merge pull request #164 from AppliedIS/feature-changestatus
Feature changestatus
- Loading branch information
Showing
16 changed files
with
181 additions
and
4 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System.Collections.Generic; | ||
using System.Web.Http; | ||
using DOL.WHD.Section14c.Business; | ||
using DOL.WHD.Section14c.Domain.Models.Submission; | ||
|
||
namespace DOL.WHD.Section14c.Api.Controllers | ||
{ | ||
/// <summary> | ||
/// Controller for managing application statuses | ||
/// </summary> | ||
[RoutePrefix("/api/status")] | ||
public class StatusController : ApiController | ||
{ | ||
private readonly IStatusService _statusService; | ||
|
||
/// <summary> | ||
/// Constructor to handle passed status service | ||
/// </summary> | ||
/// <param name="statusService"></param> | ||
public StatusController(IStatusService statusService) | ||
{ | ||
_statusService = statusService; | ||
} | ||
|
||
/// <summary> | ||
/// Gets a list of statuses | ||
/// </summary> | ||
/// <returns></returns> | ||
[HttpGet] | ||
public IEnumerable<Status> GetStatuses() | ||
{ | ||
return _statusService.GetAllStatuses(); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using DOL.WHD.Section14c.Domain.Models.Submission; | ||
|
||
namespace DOL.WHD.Section14c.Business | ||
{ | ||
public interface IStatusService : IDisposable | ||
{ | ||
IEnumerable<Status> GetAllStatuses(); | ||
Status GetStatus(int id); | ||
} | ||
} |
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
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; | ||
}; | ||
}) | ||
} | ||
|