mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-24 15:25:46 +00:00
Merge branch 'fix/not-found-page-permission' into 'development'
[FIX/FE] Not Found Page See merge request mbugroup/lti-web-client!301
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
import PageNotFound from '@/components/helper/NotFoundPage';
|
||||||
|
|
||||||
|
export default function NotFound() {
|
||||||
|
return <PageNotFound />;
|
||||||
|
}
|
||||||
@@ -50,5 +50,3 @@ const ProjectFlockDetailPage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default ProjectFlockDetailPage;
|
export default ProjectFlockDetailPage;
|
||||||
ProjectFlockDetail;
|
|
||||||
ProjectFlockDetail;
|
|
||||||
|
|||||||
@@ -74,6 +74,8 @@ const MainDrawer = ({
|
|||||||
|
|
||||||
const formattedPathname = pathname.endsWith('/') ? pathname : `${pathname}/`;
|
const formattedPathname = pathname.endsWith('/') ? pathname : `${pathname}/`;
|
||||||
|
|
||||||
|
const isPathnameNotFoundPage = formattedPathname === '/404/';
|
||||||
|
|
||||||
const isPermitted = ROUTE_PERMISSIONS[formattedPathname]?.some((permission) =>
|
const isPermitted = ROUTE_PERMISSIONS[formattedPathname]?.some((permission) =>
|
||||||
permissionCheck(permission)
|
permissionCheck(permission)
|
||||||
);
|
);
|
||||||
@@ -82,10 +84,14 @@ const MainDrawer = ({
|
|||||||
setMainDrawerOpen(!mainDrawerOpen);
|
setMainDrawerOpen(!mainDrawerOpen);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!isPermitted) {
|
if (!isPermitted && !isPathnameNotFoundPage) {
|
||||||
return <PermissionNotFound />;
|
return <PermissionNotFound />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isPathnameNotFoundPage) {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Drawer
|
<Drawer
|
||||||
open={mainDrawerOpen}
|
open={mainDrawerOpen}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import Button from '@/components/Button';
|
||||||
|
|
||||||
|
const PageNotFound = () => {
|
||||||
|
return (
|
||||||
|
<div className='w-full h-full flex-1 flex flex-col justify-center items-center gap-4'>
|
||||||
|
<h2 className='text-2xl font-bold text-error'>Halaman Tidak Ditemukan</h2>
|
||||||
|
<p className='text-gray-600 text-center'>
|
||||||
|
Halaman atau data yang anda cari tidak ditemukan.
|
||||||
|
</p>
|
||||||
|
<Button href='/dashboard' className='text-base-100'>
|
||||||
|
Kembali ke Dashboard
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PageNotFound;
|
||||||
@@ -190,8 +190,6 @@ const DailyMarketingsTable = ({
|
|||||||
];
|
];
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// console.log({ sorting });
|
|
||||||
|
|
||||||
if (sorting.length === 1) {
|
if (sorting.length === 1) {
|
||||||
onFilterByChange(sorting[0].id);
|
onFilterByChange(sorting[0].id);
|
||||||
onSortByChange(sorting[0].desc ? 'desc' : 'asc');
|
onSortByChange(sorting[0].desc ? 'desc' : 'asc');
|
||||||
|
|||||||
@@ -658,16 +658,6 @@ export function DailyChecklistContent() {
|
|||||||
) => {
|
) => {
|
||||||
const taskId = taskIdsByPhaseActivityId[activityId];
|
const taskId = taskIdsByPhaseActivityId[activityId];
|
||||||
|
|
||||||
// console.log('[CHECKBOX] Click detected:', {
|
|
||||||
// activityId,
|
|
||||||
// employeeId,
|
|
||||||
// checked,
|
|
||||||
// taskId,
|
|
||||||
// hasTaskId: !!taskId,
|
|
||||||
// checklistStatus,
|
|
||||||
// isChecklistStatusDraft,
|
|
||||||
// });
|
|
||||||
|
|
||||||
if (!taskId) {
|
if (!taskId) {
|
||||||
console.error('[CHECKBOX] No taskId found for activityId:', activityId);
|
console.error('[CHECKBOX] No taskId found for activityId:', activityId);
|
||||||
console.error('[CHECKBOX] Available taskIds:', taskIdsByPhaseActivityId);
|
console.error('[CHECKBOX] Available taskIds:', taskIdsByPhaseActivityId);
|
||||||
@@ -695,10 +685,7 @@ export function DailyChecklistContent() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
// console.log(
|
|
||||||
// '[CHECKBOX] State updated optimistically:',
|
|
||||||
// updated[taskId]?.[employeeId]
|
|
||||||
// );
|
|
||||||
return updated;
|
return updated;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -710,8 +697,6 @@ export function DailyChecklistContent() {
|
|||||||
note: assignments[taskId]?.[employeeId]?.note || null,
|
note: assignments[taskId]?.[employeeId]?.note || null,
|
||||||
};
|
};
|
||||||
|
|
||||||
// console.log('[CHECKBOX] Saving to database:', payload);
|
|
||||||
|
|
||||||
const checkOrUncheckAssignmentRes =
|
const checkOrUncheckAssignmentRes =
|
||||||
await DailyChecklistApi.checkOrUncheckAssignment(payload);
|
await DailyChecklistApi.checkOrUncheckAssignment(payload);
|
||||||
|
|
||||||
@@ -735,8 +720,6 @@ export function DailyChecklistContent() {
|
|||||||
}));
|
}));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log('[CHECKBOX] Saved successfully');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleNoteChange = async (
|
const handleNoteChange = async (
|
||||||
@@ -1247,8 +1230,6 @@ export function DailyChecklistContent() {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log(activities);
|
|
||||||
|
|
||||||
activities.forEach((activity, index) => {
|
activities.forEach((activity, index) => {
|
||||||
const taskId =
|
const taskId =
|
||||||
taskIdsByPhaseActivityId[activity.id];
|
taskIdsByPhaseActivityId[activity.id];
|
||||||
|
|||||||
+3
-5
@@ -17,7 +17,7 @@ import {
|
|||||||
DialogFooter,
|
DialogFooter,
|
||||||
} from '@/figma-make/components/base/dialog';
|
} from '@/figma-make/components/base/dialog';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
import { useRouter, useSearchParams } from 'next/navigation';
|
import { notFound, useRouter, useSearchParams } from 'next/navigation';
|
||||||
import { DailyChecklistApi } from '@/services/api/daily-checklist/daily-checklist';
|
import { DailyChecklistApi } from '@/services/api/daily-checklist/daily-checklist';
|
||||||
import { isResponseError } from '@/lib/api-helper';
|
import { isResponseError } from '@/lib/api-helper';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
@@ -140,6 +140,8 @@ export function DetailDailyChecklistContent() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (checklistId) {
|
if (checklistId) {
|
||||||
fetchChecklistDetail();
|
fetchChecklistDetail();
|
||||||
|
} else {
|
||||||
|
router.push('/404');
|
||||||
}
|
}
|
||||||
}, [checklistId]);
|
}, [checklistId]);
|
||||||
|
|
||||||
@@ -802,10 +804,6 @@ export function DetailDailyChecklistContent() {
|
|||||||
? 'pl-12'
|
? 'pl-12'
|
||||||
: 'pl-8';
|
: 'pl-8';
|
||||||
|
|
||||||
console.log({
|
|
||||||
activity,
|
|
||||||
});
|
|
||||||
|
|
||||||
rows.push(
|
rows.push(
|
||||||
<tr
|
<tr
|
||||||
key={`activity-${activity.id}-${index}`}
|
key={`activity-${activity.id}-${index}`}
|
||||||
|
|||||||
Reference in New Issue
Block a user