diff --git a/CHANGELOG.md b/CHANGELOG.md
index aa2c2693..dbad195b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,8 @@
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
+## [1.2.20](https://github.com/bipproduction/hipmi/compare/v1.2.19...v1.2.20) (2024-12-09)
+
## [1.2.19](https://github.com/bipproduction/hipmi/compare/v1.2.18...v1.2.19) (2024-12-06)
## [1.2.18](https://github.com/bipproduction/hipmi/compare/v1.2.17...v1.2.18) (2024-12-04)
diff --git a/package.json b/package.json
index 33896d0e..b47b092a 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "hipmi",
- "version": "1.2.19",
+ "version": "1.2.20",
"private": true,
"prisma": {
"seed": "npx tsx prisma/seed.ts --yes"
diff --git a/src/app/api/auth/check/route.ts b/src/app/api/auth/check/route.ts
index d8176b13..b51a6f31 100644
--- a/src/app/api/auth/check/route.ts
+++ b/src/app/api/auth/check/route.ts
@@ -14,6 +14,7 @@ export async function GET(request: NextRequest) {
id: id as string,
},
});
+
return NextResponse.json(data, { status: 200 });
} catch (error) {
console.log(error);
diff --git a/src/app/api/auth/logout/route.ts b/src/app/api/auth/logout/route.ts
index 0f9be556..44a4a2ab 100644
--- a/src/app/api/auth/logout/route.ts
+++ b/src/app/api/auth/logout/route.ts
@@ -1,4 +1,3 @@
-import { prisma } from "@/app/lib";
import { cookies } from "next/headers";
import { NextRequest, NextResponse } from "next/server";
export const dynamic = "force-dynamic";
@@ -7,15 +6,15 @@ export async function GET(request: NextRequest) {
// const { searchParams } = new URL(request.url);
// const id = searchParams.get("id");
- const delToken = await prisma.userSession.delete({
- where: {
- userId: id as string,
- },
- });
+ // const delToken = await prisma.userSession.delete({
+ // where: {
+ // userId: id as string,
+ // },
+ // });
const del = cookies().delete(process.env.NEXT_PUBLIC_BASE_SESSION_KEY!);
return NextResponse.json(
{ success: true, message: "Logout Berhasil" },
{ status: 200 }
);
- }
+}
diff --git a/src/app/api/auth/register/route.ts b/src/app/api/auth/register/route.ts
index f25500d7..45d3cd9e 100644
--- a/src/app/api/auth/register/route.ts
+++ b/src/app/api/auth/register/route.ts
@@ -32,22 +32,22 @@ export async function POST(req: Request) {
user: createUser as any,
});
- try {
- const createUserSession = await prisma.userSession.create({
- data: {
- token: token as string,
- userId: createUser.id,
- },
- });
+ // try {
+ // const createUserSession = await prisma.userSession.create({
+ // data: {
+ // token: token as string,
+ // userId: createUser.id,
+ // },
+ // });
- if (!createUserSession)
- return NextResponse.json(
- { success: false, message: "Gagal Membuat Session" },
- { status: 400 }
- );
- } catch (error) {
- console.log(error);
- }
+ // if (!createUserSession)
+ // return NextResponse.json(
+ // { success: false, message: "Gagal Membuat Session" },
+ // { status: 400 }
+ // );
+ // } catch (error) {
+ // console.log(error);
+ // }
return NextResponse.json(
{ success: true, message: "Berhasil Login", data: createUser },
diff --git a/src/app/api/auth/validasi/route.ts b/src/app/api/auth/validasi/route.ts
index 2f432b70..05ee6b26 100644
--- a/src/app/api/auth/validasi/route.ts
+++ b/src/app/api/auth/validasi/route.ts
@@ -6,73 +6,76 @@ export async function POST(req: Request) {
if (req.method === "POST") {
const { nomor } = await req.json();
- const dataUser = await prisma.user.findUnique({
- where: {
- nomor: nomor,
- },
- select: {
- id: true,
- nomor: true,
- username: true,
- active: true,
- masterUserRoleId: true,
- },
- });
-
- if (dataUser === null)
- return NextResponse.json(
- { success: false, message: "Nomor Belum Terdaftar" },
- { status: 404 }
- );
-
- const token = await sessionCreate({
- sessionKey: process.env.NEXT_PUBLIC_BASE_SESSION_KEY!,
- encodedKey: process.env.NEXT_PUBLIC_BASE_TOKEN_KEY!,
- user: dataUser as any,
- });
-
- const cekSessionUser = await prisma.userSession.findFirst({
- where: {
- userId: dataUser.id,
- },
- });
-
- if (cekSessionUser !== null) {
- await prisma.userSession.delete({
- where: {
- userId: dataUser.id,
- },
- });
- }
-
try {
- const createUserSession = await prisma.userSession.create({
- data: {
- token: token as string,
- userId: dataUser.id,
+ const dataUser = await prisma.user.findUnique({
+ where: {
+ nomor: nomor,
+ },
+ select: {
+ id: true,
+ nomor: true,
+ username: true,
+ active: true,
+ masterUserRoleId: true,
},
});
- if (!createUserSession)
+ if (dataUser === null)
return NextResponse.json(
- { success: false, message: "Gagal Membuat Session" },
- { status: 400 }
+ { success: false, message: "Nomor Belum Terdaftar" },
+ { status: 404 }
);
+
+ const token = await sessionCreate({
+ sessionKey: process.env.NEXT_PUBLIC_BASE_SESSION_KEY!,
+ encodedKey: process.env.NEXT_PUBLIC_BASE_TOKEN_KEY!,
+ user: dataUser as any,
+ });
+
+ // const cekSessionUser = await prisma.userSession.findFirst({
+ // where: {
+ // userId: dataUser.id,
+ // },
+ // });
+
+ // if (cekSessionUser !== null) {
+ // await prisma.userSession.delete({
+ // where: {
+ // userId: dataUser.id,
+ // },
+ // });
+ // }
+
+ // try {
+ // const createUserSession = await prisma.userSession.create({
+ // data: {
+ // token: token as string,
+ // userId: dataUser.id,
+ // },
+ // });
+
+ // if (!createUserSession)
+ // return NextResponse.json(
+ // { success: false, message: "Gagal Membuat Session" },
+ // { status: 400 }
+ // );
+ // } catch (error) {
+ // console.log(error);
+ // }
+
+ return NextResponse.json(
+ {
+ success: true,
+ message: "Berhasil Login",
+ roleId: dataUser.masterUserRoleId,
+ active: dataUser.active,
+ },
+ { status: 200 }
+ );
} catch (error) {
console.log(error);
}
-
- return NextResponse.json(
- {
- success: true,
- message: "Berhasil Login",
- roleId: dataUser.masterUserRoleId,
- active: dataUser.active,
- },
- { status: 200 }
- );
}
-
return NextResponse.json(
{ success: false, message: "Method Not Allowed" },
{ status: 405 }
diff --git a/src/app/api/new/home/route.ts b/src/app/api/new/home/route.ts
index 3e07f313..bdb110d8 100644
--- a/src/app/api/new/home/route.ts
+++ b/src/app/api/new/home/route.ts
@@ -1,6 +1,7 @@
import { prisma } from "@/app/lib";
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
import { NextResponse } from "next/server";
+export const dynamic = "force-dynamic";
// GET DATA HOME
diff --git a/src/app/api/new/map/[id]/route.ts b/src/app/api/new/map/[id]/route.ts
new file mode 100644
index 00000000..8047965d
--- /dev/null
+++ b/src/app/api/new/map/[id]/route.ts
@@ -0,0 +1,76 @@
+import { prisma } from "@/app/lib";
+import { NextResponse } from "next/server";
+export const dynamic = "force-dynamic";
+
+export async function GET(request: Request, context: { params: { id: string } }) {
+ try {
+ const { id } = context.params
+ const data = await prisma.businessMaps.findUnique({
+ where: {
+ id: id,
+ },
+ select: {
+ namePin: true,
+ latitude: true,
+ longitude: true,
+ pinId: true,
+ imageId: true,
+ Author: {
+ select: {
+ Profile: {
+ select: {
+ id: true,
+ name: true,
+ imageId: true,
+ }
+ }
+ }
+ },
+ Portofolio: {
+ select: {
+ id: true,
+ alamatKantor: true,
+ tlpn: true,
+ deskripsi: true,
+ namaBisnis: true,
+ MasterBidangBisnis: {
+ select: {
+ name: true,
+ },
+ },
+ },
+ },
+ }
+ });
+
+ const dataLokasi = {
+ namePin: data?.namePin,
+ latitude: data?.latitude,
+ longitude: data?.longitude,
+ pinId: data?.pinId,
+ imageId: data?.imageId,
+ }
+
+ const dataAuthor = {
+ id: data?.Author?.Profile?.id,
+ name: data?.Author?.Profile?.name,
+ imageId: data?.Author?.Profile?.imageId,
+ }
+
+ const dataBisnis = {
+ id: data?.Portofolio?.id,
+ alamatKantor: data?.Portofolio?.alamatKantor,
+ tlpn: data?.Portofolio?.tlpn,
+ deskripsi: data?.Portofolio?.deskripsi,
+ namaBisnis: data?.Portofolio?.namaBisnis,
+ bidangBisnis: data?.Portofolio?.MasterBidangBisnis?.name,
+ }
+
+ return NextResponse.json({ success: true, message: "Berhasil mendapatkan data", dataLokasi, dataAuthor, dataBisnis }, { status: 200 });
+
+ }
+ catch (error) {
+ console.error(error);
+ return NextResponse.json({ success: false, message: "Gagal mendapatkan data, coba lagi nanti ", reason: (error as Error).message, }, { status: 500 });
+ }
+}
\ No newline at end of file
diff --git a/src/app/api/new/map/route.ts b/src/app/api/new/map/route.ts
new file mode 100644
index 00000000..7a07e5ec
--- /dev/null
+++ b/src/app/api/new/map/route.ts
@@ -0,0 +1,40 @@
+import { prisma } from "@/app/lib";
+import _ from "lodash";
+import { NextResponse } from "next/server";
+export const dynamic = "force-dynamic";
+
+
+// GET ALL DATA MAP
+export async function GET(request: Request) {
+ try {
+ const data = await prisma.businessMaps.findMany({
+ where: {
+ isActive: true,
+ },
+ select: {
+ id: true,
+ namePin: true,
+ latitude: true,
+ longitude: true,
+ pinId: true,
+ Portofolio: {
+ select: {
+ logoId: true,
+ }
+ }
+ }
+ });
+
+ const dataFix = data.map((v: any) => ({
+ ..._.omit(v, ["Portofolio"]),
+ logoId: v.Portofolio.logoId
+ }))
+
+ return NextResponse.json({ success: true, message: "Berhasil mendapatkan data", data: dataFix }, { status: 200 });
+
+ }
+ catch (error) {
+ console.error(error);
+ return NextResponse.json({ success: false, message: "Gagal mendapatkan data, coba lagi nanti ", reason: (error as Error).message, }, { status: 500 });
+ }
+}
\ No newline at end of file
diff --git a/src/app/api/new/portofolio/[id]/route.ts b/src/app/api/new/portofolio/[id]/route.ts
index 5d783cb5..747cabd0 100644
--- a/src/app/api/new/portofolio/[id]/route.ts
+++ b/src/app/api/new/portofolio/[id]/route.ts
@@ -1,6 +1,7 @@
import { prisma } from "@/app/lib";
import { NextResponse } from "next/server";
import fs from "fs";
+export const dynamic = "force-dynamic";
diff --git a/src/app/api/new/portofolio/route.ts b/src/app/api/new/portofolio/route.ts
index b25478d5..fbf91221 100644
--- a/src/app/api/new/portofolio/route.ts
+++ b/src/app/api/new/portofolio/route.ts
@@ -1,5 +1,6 @@
import { prisma } from "@/app/lib";
import { NextResponse } from "next/server";
+export const dynamic = "force-dynamic";
// GET ALL DATA PORTOFOLIO BY PROFILE ID
diff --git a/src/app/api/new/user/route.ts b/src/app/api/new/user/route.ts
index 73a4fb52..8f710f53 100644
--- a/src/app/api/new/user/route.ts
+++ b/src/app/api/new/user/route.ts
@@ -1,5 +1,6 @@
import { prisma } from "@/app/lib";
import { NextResponse } from "next/server";
+export const dynamic = "force-dynamic";
// GET ONE DATA USER PROFILE BY PROFILE ID
diff --git a/src/app/dev/map/main/page.tsx b/src/app/dev/map/main/page.tsx
index 8b1b6fd6..f7867fa4 100644
--- a/src/app/dev/map/main/page.tsx
+++ b/src/app/dev/map/main/page.tsx
@@ -1,13 +1,13 @@
-import { map_funGetAllMap } from "@/app_modules/map/fun/get/fun_get_all_map";
-import { Map_View } from "@/app_modules/map/view";
+import { Map_ViewNew } from "@/app_modules/map/view/main_view_new";
const mapboxToken = process.env.MAPBOX_TOKEN!;
export default async function Page() {
- const dataMap = await map_funGetAllMap();
+ // const dataMap = await map_funGetAllMap();
return (
<>
-
+ {/* */}
+
>
);
}
diff --git a/src/app_modules/admin/event/_view/view_detail_peserta.tsx b/src/app_modules/admin/event/_view/view_detail_peserta.tsx
index 6c09ef87..c1b76811 100644
--- a/src/app_modules/admin/event/_view/view_detail_peserta.tsx
+++ b/src/app_modules/admin/event/_view/view_detail_peserta.tsx
@@ -2,6 +2,7 @@
import { MODEL_EVENT_PESERTA } from "@/app_modules/event/model/interface";
import {
+ Badge,
Button,
Center,
Pagination,
@@ -26,6 +27,7 @@ export function AdminEvent_ViewDetailPeserta({
const [isNPage, setNPage] = useState(dataPeserta.nPage);
const [isActivePage, setActivePage] = useState(1);
+
async function onPageClick(p: any) {
setActivePage(p);
const loadData = await adminEvent_getListPesertaById({
@@ -52,6 +54,15 @@ export function AdminEvent_ViewDetailPeserta({
{e?.User?.Profile?.email}
|
+
+
+ {e.isPresent ? (
+ Hadir
+ ) : (
+ Tidak Hadir
+ )}
+
+ |
));
@@ -81,6 +92,9 @@ export function AdminEvent_ViewDetailPeserta({
Email
|
+
+ Konfirmasi Kehadiran
+ |
{tableRow}
diff --git a/src/app_modules/admin/event/fun/get/get_list_peserta_by_id.ts b/src/app_modules/admin/event/fun/get/get_list_peserta_by_id.ts
index 7809a34a..b5b9764c 100644
--- a/src/app_modules/admin/event/fun/get/get_list_peserta_by_id.ts
+++ b/src/app_modules/admin/event/fun/get/get_list_peserta_by_id.ts
@@ -22,6 +22,7 @@ export async function adminEvent_getListPesertaById({
eventId: eventId,
},
select: {
+ isPresent: true,
User: {
include: {
Profile: true,
diff --git a/src/app_modules/auth/register/view.tsx b/src/app_modules/auth/register/view.tsx
index 7c1de36f..f72d7e50 100644
--- a/src/app_modules/auth/register/view.tsx
+++ b/src/app_modules/auth/register/view.tsx
@@ -41,7 +41,7 @@ export default function Register() {
const res = await fetch(`/api/auth/check?id=${kodeId}`);
const result = await res.json();
- onSetData(result.data.nomor);
+ onSetData(result.nomor);
}
async function onRegistarsi() {
diff --git a/src/app_modules/auth/validasi/view.tsx b/src/app_modules/auth/validasi/view.tsx
index d817b00e..d0b39c01 100644
--- a/src/app_modules/auth/validasi/view.tsx
+++ b/src/app_modules/auth/validasi/view.tsx
@@ -43,7 +43,7 @@ export default function Validasi() {
useShallowEffect(() => {
const kodeId = localStorage.getItem("hipmi_auth_code_id");
if (kodeId != null) {
- onCheckAuthCode({ kodeId: kodeId as string, onSetData: setData });
+ onCheckAuthCode({ kodeId: kodeId as string });
} else {
console.log("code id not found");
}
@@ -51,27 +51,25 @@ export default function Validasi() {
if (triggerOtp) {
const kodeId = localStorage.getItem("hipmi_auth_code_id");
if (kodeId != null) {
- onCheckAuthCode({ kodeId: kodeId as string, onSetData: setData });
+ onCheckAuthCode({ kodeId: kodeId as string });
} else {
console.log("code id not found");
}
setTriggerOtp(false);
}
- }, [triggerOtp, setData, setTriggerOtp]);
+ }, [triggerOtp]);
async function onCheckAuthCode({
kodeId,
- onSetData,
}: {
kodeId: string;
- onSetData: any;
}) {
const res = await fetch(`/api/auth/check?id=${kodeId}`);
const result = await res.json();
- onSetData({
- nomor: result.data.nomor,
- code: result.data.otp,
+ setData({
+ nomor: result.nomor,
+ code: result.otp,
});
}
diff --git a/src/app_modules/event/_ui/konfirmasi.tsx b/src/app_modules/event/_ui/konfirmasi.tsx
index fb72b2ed..2062d1b0 100644
--- a/src/app_modules/event/_ui/konfirmasi.tsx
+++ b/src/app_modules/event/_ui/konfirmasi.tsx
@@ -8,17 +8,8 @@ import {
ComponentGlobal_NotifikasiBerhasil,
ComponentGlobal_NotifikasiGagal,
} from "@/app_modules/_global/notif_global";
-import {
- UIGlobal_LayoutDefault
-} from "@/app_modules/_global/ui";
-import {
- Button,
- Center,
- Group,
- Skeleton,
- Stack,
- Text
-} from "@mantine/core";
+import { UIGlobal_LayoutDefault } from "@/app_modules/_global/ui";
+import { Button, Center, Group, Skeleton, Stack, Text } from "@mantine/core";
import { useShallowEffect } from "@mantine/hooks";
import { useAtom } from "jotai";
import moment from "moment";
@@ -28,6 +19,7 @@ import { event_funUpdateKehadiran } from "../fun";
import { Event_funJoinAndConfirmEvent } from "../fun/create/fun_join_and_confirm";
import { gs_event_hotMenu } from "../global_state";
import { MODEL_EVENT } from "../model/interface";
+import { Event_funJoinEvent } from "../fun/create/fun_join_event";
export default function Ui_Konfirmasi({
userLoginId,
@@ -68,7 +60,7 @@ export default function Ui_Konfirmasi({
setIsJoin(data);
}
- // CEK KEHADIRAN
+ // =========== CEK KEHADIRAN ===========//
useShallowEffect(() => {
onLoadKehadiran();
}, []);
@@ -80,11 +72,14 @@ export default function Ui_Konfirmasi({
const data = await res.json();
setIsPresent(data);
}
+ // =========== CEK KEHADIRAN ===========//
+ // Jika data kosong
if (data == null && isPresent == null) {
return ;
}
+ // Jika data tidak ada
if (data == null) {
return (
<>
@@ -93,6 +88,7 @@ export default function Ui_Konfirmasi({
);
}
+ // Jika tanggal acara lewat
if (moment(data?.tanggalSelesai).diff(moment(), "minute") < 0) {
return (
<>
@@ -101,10 +97,26 @@ export default function Ui_Konfirmasi({
);
}
- if (isJoin == false) {
+ // Jika belum join dan tanggal mulai acara belum lewat
+ if (isJoin == false && moment(data?.tanggal).diff(moment(), "minute") > 0) {
return (
<>
-
+ >
+ );
+ }
+
+ // Jika belum join dan tanggal mulai acara sudah lewat
+ if (isJoin == false && moment(data?.tanggal).diff(moment(), "minute") < 0) {
+ return (
+ <>
+ ;
}
@@ -126,16 +139,6 @@ export default function Ui_Konfirmasi({
/>
);
}
- // const tgl = moment(data?.tanggal).diff(moment(), "minute") < 0;
- // return (
- // <>
- //
- //
- // {JSON.stringify(tgl)}
- //
- //
- // >
- // );
}
function DataNotFound() {
@@ -196,7 +199,91 @@ function SkeletonIsDataNull() {
);
}
-function UserNotJoin({
+function UserAllowToJoin({
+ title,
+ tanggal,
+ lokasi,
+ eventId,
+ userLoginId,
+}: {
+ title: string;
+ tanggal: Date;
+ lokasi: string;
+ eventId: string;
+ userLoginId: string;
+}) {
+ const router = useRouter();
+ const [isLoading, setLoading] = useState(false);
+
+ async function onJoinEvent() {
+ setLoading(true);
+
+ const data = {
+ userId: userLoginId,
+ eventId: eventId,
+ };
+
+ const res = await Event_funJoinEvent(data as any);
+ if (res.status === 200) {
+ ComponentGlobal_NotifikasiBerhasil(res.message, 2000);
+ router.push(RouterEvent.detail_main + eventId);
+ } else {
+ setLoading(false);
+ ComponentGlobal_NotifikasiGagal(res.message);
+ }
+ }
+
+ return (
+ <>
+
+
+
+
+
+ Halo, Bapak/Ibu. Kami dengan senang hati mengundang Anda untuk
+ bergabung dalam acara
+
+ {title}
+ {" "}
+ yang akan diselenggarakan pada{" "}
+
+ {moment(tanggal).format("LL")}
+ {" "}
+ pukul
+
+ {moment(tanggal).format("LT")}
+ {" "}
+ di
+
+ {lokasi}
+ {" "}
+ . Pastikan Anda sudah melakukan registrasi melalui aplikasi
+ [Nama Aplikasi] agar dapat berpartisipasi. Kami sangat
+ menantikan kehadiran Anda. Sampai jumpa di acara ini.
+
+
+
+
+
+
+
+ >
+ );
+}
+
+function UserNotJoinAndEventReady({
title,
eventId,
userLoginId,
@@ -373,8 +460,12 @@ function UserNotConfirm({
{title}
{" "}
pada hari ini. Mohon untuk mengonfirmasi kehadiran Anda dengan
- menekan tombol {"Hadir"} atau fitur konfirmasi yang tersedia di
- bawah. Terima kasih dan selamat menikmati acara.
+ menekan tombol{" "}
+
+ Konfirmasi Kehadiran
+ {" "}
+ atau fitur konfirmasi yang tersedia di bawah. Terima kasih dan
+ selamat menikmati acara.
diff --git a/src/app_modules/event/component/detail/list_peserta.tsx b/src/app_modules/event/component/detail/list_peserta.tsx
index a8c53851..ab93a45d 100644
--- a/src/app_modules/event/component/detail/list_peserta.tsx
+++ b/src/app_modules/event/component/detail/list_peserta.tsx
@@ -3,6 +3,7 @@
import {
ActionIcon,
Avatar,
+ Badge,
Center,
Grid,
Group,
@@ -136,11 +137,8 @@ function ComponentEvent_AvatarAndUsername({
}
}
- const tglMulai = moment(tanggalMulai).diff(moment(), "minutes");
+ const tglMulai = moment(tanggalMulai).diff(moment(), "minutes") < 0;
- const tglSelesai = moment(tanggalSelesai).diff(moment(), "minutes");
-
- // console.log("mulai:", tglMulai, "selesai:", tglSelesai);
return (
<>
@@ -177,20 +175,12 @@ function ComponentEvent_AvatarAndUsername({
- {/* {component && (
-
-
- {component}
-
-
- )} */}
-
- {tglMulai < 0 && (
-
+ {tglMulai && (
+
- {isPresent ? "Hadir" : "-"}
+ {isPresent ? Hadir : -}
diff --git a/src/app_modules/katalog/profile/_component/button/comp_create_new_profile.tsx b/src/app_modules/katalog/profile/_component/button/comp_create_new_profile.tsx
index 02bd0b77..cd7b5204 100644
--- a/src/app_modules/katalog/profile/_component/button/comp_create_new_profile.tsx
+++ b/src/app_modules/katalog/profile/_component/button/comp_create_new_profile.tsx
@@ -47,40 +47,46 @@ export function Profile_ComponentCreateNewProfile({
"Lengkapi background profile"
);
- setLoading(true);
+ try {
+ setLoading(true);
- const uploadPhoto = await funGlobal_UploadToStorage({
- file: filePP,
- dirId: DIRECTORY_ID.profile_foto,
- });
- if (!uploadPhoto.success) {
- setLoading(false);
- return ComponentGlobal_NotifikasiPeringatan("Gagal upload foto profile");
- }
+ const uploadPhoto = await funGlobal_UploadToStorage({
+ file: filePP,
+ dirId: DIRECTORY_ID.profile_foto,
+ });
+ if (!uploadPhoto.success) {
+ setLoading(false);
+ return ComponentGlobal_NotifikasiPeringatan(
+ "Gagal upload foto profile"
+ );
+ }
- const uploadBackground = await funGlobal_UploadToStorage({
- file: fileBG,
- dirId: DIRECTORY_ID.profile_background,
- });
- if (!uploadBackground.success) {
- setLoading(false);
- return ComponentGlobal_NotifikasiPeringatan(
- "Gagal upload background profile"
- );
- }
+ const uploadBackground = await funGlobal_UploadToStorage({
+ file: fileBG,
+ dirId: DIRECTORY_ID.profile_background,
+ });
+ if (!uploadBackground.success) {
+ setLoading(false);
+ return ComponentGlobal_NotifikasiPeringatan(
+ "Gagal upload background profile"
+ );
+ }
- const create = await funCreateNewProfile({
- data: newData as any,
- imageId: uploadPhoto.data.id,
- imageBackgroundId: uploadBackground.data.id,
- });
+ const create = await funCreateNewProfile({
+ data: newData as any,
+ imageId: uploadPhoto.data.id,
+ imageBackgroundId: uploadBackground.data.id,
+ });
- if (create.status === 201) {
- ComponentGlobal_NotifikasiBerhasil("Berhasil membuat profile", 3000);
- router.push(RouterHome.main_home, { scroll: false });
- } else {
- ComponentGlobal_NotifikasiGagal(create.message);
- setLoading(false);
+ if (create.status === 201) {
+ ComponentGlobal_NotifikasiBerhasil("Berhasil membuat profile", 3000);
+ router.push(RouterHome.main_home, { scroll: false });
+ } else {
+ ComponentGlobal_NotifikasiGagal(create.message);
+ setLoading(false);
+ }
+ } catch (error) {
+ console.log(error);
}
}
diff --git a/src/app_modules/map/_component/detail_data.tsx b/src/app_modules/map/_component/detail_data.tsx
index d76b7b5c..91686323 100644
--- a/src/app_modules/map/_component/detail_data.tsx
+++ b/src/app_modules/map/_component/detail_data.tsx
@@ -74,7 +74,7 @@ export function ComponentMap_DetailData({
- +{data?.Portofolio.tlpn}
+ {data?.Portofolio.tlpn}
diff --git a/src/app_modules/map/_component/drawer_new.tsx b/src/app_modules/map/_component/drawer_new.tsx
new file mode 100644
index 00000000..1a571316
--- /dev/null
+++ b/src/app_modules/map/_component/drawer_new.tsx
@@ -0,0 +1,206 @@
+import { RouterPortofolio } from "@/app/lib/router_hipmi/router_katalog";
+import { AccentColor, MainColor } from "@/app_modules/_global/color";
+import { ComponentGlobal_LoaderAvatar } from "@/app_modules/_global/component";
+import { ActionIcon, Box, Button, Drawer, Grid, Group, Skeleton, Stack, Text, Title } from "@mantine/core";
+import { useShallowEffect } from "@mantine/hooks";
+import { IconBuildingSkyscraper, IconListDetails, IconMapPin, IconPhoneCall, IconX } from "@tabler/icons-react";
+import { useRouter } from "next/navigation";
+import { useState } from "react";
+import { apiGetOneMapById } from "../lib/api_map";
+import { IDataMap, IDataMapDetailAuthor, IDataMapDetailBisnis } from "../lib/type_map";
+import { ComponentMap_LoadImageMap } from "./comp_load_image_map";
+import { ComponentMap_SkeletonDrawerDetailData } from "./skeleton_detail_data";
+
+
+
+
+
+// SALAHHHHHHHH ---- HARUS ULANGG
+export function ComponentMap_DrawerDetailDataNew({ opened, close, mapId, }: { opened: boolean; close: () => void; mapId: string }) {
+ const router = useRouter();
+ const [dataLokasi, setDataLokasi] = useState()
+ const [dataAuthor, setDataAuthor] = useState()
+ const [dataBisnis, setDataBisnis] = useState()
+ const [loading, setLoading] = useState(false)
+
+ useShallowEffect(() => {
+ onLoadData();
+ }, []);
+
+ async function onLoadData() {
+ try {
+ setLoading(true)
+ const response = await apiGetOneMapById(mapId)
+ if (response.success) {
+ setDataLokasi(response.dataLokasi)
+ setDataAuthor(response.dataAuthor)
+ setDataBisnis(response.dataBisnis)
+ }
+ } catch (error) {
+ console.error(error)
+ } finally {
+ setLoading(false)
+ }
+ }
+
+ return (
+ <>
+ close()}
+ position={"bottom"}
+ size={"auto"}
+ withCloseButton={false}
+ styles={{
+ content: {
+ padding: 0,
+ position: "absolute",
+ margin: "auto",
+ backgroundColor: "transparent",
+ left: 0,
+ right: 0,
+ width: 500,
+ },
+ body: {
+ backgroundColor: AccentColor.darkblue,
+ borderTop: `2px solid ${AccentColor.blue}`,
+ borderRight: `1px solid ${AccentColor.blue}`,
+ borderLeft: `1px solid ${AccentColor.blue}`,
+ borderRadius: "20px 20px 0px 0px",
+ color: "white",
+ paddingBottom: "5%",
+ },
+ }}
+ >
+
+
+
+ {dataLokasi?.namePin ? (
+ dataLokasi?.namePin
+ ) : (
+
+ )}
+
+
+
+
+
+
+
+
+
+
+ {
+ loading ?
+ :
+
+
+
+ onCheckProfile()}
+ >
+
+
+
+
+
+ onCheckProfile()}
+ >
+ {dataAuthor?.name}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {dataBisnis?.namaBisnis}
+
+
+
+
+
+
+
+ {dataBisnis?.bidangBisnis}
+
+
+
+
+
+
+
+ +{dataBisnis?.tlpn}
+
+
+
+
+
+
+
+ {dataBisnis?.alamatKantor}
+
+
+
+
+
+
+
+
+
+
+ }
+
+
+
+
+
+
+
+
+ >
+ );
+}
\ No newline at end of file
diff --git a/src/app_modules/map/lib/api_map.ts b/src/app_modules/map/lib/api_map.ts
new file mode 100644
index 00000000..f0368959
--- /dev/null
+++ b/src/app_modules/map/lib/api_map.ts
@@ -0,0 +1,9 @@
+export const apiGetAllMap = async (path?: string) => {
+ const response = await fetch(`/api/new/map${(path) ? path : ''}`)
+ return await response.json().catch(() => null)
+}
+
+export const apiGetOneMapById = async (path: string) => {
+ const response = await fetch(`/api/new/map/${path}`);
+ return await response.json().catch(() => null);
+}
diff --git a/src/app_modules/map/lib/type_map.ts b/src/app_modules/map/lib/type_map.ts
new file mode 100644
index 00000000..f4b21aa6
--- /dev/null
+++ b/src/app_modules/map/lib/type_map.ts
@@ -0,0 +1,24 @@
+export interface IDataMap {
+ id: string
+ namePin: string
+ latitude: string
+ longitude: string
+ pinId: string
+ logoId: string
+ imageId: string
+}
+
+export interface IDataMapDetailAuthor {
+ id: string
+ name: string
+ imageId: string
+}
+
+export interface IDataMapDetailBisnis {
+ id: string
+ alamatKantor: string
+ tlpn: string
+ deskripsi: string
+ namaBisnis: string
+ bidangBisnis: string
+}
\ No newline at end of file
diff --git a/src/app_modules/map/ui/ui_map_new.tsx b/src/app_modules/map/ui/ui_map_new.tsx
new file mode 100644
index 00000000..6797cee0
--- /dev/null
+++ b/src/app_modules/map/ui/ui_map_new.tsx
@@ -0,0 +1,120 @@
+"use client";
+import { APIs } from "@/app/lib";
+import { AccentColor } from "@/app_modules/_global/color/color_pallet";
+import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
+import { Avatar, Stack } from "@mantine/core";
+import { useShallowEffect } from "@mantine/hooks";
+import "mapbox-gl/dist/mapbox-gl.css";
+import { useState } from "react";
+import Map, { AttributionControl, Marker, NavigationControl, ScaleControl, } from "react-map-gl";
+import { ComponentMap_DetailData, ComponentMap_DrawerDetailData } from "../_component";
+import { apiGetAllMap } from "../lib/api_map";
+import { defaultLatLong, defaultMapZoom } from "../lib/default_lat_long";
+import { IDataMap } from "../lib/type_map";
+
+export function UiMap_MapBoxViewNew({ mapboxToken, }: { mapboxToken: string }) {
+ const [mapId, setMapId] = useState("");
+ const [openDrawer, setOpenDrawer] = useState(false);
+ const [data, setData] = useState([]);
+ const [loading, setLoading] = useState(false);
+
+ useShallowEffect(() => {
+ onLoadData();
+ }, []);
+
+ async function onLoadData() {
+ try {
+ setLoading(true)
+ const response = await apiGetAllMap()
+ if (response.success) {
+ setData(response.data)
+ }
+ } catch (error) {
+ console.error(error)
+ } finally {
+ setLoading(false)
+ }
+ }
+
+ if (!mapboxToken)
+ return ;
+
+ return (
+ <>
+
+ {
+ loading ?
+ <>> :
+
+ }
+
+
+ setOpenDrawer(false)}
+ mapId={mapId}
+ component={}
+ />
+
+ {/* setOpenDrawer(false)} mapId={mapId}/> */}
+ >
+ );
+}
diff --git a/src/app_modules/map/view/main_view_new.tsx b/src/app_modules/map/view/main_view_new.tsx
new file mode 100644
index 00000000..5c9cfb0a
--- /dev/null
+++ b/src/app_modules/map/view/main_view_new.tsx
@@ -0,0 +1,13 @@
+import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
+import { ComponentMap_Header } from "../_component";
+import { UiMap_MapBoxViewNew } from "../ui/ui_map_new";
+
+export async function Map_ViewNew({ mapboxToken }: { mapboxToken: string }) {
+ return (
+ <>
+ }>
+
+
+ >
+ );
+}