Skip to content

Commit

Permalink
add multiple slides and bundles at ago
Browse files Browse the repository at this point in the history
  • Loading branch information
mozzy11 committed Sep 26, 2023
1 parent 5c3e729 commit 78a7c9f
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 20 deletions.
37 changes: 32 additions & 5 deletions frontend/src/components/cytology/CytologyCaseView.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ function CytologyCaseView() {
const [loading, setLoading] = useState(true);
const [reportTypes, setReportTypes] = useState([]);
const intl = useIntl();
const [slidesToAdd, setSlidesToAdd] = useState(1);

async function displayStatus(response) {
var body = await response.json();
Expand Down Expand Up @@ -675,15 +676,41 @@ function CytologyCaseView() {
);
})}

<Column lg={16} md={8} sm={4}>
<Column lg={2} md={8} sm={4}>
<TextInput
id="slidesToAdd"
labelText={intl.formatMessage({ id: "pathology.label.slide.add.number" })}
hideLabel={true}
placeholder={intl.formatMessage({ id: "pathology.label.slide.add.number" })}
value={slidesToAdd}
type="number"
onChange={(e) => {
setSlidesToAdd(e.target.value);
}}
/>
</Column>
<Column lg={14} md={8} sm={4}>
<Button
onClick={() => {
const maxSlideNumber = pathologySampleInfo.slides.reduce(
(max, slide) => {
const slideNumber = slide.slideNumber || 0;
return Math.ceil(Math.max(max, slideNumber));
},
0,
);

var allSlides = pathologySampleInfo.slides || [];
Array.from({ length: slidesToAdd }, (_, index) => {
allSlides.push({
id: "",
slideNumber: maxSlideNumber + 1 + index,
});
})

setPathologySampleInfo({
...pathologySampleInfo,
slides: [
...(pathologySampleInfo.slides || []),
{ id: "", slideNumber: "" },
],
slides: allSlides
});
}}
>
Expand Down
75 changes: 65 additions & 10 deletions frontend/src/components/pathology/PathologyCaseView.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ function PathologyCaseView() {
const [technicianUsers, setTechnicianUsers] = useState([]);
const [pathologistUsers, setPathologistUsers] = useState([]);
const [loading, setLoading] = useState(true);
const [blocksToAdd, setBlocksToAdd] = useState(1);
const [slidesToAdd, setSlidesToAdd] = useState(1);


async function displayStatus(response) {
var body = await response.json();
Expand Down Expand Up @@ -647,15 +650,41 @@ function PathologyCaseView() {
</>
);
})}
<Column lg={16} md={8} sm={4}>
<Column lg={2} md={8} sm={4}>
<TextInput
id="blocksToAdd"
labelText={intl.formatMessage({ id: "pathology.label.block.add.number" })}
hideLabel={true}
placeholder={intl.formatMessage({ id: "pathology.label.block.add.number" })}
value={blocksToAdd}
type="number"
onChange={(e) => {
setBlocksToAdd(e.target.value);
}}
/>
</Column>
<Column lg={14} md={8} sm={4}>
<Button
onClick={() => {
const maxBlockNumber = pathologySampleInfo.blocks.reduce(
(max, block) => {
const blockNumber = block.blockNumber || 0;
return Math.ceil(Math.max(max, blockNumber));
},
0,
);

var allBlocks = pathologySampleInfo.blocks || [];
Array.from({ length: blocksToAdd }, (_, index) => {
allBlocks.push({
id: "",
blockNumber: maxBlockNumber + 1 + index,
});
})

setPathologySampleInfo({
...pathologySampleInfo,
blocks: [
...(pathologySampleInfo.blocks || []),
{ id: "", blockNumber: "" },
],
blocks: allBlocks
});
}}
>
Expand Down Expand Up @@ -798,15 +827,41 @@ function PathologyCaseView() {
);
})}

<Column lg={16} md={8} sm={4}>
<Column lg={2} md={8} sm={4}>
<TextInput
id="slidesToAdd"
labelText={intl.formatMessage({ id: "pathology.label.slide.add.number" })}
hideLabel={true}
placeholder={intl.formatMessage({ id: "pathology.label.slide.add.number" })}
value={slidesToAdd}
type="number"
onChange={(e) => {
setSlidesToAdd(e.target.value);
}}
/>
</Column>
<Column lg={14} md={8} sm={4}>
<Button
onClick={() => {
const maxSlideNumber = pathologySampleInfo.slides.reduce(
(max, slide) => {
const slideNumber = slide.slideNumber || 0;
return Math.ceil(Math.max(max, slideNumber));
},
0,
);

var allSlides = pathologySampleInfo.slides || [];
Array.from({ length: slidesToAdd }, (_, index) => {
allSlides.push({
id: "",
slideNumber: maxSlideNumber + 1 + index,
});
})

setPathologySampleInfo({
...pathologySampleInfo,
slides: [
...(pathologySampleInfo.slides || []),
{ id: "", slideNumber: "" },
],
slides: allSlides
});
}}
>
Expand Down
8 changes: 5 additions & 3 deletions frontend/src/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@
"pathology.label.title" : "Pathology",
"pathology.label.blocks" : "Blocks",
"pathology.label.block" : "Block",
"pathology.label.addblock" : "Add Block",
"pathology.label.addblock" : "Add Block(s)",
"pathology.label.slides" : "Slides",
"pathology.label.slide" : "Slide",
"pathology.label.addslide" : "Add Slide",
"pathology.label.addslide" : "Add Slide(s)",
"pathology.label.printlabel" : "Print Label",
"pathology.label.view" : "View",
"pathology.label.dashboard" : "Pathology DashBoard",
Expand Down Expand Up @@ -301,6 +301,8 @@
"label.button.remove.slide": "Remove Slide",
"label.button.remove.block": "Remove Block",
"label.button.remove.report": "Remove Report",
"pathology.label.block.number": "Block number"
"pathology.label.block.number": "Block number",
"pathology.label.block.add.number": "Number of Blocks to add",
"pathology.label.slide.add.number": "Number of Slides to add"

}
4 changes: 2 additions & 2 deletions frontend/src/languages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@
"pathology.label.title" : "Pathologie",
"pathology.label.blocks" : "Blocs",
"pathology.label.block" : "Bloc",
"pathology.label.addblock" : "Ajouter un Bloc",
"pathology.label.addblock" : "Ajouter un Bloc(s)",
"pathology.label.slides" : "Lames",
"pathology.label.slide" : "Lame",
"pathology.label.addslide" : "Ajouter une Lame",
"pathology.label.addslide" : "Ajouter une Lame(s)",
"pathology.label.printlabel" : "Imprimer l'Étiquette",
"pathology.label.view" : "Voir",
"pathology.label.dashboard" : "Tableau de Bord de la Pathologie",
Expand Down

0 comments on commit 78a7c9f

Please sign in to comment.