From d4168b45f2cd9b947087499c3254ddcb568e88ff Mon Sep 17 00:00:00 2001
From: Ichsan Kurniawan <43689091+ichsankurnia@users.noreply.github.com>
Date: Wed, 18 Nov 2026 18:19:38 +0700
Subject: [PATCH] Tighten task actions and image uploads
Gate assignment and team actions by permissions, limit client and end-user images to 2 MB, and make the technical status end date optional. Also update status remark handling and rename the Task navigation label.
---
app/(dashboard)/components/MainNav.tsx | 2 +-
.../(main)/ClientDetailComponent.tsx | 6 ++++--
.../[client_id]/(main)/ClientProfileCard.tsx | 2 +-
.../client-detail/[client_id]/(main)/page.tsx | 1 +
.../AssignmentDetailComponent.tsx | 20 ++++++++++---------
.../task/component/FormEndUser.tsx | 14 ++++++++++---
.../component/UpdateAdministrationStatus.tsx | 4 ++--
.../task/component/UpdateTechnicalStatus.tsx | 18 +++++------------
.../task/component/client/FormClient.tsx | 14 ++++++++++---
9 files changed, 47 insertions(+), 34 deletions(-)
diff --git a/app/(dashboard)/components/MainNav.tsx b/app/(dashboard)/components/MainNav.tsx
index cc65407..aaf92f6 100644
--- a/app/(dashboard)/components/MainNav.tsx
+++ b/app/(dashboard)/components/MainNav.tsx
@@ -43,7 +43,7 @@ export function MainNav({ className, ...props }: HTMLAttributes) {
className={`text-sm font-medium transition-colors hover:text-his hover:border-b-[3px] border-his pt-6 pb-5 ${getMenuActiveStyle('/task')}`}
>
- My Task
+ Task
{session?.user.detail.role.allow_admin_panel &&
import('../../../component/project-assignment/AssignmentList'),
@@ -69,12 +70,13 @@ const ConfirmDeleteWithInput = dynamic(
);
interface Props {
+ client: IClient;
clientId: string;
assignmentLists: IProjectAssignment[];
actions?: string[]
}
-export default function ClientDetailComponent({ clientId, assignmentLists, actions }: Props) {
+export default function ClientDetailComponent({ client, clientId, assignmentLists, actions }: Props) {
const router = useRouter();
const searchParams = useSearchParams();
const urlLayout = searchParams?.get('layout') as 'grid' | 'list' | null;
@@ -133,7 +135,7 @@ export default function ClientDetailComponent({ clientId, assignmentLists, actio
This client doesn't have any projects or internal memos yet. Try to change the filter or create one to get started.
- {actions?.includes("CREATE_ASSIGNMENT") &&
+ {client?.name && actions?.includes("CREATE_ASSIGNMENT") &&
diff --git a/app/(dashboard)/task/client-detail/[client_id]/(main)/ClientProfileCard.tsx b/app/(dashboard)/task/client-detail/[client_id]/(main)/ClientProfileCard.tsx
index f1fe131..4494b75 100644
--- a/app/(dashboard)/task/client-detail/[client_id]/(main)/ClientProfileCard.tsx
+++ b/app/(dashboard)/task/client-detail/[client_id]/(main)/ClientProfileCard.tsx
@@ -61,7 +61,7 @@ export default function ClientProfileCard({ client, clientId, actions }: Props)
{/* Right: + New assignment Button */}
- {actions?.includes("CREATE_ASSIGNMENT") &&
+ {client.name && actions?.includes("CREATE_ASSIGNMENT") &&
) : null}
-
+ {actions?.includes("MANAGE_TEAM") &&
+
+ }
}
>
diff --git a/app/(dashboard)/task/component/FormEndUser.tsx b/app/(dashboard)/task/component/FormEndUser.tsx
index f961ae5..65e549e 100644
--- a/app/(dashboard)/task/component/FormEndUser.tsx
+++ b/app/(dashboard)/task/component/FormEndUser.tsx
@@ -36,7 +36,8 @@ const FormEndUser: FC = ({ data, onSuccess, onCancel }) => {
const existFile = data?.photo || null
const dropzoneRef = useRef(null);
- const maxSizeMB = 5
+ const maxSizeMB = 2
+ const maxSizeBytes = maxSizeMB * 1024 * 1024;
const openDialog = () => {
// Note that the ref is set async,
@@ -48,6 +49,13 @@ const FormEndUser: FC = ({ data, onSuccess, onCancel }) => {
const onDrop = useCallback((acceptedFiles: any[]) => {
acceptedFiles.forEach(async (file: any) => {
+ if (file.size > maxSizeBytes) {
+ toast.error('File size exceeds the limit', {
+ description: `Maximum allowed file size is ${maxSizeMB}MB.`,
+ });
+ return;
+ }
+
const reader = new FileReader();
reader.onabort = () => console.log('file reading was aborted');
@@ -184,7 +192,7 @@ const FormEndUser: FC = ({ data, onSuccess, onCancel }) => {
{/* Drop area */}
{/* @ts-ignore */}
{({ getRootProps, getInputProps, acceptedFiles }) => {
@@ -217,7 +225,7 @@ const FormEndUser: FC = ({ data, onSuccess, onCancel }) => {
Drop your files here
- SVG, PNG, JPG or GIF (max. {maxSizeMB}MB)
+ SVG, PNG, JPG, WEBP, BMP or GIF (max. {maxSizeMB}MB)