Skip to content

Commit

Permalink
Merge pull request #6435 from NMDSdevopsServiceAdm/feature-branch/fun…
Browse files Browse the repository at this point in the history
…ding-redesign

Feature branch/funding redesign
  • Loading branch information
duncanc19 authored Dec 11, 2024
2 parents 5191be9 + a50a554 commit efad3af
Show file tree
Hide file tree
Showing 105 changed files with 6,046 additions and 4,367 deletions.
2 changes: 1 addition & 1 deletion backend/server/routes/reports/wdf/parent.js
Original file line number Diff line number Diff line change
Expand Up @@ -1496,7 +1496,7 @@ const reportGet = async (req, res) => {
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'Content-disposition': `attachment; filename=${moment(date).format(
'YYYY-MM-DD',
)}-SFC-Parent-Wdf-Report.xlsx`,
)}-SFC-Parent-Funding-Report.xlsx`,
});
console.log('report/wdf/parent - 200 response');
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</r>
</si>
<si>
<t>Parent workforce development fund ASC-WDS requirements report</t>
<t>ASC-WDS funding report</t>
</si>
<si>
<t>Overview</t>
Expand All @@ -78,7 +78,7 @@
<t>Subsidiary sharing permissions</t>
</si>
<si>
<t>Current WDF eligibility status</t>
<t>Current eligibility status</t>
</si>
<si>
<t>Date achieved eligibility</t>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac">
<dimension ref="A1:M16" />
<dimension ref="A1:M14" />
<sheetViews>
<sheetView showGridLines="0" topLeftCell="A1" tabSelected="1" workbookViewId="0">
<pane ySplit="3" topLeftCell="A4" activePane="bottomLeft" state="frozenSplit" />
Expand Down Expand Up @@ -170,43 +170,8 @@
<v>0</v>
</c>
</row>
<row r="12" spans="2:12" ht="409.6" hidden="1" customHeight="1" x14ac:dyDescent="0.25" />
<row r="13" spans="2:12" ht="8.65" customHeight="1" x14ac:dyDescent="0.25" />
<row r="14" spans="2:12" ht="22.9" customHeight="1" x14ac:dyDescent="0.25">
<c r="B14" s="43" t="s">
<v>29</v>
</c>
<c r="C14" s="44" />
<c r="D14" s="44" />
<c r="E14" s="44" />
<c r="F14" s="44" />
<c r="G14" s="44" />
<c r="H14" s="44" />
<c r="I14" s="44" />
<c r="J14" s="44" />
<c r="K14" s="44" />
<c r="L14" s="45" />
</row>
<row r="15" spans="2:12" ht="71.650000000000006" customHeight="1" x14ac:dyDescent="0.25">
<c r="B15" s="46" t="s">
<v>1</v>
</c>
<c r="C15" s="44" />
<c r="D15" s="44" />
<c r="E15" s="44" />
<c r="F15" s="44" />
<c r="G15" s="44" />
<c r="H15" s="44" />
<c r="I15" s="44" />
<c r="J15" s="44" />
<c r="K15" s="44" />
<c r="L15" s="45" />
</row>
<row r="16" spans="2:12" ht="409.6" hidden="1" customHeight="1" x14ac:dyDescent="0.25" />
</sheetData>
<mergeCells count="9">
<mergeCell ref="B14:L14" />
<mergeCell ref="B15:L15" />
<mergeCells count="7">
<mergeCell ref="A2:M2" />
<mergeCell ref="B4:L4" />
<mergeCell ref="B6:L6" />
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { BenchmarksResolver } from '@core/resolvers/benchmarks.resolver';
import { CqcStatusCheckResolver } from '@core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver';
import { AllUsersForEstablishmentResolver } from '@core/resolvers/dashboard/all-users-for-establishment.resolver';
import { TotalStaffRecordsResolver } from '@core/resolvers/dashboard/total-staff-records.resolver';
import { FundingReportResolver } from '@core/resolvers/funding-report.resolver';
import { GetMissingCqcLocationsResolver } from '@core/resolvers/getMissingCqcLocations/getMissingCqcLocations.resolver';
import { GetNoOfWorkersWhoRequireInternationalRecruitmentAnswersResolver } from '@core/resolvers/international-recruitment/no-of-workers-who-require-international-recruitment-answers.resolver';
import { LoggedInUserResolver } from '@core/resolvers/logged-in-user.resolver';
Expand Down Expand Up @@ -206,6 +207,7 @@ import { SentryErrorHandler } from './SentryErrorHandler.component';
GetMissingCqcLocationsResolver,
WorkplaceResolver,
GetNoOfWorkersWhoRequireInternationalRecruitmentAnswersResolver,
FundingReportResolver,
],
bootstrap: [AppComponent],
})
Expand Down
1 change: 0 additions & 1 deletion frontend/src/app/core/breadcrumb/breadcrumb.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export enum JourneyType {
BENCHMARKS_QUALIFICATIONS,
EDIT_USER,
WDF,
WDF_PARENT,
PAGES_ARTICLES,
BENCHMARKS_SUBSIDIARIES_PAY,
BENCHMARKS_SUBSIDIARIES_TURNOVER,
Expand Down
104 changes: 14 additions & 90 deletions frontend/src/app/core/breadcrumb/journey.wdf.ts
Original file line number Diff line number Diff line change
@@ -1,120 +1,44 @@
import { JourneyRoute } from './breadcrumb.model';

enum Path {
DASHBOARD = '/dashboard',
OVERVIEW = '/wdf',
LEARN_MORE = 'wdf/learn-more',
FUNDING_REQUIREMENTS = 'wdf/funding-requirements',
DATA = '/wdf/data',
STAFF_RECORD = 'wdf/data/staff-record/:id',
WORKPLACES = 'wdf/workplaces',
STAFF_RECORD = 'wdf/staff-record/:id',
PARENT_DATA = 'wdf/workplaces/:establishmentuid',
PARENT_STAFF_RECORD = 'wdf/workplaces/:establishmentuid/staff-record/:id',
}

// ***********************************************
// new breadcrumb for when new wdf design is live -> remove wdfJourney breadcrumb below
// ***********************************************
// export const wdfJourney: JourneyRoute = {
// children: [
// {
// title: 'WDF data',
// path: Path.DATA,
// referrer: {
// path: Path.DASHBOARD,
// fragment: 'wdf',
// },
// fragment: 'staff-records',
// children: [
// {
// title: 'Staff record',
// path: Path.STAFF_RECORD,
// referrer: {
// path: Path.DATA,
// fragment: 'staff-records',
// },
// },
// ],
// },
// ],
// };

export const wdfJourney: JourneyRoute = {
children: [
{
title: 'WDF',
title: 'Meeting funding requirements?',
path: Path.OVERVIEW,
children: [
{
title: 'WDF data',
title: 'Learn more',
path: Path.LEARN_MORE,
},
{
title: 'Funding requirements',
path: Path.FUNDING_REQUIREMENTS,
},
{
title: 'Your data',
path: Path.DATA,
children: [
{
title: 'Staff record',
path: Path.STAFF_RECORD,
referrer: {
path: Path.DATA,
fragment: 'staff-records',
},
},
],
},
],
},
],
};

// ***********************************************
// new breadcrumb for when new wdf design is live -> remove wdfParentJourney breadcrumb below
// ***********************************************
// export const wdfParentJourney: JourneyRoute = {
// children: [
// {
// title: 'Workplaces',
// path: Path.WORKPLACES,
// referrer: {
// path: Path.DASHBOARD,
// fragment: 'wdf',
// },
// children: [
// {
// title: 'WDF data',
// path: Path.PARENT_DATA,
// children: [
// {
// title: 'Staff record',
// path: Path.PARENT_STAFF_RECORD,
// referrer: {
// path: Path.PARENT_DATA,
// fragment: 'staff-records',
// },
// },
// ],
// },
// ],
// },
// ],
// };

export const wdfParentJourney: JourneyRoute = {
children: [
{
title: 'WDF',
path: Path.OVERVIEW,
children: [
{
title: 'Workplaces',
path: Path.WORKPLACES,
children: [
{
title: 'WDF data',
title: 'Other workplace: data',
path: Path.PARENT_DATA,
children: [
{
title: 'Staff record',
path: Path.PARENT_STAFF_RECORD,
referrer: {
path: Path.PARENT_DATA,
fragment: 'staff-records',
},
},
],
},
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/app/core/model/establishment.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,13 @@ export enum WdfSortStaffOptions {
'0_dsc' = 'Staff name (Z to A)',
'1_asc' = 'Job role (A to Z)',
'1_dsc' = 'Job role (Z to A)',
'2_meeting' = 'WDF requirements (meeting)',
'2_not_meeting' = 'WDF requirements (not meeting)',
'2_meeting' = 'Funding requirements (meeting)',
'2_not_meeting' = 'Funding requirements (not meeting)',
}

export enum WdfParentSortWorkplacesOptions {
'1_not_meeting' = 'WDF requirements (not meeting)',
'2_meeting' = 'WDF requirements (meeting)',
export enum FundingParentSortWorkplacesOptions {
'1_not_meeting' = 'Funding requirements (not meeting)',
'2_meeting' = 'Funding requirements (meeting)',
'3_asc' = 'Workplace name (A to Z)',
'4_dsc' = 'Workplace name (Z to A)',
}
Expand Down
69 changes: 69 additions & 0 deletions frontend/src/app/core/resolvers/funding-report.resolver.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing';
import { ActivatedRouteSnapshot, convertToParamMap } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { EstablishmentService } from '@core/services/establishment.service';
import { ReportService } from '@core/services/report.service';
import { MockEstablishmentService } from '@core/test-utils/MockEstablishmentService';
import { of } from 'rxjs';

import { FundingReportResolver } from './funding-report.resolver';

describe('FundingReportResolver', () => {
function setup(overrides: any = {}) {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule, RouterTestingModule.withRoutes([])],
providers: [
FundingReportResolver,
{
provide: EstablishmentService,
useClass: MockEstablishmentService,
},
{
provide: ActivatedRouteSnapshot,
useValue: {
paramMap: convertToParamMap({ establishmentuid: overrides.idInParams ?? null }),
},
},
],
});

const resolver = TestBed.inject(FundingReportResolver);
const route = TestBed.inject(ActivatedRouteSnapshot);

const reportService = TestBed.inject(ReportService);
const getWDFReportSpy = spyOn(reportService, 'getWDFReport').and.returnValue(of(null));

return {
resolver,
route,
getWDFReportSpy,
};
}

it('should create', () => {
const { resolver } = setup();

expect(resolver).toBeTruthy();
});

it('should call getWDFReport with id from establishmentService when no uid in params', () => {
const { resolver, route, getWDFReportSpy } = setup();

const idFromEstablishmentService = '98a83eef-e1e1-49f3-89c5-b1287a3cc8dd';

resolver.resolve(route);

expect(getWDFReportSpy).toHaveBeenCalledWith(idFromEstablishmentService);
});

it('should call getWDFReport with uid in params when there', () => {
const idInParams = '12321nuihniuh4324';

const { resolver, route, getWDFReportSpy } = setup({ idInParams });

resolver.resolve(route);

expect(getWDFReportSpy).toHaveBeenCalledWith(idInParams);
});
});
26 changes: 26 additions & 0 deletions frontend/src/app/core/resolvers/funding-report.resolver.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, Resolve, Router } from '@angular/router';
import { EstablishmentService } from '@core/services/establishment.service';
import { ReportService } from '@core/services/report.service';
import { of } from 'rxjs';
import { catchError } from 'rxjs/operators';

@Injectable()
export class FundingReportResolver implements Resolve<any> {
constructor(
private router: Router,
private reportService: ReportService,
private establishmentService: EstablishmentService,
) {}

resolve(route: ActivatedRouteSnapshot) {
const workplaceUid = route.paramMap.get('establishmentuid') ?? this.establishmentService.establishmentId;

return this.reportService.getWDFReport(workplaceUid).pipe(
catchError(() => {
this.router.navigate(['/dashboard']);
return of(null);
}),
);
}
}
Loading

0 comments on commit efad3af

Please sign in to comment.