diff --git a/package.json b/package.json
index 62dea927..56aa7c0c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "hipmi",
- "version": "1.1.1",
+ "version": "1.0.9",
"private": true,
"prisma": {
"seed": "npx tsx prisma/seed.ts"
diff --git a/src/app/dev/investasi/x_detail_portofolio/draft/[id]/layout.tsx b/src/app/dev/investasi/x_detail_portofolio/draft/[id]/layout.tsx
deleted file mode 100644
index 34780b41..00000000
--- a/src/app/dev/investasi/x_detail_portofolio/draft/[id]/layout.tsx
+++ /dev/null
@@ -1,8 +0,0 @@
-import { LayoutDetailDraftInvestasi } from "@/app_modules/investasi";
-import React from "react";
-
-export default async function Layout({children, params}: {children: React.ReactNode, params: {id: string}}) {
- return<>
- {children}
- >
-}
\ No newline at end of file
diff --git a/src/app/dev/investasi/x_detail_portofolio/draft/[id]/page.tsx b/src/app/dev/investasi/x_detail_portofolio/draft/[id]/page.tsx
deleted file mode 100644
index ce6a3451..00000000
--- a/src/app/dev/investasi/x_detail_portofolio/draft/[id]/page.tsx
+++ /dev/null
@@ -1,13 +0,0 @@
-import { DetailDraftInvestasi } from "@/app_modules/investasi";
-import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
-
-export default async function Page({params}: {params: {id: string}}) {
-
-
- const dataInvestasi = await getOneInvestasiById(params.id)
-
- return<>
-
-
- >
-}
\ No newline at end of file
diff --git a/src/app/dev/investasi/x_detail_portofolio/publish/[id]/layout.tsx b/src/app/dev/investasi/x_detail_portofolio/publish/[id]/layout.tsx
deleted file mode 100644
index a52bced1..00000000
--- a/src/app/dev/investasi/x_detail_portofolio/publish/[id]/layout.tsx
+++ /dev/null
@@ -1,9 +0,0 @@
-import { LayoutDetailPublishInvestasi } from "@/app_modules/investasi";
-import React from "react";
-
-export default async function Layout({children}: {children: React.ReactNode}) {
- return<>
- {children}
-
- >
-}
\ No newline at end of file
diff --git a/src/app/dev/investasi/x_detail_portofolio/publish/[id]/page.tsx b/src/app/dev/investasi/x_detail_portofolio/publish/[id]/page.tsx
deleted file mode 100644
index 0fbb7990..00000000
--- a/src/app/dev/investasi/x_detail_portofolio/publish/[id]/page.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import { DetailPublishInvestasi } from "@/app_modules/investasi";
-import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
-
-export default async function Page({ params }: { params: { id: string } }) {
- const dataInvestasi = await getOneInvestasiById(params.id);
- return (
- <>
-
- >
- );
-}
diff --git a/src/app/dev/investasi/x_detail_portofolio/reject/[id]/layout.tsx b/src/app/dev/investasi/x_detail_portofolio/reject/[id]/layout.tsx
deleted file mode 100644
index f0653738..00000000
--- a/src/app/dev/investasi/x_detail_portofolio/reject/[id]/layout.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import { LayoutDetailRejectInvestasi } from "@/app_modules/investasi";
-import React from "react";
-
-export default async function Layout({
- children,
- params,
-}: {
- children: React.ReactNode;
- params: { id: string };
-}) {
- return (
- <>
-
- {children}
-
- >
- );
-}
diff --git a/src/app/dev/investasi/x_detail_portofolio/reject/[id]/page.tsx b/src/app/dev/investasi/x_detail_portofolio/reject/[id]/page.tsx
deleted file mode 100644
index 23368b5b..00000000
--- a/src/app/dev/investasi/x_detail_portofolio/reject/[id]/page.tsx
+++ /dev/null
@@ -1,10 +0,0 @@
-import { DetailRejectInvestasi } from "@/app_modules/investasi";
-import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
-
-export default async function Page({params}: {params: {id: string}}) {
- const dataInvestasi = await getOneInvestasiById(params.id)
-// console.log(dataInvestasi)
- return<>
-
- >
-}
\ No newline at end of file
diff --git a/src/app/dev/investasi/x_detail_portofolio/review/[id]/layout.tsx b/src/app/dev/investasi/x_detail_portofolio/review/[id]/layout.tsx
deleted file mode 100644
index 30869978..00000000
--- a/src/app/dev/investasi/x_detail_portofolio/review/[id]/layout.tsx
+++ /dev/null
@@ -1,8 +0,0 @@
-import { LayoutDetailReviewInvestasi } from "@/app_modules/investasi";
-import React from "react";
-
-export default async function Layout({children}: {children: React.ReactNode}) {
- return<>
- {children}
- >
-}
\ No newline at end of file
diff --git a/src/app/dev/investasi/x_detail_portofolio/review/[id]/page.tsx b/src/app/dev/investasi/x_detail_portofolio/review/[id]/page.tsx
deleted file mode 100644
index 0b1bcf64..00000000
--- a/src/app/dev/investasi/x_detail_portofolio/review/[id]/page.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import { DetailReviewInvestasi } from "@/app_modules/investasi";
-import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
-
-export default async function Page({params}:{params : {id: string}}) {
-
- const dataInvestasi = await getOneInvestasiById(params.id)
- // console.log(dataInvestasi)
-
- return<>
-
- >
-}
\ No newline at end of file
diff --git a/src/app/dev/job/main/status/[id]/page.tsx b/src/app/dev/job/main/status/[id]/page.tsx
new file mode 100644
index 00000000..7ba51670
--- /dev/null
+++ b/src/app/dev/job/main/status/[id]/page.tsx
@@ -0,0 +1,23 @@
+import { Job_Status } from "@/app_modules/job";
+import { job_funGetAllByStatusId } from "@/app_modules/job/fun";
+import { job_funGetMasterStatus } from "@/app_modules/job/fun/get/get_master_status";
+
+export default async function Page({ params }: { params: { id: string } }) {
+ let statusId = params.id;
+
+ const dataJob = await job_funGetAllByStatusId({
+ page: 1,
+ statusId: statusId,
+ });
+ const listStatus = await job_funGetMasterStatus();
+
+ return (
+ <>
+
+ >
+ );
+}
diff --git a/src/app/dev/job/main/status/page.tsx b/src/app/dev/job/main/status/page.tsx
deleted file mode 100644
index 767d88b1..00000000
--- a/src/app/dev/job/main/status/page.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import { Job_Status } from "@/app_modules/job";
-import job_getAllStatusDraft from "@/app_modules/job/fun/get/status/get_list_draft";
-import job_getAllStatusPublish from "@/app_modules/job/fun/get/status/get_list_publish";
-import job_getAllStatusReject from "@/app_modules/job/fun/get/status/get_list_reject";
-import job_getAllStatusReview from "@/app_modules/job/fun/get/status/get_list_review";
-
-export default async function Page() {
- const listPublish = await job_getAllStatusPublish({page: 1});
- const listReview = await job_getAllStatusReview({ page: 1 });
- const listDraft = await job_getAllStatusDraft({ page: 1 });
- const listReject = await job_getAllStatusReject({page: 1});
-
- return (
- <>
-
- >
- );
-}
diff --git a/src/app/lib/router_hipmi/router_job.ts b/src/app/lib/router_hipmi/router_job.ts
index 3251efec..29cd8585 100644
--- a/src/app/lib/router_hipmi/router_job.ts
+++ b/src/app/lib/router_hipmi/router_job.ts
@@ -7,7 +7,12 @@ export const RouterJob = {
// main
beranda: "/dev/job/main/beranda",
- status: "/dev/job/main/status",
+ /**
+ *
+ * @param statusId | 1 - 4 | 1: Publish, 2: Review, 3: Draft, 4: Reject
+ * @returns
+ */
+ status: ({ id }: { id?: string }) => `/dev/job/main/status/${id}`,
arsip: "/dev/job/main/arsip",
// create & edit
diff --git a/src/app_modules/event/main/layout.tsx b/src/app_modules/event/main/layout.tsx
index 25c9ebab..4d530d49 100644
--- a/src/app_modules/event/main/layout.tsx
+++ b/src/app_modules/event/main/layout.tsx
@@ -17,6 +17,7 @@ import { useAtom } from "jotai";
import { useRouter } from "next/navigation";
import React from "react";
import { gs_event_hotMenu } from "../global_state";
+import { IconReservedLine } from "@tabler/icons-react";
export default function LayoutEvent_Main({
children,
@@ -38,7 +39,7 @@ export default function LayoutEvent_Main({
id: "2",
name: "Status",
path: RouterEvent.status({ id: "1" }),
- icon: ,
+ icon: ,
},
{
id: "3",
diff --git a/src/app_modules/job/component/button/comp_button_save_create.tsx b/src/app_modules/job/component/button/comp_button_save_create.tsx
index 45ced268..f566b851 100644
--- a/src/app_modules/job/component/button/comp_button_save_create.tsx
+++ b/src/app_modules/job/component/button/comp_button_save_create.tsx
@@ -61,7 +61,7 @@ function Job_ComponentButtonSaveCreate({
);
setHotMenu(2);
setStatus("Review");
- router.replace(RouterJob.status);
+ router.replace(RouterJob.status({ id: "2" }));
setIsLoading(true);
ComponentGlobal_NotifikasiBerhasil(createNoFile.message);
}
@@ -105,7 +105,7 @@ function Job_ComponentButtonSaveCreate({
);
setHotMenu(2);
setStatus("Review");
- router.replace(RouterJob.status);
+ router.replace(RouterJob.status({ id: "2" }));
setIsLoading(true);
ComponentGlobal_NotifikasiBerhasil(createWithFile.message);
}
diff --git a/src/app_modules/job/component/button/comp_button_update_data.tsx b/src/app_modules/job/component/button/comp_button_update_data.tsx
index edee3ede..8a60ec8f 100644
--- a/src/app_modules/job/component/button/comp_button_update_data.tsx
+++ b/src/app_modules/job/component/button/comp_button_update_data.tsx
@@ -12,7 +12,10 @@ import { useState } from "react";
import { job_EditById } from "../../fun/edit/fun_edit_by_id";
import { gs_job_hot_menu, gs_job_status } from "../../global_state";
import { MODEL_JOB } from "../../model/interface";
-import { funGlobal_UploadToStorage } from "@/app_modules/_global/fun";
+import {
+ funGlobal_DeleteFileById,
+ funGlobal_UploadToStorage,
+} from "@/app_modules/_global/fun";
import { DIRECTORY_ID } from "@/app/lib";
export function Job_ComponentButtonUpdateData({
@@ -26,7 +29,6 @@ export function Job_ComponentButtonUpdateData({
const [isLoading, setIsLoading] = useState(false);
const [hotMenu, setHotMenu] = useAtom(gs_job_hot_menu);
- const [status, setStatus] = useAtom(gs_job_status);
const [opened, { open, close }] = useDisclosure(false);
const [scroll, scrollTo] = useWindowScroll();
@@ -44,7 +46,13 @@ export function Job_ComponentButtonUpdateData({
});
if (!uploadFile.success)
- return ComponentGlobal_NotifikasiPeringatan("Gagal upload gambar");
+ return ComponentGlobal_NotifikasiPeringatan("Gagal upload gambar");
+
+ const delFile = await funGlobal_DeleteFileById({
+ fileId: value.imageId,
+ });
+ if (!delFile.success)
+ ComponentGlobal_NotifikasiPeringatan("Gagal hapus gambar lama");
const updateWithFile = await job_EditById({
data: value,
@@ -55,7 +63,6 @@ export function Job_ComponentButtonUpdateData({
}
setHotMenu(2);
- setStatus("Draft");
setIsLoading(true);
router.back();
return ComponentGlobal_NotifikasiBerhasil("Berhasil Update");
diff --git a/src/app_modules/job/detail/draft/view.tsx b/src/app_modules/job/detail/draft/view.tsx
index d41956b4..fec246f9 100644
--- a/src/app_modules/job/detail/draft/view.tsx
+++ b/src/app_modules/job/detail/draft/view.tsx
@@ -3,7 +3,6 @@
import { RouterJob } from "@/app/lib/router_hipmi/router_job";
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
import { Button, Group, Stack } from "@mantine/core";
-import { useAtom } from "jotai";
import ComponentGlobal_BoxInformation from "@/app_modules/_global/component/box_information";
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
@@ -16,37 +15,43 @@ import { useState } from "react";
import ComponentJob_DetailData from "../../component/detail/detail_data";
import { Job_funDeleteById } from "../../fun/delete/fun_delete_by_id";
import { Job_funEditStatusByStatusId } from "../../fun/edit/fun_edit_status_by_status_id";
-import { gs_job_status } from "../../global_state";
import { MODEL_JOB } from "../../model/interface";
+import { funGlobal_DeleteFileById } from "@/app_modules/_global/fun";
+import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global";
export default function Job_DetailDraft({ dataJob }: { dataJob: MODEL_JOB }) {
+ const [data, setData] = useState(dataJob);
+
return (
<>
- {dataJob.catatan ? (
+ {data.catatan ? (
) : (
""
)}
-
-
+
+
>
);
}
-function ButtonAction({ jobId }: { jobId: string }) {
+function ButtonAction({ jobId, imageId }: { jobId: string; imageId: string }) {
const router = useRouter();
- const [status, setStatus] = useAtom(gs_job_status);
const [opened, { open, close }] = useDisclosure();
const [isAjukan, setAjukan] = useState(false);
+ const [isLoading, setLoading] = useState(false);
+ const [isLoadingDelete, setLoadingDelete] = useState(false);
async function onAjukan() {
const update = await Job_funEditStatusByStatusId(jobId, "2");
if (update.status === 200) {
+ setLoading(true);
+
const dataNotif = {
appId: update.data?.id as any,
status: update.data?.MasterStatus?.name as any,
@@ -64,108 +69,38 @@ function ButtonAction({ jobId }: { jobId: string }) {
mqtt_client.publish("ADMIN", JSON.stringify({ count: 1 }));
}
- setStatus("Review");
ComponentGlobal_NotifikasiBerhasil("Berhasil Diajukan");
- router.push(RouterJob.status);
+ router.replace(RouterJob.status({ id: "2" }));
+
+ setLoading(false);
} else {
ComponentGlobal_NotifikasiGagal(update.message);
+ setLoading(false);
}
}
async function onDelete() {
- await Job_funDeleteById(jobId).then((res) => {
- if (res.status === 200) {
- setStatus("Draft");
- ComponentGlobal_NotifikasiBerhasil(res.message);
- router.push(RouterJob.status);
- } else {
- ComponentGlobal_NotifikasiGagal(res.message);
+ const res = await Job_funDeleteById(jobId);
+ if (res.status === 200) {
+ setLoadingDelete(true);
+
+ if (imageId) {
+ const delFile = await funGlobal_DeleteFileById({ fileId: imageId });
+ if (!delFile.success) {
+ ComponentGlobal_NotifikasiPeringatan("Gagal hapus gambar lama");
+ }
}
- });
+
+ ComponentGlobal_NotifikasiBerhasil(res.message);
+ router.replace(RouterJob.status({ id: "3" }));
+ } else {
+ ComponentGlobal_NotifikasiGagal(res.message);
+ setLoadingDelete(false);
+ }
}
return (
<>
- {/* HAPUS */}
- {/*
-
-
- Yakin ingin menghapus ini ?
-
-
-
-
-
-
- */}
-
- {/* AJUKAN KEMBALI */}
- {/* {
- setAjukan(false);
- }}
- centered
- withCloseButton={false}
- styles={{
- content: {
- backgroundColor: MainColor.darkblue,
- border: `2px solid ${AccentColor.blue}`,
- },
- }}
- >
-
-
- Anda yakin akan melakukan pengajuan review kembali ?
-
-
-
-
-
-
- */}
-
{/* Ajukan */}
{
@@ -211,13 +148,15 @@ function ButtonAction({ jobId }: { jobId: string }) {
}
buttonKanan={
}
/>
diff --git a/src/app_modules/job/detail/reject/view.tsx b/src/app_modules/job/detail/reject/view.tsx
index b96c95e0..35537ae5 100644
--- a/src/app_modules/job/detail/reject/view.tsx
+++ b/src/app_modules/job/detail/reject/view.tsx
@@ -3,44 +3,46 @@
import { RouterJob } from "@/app/lib/router_hipmi/router_job";
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
import { Button, Group, Stack } from "@mantine/core";
-import { useAtom } from "jotai";
import ComponentGlobal_BoxInformation from "@/app_modules/_global/component/box_information";
+import { funGlobal_DeleteFileById } from "@/app_modules/_global/fun";
+import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global";
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
import UIGlobal_Modal from "@/app_modules/_global/ui/ui_modal";
import { useDisclosure } from "@mantine/hooks";
import { useRouter } from "next/navigation";
+import { useState } from "react";
import ComponentJob_DetailData from "../../component/detail/detail_data";
import { Job_funDeleteById } from "../../fun/delete/fun_delete_by_id";
import { Job_funEditStatusByStatusId } from "../../fun/edit/fun_edit_status_by_status_id";
-import { gs_job_status } from "../../global_state";
import { MODEL_JOB } from "../../model/interface";
export default function Job_DetailReject({ dataJob }: { dataJob: MODEL_JOB }) {
+ const [data, setData] = useState(dataJob);
+
return (
<>
-
-
+
+
>
);
}
-function ButtonAction({ jobId }: { jobId: string }) {
+function ButtonAction({ jobId, imageId }: { jobId: string; imageId: string }) {
const router = useRouter();
- const [status, setStatus] = useAtom(gs_job_status);
const [opened, { open, close }] = useDisclosure();
+ const [isLoadingDelete, setLoadingDelete] = useState(false);
async function onEditKembali() {
await Job_funEditStatusByStatusId(jobId, "3").then((res) => {
if (res.status === 200) {
- router.push(RouterJob.status);
- setStatus("Draft");
+ router.replace(RouterJob.status({ id: "3" }));
ComponentGlobal_NotifikasiBerhasil("Masuk Draft");
} else {
ComponentGlobal_NotifikasiGagal(res.message);
@@ -49,15 +51,23 @@ function ButtonAction({ jobId }: { jobId: string }) {
}
async function onDelete() {
- await Job_funDeleteById(jobId).then((res) => {
- if (res.status === 200) {
- router.push(RouterJob.status);
- setStatus("Reject");
- ComponentGlobal_NotifikasiBerhasil("Berhasil Hapus Job");
- } else {
- ComponentGlobal_NotifikasiGagal(res.message);
+ const res = await Job_funDeleteById(jobId);
+ if (res.status === 200) {
+ setLoadingDelete(true);
+
+ if (imageId) {
+ const delFile = await funGlobal_DeleteFileById({ fileId: imageId });
+ if (!delFile.success) {
+ ComponentGlobal_NotifikasiPeringatan("Gagal hapus gambar lama");
+ }
}
- });
+
+ router.replace(RouterJob.status({ id: "4" }));
+ ComponentGlobal_NotifikasiBerhasil("Berhasil Hapus Job");
+ } else {
+ ComponentGlobal_NotifikasiGagal(res.message);
+ setLoadingDelete(false);
+ }
}
return (
@@ -78,6 +88,8 @@ function ButtonAction({ jobId }: { jobId: string }) {
}
buttonKanan={