Skip to content

Commit

Permalink
Merge pull request #75 from EyeSeeTea/feat/move-add-another-treatment…
Browse files Browse the repository at this point in the history
…-button

feat: move add another treatment button to the bottom of section
  • Loading branch information
MiquelAdell authored Dec 19, 2024
2 parents 41bdbc0 + b73aaf9 commit 0a24903
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions src/webapp/components/survey/SurveyForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,25 +116,7 @@ export const SurveyForm: React.FC<SurveyFormProps> = props => {
return (
<PaddedDiv key={stage.id}>
<Typography>{i18n.t(`Stage - ${stage.title}`)}</Typography>
{stage.repeatable && (
<RightAlignedDiv>
<Button
variant="contained"
color="primary"
onClick={() => addProgramStage(stage.code)}
>
{i18n.t(`Add Another ${stage.title}`)}
</Button>
{stage.isAddedByUser && (
<CancelButton
variant="outlined"
onClick={() => removeProgramStage(stage.id)}
>
{i18n.t(`Remove ${stage.title}`)}
</CancelButton>
)}
</RightAlignedDiv>
)}

{stage.sections.map(section => {
if (!section.isVisible || section.isAntibioticSection) return null;

Expand Down Expand Up @@ -172,6 +154,26 @@ export const SurveyForm: React.FC<SurveyFormProps> = props => {
/>
);
})}

{stage.repeatable && (
<RightAlignedDiv>
<Button
variant="contained"
color="primary"
onClick={() => addProgramStage(stage.code)}
>
{i18n.t(`Add Another ${stage.title}`)}
</Button>
{stage.isAddedByUser && (
<CancelButton
variant="outlined"
onClick={() => removeProgramStage(stage.id)}
>
{i18n.t(`Remove ${stage.title}`)}
</CancelButton>
)}
</RightAlignedDiv>
)}
</PaddedDiv>
);
})}
Expand Down

0 comments on commit 0a24903

Please sign in to comment.