From e39d623f31d721079f5a63bedac7b2a6122dc617 Mon Sep 17 00:00:00 2001 From: afwilcox Date: Tue, 18 Jun 2024 16:17:07 -0700 Subject: [PATCH] fix: CE-800 Do not default officer/date on outcome (#472) --- .../outcomes/oucome-by-animal/create-outcome.tsx | 6 +++--- .../outcomes/oucome-by-animal/edit-outcome.tsx | 10 +++------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/frontend/src/app/components/containers/complaints/outcomes/oucome-by-animal/create-outcome.tsx b/frontend/src/app/components/containers/complaints/outcomes/oucome-by-animal/create-outcome.tsx index c6e57ee7b..9b354ab03 100644 --- a/frontend/src/app/components/containers/complaints/outcomes/oucome-by-animal/create-outcome.tsx +++ b/frontend/src/app/components/containers/complaints/outcomes/oucome-by-animal/create-outcome.tsx @@ -48,7 +48,7 @@ const defaultOutcome: AnimalOutcomeV2 = { drugs: [], outcome: "", officer: "", - date: new Date(), + date: undefined, order: 0, }; @@ -79,7 +79,7 @@ export const CreateAnimalOutcome: FC = ({ index, assignedOfficer: officer //-- new input data // eslint-disable-line no-console, max-len - const [data, applyData] = useState({ ...defaultOutcome, species, officer }); + const [data, applyData] = useState({ ...defaultOutcome, species }); //-- refs // eslint-disable-next-line @typescript-eslint/no-array-constructor @@ -596,7 +596,7 @@ export const CreateAnimalOutcome: FC = ({ index, assignedOfficer: officer onChange={(input: Date) => { handleOutcomeDateChange(input); }} - selectedDate={!data?.date ? new Date() : data.date} + selectedDate={data?.date} classNamePrefix="comp-details-edit-calendar-input" className={"animal-outcome-details-input"} placeholder={"Select"} 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 690e727ff..13056f569 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 @@ -58,10 +58,7 @@ export const EditOutcome: FC = ({ id, index, outcome, assignedOfficer: of const [showModal, setShowModal] = useState(false); //-- new input data - const [data, applyData] = useState({ - ...outcome, - officer: !outcome.officer ? officer : outcome.officer, - }); + const [data, applyData] = useState({ ...outcome }); //-- refs // eslint-disable-next-line @typescript-eslint/no-array-constructor @@ -326,7 +323,6 @@ export const EditOutcome: FC = ({ id, index, outcome, assignedOfficer: of if (authorizationRef.current && !authorizationRef.current.isValid()) { _isValid = false; } - return _isValid; }; @@ -355,8 +351,8 @@ export const EditOutcome: FC = ({ id, index, outcome, assignedOfficer: of const handleUpdate = () => { if (isValid()) { update(data); + toggle(""); } - toggle(""); }; const handleCancel = () => { @@ -595,7 +591,7 @@ export const EditOutcome: FC = ({ id, index, outcome, assignedOfficer: of onChange={(input: Date) => { handleOutcomeDateChange(input); }} - selectedDate={!data?.date ? new Date() : data.date} + selectedDate={data?.date} classNamePrefix="comp-details-edit-calendar-input" className={"animal-outcome-details-input"} placeholder={"Select"}