This reverts commit 7d983ad5a9.
tags/Baseline_180220205_Frontend^2
| @@ -36,7 +36,6 @@ interface Props<EntryTableProps = object> { | |||
| EntryTableProps & { day: string; isHoliday: boolean } | |||
| >; | |||
| entryTableProps: EntryTableProps; | |||
| isSaturdayWorker: boolean | |||
| } | |||
| function DateHoursTable<EntryTableProps>({ | |||
| @@ -46,9 +45,9 @@ function DateHoursTable<EntryTableProps>({ | |||
| leaveEntries, | |||
| timesheetEntries, | |||
| companyHolidays, | |||
| isSaturdayWorker, | |||
| }: Props<EntryTableProps>) { | |||
| const { t } = useTranslation("home"); | |||
| return ( | |||
| <TableContainer sx={{ maxHeight: 400 }}> | |||
| <Table stickyHeader> | |||
| @@ -72,7 +71,6 @@ function DateHoursTable<EntryTableProps>({ | |||
| timesheetEntries={timesheetEntries} | |||
| EntryTableComponent={EntryTableComponent} | |||
| entryTableProps={entryTableProps} | |||
| isSaturdayWorker={isSaturdayWorker} | |||
| /> | |||
| ); | |||
| })} | |||
| @@ -89,7 +87,6 @@ function DayRow<EntryTableProps>({ | |||
| entryTableProps, | |||
| EntryTableComponent, | |||
| companyHolidays, | |||
| isSaturdayWorker, | |||
| }: { | |||
| day: string; | |||
| companyHolidays: HolidaysResult[]; | |||
| @@ -99,18 +96,16 @@ 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 holiday = getHolidayForDate(day, companyHolidays); | |||
| const isWeekend = !isSaturdayWorker ? dayJsObj.day() === 0 || dayJsObj.day() === 6 : dayJsObj.day() === 0; | |||
| const isHoliday = holiday || isWeekend; | |||
| const isHoliday = holiday || dayJsObj.day() === 0 || dayJsObj.day() === 6; | |||
| const leaves = leaveEntries[day]; | |||
| const leaveHours = | |||
| @@ -54,7 +54,6 @@ interface Props { | |||
| isFullTime: boolean; | |||
| joinDate: Dayjs; | |||
| miscTasks: Task[]; | |||
| isSaturdayWorker: boolean | |||
| } | |||
| const modalSx: SxProps = { | |||
| @@ -82,7 +81,6 @@ const TimeLeaveModal: React.FC<Props> = ({ | |||
| isFullTime, | |||
| joinDate, | |||
| miscTasks, | |||
| isSaturdayWorker, | |||
| }) => { | |||
| const { t } = useTranslation("home"); | |||
| @@ -229,7 +227,6 @@ const TimeLeaveModal: React.FC<Props> = ({ | |||
| leaveTypes, | |||
| miscTasks, | |||
| }} | |||
| isSaturdayWorker={isSaturdayWorker} | |||
| /> | |||
| </Box> | |||
| {errorComponent} | |||
| @@ -43,7 +43,6 @@ export interface Props { | |||
| isFullTime: boolean; | |||
| joinDate?: number | null; | |||
| miscTasks: Task[]; | |||
| isSaturdayWorker: boolean | |||
| } | |||
| const menuItemSx: SxProps = { | |||
| @@ -66,7 +65,6 @@ const UserWorkspacePage: React.FC<Props> = ({ | |||
| isFullTime, | |||
| joinDate, | |||
| miscTasks, | |||
| isSaturdayWorker | |||
| }) => { | |||
| const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null); | |||
| @@ -185,7 +183,6 @@ const UserWorkspacePage: React.FC<Props> = ({ | |||
| allProjects={allProjects} | |||
| leaveTypes={leaveTypes} | |||
| companyHolidays={holidays} | |||
| isSaturdayWorker={isSaturdayWorker} | |||
| /> | |||
| <TimeLeaveModal | |||
| fastEntryEnabled={fastEntryEnabled} | |||
| @@ -200,7 +197,6 @@ const UserWorkspacePage: React.FC<Props> = ({ | |||
| isFullTime={isFullTime} | |||
| joinDate={dayjs(joinDate)} | |||
| miscTasks={miscTasks} | |||
| isSaturdayWorker={isSaturdayWorker} | |||
| /> | |||
| <LeaveModal | |||
| open={isLeaveCalendarVisible} | |||
| @@ -16,7 +16,6 @@ import { | |||
| MAINTAIN_TIMESHEET_FAST_TIME_ENTRY, | |||
| MAINTAIN_NORMAL_STAFF_WORKSPACE, | |||
| MAINTAIN_MANAGEMENT_STAFF_WORKSPACE, | |||
| SATURDAY_WORKERS | |||
| } from "@/middleware"; | |||
| import { fetchAllTasks } from "@/app/api/tasks"; | |||
| @@ -60,8 +59,6 @@ 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} | |||
| @@ -81,7 +78,6 @@ const UserWorkspaceWrapper: React.FC = async () => { | |||
| maintainManagementStaffWorkspaceAbility={ | |||
| maintainManagementStaffWorkspaceAbility | |||
| } | |||
| isSaturdayWorker={isSaturdayWorker} | |||
| /> | |||
| ); | |||
| }; | |||
| @@ -58,6 +58,14 @@ 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,8 +71,7 @@ export const [ | |||
| GENERATE_PROJECT_CASH_FLOW_REPORT, | |||
| GENERATE_STAFF_MONTHLY_WORK_HOURS_ANALYSIS_REPORT, | |||
| GENERATE_CROSS_TEAM_CHARGE_REPORT, | |||
| VIEW_ALL_PROJECTS, | |||
| SATURDAY_WORKERS | |||
| VIEW_ALL_PROJECTS | |||
| ] = [ | |||
| 'MAINTAIN_USER', | |||
| 'MAINTAIN_TIMESHEET', | |||
| @@ -125,8 +124,7 @@ export const [ | |||
| 'G_PROJECT_CASH_FLOW_REPORT', | |||
| 'G_STAFF_MONTHLY_WORK_HOURS_ANALYSIS_REPORT', | |||
| 'G_CROSS_TEAM_CHARGE_REPORT', | |||
| 'VIEW_ALL_PROJECTS', | |||
| 'SATURDAY_WORKERS' | |||
| 'VIEW_ALL_PROJECTS' | |||
| ] | |||
| const PRIVATE_ROUTES = [ | |||