From 51bce1a2c70b45696487e6f1ce77f8aab6ae9bdd Mon Sep 17 00:00:00 2001 From: randy-ar Date: Thu, 23 Oct 2025 20:23:25 +0700 Subject: [PATCH] feat(FE-86-88): Adding reject button and integrate with approval api --- .../production/project-flock/detail/page.tsx | 8 +- src/components/input/DateInput.tsx | 2 +- src/components/input/FileInput.tsx | 2 +- src/components/input/SelectInput.tsx | 8 +- src/components/input/TextArea.tsx | 2 +- src/components/input/TextInput.tsx | 2 +- .../pages/production/chickin/ChickinTable.tsx | 7 - .../project-flock/ProjectFlockTable.tsx | 353 +++++++++--------- .../project-flock/form/ProjectFlockForm.tsx | 95 +++-- src/types/api/api-general.d.ts | 9 + src/types/api/production/project-flock.d.ts | 29 +- 11 files changed, 298 insertions(+), 219 deletions(-) diff --git a/src/app/production/project-flock/detail/page.tsx b/src/app/production/project-flock/detail/page.tsx index 5efe83d8..bf0da188 100644 --- a/src/app/production/project-flock/detail/page.tsx +++ b/src/app/production/project-flock/detail/page.tsx @@ -13,7 +13,7 @@ const ProjectFlockDetail = () => { const projectFlockId = searchParams.get("projectFlockId"); - const { data: projectFlock, isLoading: isLoadingCostumer } = useSWR( + const { data: projectFlock, isLoading: isLoadingProjectFlock } = useSWR( projectFlockId, (id: number) => ProjectFlockApi.getSingle(id) ); @@ -28,15 +28,15 @@ const ProjectFlockDetail = () => { ); } - if(!isLoadingCostumer && (!projectFlock || isResponseError(projectFlock))){ + if(!isLoadingProjectFlock && (!projectFlock || isResponseError(projectFlock))){ router.replace("/404"); return; } return (
- {isLoadingCostumer && } - {!isLoadingCostumer && isResponseSuccess(projectFlock) && ( + {isLoadingProjectFlock && } + {!isLoadingProjectFlock && isResponseSuccess(projectFlock) && ( )}
diff --git a/src/components/input/DateInput.tsx b/src/components/input/DateInput.tsx index 0ef80fee..be485b75 100644 --- a/src/components/input/DateInput.tsx +++ b/src/components/input/DateInput.tsx @@ -88,7 +88,7 @@ const DateInput = ({
(props: SelectInputProps) => { classNames={{ control: ({ isFocused, isDisabled }) => cn( - 'w-full min-h-12! rounded-lg! border bg-white transition-shadow cursor-pointer!', + 'w-full min-h-12! rounded border bg-white transition-shadow cursor-pointer!', { 'border-red-500! ring-2 ring-red-200': isError, 'border-indigo-500 ring-2 ring-indigo-200': isFocused, @@ -176,7 +176,7 @@ const SelectInput = (props: SelectInputProps) => { input: () => cn('text-gray-900'), indicatorsContainer: () => cn('flex items-center gap-1 pr-2'), dropdownIndicator: ({ isFocused }) => - cn('p-1 rounded-md hover:bg-gray-100', { + cn('p-1 rounded hover:bg-gray-100', { 'text-gray-900': isFocused, 'text-gray-500': !isFocused, 'text-error!': isError, @@ -185,7 +185,7 @@ const SelectInput = (props: SelectInputProps) => { cn('border border-gray-200 rounded-lg bg-white shadow-lg!'), menuList: () => cn('p-2! max-h-60 overflow-auto'), option: ({ isFocused, isSelected }) => - cn('mt-1 px-3 py-2 rounded-md cursor-pointer!', { + cn('mt-1 px-3 py-2 rounded cursor-pointer!', { 'bg-indigo-600 text-white': isFocused, 'bg-blue-500!': isSelected, 'text-gray-700': !isFocused && !isSelected, @@ -193,7 +193,7 @@ const SelectInput = (props: SelectInputProps) => { multiValue: ({ getValue, index }) => { const selectedValues = getValue() as T[]; return cn( - 'bg-indigo-50 rounded-md py-0.5 pl-2 pr-1 flex items-center gap-1!', + 'bg-indigo-50 rounded py-0.5 pl-2 pr-1 flex items-center gap-1!', selectedValues[index]?.className ); }, diff --git a/src/components/input/TextArea.tsx b/src/components/input/TextArea.tsx index e9517277..d8d58929 100644 --- a/src/components/input/TextArea.tsx +++ b/src/components/input/TextArea.tsx @@ -87,7 +87,7 @@ const TextArea = ({