@@ -0,0 +1,17 @@ | |||||
import { getServerI18n } from "@/i18n"; | |||||
import { Stack, Typography, Link } from "@mui/material"; | |||||
import NextLink from "next/link"; | |||||
export default async function NotFound() { | |||||
const { t } = await getServerI18n("projects", "common"); | |||||
return ( | |||||
<Stack spacing={2}> | |||||
<Typography variant="h4">{t("Not Found")}</Typography> | |||||
<Typography variant="body1">{t("The create project page was not found!")}</Typography> | |||||
<Link href="/projects" component={NextLink} variant="body2"> | |||||
{t("Return to all projects")} | |||||
</Link> | |||||
</Stack> | |||||
); | |||||
} |
@@ -11,10 +11,13 @@ import { | |||||
} from "@/app/api/projects"; | } from "@/app/api/projects"; | ||||
import { preloadStaff, preloadTeamLeads } from "@/app/api/staff"; | import { preloadStaff, preloadTeamLeads } from "@/app/api/staff"; | ||||
import { fetchAllTasks, fetchTaskTemplates } from "@/app/api/tasks"; | import { fetchAllTasks, fetchTaskTemplates } from "@/app/api/tasks"; | ||||
import { getUserAbilities } from "@/app/utils/commonUtil"; | |||||
import CreateProject from "@/components/CreateProject"; | import CreateProject from "@/components/CreateProject"; | ||||
import { I18nProvider, getServerI18n } from "@/i18n"; | import { I18nProvider, getServerI18n } from "@/i18n"; | ||||
import { MAINTAIN_PROJECT } from "@/middleware"; | |||||
import Typography from "@mui/material/Typography"; | import Typography from "@mui/material/Typography"; | ||||
import { Metadata } from "next"; | import { Metadata } from "next"; | ||||
import { notFound } from "next/navigation"; | |||||
export const metadata: Metadata = { | export const metadata: Metadata = { | ||||
title: "Create Project", | title: "Create Project", | ||||
@@ -23,6 +26,12 @@ export const metadata: Metadata = { | |||||
const Projects: React.FC = async () => { | const Projects: React.FC = async () => { | ||||
const { t } = await getServerI18n("projects"); | const { t } = await getServerI18n("projects"); | ||||
const abilities = await getUserAbilities() | |||||
if (!abilities.includes(MAINTAIN_PROJECT)) { | |||||
notFound(); | |||||
} | |||||
// Preload necessary dependencies | // Preload necessary dependencies | ||||
fetchAllTasks(); | fetchAllTasks(); | ||||
fetchTaskTemplates(); | fetchTaskTemplates(); | ||||
@@ -13,9 +13,11 @@ import { | |||||
} from "@/app/api/projects"; | } from "@/app/api/projects"; | ||||
import { preloadStaff, preloadTeamLeads } from "@/app/api/staff"; | import { preloadStaff, preloadTeamLeads } from "@/app/api/staff"; | ||||
import { fetchAllTasks, fetchTaskTemplates } from "@/app/api/tasks"; | import { fetchAllTasks, fetchTaskTemplates } from "@/app/api/tasks"; | ||||
import { getUserAbilities } from "@/app/utils/commonUtil"; | |||||
import { ServerFetchError } from "@/app/utils/fetchUtil"; | import { ServerFetchError } from "@/app/utils/fetchUtil"; | ||||
import CreateProject from "@/components/CreateProject"; | import CreateProject from "@/components/CreateProject"; | ||||
import { I18nProvider, getServerI18n } from "@/i18n"; | import { I18nProvider, getServerI18n } from "@/i18n"; | ||||
import { MAINTAIN_PROJECT } from "@/middleware"; | |||||
import Typography from "@mui/material/Typography"; | import Typography from "@mui/material/Typography"; | ||||
import { Metadata } from "next"; | import { Metadata } from "next"; | ||||
import { notFound } from "next/navigation"; | import { notFound } from "next/navigation"; | ||||
@@ -26,6 +28,11 @@ export const metadata: Metadata = { | |||||
const Projects: React.FC = async () => { | const Projects: React.FC = async () => { | ||||
const { t } = await getServerI18n("projects"); | const { t } = await getServerI18n("projects"); | ||||
const abilities = await getUserAbilities() | |||||
if (!abilities.includes(MAINTAIN_PROJECT)) { | |||||
notFound(); | |||||
} | |||||
// Preload necessary dependencies | // Preload necessary dependencies | ||||
fetchAllTasks(); | fetchAllTasks(); | ||||
@@ -12,9 +12,11 @@ import { | |||||
} from "@/app/api/projects"; | } from "@/app/api/projects"; | ||||
import { preloadStaff, preloadTeamLeads } from "@/app/api/staff"; | import { preloadStaff, preloadTeamLeads } from "@/app/api/staff"; | ||||
import { fetchAllTasks, fetchTaskTemplates } from "@/app/api/tasks"; | import { fetchAllTasks, fetchTaskTemplates } from "@/app/api/tasks"; | ||||
import { getUserAbilities } from "@/app/utils/commonUtil"; | |||||
import { ServerFetchError } from "@/app/utils/fetchUtil"; | import { ServerFetchError } from "@/app/utils/fetchUtil"; | ||||
import CreateProject from "@/components/CreateProject"; | import CreateProject from "@/components/CreateProject"; | ||||
import { I18nProvider, getServerI18n } from "@/i18n"; | import { I18nProvider, getServerI18n } from "@/i18n"; | ||||
import { MAINTAIN_PROJECT } from "@/middleware"; | |||||
import Typography from "@mui/material/Typography"; | import Typography from "@mui/material/Typography"; | ||||
import { isArray } from "lodash"; | import { isArray } from "lodash"; | ||||
import { Metadata } from "next"; | import { Metadata } from "next"; | ||||
@@ -32,8 +34,9 @@ const Projects: React.FC<Props> = async ({ searchParams }) => { | |||||
const { t } = await getServerI18n("projects"); | const { t } = await getServerI18n("projects"); | ||||
// Assume projectId is string here | // Assume projectId is string here | ||||
const projectId = searchParams["id"]; | const projectId = searchParams["id"]; | ||||
const abilities = await getUserAbilities() | |||||
if (!projectId || isArray(projectId)) { | |||||
if (!projectId || isArray(projectId) || abilities.includes(MAINTAIN_PROJECT)) { | |||||
notFound(); | notFound(); | ||||
} | } | ||||
@@ -13,8 +13,10 @@ import { | |||||
} from "@/app/api/projects"; | } from "@/app/api/projects"; | ||||
import { preloadStaff, preloadTeamLeads } from "@/app/api/staff"; | import { preloadStaff, preloadTeamLeads } from "@/app/api/staff"; | ||||
import { fetchAllTasks, fetchTaskTemplates } from "@/app/api/tasks"; | import { fetchAllTasks, fetchTaskTemplates } from "@/app/api/tasks"; | ||||
import { getUserAbilities } from "@/app/utils/commonUtil"; | |||||
import CreateProject from "@/components/CreateProject"; | import CreateProject from "@/components/CreateProject"; | ||||
import { I18nProvider, getServerI18n } from "@/i18n"; | import { I18nProvider, getServerI18n } from "@/i18n"; | ||||
import { MAINTAIN_PROJECT } from "@/middleware"; | |||||
import Typography from "@mui/material/Typography"; | import Typography from "@mui/material/Typography"; | ||||
import { isArray } from "lodash"; | import { isArray } from "lodash"; | ||||
import { Metadata } from "next"; | import { Metadata } from "next"; | ||||
@@ -32,7 +34,8 @@ const Projects: React.FC<Props> = async ({ searchParams }) => { | |||||
const { t } = await getServerI18n("projects"); | const { t } = await getServerI18n("projects"); | ||||
const projectId = searchParams["id"]; | const projectId = searchParams["id"]; | ||||
if (!projectId || isArray(projectId)) { | |||||
const abilities = await getUserAbilities() | |||||
if (!projectId || isArray(projectId) || !abilities.includes(MAINTAIN_PROJECT)) { | |||||
notFound(); | notFound(); | ||||
} | } | ||||
@@ -0,0 +1,17 @@ | |||||
import { getServerI18n } from "@/i18n"; | |||||
import { Stack, Typography, Link } from "@mui/material"; | |||||
import NextLink from "next/link"; | |||||
export default async function NotFound() { | |||||
const { t } = await getServerI18n("projects", "common"); | |||||
return ( | |||||
<Stack spacing={2}> | |||||
<Typography variant="h4">{t("Not Found")}</Typography> | |||||
<Typography variant="body1">{t("The project page was not found!")}</Typography> | |||||
<Link href="/home" component={NextLink} variant="body2"> | |||||
{t("Return to home")} | |||||
</Link> | |||||
</Stack> | |||||
); | |||||
} |
@@ -1,13 +1,15 @@ | |||||
import { fetchProjectCategories, fetchProjects, preloadProjects } from "@/app/api/projects"; | import { fetchProjectCategories, fetchProjects, preloadProjects } from "@/app/api/projects"; | ||||
import { getUserAbilities } from "@/app/utils/commonUtil"; | |||||
import ProjectSearch from "@/components/ProjectSearch"; | import ProjectSearch from "@/components/ProjectSearch"; | ||||
import { getServerI18n } from "@/i18n"; | import { getServerI18n } from "@/i18n"; | ||||
import { MAINTAIN_PROJECT, VIEW_PROJECT } from "@/middleware"; | |||||
import Add from "@mui/icons-material/Add"; | import Add from "@mui/icons-material/Add"; | ||||
import { ButtonGroup } from "@mui/material"; | |||||
import Button from "@mui/material/Button"; | import Button from "@mui/material/Button"; | ||||
import Stack from "@mui/material/Stack"; | import Stack from "@mui/material/Stack"; | ||||
import Typography from "@mui/material/Typography"; | import Typography from "@mui/material/Typography"; | ||||
import { Metadata } from "next"; | import { Metadata } from "next"; | ||||
import Link from "next/link"; | import Link from "next/link"; | ||||
import { notFound } from "next/navigation"; | |||||
import { Suspense } from "react"; | import { Suspense } from "react"; | ||||
export const metadata: Metadata = { | export const metadata: Metadata = { | ||||
@@ -19,6 +21,10 @@ const Projects: React.FC = async () => { | |||||
// preloadProjects(); | // preloadProjects(); | ||||
fetchProjectCategories(); | fetchProjectCategories(); | ||||
const projects = await fetchProjects(); | const projects = await fetchProjects(); | ||||
const abilities = await getUserAbilities() | |||||
if (!abilities.includes(VIEW_PROJECT)) { | |||||
notFound(); | |||||
} | |||||
return ( | return ( | ||||
<> | <> | ||||
@@ -31,7 +37,7 @@ const Projects: React.FC = async () => { | |||||
<Typography variant="h4" marginInlineEnd={2}> | <Typography variant="h4" marginInlineEnd={2}> | ||||
{t("Projects")} | {t("Projects")} | ||||
</Typography> | </Typography> | ||||
<Stack | |||||
{abilities.includes(MAINTAIN_PROJECT) && <Stack | |||||
direction="row" | direction="row" | ||||
justifyContent="space-between" | justifyContent="space-between" | ||||
flexWrap="wrap" | flexWrap="wrap" | ||||
@@ -55,7 +61,7 @@ const Projects: React.FC = async () => { | |||||
> | > | ||||
{t("Create Project")} | {t("Create Project")} | ||||
</Button> | </Button> | ||||
</Stack > | |||||
</Stack >} | |||||
</Stack> | </Stack> | ||||
<Suspense fallback={<ProjectSearch.Loading />}> | <Suspense fallback={<ProjectSearch.Loading />}> | ||||
<ProjectSearch /> | <ProjectSearch /> | ||||
@@ -1,8 +1,9 @@ | |||||
import { SessionWithTokens, authOptions } from "@/config/authConfig" | |||||
import { getServerSession } from "next-auth" | |||||
export interface WildCard { | export interface WildCard { | ||||
[key: string]: any; | [key: string]: any; | ||||
} | } | ||||
export const dateInRange = (currentDate: string, startDate: string, endDate: string) => { | export const dateInRange = (currentDate: string, startDate: string, endDate: string) => { | ||||
if (currentDate === undefined) { | if (currentDate === undefined) { | ||||
@@ -46,6 +47,11 @@ export function readIntFromString(input: string): [string, number | null] | stri | |||||
const stringPart = parts.slice(0, parts.length - 1).join("-"); | const stringPart = parts.slice(0, parts.length - 1).join("-"); | ||||
const intPartStr = parts[parts.length - 1]; | const intPartStr = parts[parts.length - 1]; | ||||
const intPart = intPartStr ? parseInt(intPartStr, 10) : null; | const intPart = intPartStr ? parseInt(intPartStr, 10) : null; | ||||
return [stringPart, intPart]; | return [stringPart, intPart]; | ||||
} | |||||
} | |||||
export const getUserAbilities = async () => { | |||||
const session = await getServerSession(authOptions) as SessionWithTokens; | |||||
return session?.abilities ?? [] | |||||
} |
@@ -22,7 +22,7 @@ export const serverFetch: typeof fetch = async (input, init) => { | |||||
const session = await getServerSession<any, SessionWithTokens>(authOptions); | const session = await getServerSession<any, SessionWithTokens>(authOptions); | ||||
const accessToken = session?.accessToken; | const accessToken = session?.accessToken; | ||||
console.log(accessToken); | |||||
// console.log(accessToken); | |||||
return fetch(input, { | return fetch(input, { | ||||
...init, | ...init, | ||||
headers: { | headers: { | ||||
@@ -16,7 +16,7 @@ export interface AppBarProps { | |||||
const AppBar: React.FC<AppBarProps> = async ({ avatarImageSrc, profileName }) => { | const AppBar: React.FC<AppBarProps> = async ({ avatarImageSrc, profileName }) => { | ||||
const session = await getServerSession(authOptions) as any; | const session = await getServerSession(authOptions) as any; | ||||
const abilities: string[] = session.abilities | const abilities: string[] = session.abilities | ||||
console.log(abilities) | |||||
// console.log(abilities) | |||||
return ( | return ( | ||||
<I18nProvider namespaces={["common"]}> | <I18nProvider namespaces={["common"]}> | ||||
<MUIAppBar position="sticky" color="default" elevation={4}> | <MUIAppBar position="sticky" color="default" elevation={4}> | ||||
@@ -50,6 +50,7 @@ import { | |||||
successDialog, | successDialog, | ||||
} from "../Swal/CustomAlerts"; | } from "../Swal/CustomAlerts"; | ||||
import dayjs from "dayjs"; | import dayjs from "dayjs"; | ||||
import { DELETE_PROJECT } from "@/middleware"; | |||||
export interface Props { | export interface Props { | ||||
isEditMode: boolean; | isEditMode: boolean; | ||||
@@ -70,6 +71,7 @@ export interface Props { | |||||
workNatures: WorkNature[]; | workNatures: WorkNature[]; | ||||
allStaffs: StaffResult[]; | allStaffs: StaffResult[]; | ||||
grades: Grade[]; | grades: Grade[]; | ||||
abilities: string[]; | |||||
} | } | ||||
const hasErrorsInTab = ( | const hasErrorsInTab = ( | ||||
@@ -113,6 +115,7 @@ const CreateProject: React.FC<Props> = ({ | |||||
buildingTypes, | buildingTypes, | ||||
workNatures, | workNatures, | ||||
allStaffs, | allStaffs, | ||||
abilities, | |||||
}) => { | }) => { | ||||
const [serverError, setServerError] = useState(""); | const [serverError, setServerError] = useState(""); | ||||
const [tabIndex, setTabIndex] = useState(0); | const [tabIndex, setTabIndex] = useState(0); | ||||
@@ -302,7 +305,7 @@ const CreateProject: React.FC<Props> = ({ | |||||
{isEditMode && !(formProps.getValues("projectDeleted") === true) && ( | {isEditMode && !(formProps.getValues("projectDeleted") === true) && ( | ||||
<Stack direction="row" gap={1}> | <Stack direction="row" gap={1}> | ||||
{/* {!formProps.getValues("projectActualStart") && ( */} | {/* {!formProps.getValues("projectActualStart") && ( */} | ||||
{formProps.getValues("projectStatus").toLowerCase() === "pending to start" && ( | |||||
{formProps.getValues("projectStatus")?.toLowerCase() === "pending to start" && ( | |||||
<Button | <Button | ||||
name="start" | name="start" | ||||
type="submit" | type="submit" | ||||
@@ -315,7 +318,7 @@ const CreateProject: React.FC<Props> = ({ | |||||
)} | )} | ||||
{/* {formProps.getValues("projectActualStart") && | {/* {formProps.getValues("projectActualStart") && | ||||
!formProps.getValues("projectActualEnd") && ( */} | !formProps.getValues("projectActualEnd") && ( */} | ||||
{formProps.getValues("projectStatus").toLowerCase() === "on-going" && ( | |||||
{formProps.getValues("projectStatus")?.toLowerCase() === "on-going" && ( | |||||
<Button | <Button | ||||
name="complete" | name="complete" | ||||
type="submit" | type="submit" | ||||
@@ -329,9 +332,9 @@ const CreateProject: React.FC<Props> = ({ | |||||
{!( | {!( | ||||
// formProps.getValues("projectActualStart") && | // formProps.getValues("projectActualStart") && | ||||
// formProps.getValues("projectActualEnd") | // formProps.getValues("projectActualEnd") | ||||
formProps.getValues("projectStatus") === "Completed" || | |||||
formProps.getValues("projectStatus") === "Deleted" | |||||
) && ( | |||||
formProps.getValues("projectStatus")?.toLowerCase() === "completed" || | |||||
formProps.getValues("projectStatus")?.toLowerCase() === "deleted" | |||||
) && abilities.includes(DELETE_PROJECT) && ( | |||||
<Button | <Button | ||||
variant="outlined" | variant="outlined" | ||||
startIcon={<Delete />} | startIcon={<Delete />} | ||||
@@ -14,6 +14,7 @@ import { | |||||
import { fetchStaff, fetchTeamLeads } from "@/app/api/staff"; | import { fetchStaff, fetchTeamLeads } from "@/app/api/staff"; | ||||
import { fetchAllCustomers, fetchAllSubsidiaries } from "@/app/api/customer"; | import { fetchAllCustomers, fetchAllSubsidiaries } from "@/app/api/customer"; | ||||
import { fetchGrades } from "@/app/api/grades"; | import { fetchGrades } from "@/app/api/grades"; | ||||
import { getUserAbilities } from "@/app/utils/commonUtil"; | |||||
type CreateProjectProps = { | type CreateProjectProps = { | ||||
isEditMode: false; | isEditMode: false; | ||||
@@ -43,6 +44,7 @@ const CreateProjectWrapper: React.FC<Props> = async (props) => { | |||||
workNatures, | workNatures, | ||||
allStaffs, | allStaffs, | ||||
grades, | grades, | ||||
abilities, | |||||
] = await Promise.all([ | ] = await Promise.all([ | ||||
fetchAllTasks(), | fetchAllTasks(), | ||||
fetchTaskTemplates(), | fetchTaskTemplates(), | ||||
@@ -58,6 +60,7 @@ const CreateProjectWrapper: React.FC<Props> = async (props) => { | |||||
fetchProjectWorkNatures(), | fetchProjectWorkNatures(), | ||||
fetchStaff(), | fetchStaff(), | ||||
fetchGrades(), | fetchGrades(), | ||||
getUserAbilities(), | |||||
]); | ]); | ||||
const projectInfo = props.isEditMode | const projectInfo = props.isEditMode | ||||
@@ -88,6 +91,7 @@ const CreateProjectWrapper: React.FC<Props> = async (props) => { | |||||
allStaffs={allStaffs} | allStaffs={allStaffs} | ||||
grades={grades} | grades={grades} | ||||
mainProjects={mainProjects} | mainProjects={mainProjects} | ||||
abilities={abilities} | |||||
/> | /> | ||||
); | ); | ||||
}; | }; | ||||
@@ -36,6 +36,7 @@ const GenerateProjectCashFlowReport: React.FC<Props> = ({ projects }) => { | |||||
<SearchBox | <SearchBox | ||||
criteria={searchCriteria} | criteria={searchCriteria} | ||||
onSearch={async (query) => { | onSearch={async (query) => { | ||||
if (Boolean(query.project) && query.project !== "All") { | if (Boolean(query.project) && query.project !== "All") { | ||||
// const projectIndex = projectCombo.findIndex(({value}) => value === parseInt(query.project)) | // const projectIndex = projectCombo.findIndex(({value}) => value === parseInt(query.project)) | ||||
const response = await fetchProjectCashFlowReport({ projectId: parseInt(query.project), dateType: query.dateType }) | const response = await fetchProjectCashFlowReport({ projectId: parseInt(query.project), dateType: query.dateType }) | ||||
@@ -8,16 +8,18 @@ import SearchResults, { Column } from "../SearchResults"; | |||||
import EditNote from "@mui/icons-material/EditNote"; | import EditNote from "@mui/icons-material/EditNote"; | ||||
import uniq from "lodash/uniq"; | import uniq from "lodash/uniq"; | ||||
import { useRouter } from "next/navigation"; | import { useRouter } from "next/navigation"; | ||||
import { MAINTAIN_PROJECT } from "@/middleware"; | |||||
interface Props { | interface Props { | ||||
projects: ProjectResult[]; | projects: ProjectResult[]; | ||||
projectCategories: ProjectCategory[]; | projectCategories: ProjectCategory[]; | ||||
abilities: string[] | |||||
} | } | ||||
type SearchQuery = Partial<Omit<ProjectResult, "id">>; | type SearchQuery = Partial<Omit<ProjectResult, "id">>; | ||||
type SearchParamNames = keyof SearchQuery; | type SearchParamNames = keyof SearchQuery; | ||||
const ProjectSearch: React.FC<Props> = ({ projects, projectCategories }) => { | |||||
const ProjectSearch: React.FC<Props> = ({ projects, projectCategories, abilities }) => { | |||||
const router = useRouter(); | const router = useRouter(); | ||||
const { t } = useTranslation("projects"); | const { t } = useTranslation("projects"); | ||||
@@ -75,6 +77,7 @@ const ProjectSearch: React.FC<Props> = ({ projects, projectCategories }) => { | |||||
label: t("Details"), | label: t("Details"), | ||||
onClick: onProjectClick, | onClick: onProjectClick, | ||||
buttonIcon: <EditNote />, | buttonIcon: <EditNote />, | ||||
disabled: !abilities.includes(MAINTAIN_PROJECT), | |||||
}, | }, | ||||
{ name: "code", label: t("Project Code") }, | { name: "code", label: t("Project Code") }, | ||||
{ name: "name", label: t("Project Name") }, | { name: "name", label: t("Project Name") }, | ||||
@@ -2,6 +2,7 @@ import { fetchProjectCategories, fetchProjects } from "@/app/api/projects"; | |||||
import React from "react"; | import React from "react"; | ||||
import ProjectSearch from "./ProjectSearch"; | import ProjectSearch from "./ProjectSearch"; | ||||
import ProjectSearchLoading from "./ProjectSearchLoading"; | import ProjectSearchLoading from "./ProjectSearchLoading"; | ||||
import { getUserAbilities } from "@/app/utils/commonUtil"; | |||||
interface SubComponents { | interface SubComponents { | ||||
Loading: typeof ProjectSearchLoading; | Loading: typeof ProjectSearchLoading; | ||||
@@ -11,7 +12,9 @@ const ProjectSearchWrapper: React.FC & SubComponents = async () => { | |||||
const projectCategories = await fetchProjectCategories(); | const projectCategories = await fetchProjectCategories(); | ||||
const projects = await fetchProjects(); | const projects = await fetchProjects(); | ||||
return <ProjectSearch projects={projects} projectCategories={projectCategories} />; | |||||
const abilities = await getUserAbilities() | |||||
return <ProjectSearch projects={projects} projectCategories={projectCategories} abilities={abilities}/>; | |||||
}; | }; | ||||
ProjectSearchWrapper.Loading = ProjectSearchLoading; | ProjectSearchWrapper.Loading = ProjectSearchLoading; | ||||
@@ -32,6 +32,7 @@ interface BaseColumn<T extends ResultWithId> { | |||||
interface ColumnWithAction<T extends ResultWithId> extends BaseColumn<T> { | interface ColumnWithAction<T extends ResultWithId> extends BaseColumn<T> { | ||||
onClick: (item: T) => void; | onClick: (item: T) => void; | ||||
buttonIcon: React.ReactNode; | buttonIcon: React.ReactNode; | ||||
disabled?: boolean; | |||||
} | } | ||||
export type Column<T extends ResultWithId> = | export type Column<T extends ResultWithId> = | ||||
@@ -101,6 +102,7 @@ function SearchResults<T extends ResultWithId>({ | |||||
<IconButton | <IconButton | ||||
color={column.color ?? "primary"} | color={column.color ?? "primary"} | ||||
onClick={() => column.onClick(item)} | onClick={() => column.onClick(item)} | ||||
disabled={Boolean(column.disabled)} | |||||
> | > | ||||
{column.buttonIcon} | {column.buttonIcon} | ||||
</IconButton> | </IconButton> | ||||
@@ -5,7 +5,7 @@ import { LOGIN_API_PATH } from "./api"; | |||||
export interface SessionWithTokens extends Session { | export interface SessionWithTokens extends Session { | ||||
staff?: any; | staff?: any; | ||||
role?: String; | role?: String; | ||||
abilities?: any[]; | |||||
abilities?: string[]; | |||||
accessToken?: string; | accessToken?: string; | ||||
refreshToken?: string; | refreshToken?: string; | ||||
} | } | ||||
@@ -38,6 +38,7 @@ export const [ | |||||
MAINTAIN_TIMESHEET_7DAYS, | MAINTAIN_TIMESHEET_7DAYS, | ||||
VIEW_PROJECT, | VIEW_PROJECT, | ||||
MAINTAIN_PROJECT, | MAINTAIN_PROJECT, | ||||
DELETE_PROJECT, | |||||
] = [ | ] = [ | ||||
'VIEW_USER', | 'VIEW_USER', | ||||
'MAINTAIN_USER', | 'MAINTAIN_USER', | ||||
@@ -56,7 +57,8 @@ export const [ | |||||
'MAINTAIN_TASK_TEMPLATE', | 'MAINTAIN_TASK_TEMPLATE', | ||||
'MAINTAIN_TIMESHEET_7DAYS', | 'MAINTAIN_TIMESHEET_7DAYS', | ||||
'VIEW_PROJECT', | 'VIEW_PROJECT', | ||||
'MAINTAIN_PROJECT' | |||||
'MAINTAIN_PROJECT', | |||||
'DELETE_PROJECT' | |||||
] | ] | ||||
const PRIVATE_ROUTES = [ | const PRIVATE_ROUTES = [ | ||||