feat(84-85-86-87-88-89-102): create feature project flocks and adjust master data flock feature

This commit is contained in:
randy-ar
2025-10-16 16:49:44 +07:00
parent e2b35e765c
commit 5113bf4d3f
16 changed files with 1207 additions and 19 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
@plugin "daisyui";
@plugin "daisyui/theme" {
name: "corporate";
name: "lti";
default: false;
prefersdark: false;
color-scheme: "light";
@@ -1,3 +1,5 @@
'use client'
import FlockForm from "@/components/pages/master-data/flock/form/FlockForm";
import { isResponseError, isResponseSuccess } from "@/lib/api-helper";
import { FlockApi } from "@/services/api/master-data";
@@ -1,3 +1,5 @@
'use client'
import FlockForm from "@/components/pages/master-data/flock/form/FlockForm";
import { isResponseError, isResponseSuccess } from "@/lib/api-helper";
import { FlockApi } from "@/services/api/master-data";
@@ -0,0 +1,13 @@
'use client'
import ProjectFlockForm from "@/components/pages/production/project-flock/form/ProjectFlockForm";
const AddProjectFlock = () => {
return (
<section className="w-full p-4 flex flex-row justify-center">
<ProjectFlockForm formType="add"/>
</section>
);
}
export default AddProjectFlock;
@@ -0,0 +1,46 @@
'use client'
import ProjectFlockForm from "@/components/pages/production/project-flock/form/ProjectFlockForm";
import { isResponseError, isResponseSuccess } from "@/lib/api-helper";
import { ProjectFlockApi } from "@/services/api/production";
import { useRouter, useSearchParams } from "next/navigation";
import useSWR from "swr";
const ProjectFlockDetail = () => {
const router = useRouter();
const searchParams = useSearchParams();
const projectFlockId = searchParams.get("projectFlockId");
const { data: projectFlock, isLoading: isLoadingCostumer } = useSWR(
projectFlockId,
(id: number) => ProjectFlockApi.getSingle(id)
);
if(!projectFlockId){
router.back();
return (
<div className="w-full flex flex-row justify-center items-center p-4">
<span className="loading loading-spinner loading-xl" />
</div>
);
}
if(!isLoadingCostumer && (!projectFlock || isResponseError(projectFlock))){
router.replace("/404");
return;
}
return (
<div className="w-full p-4 flex flex-row justify-center">
{isLoadingCostumer && <span className="loading loading-spinner loading-xl" />}
{!isLoadingCostumer && isResponseSuccess(projectFlock) && (
<ProjectFlockForm formType="detail" initialValues={projectFlock.data} />
)}
</div>
)
}
export default ProjectFlockDetail;
+12
View File
@@ -0,0 +1,12 @@
import ProjectFlockForm from "@/components/pages/production/project-flock/form/ProjectFlockForm"
import ProjectFlockTable from "@/components/pages/production/project-flock/ProjectFlockTable";
const ProjectFlock = () => {
return (
<section className="w-full p-4">
<ProjectFlockTable/>
</section>
);
}
export default ProjectFlock;