Browse Source

update timesheet

tags/Baseline_30082024_FRONTEND_UAT
cyril.tsui 1 year ago
parent
commit
43f922df63
3 changed files with 28 additions and 3 deletions
  1. +8
    -1
      src/components/LeaveTable/LeaveEditModal.tsx
  2. +12
    -1
      src/components/PastEntryCalendar/PastEntryList.tsx
  3. +8
    -1
      src/components/TimesheetTable/TimesheetEditModal.tsx

+ 8
- 1
src/components/LeaveTable/LeaveEditModal.tsx View File

@@ -6,7 +6,7 @@ import {
} from "@/app/api/timesheets/utils"; } from "@/app/api/timesheets/utils";
import { shortDateFormatter } from "@/app/utils/formatUtil"; import { shortDateFormatter } from "@/app/utils/formatUtil";
import { roundToNearestQuarter } from "@/app/utils/manhourUtils"; import { roundToNearestQuarter } from "@/app/utils/manhourUtils";
import { Check, Delete } from "@mui/icons-material";
import { Check, Delete, Close } from "@mui/icons-material";
import { import {
Box, Box,
Button, Button,
@@ -173,6 +173,13 @@ const LeaveEditModal: React.FC<Props> = ({
{t("Delete")} {t("Delete")}
</Button> </Button>
)} )}
<Button
variant="outlined"
startIcon={<Close />}
onClick={(event) => closeHandler(event, "backdropClick")}
>
{t("Close")}
</Button>
<Button <Button
variant="contained" variant="contained"
startIcon={<Check />} startIcon={<Check />}


+ 12
- 1
src/components/PastEntryCalendar/PastEntryList.tsx View File

@@ -2,7 +2,7 @@ import {
RecordTimesheetInput, RecordTimesheetInput,
RecordLeaveInput, RecordLeaveInput,
} from "@/app/api/timesheets/actions"; } from "@/app/api/timesheets/actions";
import { shortDateFormatter } from "@/app/utils/formatUtil";
import { manhourFormatter, shortDateFormatter } from "@/app/utils/formatUtil";
import { Box, Stack, Typography } from "@mui/material"; import { Box, Stack, Typography } from "@mui/material";
import dayjs from "dayjs"; import dayjs from "dayjs";
import React, { useMemo } from "react"; import React, { useMemo } from "react";
@@ -28,6 +28,7 @@ const PastEntryList: React.FC<Props> = ({
allProjects, allProjects,
}) => { }) => {
const { const {
t,
i18n: { language }, i18n: { language },
} = useTranslation("home"); } = useTranslation("home");


@@ -93,6 +94,16 @@ const PastEntryList: React.FC<Props> = ({
leaveTypeMap={leaveTypeMap} leaveTypeMap={leaveTypeMap}
/> />
))} ))}
<Typography
variant="overline"
>
{t("Total Work Hours")}: {manhourFormatter.format(timeEntries.map(entry => (entry.inputHours ?? 0) + (entry.otHours ?? 0)).reduce((acc, cur) => { return acc + cur }, 0))}
</Typography>
<Typography
variant="overline"
>
{t("Total Leave Hours")}: {manhourFormatter.format(leaveEntries.map(entry => entry.inputHours).reduce((acc, cur) => { return acc + cur }, 0))}
</Typography>
</Box> </Box>
</Stack> </Stack>
); );


+ 8
- 1
src/components/TimesheetTable/TimesheetEditModal.tsx View File

@@ -1,5 +1,5 @@
import { TimeEntry } from "@/app/api/timesheets/actions"; import { TimeEntry } from "@/app/api/timesheets/actions";
import { Check, Delete } from "@mui/icons-material";
import { Check, Delete, Close } from "@mui/icons-material";
import { import {
Box, Box,
Button, Button,
@@ -297,6 +297,13 @@ const TimesheetEditModal: React.FC<Props> = ({
{t("Delete")} {t("Delete")}
</Button> </Button>
)} )}
<Button
variant="outlined"
startIcon={<Close />}
onClick={(event) => closeHandler(event, "backdropClick")}
>
{t("Close")}
</Button>
<Button <Button
variant="contained" variant="contained"
startIcon={<Check />} startIcon={<Check />}


Loading…
Cancel
Save