Skip to content

Commit

Permalink
Fix changed notes aren't saving (#2194)
Browse files Browse the repository at this point in the history
  • Loading branch information
jadmsaadaot authored May 6, 2024
1 parent e5389f9 commit 453d389
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions epictrack-web/src/components/workPlan/event/EventForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,6 @@ const EventForm = ({

const onSubmitHandler = async (submittedData: MilestoneEvent) => {
try {
submittedData.notes = notes;
const pushRequired = dateCheckStatus?.subsequent_event_push_required;
if (pushRequired) {
setShowEventPushConfirmation(pushRequired);
Expand Down Expand Up @@ -491,38 +490,39 @@ const EventForm = ({
},
[event, pushEvents]
);
const handleSaveEvent = useCallback(
async (
data?: MilestoneEvent,
pushEventConfirmed = false,
confirmSaveInLocked = false
) => {
try {
const dataToBeSubmitted = data ?? getValues();
if (showLockConfirmDialog(dataToBeSubmitted) && !confirmSaveInLocked) {
setShowEventLockDialog(true);
} else {
dataToBeSubmitted.anticipated_date = Moment(
dataToBeSubmitted.anticipated_date
const handleSaveEvent = async (
data?: MilestoneEvent,
pushEventConfirmed = false,
confirmSaveInLocked = false
) => {
try {
const formData = data ?? getValues();
const dataToBeSubmitted = {
...formData,
notes: notes,
};
if (showLockConfirmDialog(dataToBeSubmitted) && !confirmSaveInLocked) {
setShowEventLockDialog(true);
} else {
dataToBeSubmitted.anticipated_date = Moment(
dataToBeSubmitted.anticipated_date
).format();
if (!!dataToBeSubmitted.actual_date) {
dataToBeSubmitted.actual_date = Moment(
dataToBeSubmitted.actual_date
).format();
if (!!dataToBeSubmitted.actual_date) {
dataToBeSubmitted.actual_date = Moment(
dataToBeSubmitted.actual_date
).format();
}
await saveEvent(dataToBeSubmitted, pushEventConfirmed);
onSave();
setDateCheckStatus(undefined);
}
} catch (e) {
const message = getErrorMessage(e);
showNotification(message, {
type: "error",
});
await saveEvent(dataToBeSubmitted, pushEventConfirmed);
onSave();
setDateCheckStatus(undefined);
}
},
[pushEvents, event]
);
} catch (e) {
const message = getErrorMessage(e);
showNotification(message, {
type: "error",
});
}
};

const onChangeMilestoneType = (configuration_id: number) => {
const configuration = configurations.filter(
Expand Down

0 comments on commit 453d389

Please sign in to comment.