fix job
deskrispi: - fix status job
This commit is contained in:
87
src/app/api/job/status/[name]/route.ts
Normal file
87
src/app/api/job/status/[name]/route.ts
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||||
|
import backendLogger from "@/util/backendLogger";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { redirect } from "next/navigation";
|
||||||
|
import { NextResponse } from "next/server";
|
||||||
|
export async function GET(
|
||||||
|
request: Request,
|
||||||
|
{ params }: { params: { name: string } }
|
||||||
|
) {
|
||||||
|
try {
|
||||||
|
let fixData;
|
||||||
|
const { name } = params;
|
||||||
|
const { searchParams } = new URL(request.url);
|
||||||
|
const page = searchParams.get("page");
|
||||||
|
const takeData = 10
|
||||||
|
const skipData = Number(page) * takeData - takeData;
|
||||||
|
|
||||||
|
const userLoginId = await funGetUserIdByToken();
|
||||||
|
|
||||||
|
if (!userLoginId) {
|
||||||
|
return NextResponse.json(
|
||||||
|
{
|
||||||
|
success: false,
|
||||||
|
message: "Gagal mendapatkan data",
|
||||||
|
reason: "Unauthorized",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
status: 401,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!page) {
|
||||||
|
fixData = await prisma.job.findMany({
|
||||||
|
orderBy: {
|
||||||
|
updatedAt: "desc",
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
authorId: userLoginId,
|
||||||
|
isActive: true,
|
||||||
|
isArsip: false,
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
Author: true,
|
||||||
|
MasterStatus: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const fixStatusName = _.startCase(name);
|
||||||
|
fixData = await prisma.job.findMany({
|
||||||
|
take: takeData,
|
||||||
|
skip: skipData,
|
||||||
|
orderBy: {
|
||||||
|
updatedAt: "desc",
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
authorId: userLoginId,
|
||||||
|
isActive: true,
|
||||||
|
MasterStatus: {
|
||||||
|
name: fixStatusName || name,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
Author: true,
|
||||||
|
MasterStatus: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return NextResponse.json({
|
||||||
|
success: true,
|
||||||
|
message: "Berhasil mendapatkan data",
|
||||||
|
data: fixData,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
backendLogger.error("Error Get Data Job", error);
|
||||||
|
return NextResponse.json(
|
||||||
|
{
|
||||||
|
success: false,
|
||||||
|
message: "Gagal mendapatkan data",
|
||||||
|
reason: (error as Error).message,
|
||||||
|
},
|
||||||
|
{ status: 500 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,22 +2,12 @@ import { Job_Status } from "@/app_modules/job";
|
|||||||
import { job_funGetAllByStatusId } from "@/app_modules/job/fun";
|
import { job_funGetAllByStatusId } from "@/app_modules/job/fun";
|
||||||
import { job_funGetMasterStatus } from "@/app_modules/job/fun/get/get_master_status";
|
import { job_funGetMasterStatus } from "@/app_modules/job/fun/get/get_master_status";
|
||||||
|
|
||||||
export default async function Page({ params }: { params: { id: string } }) {
|
export default async function Page() {
|
||||||
let statusId = params.id;
|
|
||||||
|
|
||||||
const dataJob = await job_funGetAllByStatusId({
|
|
||||||
page: 1,
|
|
||||||
statusId: statusId,
|
|
||||||
});
|
|
||||||
const listStatus = await job_funGetMasterStatus();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Job_Status
|
<Job_Status/>
|
||||||
statusId={statusId}
|
|
||||||
dataJob={dataJob}
|
|
||||||
listStatus={listStatus as any}
|
|
||||||
/>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { globalStatusApp } from "./list_status_app";
|
||||||
import { MAX_SIZE } from "./max_size";
|
import { MAX_SIZE } from "./max_size";
|
||||||
|
|
||||||
export { MAX_SIZE };
|
export { MAX_SIZE };
|
||||||
|
export { globalStatusApp };
|
||||||
|
|||||||
18
src/app_modules/_global/lib/list_status_app.ts
Normal file
18
src/app_modules/_global/lib/list_status_app.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
export const globalStatusApp = [
|
||||||
|
{
|
||||||
|
id: "1",
|
||||||
|
name: "Publish",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "2",
|
||||||
|
name: "Review",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "3",
|
||||||
|
name: "Draft",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "4",
|
||||||
|
name: "Reject",
|
||||||
|
},
|
||||||
|
];
|
||||||
@@ -32,7 +32,7 @@ import { useShallowEffect } from "@mantine/hooks";
|
|||||||
import { apiGetAdminAllTransaksiById, apiGetAdminStatusTransaksi } from "../../_lib/api_fetch_admin_investasi";
|
import { apiGetAdminAllTransaksiById, apiGetAdminStatusTransaksi } from "../../_lib/api_fetch_admin_investasi";
|
||||||
import { clientLogger } from "@/util/clientLogger";
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||||
import { apiGetMasterStatusTransaksi } from "@/app_modules/_global/lib/api_master";
|
import { apiGetMasterStatusTransaksi } from "@/app_modules/_global/lib/api_fetch_master";
|
||||||
|
|
||||||
export function AdminInvestasi_ViewDaftarTransaksi() {
|
export function AdminInvestasi_ViewDaftarTransaksi() {
|
||||||
const params = useParams<{ id: string }>();
|
const params = useParams<{ id: string }>();
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { RouterEvent } from "@/lib/router_hipmi/router_event";
|
import { RouterEvent } from "@/lib/router_hipmi/router_event";
|
||||||
import { AccentColor, MainColor } from "@/app_modules/_global/color";
|
import { AccentColor, MainColor } from "@/app_modules/_global/color";
|
||||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||||
import { apiGetMasterBank } from "@/app_modules/_global/lib/api_master";
|
import { apiGetMasterBank } from "@/app_modules/_global/lib/api_fetch_master";
|
||||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||||
import {
|
import {
|
||||||
gs_event_bank_id,
|
gs_event_bank_id,
|
||||||
|
|||||||
47
src/app_modules/job/component/api_fetch_job.ts
Normal file
47
src/app_modules/job/component/api_fetch_job.ts
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
export { apiGetJobByStatus };
|
||||||
|
|
||||||
|
const apiGetJobByStatus = async ({
|
||||||
|
status,
|
||||||
|
page,
|
||||||
|
}: {
|
||||||
|
status?: string;
|
||||||
|
page: string;
|
||||||
|
}) => {
|
||||||
|
try {
|
||||||
|
// Fetch token from cookie
|
||||||
|
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
|
||||||
|
if (!token) {
|
||||||
|
console.error("No token found");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("status > ", status);
|
||||||
|
|
||||||
|
// Send PUT request to update portfolio logo
|
||||||
|
const isPage = `?page=${page}`
|
||||||
|
const response = await fetch(`/api/job/status/${status}${isPage}`, {
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Accept: "application/json",
|
||||||
|
Authorization: `Bearer ${token}`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Check if the response is OK
|
||||||
|
if (!response.ok) {
|
||||||
|
const errorData = await response.json().catch(() => null);
|
||||||
|
console.error(
|
||||||
|
"Error updating portfolio logo:",
|
||||||
|
errorData?.message || "Unknown error"
|
||||||
|
);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return await response.json();
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error updating portfolio medsos:", error);
|
||||||
|
throw error; // Re-throw the error to handle it in the calling function
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import Job_ViewBeranda from "./main/beranda/view_beranda";
|
import Job_ViewBeranda from "./main/beranda/view_beranda";
|
||||||
import LayoutJob_Main from "./main/layout";
|
import LayoutJob_Main from "./main/layout";
|
||||||
import Job_ViewSplash from "./splash/view_splash";
|
import Job_ViewSplash from "./splash/view_splash";
|
||||||
import Job_ViewStatus from "./main/status/view_status";
|
import Job_UiStatus from "./main/status/ui_status";
|
||||||
import Job_ViewArsip from "./main/arsip/view_arsip";
|
import Job_ViewArsip from "./main/arsip/view_arsip";
|
||||||
import Job_Create from "./create/view";
|
import Job_Create from "./create/view";
|
||||||
import LayoutJob_Create from "./create/layout";
|
import LayoutJob_Create from "./create/layout";
|
||||||
@@ -26,7 +26,7 @@ export {
|
|||||||
Job_ViewBeranda,
|
Job_ViewBeranda,
|
||||||
LayoutJob_Main,
|
LayoutJob_Main,
|
||||||
Job_ViewSplash,
|
Job_ViewSplash,
|
||||||
Job_ViewStatus as Job_Status,
|
Job_UiStatus as Job_Status,
|
||||||
Job_ViewArsip as Job_Arsip,
|
Job_ViewArsip as Job_Arsip,
|
||||||
Job_Create,
|
Job_Create,
|
||||||
LayoutJob_Create,
|
LayoutJob_Create,
|
||||||
|
|||||||
@@ -8,43 +8,58 @@ import { ScrollOnly } from "next-scroll-loader";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import ComponentJob_CardStatus from "../../component/card/card_view";
|
import ComponentJob_CardStatus from "../../component/card/card_view";
|
||||||
import job_getAllStatusPublish from "../../fun/get/status/get_list_publish";
|
import job_getAllStatusPublish from "../../fun/get/status/get_list_publish";
|
||||||
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
|
import { apiGetJobByStatus } from "../../component/api_fetch_job";
|
||||||
|
|
||||||
export default function Job_Publish({ listPublish }: { listPublish: any }) {
|
export default function Job_Publish({ nameStatus }: { nameStatus: string }) {
|
||||||
const [data, setData] = useState(listPublish);
|
const [data, setData] = useState<any[] | null>(null);
|
||||||
const [activePage, setActivePage] = useState(1);
|
const [activePage, setActivePage] = useState(1);
|
||||||
|
|
||||||
|
useShallowEffect(() => {
|
||||||
|
handleLoadData();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleLoadData = async () => {
|
||||||
|
try {
|
||||||
|
// const response = await apiGetJobByStatus({ status: nameStatus });
|
||||||
|
// if (response.success) {
|
||||||
|
// console.log(response.data);
|
||||||
|
// }
|
||||||
|
} catch (error) {}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{_.isEmpty(data) ? (
|
{_.isEmpty(data) ? (
|
||||||
<ComponentGlobal_IsEmptyData />
|
<ComponentGlobal_IsEmptyData />
|
||||||
) : (
|
) : (
|
||||||
// --- Main component --- //
|
"Publish"
|
||||||
<ScrollOnly
|
// <ScrollOnly
|
||||||
height="75vh"
|
// height="75vh"
|
||||||
renderLoading={() => (
|
// renderLoading={() => (
|
||||||
<Center mt={"lg"}>
|
// <Center mt={"lg"}>
|
||||||
<Loader color={"yellow"} />
|
// <Loader color={"yellow"} />
|
||||||
</Center>
|
// </Center>
|
||||||
)}
|
// )}
|
||||||
data={data}
|
// data={data}
|
||||||
setData={setData}
|
// setData={setData}
|
||||||
moreData={async () => {
|
// moreData={async () => {
|
||||||
const loadData = await job_getAllStatusPublish({
|
// const loadData = await job_getAllStatusPublish({
|
||||||
page: activePage + 1,
|
// page: activePage + 1,
|
||||||
});
|
// });
|
||||||
|
|
||||||
setActivePage((val) => val + 1);
|
// setActivePage((val) => val + 1);
|
||||||
|
|
||||||
return loadData;
|
// return loadData;
|
||||||
}}
|
// }}
|
||||||
>
|
// >
|
||||||
{(item) => (
|
// {(item) => (
|
||||||
<ComponentJob_CardStatus
|
// <ComponentJob_CardStatus
|
||||||
data={item}
|
// data={item}
|
||||||
path={RouterJob.detail_publish}
|
// path={RouterJob.detail_publish}
|
||||||
/>
|
// />
|
||||||
)}
|
// )}
|
||||||
</ScrollOnly>
|
// </ScrollOnly>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -8,43 +8,58 @@ import { ScrollOnly } from "next-scroll-loader";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import ComponentJob_CardStatus from "../../component/card/card_view";
|
import ComponentJob_CardStatus from "../../component/card/card_view";
|
||||||
import job_getAllStatusReview from "../../fun/get/status/get_list_review";
|
import job_getAllStatusReview from "../../fun/get/status/get_list_review";
|
||||||
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
|
import { apiGetJobByStatus } from "../../component/api_fetch_job";
|
||||||
|
|
||||||
export default function Job_Review({ listReview }: { listReview: any[] }) {
|
export default function Job_Review({ nameStatus }: { nameStatus: string }) {
|
||||||
const [data, setData] = useState(listReview);
|
const [data, setData] = useState<any[] | null>(null);
|
||||||
const [activePage, setActivePage] = useState(1);
|
const [activePage, setActivePage] = useState(1);
|
||||||
|
|
||||||
|
useShallowEffect(() => {
|
||||||
|
handleLoadData();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleLoadData = async () => {
|
||||||
|
try {
|
||||||
|
// const response = await apiGetJobByStatus({ status: nameStatus });
|
||||||
|
// if (response.success) {
|
||||||
|
// console.log(response.data);
|
||||||
|
// }
|
||||||
|
} catch (error) {}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{_.isEmpty(data) ? (
|
{_.isEmpty(data) ? (
|
||||||
<ComponentGlobal_IsEmptyData />
|
<ComponentGlobal_IsEmptyData />
|
||||||
) : (
|
) : (
|
||||||
// --- Main component --- //
|
"Review"
|
||||||
<ScrollOnly
|
// <ScrollOnly
|
||||||
height="75vh"
|
// height="75vh"
|
||||||
renderLoading={() => (
|
// renderLoading={() => (
|
||||||
<Center mt={"lg"}>
|
// <Center mt={"lg"}>
|
||||||
<Loader color={"yellow"} />
|
// <Loader color={"yellow"} />
|
||||||
</Center>
|
// </Center>
|
||||||
)}
|
// )}
|
||||||
data={data}
|
// data={data}
|
||||||
setData={setData}
|
// setData={setData}
|
||||||
moreData={async () => {
|
// moreData={async () => {
|
||||||
const loadData = await job_getAllStatusReview({
|
// const loadData = await job_getAllStatusReview({
|
||||||
page: activePage + 1,
|
// page: activePage + 1,
|
||||||
});
|
// });
|
||||||
|
|
||||||
setActivePage((val) => val + 1);
|
// setActivePage((val) => val + 1);
|
||||||
|
|
||||||
return loadData;
|
// return loadData;
|
||||||
}}
|
// }}
|
||||||
>
|
// >
|
||||||
{(item) => (
|
// {(item) => (
|
||||||
<ComponentJob_CardStatus
|
// <ComponentJob_CardStatus
|
||||||
data={item}
|
// data={item}
|
||||||
path={RouterJob.detail_review}
|
// path={RouterJob.detail_review}
|
||||||
/>
|
// />
|
||||||
)}
|
// )}
|
||||||
</ScrollOnly>
|
// </ScrollOnly>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
74
src/app_modules/job/main/status/ui_status.tsx
Normal file
74
src/app_modules/job/main/status/ui_status.tsx
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { MainColor } from "@/app_modules/_global/color";
|
||||||
|
import { globalStatusApp } from "@/app_modules/_global/lib";
|
||||||
|
import { RouterJob } from "@/lib/router_hipmi/router_job";
|
||||||
|
import { Stack, Tabs } from "@mantine/core";
|
||||||
|
import { useParams, useRouter } from "next/navigation";
|
||||||
|
import Job_NewViewStatus from "./view_status";
|
||||||
|
|
||||||
|
export default function Job_UiStatus() {
|
||||||
|
const router = useRouter();
|
||||||
|
const param = useParams<{ id: string }>();
|
||||||
|
const statusId = param.id;
|
||||||
|
|
||||||
|
// const [changeStatus, setChangeStatus] = useState(statusId);
|
||||||
|
// const [nameStatus, setNameStatus] = useState<string | undefined>("");
|
||||||
|
|
||||||
|
// async function onChangeStatus({ statusId }: { statusId: string }) {
|
||||||
|
// router.replace(RouterJob.status({ id: statusId }));
|
||||||
|
// const cek = globalStatusApp.find((e) => e.id === statusId);
|
||||||
|
|
||||||
|
// setNameStatus(cek?.name);
|
||||||
|
// }
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Tabs
|
||||||
|
mt={1}
|
||||||
|
color="yellow"
|
||||||
|
variant="pills"
|
||||||
|
radius={"xl"}
|
||||||
|
defaultValue={statusId}
|
||||||
|
value={statusId}
|
||||||
|
onTabChange={(val: any) => {
|
||||||
|
router.replace(RouterJob.status({ id: val }));
|
||||||
|
}}
|
||||||
|
styles={{
|
||||||
|
tabsList: {
|
||||||
|
backgroundColor: MainColor.darkblue,
|
||||||
|
position: "sticky",
|
||||||
|
top: 0,
|
||||||
|
zIndex: 99,
|
||||||
|
},
|
||||||
|
panel: {
|
||||||
|
paddingTop: 10,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Stack>
|
||||||
|
<Tabs.List grow>
|
||||||
|
{globalStatusApp.map((e) => (
|
||||||
|
<Tabs.Tab
|
||||||
|
key={e.id}
|
||||||
|
value={e.id}
|
||||||
|
fw={"bold"}
|
||||||
|
color={statusId === e.id ? "black" : MainColor.darkblue}
|
||||||
|
style={{
|
||||||
|
transition: "0.5s",
|
||||||
|
backgroundColor:
|
||||||
|
statusId === e.id ? MainColor.yellow : "white",
|
||||||
|
color: MainColor.darkblue,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{e.name}
|
||||||
|
</Tabs.Tab>
|
||||||
|
))}
|
||||||
|
</Tabs.List>
|
||||||
|
|
||||||
|
<Job_NewViewStatus />
|
||||||
|
</Stack>
|
||||||
|
</Tabs>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,107 +1,105 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||||
|
import { globalStatusApp } from "@/app_modules/_global/lib";
|
||||||
|
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||||
import { RouterJob } from "@/lib/router_hipmi/router_job";
|
import { RouterJob } from "@/lib/router_hipmi/router_job";
|
||||||
import { AccentColor, MainColor } from "@/app_modules/_global/color";
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
import { MODEL_NEW_DEFAULT_MASTER } from "@/app_modules/model_global/interface";
|
import { Center, Loader, Stack } from "@mantine/core";
|
||||||
import { Stack, Tabs } from "@mantine/core";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
import { useRouter } from "next/navigation";
|
import _ from "lodash";
|
||||||
|
import { ScrollOnly } from "next-scroll-loader";
|
||||||
|
import { useParams } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import Job_Draft from "./draft";
|
import { apiGetJobByStatus } from "../../component/api_fetch_job";
|
||||||
import Job_Publish from "./publish";
|
import ComponentJob_CardStatus from "../../component/card/card_view";
|
||||||
import Job_Reject from "./reject";
|
|
||||||
import Job_Review from "./review";
|
|
||||||
|
|
||||||
export default function Job_ViewStatus({
|
export default function Job_NewViewStatus() {
|
||||||
statusId,
|
const param = useParams<{ id: string }>();
|
||||||
dataJob,
|
const [data, setData] = useState<any[] | null>(null);
|
||||||
listStatus,
|
const [activePage, setActivePage] = useState(1);
|
||||||
}: {
|
|
||||||
statusId: string;
|
|
||||||
dataJob: any[];
|
|
||||||
listStatus: MODEL_NEW_DEFAULT_MASTER[];
|
|
||||||
}) {
|
|
||||||
const router = useRouter();
|
|
||||||
const [changeStatus, setChangeStatus] = useState(statusId);
|
|
||||||
|
|
||||||
// const listTabs = [
|
useShallowEffect(() => {
|
||||||
// {
|
handleLoadData();
|
||||||
// id: 1,
|
}, []);
|
||||||
// path: <Job_Publish listPublish={listPublish} />,
|
|
||||||
// value: "Publish",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// id: 2,
|
|
||||||
// path: <Job_Review listReview={listReview} />,
|
|
||||||
// value: "Review",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// id: 3,
|
|
||||||
// path: <Job_Draft listDraft={listDraft} />,
|
|
||||||
// value: "Draft",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// id: 4,
|
|
||||||
// path: <Job_Reject listReject={listReject} />,
|
|
||||||
// value: "Reject",
|
|
||||||
// },
|
|
||||||
// ];
|
|
||||||
|
|
||||||
async function onChangeStatus({ statusId }: { statusId: string }) {
|
const handleLoadData = async () => {
|
||||||
router.replace(RouterJob.status({ id: statusId }));
|
try {
|
||||||
|
const cek = globalStatusApp.find((e) => e.id === param.id);
|
||||||
|
const response = await apiGetJobByStatus({
|
||||||
|
status: cek?.name,
|
||||||
|
page: `${activePage}`,
|
||||||
|
});
|
||||||
|
if (response.success) {
|
||||||
|
console.log(response.data);
|
||||||
|
setData(response.data);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
clientLogger.error("Error get job", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const hanldeMoreData = async () => {
|
||||||
|
try {
|
||||||
|
const cek = globalStatusApp.find((e) => e.id === param.id);
|
||||||
|
const nextPage = activePage + 1;
|
||||||
|
const response = await apiGetJobByStatus({
|
||||||
|
status: cek?.name,
|
||||||
|
page: `${nextPage}`,
|
||||||
|
});
|
||||||
|
if (response.success) {
|
||||||
|
setActivePage(nextPage);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
clientLogger.error("Error get job", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!data)
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack>
|
||||||
|
<CustomSkeleton height={70} width={"100%"} />
|
||||||
|
<CustomSkeleton height={70} width={"100%"} />
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Tabs
|
{_.isEmpty(data) ? (
|
||||||
mt={1}
|
<ComponentGlobal_IsEmptyData />
|
||||||
color="yellow"
|
) : (
|
||||||
variant="pills"
|
<ScrollOnly
|
||||||
radius={"xl"}
|
height="75vh"
|
||||||
value={changeStatus}
|
renderLoading={() => (
|
||||||
onTabChange={(val: any) => {
|
<Center mt={"lg"}>
|
||||||
setChangeStatus(val);
|
<Loader color={"yellow"} />
|
||||||
onChangeStatus({ statusId: val });
|
</Center>
|
||||||
}}
|
)}
|
||||||
styles={{
|
data={data}
|
||||||
tabsList: {
|
setData={setData as any}
|
||||||
backgroundColor: MainColor.darkblue,
|
moreData={hanldeMoreData}
|
||||||
position: "sticky",
|
|
||||||
top: 0,
|
|
||||||
zIndex: 99,
|
|
||||||
},
|
|
||||||
panel: {
|
|
||||||
paddingTop: 10,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<Stack>
|
{(item) => (
|
||||||
<Tabs.List grow>
|
<ComponentJob_CardStatus
|
||||||
{listStatus.map((e) => (
|
data={item}
|
||||||
<Tabs.Tab
|
path={
|
||||||
key={e.id}
|
param.id == "1"
|
||||||
value={e.id}
|
? RouterJob.detail_publish
|
||||||
fw={"bold"}
|
: param.id == "2"
|
||||||
color={statusId === e.id ? "black" : "white"}
|
? RouterJob.detail_review
|
||||||
style={{
|
: param.id === "3"
|
||||||
transition: "0.5s",
|
? RouterJob.detail_draft
|
||||||
backgroundColor:
|
: param.id === "4"
|
||||||
statusId === e.id ? MainColor.yellow : "white",
|
? RouterJob.detail_reject
|
||||||
border:
|
: ""
|
||||||
statusId === e.id
|
}
|
||||||
? `1px solid ${AccentColor.yellow}`
|
/>
|
||||||
: `1px solid white`,
|
)}
|
||||||
}}
|
</ScrollOnly>
|
||||||
>
|
)}
|
||||||
{e.name}
|
|
||||||
</Tabs.Tab>
|
|
||||||
))}
|
|
||||||
</Tabs.List>
|
|
||||||
{statusId === "1" && <Job_Publish listPublish={dataJob} />}
|
|
||||||
{statusId === "2" && <Job_Review listReview={dataJob} />}
|
|
||||||
{statusId === "3" && <Job_Draft listDraft={dataJob} />}
|
|
||||||
{statusId === "4" && <Job_Reject listReject={dataJob} />}
|
|
||||||
</Stack>
|
|
||||||
</Tabs>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import "react-international-phone/style.css";
|
|||||||
import { Portofolio_ComponentButtonSelanjutnya } from "../component";
|
import { Portofolio_ComponentButtonSelanjutnya } from "../component";
|
||||||
import { useParams } from "next/navigation";
|
import { useParams } from "next/navigation";
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
import { apiGetMasterBidangBisnis } from "@/app_modules/_global/lib/api_master";
|
import { apiGetMasterBidangBisnis } from "@/app_modules/_global/lib/api_fetch_master";
|
||||||
import { MODEL_PORTOFOLIO_BIDANG_BISNIS } from "../model/interface";
|
import { MODEL_PORTOFOLIO_BIDANG_BISNIS } from "../model/interface";
|
||||||
import { clientLogger } from "@/util/clientLogger";
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
import ComponentGlobal_ErrorInput from "@/app_modules/_global/component/error_input";
|
import ComponentGlobal_ErrorInput from "@/app_modules/_global/component/error_input";
|
||||||
import ComponentGlobal_InputCountDown from "@/app_modules/_global/component/input_countdown";
|
import ComponentGlobal_InputCountDown from "@/app_modules/_global/component/input_countdown";
|
||||||
import { apiGetMasterBidangBisnis } from "@/app_modules/_global/lib/api_master";
|
import { apiGetMasterBidangBisnis } from "@/app_modules/_global/lib/api_fetch_master";
|
||||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global";
|
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global";
|
||||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||||
|
|||||||
Reference in New Issue
Block a user