diff --git a/.gitignore b/.gitignore index 8fbb7710..61b4bc33 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,5 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts + +certificates \ No newline at end of file diff --git a/gen_api.ts b/gen_api.ts deleted file mode 100644 index 82d5f284..00000000 --- a/gen_api.ts +++ /dev/null @@ -1,210 +0,0 @@ -import app_config from "@/util/app_config"; - - export const gen_api = { -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/test-scroll/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/test-scroll/route.ts) - */ -testScroll : async ({isServer}: {isServer?: boolean}) => { - - return fetch(`${isServer && app_config.host || ''}/api/test-scroll/`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/seeder/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/seeder/route.ts) - */ -seeder : async ({isServer}: {isServer?: boolean}) => { - - return fetch(`${isServer && app_config.host || ''}/api/seeder/`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/profile/url_foto/[url]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/profile/url_foto/[url]/route.ts) - */ -profileUrl_fotoUrlByUrl : async ({url, isServer}: {url: string, isServer?: boolean}) => { - - return fetch(`${isServer && app_config.host || ''}/api/profile/url_foto/${url}/`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/profile/url_background/[url]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/profile/url_background/[url]/route.ts) - */ -profileUrl_backgroundUrlByUrl : async ({url, isServer}: {url: string, isServer?: boolean}) => { - - return fetch(`${isServer && app_config.host || ''}/api/profile/url_background/${url}/`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/profile/foto/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/profile/foto/[id]/route.ts) - */ -profileFotoIdById : async ({id, isServer}: {id: string, isServer?: boolean}) => { - - return fetch(`${isServer && app_config.host || ''}/api/profile/foto/${id}/`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/profile/background/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/profile/background/[id]/route.ts) - */ -profileBackgroundIdById : async ({id, isServer}: {id: string, isServer?: boolean}) => { - - return fetch(`${isServer && app_config.host || ''}/api/profile/background/${id}/`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/portofolio/logo/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/portofolio/logo/[id]/route.ts) - */ -portofolioLogoIdById : async ({id, isServer}: {id: string, isServer?: boolean}) => { - - return fetch(`${isServer && app_config.host || ''}/api/portofolio/logo/${id}/`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/job/gambar/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/job/gambar/[id]/route.ts) - */ -jobGambarIdById : async ({id, isServer}: {id: string, isServer?: boolean}) => { - - return fetch(`${isServer && app_config.host || ''}/api/job/gambar/${id}/`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/investasi/prospektus/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/investasi/prospektus/[id]/route.ts) - */ -investasiProspektusIdById : async ({id, isServer}: {id: string, isServer?: boolean}) => { - - return fetch(`${isServer && app_config.host || ''}/api/investasi/prospektus/${id}/`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/investasi/midtrans/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/investasi/midtrans/[id]/route.ts) - */ -investasiMidtransIdById : async ({id, isServer}: {id: string, isServer?: boolean}) => { - - return fetch(`${isServer && app_config.host || ''}/api/investasi/midtrans/${id}/`, { method: 'POST', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/investasi/gambar/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/investasi/gambar/[id]/route.ts) - */ -investasiGambarIdById : async ({id, isServer}: {id: string, isServer?: boolean}) => { - - return fetch(`${isServer && app_config.host || ''}/api/investasi/gambar/${id}/`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/investasi/dokumen/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/investasi/dokumen/[id]/route.ts) - */ -investasiDokumenIdById : async ({id, isServer}: {id: string, isServer?: boolean}) => { - - return fetch(`${isServer && app_config.host || ''}/api/investasi/dokumen/${id}/`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/image_cerita/[url]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/image_cerita/[url]/route.ts) - */ -donasiImage_ceritaUrlByUrl : async ({url, isServer}: {url: string, isServer?: boolean}) => { - - return fetch(`${isServer && app_config.host || ''}/api/donasi/image_cerita/${url}/`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/image/[url]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/image/[url]/route.ts) - */ -donasiImageUrlByUrl : async ({url, isServer}: {url: string, isServer?: boolean}) => { - - return fetch(`${isServer && app_config.host || ''}/api/donasi/image/${url}/`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/gambar_pencairan/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/gambar_pencairan/[id]/route.ts) - */ -donasiGambar_pencairanIdById : async ({id, isServer}: {id: string, isServer?: boolean}) => { - - return fetch(`${isServer && app_config.host || ''}/api/donasi/gambar_pencairan/${id}/`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/gambar_kabar/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/gambar_kabar/[id]/route.ts) - */ -donasiGambar_kabarIdById : async ({id, isServer}: {id: string, isServer?: boolean}) => { - - return fetch(`${isServer && app_config.host || ''}/api/donasi/gambar_kabar/${id}/`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/gambar_cerita/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/gambar_cerita/[id]/route.ts) - */ -donasiGambar_ceritaIdById : async ({id, isServer}: {id: string, isServer?: boolean}) => { - - return fetch(`${isServer && app_config.host || ''}/api/donasi/gambar_cerita/${id}/`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/gambar_bukti_transfer/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/gambar_bukti_transfer/[id]/route.ts) - */ -donasiGambar_bukti_transferIdById : async ({id, isServer}: {id: string, isServer?: boolean}) => { - - return fetch(`${isServer && app_config.host || ''}/api/donasi/gambar_bukti_transfer/${id}/`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/gambar/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/gambar/[id]/route.ts) - */ -donasiGambarIdById : async ({id, isServer}: {id: string, isServer?: boolean}) => { - - return fetch(`${isServer && app_config.host || ''}/api/donasi/gambar/${id}/`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/auth/validasi/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/auth/validasi/route.ts) - */ -authValidasi : async ({isServer}: {isServer?: boolean}) => { - - return fetch(`${isServer && app_config.host || ''}/api/auth/validasi/`, { method: 'POST', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/auth/register/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/auth/register/route.ts) - */ -authRegister : async ({isServer}: {isServer?: boolean}) => { - - return fetch(`${isServer && app_config.host || ''}/api/auth/register/`, { method: 'POST', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/auth/logout/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/auth/logout/route.ts) - */ -authLogout : async ({isServer}: {isServer?: boolean}) => { - - return fetch(`${isServer && app_config.host || ''}/api/auth/logout/`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/auth/login/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/auth/login/route.ts) - */ -authLogin : async ({isServer}: {isServer?: boolean}) => { - - return fetch(`${isServer && app_config.host || ''}/api/auth/login/`, { method: 'POST', cache: 'no-cache' }) - .then(res => res.json()); -} -}; \ No newline at end of file diff --git a/package.json b/package.json index 434b142a..5b8bc141 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { "name": "hipmi", - "version": "1.0.6", + "version": "1.1.0", "private": true, "prisma": { "seed": "npx tsx prisma/seed.ts" }, "scripts": { - "dev": "next dev ", + "dev": "next dev --experimental-https", "build": "next build", "start": "next start", "lint": "next lint" diff --git a/src/app/dev/admin/award/main/page.tsx b/src/app/dev/admin/award/main/page.tsx index 3c270cb2..6f07e7f7 100644 --- a/src/app/dev/admin/award/main/page.tsx +++ b/src/app/dev/admin/award/main/page.tsx @@ -1,5 +1,4 @@ import { Admin_Award } from "@/app_modules/admin/award"; -import { gen_api } from "../../../../../../gen_api"; export default async function Page() { diff --git a/src/app/dev/event/main/riwayat/[id]/page.tsx b/src/app/dev/event/main/riwayat/[id]/page.tsx new file mode 100644 index 00000000..024aa414 --- /dev/null +++ b/src/app/dev/event/main/riwayat/[id]/page.tsx @@ -0,0 +1,32 @@ +import { Event_Riwayat } from "@/app_modules/event"; +import { event_getListRiwayatSaya } from "@/app_modules/event/fun/get/riwayat/get_list_riwayat_saya"; +import { event_getListSemuaRiwayat } from "@/app_modules/event/fun/get/riwayat/get_list_semua_riwayat"; + +export default async function Page({ params }: { params: { id: string } }) { + let statusRiwayatId = params.id; + + const dataSemuaRiwayat = await event_getListSemuaRiwayat({ page: 1 }); + const dataRiwayatSaya = await event_getListRiwayatSaya({ page: 1 }); + + if (statusRiwayatId == "1") { + return ( + <> + + + ); + } + + if (statusRiwayatId == "2") { + return ( + <> + + + ); + } +} diff --git a/src/app/dev/event/main/riwayat/page.tsx b/src/app/dev/event/main/riwayat/page.tsx deleted file mode 100644 index 44f99fd3..00000000 --- a/src/app/dev/event/main/riwayat/page.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Event_Riwayat } from "@/app_modules/event"; -import { event_getListRiwayatSaya } from "@/app_modules/event/fun/get/get_list_riwayat_saya"; -import { event_getListSemuaRiwayat } from "@/app_modules/event/fun/get/riwayat/get_list_semua_riwayat"; - -export default async function Page({ params }: { params: { id: string } }) { - let eventId = params.id; - const dataSemuaRiwayat = await event_getListSemuaRiwayat({ page: 1 }); - const dataRiwayatSaya = await event_getListRiwayatSaya({ page: 1 }); - - return ( - - ); -} diff --git a/src/app/dev/event/main/status/[id]/page.tsx b/src/app/dev/event/main/status/[id]/page.tsx new file mode 100644 index 00000000..01ab75d3 --- /dev/null +++ b/src/app/dev/event/main/status/[id]/page.tsx @@ -0,0 +1,29 @@ +import { funGetUserIdByToken } from "@/app_modules/_global/fun/get"; +import { Event_StatusPage } from "@/app_modules/event"; +import { + event_getAllByStatusId, + event_getMasterStatus, +} from "@/app_modules/event/fun"; +import React from "react"; + +async function Page({ params }: { params: { id: string } }) { + let statusId = params.id; + const listStatus = await event_getMasterStatus(); + + const dataStatus = await event_getAllByStatusId({ + page: 1, + statusId: statusId, + }); + + return ( + <> + + + ); +} + +export default Page; diff --git a/src/app/dev/event/main/status_page/page.tsx b/src/app/dev/event/main/status_page/page.tsx index 4c02d9a1..d99da96d 100644 --- a/src/app/dev/event/main/status_page/page.tsx +++ b/src/app/dev/event/main/status_page/page.tsx @@ -14,12 +14,13 @@ export default async function Page() { const listReject = await event_getAllReject({ page: 1 }); return ( - + <>maintenace + // ); } diff --git a/src/app/lib/router_hipmi/router_event.ts b/src/app/lib/router_hipmi/router_event.ts index 833979c2..fcbd0cd9 100644 --- a/src/app/lib/router_hipmi/router_event.ts +++ b/src/app/lib/router_hipmi/router_event.ts @@ -2,15 +2,21 @@ export const RouterEvent = { //main splash: "/dev/event/splash", beranda: "/dev/event/main/beranda", - status_page: "/dev/event/main/status_page", + // status_page: "/dev/event/main/status_page", kontribusi: "/dev/event/main/kontribusi", - riwayat: "/dev/event/main/riwayat", + riwayat: ({ id }: { id: string }) => `/dev/event/main/riwayat/${id}`, + /** + * + * @param statusId | 1 - 4 | 1: Publish, 2: Review, 3: Draft, 4: Reject + * @type string + */ // status - status_publish: "/dev/event/main/status_page/publish", - status_review: "/dev/event/main/status_page/review", - status_draft: "/dev/event/main/status_page/draft", - status_reject: "/dev/event/main/status_page/reject", + status: ({ id }: { id?: string }) => `/dev/event/main/status/${id}`, + // status_publish: "/dev/event/main/status_page/publish", + // status_review: "/dev/event/main/status_page/review", + // status_draft: "/dev/event/main/status_page/draft", + // status_reject: "/dev/event/main/status_page/reject", //create create: "/dev/event/create", diff --git a/src/app_modules/event/create/create.tsx b/src/app_modules/event/create/create.tsx index 27e45782..c2a6f73f 100644 --- a/src/app_modules/event/create/create.tsx +++ b/src/app_modules/event/create/create.tsx @@ -14,7 +14,7 @@ import { useRouter } from "next/navigation"; import { useState } from "react"; import ComponentEvent_ErrorMaximalInput from "../component/error_maksimal_input"; import { Event_funCreate } from "../fun/create/fun_create"; -import { gs_event_hotMenu, gs_event_status } from "../global_state"; +import { gs_event_hotMenu } from "../global_state"; import { MainColor } from "@/app_modules/_global/color/color_pallet"; import mqtt_client from "@/util/mqtt_client"; import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin"; @@ -27,7 +27,6 @@ export default function Event_Create({ authorId: string; }) { const router = useRouter(); - const [tabsStatus, setTabsStatus] = useAtom(gs_event_status); const [listTipe, setListTipe] = useState(listTipeAcara); const [hotMenu, setHotMenu] = useAtom(gs_event_hotMenu); const [isTime, setIsTime] = useState(false); @@ -177,7 +176,7 @@ export default function Event_Create({ radius={"xl"} mt={"xl"} onClick={() => { - onSave(router, setTabsStatus, value, setHotMenu, setLoading); + onSave(router, value, setHotMenu, setLoading); }} bg={MainColor.yellow} color="yellow" @@ -191,7 +190,6 @@ export default function Event_Create({ async function onSave( router: AppRouterInstance, - setTabsStatus: any, value: any, setHotMenu: any, setLoading: any @@ -231,10 +229,9 @@ async function onSave( ); ComponentGlobal_NotifikasiBerhasil(res.message); - setTabsStatus("Review"); setHotMenu(1); setLoading(true); - router.push(RouterEvent.status_page); + router.push(RouterEvent.status({ id: "2" }), { scroll: false }); } } else { ComponentGlobal_NotifikasiGagal(res.message); diff --git a/src/app_modules/event/detail/draft/index.tsx b/src/app_modules/event/detail/draft/index.tsx index 6eb84a28..4d0b7661 100644 --- a/src/app_modules/event/detail/draft/index.tsx +++ b/src/app_modules/event/detail/draft/index.tsx @@ -1,31 +1,31 @@ "use client"; -import { Button, Group, Stack } from "@mantine/core"; -import ComponentEvent_DetailData from "../../component/detail/detail_data"; +import { RouterEvent } from "@/app/lib/router_hipmi/router_event"; import ComponentGlobal_BoxInformation from "@/app_modules/_global/component/box_information"; import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil"; import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal"; import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan"; import UIGlobal_Modal from "@/app_modules/_global/ui/ui_modal"; -import { useAtom } from "jotai"; +import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin"; +import mqtt_client from "@/util/mqtt_client"; +import { Button, Group, Stack } from "@mantine/core"; import moment from "moment"; import { useRouter } from "next/navigation"; import { useState } from "react"; +import ComponentEvent_DetailData from "../../component/detail/detail_data"; import { Event_funDeleteById } from "../../fun/delete/fun_delete"; import { Event_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id"; -import { gs_event_status } from "../../global_state"; import { MODEL_EVENT } from "../../model/interface"; -import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin"; -import mqtt_client from "@/util/mqtt_client"; export default function Event_DetailDraft({ dataEvent, }: { dataEvent: MODEL_EVENT; }) { + const [data, setData] = useState(dataEvent); return ( <> - {/*
{JSON.stringify(dataEvent.catatan)}
*/} + {/*
{JSON.stringify(dataEvent.tanggal)}
*/} {dataEvent?.catatan ? ( - + + ); } -function ButtonAction({ eventId, tanggal }: { eventId: string; tanggal: any }) { +function ButtonAction({ + eventId, + tanggal, +}: { + eventId: string; + tanggal?: any; +}) { const router = useRouter(); const [isLoadingDelete, setLoadingDelete] = useState(false); const [isLoadingAjukan, setLoadingAjukan] = useState(false); - const [tabsStatus, setTabsStatus] = useAtom(gs_event_status); const [openModal1, setOpenModal1] = useState(false); const [openModal2, setOpenModal2] = useState(false); async function onDelete() { - await Event_funDeleteById(eventId).then((res) => { - if (res.status === 200) { - ComponentGlobal_NotifikasiBerhasil(res.message, 2000); - setLoadingDelete(true); - setTabsStatus("Draft"); - close(); - router.back(); - } else { - ComponentGlobal_NotifikasiGagal(res.message); - } - }); + const res = await Event_funDeleteById(eventId); + if (res.status === 200) { + router.back(); + ComponentGlobal_NotifikasiBerhasil(res.message, 2000); + setLoadingDelete(true); + } else { + ComponentGlobal_NotifikasiGagal(res.message); + } } async function onAjukan() { @@ -91,9 +93,8 @@ function ButtonAction({ eventId, tanggal }: { eventId: string; tanggal: any }) { }) ); ComponentGlobal_NotifikasiBerhasil(res.message, 2000); - setTabsStatus("Review"); setLoadingAjukan(true); - router.back(); + router.replace(RouterEvent.status({ id: "2" })); } } else { ComponentGlobal_NotifikasiGagal(res.message); diff --git a/src/app_modules/event/detail/reject/index.tsx b/src/app_modules/event/detail/reject/index.tsx index 6e7247f5..6e25c05b 100644 --- a/src/app_modules/event/detail/reject/index.tsx +++ b/src/app_modules/event/detail/reject/index.tsx @@ -1,77 +1,38 @@ "use client"; -import { - Box, - Button, - Grid, - Group, - Modal, - Paper, - SimpleGrid, - Stack, - Text, - Title, -} from "@mantine/core"; -import ComponentEvent_DetailData from "../../component/detail/detail_data"; -import { useRouter } from "next/navigation"; -import { useAtom } from "jotai"; -import { gs_event_status } from "../../global_state"; -import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime"; -import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil"; -import { useDisclosure } from "@mantine/hooks"; -import { MODEL_EVENT } from "../../model/interface"; -import { Event_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id"; -import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal"; -import ComponentEvent_CatatanReject from "../../component/catatan_reject"; -import { Event_funDeleteById } from "../../fun/delete/fun_delete"; +import { RouterEvent } from "@/app/lib/router_hipmi/router_event"; import ComponentGlobal_BoxInformation from "@/app_modules/_global/component/box_information"; -import { useState } from "react"; +import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil"; +import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal"; import UIGlobal_Modal from "@/app_modules/_global/ui/ui_modal"; +import { Button, SimpleGrid, Stack } from "@mantine/core"; +import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import ComponentEvent_DetailData from "../../component/detail/detail_data"; +import { Event_funDeleteById } from "../../fun/delete/fun_delete"; +import { Event_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id"; +import { MODEL_EVENT } from "../../model/interface"; export default function Event_DetailReject({ dataEvent, }: { dataEvent: MODEL_EVENT; }) { + const [data, setData] = useState(dataEvent); return ( <> - - - + + + - - {/* - - Yakin akan menghapus event ini? - - - - - - */} ); } function ButtonAction({ eventId }: { eventId: string }) { const router = useRouter(); - const [tabsStatus, setTabsStatus] = useAtom(gs_event_status); const [openModal1, setOpenModal1] = useState(false); const [openModal2, setOpenModal2] = useState(false); @@ -113,7 +74,7 @@ function ButtonAction({ eventId }: { eventId: string }) { radius={"xl"} color={"yellow"} onClick={() => { - onUpdate(router, setTabsStatus, eventId); + onUpdate(router, eventId); setOpenModal1(false); }} > @@ -137,9 +98,8 @@ function ButtonAction({ eventId }: { eventId: string }) { radius={"xl"} color={"red"} onClick={() => { - onDelete(router, eventId, close); + onDelete(router, eventId); setOpenModal2(false); - }} > Hapus @@ -150,32 +110,23 @@ function ButtonAction({ eventId }: { eventId: string }) { ); } -async function onUpdate( - router: AppRouterInstance, - setTabsStatus: any, - eventId: string -) { +async function onUpdate(router: AppRouterInstance, eventId: string) { await Event_funEditStatusById("3", eventId).then((res) => { if (res.status === 200) { ComponentGlobal_NotifikasiBerhasil(res.message); - setTabsStatus("Draft"); - router.back(); + router.push(RouterEvent.status({ id: "3" })); } else { ComponentGlobal_NotifikasiGagal(res.message); } }); } -async function onDelete( - router: AppRouterInstance, - eventId: string, - close: any -) { - await Event_funDeleteById(eventId).then((res) => { - if (res.status === 200) { - ComponentGlobal_NotifikasiBerhasil(res.message, 2000); - } else { - ComponentGlobal_NotifikasiGagal(res.message); - } - }); +async function onDelete(router: AppRouterInstance, eventId: string) { + const res = await Event_funDeleteById(eventId); + if (res.status === 200) { + ComponentGlobal_NotifikasiBerhasil(res.message, 2000); + router.back(); + } else { + ComponentGlobal_NotifikasiGagal(res.message); + } } diff --git a/src/app_modules/event/detail/review/index.tsx b/src/app_modules/event/detail/review/index.tsx index 489db857..fef47024 100644 --- a/src/app_modules/event/detail/review/index.tsx +++ b/src/app_modules/event/detail/review/index.tsx @@ -1,18 +1,17 @@ "use client"; +import { RouterEvent } from "@/app/lib/router_hipmi/router_event"; import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil"; import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal"; import UIGlobal_Modal from "@/app_modules/_global/ui/ui_modal"; import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin"; import mqtt_client from "@/util/mqtt_client"; import { Button, Stack } from "@mantine/core"; -import { useAtom } from "jotai"; import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime"; import { useRouter } from "next/navigation"; import { useState } from "react"; import ComponentEvent_DetailData from "../../component/detail/detail_data"; import { Event_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id"; -import { gs_event_status } from "../../global_state"; import { MODEL_EVENT } from "../../model/interface"; export default function Event_DetailReview({ @@ -32,14 +31,11 @@ export default function Event_DetailReview({ function ButtonAction({ eventId }: { eventId: string }) { const router = useRouter(); - const [tabsStatus, setTabsStatus] = useAtom(gs_event_status); const [isLoading, setLoading] = useState(false); const [openModal, setOpenModal] = useState(false); return ( <> @@ -72,7 +70,6 @@ function ButtonAction({ eventId }: { eventId: string }) { async function onClick( router: AppRouterInstance, - setTabsStatus: any, eventId: string, setLoading: any ) { @@ -100,9 +97,8 @@ async function onClick( ); ComponentGlobal_NotifikasiBerhasil(res.message, 1500); - setTabsStatus("Draft"); setLoading(true); - router.back(); + router.replace(RouterEvent.status({ id: "3" })); } } else { ComponentGlobal_NotifikasiGagal(res.message); diff --git a/src/app_modules/event/fun/delete/fun_delete.ts b/src/app_modules/event/fun/delete/fun_delete.ts index cc15c255..7d896b79 100644 --- a/src/app_modules/event/fun/delete/fun_delete.ts +++ b/src/app_modules/event/fun/delete/fun_delete.ts @@ -1,9 +1,11 @@ "use server"; import prisma from "@/app/lib/prisma"; +import { RouterEvent } from "@/app/lib/router_hipmi/router_event"; import { revalidatePath } from "next/cache"; export async function Event_funDeleteById(eventId: string) { + console.log(eventId); const del = await prisma.event.delete({ where: { id: eventId, @@ -11,17 +13,9 @@ export async function Event_funDeleteById(eventId: string) { }); if (!del) return { status: 400, message: "Gagal hapus data" }; - // const delTemporary = await prisma.event.update({ - // where: { - // id: eventId, - // }, - // data: { - // active: false, - // }, - // }); - // if (!delTemporary) return { status: 400, message: "Gagal hapus data" }; + revalidatePath("/dev/event/main/status/3"); + revalidatePath("/dev/event/main/status/4"); - revalidatePath("/dev/event/main/status_page"); return { status: 200, message: "Hapus data berhasil", diff --git a/src/app_modules/event/fun/edit/fun_edit_by_id.ts b/src/app_modules/event/fun/edit/fun_edit_by_id.ts index b23c8253..d9c675d1 100644 --- a/src/app_modules/event/fun/edit/fun_edit_by_id.ts +++ b/src/app_modules/event/fun/edit/fun_edit_by_id.ts @@ -3,6 +3,7 @@ import prisma from "@/app/lib/prisma"; import { MODEL_EVENT } from "../../model/interface"; import { revalidatePath } from "next/cache"; +import { RouterEvent } from "@/app/lib/router_hipmi/router_event"; export async function Event_funEditById(data: MODEL_EVENT) { const updt = await prisma.event.update({ @@ -19,7 +20,7 @@ export async function Event_funEditById(data: MODEL_EVENT) { }); if (!updt) return { status: 400, message: "Update Gagal" }; - revalidatePath("/dev/event/detail/event"); + revalidatePath(RouterEvent.detail_draft + data.id); return { status: 200, message: "Berhasil Update", diff --git a/src/app_modules/event/fun/get/get_list_riwayat_saya.ts b/src/app_modules/event/fun/get/riwayat/get_list_riwayat_saya.ts similarity index 100% rename from src/app_modules/event/fun/get/get_list_riwayat_saya.ts rename to src/app_modules/event/fun/get/riwayat/get_list_riwayat_saya.ts diff --git a/src/app_modules/event/fun/get/status/get_all_by_status_id.tsx b/src/app_modules/event/fun/get/status/get_all_by_status_id.tsx new file mode 100644 index 00000000..c9cb90dc --- /dev/null +++ b/src/app_modules/event/fun/get/status/get_all_by_status_id.tsx @@ -0,0 +1,38 @@ +"use server"; + +import { prisma } from "@/app/lib"; +import { funGetUserIdByToken } from "@/app_modules/_global/fun/get"; + +export async function event_getAllByStatusId({ + page, + statusId, +}: { + page: number; + statusId: string; +}) { + const userLoginId = await funGetUserIdByToken(); + + const takeData = 10; + const skipData = page * takeData - takeData; + + const data = await prisma.event.findMany({ + take: takeData, + skip: skipData, + orderBy: { + updatedAt: "desc", + }, + where: { + active: true, + eventMaster_StatusId: statusId, + authorId: userLoginId, + }, + select: { + id: true, + title: true, + deskripsi: true, + tanggal: true, + }, + }); + + return data; +} diff --git a/src/app_modules/event/fun/index.ts b/src/app_modules/event/fun/index.ts new file mode 100644 index 00000000..e8dffb0d --- /dev/null +++ b/src/app_modules/event/fun/index.ts @@ -0,0 +1,5 @@ +import { event_getAllByStatusId } from "./get/status/get_all_by_status_id"; +import { event_getMasterStatus } from "./master/get_status_event"; + +export { event_getAllByStatusId }; +export { event_getMasterStatus }; diff --git a/src/app_modules/event/fun/master/get_status_event.ts b/src/app_modules/event/fun/master/get_status_event.ts new file mode 100644 index 00000000..e86db9cd --- /dev/null +++ b/src/app_modules/event/fun/master/get_status_event.ts @@ -0,0 +1,9 @@ +"use server"; + +import { prisma } from "@/app/lib"; + +export async function event_getMasterStatus() { + const data = await prisma.eventMaster_Status.findMany({}); + + return data; +} diff --git a/src/app_modules/event/global_state/index.ts b/src/app_modules/event/global_state/index.ts index 71b2cc3e..310e4a91 100644 --- a/src/app_modules/event/global_state/index.ts +++ b/src/app_modules/event/global_state/index.ts @@ -11,9 +11,3 @@ export const gs_event_hotMenu = atomWithStorage("gs_event_hotMenu", 0) * @type string */ export const gs_event_status = atomWithStorage("gs_status_event", "Publish") - -/** - * @param riwayat | "Semua", "Saya" - * @type string - */ -export const gs_event_riwayat = atomWithStorage("gs_event_riwayat", "Semua") \ No newline at end of file diff --git a/src/app_modules/event/main/layout.tsx b/src/app_modules/event/main/layout.tsx index 6e3ff818..25c9ebab 100644 --- a/src/app_modules/event/main/layout.tsx +++ b/src/app_modules/event/main/layout.tsx @@ -6,17 +6,12 @@ import { MainColor } from "@/app_modules/_global/color/color_pallet"; import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan"; import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate"; import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate"; -import { - ActionIcon, - SimpleGrid, - Stack, - Text -} from "@mantine/core"; +import { ActionIcon, SimpleGrid, Stack, Text } from "@mantine/core"; import { IconCalendarEvent, IconHistory, IconHome, - IconTimelineEventText + IconTimelineEventText, } from "@tabler/icons-react"; import { useAtom } from "jotai"; import { useRouter } from "next/navigation"; @@ -42,7 +37,7 @@ export default function LayoutEvent_Main({ { id: "2", name: "Status", - path: RouterEvent.status_page, + path: RouterEvent.status({ id: "1" }), icon: , }, { @@ -54,7 +49,7 @@ export default function LayoutEvent_Main({ { id: "4", name: "Riwayat", - path: RouterEvent.riwayat, + path: RouterEvent.riwayat({ id: "1" }), icon: , }, ]; diff --git a/src/app_modules/event/main/riwayat/index.tsx b/src/app_modules/event/main/riwayat/index.tsx index 8dc531dc..69d4da09 100644 --- a/src/app_modules/event/main/riwayat/index.tsx +++ b/src/app_modules/event/main/riwayat/index.tsx @@ -1,48 +1,57 @@ "use client"; import { Stack, Tabs } from "@mantine/core"; - -import { AccentColor, MainColor } from "@/app_modules/_global/color/color_pallet"; -import { useAtom } from "jotai"; +import { RouterEvent } from "@/app/lib/router_hipmi/router_event"; +import { + AccentColor, + MainColor, +} from "@/app_modules/_global/color/color_pallet"; import { useRouter } from "next/navigation"; -import { gs_event_riwayat } from "../../global_state"; +import { useState } from "react"; import { MODEL_EVENT } from "../../model/interface"; import Event_RiwayatSaya from "./saya"; import Event_SemuaRiwayat from "./semua"; export default function Event_Riwayat({ + statusId, dataSemuaRiwayat, - dataRiwayatSaya + dataRiwayatSaya, }: { - dataSemuaRiwayat: MODEL_EVENT[]; - dataRiwayatSaya: MODEL_EVENT[] + statusId: string; + dataSemuaRiwayat?: MODEL_EVENT[]; + dataRiwayatSaya?: MODEL_EVENT[]; }) { const router = useRouter(); - const [tabsRiwayat, setTabsRiwayat] = useAtom(gs_event_riwayat) + // const [tabsRiwayat, setTabsRiwayat] = useAtom(gs_event_riwayat) + const [changeStatus, setChangeStatus] = useState(statusId); const listTabs = [ { - id: 1, + id: "1", label: "Semua Riwayat", value: "Semua", - path: , }, { - id: 2, + id: "2", label: "Riwayat Saya", value: "Saya", - path: , }, ]; + async function onChangeStatus({ statusId }: { statusId: string }) { + router.push(RouterEvent.riwayat({ id: statusId })); + } + return ( <> { + setChangeStatus(val); + onChangeStatus({ statusId: val }); + }} styles={{ tabsList: { backgroundColor: MainColor.darkblue, @@ -57,15 +66,15 @@ export default function Event_Riwayat({ {listTabs.map((e) => ( ))} - {listTabs.map((e) => ( - - {e.path} - - ))} + {statusId == "1" && ( + + )} + {statusId == "2" && ( + + )} diff --git a/src/app_modules/event/main/riwayat/saya.tsx b/src/app_modules/event/main/riwayat/saya.tsx index ca4e1c97..bf83552c 100644 --- a/src/app_modules/event/main/riwayat/saya.tsx +++ b/src/app_modules/event/main/riwayat/saya.tsx @@ -9,7 +9,7 @@ import { useState } from "react"; import { ComponentEvent_CardRiwayat } from "../../component/card_view/card_riwayat"; import { event_getListSemuaRiwayat } from "../../fun/get/riwayat/get_list_semua_riwayat"; import { MODEL_EVENT } from "../../model/interface"; -import { event_getListRiwayatSaya } from "../../fun/get/get_list_riwayat_saya"; +import { event_getListRiwayatSaya } from "../../fun/get/riwayat/get_list_riwayat_saya"; export default function Event_RiwayatSaya({ listData, diff --git a/src/app_modules/event/main/status_page/index.tsx b/src/app_modules/event/main/status_page/index.tsx index 78a21d04..903f14ed 100644 --- a/src/app_modules/event/main/status_page/index.tsx +++ b/src/app_modules/event/main/status_page/index.tsx @@ -1,64 +1,47 @@ "use client"; -import { Stack, Tabs } from "@mantine/core"; -import { useAtom } from "jotai"; -import { useRouter } from "next/navigation"; -import { gs_event_status } from "../../global_state"; -import Event_StatusDraft from "./draft"; -import Event_StatusPublish from "./publish"; -import Event_StatusReject from "./reject"; -import Event_StatusReview from "./review"; +import { RouterEvent } from "@/app/lib/router_hipmi/router_event"; import { AccentColor, MainColor, } from "@/app_modules/_global/color/color_pallet"; +import { MODEL_NEW_DEFAULT_MASTER } from "@/app_modules/model_global/interface"; +import { Box, Stack, Tabs } from "@mantine/core"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import Event_StatusDraft from "./draft"; +import Event_StatusPublish from "./publish"; +import Event_StatusReject from "./reject"; +import Event_StatusReview from "./review"; export default function Event_StatusPage({ - authorId, - listPublish, - listReview, - listDraft, - listReject, + statusId, + dataStatus, + listStatus, }: { - authorId: string; - listPublish: any; - listReview: any; - listDraft: any; - listReject: any; + statusId: string; + dataStatus: any[]; + listStatus: MODEL_NEW_DEFAULT_MASTER[]; }) { const router = useRouter(); - const [tabsStatus, setTabsStatus] = useAtom(gs_event_status); - const listTabs = [ - { - id: 1, - path: , - value: "Publish", - }, - { - id: 2, - path: , - value: "Review", - }, - { - id: 3, - path: , - value: "Draft", - }, - { - id: 4, - path: , - value: "Reject", - }, - ]; + const [changeStatus, setChangeStatus] = useState(statusId); + + async function onChangeStatus({ statusId }: { statusId: string }) { + router.push(RouterEvent.status({ id: statusId })); + } + return ( <> { + setChangeStatus(val); + onChangeStatus({ statusId: val }); + }} styles={{ tabsList: { backgroundColor: MainColor.darkblue, @@ -70,33 +53,95 @@ export default function Event_StatusPage({ > - {listTabs.map((e) => ( + {listStatus.map((e) => ( - {e.value} + {e.name} ))} - {listTabs.map((e) => ( - - {e.path} - - ))} + + + {changeStatus === "1" && ( + + )} + {changeStatus === "2" && ( + + )} + {changeStatus === "3" && ( + + )} + {changeStatus === "4" && ( + + )} + ); + + // return ( + // <> + // { + // console.log(val); + // }} + // styles={{ + // tabsList: { + // backgroundColor: MainColor.darkblue, + // position: "sticky", + // top: 0, + // zIndex: 99, + // }, + // }} + // > + // + // + // {listStatus.map((e) => ( + // + // {e.name} + // + // ))} + // + // {/* {listTabs.map((e) => ( + // + // {e.path} + // + // ))} */} + // + // + // + // ); } diff --git a/src/app_modules/event/main/status_page/reject.tsx b/src/app_modules/event/main/status_page/reject.tsx index 8b31882d..e9dca1d5 100644 --- a/src/app_modules/event/main/status_page/reject.tsx +++ b/src/app_modules/event/main/status_page/reject.tsx @@ -1,27 +1,18 @@ "use client"; import { RouterEvent } from "@/app/lib/router_hipmi/router_event"; +import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data"; import { Box, Center, - Group, - Loader, - Paper, - Stack, - Text, - Title, + Loader } from "@mantine/core"; -import moment from "moment"; -import { useRouter } from "next/navigation"; -import { MODEL_EVENT } from "../../model/interface"; -import ComponentEvent_BoxListStatus from "../../component/box_list_status"; import _ from "lodash"; -import ComponentEvent_IsEmptyData from "../../component/is_empty_data"; -import { event_getAllReject } from "../../fun/get/status/get_all_reject"; -import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data"; import { ScrollOnly } from "next-scroll-loader"; import { useState } from "react"; -import { event_getAllReview } from "../../fun/get/status/get_all_review"; +import ComponentEvent_BoxListStatus from "../../component/box_list_status"; +import { event_getAllReject } from "../../fun/get/status/get_all_reject"; +import { MODEL_EVENT } from "../../model/interface"; export default function Event_StatusReject({ listReject, diff --git a/src/app_modules/event/main/status_page/review.tsx b/src/app_modules/event/main/status_page/review.tsx index 3d06563b..d2612807 100644 --- a/src/app_modules/event/main/status_page/review.tsx +++ b/src/app_modules/event/main/status_page/review.tsx @@ -12,10 +12,8 @@ import { MODEL_EVENT } from "../../model/interface"; export default function Event_StatusReview({ listReview, - }: { listReview: MODEL_EVENT[]; - }) { const [data, setData] = useState(listReview); const [activePage, setActivePage] = useState(1); diff --git a/src/app_modules/event/splash/index.tsx b/src/app_modules/event/splash/index.tsx index 9d249788..e6d75e20 100644 --- a/src/app_modules/event/splash/index.tsx +++ b/src/app_modules/event/splash/index.tsx @@ -6,18 +6,16 @@ import { useShallowEffect } from "@mantine/hooks"; import { IconPresentation } from "@tabler/icons-react"; import { useAtom } from "jotai"; import { useRouter } from "next/navigation"; -import { gs_event_hotMenu, gs_event_status } from "../global_state"; +import { gs_event_hotMenu } from "../global_state"; export default function Event_SplashScreen() { const router = useRouter(); const [hotMenu, setHotMenu] = useAtom(gs_event_hotMenu); - const [tabsStatus, setTabsStatus] = useAtom(gs_event_status); useShallowEffect(() => { setTimeout(() => { router.replace(RouterEvent.beranda); setHotMenu(0); - setTabsStatus("Publish"); }, 1000); }, []); return ( diff --git a/src/app_modules/notifikasi/component/path/event.ts b/src/app_modules/notifikasi/component/path/event.ts index 85984bf1..d663f7ab 100644 --- a/src/app_modules/notifikasi/component/path/event.ts +++ b/src/app_modules/notifikasi/component/path/event.ts @@ -11,7 +11,7 @@ export function redirectEventPage({ router: AppRouterInstance; onSetPage: (val: any) => void; }) { - const path = RouterEvent.status_page; + const path = RouterEvent.status({id: ""}); if (data.status === "Publish") { onSetPage({ diff --git a/src/ui/Coba.tsx b/src/ui/Coba.tsx deleted file mode 100644 index 12643b67..00000000 --- a/src/ui/Coba.tsx +++ /dev/null @@ -1,59 +0,0 @@ -"use client"; -"use dev"; -import { Flex } from "@mantine/core"; -import { DevBox } from "next-dev"; -import { useState } from "react"; - -// Beda Package -import InfiniteScroll from "react-infinite-scroll-component"; -import { CobaSatu } from "./CobaSatu"; -import { TombolDev } from "./TombolDev"; - -export default function Coba() { - const [data, setData] = useState([]); - const [isLoading, setIsLoading] = useState(false); - - const ttlData = Array.from({ length: 21 }); - const [list, setList] = useState(ttlData); - - const fetchMoreData = () => { - setTimeout(() => { - setList(list.concat(Array.from({ length: 20 }))); - }, 100); - }; - - const style = { - height: 30, - border: "1px solid green", - margin: 6, - padding: 8, - }; - - return ( - - -
- -

Loading...

- - } - scrollableTarget="scrollableDiv" - > - {list.map((i, index) => ( -
- div - #{index} -
- ))} -
-
- - -
-
- ); -} diff --git a/src/ui/CobaSatu.tsx b/src/ui/CobaSatu.tsx deleted file mode 100644 index 088deb25..00000000 --- a/src/ui/CobaSatu.tsx +++ /dev/null @@ -1,21 +0,0 @@ -"use client"; -"use dev"; -import { DevBox } from "next-dev"; -import { Card } from "@mantine/core"; -import { useShallowEffect } from "@mantine/hooks"; -import { genFetchApi } from "@/util/genFetchApi"; - -export function CobaSatu() { - useShallowEffect(() => { - genFetchApi - .seeder({ isServer: false }) - .then(async (v) => { - console.log(v) - }) - }, []); - return ( - - ini percobaan - - ); -} diff --git a/src/ui/TombolDev.tsx b/src/ui/TombolDev.tsx deleted file mode 100644 index 8fed80de..00000000 --- a/src/ui/TombolDev.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { Button } from "@mantine/core"; -import { ButtonToogle } from "next-dev"; - -export function TombolDev() { - return ( - - {(isDev) => ( - - )} - - ); -} diff --git a/src/util/app_config.ts b/src/util/app_config.ts deleted file mode 100644 index ffa65ce0..00000000 --- a/src/util/app_config.ts +++ /dev/null @@ -1,13 +0,0 @@ -import os from "os"; - -const app_config = { - title: "Example Title", - description: "Example Description", - host: - os.platform() === "darwin" - ? "http://localhost:3000" - : "https://test2-hipmi.wibudev.com", - isLocal: os.platform() === "darwin", -}; - -export default app_config; diff --git a/src/util/genFetchApi.ts b/src/util/genFetchApi.ts deleted file mode 100644 index ba6080a7..00000000 --- a/src/util/genFetchApi.ts +++ /dev/null @@ -1,278 +0,0 @@ -import app_config from "./app_config"; - export const genFetchApi = { -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/test-scroll/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/test-scroll/route.ts) - * @param {} - * @param {boolean} isServer - * @param {string} searchParams ?key=value - */ -testScroll : async ({isServer, searchParams}: {isServer?: boolean, searchParams?: string}) => { - - return fetch(`${isServer && app_config.host || ''}/api/test-scroll${searchParams || ''}`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/seeder/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/seeder/route.ts) - * @param {} - * @param {boolean} isServer - * @param {string} searchParams ?key=value - */ -seeder : async ({isServer, searchParams}: {isServer?: boolean, searchParams?: string}) => { - - return fetch(`${isServer && app_config.host || ''}/api/seeder${searchParams || ''}`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/profile/url_foto/[url]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/profile/url_foto/[url]/route.ts) - * @param {} - * @param {boolean} isServer - * @param {string} searchParams ?key=value - */ -profileUrl_fotoUrlByUrl : async ({url, isServer, searchParams}: {url: string, isServer?: boolean, searchParams?: string}) => { - - return fetch(`${isServer && app_config.host || ''}/api/profile/url_foto/${url}${searchParams || ''}`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/profile/url_background/[url]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/profile/url_background/[url]/route.ts) - * @param {} - * @param {boolean} isServer - * @param {string} searchParams ?key=value - */ -profileUrl_backgroundUrlByUrl : async ({url, isServer, searchParams}: {url: string, isServer?: boolean, searchParams?: string}) => { - - return fetch(`${isServer && app_config.host || ''}/api/profile/url_background/${url}${searchParams || ''}`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/profile/foto/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/profile/foto/[id]/route.ts) - * @param {} - * @param {boolean} isServer - * @param {string} searchParams ?key=value - */ -profileFotoIdById : async ({id, isServer, searchParams}: {id: string, isServer?: boolean, searchParams?: string}) => { - - return fetch(`${isServer && app_config.host || ''}/api/profile/foto/${id}${searchParams || ''}`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/profile/background/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/profile/background/[id]/route.ts) - * @param {} - * @param {boolean} isServer - * @param {string} searchParams ?key=value - */ -profileBackgroundIdById : async ({id, isServer, searchParams}: {id: string, isServer?: boolean, searchParams?: string}) => { - - return fetch(`${isServer && app_config.host || ''}/api/profile/background/${id}${searchParams || ''}`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/portofolio/logo/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/portofolio/logo/[id]/route.ts) - * @param {} - * @param {boolean} isServer - * @param {string} searchParams ?key=value - */ -portofolioLogoIdById : async ({id, isServer, searchParams}: {id: string, isServer?: boolean, searchParams?: string}) => { - - return fetch(`${isServer && app_config.host || ''}/api/portofolio/logo/${id}${searchParams || ''}`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/job/gambar/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/job/gambar/[id]/route.ts) - * @param {} - * @param {boolean} isServer - * @param {string} searchParams ?key=value - */ -jobGambarIdById : async ({id, isServer, searchParams}: {id: string, isServer?: boolean, searchParams?: string}) => { - - return fetch(`${isServer && app_config.host || ''}/api/job/gambar/${id}${searchParams || ''}`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/investasi/prospektus/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/investasi/prospektus/[id]/route.ts) - * @param {} - * @param {boolean} isServer - * @param {string} searchParams ?key=value - */ -investasiProspektusIdById : async ({id, isServer, searchParams}: {id: string, isServer?: boolean, searchParams?: string}) => { - - return fetch(`${isServer && app_config.host || ''}/api/investasi/prospektus/${id}${searchParams || ''}`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/investasi/midtrans/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/investasi/midtrans/[id]/route.ts) - * @param {} - * @param {boolean} isServer - * @param {string} searchParams ?key=value - */ -investasiMidtransIdById : async ({id, isServer, searchParams}: {id: string, isServer?: boolean, searchParams?: string}) => { - - return fetch(`${isServer && app_config.host || ''}/api/investasi/midtrans/${id}${searchParams || ''}`, { method: 'POST', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/investasi/gambar/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/investasi/gambar/[id]/route.ts) - * @param {} - * @param {boolean} isServer - * @param {string} searchParams ?key=value - */ -investasiGambarIdById : async ({id, isServer, searchParams}: {id: string, isServer?: boolean, searchParams?: string}) => { - - return fetch(`${isServer && app_config.host || ''}/api/investasi/gambar/${id}${searchParams || ''}`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/investasi/dokumen/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/investasi/dokumen/[id]/route.ts) - * @param {} - * @param {boolean} isServer - * @param {string} searchParams ?key=value - */ -investasiDokumenIdById : async ({id, isServer, searchParams}: {id: string, isServer?: boolean, searchParams?: string}) => { - - return fetch(`${isServer && app_config.host || ''}/api/investasi/dokumen/${id}${searchParams || ''}`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/image_cerita/[url]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/image_cerita/[url]/route.ts) - * @param {} - * @param {boolean} isServer - * @param {string} searchParams ?key=value - */ -donasiImage_ceritaUrlByUrl : async ({url, isServer, searchParams}: {url: string, isServer?: boolean, searchParams?: string}) => { - - return fetch(`${isServer && app_config.host || ''}/api/donasi/image_cerita/${url}${searchParams || ''}`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/image/[url]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/image/[url]/route.ts) - * @param {} - * @param {boolean} isServer - * @param {string} searchParams ?key=value - */ -donasiImageUrlByUrl : async ({url, isServer, searchParams}: {url: string, isServer?: boolean, searchParams?: string}) => { - - return fetch(`${isServer && app_config.host || ''}/api/donasi/image/${url}${searchParams || ''}`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/gambar_pencairan/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/gambar_pencairan/[id]/route.ts) - * @param {} - * @param {boolean} isServer - * @param {string} searchParams ?key=value - */ -donasiGambar_pencairanIdById : async ({id, isServer, searchParams}: {id: string, isServer?: boolean, searchParams?: string}) => { - - return fetch(`${isServer && app_config.host || ''}/api/donasi/gambar_pencairan/${id}${searchParams || ''}`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/gambar_kabar/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/gambar_kabar/[id]/route.ts) - * @param {} - * @param {boolean} isServer - * @param {string} searchParams ?key=value - */ -donasiGambar_kabarIdById : async ({id, isServer, searchParams}: {id: string, isServer?: boolean, searchParams?: string}) => { - - return fetch(`${isServer && app_config.host || ''}/api/donasi/gambar_kabar/${id}${searchParams || ''}`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/gambar_cerita/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/gambar_cerita/[id]/route.ts) - * @param {} - * @param {boolean} isServer - * @param {string} searchParams ?key=value - */ -donasiGambar_ceritaIdById : async ({id, isServer, searchParams}: {id: string, isServer?: boolean, searchParams?: string}) => { - - return fetch(`${isServer && app_config.host || ''}/api/donasi/gambar_cerita/${id}${searchParams || ''}`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/gambar_bukti_transfer/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/gambar_bukti_transfer/[id]/route.ts) - * @param {} - * @param {boolean} isServer - * @param {string} searchParams ?key=value - */ -donasiGambar_bukti_transferIdById : async ({id, isServer, searchParams}: {id: string, isServer?: boolean, searchParams?: string}) => { - - return fetch(`${isServer && app_config.host || ''}/api/donasi/gambar_bukti_transfer/${id}${searchParams || ''}`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/gambar/[id]/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/donasi/gambar/[id]/route.ts) - * @param {} - * @param {boolean} isServer - * @param {string} searchParams ?key=value - */ -donasiGambarIdById : async ({id, isServer, searchParams}: {id: string, isServer?: boolean, searchParams?: string}) => { - - return fetch(`${isServer && app_config.host || ''}/api/donasi/gambar/${id}${searchParams || ''}`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/auth/validasi/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/auth/validasi/route.ts) - * @param {} - * @param {boolean} isServer - * @param {string} searchParams ?key=value - */ -authValidasi : async ({isServer, searchParams}: {isServer?: boolean, searchParams?: string}) => { - - return fetch(`${isServer && app_config.host || ''}/api/auth/validasi${searchParams || ''}`, { method: 'POST', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/auth/register/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/auth/register/route.ts) - * @param {} - * @param {boolean} isServer - * @param {string} searchParams ?key=value - */ -authRegister : async ({isServer, searchParams}: {isServer?: boolean, searchParams?: string}) => { - - return fetch(`${isServer && app_config.host || ''}/api/auth/register${searchParams || ''}`, { method: 'POST', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/auth/logout/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/auth/logout/route.ts) - * @param {} - * @param {boolean} isServer - * @param {string} searchParams ?key=value - */ -authLogout : async ({isServer, searchParams}: {isServer?: boolean, searchParams?: string}) => { - - return fetch(`${isServer && app_config.host || ''}/api/auth/logout${searchParams || ''}`, { method: 'GET', cache: 'no-cache' }) - .then(res => res.json()); -} -, -/** - * [/Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/auth/login/route.ts](file:///Users/bagasbanuna/Documents/BIP/hipmi/src/app/api/auth/login/route.ts) - * @param {} - * @param {boolean} isServer - * @param {string} searchParams ?key=value - */ -authLogin : async ({isServer, searchParams}: {isServer?: boolean, searchParams?: string}) => { - - return fetch(`${isServer && app_config.host || ''}/api/auth/login${searchParams || ''}`, { method: 'POST', cache: 'no-cache' }) - .then(res => res.json()); -} -}; \ No newline at end of file