fixed endet at and duration not set after grouptask finished

main
alex 2023-11-01 21:04:22 +01:00
parent 4e66d10a51
commit 97e25d4d0c
1 changed files with 84 additions and 76 deletions

View File

@ -643,6 +643,89 @@ export default function GroupTasksViewModal({ isOpen }) {
); );
}; };
const PopoverContent = () => {
// get current group task from useState as endetAt and duration not updated only with currentGroupTask as it is a useRef
const cGroupTask = groupTasksContext.groupTasks.find(
(g) => g.Id === currentGroupTask.current.Id
);
return (
<div key={paramGroupTaskId}>
<h1
style={{
color: Constants.COLORS.PRIMARY,
fontWeight: "bold",
marginBottom: 0,
}}
>
{currentGroupTask.current.GroupName}{" "}
<Popover
trigger="click"
title={
<h2
style={{
fontWeight: "bold",
color: Constants.COLORS.SECONDARY,
}}
>
{t("groupTasks.groupTasksViewModal.popover.details")}
</h2>
}
content={
<>
<p style={{ margin: 0 }}>
<span style={{ fontWeight: "bold" }}>ID:</span>{" "}
{paramGroupTaskId} <br />
<span style={{ fontWeight: "bold" }}>
{t("groupTasks.groupTasksViewModal.category")}:
</span>{" "}
{currentGroupTask.current.Category}
<br />
<span style={{ fontWeight: "bold" }}>
{t("groupTasks.groupTasksViewModal.startedAt")}:
</span>{" "}
{FormatDatetime(currentGroupTask.current.StartedAt)}
<br />
<span style={{ fontWeight: "bold" }}>
{t("groupTasks.groupTasksViewModal.endedAt")}:
</span>{" "}
{FormatDatetime(cGroupTask.EndedAt)}
<br />
<span style={{ fontWeight: "bold" }}>
{t("groupTasks.groupTasksViewModal.duration")}:
</span>{" "}
{GetDuration(cGroupTask.StartedAt, cGroupTask.EndedAt)}
</p>
<GlobalInputs />
</>
}
>
<InfoCircleOutlined
style={{
fontSize: "18px",
color: Constants.COLORS.ICON_INFO,
marginBottom: "4px",
verticalAlign: "middle",
}}
/>
</Popover>{" "}
<MyAvatar
tooltip
allUsers={appContext.users}
userId={currentGroupTask.current.CreatorUserId}
/>
<br />
</h1>
<div style={{ marginBottom: 16 }}>
<span>{currentGroupTask.current.Description}</span>
</div>
<Steps direction="vertical" items={stepsItemHandler()} />
</div>
);
};
return ( return (
<MyModal isOpen={isOpen} onCancel={handleCancel}> <MyModal isOpen={isOpen} onCancel={handleCancel}>
{notificationContextHolder} {notificationContextHolder}
@ -658,82 +741,7 @@ export default function GroupTasksViewModal({ isOpen }) {
resultTitle={t("groupTasks.groupTasksViewModal.groupTaskNotFound")} resultTitle={t("groupTasks.groupTasksViewModal.groupTaskNotFound")}
/> />
) : ( ) : (
<div key={paramGroupTaskId}> <PopoverContent />
<h1
style={{
color: Constants.COLORS.PRIMARY,
fontWeight: "bold",
marginBottom: 0,
}}
>
{currentGroupTask.current.GroupName}{" "}
<Popover
trigger="click"
title={
<h2
style={{
fontWeight: "bold",
color: Constants.COLORS.SECONDARY,
}}
>
{t("groupTasks.groupTasksViewModal.popover.details")}
</h2>
}
content={
<>
<p style={{ margin: 0 }}>
<span style={{ fontWeight: "bold" }}>ID:</span>{" "}
{paramGroupTaskId} <br />
<span style={{ fontWeight: "bold" }}>
{t("groupTasks.groupTasksViewModal.category")}:
</span>{" "}
{currentGroupTask.current.Category}
<br />
<span style={{ fontWeight: "bold" }}>
{t("groupTasks.groupTasksViewModal.startedAt")}:
</span>{" "}
{FormatDatetime(currentGroupTask.current.StartedAt)}
<br />
<span style={{ fontWeight: "bold" }}>
{t("groupTasks.groupTasksViewModal.endedAt")}:
</span>{" "}
{FormatDatetime(currentGroupTask.current.EndedAt)}
<br />
<span style={{ fontWeight: "bold" }}>
{t("groupTasks.groupTasksViewModal.duration")}:
</span>{" "}
{GetDuration(
currentGroupTask.current.StartedAt,
currentGroupTask.current.EndedAt
)}
</p>
<GlobalInputs />
</>
}
>
<InfoCircleOutlined
style={{
fontSize: "18px",
color: Constants.COLORS.ICON_INFO,
marginBottom: "4px",
verticalAlign: "middle",
}}
/>
</Popover>{" "}
<MyAvatar
tooltip
allUsers={appContext.users}
userId={currentGroupTask.current.CreatorUserId}
/>
<br />
</h1>
<div style={{ marginBottom: 16 }}>
<span>{currentGroupTask.current.Description}</span>
</div>
<Steps direction="vertical" items={stepsItemHandler()} />
</div>
)} )}
</MyModal> </MyModal>
); );