diff --git a/src/pages/XeniumAnalyser.tsx b/src/pages/XeniumAnalyser.tsx index 02b6a20d..5826053b 100644 --- a/src/pages/XeniumAnalyser.tsx +++ b/src/pages/XeniumAnalyser.tsx @@ -48,8 +48,8 @@ type SampleWithRegion = { roi: string; }; type LabwareSamples = { - barcode: string; samples: SampleWithRegion[]; + labware: LabwareFlaggedFieldsFragment; }; type AnalyserLabwareForm = { @@ -88,6 +88,7 @@ const LabwareAnalyserTable = (labwareForm: AnalyserLabwareForm) => { + BarcodeDonor IDLabware TypeExternal Name @@ -99,6 +100,7 @@ const LabwareAnalyserTable = (labwareForm: AnalyserLabwareForm) => { + {labwareForm.labware.barcode} {joinUnique(samples.map((sample) => sample.tissue.donor.donorName))} @@ -278,7 +280,7 @@ const XeniumAnalyser = () => { }); }); }); - setLabwareSamples((prev) => [...prev, { barcode: lw.barcode, workNumber: '', samples }]); + setLabwareSamples((prev) => [...prev, { labware: lw, barcode: lw.barcode, workNumber: '', samples }]); }; setLabwareSampleData(labware); }, @@ -303,7 +305,7 @@ const XeniumAnalyser = () => { validationSchema={validationSchema} onSubmit={async (values) => { const labwareROIData: AnalyserLabware[] = values.labware.map((lw) => { - const labwareSample = labwareSamples.find((ls) => ls.barcode === lw.labware.barcode); + const labwareSample = labwareSamples.find((ls) => ls.labware.barcode === lw.labware.barcode); return { barcode: lw.labware.barcode, workNumber: lw.workNumber, @@ -346,12 +348,12 @@ const XeniumAnalyser = () => { limit={2} onAdd={(labware) => { /**If labware scanned not already displayed, add to list**/ - if (!labwareSamples.some((lwSamples) => lwSamples.barcode === labware.barcode)) { + if (!labwareSamples.some((lwSamples) => lwSamples.labware.barcode === labware.barcode)) { createTableDataForSlots(labware, setValues, values); } }} onRemove={async (labware) => { - setLabwareSamples((prev) => prev.filter((lw) => lw.barcode !== labware.barcode)); + setLabwareSamples((prev) => prev.filter((lw) => lw.labware.barcode !== labware.barcode)); await setValues((prev) => { return { ...prev, @@ -367,14 +369,7 @@ const XeniumAnalyser = () => {
removeLabware(labwareForm.labware.barcode)} />
-
-
-
- -
-
{LabwareAnalyserTable(labwareForm)}
-
-
+
{LabwareAnalyserTable(labwareForm)}
)) } @@ -471,93 +466,101 @@ const XeniumAnalyser = () => { - -
- - - Barcode - SGP Number - Cassette Position - Samples - - - - {labwareSamples.map((lw, lwIndex) => ( - - {lw.barcode} - - { - setFieldValue(`labware.${lwIndex}.workNumber`, workNumber); - }} - workNumber={values.labware[lwIndex]?.workNumber} - requiredField={true} - /> - - - - { - return { value: val, label: val }; - })} - name={`labware.${lwIndex}.position`} - dataTestId={`${lw.barcode}-position`} - emptyOption={true} - /> - + {labwareSamples.map((lw, lwIndex) => ( + +
+
+ +
+
+
+ + + SGP Number + Cassette Position + Samples + + + + + + { + setFieldValue(`labware.${lwIndex}.workNumber`, workNumber); + }} + workNumber={values.labware[lwIndex]?.workNumber} + requiredField={true} + /> + + + + { + return { value: val, label: val }; + })} + name={`labware.${lwIndex}.position`} + dataTestId={`${lw.labware.barcode}-position`} + emptyOption={true} + /> + - -
-
- Region of interest - Slot address - Section number - Section position - External Id -
- {lw.samples.map((sample, sampleIndex) => { - return ( -
-
- ) => { - setFieldValue( - `labware.${lwIndex}.samples.${sampleIndex}.roi`, - e.currentTarget.value - ); - setLabwareSamples((prev) => { - const updated = [...prev]; - updated[lwIndex].samples[sampleIndex].roi = e.currentTarget.value; - return updated; - }); - }} - value={labwareSamples[lwIndex].samples[sampleIndex].roi} - /> -
-
- -
- - - + +
+
+ Region of interest + Slot address + Section number + Section position + External Id
- ); - })} -
-
-
- ))} - -
- + {lw.samples.map((sample, sampleIndex) => { + return ( +
+
+ ) => { + setFieldValue( + `labware.${lwIndex}.samples.${sampleIndex}.roi`, + e.currentTarget.value + ); + setLabwareSamples((prev) => { + const updated = [...prev]; + updated[lwIndex].samples[sampleIndex].roi = e.currentTarget.value; + return updated; + }); + }} + value={labwareSamples[lwIndex].samples[sampleIndex].roi} + /> +
+
+ +
+ + + +
+ ); + })} + + + + + + + + + ))}
Save