fix: Admin
Deskripsi: - Penambahan field nama rekening di db bank - Optimalisasi event ## No Issue
This commit is contained in:
124
src/app_modules/admin/map/component/comp_detail_data_drawer.tsx
Normal file
124
src/app_modules/admin/map/component/comp_detail_data_drawer.tsx
Normal file
@@ -0,0 +1,124 @@
|
||||
import { RouterMap } from "@/app/lib/router_hipmi/router_map";
|
||||
import { MODEL_MAP } from "@/app_modules/map/lib/interface";
|
||||
import {
|
||||
Stack,
|
||||
AspectRatio,
|
||||
Box,
|
||||
Grid,
|
||||
Image,
|
||||
Text,
|
||||
Button,
|
||||
Center,
|
||||
} from "@mantine/core";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import {
|
||||
IconBuildingSkyscraper,
|
||||
IconListDetails,
|
||||
IconPhoneCall,
|
||||
IconMapPin,
|
||||
IconPinned,
|
||||
} from "@tabler/icons-react";
|
||||
import { useState } from "react";
|
||||
import { adminMap_funGetOneById } from "../fun/fun_get_one_by_id";
|
||||
|
||||
export function ComponentAdminMap_DetailDataDrawer({
|
||||
mapId,
|
||||
}: {
|
||||
mapId: string;
|
||||
}) {
|
||||
const [data, setData] = useState<MODEL_MAP>();
|
||||
|
||||
useShallowEffect(() => {
|
||||
onLoadMap(mapId);
|
||||
}, [mapId]);
|
||||
|
||||
async function onLoadMap(mapId: string) {
|
||||
try {
|
||||
const res = await adminMap_funGetOneById({ mapId: mapId });
|
||||
setData(res as any);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<AspectRatio ratio={1 / 1} mah={300}>
|
||||
<Image
|
||||
radius={"md"}
|
||||
width={300}
|
||||
alt="Foto"
|
||||
src={RouterMap.api_foto + data?.imageMapId}
|
||||
/>
|
||||
</AspectRatio>
|
||||
|
||||
<Box>
|
||||
<Grid>
|
||||
<Grid.Col span={2}>
|
||||
<IconBuildingSkyscraper />
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Text>{data?.Portofolio.namaBisnis}</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Col span={2}>
|
||||
<IconListDetails />
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Text>{data?.Portofolio.MasterBidangBisnis.name}</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Col span={2}>
|
||||
<IconPhoneCall />
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Text>+{data?.Portofolio.tlpn}</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Col span={2}>
|
||||
<IconMapPin />
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Text>{data?.Portofolio.alamatKantor}</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Col span={2}>
|
||||
<IconPinned />
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Text>{data?.Portofolio.deskripsi}</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Box>
|
||||
|
||||
{data ? (
|
||||
<Center>
|
||||
<Button
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
window.open(
|
||||
`https://maps.google.com?q=${data?.latitude},${data?.longitude}`,
|
||||
"_blank",
|
||||
"width=800,height=600,noopener,noreferrer"
|
||||
);
|
||||
}}
|
||||
>
|
||||
Buka Google Map
|
||||
</Button>
|
||||
</Center>
|
||||
) : (
|
||||
<Center>
|
||||
<Button radius={"xl"} disabled>
|
||||
Buka Google Map
|
||||
</Button>
|
||||
</Center>
|
||||
)}
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
65
src/app_modules/admin/map/component/comp_skeleton_drawer.tsx
Normal file
65
src/app_modules/admin/map/component/comp_skeleton_drawer.tsx
Normal file
@@ -0,0 +1,65 @@
|
||||
import { Box, Button, Center, Grid, Skeleton, Stack } from "@mantine/core";
|
||||
import {
|
||||
IconBuildingSkyscraper,
|
||||
IconListDetails,
|
||||
IconMapPin,
|
||||
IconPhoneCall,
|
||||
IconPinned,
|
||||
} from "@tabler/icons-react";
|
||||
|
||||
export function ComponentAdminMap_SkeletonDrawer() {
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<Skeleton h={300} width={300} />
|
||||
<Box>
|
||||
<Grid>
|
||||
<Grid.Col span={2}>
|
||||
<IconBuildingSkyscraper />
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Skeleton radius={"xl"} h={10} />
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Col span={2}>
|
||||
<IconListDetails />
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Skeleton radius={"xl"} h={10} />
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Col span={2}>
|
||||
<IconPhoneCall />
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Skeleton radius={"xl"} h={10} />
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Col span={2}>
|
||||
<IconMapPin />
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Skeleton radius={"xl"} h={10} />
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Col span={2}>
|
||||
<IconPinned />
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Skeleton radius={"xl"} h={10} />
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Box>
|
||||
<Center>
|
||||
<Button radius={"xl"} disabled>
|
||||
Buka Google Map
|
||||
</Button>
|
||||
</Center>
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { RouterMap } from "@/app/lib/router_hipmi/router_map";
|
||||
import { MODEL_MAP } from "@/app_modules/map/lib/interface";
|
||||
import {
|
||||
AspectRatio,
|
||||
Box,
|
||||
@@ -9,21 +11,20 @@ import {
|
||||
Image,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { ComponentAdmin_UIDrawerNotifikasi } from "../../notifikasi/ui_drawer_notifikasi";
|
||||
import { MODEL_MAP } from "@/app_modules/map/lib/interface";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { adminMap_funGetOneById } from "../fun/fun_get_one_by_id";
|
||||
import { useState } from "react";
|
||||
import { RouterMap } from "@/app/lib/router_hipmi/router_map";
|
||||
import {
|
||||
IconBuildingSkyscraper,
|
||||
IconListDetails,
|
||||
IconPhoneCall,
|
||||
IconMapPin,
|
||||
IconPhoneCall,
|
||||
IconPinned,
|
||||
} from "@tabler/icons-react";
|
||||
import { useState } from "react";
|
||||
import { adminMap_funGetOneById } from "../fun/fun_get_one_by_id";
|
||||
import _ from "lodash";
|
||||
import { ComponentAdminMap_SkeletonDrawer } from "./comp_skeleton_drawer";
|
||||
import { ComponentAdminMap_DetailDataDrawer } from "./comp_detail_data_drawer";
|
||||
|
||||
export function ComponentAdminMap_Drawer({
|
||||
opened,
|
||||
@@ -41,8 +42,12 @@ export function ComponentAdminMap_Drawer({
|
||||
}, [mapId]);
|
||||
|
||||
async function onLoadMap(mapId: string) {
|
||||
const res = await adminMap_funGetOneById({ mapId: mapId });
|
||||
setData(res as any);
|
||||
try {
|
||||
const res = await adminMap_funGetOneById({ mapId: mapId });
|
||||
setData(res as any);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -60,59 +65,12 @@ export function ComponentAdminMap_Drawer({
|
||||
position="right"
|
||||
size={"sm"}
|
||||
>
|
||||
<Stack>
|
||||
<AspectRatio ratio={1 / 1} mah={300}>
|
||||
<Image
|
||||
radius={"md"}
|
||||
width={300}
|
||||
alt="Foto"
|
||||
src={RouterMap.api_foto + data?.imageMapId}
|
||||
/>
|
||||
</AspectRatio>
|
||||
{_.isEmpty(data) ? (
|
||||
<ComponentAdminMap_SkeletonDrawer />
|
||||
) : (
|
||||
<ComponentAdminMap_DetailDataDrawer mapId={mapId} />
|
||||
)}
|
||||
|
||||
<Box>
|
||||
<Grid>
|
||||
<Grid.Col span={2}>
|
||||
<IconBuildingSkyscraper />
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Text>{data?.Portofolio.namaBisnis}</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Col span={2}>
|
||||
<IconListDetails />
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Text>{data?.Portofolio.MasterBidangBisnis.name}</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Col span={2}>
|
||||
<IconPhoneCall />
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Text>+{data?.Portofolio.tlpn}</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Col span={2}>
|
||||
<IconMapPin />
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Text>{data?.Portofolio.alamatKantor}</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Col span={2}>
|
||||
<IconPinned />
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Text >{data?.Portofolio.deskripsi}</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Box>
|
||||
</Stack>
|
||||
{/* <pre>{JSON.stringify(data, null, 2)}</pre> */}
|
||||
</Drawer>
|
||||
</>
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
import { ComponentAdminMap_DetailDataDrawer } from "./comp_detail_data_drawer";
|
||||
import { ComponentAdminMap_SkeletonDrawer } from "./comp_skeleton_drawer";
|
||||
import { ComponentAdminMap_Drawer } from "./drawer_detail_map";
|
||||
|
||||
export { ComponentAdminMap_Drawer };
|
||||
export { ComponentAdminMap_SkeletonDrawer };
|
||||
export { ComponentAdminMap_DetailDataDrawer };
|
||||
|
||||
@@ -10,6 +10,10 @@ export async function adminMap_funGetAllMaps() {
|
||||
where: {
|
||||
isActive: true,
|
||||
},
|
||||
include: {
|
||||
ImagePin: true,
|
||||
Portofolio: true,
|
||||
},
|
||||
});
|
||||
|
||||
return data;
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
defaultLatLong,
|
||||
defaultMapZoom,
|
||||
} from "@/app_modules/map/lib/default_lat_long";
|
||||
import { Image, Paper, Stack, Text } from "@mantine/core";
|
||||
import { Avatar, Image, Paper, Stack, Text } from "@mantine/core";
|
||||
import "mapbox-gl/dist/mapbox-gl.css";
|
||||
import Map, {
|
||||
AttributionControl,
|
||||
@@ -16,6 +16,9 @@ import Map, {
|
||||
ScaleControl,
|
||||
} from "react-map-gl";
|
||||
import { ComponentAdminMap_Drawer } from "../component";
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import { RouterPortofolio } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import { RouterMap } from "@/app/lib/router_hipmi/router_map";
|
||||
|
||||
export function UiAdminMap_MapBoxView({
|
||||
mapboxToken,
|
||||
@@ -77,25 +80,19 @@ export function UiAdminMap_MapBoxView({
|
||||
setOpenDrawer(true);
|
||||
}}
|
||||
>
|
||||
<Image
|
||||
w={"100%"}
|
||||
alt="image"
|
||||
src="https://cdn-icons-png.flaticon.com/512/5860/5860579.png"
|
||||
/>
|
||||
<Text
|
||||
fz={"xs"}
|
||||
bg={"dark"}
|
||||
c={"white"}
|
||||
align="center"
|
||||
<Avatar
|
||||
alt="Logo"
|
||||
style={{
|
||||
borderRadius: "5px",
|
||||
padding: "5px",
|
||||
width: 50,
|
||||
border: `2px solid ${AccentColor.softblue}`,
|
||||
borderRadius: "100%",
|
||||
backgroundColor: "white",
|
||||
}}
|
||||
lineClamp={2}
|
||||
>
|
||||
{e.namePin}
|
||||
</Text>
|
||||
src={
|
||||
e.imagePinId === null
|
||||
? RouterPortofolio.api_logo_porto + e.Portofolio.logoId
|
||||
: RouterMap.api_custom_pin + e.imagePinId
|
||||
}
|
||||
/>
|
||||
</Stack>
|
||||
</Marker>
|
||||
</Stack>
|
||||
@@ -108,9 +105,9 @@ export function UiAdminMap_MapBoxView({
|
||||
</Stack>
|
||||
|
||||
<ComponentAdminMap_Drawer
|
||||
opened={openDrawer}
|
||||
onClose={() => setOpenDrawer(false)}
|
||||
mapId={mapId as any}
|
||||
opened={openDrawer}
|
||||
onClose={() => setOpenDrawer(false)}
|
||||
mapId={mapId as any}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -2,7 +2,6 @@ import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamp
|
||||
import { adminMap_funGetAllMaps } from "../fun/fun_get_all_maps";
|
||||
import { UiAdminMap_MapBoxView } from "../ui";
|
||||
|
||||
|
||||
const mapboxToken = process.env.MAPBOX_TOKEN!;
|
||||
export async function AdminMap_View() {
|
||||
const dataMap = await adminMap_funGetAllMaps();
|
||||
@@ -10,7 +9,6 @@ export async function AdminMap_View() {
|
||||
return (
|
||||
<>
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Maps" />
|
||||
|
||||
<UiAdminMap_MapBoxView
|
||||
mapboxToken={mapboxToken}
|
||||
dataMap={dataMap as any}
|
||||
|
||||
Reference in New Issue
Block a user