diff --git a/frontend/src/app/features/training-and-qualifications/new-training-qualifications-record/new-qualifications/new-qualifications.spec.ts b/frontend/src/app/features/training-and-qualifications/new-training-qualifications-record/new-qualifications/new-qualifications.spec.ts
index 1ddeef8433..22ed7a4d2d 100644
--- a/frontend/src/app/features/training-and-qualifications/new-training-qualifications-record/new-qualifications/new-qualifications.spec.ts
+++ b/frontend/src/app/features/training-and-qualifications/new-training-qualifications-record/new-qualifications/new-qualifications.spec.ts
@@ -39,7 +39,6 @@ describe('NewQualificationsComponent', () => {
expect(getAllByText('Certificate name').length).toBe(2);
expect(getAllByText('Year achieved').length).toBe(2);
- expect(getAllByText('Notes').length).toBe(2);
});
it('should show Health table row with details of record', async () => {
@@ -47,7 +46,6 @@ describe('NewQualificationsComponent', () => {
expect(getByText('Health qualification')).toBeTruthy();
expect(getByText('2020')).toBeTruthy();
- expect(getByText('This is a test note for the first row in the Health group')).toBeTruthy();
});
it('should show Certificate table first row with details of record', async () => {
@@ -55,7 +53,6 @@ describe('NewQualificationsComponent', () => {
expect(getByText('Cert qualification')).toBeTruthy();
expect(getByText('2021')).toBeTruthy();
- expect(getByText('Test notes needed')).toBeTruthy();
});
it('should show Certificate table second row with details of record', async () => {
@@ -63,7 +60,6 @@ describe('NewQualificationsComponent', () => {
expect(getByText('Another name for qual')).toBeTruthy();
expect(getByText('2012')).toBeTruthy();
- expect(getByText('These are some more notes in the second row of the cert table')).toBeTruthy();
});
describe('no qualifications', async () => {
diff --git a/frontend/src/app/features/wdf/wdf-data-change/wdf-routing.module.ts b/frontend/src/app/features/wdf/wdf-data-change/wdf-routing.module.ts
index b26f741f2e..22236acb8d 100644
--- a/frontend/src/app/features/wdf/wdf-data-change/wdf-routing.module.ts
+++ b/frontend/src/app/features/wdf/wdf-data-change/wdf-routing.module.ts
@@ -40,6 +40,7 @@ import { WdfDataComponent } from './wdf-data/wdf-data.component';
import { WdfOverviewComponent } from './wdf-overview/wdf-overview.component';
import { WdfStaffRecordComponent } from './wdf-staff-record/wdf-staff-record.component';
import { WdfWorkplacesSummaryComponent } from './wdf-workplaces-summary/wdf-workplaces-summary.component';
+import { Level2AdultSocialCareCertificateComponent } from '@features/workers/level-2-adult-social-care-certificate/level-2-adult-social-care-certificate.component';
const routes: Routes = [
{
@@ -200,6 +201,11 @@ const routes: Routes = [
component: CareCertificateComponent,
data: { title: 'Care Certificate' },
},
+ {
+ path: 'level-2-care-certificate',
+ component: Level2AdultSocialCareCertificateComponent,
+ data: { title: 'Level 2 Adult Social Care Certificate' },
+ },
{
path: 'apprenticeship-training',
component: ApprenticeshipTrainingComponent,
@@ -389,6 +395,11 @@ const routes: Routes = [
component: CareCertificateComponent,
data: { title: 'Care Certificate' },
},
+ {
+ path: 'level-2-care-certificate',
+ component: Level2AdultSocialCareCertificateComponent,
+ data: { title: 'Level 2 Adult Social Care Certificate' },
+ },
{
path: 'apprenticeship-training',
component: ApprenticeshipTrainingComponent,
diff --git a/frontend/src/app/features/workers/care-certificate/care-certificate.component.html b/frontend/src/app/features/workers/care-certificate/care-certificate.component.html
index ca29a30213..5eb1e7f461 100644
--- a/frontend/src/app/features/workers/care-certificate/care-certificate.component.html
+++ b/frontend/src/app/features/workers/care-certificate/care-certificate.component.html
@@ -11,6 +11,21 @@
Have they completed, started or partially completed their Care Certificate?
+
+ The Care Certificate is not the same thing as the Level 2 Adult Social Care Certificate, introduced in 2024.
+
+
+
+ What’s the Care Certificate?
+
+
+
+ The Care Certificate is an agreed set of standards that define the knowledge, skills and behaviours
+ expected of specific job roles in the health and social care sectors. It’s made up of the 15 standards
+ that should be covered as part of a robust induction programme.
+
+
+
{
expect(getByLabelText('No')).toBeTruthy();
});
+ it('should render a inset text to explain Care Certificate is not the same as L2 CC certificate', async () => {
+ const { getByText } = await setup();
+
+ const explanationText = getByText(
+ 'The Care Certificate is not the same thing as the Level 2 Adult Social Care Certificate, introduced in 2024.',
+ );
+
+ expect(explanationText).toBeTruthy();
+ });
+
+ it('should render a reveal text about what is the Care Certification', async () => {
+ const { getByText } = await setup();
+
+ const reveal = getByText('What’s the Care Certificate?');
+ const revealText = getByText(
+ 'The Care Certificate is an agreed set of standards that define the knowledge, skills and behaviours expected of specific job roles in the health and social care sectors. It’s made up of the 15 standards that should be covered as part of a robust induction programme.',
+ );
+
+ expect(reveal).toBeTruthy();
+ expect(revealText).toBeTruthy();
+ });
+
describe('submit buttons', () => {
it(`should show 'Save and continue' cta button, skip this question and 'View this staff record' link, if a return url is not provided`, async () => {
const { getByText } = await setup();
@@ -110,7 +132,7 @@ describe('CareCertificateComponent', () => {
});
describe('navigation', () => {
- it('should navigate to apprenticeship-training page when submitting from flow', async () => {
+ it('should navigate to level-2-care-certificate page when submitting from flow', async () => {
const { component, routerSpy, getByText } = await setup();
const workerId = component.worker.uid;
@@ -126,11 +148,11 @@ describe('CareCertificateComponent', () => {
workplaceId,
'staff-record',
workerId,
- 'apprenticeship-training',
+ 'level-2-care-certificate',
]);
});
- it('should navigate to apprenticeship-training page when skipping the question in the flow', async () => {
+ it('should navigate to level-2-care-certificate page when skipping the question in the flow', async () => {
const { component, routerSpy, getByText } = await setup();
const workerId = component.worker.uid;
@@ -144,7 +166,7 @@ describe('CareCertificateComponent', () => {
workplaceId,
'staff-record',
workerId,
- 'apprenticeship-training',
+ 'level-2-care-certificate',
]);
});
diff --git a/frontend/src/app/features/workers/care-certificate/care-certificate.component.ts b/frontend/src/app/features/workers/care-certificate/care-certificate.component.ts
index 19ad711575..4961b3d7cc 100644
--- a/frontend/src/app/features/workers/care-certificate/care-certificate.component.ts
+++ b/frontend/src/app/features/workers/care-certificate/care-certificate.component.ts
@@ -37,7 +37,7 @@ export class CareCertificateComponent extends QuestionComponent {
}
init() {
- this.next = this.getRoutePath('apprenticeship-training');
+ this.next = this.getRoutePath('level-2-care-certificate');
if (this.worker.careCertificate) {
this.prefill();
}
diff --git a/frontend/src/app/features/workers/level-2-adult-social-care-certificate/level-2-adult-social-care-certificate.component.html b/frontend/src/app/features/workers/level-2-adult-social-care-certificate/level-2-adult-social-care-certificate.component.html
new file mode 100644
index 0000000000..f5e99e3200
--- /dev/null
+++ b/frontend/src/app/features/workers/level-2-adult-social-care-certificate/level-2-adult-social-care-certificate.component.html
@@ -0,0 +1,121 @@
+
+
+
diff --git a/frontend/src/app/features/workers/level-2-adult-social-care-certificate/level-2-adult-social-care-certificate.component.spec.ts b/frontend/src/app/features/workers/level-2-adult-social-care-certificate/level-2-adult-social-care-certificate.component.spec.ts
new file mode 100644
index 0000000000..39ff83c334
--- /dev/null
+++ b/frontend/src/app/features/workers/level-2-adult-social-care-certificate/level-2-adult-social-care-certificate.component.spec.ts
@@ -0,0 +1,409 @@
+import { getTestBed } from '@angular/core/testing';
+import { fireEvent, render } from '@testing-library/angular';
+import { SharedModule } from '@shared/shared.module';
+import { ActivatedRoute, Router, RouterModule } from '@angular/router';
+import { RouterTestingModule } from '@angular/router/testing';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { ReactiveFormsModule, UntypedFormBuilder } from '@angular/forms';
+import { WorkerService } from '@core/services/worker.service';
+import { Worker } from '@core/model/worker.model';
+import { MockWorkerServiceWithUpdateWorker, workerBuilder } from '@core/test-utils/MockWorkerService';
+
+import { Level2AdultSocialCareCertificateComponent } from './level-2-adult-social-care-certificate.component';
+import { HttpClient } from '@angular/common/http';
+import dayjs from 'dayjs';
+
+describe('Level2AdultSocialCareCertificateComponent', () => {
+ const workerFieldsNoLevel2CareCertificate = { level2CareCertificate: { value: null, year: null } };
+ async function setup(insideFlow = true, workerFields = workerFieldsNoLevel2CareCertificate) {
+ const { fixture, getByText, getAllByText, getByLabelText, getByTestId, queryByTestId, queryByText } = await render(
+ Level2AdultSocialCareCertificateComponent,
+ {
+ imports: [SharedModule, RouterModule, RouterTestingModule, HttpClientTestingModule, ReactiveFormsModule],
+ providers: [
+ UntypedFormBuilder,
+ {
+ provide: ActivatedRoute,
+ useValue: {
+ parent: {
+ snapshot: {
+ url: [{ path: insideFlow ? 'staff-uid' : 'staff-record-summary' }],
+ data: {
+ establishment: { uid: 'mocked-uid' },
+ primaryWorkplace: {},
+ },
+ },
+ },
+ snapshot: {
+ params: {},
+ },
+ },
+ },
+ {
+ provide: WorkerService,
+ useFactory: MockWorkerServiceWithUpdateWorker.factory({ ...workerBuilder(), ...workerFields } as Worker),
+ deps: [HttpClient],
+ },
+ ],
+ declarations: [],
+ },
+ );
+ const injector = getTestBed();
+
+ const component = fixture.componentInstance;
+
+ const router = injector.inject(Router) as Router;
+
+ const routerSpy = spyOn(router, 'navigate').and.returnValue(Promise.resolve(true));
+
+ return {
+ component,
+ fixture,
+ getByText,
+ getAllByText,
+ getByLabelText,
+ getByTestId,
+ queryByTestId,
+ queryByText,
+ router,
+ routerSpy,
+ };
+ }
+
+ it('should render the Level2AdultSocialCareCertificateComponent', async () => {
+ const { component } = await setup();
+ expect(component).toBeTruthy();
+ });
+
+ it('should show the caption', async () => {
+ const { getByTestId } = await setup();
+
+ const sectionHeading = getByTestId('section-heading');
+ const captionText = 'Training and qualifications';
+
+ expect(sectionHeading.textContent).toEqual(captionText);
+ });
+
+ it('should show the heading', async () => {
+ const { getByText } = await setup();
+
+ const headingText = getByText('Have they completed or started their Level 2 Adult Social Care Certificate?');
+
+ expect(headingText).toBeTruthy();
+ });
+
+ it('should show the reveal', async () => {
+ const { getByTestId } = await setup();
+
+ const reveal = getByTestId('reveal-whatIsLevel2CC');
+
+ expect(reveal).toBeTruthy();
+ });
+
+ it('should show the radio buttons', async () => {
+ const { getByLabelText } = await setup();
+
+ expect(getByLabelText('Yes, completed')).toBeTruthy();
+ expect(getByLabelText('Yes, started')).toBeTruthy();
+ expect(getByLabelText('No')).toBeTruthy();
+ });
+
+ describe('submit buttons', () => {
+ it(`should show 'Save and continue' cta button, skip this question and 'View this staff record' link, if a return url is not provided`, async () => {
+ const { getByText } = await setup();
+
+ expect(getByText('Save and continue')).toBeTruthy();
+ expect(getByText('Skip this question')).toBeTruthy();
+ expect(getByText('View this staff record')).toBeTruthy();
+ });
+
+ it(`should show 'Save and return' cta button and 'Cancel' link if a return url is provided`, async () => {
+ const { getByText } = await setup(false);
+
+ expect(getByText('Save and return')).toBeTruthy();
+ expect(getByText('Cancel')).toBeTruthy();
+ });
+ });
+
+ describe('progress bar', () => {
+ it('should render the workplace progress bar', async () => {
+ const { getByTestId } = await setup();
+
+ expect(getByTestId('progress-bar')).toBeTruthy();
+ });
+
+ it('should not render the progress bars when accessed from outside the flow', async () => {
+ const { queryByTestId } = await setup(false);
+
+ expect(queryByTestId('progress-bar')).toBeFalsy();
+ });
+ });
+
+ describe('year achieved input', () => {
+ describe('should not show', () => {
+ it('when the page is loaded', async () => {
+ const { fixture } = await setup();
+
+ const yearAchievedInput = fixture.nativeElement.querySelector('div[id="certification-achieved"]');
+
+ expect(yearAchievedInput.getAttribute('class')).toContain('hidden');
+ });
+
+ it('when "Yes, started" is clicked', async () => {
+ const { fixture, getByLabelText } = await setup();
+
+ const yesStartedRadioButton = getByLabelText('Yes, started');
+
+ fireEvent.click(yesStartedRadioButton);
+ fixture.detectChanges();
+
+ const yearAchievedInput = fixture.nativeElement.querySelector('div[id="certification-achieved"]');
+
+ expect(yearAchievedInput.getAttribute('class')).toContain('hidden');
+ });
+
+ it('when "no" is clicked', async () => {
+ const { fixture, getByLabelText } = await setup();
+
+ const noRadioButton = getByLabelText('No');
+
+ fireEvent.click(noRadioButton);
+ fixture.detectChanges();
+
+ const yearAchievedInput = fixture.nativeElement.querySelector('div[id="certification-achieved"]');
+
+ expect(yearAchievedInput.getAttribute('class')).toContain('hidden');
+ });
+ });
+
+ it('should show when "yes, completed" is clicked', async () => {
+ const { fixture, getByLabelText } = await setup();
+
+ const yesCompletedRadioButton = getByLabelText('Yes, completed');
+
+ fireEvent.click(yesCompletedRadioButton);
+ fixture.detectChanges();
+
+ const yearAchievedInput = fixture.nativeElement.querySelector('div[id="certification-achieved"]');
+
+ expect(yearAchievedInput.getAttribute('class')).not.toContain('hidden');
+ });
+ });
+
+ describe('navigation', () => {
+ it('should navigate to apprenticeship-training page when submitting from flow', async () => {
+ const { component, fixture, routerSpy, getByText } = await setup();
+
+ const workerId = component.worker.uid;
+ const workplaceId = component.workplace.uid;
+ const radioBtn = fixture.nativeElement.querySelector('input[id="level2CareCertificate-yesStarted"]');
+ const saveButton = getByText('Save and continue');
+
+ fireEvent.click(radioBtn);
+ fireEvent.click(saveButton);
+ fixture.detectChanges();
+
+ expect(getByText('Save and continue')).toBeTruthy();
+
+ expect(routerSpy).toHaveBeenCalledWith([
+ '/workplace',
+ workplaceId,
+ 'staff-record',
+ workerId,
+ 'apprenticeship-training',
+ ]);
+ });
+
+ it('should navigate to apprenticeship-training page when skipping the question in the flow', async () => {
+ const { component, routerSpy, getByText } = await setup();
+
+ const workerId = component.worker.uid;
+ const workplaceId = component.workplace.uid;
+
+ const link = getByText('Skip this question');
+ fireEvent.click(link);
+
+ expect(routerSpy).toHaveBeenCalledWith([
+ '/workplace',
+ workplaceId,
+ 'staff-record',
+ workerId,
+ 'apprenticeship-training',
+ ]);
+ });
+
+ it('should navigate to staff-summary-page page when pressing view this staff record', async () => {
+ const { component, routerSpy, getByText } = await setup();
+
+ const workerId = component.worker.uid;
+ const workplaceId = component.workplace.uid;
+
+ const link = getByText('View this staff record');
+ fireEvent.click(link);
+
+ expect(routerSpy).toHaveBeenCalledWith([
+ '/workplace',
+ workplaceId,
+ 'staff-record',
+ workerId,
+ 'staff-record-summary',
+ ]);
+ });
+
+ it('should navigate to staff-summary-page page when pressing save and return', async () => {
+ const { component, fixture, routerSpy, getByText } = await setup(false);
+
+ const workerId = component.worker.uid;
+ const workplaceId = component.workplace.uid;
+ const radioBtn = fixture.nativeElement.querySelector('input[id="level2CareCertificate-yesStarted"]');
+ const saveButton = getByText('Save and return');
+
+ fireEvent.click(radioBtn);
+ fireEvent.click(saveButton);
+ fixture.detectChanges();
+
+ expect(routerSpy).toHaveBeenCalledWith([
+ '/workplace',
+ workplaceId,
+ 'staff-record',
+ workerId,
+ 'staff-record-summary',
+ ]);
+ });
+
+ it('should navigate to staff-summary-page page when pressing cancel', async () => {
+ const { component, routerSpy, getByText } = await setup(false);
+
+ const workerId = component.worker.uid;
+ const workplaceId = component.workplace.uid;
+
+ const link = getByText('Cancel');
+ fireEvent.click(link);
+
+ expect(routerSpy).toHaveBeenCalledWith([
+ '/workplace',
+ workplaceId,
+ 'staff-record',
+ workerId,
+ 'staff-record-summary',
+ ]);
+ });
+
+ it('should navigate to wdf staff-summary-page page when pressing save and return in wdf version of page', async () => {
+ const { component, router, fixture, routerSpy, getByText } = await setup(false);
+ spyOnProperty(router, 'url').and.returnValue('/wdf/staff-record');
+ component.returnUrl = undefined;
+ component.ngOnInit();
+ fixture.detectChanges();
+ const workerId = component.worker.uid;
+
+ const radioBtn = fixture.nativeElement.querySelector('input[id="level2CareCertificate-yesStarted"]');
+ const saveButton = getByText('Save and return');
+
+ fireEvent.click(radioBtn);
+ fireEvent.click(saveButton);
+ fixture.detectChanges();
+
+ expect(routerSpy).toHaveBeenCalledWith(['/wdf', 'staff-record', workerId]);
+ });
+
+ it('should navigate to wdf staff-summary-page page when pressing cancel in wdf version of page', async () => {
+ const { component, router, fixture, routerSpy, getByText } = await setup(false);
+ spyOnProperty(router, 'url').and.returnValue('/wdf/staff-record');
+ component.returnUrl = undefined;
+ component.ngOnInit();
+ fixture.detectChanges();
+ const workerId = component.worker.uid;
+
+ const link = getByText('Cancel');
+ fireEvent.click(link);
+
+ expect(routerSpy).toHaveBeenCalledWith(['/wdf', 'staff-record', workerId]);
+ });
+ });
+
+ describe('pre-fill', () => {
+ it('should only show radio button checked', async () => {
+ const workerFields = { level2CareCertificate: { value: 'No', year: null } };
+ const { component, fixture } = await setup(false, workerFields);
+
+ fixture.detectChanges();
+
+ const form = component.form;
+ const radioBtn = fixture.nativeElement.querySelector('input[id="level2CareCertificate-no"]');
+ const yearAchievedInput = fixture.nativeElement.querySelector('div[id="certification-achieved"]');
+
+ expect(radioBtn.checked).toBeTruthy();
+ expect(yearAchievedInput.getAttribute('class')).toContain('hidden');
+ expect(form.value).toEqual({ level2CareCertificate: 'No', level2CareCertificateYearAchieved: null });
+ });
+
+ it('should show radio and year input', async () => {
+ const workerFields = { level2CareCertificate: { value: 'Yes, completed', year: 2023 } };
+ const { component, fixture } = await setup(false, workerFields);
+
+ fixture.detectChanges();
+
+ const form = component.form;
+ const radioBtn = fixture.nativeElement.querySelector('input[id="level2CareCertificate-yesCompleted"]');
+ const yearAchievedInput = fixture.nativeElement.querySelector('div[id="certification-achieved"]');
+
+ expect(radioBtn.checked).toBeTruthy();
+ expect(yearAchievedInput.getAttribute('class')).not.toContain('hidden');
+ expect(form.value).toEqual({ level2CareCertificate: 'Yes, completed', level2CareCertificateYearAchieved: 2023 });
+ });
+ });
+
+ describe('errors', () => {
+ it('should not show if "Yes, completed" is clicked but no year entered', async () => {
+ const { component, fixture, getByText, queryByText } = await setup(false);
+
+ const form = component.form;
+ const radioBtn = fixture.nativeElement.querySelector('input[id="level2CareCertificate-yesCompleted"]');
+ const saveButton = getByText('Save and return');
+
+ fireEvent.click(radioBtn);
+ fireEvent.click(saveButton);
+ fixture.detectChanges();
+
+ expect(form.valid).toBeTruthy();
+ expect(queryByText('There is a problem')).toBeFalsy();
+ });
+
+ it('should show if the entered year is in the future', async () => {
+ const { component, fixture, getByText, getAllByText } = await setup(false);
+
+ const form = component.form;
+ const radioBtn = fixture.nativeElement.querySelector('input[id="level2CareCertificate-yesCompleted"]');
+ const saveButton = getByText('Save and return');
+ const expectedErrorMessage = 'Year achieved cannot be in the future';
+ const nextYear = dayjs().year() + 1;
+
+ form.get('level2CareCertificateYearAchieved').setValue(nextYear);
+ form.markAsDirty();
+ fireEvent.click(radioBtn);
+ fireEvent.click(saveButton);
+
+ expect(form.invalid).toBeTruthy();
+ expect(getAllByText(expectedErrorMessage, { exact: false }).length).toBe(2);
+ });
+
+ it('should error if entered year is before the qualification was introduced', async () => {
+ const { component, fixture, getByText, getAllByText } = await setup(false);
+
+ const form = component.form;
+ const radioBtn = fixture.nativeElement.querySelector('input[id="level2CareCertificate-yesCompleted"]');
+ const saveButton = getByText('Save and return');
+
+ form.get('level2CareCertificateYearAchieved').setValue(2023);
+ form.markAsDirty();
+ fireEvent.click(radioBtn);
+ fireEvent.click(saveButton);
+
+ const expectedErrorMessage = 'Year achieved cannot be before 2024';
+
+ expect(form.invalid).toBeTruthy();
+ expect(getAllByText(expectedErrorMessage, { exact: false }).length).toBe(2);
+ });
+ });
+});
diff --git a/frontend/src/app/features/workers/level-2-adult-social-care-certificate/level-2-adult-social-care-certificate.component.ts b/frontend/src/app/features/workers/level-2-adult-social-care-certificate/level-2-adult-social-care-certificate.component.ts
new file mode 100644
index 0000000000..10ef395367
--- /dev/null
+++ b/frontend/src/app/features/workers/level-2-adult-social-care-certificate/level-2-adult-social-care-certificate.component.ts
@@ -0,0 +1,93 @@
+import { Component } from '@angular/core';
+import { QuestionComponent } from '../question/question.component';
+import { UntypedFormBuilder, Validators } from '@angular/forms';
+import { ActivatedRoute, Router } from '@angular/router';
+import { BackLinkService } from '@core/services/backLink.service';
+import { ErrorSummaryService } from '@core/services/error-summary.service';
+import { WorkerService } from '@core/services/worker.service';
+import { EstablishmentService } from '@core/services/establishment.service';
+import dayjs from 'dayjs';
+
+@Component({
+ selector: 'app-level-2-adult-social-care-certificate',
+ templateUrl: './level-2-adult-social-care-certificate.component.html',
+})
+export class Level2AdultSocialCareCertificateComponent extends QuestionComponent {
+ public answersAvailable = ['Yes, completed', 'Yes, started', 'No'];
+
+ public section = 'Training and qualifications';
+
+ constructor(
+ protected formBuilder: UntypedFormBuilder,
+ protected router: Router,
+ protected route: ActivatedRoute,
+ protected backLinkService: BackLinkService,
+ protected errorSummaryService: ErrorSummaryService,
+ protected workerService: WorkerService,
+ protected establishmentService: EstablishmentService,
+ ) {
+ super(formBuilder, router, route, backLinkService, errorSummaryService, workerService, establishmentService);
+
+ this.form = this.formBuilder.group({
+ level2CareCertificate: null,
+ level2CareCertificateYearAchieved: [null, { validators: null, updateOn: 'submit' }],
+ });
+ }
+
+ init() {
+ this.next = this.getRoutePath('apprenticeship-training');
+
+ this.subscriptions.add(
+ this.form.get('level2CareCertificate').valueChanges.subscribe((value) => {
+ this.form.get('level2CareCertificateYearAchieved').clearValidators();
+
+ if (value === 'Yes, completed') {
+ this.form
+ .get('level2CareCertificateYearAchieved')
+ .setValidators([Validators.min(2024), Validators.max(dayjs().year())]);
+ }
+ this.form.get('level2CareCertificateYearAchieved').updateValueAndValidity();
+ }),
+ );
+
+ if (this.worker.level2CareCertificate && this.worker.level2CareCertificate.value) {
+ this.form.patchValue({
+ level2CareCertificate: this.worker.level2CareCertificate.value,
+ level2CareCertificateYearAchieved: this.worker.level2CareCertificate.year,
+ });
+ }
+ }
+
+ generateUpdateProps() {
+ const { level2CareCertificate, level2CareCertificateYearAchieved } = this.form.value;
+
+ if (!level2CareCertificate) {
+ return null;
+ }
+
+ return {
+ level2CareCertificate: {
+ value: level2CareCertificate,
+ year: level2CareCertificateYearAchieved,
+ },
+ };
+ }
+
+ setupFormErrorsMap(): void {
+ this.formErrorsMap = [
+ {
+ item: 'level2CareCertificateYearAchieved',
+ type: [
+ {
+ name: 'min',
+ message: `Year achieved cannot be before 2024`,
+ },
+ {
+ name: 'max',
+ message: `Year achieved cannot be in the future`,
+ },
+ ],
+ },
+ ];
+ }
+}
diff --git a/frontend/src/app/features/workers/workers-routing.module.ts b/frontend/src/app/features/workers/workers-routing.module.ts
index 2efdafa5da..56ea30f210 100644
--- a/frontend/src/app/features/workers/workers-routing.module.ts
+++ b/frontend/src/app/features/workers/workers-routing.module.ts
@@ -52,6 +52,7 @@ import { TotalStaffChangeComponent } from './total-staff-change/total-staff-chan
import { WeeklyContractedHoursComponent } from './weekly-contracted-hours/weekly-contracted-hours.component';
import { YearArrivedUkComponent } from './year-arrived-uk/year-arrived-uk.component';
import { EmployedFromOutsideUkComponent } from './employed-from-outside-uk/employed-from-outside-uk.component';
+import { Level2AdultSocialCareCertificateComponent } from './level-2-adult-social-care-certificate/level-2-adult-social-care-certificate.component';
import { SelectTrainingCategoryComponent } from '@features/training-and-qualifications/add-edit-training/select-training-category/select-training-category.component';
import { TrainingCategoriesResolver } from '@core/resolvers/training-categories.resolver';
@@ -204,7 +205,7 @@ const routes: Routes = [
{
path: 'inside-or-outside-of-uk',
component: EmployedFromOutsideUkComponent,
- data: { title: 'Inside or Outside UK'}
+ data: { title: 'Inside or Outside UK' },
},
{
path: 'adult-social-care-started',
@@ -241,6 +242,11 @@ const routes: Routes = [
component: CareCertificateComponent,
data: { title: 'Care Certificate' },
},
+ {
+ path: 'level-2-care-certificate',
+ component: Level2AdultSocialCareCertificateComponent,
+ data: { title: 'Level 2 Adult Social Care Certificate' },
+ },
{
path: 'apprenticeship-training',
component: ApprenticeshipTrainingComponent,
@@ -293,19 +299,19 @@ const routes: Routes = [
path: 'add-training',
children: [
{
- path:'',
+ path: '',
component: SelectTrainingCategoryComponent,
data: { title: 'Add Training' },
resolve: {
trainingCategories: TrainingCategoriesResolver,
- }
+ },
},
{
path: 'details',
component: AddEditTrainingComponent,
data: { title: 'Add Training' },
- }
- ]
+ },
+ ],
},
{
path: 'training/:trainingRecordId',
@@ -461,7 +467,7 @@ const routes: Routes = [
{
path: 'inside-or-outside-of-uk',
component: EmployedFromOutsideUkComponent,
- data: { title: 'Inside or Outside UK'}
+ data: { title: 'Inside or Outside UK' },
},
{
path: 'adult-social-care-started',
@@ -498,6 +504,11 @@ const routes: Routes = [
component: CareCertificateComponent,
data: { title: 'Care Certificate' },
},
+ {
+ path: 'level-2-care-certificate',
+ component: Level2AdultSocialCareCertificateComponent,
+ data: { title: 'Level 2 Adult Social Care Certificate' },
+ },
{
path: 'apprenticeship-training',
component: ApprenticeshipTrainingComponent,
@@ -550,19 +561,19 @@ const routes: Routes = [
path: 'add-training',
children: [
{
- path:'',
+ path: '',
component: SelectTrainingCategoryComponent,
data: { title: 'Add Training' },
resolve: {
trainingCategories: TrainingCategoriesResolver,
- }
+ },
},
{
path: 'details',
component: AddEditTrainingComponent,
data: { title: 'Add Training' },
- }
- ]
+ },
+ ],
},
{
path: 'training/:trainingRecordId',
diff --git a/frontend/src/app/features/workers/workers.module.ts b/frontend/src/app/features/workers/workers.module.ts
index b639addad6..e77e3b0b71 100644
--- a/frontend/src/app/features/workers/workers.module.ts
+++ b/frontend/src/app/features/workers/workers.module.ts
@@ -65,6 +65,7 @@ import { WeeklyContractedHoursComponent } from './weekly-contracted-hours/weekly
import { WorkersRoutingModule } from './workers-routing.module';
import { YearArrivedUkComponent } from './year-arrived-uk/year-arrived-uk.component';
import { EmployedFromOutsideUkComponent } from './employed-from-outside-uk/employed-from-outside-uk.component';
+import { Level2AdultSocialCareCertificateComponent } from './level-2-adult-social-care-certificate/level-2-adult-social-care-certificate.component';
import { TrainingCategoriesResolver } from '@core/resolvers/training-categories.resolver';
@NgModule({
@@ -120,6 +121,7 @@ import { TrainingCategoriesResolver } from '@core/resolvers/training-categories.
DownloadPdfTrainingAndQualificationComponent,
HealthAndCareVisaComponent,
EmployedFromOutsideUkComponent,
+ Level2AdultSocialCareCertificateComponent,
],
providers: [
DialogService,
diff --git a/frontend/src/app/shared/components/staff-record-summary/qualifications-and-training/qualifications-and-training.component.html b/frontend/src/app/shared/components/staff-record-summary/qualifications-and-training/qualifications-and-training.component.html
index a864317e5f..cb4c0834ba 100644
--- a/frontend/src/app/shared/components/staff-record-summary/qualifications-and-training/qualifications-and-training.component.html
+++ b/frontend/src/app/shared/components/staff-record-summary/qualifications-and-training/qualifications-and-training.component.html
@@ -19,7 +19,7 @@