diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 15cfd506..2d38d7c4 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -46,6 +46,7 @@ model User { Admin_Notifikasi Notifikasi[] @relation("AdminNotifikasi") User_Notifikasi Notifikasi[] @relation("UserNotifikasi") BusinessMaps BusinessMaps[] + Investasi_Invoice Investasi_Invoice[] } model MasterUserRole { @@ -116,6 +117,7 @@ model Images { Job Job[] Image_Map BusinessMaps[] @relation("ImageMap") Image_Pin BusinessMaps[] @relation("ImagePin") + Investasi_Invoice Investasi_Invoice[] } model ImagesBackground { @@ -180,6 +182,18 @@ model MasterStatus { Job Job[] } +// ------------------- MASTER -------------------------- // + +model MasterBank { + id String @id @default(cuid()) + name String + norek String + active Boolean @default(true) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + Investasi_Invoice Investasi_Invoice[] +} + // -------------------- INVESTASI --------------------- // // Table investasi / saham model Investasi { @@ -218,6 +232,7 @@ model Investasi { TransaksiInvestasi TransaksiInvestasi[] MasterProgresInvestasi MasterProgresInvestasi? @relation(fields: [masterProgresInvestasiId], references: [id]) masterProgresInvestasiId String? + Investasi_Invoice Investasi_Invoice[] } model MasterPencarianInvestor { @@ -291,15 +306,6 @@ model BeritaInvestasi { investasiId String } -model MasterBank { - id String @id @default(cuid()) - name String - norek String - active Boolean @default(true) - createdAt DateTime @default(now()) - updatedAt DateTime @updatedAt -} - model MasterProgresInvestasi { id String @id @default(cuid()) name String @@ -352,6 +358,40 @@ model MasterStatusTransaksiInvestasi { TransaksiInvestasi TransaksiInvestasi[] } +model Investasi_Invoice { + id String @id @default(cuid()) + isActive Boolean @default(true) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + nominal String + lembarTerbeli String + + Investasi Investasi? @relation(fields: [investasiId], references: [id]) + investasiId String? + + MasterBank MasterBank? @relation(fields: [masterBankId], references: [id]) + masterBankId String? + + StatusInvoice InvestasiMaster_StatusInvoice? @relation(fields: [statusInvoiceId], references: [id]) + statusInvoiceId String? + + Author User? @relation(fields: [authorId], references: [id]) + authorId String? + + Images Images? @relation(fields: [imagesId], references: [id]) + imagesId String? +} + +model InvestasiMaster_StatusInvoice { + id String @id @default(cuid()) + name String + active Boolean @default(true) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + Investasi_Invoice Investasi_Invoice[] +} + /// ---------------------------------------- DONASI ----------------------------------------- // model Donasi { id String @id @default(cuid()) @@ -875,6 +915,7 @@ model Notifikasi { adminId String? } +// MAPS model BusinessMaps { id String @id @default(cuid()) isActive Boolean @default(true) @@ -887,8 +928,18 @@ model BusinessMaps { authorId String? Portofolio Portofolio? @relation(fields: [portofolioId], references: [id]) portofolioId String? @unique - ImageMap Images? @relation("ImageMap", fields: [imagesMapId], references: [id], map: "MapImage") - imagesMapId String? + ImageMap Images? @relation("ImageMap", fields: [imageMapId], references: [id], map: "MapImage") + imageMapId String? ImagePin Images? @relation("ImagePin", fields: [imagePinId], references: [id], map: "PinImage") imagePinId String? } + +// Kategori App +model MasterKategoriApp { + id String @id @default(cuid()) + isActive Boolean @default(true) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + name String + value String? +} diff --git a/prisma/seed.ts b/prisma/seed.ts index 77eba579..b4eb2917 100644 --- a/prisma/seed.ts +++ b/prisma/seed.ts @@ -1,410 +1,9 @@ import prisma from "./../src/app/lib/prisma"; -// import { generate_seeder } from "./../src/app_modules/_global/fun/generate_seeder"; -import bidangBisnis from "./../src/bin/seeder/bidang_bisnis.json"; -import collaboration_industri from "./../src/bin/seeder/colab/master_industri.json"; -import collaboration_status from "./../src/bin/seeder/colab/master_status.json"; -import donasi_namaBank from "./../src/bin/seeder/donasi/master_bank.json"; -import donasi_durasi from "./../src/bin/seeder/donasi/master_durasi.json"; -import donasi_kategori from "./../src/bin/seeder/donasi/master_kategori.json"; -import donasi_status from "./../src/bin/seeder/donasi/master_status.json"; -import donasi_status_invoice from "./../src/bin/seeder/donasi/master_status_invoice.json"; -import event_status from "./../src/bin/seeder/event/master_status.json"; -import event_tipe_acara from "./../src/bin/seeder/event/master_tipe_acara.json"; -import forum_kategori_report from "./../src/bin/seeder/forum/master_report.json"; -import forum_status_posting from "./../src/bin/seeder/forum/master_status.json"; -import jenisProgres from "./../src/bin/seeder/investasi/master_progres.json"; -import namaBank from "./../src/bin/seeder/investasi/nama_bank.json"; -import pembagianDeviden from "./../src/bin/seeder/investasi/pembagian_deviden.json"; -import pencarianInvestor from "./../src/bin/seeder/investasi/pencarian_investor.json"; -import periodeDeviden from "./../src/bin/seeder/investasi/periode_deviden.json"; -import statusInvestasi from "./../src/bin/seeder/investasi/status_investasi.json"; -import statusTransaksiInvestasi from "./../src/bin/seeder/investasi/status_transaksi_investasi.json"; -import master_status from "./../src/bin/seeder/master_status.json"; -import nomor_admin from "./../src/bin/seeder/nomor_admin.json"; -import userRole from "./../src/bin/seeder/user_role.json"; -import userSeeder from "./../src/bin/seeder/user_seeder.json"; -import voting_status from "./../src/bin/seeder/voting/master_status.json"; +import { generate_seeder } from "./../src/app_modules/_global/fun/generate_seeder"; (async () => { console.log("start"); - for (let i of userRole) { - await prisma.masterUserRole.upsert({ - where: { - id: i.id.toString(), - }, - update: { - id: i.id.toString(), - name: i.name, - }, - create: { - id: i.id.toString(), - name: i.name, - }, - }); - } - - for (let i of userSeeder) { - await prisma.user.upsert({ - where: { - nomor: i.nomor, - }, - create: { - nomor: i.nomor, - username: i.name, - masterUserRoleId: i.masterUserRoleId, - }, - update: { - nomor: i.nomor, - username: i.name, - masterUserRoleId: i.masterUserRoleId, - }, - }); - } - - for (let i of bidangBisnis) { - await prisma.masterBidangBisnis.upsert({ - where: { - id: i.id.toString(), - }, - update: { - id: i.id.toString(), - name: i.name, - }, - create: { - id: i.id.toString(), - name: i.name, - }, - }); - } - - for (let i of pencarianInvestor) { - await prisma.masterPencarianInvestor.upsert({ - where: { - id: i.id.toString(), - }, - update: { - id: i.id.toString(), - name: i.name, - }, - create: { - id: i.id.toString(), - name: i.name, - }, - }); - } - - for (let i of pembagianDeviden) { - await prisma.masterPembagianDeviden.upsert({ - where: { - id: i.id.toString(), - }, - update: { - id: i.id.toString(), - name: i.name, - }, - create: { - id: i.id.toString(), - name: i.name, - }, - }); - } - - for (let i of periodeDeviden) { - await prisma.masterPeriodeDeviden.upsert({ - where: { - id: i.id.toString(), - }, - update: { - id: i.id.toString(), - name: i.name, - }, - create: { - id: i.id.toString(), - name: i.name, - }, - }); - } - - for (let i of statusInvestasi) { - await prisma.masterStatusInvestasi.upsert({ - where: { - id: i.id, - }, - create: { - id: i.id, - name: i.name, - color: i.color, - }, - update: { - id: i.id, - name: i.name, - color: i.color, - }, - }); - } - - for (let i of namaBank) { - await prisma.masterBank.upsert({ - where: { - id: i.id.toString(), - }, - create: { - id: i.id.toString(), - name: i.name, - norek: i.norek.toString(), - }, - update: { - id: i.id.toString(), - name: i.name, - norek: i.norek.toString(), - }, - }); - } - - for (let i of statusTransaksiInvestasi) { - await prisma.masterStatusTransaksiInvestasi.upsert({ - where: { - id: i.id, - }, - create: { - id: i.id, - name: i.name, - color: i.color, - }, - update: { - id: i.id, - name: i.name, - color: i.color, - }, - }); - } - - for (let i of jenisProgres) { - await prisma.masterProgresInvestasi.upsert({ - where: { - id: i.id, - }, - create: { - id: i.id, - name: i.name, - }, - update: { - name: i.name, - }, - }); - } - - for (let d of donasi_status) { - await prisma.donasiMaster_StatusDonasi.upsert({ - where: { - id: d.id, - }, - create: { - id: d.id, - name: d.name, - }, - update: { - name: d.name, - }, - }); - } - - for (let d of donasi_kategori) { - await prisma.donasiMaster_Kategori.upsert({ - where: { - id: d.id, - }, - create: { - id: d.id, - name: d.name, - }, - update: { - name: d.name, - }, - }); - } - - for (let d of donasi_durasi) { - await prisma.donasiMaster_Durasi.upsert({ - where: { - id: d.id, - }, - create: { - id: d.id, - name: d.name, - }, - update: { - name: d.name, - }, - }); - } - - for (let i of donasi_namaBank) { - await prisma.donasiMaster_Bank.upsert({ - where: { - id: i.id, - }, - create: { - id: i.id, - name: i.name, - norek: i.norek, - }, - update: { - id: i.id, - name: i.name, - norek: i.norek, - }, - }); - } - - for (let d of donasi_status_invoice) { - await prisma.donasiMaster_StatusInvoice.upsert({ - where: { - id: d.id, - }, - create: { - id: d.id, - name: d.name, - }, - update: { - name: d.name, - }, - }); - } - - for (let e of event_status) { - await prisma.eventMaster_Status.upsert({ - where: { - id: e.id, - }, - create: { - id: e.id, - name: e.name, - }, - update: { - name: e.name, - }, - }); - } - - for (let e of event_tipe_acara) { - await prisma.eventMaster_TipeAcara.upsert({ - where: { - id: e.id, - }, - create: { - id: e.id, - name: e.name, - }, - update: { - name: e.name, - }, - }); - } - - for (let v of voting_status) { - await prisma.voting_Status.upsert({ - where: { - id: v.id, - }, - create: { - id: v.id, - name: v.name, - }, - update: { - name: v.name, - }, - }); - } - - for (let m of master_status) { - await prisma.masterStatus.upsert({ - where: { - id: m.id, - }, - create: { - id: m.id, - name: m.name, - }, - update: { - name: m.name, - }, - }); - } - - for (let m of forum_kategori_report) { - await prisma.forumMaster_KategoriReport.upsert({ - where: { - id: m.id as number, - }, - create: { - title: m.title, - deskripsi: m.deskripsi, - }, - update: { - title: m.title, - deskripsi: m.deskripsi, - }, - }); - } - - for (let s of forum_status_posting) { - await prisma.forumMaster_StatusPosting.upsert({ - where: { - id: s.id, - }, - create: { - status: s.status, - }, - update: { - status: s.status, - }, - }); - } - - for (let p of collaboration_industri) { - await prisma.projectCollaborationMaster_Industri.upsert({ - where: { - id: p.id, - }, - create: { - name: p.name, - }, - update: { - name: p.name, - }, - }); - } - - for (let p of collaboration_status) { - await prisma.projectCollaborationMaster_Status.upsert({ - where: { - id: p.id, - }, - create: { - name: p.name, - }, - update: { - name: p.name, - }, - }); - } - - for (let a of nomor_admin) { - await prisma.nomorAdmin.upsert({ - where: { - id: a.id, - }, - create: { - id: a.id, - nomor: a.nomor, - }, - update: { - id: a.id, - nomor: a.nomor, - }, - }); - } + await generate_seeder(); })() .then(() => { console.log("success"); diff --git a/public/donasi/invoice/2a49f6f4-e438-4553-8805-262cfc149676.jpg b/public/donasi/invoice/2a49f6f4-e438-4553-8805-262cfc149676.jpg new file mode 100644 index 00000000..ea83eb05 Binary files /dev/null and b/public/donasi/invoice/2a49f6f4-e438-4553-8805-262cfc149676.jpg differ diff --git a/public/map/994abfea-c671-40e6-80ff-085d1ab630d8.jpeg b/public/map/994abfea-c671-40e6-80ff-085d1ab630d8.jpeg deleted file mode 100644 index fb1937e3..00000000 Binary files a/public/map/994abfea-c671-40e6-80ff-085d1ab630d8.jpeg and /dev/null differ diff --git a/public/map/c9b8ae8d-840a-4d67-9417-bb385779aca7.jpg b/public/map/c9b8ae8d-840a-4d67-9417-bb385779aca7.jpg deleted file mode 100644 index 0b6c4e4a..00000000 Binary files a/public/map/c9b8ae8d-840a-4d67-9417-bb385779aca7.jpg and /dev/null differ diff --git a/public/map/d81f191e-9d94-433f-8e33-ad5bbaa187e8.jpg b/public/map/d81f191e-9d94-433f-8e33-ad5bbaa187e8.jpg deleted file mode 100644 index 830b275a..00000000 Binary files a/public/map/d81f191e-9d94-433f-8e33-ad5bbaa187e8.jpg and /dev/null differ diff --git a/public/map/foto/058062ed-4f6c-4b66-973d-baec02269426.jpg b/public/map/foto/058062ed-4f6c-4b66-973d-baec02269426.jpg new file mode 100644 index 00000000..6649ae84 Binary files /dev/null and b/public/map/foto/058062ed-4f6c-4b66-973d-baec02269426.jpg differ diff --git a/public/map/9f873fae-7b5e-4c60-a5fa-cb6b63a1eba3.jpg b/public/map/foto/a4e06daa-c60c-47a5-b401-aa9dd2d62890.jpg similarity index 100% rename from public/map/9f873fae-7b5e-4c60-a5fa-cb6b63a1eba3.jpg rename to public/map/foto/a4e06daa-c60c-47a5-b401-aa9dd2d62890.jpg diff --git a/public/map/pin/3b90a6b0-660f-4b0c-b9a2-4a7859b7d15f.png b/public/map/pin/3b90a6b0-660f-4b0c-b9a2-4a7859b7d15f.png new file mode 100644 index 00000000..7db4a537 Binary files /dev/null and b/public/map/pin/3b90a6b0-660f-4b0c-b9a2-4a7859b7d15f.png differ diff --git a/public/map/pin/6d3378ed-2f89-4a8b-b93a-787d72118a17.png b/public/map/pin/6d3378ed-2f89-4a8b-b93a-787d72118a17.png new file mode 100644 index 00000000..f88d76f7 Binary files /dev/null and b/public/map/pin/6d3378ed-2f89-4a8b-b93a-787d72118a17.png differ diff --git a/public/portofolio/logo/b46ad0ae-497e-4968-9943-14b571adce9a.jpg b/public/portofolio/logo/b46ad0ae-497e-4968-9943-14b571adce9a.jpg new file mode 100644 index 00000000..b069b1ed Binary files /dev/null and b/public/portofolio/logo/b46ad0ae-497e-4968-9943-14b571adce9a.jpg differ diff --git a/src/app/api/map/foto/[id]/route.ts b/src/app/api/map/foto/[id]/route.ts new file mode 100644 index 00000000..f822b3c6 --- /dev/null +++ b/src/app/api/map/foto/[id]/route.ts @@ -0,0 +1,32 @@ +import prisma from "@/app/lib/prisma"; +import fs from "fs"; +import { NextRequest, NextResponse } from "next/server"; + +export async function GET( + req: NextRequest, + { params }: { params: { id: string } } +) { + const get = await prisma.images.findUnique({ + where: { + id: params.id, + }, + select: { + url: true, + }, + }); + + if (!fs.existsSync(`./public/map/foto/${get?.url}`)) { + const notFile = fs.readFileSync("./public/aset/global/no_img.png"); + return new NextResponse(notFile, { + headers: { + "Content-Type": "image/png", + }, + }); + } + const file = fs.readFileSync(`./public/map/foto/${get?.url}`); + return new NextResponse(file, { + headers: { + "Content-Type": "image/png", + }, + }); +} diff --git a/src/app/api/map/[id]/route.ts b/src/app/api/map/pin/[id]/route.ts similarity index 83% rename from src/app/api/map/[id]/route.ts rename to src/app/api/map/pin/[id]/route.ts index 5b5bba33..606cb5d5 100644 --- a/src/app/api/map/[id]/route.ts +++ b/src/app/api/map/pin/[id]/route.ts @@ -15,7 +15,7 @@ export async function GET( }, }); - if (!fs.existsSync(`./public/map/${get?.url}`)) { + if (!fs.existsSync(`./public/map/pin/${get?.url}`)) { const notFile = fs.readFileSync("./public/aset/global/no_img.png"); return new NextResponse(notFile, { headers: { @@ -23,7 +23,7 @@ export async function GET( }, }); } - const file = fs.readFileSync(`./public/map/${get?.url}`); + const file = fs.readFileSync(`./public/map/pin/${get?.url}`); return new NextResponse(file, { headers: { "Content-Type": "image/png", diff --git a/src/app/contoh/page.tsx b/src/app/contoh/page.tsx new file mode 100644 index 00000000..211c2c35 --- /dev/null +++ b/src/app/contoh/page.tsx @@ -0,0 +1,50 @@ +"use client"; +import { ComponentNotifikasi_CardSkeleton } from "@/app_modules/notifikasi/component"; +import { Box, Button, Flex, Paper, Stack, Title } from "@mantine/core"; + +export default function Page() { + + return<> + + + + + return ( + + + + {Array.from(new Array(10), (_, i) => ( + + Contoh + + ))} + + + + + Ini Bagian Yang Gak Ikut + + + ); +} diff --git a/src/app/dev/investasi/transaksi/invoice/[id]/page.tsx b/src/app/dev/investasi/transaksi/invoice/[id]/page.tsx new file mode 100644 index 00000000..96af36c1 --- /dev/null +++ b/src/app/dev/investasi/transaksi/invoice/[id]/page.tsx @@ -0,0 +1,12 @@ +import { Investasi_UiInvoice } from "@/app_modules/investasi/_ui"; + +export default function Page({ params }: { params: { id: string } }) { + const invoiceId = params.id; + + + return ( + <> + + + ); +} diff --git a/src/app/dev/investasi/transaksi/pembelian/[id]/page.tsx b/src/app/dev/investasi/transaksi/pembelian/[id]/page.tsx index c8c5754a..ff9e0b90 100644 --- a/src/app/dev/investasi/transaksi/pembelian/[id]/page.tsx +++ b/src/app/dev/investasi/transaksi/pembelian/[id]/page.tsx @@ -1,5 +1,6 @@ import { investasi_funGetOneInvestasiById } from "@/app_modules/investasi/_fun"; -import { Investasi_UiProsesTransaksi } from "@/app_modules/investasi/_ui"; +import { Investasi_UiProsesPembelian } from "@/app_modules/investasi/_ui"; + export default async function Page({ params }: { params: { id: string } }) { const investasiId = params.id; @@ -7,7 +8,7 @@ export default async function Page({ params }: { params: { id: string } }) { return ( <> - + ); } diff --git a/src/app/dev/investasi/transaksi/proses-transaksi/[id]/page.tsx b/src/app/dev/investasi/transaksi/proses-transaksi/[id]/page.tsx new file mode 100644 index 00000000..08909807 --- /dev/null +++ b/src/app/dev/investasi/transaksi/proses-transaksi/[id]/page.tsx @@ -0,0 +1,11 @@ +import { Investasi_UiProsesTransaksi } from "@/app_modules/investasi/_ui"; + +export default async function Page({ params }: { params: { id: string } }) { + const invoiceId = params.id; + + return ( + <> + + + ); +} diff --git a/src/app/dev/map/custom-pin/[id]/page.tsx b/src/app/dev/map/custom-pin/[id]/page.tsx new file mode 100644 index 00000000..40347ba6 --- /dev/null +++ b/src/app/dev/map/custom-pin/[id]/page.tsx @@ -0,0 +1,16 @@ +import { map_funGetOneBusinessMapByPortofolioId } from "@/app_modules/map/fun/get/fun_get_one_by_portofolio_id"; +import { Map_CustomPin } from "@/app_modules/map/view"; + +export default async function Page({ params }: { params: { id: string } }) { + const portofolioId = params.id; + const dataMap = await map_funGetOneBusinessMapByPortofolioId({ + portofolioId: portofolioId, + }); + + + return ( + <> + + + ); +} diff --git a/src/app/dev/map/edit/[id]/page.tsx b/src/app/dev/map/edit/[id]/page.tsx index 79a07168..13a5758d 100644 --- a/src/app/dev/map/edit/[id]/page.tsx +++ b/src/app/dev/map/edit/[id]/page.tsx @@ -1,9 +1,9 @@ -import { map_funGetOneByPortofolioId } from "@/app_modules/map/fun/get/fun_get_one_by_portofolio_id"; +import { map_funGetOneBusinessMapByPortofolioId } from "@/app_modules/map/fun/get/fun_get_one_by_portofolio_id"; import { Map_EditPin } from "@/app_modules/map/view"; export default async function Page({ params }: { params: { id: string } }) { const portofolioId = params.id; - const dataMap = await map_funGetOneByPortofolioId({portofolioId: portofolioId}) + const dataMap = await map_funGetOneBusinessMapByPortofolioId({portofolioId: portofolioId}) return ( <> diff --git a/src/app/dev/map/main/page.tsx b/src/app/dev/map/main/page.tsx index 36cb8f49..202b3ffc 100644 --- a/src/app/dev/map/main/page.tsx +++ b/src/app/dev/map/main/page.tsx @@ -1,14 +1,14 @@ import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data"; +import { map_funGetAllMap } from "@/app_modules/map/fun/get/fun_get_all_map"; import { Map_View } from "@/app_modules/map/view"; const mapboxToken = process.env.MAPBOX_TOKEN!; export default async function Page() { - if (!mapboxToken) - return ; + const dataMap = await map_funGetAllMap(); return ( <> - + ); } diff --git a/src/app/dev/notifikasi/page.tsx b/src/app/dev/notifikasi/page.tsx index de986f62..93689e8a 100644 --- a/src/app/dev/notifikasi/page.tsx +++ b/src/app/dev/notifikasi/page.tsx @@ -1,12 +1,24 @@ -import { Notifikasi_MainView } from "@/app_modules/notifikasi"; +import { ComponentNotifikasi_CardSkeleton } from "@/app_modules/notifikasi/component"; +import { notifikasi_funGetKategoriApp } from "@/app_modules/notifikasi/fun/get/fun_get_kategori_app"; import notifikasi_getByUserId from "@/app_modules/notifikasi/fun/get/get_notifiaksi_by_id"; +import { Notifikasi_MainView } from "@/app_modules/notifikasi/view"; +import { Suspense } from "react"; export default async function Page() { - const listNotifikasi = await notifikasi_getByUserId({ page: 1 }); + const listNotifikasi = await notifikasi_getByUserId({ + page: 1, + kategoriApp: "Semua", + }); + const masterKategori = await notifikasi_funGetKategoriApp(); return ( <> - + }> + + ); } diff --git a/src/app/lib/router_hipmi/router_investasi.ts b/src/app/lib/router_hipmi/router_investasi.ts index c3933bf9..7c97bdec 100644 --- a/src/app/lib/router_hipmi/router_investasi.ts +++ b/src/app/lib/router_hipmi/router_investasi.ts @@ -2,6 +2,8 @@ export const NEW_RouterInvestasi = { // Transaksi pembelian: "/dev/investasi/transaksi/pembelian/", metode_pembayaran: "/dev/investasi/transaksi/metode-pembayaran/", + invoice: "/dev/investasi/transaksi/invoice/", + proses_transaksi: "/dev/investasi/transaksi/proses-transaksi/", // file view file_view: "/dev/investasi/file-view/", diff --git a/src/app/lib/router_hipmi/router_map.ts b/src/app/lib/router_hipmi/router_map.ts index b2c4bd15..4c2f8a66 100644 --- a/src/app/lib/router_hipmi/router_map.ts +++ b/src/app/lib/router_hipmi/router_map.ts @@ -1,10 +1,12 @@ export const RouterMap = { // api - api_foto: "/api/map/", + api_foto: "/api/map/foto/", + api_custom_pin: "/api/map/pin/", // main splash: "/dev/map/splash", main_view: "/dev/map/main", create: "/dev/map/create/", edit: "/dev/map/edit/", + custom_pin: "/dev/map/custom-pin/", }; diff --git a/src/app_modules/_global/fun/generate_seeder.ts b/src/app_modules/_global/fun/generate_seeder.ts index 837c2f12..828bde19 100644 --- a/src/app_modules/_global/fun/generate_seeder.ts +++ b/src/app_modules/_global/fun/generate_seeder.ts @@ -23,6 +23,8 @@ import nomor_admin from "../../../bin/seeder/nomor_admin.json"; import userRole from "../../../bin/seeder/user_role.json"; import userSeeder from "../../../bin/seeder/user_seeder.json"; import voting_status from "../../../bin/seeder/voting/master_status.json"; +import { master_kategori_app } from "@/bin/seeder/master"; +import { new_status_transaksi_investasi } from "@/bin/seeder/investasi"; export async function generate_seeder() { for (let i of userRole) { @@ -404,5 +406,37 @@ export async function generate_seeder() { }); } + for (let a of master_kategori_app) { + await prisma.masterKategoriApp.upsert({ + where: { + id: a.id, + }, + create: { + id: a.id, + name: a.name, + }, + update: { + id: a.id, + name: a.name, + }, + }); + } + + for (let a of new_status_transaksi_investasi) { + await prisma.investasiMaster_StatusInvoice.upsert({ + where: { + id: a.id, + }, + create: { + id: a.id, + name: a.name, + }, + update: { + id: a.id, + name: a.name, + }, + }); + } + return { status: 200, success: true }; } diff --git a/src/app_modules/_global/fun/get/fun_master_kategori_app.ts b/src/app_modules/_global/fun/get/fun_master_kategori_app.ts new file mode 100644 index 00000000..a47a70ea --- /dev/null +++ b/src/app_modules/_global/fun/get/fun_master_kategori_app.ts @@ -0,0 +1,13 @@ +"use server"; + +import prisma from "@/app/lib/prisma"; + +export async function funGlobal_getMasterKategoriApp() { + const data = await prisma.masterKategoriApp.findMany({ + where: { + isActive: true, + }, + }); + + return data; +} diff --git a/src/app_modules/_global/fun/get/index.ts b/src/app_modules/_global/fun/get/index.ts new file mode 100644 index 00000000..6c8d677a --- /dev/null +++ b/src/app_modules/_global/fun/get/index.ts @@ -0,0 +1,3 @@ +import { funGlobal_getMasterKategoriApp } from "./fun_master_kategori_app"; + +export { funGlobal_getMasterKategoriApp }; diff --git a/src/app_modules/admin/map/component/drawer_detail_map.tsx b/src/app_modules/admin/map/component/drawer_detail_map.tsx index 2cae9c40..19bb1de8 100644 --- a/src/app_modules/admin/map/component/drawer_detail_map.tsx +++ b/src/app_modules/admin/map/component/drawer_detail_map.tsx @@ -66,7 +66,7 @@ export function ComponentAdminMap_Drawer({ radius={"md"} width={300} alt="Foto" - src={RouterMap.api_foto + data?.imagesId} + src={RouterMap.api_foto + data?.imageMapId} /> diff --git a/src/app_modules/home/component/button_header.tsx b/src/app_modules/home/component/button_header.tsx index 2410796d..080f9c7c 100644 --- a/src/app_modules/home/component/button_header.tsx +++ b/src/app_modules/home/component/button_header.tsx @@ -16,6 +16,8 @@ import { RouterNotifikasi } from "@/app/lib/router_hipmi/router_notifikasi"; import { useShallowEffect } from "@mantine/hooks"; import notifikasi_countUserNotifikasi from "@/app_modules/notifikasi/fun/count/fun_count_by_id"; import mqtt_client from "@/util/mqtt_client"; +import { useAtom } from "jotai"; +import { gs_notifikasi_kategori_app } from "@/app_modules/notifikasi/lib"; export function ComponentHome_ButtonHeaderLeft({ dataUser, @@ -59,19 +61,9 @@ export function ComponentHome_ButtonHeaderRight({ const router = useRouter(); const [count, setCount] = useState(countNotifikasi); const [isLoadingBell, setIsLoadingBell] = useState(false); - - // useShallowEffect(() => { - // onLoadNotifkasi({ - // onLoad(val) { - // setCount(val); - // }, - // }); - // }, []); - - // async function onLoadNotifkasi({ onLoad }: { onLoad: (val: any) => void }) { - // const loadNotifikasi = await notifikasi_countUserNotifikasi(); - // onLoad(loadNotifikasi); - // } + const [activeKategori, setActiveKategori] = useAtom( + gs_notifikasi_kategori_app + ); useShallowEffect(() => { mqtt_client.subscribe("USER"); @@ -107,11 +99,14 @@ export function ComponentHome_ButtonHeaderRight({ } else { router.push(RouterNotifikasi.main, { scroll: false }); setIsLoadingBell(true); + setActiveKategori("Semua") } }} > {isLoadingBell ? ( + ) : count === 0 ? ( + ) : ( + + + + + + Admin sedang memproses transaksimu + +
+ +
+
+ Mohon menunggu ! +
+
+
+
+ + + + + + Hubungi admin jika tidak kunjung di proses! + + + Klik pada logo Whatsapp ini. + + + {/* + + */} + + + +
+ + ); +} diff --git a/src/app_modules/investasi/_component/transaksi/view_invoice.tsx b/src/app_modules/investasi/_component/transaksi/view_invoice.tsx new file mode 100644 index 00000000..baf22321 --- /dev/null +++ b/src/app_modules/investasi/_component/transaksi/view_invoice.tsx @@ -0,0 +1,267 @@ +"use client"; + +import { NEW_RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi"; +import { + AccentColor, + MainColor, +} from "@/app_modules/_global/color/color_pallet"; +import TampilanRupiahDonasi from "@/app_modules/donasi/component/tampilan_rupiah"; +import { + Stack, + Title, + Group, + Paper, + Grid, + CopyButton, + Button, + Center, + FileButton, + Text, +} from "@mantine/core"; +import { IconCamera, IconCircleCheck } from "@tabler/icons-react"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; + +export function ComponentInvestasi_ViewInvoice({ + dataInvoice, +}: { + dataInvoice: any; +}) { + const router = useRouter(); + const [invoice, setDataInvoice] = useState(dataInvoice); + const [file, setFile] = useState(null); + const [image, setImage] = useState(null); + // const [active, setActive] = useAtom(gs_donasi_hot_menu); + + return ( + <> + + + Mohon transfer ke rekening dibawah + + untuk diteruskan ke + {invoice?.Donasi?.Author.username} + + + + + + + Bank {invoice?.DonasiMaster_Bank?.name} + PT. Himpunan Pengusaha Badung + + + + + + + {invoice?.DonasiMaster_Bank?.norek} + + + + + + + {({ copied, copy }) => ( + + )} + + + + + + + + + + + + Jumlah transfer + + + + + + + <TampilanRupiahDonasi nominal={+(+invoice.nominal)} /> + + + + + + + {({ copied, copy }) => ( + + )} + + + + + + {/* + Sudah termasuk biaya admin Rp. 2.500,- + */} + + + + + +
+ { + try { + // const buffer = URL.createObjectURL( + // new Blob([new Uint8Array(await files.arrayBuffer())]) + // ); + // console.log(buffer, "ini buffer"); + // console.log(files, " ini file"); + setFile(files); + // onUpload(invoice.id, files); + } catch (error) { + console.log(error); + } + }} + accept="image/png,image/jpeg" + > + {(props) => ( + + )} + +
+ {file ? ( +
+ + + Upload berhasil{" "} + + + +
+ ) : ( +
+ + Upload bukti transfer anda ! + +
+ )} +
+
+ + {file !== null ? ( + + ) : ( + + )} +
+ + ); +} diff --git a/src/app_modules/investasi/_ui/index.ts b/src/app_modules/investasi/_ui/index.ts index a016b178..d128a84a 100644 --- a/src/app_modules/investasi/_ui/index.ts +++ b/src/app_modules/investasi/_ui/index.ts @@ -1,7 +1,11 @@ import { Investasi_UiFileView } from "./file_view"; +import { Investasi_UiInvoice } from "./transaksi/invoice"; import { Investasi_UiMetodePembayaran } from "./transaksi/metode_pembayaran"; +import { Investasi_UiProsesPembelian } from "./transaksi/proses_pembelian"; import { Investasi_UiProsesTransaksi } from "./transaksi/proses_transaksi"; -export { Investasi_UiProsesTransaksi }; +export { Investasi_UiProsesPembelian }; export { Investasi_UiMetodePembayaran }; export { Investasi_UiFileView }; +export { Investasi_UiInvoice }; +export { Investasi_UiProsesTransaksi }; diff --git a/src/app_modules/investasi/_ui/transaksi/invoice.tsx b/src/app_modules/investasi/_ui/transaksi/invoice.tsx new file mode 100644 index 00000000..01a61cf5 --- /dev/null +++ b/src/app_modules/investasi/_ui/transaksi/invoice.tsx @@ -0,0 +1,15 @@ +"use client"; + +import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate"; +import { ComponentInvestasi_ViewInvoice } from "../../_component"; +import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate"; + +export function Investasi_UiInvoice() { + return ( + } + > + + + ); +} diff --git a/src/app_modules/investasi/_ui/transaksi/proses_pembelian.tsx b/src/app_modules/investasi/_ui/transaksi/proses_pembelian.tsx new file mode 100644 index 00000000..4cbf7e31 --- /dev/null +++ b/src/app_modules/investasi/_ui/transaksi/proses_pembelian.tsx @@ -0,0 +1,22 @@ +"use client"; + +import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate"; +import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate"; +import { ComponentInvestasi_BoxPembelian } from "../../_component"; + + +export function Investasi_UiProsesPembelian({ + dataInvestasi, +}: { + dataInvestasi: any; +}) { + return ( + <> + } + > + + + + ); +} diff --git a/src/app_modules/investasi/_ui/transaksi/proses_transaksi.tsx b/src/app_modules/investasi/_ui/transaksi/proses_transaksi.tsx index 587460a2..62fe2565 100644 --- a/src/app_modules/investasi/_ui/transaksi/proses_transaksi.tsx +++ b/src/app_modules/investasi/_ui/transaksi/proses_transaksi.tsx @@ -1,21 +1,22 @@ "use client"; -import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate"; import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate"; -import { ComponentInvestasi_BoxPembelian } from "../../_component"; +import { ComponentInvestasi_ProsesAccAdmin } from "../../_component"; +import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate"; +import { IconX } from "@tabler/icons-react"; - -export function Investasi_UiProsesTransaksi({ - dataInvestasi, -}: { - dataInvestasi: any; -}) { +export function Investasi_UiProsesTransaksi() { return ( <> } + header={ + } + /> + } > - + ); diff --git a/src/app_modules/investasi/detail/view.tsx b/src/app_modules/investasi/detail/view.tsx index 29bd51d5..7058b1b9 100644 --- a/src/app_modules/investasi/detail/view.tsx +++ b/src/app_modules/investasi/detail/view.tsx @@ -2,10 +2,14 @@ import { NEW_RouterInvestasi, - RouterInvestasi_OLD, + RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi"; import { Warna } from "@/app/lib/warna"; import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/_global/author_name_on_header"; +import { + AccentColor, + MainColor, +} from "@/app_modules/_global/color/color_pallet"; import { MODEL_PROFILE_OLD } from "@/app_modules/home/model/user_profile"; import { ActionIcon, @@ -19,10 +23,9 @@ import { Image, Paper, Progress, - SimpleGrid, Stack, Text, - Title, + Title } from "@mantine/core"; import { IconBookDownload, @@ -35,12 +38,8 @@ import { useAtom } from "jotai"; import moment from "moment"; import { useRouter } from "next/navigation"; import { useState } from "react"; -import { gs_TransferValue } from "../g_state"; import { MODEL_INVESTASI } from "../_lib/interface"; -import { - AccentColor, - MainColor, -} from "@/app_modules/_global/color/color_pallet"; +import { gs_TransferValue } from "../g_state"; export default function DetailInvestasi({ dataInvestasi, @@ -86,10 +85,11 @@ export default function DetailInvestasi({ async function onSubmit() { //NEW - // router.push(NEW_RouterInvestasi.pembelian + data.id, { scroll: false }); + router.push(NEW_RouterInvestasi.pembelian + data.id, { scroll: false }); // OLD - router.push(RouterInvestasi_OLD.proses_transaksi + `${data.id}`); + // router.push(RouterInvestasi_OLD.proses_transaksi + `${data.id}`); + setTransaksiValue({ ...transaksiValue, lembarTerbeli: "", diff --git a/src/app_modules/katalog/portofolio/component/button_more.tsx b/src/app_modules/katalog/portofolio/component/button_more.tsx index 65397a97..766b2482 100644 --- a/src/app_modules/katalog/portofolio/component/button_more.tsx +++ b/src/app_modules/katalog/portofolio/component/button_more.tsx @@ -9,6 +9,8 @@ import { IconDotsVertical, IconEdit, IconId, + IconMapPin, + IconMapPin2, IconMapPinMinus, IconPhotoEdit, } from "@tabler/icons-react"; @@ -46,10 +48,16 @@ export function ComponentPortofolio_ButtonMore({ }, { id: "4", - name: "Edit pin map", - icon: , + name: "Edit data map", + icon: , path: RouterMap.edit + `${portoId}`, }, + { + id: "5", + name: "Custom pin map", + icon: , + path: RouterMap.custom_pin + `${portoId}`, + }, ]; return ( diff --git a/src/app_modules/katalog/portofolio/component/detail_data_drawer_map.tsx b/src/app_modules/katalog/portofolio/component/detail_data_drawer_map.tsx index 3c004dbb..ef68cee8 100644 --- a/src/app_modules/katalog/portofolio/component/detail_data_drawer_map.tsx +++ b/src/app_modules/katalog/portofolio/component/detail_data_drawer_map.tsx @@ -2,6 +2,10 @@ import { RouterMap } from "@/app/lib/router_hipmi/router_map"; import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/_global/author_name_on_header"; +import { MainColor } from "@/app_modules/_global/color/color_pallet"; +import { ComponentMap_SkeletonDrawerDetailData } from "@/app_modules/map/_component"; +import { map_funGetOneById } from "@/app_modules/map/fun/get/fun_get_one_by_id"; +import { MODEL_MAP } from "@/app_modules/map/lib/interface"; import { Box, Button, @@ -10,23 +14,17 @@ import { Image, SimpleGrid, Stack, - Text, - Title, + Text } from "@mantine/core"; import { useShallowEffect } from "@mantine/hooks"; -import { useState } from "react"; import { IconBuildingSkyscraper, IconListDetails, - IconPhoneCall, IconMapPin, + IconPhoneCall, } from "@tabler/icons-react"; import { useRouter } from "next/navigation"; -import { RouterPortofolio } from "@/app/lib/router_hipmi/router_katalog"; -import { MainColor } from "@/app_modules/_global/color/color_pallet"; -import { MODEL_MAP } from "@/app_modules/map/lib/interface"; -import { map_funGetOneById } from "@/app_modules/map/fun/get/fun_get_one_by_id"; -import { ComponentMap_SkeletonDrawerDetailData } from "@/app_modules/map/_component"; +import { useState } from "react"; export function ComponentPortofolio_DetailDataMap({ mapId }: { mapId: any }) { const router = useRouter(); @@ -45,7 +43,7 @@ export function ComponentPortofolio_DetailDataMap({ mapId }: { mapId: any }) { return ( <> - + @@ -104,6 +102,38 @@ export function ComponentPortofolio_DetailDataMap({ mapId }: { mapId: any }) { + + + + + + + + + + {/*
{JSON.stringify(data, null, 2)}
*/}
diff --git a/src/app_modules/katalog/portofolio/fun/get/get_one_portofolio.ts b/src/app_modules/katalog/portofolio/fun/get/get_one_portofolio.ts index 49565a82..5baca6d4 100644 --- a/src/app_modules/katalog/portofolio/fun/get/get_one_portofolio.ts +++ b/src/app_modules/katalog/portofolio/fun/get/get_one_portofolio.ts @@ -8,18 +8,8 @@ export async function portofolio_getOneById(portoId: string) { where: { id: portoId, }, - select: { - id: true, - id_Portofolio: true, - namaBisnis: true, - alamatKantor: true, - deskripsi: true, - tlpn: true, - active: true, - profileId: true, + include: { Logo: true, - logoId: true, - masterBidangBisnisId: true, MasterBidangBisnis: { select: { id: true, @@ -41,6 +31,8 @@ export async function portofolio_getOneById(portoId: string) { BusinessMaps: { include: { Author: true, + ImageMap: true, + ImagePin: true, }, }, }, diff --git a/src/app_modules/katalog/portofolio/ui/ui_detail_map.tsx b/src/app_modules/katalog/portofolio/ui/ui_detail_map.tsx index 3d3d3158..1ecfaffe 100644 --- a/src/app_modules/katalog/portofolio/ui/ui_detail_map.tsx +++ b/src/app_modules/katalog/portofolio/ui/ui_detail_map.tsx @@ -1,10 +1,12 @@ "use client"; +import { RouterPortofolio } from "@/app/lib/router_hipmi/router_katalog"; +import { RouterMap } from "@/app/lib/router_hipmi/router_map"; import { AccentColor } from "@/app_modules/_global/color/color_pallet"; import { ComponentMap_DrawerDetailData } from "@/app_modules/map/_component"; import { defaultMapZoom } from "@/app_modules/map/lib/default_lat_long"; import { MODEL_MAP } from "@/app_modules/map/lib/interface"; -import { Image, Paper, Stack, Text, Title } from "@mantine/core"; +import { Image, Paper, Stack, Title } from "@mantine/core"; import "mapbox-gl/dist/mapbox-gl.css"; import { useState } from "react"; import { @@ -16,7 +18,6 @@ import { } from "react-map-gl"; import { ComponentPortofolio_DetailDataMap } from "../component"; import { MODEL_LOGO, MODEL_PORTOFOLIO } from "../model/interface"; -import { RouterPortofolio } from "@/app/lib/router_hipmi/router_katalog"; export function Portofolio_UiMap({ mapboxToken, @@ -25,7 +26,6 @@ export function Portofolio_UiMap({ mapboxToken: string; data: MODEL_PORTOFOLIO; }) { - // console.log(data); return ( - - {/* - {data.namePin} - */}
diff --git a/src/app_modules/map/_component/detail_data.tsx b/src/app_modules/map/_component/detail_data.tsx index f241b21d..4bc306dc 100644 --- a/src/app_modules/map/_component/detail_data.tsx +++ b/src/app_modules/map/_component/detail_data.tsx @@ -30,6 +30,7 @@ import { useRouter } from "next/navigation"; import { RouterPortofolio } from "@/app/lib/router_hipmi/router_katalog"; import { MainColor } from "@/app_modules/_global/color/color_pallet"; import { ComponentMap_SkeletonDrawerDetailData } from "./skeleton_detail_data"; +import Link from "next/link"; export function ComponentMap_DetailData({ mapId }: { mapId: any }) { const router = useRouter(); @@ -48,7 +49,7 @@ export function ComponentMap_DetailData({ mapId }: { mapId: any }) { return ( <> - + @@ -116,24 +117,35 @@ export function ComponentMap_DetailData({ mapId }: { mapId: any }) { { maxWidth: 600, cols: 1, spacing: "sm" }, ]} > - + - - - + {/*
{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(null); + const [imgPin, setImgPin] = useState(null); + + if (!mapboxToken) + return ; + + return ( + <> + {/* Logo Custom */} + + + + + {imgPin ? ( +
+ +
+ ) : ( +
+ +
+ )} + +
+ { + try { + const buffer = URL.createObjectURL( + new Blob([new Uint8Array(await files.arrayBuffer())]) + ); + if (files.size > 2000000) { + ComponentGlobal_NotifikasiPeringatan( + "Maaf, Ukuran file terlalu besar, maximum 2mb", + 3000 + ); + } else { + setImgPin(buffer); + setFilePin(files); + } + } catch (error) { + console.log(error); + } + }} + accept="image/png,image/jpeg" + > + {(props) => ( + + )} + +
+
+ + {/* Map */} + + + + + + + + + + +
+ + ); +} + +function ButtonSimpan({ + mapId, + filePin, +}: { + mapId: string; + filePin: FormData; +}) { + const router = useRouter(); + const [isLoading, setLoading] = useState(false); + + async function onCustom() { + const file = new FormData(); + file.append("file", filePin as any); + + const res = await map_funCustomPinMap({ mapId: mapId, file: file }); + res.status === 200 + ? (ComponentGlobal_NotifikasiBerhasil(res.message), router.back()) + : ComponentGlobal_NotifikasiGagal(res.message); + } + + return ( + <> + + + ); +} diff --git a/src/app_modules/map/ui/ui_edit_pin.tsx b/src/app_modules/map/ui/ui_edit_map.tsx similarity index 85% rename from src/app_modules/map/ui/ui_edit_pin.tsx rename to src/app_modules/map/ui/ui_edit_map.tsx index 47e7d986..ceb34f6c 100644 --- a/src/app_modules/map/ui/ui_edit_pin.tsx +++ b/src/app_modules/map/ui/ui_edit_map.tsx @@ -1,27 +1,27 @@ "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_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 { AspectRatio, - Box, + Avatar, Button, Center, FileButton, Image, Paper, Stack, - Text, TextInput, - Title, } from "@mantine/core"; import { IconCamera } from "@tabler/icons-react"; -import _ from "lodash"; import { useRouter } from "next/navigation"; import { useState } from "react"; import Map, { @@ -30,13 +30,11 @@ import Map, { NavigationControl, ScaleControl, } from "react-map-gl"; -import { map_funCreatePin } from "../fun/create/fun_create_pin"; -import { defaultLatLong, defaultMapZoom } from "../lib/default_lat_long"; -import { MODEL_MAP } from "../lib/interface"; -import { RouterMap } from "@/app/lib/router_hipmi/router_map"; import { map_funEditMap } from "../fun/edit/fun_edit_map"; +import { defaultMapZoom } from "../lib/default_lat_long"; +import { MODEL_MAP } from "../lib/interface"; -export function UiMap_EditPin({ +export function UiMap_EditMap({ mapboxToken, dataMap, }: { @@ -47,10 +45,9 @@ export function UiMap_EditPin({ const [file, setFile] = useState(null); const [img, setImg] = useState(null); - return ( <> - + - - image - + @@ -123,7 +127,10 @@ export function UiMap_EditPin({ /> - + {/* Foto Usaha */} + + + {img ? ( @@ -214,8 +221,7 @@ function ButtonSavePin({ data, file }: { data: MODEL_MAP; file: FormData }) { const res = await map_funEditMap({ data: data, - file: gambar - + file: gambar, }); res.status === 200 ? (ComponentGlobal_NotifikasiBerhasil(res.message), router.back()) @@ -225,7 +231,7 @@ function ButtonSavePin({ data, file }: { data: MODEL_MAP; file: FormData }) { return ( <> + ))} + +
+ {_.isEmpty(data) ? ( ) : ( (
@@ -121,7 +165,7 @@ export function Notifikasi_UiView({ )} )} - + ); } diff --git a/src/app_modules/notifikasi/index.ts b/src/app_modules/notifikasi/view/index.ts similarity index 100% rename from src/app_modules/notifikasi/index.ts rename to src/app_modules/notifikasi/view/index.ts diff --git a/src/app_modules/notifikasi/view/view_notifikasi.tsx b/src/app_modules/notifikasi/view/view_notifikasi.tsx new file mode 100644 index 00000000..121c50a0 --- /dev/null +++ b/src/app_modules/notifikasi/view/view_notifikasi.tsx @@ -0,0 +1,23 @@ +import UIGlobal_LayoutHeaderTamplate from "../../_global/ui/ui_header_tamplate"; +import { Notifikasi_UiLayout, Notifikasi_UiView } from "../ui"; + +export default function Notifikasi_MainView({ + listNotifikasi, + masterKategori, +}: { + listNotifikasi: any[]; + masterKategori: any[]; +}) { + return ( + <> + } + > + + + + ); +} diff --git a/src/app_modules/notifikasi/view_notifikasi.tsx b/src/app_modules/notifikasi/view_notifikasi.tsx deleted file mode 100644 index 2855b5b9..00000000 --- a/src/app_modules/notifikasi/view_notifikasi.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import UIGlobal_LayoutHeaderTamplate from "../_global/ui/ui_header_tamplate"; -import UIGlobal_LayoutTamplate from "../_global/ui/ui_layout_tamplate"; -import { Notifikasi_UiView } from "./component/ui_notifiaksi"; - -export default function Notifikasi_MainView({ - listNotifikasi, -}: { - listNotifikasi: any[]; -}) { - return ( - <> - } - > - - - - ); -} diff --git a/src/bin/seeder/investasi/index.ts b/src/bin/seeder/investasi/index.ts new file mode 100644 index 00000000..65b32fc9 --- /dev/null +++ b/src/bin/seeder/investasi/index.ts @@ -0,0 +1,3 @@ +import new_status_transaksi_investasi from "./new_status_transaksi.json"; + +export { new_status_transaksi_investasi }; diff --git a/src/bin/seeder/investasi/new_status_transaksi.json b/src/bin/seeder/investasi/new_status_transaksi.json new file mode 100644 index 00000000..1e9c92bd --- /dev/null +++ b/src/bin/seeder/investasi/new_status_transaksi.json @@ -0,0 +1,22 @@ +[ + { + "id": "1", + "name": "Berhasil" + }, + { + "id": "2", + "name": "Proses" + }, + { + "id": "3", + "name": "Menunggu" + }, + { + "id": "4", + "name": "Menolak" + }, + { + "id": "5", + "name": "Gagal" + } +] diff --git a/src/bin/seeder/master/index.ts b/src/bin/seeder/master/index.ts new file mode 100644 index 00000000..2b36c6e7 --- /dev/null +++ b/src/bin/seeder/master/index.ts @@ -0,0 +1,3 @@ +import master_kategori_app from "./master_kategori_app.json"; + +export { master_kategori_app }; diff --git a/src/bin/seeder/master/master_kategori_app.json b/src/bin/seeder/master/master_kategori_app.json new file mode 100644 index 00000000..1ffdba06 --- /dev/null +++ b/src/bin/seeder/master/master_kategori_app.json @@ -0,0 +1,30 @@ +[ + { + "id": "1", + "name": "Event" + }, + { + "id": "2", + "name": "Job" + }, + { + "id": "3", + "name": "Voting" + }, + { + "id": "4", + "name": "Donasi" + }, + { + "id": "5", + "name": "Investasi" + }, + { + "id": "6", + "name": "Forum" + }, + { + "id": "7", + "name": "Collaboration" + } +]