| @@ -19,6 +19,7 @@ import { | |||||
| } from "@/app/api/customer"; | } from "@/app/api/customer"; | ||||
| import { fetchGrades } from "@/app/api/grades"; | import { fetchGrades } from "@/app/api/grades"; | ||||
| import { fetchUserAbilities, fetchUserStaff } from "@/app/utils/fetchUtil"; | import { fetchUserAbilities, fetchUserStaff } from "@/app/utils/fetchUtil"; | ||||
| import { MAINTAIN_ALL_PROJECTS } from "@/middleware"; | |||||
| type CreateProjectProps = { | type CreateProjectProps = { | ||||
| isEditMode?: false; | isEditMode?: false; | ||||
| @@ -80,14 +81,25 @@ const CreateProjectWrapper: React.FC<Props> = async (props) => { | |||||
| ]); | ]); | ||||
| const userStaff = await fetchUserStaff(); | const userStaff = await fetchUserStaff(); | ||||
| const teamId = userStaff?.teamId; | const teamId = userStaff?.teamId; | ||||
| const isMaintainAllProjectsRight = [MAINTAIN_ALL_PROJECTS].some((ability) => | |||||
| abilities.includes(ability), | |||||
| ); | |||||
| var filteredTeamLeads = teamId ? teamLeads.filter( | var filteredTeamLeads = teamId ? teamLeads.filter( | ||||
| (teamLead) => teamLead.teamId === teamId, | (teamLead) => teamLead.teamId === teamId, | ||||
| ) : teamLeads | ) : teamLeads | ||||
| if (userStaff?.id != null && userStaff?.id == 1) { | if (userStaff?.id != null && userStaff?.id == 1) { | ||||
| filteredTeamLeads = teamLeads.filter( | filteredTeamLeads = teamLeads.filter( | ||||
| (teamLead) => teamLead.teamId === teamId || teamLead.team == "ST", | (teamLead) => teamLead.teamId === teamId || teamLead.team == "ST", | ||||
| ) | ) | ||||
| } | } | ||||
| if(isMaintainAllProjectsRight){ | |||||
| filteredTeamLeads = teamLeads | |||||
| } | |||||
| const projectInfo = props.isEditMode || props.isCopyMode | const projectInfo = props.isEditMode || props.isCopyMode | ||||
| ? await fetchProjectDetails(props.projectId!) | ? await fetchProjectDetails(props.projectId!) | ||||
| : undefined; | : undefined; | ||||
| @@ -38,9 +38,9 @@ const GenerateLastModifiedReport: React.FC<Props> = ({ projects, companyHolidays | |||||
| paramName: "dayRange", | paramName: "dayRange", | ||||
| type: "autocomplete", | type: "autocomplete", | ||||
| options: [ | options: [ | ||||
| {label: t("30 Days"), value: 30}, | |||||
| {label: t("60 Days"), value: 60}, | |||||
| {label: t("90 Days"), value: 90}, | |||||
| {label: t("Past 30 Days"), value: 30}, | |||||
| {label: t("Past 60 Days"), value: 60}, | |||||
| {label: t("Past 90 Days"), value: 90}, | |||||
| ], | ], | ||||
| needAll: false | needAll: false | ||||
| } | } | ||||
| @@ -95,10 +95,10 @@ const MailSetting: React.FC<Props> = ({ | |||||
| try { | try { | ||||
| // msg = "testEveryone" | // msg = "testEveryone" | ||||
| // await testEveryone() | // await testEveryone() | ||||
| // msg = "test7th" | |||||
| // await test7th() | |||||
| msg = "test15th" | |||||
| await test15th() | |||||
| msg = "test7th" | |||||
| await test7th() | |||||
| // msg = "test15th" | |||||
| // await test15th() | |||||
| } catch (error) { | } catch (error) { | ||||
| console.log(error) | console.log(error) | ||||
| console.log(msg) | console.log(msg) | ||||
| @@ -81,7 +81,10 @@ import { | |||||
| GENERATE_STAFF_MONTHLY_WORK_HOURS_ANALYSIS_REPORT, | GENERATE_STAFF_MONTHLY_WORK_HOURS_ANALYSIS_REPORT, | ||||
| GENERATE_CROSS_TEAM_CHARGE_REPORT, | GENERATE_CROSS_TEAM_CHARGE_REPORT, | ||||
| VIEW_MAIL, | VIEW_MAIL, | ||||
| MAINTAIN_MAIL | |||||
| MAINTAIN_MAIL, | |||||
| G_PROJ_MANHOUR_SUMMARY_MONTHLY_REPORT, | |||||
| G_PROJ_MANHOUR_SUMMARY_DAILY_REPORT, | |||||
| GENERATE_LAST_MODIFIED_REPORT | |||||
| } from "@/middleware"; | } from "@/middleware"; | ||||
| import { SessionWithAbilities } from "../AppBar/NavigationToggle"; | import { SessionWithAbilities } from "../AppBar/NavigationToggle"; | ||||
| import { authOptions } from "@/config/authConfig"; | import { authOptions } from "@/config/authConfig"; | ||||
| @@ -232,7 +235,10 @@ const NavigationContent: React.FC<Props> = ({ abilities, username }) => { | |||||
| GENERATE_FINANCIAL_STATUS_REPORT, | GENERATE_FINANCIAL_STATUS_REPORT, | ||||
| GENERATE_PROJECT_CASH_FLOW_REPORT, | GENERATE_PROJECT_CASH_FLOW_REPORT, | ||||
| GENERATE_STAFF_MONTHLY_WORK_HOURS_ANALYSIS_REPORT, | GENERATE_STAFF_MONTHLY_WORK_HOURS_ANALYSIS_REPORT, | ||||
| GENERATE_CROSS_TEAM_CHARGE_REPORT | |||||
| GENERATE_CROSS_TEAM_CHARGE_REPORT, | |||||
| G_PROJ_MANHOUR_SUMMARY_MONTHLY_REPORT, | |||||
| G_PROJ_MANHOUR_SUMMARY_DAILY_REPORT, | |||||
| GENERATE_LAST_MODIFIED_REPORT | |||||
| ].some((ability) => | ].some((ability) => | ||||
| abilities!.includes(ability), | abilities!.includes(ability), | ||||
| ), | ), | ||||
| @@ -315,12 +321,18 @@ const NavigationContent: React.FC<Props> = ({ abilities, username }) => { | |||||
| icon: <Analytics />, | icon: <Analytics />, | ||||
| label: "Project Manhour Summary Monthly Report", | label: "Project Manhour Summary Monthly Report", | ||||
| path: "/analytics/ProjectManhourSummaryReport", | path: "/analytics/ProjectManhourSummaryReport", | ||||
| isHidden: false | |||||
| isHidden: ![G_PROJ_MANHOUR_SUMMARY_MONTHLY_REPORT].some((ability) => | |||||
| abilities!.includes(ability), | |||||
| ), | |||||
| // isHidden: false | |||||
| }, | }, | ||||
| { | { | ||||
| icon: <Analytics />, | icon: <Analytics />, | ||||
| label: "Project Manhour Summary Daily Report", | label: "Project Manhour Summary Daily Report", | ||||
| path: "/analytics/ProjectMonthlyReport", | path: "/analytics/ProjectMonthlyReport", | ||||
| isHidden: ![G_PROJ_MANHOUR_SUMMARY_DAILY_REPORT].some((ability) => | |||||
| abilities!.includes(ability), | |||||
| ), | |||||
| }, | }, | ||||
| { | { | ||||
| icon: <Analytics />, | icon: <Analytics />, | ||||
| @@ -342,6 +354,9 @@ const NavigationContent: React.FC<Props> = ({ abilities, username }) => { | |||||
| icon: <Analytics />, | icon: <Analytics />, | ||||
| label: "Last Modified Report", | label: "Last Modified Report", | ||||
| path: "/analytics/LastModifiedReport", | path: "/analytics/LastModifiedReport", | ||||
| isHidden: ![GENERATE_LAST_MODIFIED_REPORT].some((ability) => | |||||
| abilities!.includes(ability), | |||||
| ), | |||||
| }, | }, | ||||
| ], | ], | ||||
| }, | }, | ||||
| @@ -71,7 +71,11 @@ export const [ | |||||
| GENERATE_PROJECT_CASH_FLOW_REPORT, | GENERATE_PROJECT_CASH_FLOW_REPORT, | ||||
| GENERATE_STAFF_MONTHLY_WORK_HOURS_ANALYSIS_REPORT, | GENERATE_STAFF_MONTHLY_WORK_HOURS_ANALYSIS_REPORT, | ||||
| GENERATE_CROSS_TEAM_CHARGE_REPORT, | GENERATE_CROSS_TEAM_CHARGE_REPORT, | ||||
| G_PROJ_MANHOUR_SUMMARY_MONTHLY_REPORT, | |||||
| G_PROJ_MANHOUR_SUMMARY_DAILY_REPORT, | |||||
| GENERATE_LAST_MODIFIED_REPORT, | |||||
| VIEW_ALL_PROJECTS, | VIEW_ALL_PROJECTS, | ||||
| MAINTAIN_ALL_PROJECTS, | |||||
| SATURDAY_WORKERS | SATURDAY_WORKERS | ||||
| ] = [ | ] = [ | ||||
| 'MAINTAIN_USER', | 'MAINTAIN_USER', | ||||
| @@ -125,7 +129,11 @@ export const [ | |||||
| 'G_PROJECT_CASH_FLOW_REPORT', | 'G_PROJECT_CASH_FLOW_REPORT', | ||||
| 'G_STAFF_MONTHLY_WORK_HOURS_ANALYSIS_REPORT', | 'G_STAFF_MONTHLY_WORK_HOURS_ANALYSIS_REPORT', | ||||
| 'G_CROSS_TEAM_CHARGE_REPORT', | 'G_CROSS_TEAM_CHARGE_REPORT', | ||||
| 'G_PROJ_MANHOUR_SUMMARY_MONTHLY_R', | |||||
| 'G_PROJ_MANHOUR_SUMMARY_DAILY_R', | |||||
| 'G_LAST_MODIFIED_REPORT', | |||||
| 'VIEW_ALL_PROJECTS', | 'VIEW_ALL_PROJECTS', | ||||
| 'MAINTAIN_ALL_PROJECTS', | |||||
| 'SATURDAY_WORKERS' | 'SATURDAY_WORKERS' | ||||
| ] | ] | ||||