From 6a9a9f4ceeca460714d06484514153d25580724b Mon Sep 17 00:00:00 2001 From: JOSEPH LE Date: Fri, 7 Jun 2024 14:33:23 +0700 Subject: [PATCH] update timekeeping --- .../src/pages/Timekeeping/Timekeeping.tsx | 75 ++++++++++++++----- 1 file changed, 56 insertions(+), 19 deletions(-) diff --git a/FRONTEND/src/pages/Timekeeping/Timekeeping.tsx b/FRONTEND/src/pages/Timekeeping/Timekeeping.tsx index 882d050..fca71c9 100644 --- a/FRONTEND/src/pages/Timekeeping/Timekeeping.tsx +++ b/FRONTEND/src/pages/Timekeeping/Timekeeping.tsx @@ -56,7 +56,11 @@ const Timekeeping = () => { year: date.year, }) if (res.status) { - setData(res.data.filter((u:UserData)=>permission.includes(u.user.permission))) + setData( + res.data.filter((u: UserData) => + permission.includes(u.user.permission), + ), + ) setDaysInMonth( Array.from({ length: getDaysInMonth() }, (_, index) => index + 1), ) @@ -104,7 +108,7 @@ const Timekeeping = () => { @@ -128,12 +132,22 @@ const Timekeeping = () => { > - +
Day {daysInMonth.map((d) => { - return {d} + return ( + + {d} + + ) })} @@ -150,11 +164,8 @@ const Timekeeping = () => { {data.map((user) => { return ( - - {user.user.name} + + {user.user.name} {daysInMonth.map((d) => { var total = user.history.find((h) => h.day === d)?.total ?? 0 @@ -163,7 +174,6 @@ const Timekeeping = () => { {total / 60 / 60 < 8 && total !== 0 ? ( {`Total: ${(total / 60 / 60).toFixed(1)}h`} @@ -171,7 +181,34 @@ const Timekeeping = () => { .find((h) => h.day === d) ?.values.map((v) => { return ( -

{v.status + ': ' + v.time_string}

{v.image&&}
+ +

{v.status + ': ' + v.time_string}

{' '} + {v.image && ( + + )} +
) })} @@ -182,9 +219,9 @@ const Timekeeping = () => { style={{ backgroundColor: 'orange', color: 'white', - borderRadius:"5px", - padding: "2px", - fontWeight: 700 + borderRadius: '5px', + padding: '2px', + fontWeight: 700, }} />
@@ -209,8 +246,8 @@ const Timekeeping = () => { style={{ backgroundColor: 'green', color: 'white', - borderRadius:"5px", - padding: "2px" + borderRadius: '5px', + padding: '2px', }} /> @@ -220,8 +257,8 @@ const Timekeeping = () => { style={{ backgroundColor: '#ff4646', color: 'white', - borderRadius:"5px", - padding: "2px" + borderRadius: '5px', + padding: '2px', }} /> )}