Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X1246 section reg bio risk #794

Merged
merged 3 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cypress/e2e/pages/sectionRegistration.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ describe('Section Registration Page', () => {
'Section External Identifier contains invalid characters. Only letters, numbers, hyphens, and underscores are permitted'
).should('be.visible');
});

it('requires Biological Risk Assessment Numbers ', () => {
cy.findByLabelText('Biological Risk Assessment Numbers').focus().blur();
cy.findByText('Biological Risk Assessment Numbers is a required field').should('be.visible');
});
});

describe('Initialisation', () => {
Expand Down Expand Up @@ -342,6 +347,7 @@ function fillInForm() {
selectOption('Tissue Type', 'Liver');
selectOption('Spatial Location', '3 - Surface central region');
cy.findByLabelText('Replicate Number').clear().type('2');
selectOption('bioRiskCode', 'bioRisk1');
cy.findByLabelText('Section External Identifier').clear().type('S_EXT_ID_1');
cy.findByLabelText('Sectioned Date').clear().type('2024-07-07');
cy.findByLabelText('Section Number').clear().type('5');
Expand Down
10 changes: 7 additions & 3 deletions src/pages/SectionRegistration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type SectionRegistrationFormSection = {
sectionThickness: number;
region?: string;
dateSectioned?: Date;
bioRiskCode: string;
};

type SectionRegistrationFormLabware = {
Expand Down Expand Up @@ -93,7 +94,8 @@ function buildSectionRegisterRequest(values: SectionRegistrationFormValues): Sec
species: sample.species.trim(),
tissueType: sample.tissueType.trim(),
region: sample.region,
dateSectioned: sample.dateSectioned?.toString()
dateSectioned: sample.dateSectioned?.toString(),
bioRiskCode: sample.bioRiskCode
}));
})
};
Expand Down Expand Up @@ -135,7 +137,8 @@ function buildSample(): SectionRegistrationFormSection {
sectionNumber: 0,
sectionThickness: 0,
region: '',
dateSectioned: undefined
dateSectioned: undefined,
bioRiskCode: ''
};
}

Expand Down Expand Up @@ -166,7 +169,8 @@ function buildValidationSchema(registrationInfo: GetRegistrationInfoQuery) {
sectionNumber: validation.sectionNumber,
sectionThickness: validation.sectionThickness,
region: validation.region,
dateSectioned: validation.dateSectioned
dateSectioned: validation.dateSectioned,
bioRiskCode: validation.bioRiskCode
})
)
)
Expand Down
13 changes: 13 additions & 0 deletions src/pages/registration/SectionForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,19 @@ export default function SectionForm({
name={`labwares.${currentIndex}.slots.${slotAddress}.${sectionIndex}.replicateNumber`}
/>

<CustomReactSelect
label="Biological Risk Assessment Numbers"
dataTestId="bioRiskCode"
name={`labwares.${currentIndex}.slots.${slotAddress}.${sectionIndex}.bioRiskCode`}
value={values.labwares[currentIndex].slots[slotAddress][sectionIndex].bioRiskCode}
options={registrationInfo.bioRisks.map((bioRisk) => {
return {
label: bioRisk.code,
value: bioRisk.code
};
})}
/>

<Heading level={4}>Section Information</Heading>

<FormikInput
Expand Down
Loading
Loading