Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #149 from AppliedIS/feature-adminview
Browse files Browse the repository at this point in the history
Feature adminview
  • Loading branch information
jefferey committed Nov 17, 2016
2 parents 6374a44 + d093539 commit b5bd926
Show file tree
Hide file tree
Showing 51 changed files with 818 additions and 167 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public ApplicationSummary Build(ApplicationSubmission submission)
NumWorkers = submission.WorkSites.Sum(x => x.Employees.Count),
NumWorkSites = submission.WorkSites.Count,
State = submission.Employer.PhysicalAddress.State,
StatusName = submission.Status.Name
StatusName = submission.Status.Name,
EmployerName = submission.Employer.LegalName
};

return obj;
Expand Down
2 changes: 2 additions & 0 deletions DOL.WHD.Section14c.DataAccess/Migrations/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ protected override void Seed(ApplicationDbContext context)
context.AddFeature(ApplicationClaimTypes.ModifyAccount, "Change Application Accounts");
context.AddFeature(ApplicationClaimTypes.SubmitApplication, "Submit Application");
context.AddFeature(ApplicationClaimTypes.GetRoles, "Get list of Application Roles");
context.AddFeature(ApplicationClaimTypes.ViewAdminUI, "Access to the admin UI");
context.AddFeature(ApplicationClaimTypes.ViewAllApplications, "View All Submitted Applications");
context.AddFeature(ApplicationClaimTypes.ChangeApplicationStatus, "Change the Status of a Submitted Application");

Expand All @@ -144,6 +145,7 @@ protected override void Seed(ApplicationDbContext context)
context.AddRoleFeature(Roles.SystemAdministrator, ApplicationClaimTypes.CreateAccount);
context.AddRoleFeature(Roles.SystemAdministrator, ApplicationClaimTypes.ModifyAccount);
context.AddRoleFeature(Roles.SystemAdministrator, ApplicationClaimTypes.GetRoles);
context.AddRoleFeature(Roles.SystemAdministrator, ApplicationClaimTypes.ViewAdminUI);
context.AddRoleFeature(Roles.SystemAdministrator, ApplicationClaimTypes.ViewAllApplications);
context.AddRoleFeature(Roles.SystemAdministrator, ApplicationClaimTypes.ChangeApplicationStatus);

Expand Down
1 change: 1 addition & 0 deletions DOL.WHD.Section14c.Domain/Models/ApplicationSummary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ public class ApplicationSummary
public int NumWorkSites { get; set; }
public int NumWorkers { get; set; }
public string ApplicationType { get; set; }
public string EmployerName { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public static class ApplicationClaimTypes
public const string GetRoles = ClaimPrefix + "UserManagement.GetRoles";

// Application Management
public const string ViewAdminUI = ClaimPrefix + "Application.ViewAdminUI";
public const string ViewAllApplications = ClaimPrefix + "Application.ViewAll";
public const string ChangeApplicationStatus = ClaimPrefix + "Application.ChangeStatus";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public void ApplicationSummaryFactory_Build()
var types = new List<string> {"Business", "Hospital"};
var numWorkSites = 3;
var numWorkersPerSite = 5;
var employerName = "Employer Name";
var submission = new ApplicationSubmission
{
Id = appId,
Expand All @@ -45,7 +46,8 @@ public void ApplicationSummaryFactory_Build()
.ToList(),
Employer = new EmployerInfo
{
PhysicalAddress = new Address {State = state}
PhysicalAddress = new Address {State = state},
LegalName = employerName
},
WorkSites =
Enumerable.Repeat(
Expand All @@ -70,6 +72,7 @@ public void ApplicationSummaryFactory_Build()
Assert.AreEqual(numWorkSites, summary.NumWorkSites);
Assert.AreEqual(numWorkSites * numWorkersPerSite, summary.NumWorkers);
Assert.AreEqual(applicationType, summary.ApplicationType);
Assert.AreEqual(employerName, summary.EmployerName);
}
}
}
42 changes: 31 additions & 11 deletions DOL.WHD.Section14c.Web/src/modules/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ app.config(function($routeProvider, $compileProvider) {
.when('/changePassword', {
controller: 'changePasswordPageController',
template: require('./pages/changePasswordPageTemplate.html'),
public: true
public: true,
admin: true
})
.when('/forgotPassword', {
controller: 'forgotPasswordPageController',
template: require('./pages/forgotPasswordPageTemplate.html'),
public: true
public: true,
admin: true
})
.when('/login', {
controller: 'userLoginPageController',
Expand All @@ -85,32 +87,50 @@ app.config(function($routeProvider, $compileProvider) {
template: function(params){ return '<form-section><section-' + params.section_id + '></section-' + params.section_id + '></form-section>'; },
reloadOnSearch: false
})
.when('/admin', {
controller: 'adminDashboardController',
template: require('./pages/adminDashboardTemplate.html'),
admin: true
})
.when('/admin/:app_id', {
redirectTo: function(params){ return '/admin/' + params.app_id + '/section/summary'; }
})
.when('/admin/:app_id/section/:section_id', {
template: function(params){ return '<admin-review appid=' + params.app_id + '><section-admin-' + params.section_id + '></section-admin-' + params.section_id + '></admin-review>'; },
reloadOnSearch: false,
admin: true
})
.otherwise({
redirectTo: '/'
});
});

app.run(function($rootScope, $location, stateService, autoSaveService) {
app.run(function($rootScope, $location, stateService, autoSaveService, authService) {
// check cookie to see if we're logged in
const accessToken = stateService.access_token;
if(accessToken) {
stateService.loadState().then(function(result) {
$rootScope.loggedIn = true;

// start auto-save
if(stateService.ein){
autoSaveService.start();
}
// authenticate the user based on token
authService.authenticateUser().then(undefined, function errorCallback(error) {
console.log(error);
});
}

//TODO: remove dev_flag check
if (!env.dev_flag === true) {
// watch for route changes and redirect non-public routes if not logged in
$rootScope.$on( "$routeChangeStart", function(event, next, current) {
if ( !$rootScope.loggedIn && next.$$route.public !== true ) {
if (!stateService.loggedIn && next.$$route.public !== true ) {
// not logged in
$location.path( "/" );
}
else if (next.$$route.admin === true && !stateService.isAdmin) {
// non-admin trying to access admin page
$location.path( "/" );
}
else if (stateService.isAdmin && next.$$route.admin !== true) {
// admin trying to access application form pages
$location.path( "/admin" );
}
});
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

module.exports = function(ngModule) {
ngModule.controller('adminReviewController', function($scope, stateService) {
'ngInject';
'use strict';

$scope.appData = stateService.appData;

if ($scope.appid && $scope.appid !== $scope.appData.id) {
stateService.loadApplicationData()
}
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict';

module.exports = function(ngModule) {
ngModule.directive('adminReview', function() {

'use strict';

return {
restrict: 'E',
template: require('./adminReviewTemplate.html'),
controller: 'adminReviewController',
scope: {
appid: '@'
},
transclude: true,
link: function(scope, element, attrs, ctrlr, transclude) {
transclude(scope, function(clone, scope){
angular.element(element[0].querySelector('.admin-content')).append(clone);
});
}
};
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<main-header-control admin="true"></main-header-control>
<div class="main-content admin-content">
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict';

module.exports = function(ngModule) {
require('./adminReviewController')(ngModule);
require('./adminReviewDirective')(ngModule);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';

module.exports = function(ngModule) {
ngModule.directive('answerField', function() {
'use strict'

return {
transclude: true,
template: require('./answerFieldTemplate.html'),
replace: true,
scope: {
answer: '=',
addressField: '=',
datefield: '='
}
}
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<div class="answer-block">
<div class="answer-question">
<ng-transclude></ng-transclude>
</div>
<div class="answer-answer" ng-show="answer !== undefined">
<div ng-show="!addressField && !datefield">
{{ answer === true ? 'Yes' : answer === false ? 'No' : answer }}
</div>
<div ng-show="addressField">
{{ answer.streetAddress }} <br>
{{ answer.city + ', ' + answer.state + ' ' + answer.zipCode }} <br>
<p ng-show="answer.county"><em>County:</em> {{ answer.county }}</p>
</div>
<div ng-show="datefield">
{{ answer.month }} / {{ answer.day }} / {{ answer.year }}
</div>
</div>
<div class="answer-answer" ng-show="answer === undefined">
NOT PROVIDED
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = function(ngModule) {
require('./answerFieldDirective')(ngModule);
};
5 changes: 5 additions & 0 deletions DOL.WHD.Section14c.Web/src/modules/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

module.exports = function(ngModule) {
require('./accountManagementControls')(ngModule);
require('./adminReview')(ngModule);
require('./answerField')(ngModule);
require('./attachmentField')(ngModule);
require('./changePasswordForm')(ngModule);
require('./dateField')(ngModule);
Expand All @@ -10,6 +12,9 @@ module.exports = function(ngModule) {
require('./mainHeaderControl')(ngModule);
require('./mainNavigationControl')(ngModule);
require('./resetPasswordForm')(ngModule);
require('./sectionAdminAppInfo')(ngModule);
require('./sectionAdminEmployer')(ngModule);
require('./sectionAdminWioa')(ngModule);
require('./sectionAppInfo')(ngModule);
require('./sectionAssurances')(ngModule);
require('./sectionEmployer')(ngModule);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ module.exports = function(ngModule) {
'ngInject';
'use strict';

$scope.appData = stateService.appData;

var vm = this;
vm.stateService = stateService;
vm.assetService = assetService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ module.exports = function(ngModule) {
restrict: 'EA',
template: require('./mainHeaderControlTemplate.html'),
controller: 'mainHeaderControlController',
scope: {},
scope: {
admin: '='
},
controllerAs: 'vm'
};
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ <h1>Section 14(c) Certificate Application</h1>
</nav>
</header>
<div class="dol-applicant-meta">
<div class="dol-applicant-ein">
<div class="dol-applicant-ein" ng-show="!admin">
Applicant EIN: <span>{{ vm.stateService.ein ? vm.stateService.ein : "XX-XXXXXXX" }}</span>
</div>
<div class="dol-applicant-ein" ng-show="admin">
{{ appData.employer.legalName }}
</div>

<div class="dol-feedback-save">
<span class="dol-feedback-save-success" ng-show="vm.stateService.formData.lastSaved > 0">
Expand All @@ -25,12 +28,17 @@ <h1>Section 14(c) Certificate Application</h1>
</div>
<div class="dol-form-meta">
<div class="usa-content">
<p>Application for Authority to Employ Workers with Disabilities at Subminimum Wages</p>
<p ng-show="!admin">Application for Authority to Employ Workers with Disabilities at Subminimum Wages</p>
<p ng-show="admin">Applicant EIN: <span>{{ vm.stateService.ein ? vm.stateService.ein : "XX-XXXXXXX" }}</span></p>
</div>

<div class="dol-form-omb">
<div class="dol-form-omb" ng-show="!admin">
<p>OMB NO: 1235-0001</p>
<p>REV XX/20XX</p>
</div>

<div class="dol-form-status" ng-show="admin">
Status: {{ appData.applicationStatus ? appData.applicationStatus : 'Unknown' }}
</div>
</div>
<main-navigation-control></main-navigation-control>
<main-navigation-control admin="admin"></main-navigation-control>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ module.exports = function(ngModule) {
'ngInject';
'use strict';

$scope.sections = navService.getSections();

var vm = this;
vm.stateService = stateService;
vm.current = $route.current.params.section_id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ module.exports = function(ngModule) {
restrict: 'EA',
template: require('./mainNavigationControlTemplate.html'),
controller: 'mainNavigationControlController',
scope: {},
scope: {
admin: '='
},
controllerAs: 'vm'
};
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<nav role="navigation" class="main-nav-bar">
<ul>
<li class="nav-button {{ vm.current === 'assurances' ? 'active' : '' }}" data-sectionid="assurances" ng-click="vm.onNavClick($event)">Assurances</li>
<li class="nav-button {{ vm.current === 'app-info' ? 'active' : '' }}" data-sectionid="app-info" ng-click="vm.onNavClick($event)">Application Info</li>
<li class="nav-button {{ vm.current === 'employer' ? 'active' : '' }}" data-sectionid="employer" ng-click="vm.onNavClick($event)">Employer</li>
<li class="nav-button {{ vm.current === 'wage-data' ? 'active' : '' }}" data-sectionid="wage-data" ng-click="vm.onNavClick($event)">Wage Data</li>
<li class="nav-button {{ vm.current === 'work-sites' ? 'active' : '' }}" data-sectionid="work-sites" ng-click="vm.onNavClick($event)">Work Sites &amp; Employees</li>
<li class="nav-button {{ vm.current === 'wioa' ? 'active' : '' }}" data-sectionid="wioa" ng-click="vm.onNavClick($event)">WIOA</li>
<li class="nav-button {{ vm.current === 'review' ? 'active' : '' }}" data-sectionid="review" ng-click="vm.onNavClick($event)" ng-show="vm.stateService.inReview">Review &amp; Submit</li>
<li ng-repeat="section in sections" class="nav-button {{ vm.current === section.id ? 'active' : '' }}" data-sectionid="{{ section.id }}" ng-click="vm.onNavClick($event)" ng-show="section.id !== 'review' || vm.stateService.inReview">{{ section.display }}</li>
</ul>
</nav>
</nav>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = function(ngModule) {
require('./sectionAdminAppInfoDirective')(ngModule);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict';

module.exports = function(ngModule) {
ngModule.directive('sectionAdminAppInfo', function() {

'use strict';

return {
restrict: 'EA',
template: require('./sectionAdminAppInfoTemplate.html')
};
});
}
Loading

0 comments on commit b5bd926

Please sign in to comment.