| @@ -36,6 +36,7 @@ interface Props<EntryTableProps = object> { | |||
| EntryTableProps & { day: string; isHoliday: boolean } | |||
| >; | |||
| entryTableProps: EntryTableProps; | |||
| isSaturdayWorker: boolean | |||
| } | |||
| function DateHoursTable<EntryTableProps>({ | |||
| @@ -45,9 +46,9 @@ function DateHoursTable<EntryTableProps>({ | |||
| leaveEntries, | |||
| timesheetEntries, | |||
| companyHolidays, | |||
| isSaturdayWorker, | |||
| }: Props<EntryTableProps>) { | |||
| const { t } = useTranslation("home"); | |||
| return ( | |||
| <TableContainer sx={{ maxHeight: 400 }}> | |||
| <Table stickyHeader> | |||
| @@ -71,6 +72,7 @@ function DateHoursTable<EntryTableProps>({ | |||
| timesheetEntries={timesheetEntries} | |||
| EntryTableComponent={EntryTableComponent} | |||
| entryTableProps={entryTableProps} | |||
| isSaturdayWorker={isSaturdayWorker} | |||
| /> | |||
| ); | |||
| })} | |||
| @@ -87,6 +89,7 @@ function DayRow<EntryTableProps>({ | |||
| entryTableProps, | |||
| EntryTableComponent, | |||
| companyHolidays, | |||
| isSaturdayWorker, | |||
| }: { | |||
| day: string; | |||
| companyHolidays: HolidaysResult[]; | |||
| @@ -96,16 +99,18 @@ function DayRow<EntryTableProps>({ | |||
| EntryTableProps & { day: string; isHoliday: boolean } | |||
| >; | |||
| entryTableProps: EntryTableProps; | |||
| isSaturdayWorker: boolean | |||
| }) { | |||
| const { | |||
| t, | |||
| i18n: { language }, | |||
| } = useTranslation("home"); | |||
| const dayJsObj = dayjs(day); | |||
| const [open, setOpen] = useState(false); | |||
| const [open, setOpen] = useState(false); | |||
| const holiday = getHolidayForDate(day, companyHolidays); | |||
| const isHoliday = holiday || dayJsObj.day() === 0 || dayJsObj.day() === 6; | |||
| const isWeekend = !isSaturdayWorker ? dayJsObj.day() === 0 || dayJsObj.day() === 6 : dayJsObj.day() === 0; | |||
| const isHoliday = holiday || isWeekend; | |||
| const leaves = leaveEntries[day]; | |||
| const leaveHours = | |||
| @@ -54,6 +54,7 @@ interface Props { | |||
| isFullTime: boolean; | |||
| joinDate: Dayjs; | |||
| miscTasks: Task[]; | |||
| isSaturdayWorker: boolean | |||
| } | |||
| const modalSx: SxProps = { | |||
| @@ -81,6 +82,7 @@ const TimeLeaveModal: React.FC<Props> = ({ | |||
| isFullTime, | |||
| joinDate, | |||
| miscTasks, | |||
| isSaturdayWorker, | |||
| }) => { | |||
| const { t } = useTranslation("home"); | |||
| @@ -227,6 +229,7 @@ const TimeLeaveModal: React.FC<Props> = ({ | |||
| leaveTypes, | |||
| miscTasks, | |||
| }} | |||
| isSaturdayWorker={isSaturdayWorker} | |||
| /> | |||
| </Box> | |||
| {errorComponent} | |||
| @@ -43,6 +43,7 @@ export interface Props { | |||
| isFullTime: boolean; | |||
| joinDate?: number | null; | |||
| miscTasks: Task[]; | |||
| isSaturdayWorker: boolean | |||
| } | |||
| const menuItemSx: SxProps = { | |||
| @@ -65,6 +66,7 @@ const UserWorkspacePage: React.FC<Props> = ({ | |||
| isFullTime, | |||
| joinDate, | |||
| miscTasks, | |||
| isSaturdayWorker | |||
| }) => { | |||
| const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null); | |||
| @@ -183,6 +185,7 @@ const UserWorkspacePage: React.FC<Props> = ({ | |||
| allProjects={allProjects} | |||
| leaveTypes={leaveTypes} | |||
| companyHolidays={holidays} | |||
| isSaturdayWorker={isSaturdayWorker} | |||
| /> | |||
| <TimeLeaveModal | |||
| fastEntryEnabled={fastEntryEnabled} | |||
| @@ -197,6 +200,7 @@ const UserWorkspacePage: React.FC<Props> = ({ | |||
| isFullTime={isFullTime} | |||
| joinDate={dayjs(joinDate)} | |||
| miscTasks={miscTasks} | |||
| isSaturdayWorker={isSaturdayWorker} | |||
| /> | |||
| <LeaveModal | |||
| open={isLeaveCalendarVisible} | |||
| @@ -16,6 +16,7 @@ import { | |||
| MAINTAIN_TIMESHEET_FAST_TIME_ENTRY, | |||
| MAINTAIN_NORMAL_STAFF_WORKSPACE, | |||
| MAINTAIN_MANAGEMENT_STAFF_WORKSPACE, | |||
| SATURDAY_WORKERS | |||
| } from "@/middleware"; | |||
| import { fetchAllTasks } from "@/app/api/tasks"; | |||
| @@ -59,6 +60,8 @@ const UserWorkspaceWrapper: React.FC = async () => { | |||
| const miscTasks = allTasks.filter((t) => t.taskGroup.id === 5); | |||
| const isSaturdayWorker = abilities.includes(SATURDAY_WORKERS) | |||
| return ( | |||
| <UserWorkspacePage | |||
| joinDate={userStaff?.joinDate} | |||
| @@ -78,6 +81,7 @@ const UserWorkspaceWrapper: React.FC = async () => { | |||
| maintainManagementStaffWorkspaceAbility={ | |||
| maintainManagementStaffWorkspaceAbility | |||
| } | |||
| isSaturdayWorker={isSaturdayWorker} | |||
| /> | |||
| ); | |||
| }; | |||
| @@ -58,14 +58,6 @@ export const authOptions: AuthOptions = { | |||
| jwt(params) { | |||
| // Add the data from user to the token | |||
| const { token, user, account, trigger, session } = params; | |||
| // console.log("--------------------------") | |||
| // console.log("%c [ token ]:", 'font-size:13px; background:#A888B5; color:#bf2c9f;', token) | |||
| // console.log("%c [ user ]:", 'font-size:13px; background:pink; color:#bf2c9f;', user) | |||
| // console.log("%c [ account ]:", 'font-size:13px; background:pink; color:#bf2c9f;', account) | |||
| // console.log("%c [ session ]:", 'font-size:13px; background:#FFD2A0; color:#bf2c9f;', session) | |||
| // console.log("%c [ trigger ]:", 'font-size:13px; background:#EFB6C8; color:#bf2c9f;', trigger) | |||
| // console.log(params) | |||
| // console.log("--------------------------") | |||
| if (trigger === "update" && session?.accessToken && session?.refreshToken) { | |||
| token.accessToken = session.accessToken | |||
| @@ -71,7 +71,8 @@ export const [ | |||
| GENERATE_PROJECT_CASH_FLOW_REPORT, | |||
| GENERATE_STAFF_MONTHLY_WORK_HOURS_ANALYSIS_REPORT, | |||
| GENERATE_CROSS_TEAM_CHARGE_REPORT, | |||
| VIEW_ALL_PROJECTS | |||
| VIEW_ALL_PROJECTS, | |||
| SATURDAY_WORKERS | |||
| ] = [ | |||
| 'MAINTAIN_USER', | |||
| 'MAINTAIN_TIMESHEET', | |||
| @@ -124,7 +125,8 @@ export const [ | |||
| 'G_PROJECT_CASH_FLOW_REPORT', | |||
| 'G_STAFF_MONTHLY_WORK_HOURS_ANALYSIS_REPORT', | |||
| 'G_CROSS_TEAM_CHARGE_REPORT', | |||
| 'VIEW_ALL_PROJECTS' | |||
| 'VIEW_ALL_PROJECTS', | |||
| 'SATURDAY_WORKERS' | |||
| ] | |||
| const PRIVATE_ROUTES = [ | |||