Skip to content

Commit

Permalink
fix: CE-800 Do not default officer/date on outcome (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
afwilcox authored Jun 18, 2024
1 parent 5210f0b commit e39d623
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const defaultOutcome: AnimalOutcomeV2 = {
drugs: [],
outcome: "",
officer: "",
date: new Date(),
date: undefined,
order: 0,
};

Expand Down Expand Up @@ -79,7 +79,7 @@ export const CreateAnimalOutcome: FC<props> = ({ index, assignedOfficer: officer

//-- new input data
// eslint-disable-line no-console, max-len
const [data, applyData] = useState<AnimalOutcomeV2>({ ...defaultOutcome, species, officer });
const [data, applyData] = useState<AnimalOutcomeV2>({ ...defaultOutcome, species });

//-- refs
// eslint-disable-next-line @typescript-eslint/no-array-constructor
Expand Down Expand Up @@ -596,7 +596,7 @@ export const CreateAnimalOutcome: FC<props> = ({ 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"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ export const EditOutcome: FC<props> = ({ id, index, outcome, assignedOfficer: of
const [showModal, setShowModal] = useState(false);

//-- new input data
const [data, applyData] = useState<AnimalOutcomeV2>({
...outcome,
officer: !outcome.officer ? officer : outcome.officer,
});
const [data, applyData] = useState<AnimalOutcomeV2>({ ...outcome });

//-- refs
// eslint-disable-next-line @typescript-eslint/no-array-constructor
Expand Down Expand Up @@ -326,7 +323,6 @@ export const EditOutcome: FC<props> = ({ id, index, outcome, assignedOfficer: of
if (authorizationRef.current && !authorizationRef.current.isValid()) {
_isValid = false;
}

return _isValid;
};

Expand Down Expand Up @@ -355,8 +351,8 @@ export const EditOutcome: FC<props> = ({ id, index, outcome, assignedOfficer: of
const handleUpdate = () => {
if (isValid()) {
update(data);
toggle("");
}
toggle("");
};

const handleCancel = () => {
Expand Down Expand Up @@ -595,7 +591,7 @@ export const EditOutcome: FC<props> = ({ 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"}
Expand Down

0 comments on commit e39d623

Please sign in to comment.