{JSON.stringify(data, null, 2)} */}
{JSON.stringify(data, null, 2)} */}
diff --git a/src/app_modules/map/fun/create/fun_create_pin.ts b/src/app_modules/map/fun/create/fun_create_pin.ts
index f68aa22b..0269aa52 100644
--- a/src/app_modules/map/fun/create/fun_create_pin.ts
+++ b/src/app_modules/map/fun/create/fun_create_pin.ts
@@ -29,7 +29,7 @@ export async function map_funCreatePin({ data }: { data: any }) {
if (!uploadImage) return { status: 400, message: "Gagal upload foto lokasi" };
const upload_Folder = Buffer.from(await gambar.arrayBuffer());
- fs.writeFileSync(`./public/map/${uploadImage.url}`, upload_Folder);
+ fs.writeFileSync(`./public/map/foto/${uploadImage.url}`, upload_Folder);
const create = await prisma.businessMaps.create({
data: {
@@ -38,7 +38,7 @@ export async function map_funCreatePin({ data }: { data: any }) {
namePin: data.namePin,
portofolioId: data?.portofolioId,
authorId: authorId,
- imagesMapId: uploadImage.id,
+ imageMapId: uploadImage.id,
},
});
diff --git a/src/app_modules/map/fun/edit/fun_custom_pin_map.ts b/src/app_modules/map/fun/edit/fun_custom_pin_map.ts
new file mode 100644
index 00000000..85cadf6d
--- /dev/null
+++ b/src/app_modules/map/fun/edit/fun_custom_pin_map.ts
@@ -0,0 +1,50 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+import _ from "lodash";
+import { v4 } from "uuid";
+import fs from "fs";
+import { revalidatePath } from "next/cache";
+import { RouterPortofolio } from "@/app/lib/router_hipmi/router_katalog";
+
+export async function map_funCustomPinMap({
+ mapId,
+ file,
+}: {
+ mapId: string;
+ file: FormData;
+}) {
+
+ const newPin: any = file.get("file");
+ const fileName = newPin.name;
+ const fileExtension = _.lowerCase(newPin.name.split(".").pop());
+ const fileRandomName = v4(fileName) + "." + fileExtension;
+
+ const uploadPin = await prisma.images.create({
+ data: {
+ url: fileRandomName,
+ label: "MAP_CUSTOM_PIN",
+ },
+ select: {
+ id: true,
+ url: true,
+ },
+ });
+
+ if (!uploadPin) return { status: 400, message: "Gagal upload foto lokasi" };
+ const upload_Folder = Buffer.from(await newPin.arrayBuffer());
+ fs.writeFileSync(`./public/map/pin/${uploadPin.url}`, upload_Folder);
+
+ const updt = await prisma.businessMaps.update({
+ where: {
+ id: mapId,
+ },
+ data: {
+ imagePinId: uploadPin.id,
+ },
+ });
+
+ if (!updt) return { status: 400, message: "Gagal update pin" };
+ revalidatePath(RouterPortofolio.main_detail)
+ return { status: 200, message: "Berhasil update pin" };
+}
diff --git a/src/app_modules/map/fun/edit/fun_edit_map.ts b/src/app_modules/map/fun/edit/fun_edit_map.ts
index 1c09b93e..5fef7c09 100644
--- a/src/app_modules/map/fun/edit/fun_edit_map.ts
+++ b/src/app_modules/map/fun/edit/fun_edit_map.ts
@@ -11,6 +11,7 @@ import { RouterPortofolio } from "@/app/lib/router_hipmi/router_katalog";
export async function map_funEditMap({
data,
file,
+
}: {
data: MODEL_MAP;
file: FormData;
@@ -37,7 +38,7 @@ export async function map_funEditMap({
if (!uploadImage)
return { status: 400, message: "Gagal upload foto lokasi" };
const upload_Folder = Buffer.from(await gambar.arrayBuffer());
- fs.writeFileSync(`./public/map/${uploadImage.url}`, upload_Folder);
+ fs.writeFileSync(`./public/map/foto/${uploadImage.url}`, upload_Folder);
const updt = await prisma.businessMaps.update({
where: {
@@ -47,7 +48,7 @@ export async function map_funEditMap({
latitude: data.latitude,
longitude: data.longitude,
namePin: data.namePin,
- imagesMapId: uploadImage.id,
+ imageMapId: uploadImage.id,
},
});
diff --git a/src/app_modules/map/fun/get/fun_get_all_map.ts b/src/app_modules/map/fun/get/fun_get_all_map.ts
index 15814a79..fcf777c2 100644
--- a/src/app_modules/map/fun/get/fun_get_all_map.ts
+++ b/src/app_modules/map/fun/get/fun_get_all_map.ts
@@ -7,6 +7,13 @@ export async function map_funGetAllMap() {
where: {
isActive: true,
},
+ include: {
+ Portofolio: {
+ select: {
+ logoId: true,
+ },
+ },
+ },
});
return data;
diff --git a/src/app_modules/map/fun/get/fun_get_one_by_id.ts b/src/app_modules/map/fun/get/fun_get_one_by_id.ts
index d1455b64..1ac1f3c6 100644
--- a/src/app_modules/map/fun/get/fun_get_one_by_id.ts
+++ b/src/app_modules/map/fun/get/fun_get_one_by_id.ts
@@ -28,7 +28,7 @@ export async function map_funGetOneById({ mapId }: { mapId: string }) {
latitude: true,
longitude: true,
authorId: true,
- imagesMapId: true,
+ imageMapId: true,
Portofolio: {
select: {
id: true,
diff --git a/src/app_modules/map/fun/get/fun_get_one_by_portofolio_id.ts b/src/app_modules/map/fun/get/fun_get_one_by_portofolio_id.ts
index 3c5cc618..772336bf 100644
--- a/src/app_modules/map/fun/get/fun_get_one_by_portofolio_id.ts
+++ b/src/app_modules/map/fun/get/fun_get_one_by_portofolio_id.ts
@@ -2,7 +2,7 @@
import prisma from "@/app/lib/prisma";
-export async function map_funGetOneByPortofolioId({
+export async function map_funGetOneBusinessMapByPortofolioId({
portofolioId,
}: {
portofolioId: string;
@@ -11,13 +11,17 @@ export async function map_funGetOneByPortofolioId({
where: {
portofolioId: portofolioId,
},
- select: {
- id: true,
- namePin: true,
- latitude: true,
- longitude: true,
- imagesMapId: true,
- },
+ include: {
+ ImageMap: true,
+ ImagePin: true,
+ Portofolio: {
+ select: {
+ id: true,
+ Logo: true,
+ logoId: true
+ }
+ }
+ }
});
return res;
diff --git a/src/app_modules/map/fun/index.ts b/src/app_modules/map/fun/index.ts
new file mode 100644
index 00000000..8c34dd18
--- /dev/null
+++ b/src/app_modules/map/fun/index.ts
@@ -0,0 +1,3 @@
+import { map_funCustomPinMap } from "./edit/fun_custom_pin_map";
+
+export { map_funCustomPinMap };
diff --git a/src/app_modules/map/lib/default_lat_long.ts b/src/app_modules/map/lib/default_lat_long.ts
index 22d6bdd2..809f3e4e 100644
--- a/src/app_modules/map/lib/default_lat_long.ts
+++ b/src/app_modules/map/lib/default_lat_long.ts
@@ -1,3 +1,3 @@
-export const defaultLatLong = [-8.723606930462012, 115.17496509980654];
-export const defaultMapZoom = 12
+export const defaultLatLong = [-8.745326073272455, 115.17319973054386];
+export const defaultMapZoom = 11
diff --git a/src/app_modules/map/lib/interface.ts b/src/app_modules/map/lib/interface.ts
index 3bc5d587..d1c08054 100644
--- a/src/app_modules/map/lib/interface.ts
+++ b/src/app_modules/map/lib/interface.ts
@@ -13,5 +13,8 @@ export interface MODEL_MAP {
Author: MODEL_USER;
portofolioId: string;
Portofolio: MODEL_PORTOFOLIO
- imagesId: string
+ imageMapId: string
+ ImageMap: any
+ imagePinId: string
+ ImagePin: any
}
diff --git a/src/app_modules/map/ui/index.ts b/src/app_modules/map/ui/index.ts
index b246f0a1..34f2c255 100644
--- a/src/app_modules/map/ui/index.ts
+++ b/src/app_modules/map/ui/index.ts
@@ -1,4 +1,5 @@
export { UiMap_MapBoxView } from "./ui_map";
export { UiMap_SplashView } from "./ui_splash";
-export { UiMap_CreatePin } from "./ui_create_pin"
-export { UiMap_EditPin } from "./ui_edit_pin"
\ No newline at end of file
+export { UiMap_CreatePin } from "./ui_create_pin";
+export { UiMap_EditMap as UiMap_EditPin } from "./ui_edit_map";
+export { UiMap_CustomPin } from "./ui_custom_pin";
diff --git a/src/app_modules/map/ui/ui_custom_pin.tsx b/src/app_modules/map/ui/ui_custom_pin.tsx
new file mode 100644
index 00000000..ac3e0cd8
--- /dev/null
+++ b/src/app_modules/map/ui/ui_custom_pin.tsx
@@ -0,0 +1,224 @@
+"use client";
+
+import { RouterPortofolio } from "@/app/lib/router_hipmi/router_katalog";
+import { RouterMap } from "@/app/lib/router_hipmi/router_map";
+import {
+ AccentColor,
+ MainColor,
+} from "@/app_modules/_global/color/color_pallet";
+import ComponentGlobal_BoxInformation from "@/app_modules/_global/component/box_information";
+import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
+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 {
+ Avatar,
+ Button,
+ Center,
+ FileButton,
+ Stack
+} from "@mantine/core";
+import { IconCamera } from "@tabler/icons-react";
+import { useRouter } from "next/navigation";
+import { useState } from "react";
+import {
+ AttributionControl,
+ Map,
+ Marker,
+ NavigationControl,
+ ScaleControl,
+} from "react-map-gl";
+import { map_funCustomPinMap } from "../fun";
+import { defaultMapZoom } from "../lib/default_lat_long";
+import { MODEL_MAP } from "../lib/interface";
+
+export function UiMap_CustomPin({
+ dataMap,
+ mapboxToken,
+}: {
+ dataMap: MODEL_MAP;
+ mapboxToken: string;
+}) {
+ const [data, setData] = useState(dataMap);
+ const [filePin, setFilePin] = useState