clean code fe page Timekeeping
This commit is contained in:
parent
072d8ccad7
commit
72b586e94a
|
|
@ -4,7 +4,7 @@ import {
|
|||
getTheTimesheet,
|
||||
updateMultipleUserWorkingTime,
|
||||
updateNote,
|
||||
updateWorkingDays
|
||||
updateWorkingDays,
|
||||
} from '@/api/Admin'
|
||||
import { update, Xdelete } from '@/rtk/helpers/CRUD'
|
||||
import { get } from '@/rtk/helpers/apiService'
|
||||
|
|
@ -20,7 +20,7 @@ import {
|
|||
Text,
|
||||
Textarea,
|
||||
TextInput,
|
||||
Tooltip
|
||||
Tooltip,
|
||||
} from '@mantine/core'
|
||||
import { useDisclosure } from '@mantine/hooks'
|
||||
import { notifications } from '@mantine/notifications'
|
||||
|
|
@ -418,6 +418,21 @@ const Timekeeping = () => {
|
|||
}
|
||||
}
|
||||
|
||||
const handleOpenNote = (user: UserData, d: number) => {
|
||||
open2()
|
||||
setCustomAddNotes({
|
||||
...customAddNotes,
|
||||
day: d,
|
||||
user: {
|
||||
id: user.user.id,
|
||||
name: user.user.name,
|
||||
},
|
||||
notes:
|
||||
user.history.find((h) => h.day === d && h.notes && h.notes.length > 0)
|
||||
?.notes ?? [],
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className={classes.title}>
|
||||
|
|
@ -903,22 +918,7 @@ const Timekeeping = () => {
|
|||
fontWeight: 700,
|
||||
}}
|
||||
onClick={() => {
|
||||
open2()
|
||||
setCustomAddNotes({
|
||||
...customAddNotes,
|
||||
day: d,
|
||||
user: {
|
||||
id: user.user.id,
|
||||
name: user.user.name,
|
||||
},
|
||||
notes:
|
||||
user.history.find(
|
||||
(h) =>
|
||||
h.day === d &&
|
||||
h.notes &&
|
||||
h.notes.length > 0,
|
||||
)?.notes ?? [],
|
||||
})
|
||||
handleOpenNote(user, d)
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
|
|
@ -937,22 +937,7 @@ const Timekeeping = () => {
|
|||
fontWeight: 700,
|
||||
}}
|
||||
onClick={() => {
|
||||
open2()
|
||||
setCustomAddNotes({
|
||||
...customAddNotes,
|
||||
day: d,
|
||||
user: {
|
||||
id: user.user.id,
|
||||
name: user.user.name,
|
||||
},
|
||||
notes:
|
||||
user.history.find(
|
||||
(h) =>
|
||||
h.day === d &&
|
||||
h.notes &&
|
||||
h.notes.length > 0,
|
||||
)?.notes ?? [],
|
||||
})
|
||||
handleOpenNote(user, d)
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
|
|
@ -972,22 +957,7 @@ const Timekeeping = () => {
|
|||
padding: '2px',
|
||||
}}
|
||||
onClick={() => {
|
||||
open2()
|
||||
setCustomAddNotes({
|
||||
...customAddNotes,
|
||||
day: d,
|
||||
user: {
|
||||
id: user.user.id,
|
||||
name: user.user.name,
|
||||
},
|
||||
notes:
|
||||
user.history.find(
|
||||
(h) =>
|
||||
h.day === d &&
|
||||
h.notes &&
|
||||
h.notes.length > 0,
|
||||
)?.notes ?? [],
|
||||
})
|
||||
handleOpenNote(user, d)
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
|
|
@ -1012,22 +982,7 @@ const Timekeeping = () => {
|
|||
}}
|
||||
id={`indexBySN${user.user.id}_${d}`}
|
||||
onClick={() => {
|
||||
open2()
|
||||
setCustomAddNotes({
|
||||
...customAddNotes,
|
||||
day: d,
|
||||
user: {
|
||||
id: user.user.id,
|
||||
name: user.user.name,
|
||||
},
|
||||
notes:
|
||||
user.history.find(
|
||||
(h) =>
|
||||
h.day === d &&
|
||||
h.notes &&
|
||||
h.notes.length > 0,
|
||||
)?.notes ?? [],
|
||||
})
|
||||
handleOpenNote(user, d)
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
|
|
@ -1042,22 +997,7 @@ const Timekeeping = () => {
|
|||
}}
|
||||
id={`indexBySN${user.user.id}_${d}`}
|
||||
onClick={() => {
|
||||
open2()
|
||||
setCustomAddNotes({
|
||||
...customAddNotes,
|
||||
day: d,
|
||||
user: {
|
||||
id: user.user.id,
|
||||
name: user.user.name,
|
||||
},
|
||||
notes:
|
||||
user.history.find(
|
||||
(h) =>
|
||||
h.day === d &&
|
||||
h.notes &&
|
||||
h.notes.length > 0,
|
||||
)?.notes ?? [],
|
||||
})
|
||||
handleOpenNote(user, d)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
|
|
|||
Loading…
Reference in New Issue