From 7600ddf661b605cdaef3695bce50c4328781ccb5 Mon Sep 17 00:00:00 2001 From: dmitri-korin-bcps <108112696+dmitri-korin-bcps@users.noreply.github.com> Date: Wed, 11 Dec 2024 10:26:32 -0800 Subject: [PATCH] fix: CE-1308-and-CE-1307 (#812) Co-authored-by: afwilcox --- .../outcomes/oucome-by-animal/edit-outcome.tsx | 16 ++++++++++++---- .../standalone-cancel-confirm-modal.tsx | 15 +++++++++++++-- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/components/containers/complaints/outcomes/oucome-by-animal/edit-outcome.tsx b/frontend/src/app/components/containers/complaints/outcomes/oucome-by-animal/edit-outcome.tsx index 1df54a955..2c534c448 100644 --- a/frontend/src/app/components/containers/complaints/outcomes/oucome-by-animal/edit-outcome.tsx +++ b/frontend/src/app/components/containers/complaints/outcomes/oucome-by-animal/edit-outcome.tsx @@ -543,9 +543,13 @@ export const EditOutcome: FC = ({ id, index, outcome, assignedOfficer: of placeholder={"Select"} value={getDropdownOption(data.outcome, outcomes)} onChange={(evt) => { - showEditWarning(() => { + if (data?.outcome) { + showEditWarning(() => { + updateModel("outcome", evt?.value); + }); + } else { updateModel("outcome", evt?.value); - }); + } }} defaultOption={getDropdownOption(data.outcome, outcomes)} /> @@ -591,9 +595,13 @@ export const EditOutcome: FC = ({ id, index, outcome, assignedOfficer: of id="equipment-day-set" maxDate={new Date()} onChange={(input: Date) => { - showEditWarning(() => { + if (data?.date) { + showEditWarning(() => { + handleOutcomeDateChange(input); + }); + } else { handleOutcomeDateChange(input); - }); + } }} selectedDate={data?.date} placeholder={"Select"} diff --git a/frontend/src/app/components/modal/instances/standalone-cancel-confirm-modal.tsx b/frontend/src/app/components/modal/instances/standalone-cancel-confirm-modal.tsx index 8466bd337..59d778259 100644 --- a/frontend/src/app/components/modal/instances/standalone-cancel-confirm-modal.tsx +++ b/frontend/src/app/components/modal/instances/standalone-cancel-confirm-modal.tsx @@ -3,7 +3,7 @@ //-- where unable to use the global redux modals //-- -import { FC } from "react"; +import { FC, useEffect, useState } from "react"; import { Button, Col, Modal, Row } from "react-bootstrap"; type props = { @@ -25,11 +25,22 @@ export const StandaloneConfirmCancelModal: FC = ({ confirm, cancel, }) => { + const [showModal, setShowModal] = useState(false); + + useEffect(() => { + setShowModal(show); + }, [show]); + + const handleClose = () => { + cancel(); + }; + return ( {title && (