fix: Admin
Deskripsi: - Penambahan field nama rekening di db bank - Optimalisasi event ## No Issue
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 6.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.9 KiB |
33
src/app/api/investasi/bukti-transfer/[id]/route.ts
Normal file
33
src/app/api/investasi/bukti-transfer/[id]/route.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import fs from "fs";
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export async function GET(
|
||||
req: NextRequest,
|
||||
{ params }: { params: { id: string } }
|
||||
) {
|
||||
const data = await prisma.images.findUnique({
|
||||
where: {
|
||||
id: params.id,
|
||||
},
|
||||
select: {
|
||||
url: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (!fs.existsSync(`./public/investasi/invoice/${data?.url}`)) {
|
||||
const fl = fs.readFileSync(`./public/aset/no-img.png`);
|
||||
return new NextResponse(fl, {
|
||||
headers: {
|
||||
"Content-Type": "image/png",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const fl = fs.readFileSync(`./public/investasi/invoice/${data?.url}`);
|
||||
return new NextResponse(fl, {
|
||||
headers: {
|
||||
"Content-Type": "image/png",
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { AdminAppInformation_MainView } from "@/app_modules/admin/app_info";
|
||||
import adminAppInformation_getMasterBank from "@/app_modules/admin/app_info/fun/master/get_list_bank";
|
||||
import adminAppInformation_getNomorAdmin from "@/app_modules/admin/app_info/fun/master/get_nomor_admin";
|
||||
import { AdminAppInformation_UiMain } from "@/app_modules/admin/app_info/ui";
|
||||
|
||||
export default async function Page() {
|
||||
const nomorAdmin = await adminAppInformation_getNomorAdmin();
|
||||
@@ -8,10 +8,7 @@ export default async function Page() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<AdminAppInformation_MainView
|
||||
nomorAdmin={nomorAdmin}
|
||||
listBank={listBank}
|
||||
/>
|
||||
<AdminAppInformation_UiMain nomorAdmin={nomorAdmin} listBank={listBank} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import ComponentAdminGlobal_LoadingPage from "@/app_modules/admin/_admin_global/loading_admin_page";
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<ComponentAdminGlobal_LoadingPage />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import ComponentAdminGlobal_LoadingPage from "@/app_modules/admin/_admin_global/loading_admin_page";
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<ComponentAdminGlobal_LoadingPage />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import ComponentAdminGlobal_LoadingPage from "@/app_modules/admin/_admin_global/loading_admin_page";
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<ComponentAdminGlobal_LoadingPage />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import ComponentAdminGlobal_LoadingPage from "@/app_modules/admin/_admin_global/loading_admin_page";
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<ComponentAdminGlobal_LoadingPage />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
import { AdminEvent_Riwayat } from "@/app_modules/admin/event";
|
||||
import { AdminEvent_getListAllRiwayat } from "@/app_modules/admin/event/fun/get/get_list_all_riwayat";
|
||||
import { adminEvent_funGetListAllRiwayat } from "@/app_modules/admin/event/fun/get/get_list_all_riwayat";
|
||||
|
||||
export default async function Page() {
|
||||
const listRiwayat = await AdminEvent_getListAllRiwayat()
|
||||
|
||||
const listRiwayat = await adminEvent_funGetListAllRiwayat({ page: 1 });
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
3
src/app/dev/admin/event/detail/main-detail/page.tsx
Normal file
3
src/app/dev/admin/event/detail/main-detail/page.tsx
Normal file
@@ -0,0 +1,3 @@
|
||||
export default function Page({ params }: { params: { id: string } }) {
|
||||
return null;
|
||||
}
|
||||
13
src/app/dev/admin/event/detail/peserta/[id]/page.tsx
Normal file
13
src/app/dev/admin/event/detail/peserta/[id]/page.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import { AdminEvent_UiDetailPeserta } from "@/app_modules/admin/event/_ui";
|
||||
import { adminEvent_getListPesertaById } from "@/app_modules/admin/event/fun/get/get_list_peserta_by_id";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const eventId = params.id;
|
||||
const dataPeserta = await adminEvent_getListPesertaById({ eventId, page: 1 });
|
||||
|
||||
return (
|
||||
<>
|
||||
<AdminEvent_UiDetailPeserta dataPeserta={dataPeserta} eventId={eventId} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import ComponentAdminGlobal_LoadingPage from "@/app_modules/admin/_admin_global/loading_admin_page";
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<ComponentAdminGlobal_LoadingPage />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
import { AdminEvent_TablePublish } from "@/app_modules/admin/event";
|
||||
import { adminEvent_funGetListPublish } from "@/app_modules/admin/event/fun";
|
||||
import { AdminEvent_getListTableByStatusId } from "@/app_modules/admin/event/fun/get/get_list_table_by_status_id";
|
||||
|
||||
export default async function Page() {
|
||||
const listPublish = await AdminEvent_getListTableByStatusId("1");
|
||||
const listPublish = await adminEvent_funGetListPublish({page: 1});
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { AdminEvent_TableReject } from "@/app_modules/admin/event";
|
||||
import { AdminEvent_getListTableByStatusId } from "@/app_modules/admin/event/fun/get/get_list_table_by_status_id";
|
||||
import { adminEvent_funGetListReject } from "@/app_modules/admin/event/fun";
|
||||
|
||||
export default async function Page() {
|
||||
const listReject = await AdminEvent_getListTableByStatusId("4")
|
||||
const listReject = await adminEvent_funGetListReject({ page: 1 });
|
||||
|
||||
return <>
|
||||
<AdminEvent_TableReject listReject={listReject as any}/>
|
||||
return (
|
||||
<>
|
||||
<AdminEvent_TableReject listReject={listReject as any} />
|
||||
</>
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import { AdminEvent_TableReview } from "@/app_modules/admin/event";
|
||||
import { adminEvent_funGetListReview } from "@/app_modules/admin/event/fun";
|
||||
import { AdminEvent_getListTableByStatusId } from "@/app_modules/admin/event/fun/get/get_list_table_by_status_id";
|
||||
|
||||
export default async function Page() {
|
||||
const listReview = await AdminEvent_getListTableByStatusId("2")
|
||||
const listReview = await adminEvent_funGetListReview({ page: 1 });
|
||||
|
||||
return <>
|
||||
<AdminEvent_TableReview listReview={listReview as any}/>
|
||||
</>
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<AdminEvent_TableReview listData={listReview as any} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import ComponentAdminGlobal_LoadingPage from "@/app_modules/admin/_admin_global/loading_admin_page";
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<ComponentAdminGlobal_LoadingPage />
|
||||
</>
|
||||
);
|
||||
}
|
||||
10
src/app/dev/admin/investasi/bukti-transfer/[id]/page.tsx
Normal file
10
src/app/dev/admin/investasi/bukti-transfer/[id]/page.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import { AdminInvestasi_DetailBuktiTransfer } from "@/app_modules/admin/investasi/detail";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const imageId = params.id;
|
||||
return (
|
||||
<>
|
||||
<AdminInvestasi_DetailBuktiTransfer imageId={imageId} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
import { Admin_LayoutBuktiTransferInvestasi } from "@/app_modules/admin/investasi";
|
||||
import React from "react";
|
||||
|
||||
export default async function Layout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Admin_LayoutBuktiTransferInvestasi>
|
||||
{children}
|
||||
</Admin_LayoutBuktiTransferInvestasi>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import { Admin_BuktiTransferInvestasi } from "@/app_modules/admin/investasi";
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<Admin_BuktiTransferInvestasi />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,13 +1,27 @@
|
||||
import { AdminInvestasi_DetailPublish } from "@/app_modules/admin/investasi";
|
||||
import {
|
||||
adminInvestasi_funGetAllTransaksiById,
|
||||
adminInvestasi_getStatusInvestasi,
|
||||
} from "@/app_modules/admin/investasi/fun";
|
||||
import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const investasiId = params.id;
|
||||
const dataInvestasi = await getOneInvestasiById(investasiId);
|
||||
const statusTransaksi = await adminInvestasi_getStatusInvestasi();
|
||||
const dataTransaksi = await adminInvestasi_funGetAllTransaksiById({
|
||||
investasiId,
|
||||
page: 1,
|
||||
});
|
||||
|
||||
|
||||
export default async function Page({params}: {params: {id: string}}) {
|
||||
const investasiId = params.id;
|
||||
const dataInvestasi = await getOneInvestasiById(investasiId);
|
||||
|
||||
return<>
|
||||
<AdminInvestasi_DetailPublish data={dataInvestasi as any}/>
|
||||
return (
|
||||
<>
|
||||
<AdminInvestasi_DetailPublish
|
||||
data={dataInvestasi as any}
|
||||
dataTransaksi={dataTransaksi as any}
|
||||
statusTransaksi={statusTransaksi}
|
||||
investasiId={investasiId as any}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import ComponentAdminGlobal_LoadingPage from "@/app_modules/admin/_admin_global/loading_admin_page";
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<ComponentAdminGlobal_LoadingPage />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import ComponentAdminGlobal_LoadingPage from "@/app_modules/admin/_admin_global/loading_admin_page";
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<ComponentAdminGlobal_LoadingPage />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import ComponentAdminGlobal_LoadingPage from "@/app_modules/admin/_admin_global/loading_admin_page";
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<ComponentAdminGlobal_LoadingPage />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { StatusTransaksiInvestasi } from "@/app_modules/investasi";
|
||||
import { investasi_funGetInvoiceById } from "@/app_modules/investasi/_fun/get/fun_get_one_invoice_by_id";
|
||||
import { Investasi_UiTransaksiBerhasil } from "@/app_modules/investasi/_ui";
|
||||
|
||||
export default async function Page({params}: {params: {id: string}}) {
|
||||
const invoiceId = params.id;
|
||||
const dataTransaksi = await investasi_funGetInvoiceById({ invoiceId });
|
||||
return (
|
||||
<>
|
||||
<Investasi_UiTransaksiBerhasil dataTransaksi={dataTransaksi} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
18
src/app/dev/investasi/status-transaksi/gagal/[id]/page.tsx
Normal file
18
src/app/dev/investasi/status-transaksi/gagal/[id]/page.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
import { funGlobal_getNomorAdmin } from "@/app_modules/_global/fun/get";
|
||||
import { investasi_funGetInvoiceById } from "@/app_modules/investasi/_fun/get/fun_get_one_invoice_by_id";
|
||||
import { Investasi_UiTransaksiGagal } from "@/app_modules/investasi/_ui/status_transaksi/ui_transaksi_gagal";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const invoiceId = params.id;
|
||||
const dataTransaksi = await investasi_funGetInvoiceById({ invoiceId });
|
||||
const nomorAdmin = await funGlobal_getNomorAdmin();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Investasi_UiTransaksiGagal
|
||||
dataTransaksi={dataTransaksi}
|
||||
nomorAdmin={nomorAdmin as any}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
import { LayoutStatusTransaksiInvestasi } from "@/app_modules/investasi";
|
||||
import React from "react";
|
||||
|
||||
export default async function Layout({children}: {children: React.ReactNode}) {
|
||||
return<>
|
||||
<LayoutStatusTransaksiInvestasi>{children}</LayoutStatusTransaksiInvestasi>
|
||||
</>
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import ComponentGlobal_V2_LoadingPage from "@/app_modules/_global/loading_page_v2";
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<ComponentGlobal_V2_LoadingPage/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import { StatusTransaksiInvestasi } from "@/app_modules/investasi";
|
||||
|
||||
|
||||
export default async function Page() {
|
||||
return<>
|
||||
<StatusTransaksiInvestasi/>
|
||||
</>
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
import { LayoutStatusTransaksiInvestasi_Gagal } from "@/app_modules/investasi";
|
||||
import React from "react";
|
||||
|
||||
export default async function Layout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<LayoutStatusTransaksiInvestasi_Gagal>
|
||||
{children}
|
||||
</LayoutStatusTransaksiInvestasi_Gagal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import ComponentGlobal_V2_LoadingPage from "@/app_modules/_global/loading_page_v2";
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<ComponentGlobal_V2_LoadingPage/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
import { StatusTransaksiInvestasi_Gagal } from "@/app_modules/investasi";
|
||||
import getTransaksiByIdInvestasi from "@/app_modules/investasi/fun/get_transaksi_investasi";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
// console.log(params.id)
|
||||
const dataTransaksi = await getTransaksiByIdInvestasi(params.id);
|
||||
// console.log(dataTransaksi);
|
||||
|
||||
return (
|
||||
<>
|
||||
<StatusTransaksiInvestasi_Gagal dataTransaksi={dataTransaksi as any} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { investasi_funGetInvoiceById } from "@/app_modules/investasi/_fun/get/fun_get_invoice_by_id";
|
||||
import { investasi_funGetInvoiceById } from "@/app_modules/investasi/_fun/get/fun_get_one_invoice_by_id";
|
||||
import { Investasi_UiInvoice } from "@/app_modules/investasi/_ui";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
|
||||
@@ -2,6 +2,9 @@ export const RouterAdminEvent = {
|
||||
main_event: "/dev/admin/event/main",
|
||||
|
||||
// detail
|
||||
detail_peserta: "/dev/admin/event/detail/peserta/",
|
||||
|
||||
// child
|
||||
detail_tipe_acara: "/dev/admin/event/child/tipe_acara",
|
||||
detail_riwayat: "/dev/admin/event/child/riwayat",
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
export const RouterAdminInvestasi = {
|
||||
// API
|
||||
api_bukti_transfer: "/api/investasi/bukti-transfer/",
|
||||
|
||||
main: "/dev/admin/investasi/main",
|
||||
table_publish: "/dev/admin/investasi/sub-menu/publish",
|
||||
table_review: "/dev/admin/investasi/sub-menu/review",
|
||||
@@ -8,4 +11,5 @@ export const RouterAdminInvestasi = {
|
||||
detail_publish: "/dev/admin/investasi/detail/publish/",
|
||||
detail_review: "/dev/admin/investasi/detail/review/",
|
||||
detail_reject: "/dev/admin/investasi/detail/reject/",
|
||||
};
|
||||
bukti_transfer: "/dev/admin/investasi/bukti-transfer/",
|
||||
};
|
||||
|
||||
@@ -5,9 +5,13 @@ export const NEW_RouterInvestasi = {
|
||||
invoice: "/dev/investasi/transaksi/invoice/",
|
||||
proses_transaksi: "/dev/investasi/transaksi/proses-transaksi/",
|
||||
|
||||
// stasus transaksi
|
||||
transaksi_gagal: "/dev/investasi/status-transaksi/gagal/",
|
||||
transaksi_berhasil: "/dev/investasi/status-transaksi/berhasil/",
|
||||
|
||||
// file view
|
||||
file_view: "/dev/investasi/file-view/",
|
||||
}
|
||||
};
|
||||
|
||||
export const RouterInvestasi_OLD = {
|
||||
api_gambar: "/api/investasi/gambar/",
|
||||
@@ -32,7 +36,7 @@ export const RouterInvestasi_OLD = {
|
||||
proses_investasi: "/dev/investasi/proses_investasi/",
|
||||
proses_transaksi: "/dev/investasi/proses_transaksi/",
|
||||
status_transaksi: "/dev/investasi/status_transaksi/berhasil",
|
||||
status_pesanan:"/dev/investasi/status_pesanan/",
|
||||
status_pesanan: "/dev/investasi/status_pesanan/",
|
||||
status_transaksi_gagal: "/dev/investasi/status_transaksi/gagal/",
|
||||
metode_transfer: "/dev/investasi/metode_transfer/",
|
||||
|
||||
@@ -64,5 +68,3 @@ export const RouterInvestasi_OLD = {
|
||||
upload_prospektus: "/dev/investasi/upload_prospektus/",
|
||||
upload_dokumen: "/dev/investasi/upload_dokumen/",
|
||||
};
|
||||
|
||||
|
||||
|
||||
28
src/app_modules/_global/component/comp_tampilan_rupiah.tsx
Normal file
28
src/app_modules/_global/component/comp_tampilan_rupiah.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import { Text } from "@mantine/core";
|
||||
|
||||
export default function ComponentGlobal_TampilanRupiah({
|
||||
nominal,
|
||||
color,
|
||||
fontSize,
|
||||
}: {
|
||||
nominal: number;
|
||||
color?: string;
|
||||
fontSize?: number;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Text
|
||||
fz={fontSize ? fontSize : "md"}
|
||||
style={{
|
||||
color: color ? color : "black",
|
||||
}}
|
||||
>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", { maximumFractionDigits: 10 }).format(
|
||||
nominal
|
||||
)}
|
||||
</Text>
|
||||
</>
|
||||
);
|
||||
}
|
||||
3
src/app_modules/_global/component/index.ts
Normal file
3
src/app_modules/_global/component/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import ComponentGlobal_TampilanRupiah from "./comp_tampilan_rupiah";
|
||||
|
||||
export { ComponentGlobal_TampilanRupiah };
|
||||
@@ -0,0 +1,29 @@
|
||||
"use client";
|
||||
|
||||
import { Group, Title, TextInput } from "@mantine/core";
|
||||
import { IconSearch } from "@tabler/icons-react";
|
||||
import React from "react";
|
||||
|
||||
export function ComponentAdminGlobal_TitlePage({
|
||||
name,
|
||||
color,
|
||||
component,
|
||||
}: {
|
||||
name: string;
|
||||
color?: string;
|
||||
component?: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Group
|
||||
position="apart"
|
||||
bg={color ? color : "gray.4"}
|
||||
p={"xs"}
|
||||
style={{ borderRadius: "6px" }}
|
||||
>
|
||||
<Title order={4}>{name}</Title>
|
||||
{component ? component : ""}
|
||||
</Group>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -17,8 +17,6 @@ export default function ComponentAdminGlobal_BackButton({
|
||||
<>
|
||||
<Group>
|
||||
<Button
|
||||
// loaderPosition="center"
|
||||
// loading={isLoading ? true : false}
|
||||
c={"gray"}
|
||||
leftIcon={
|
||||
isLoading ? (
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import { Text } from "@mantine/core";
|
||||
|
||||
export function ComponentAdminGlobal_TampilanRupiah({
|
||||
nominal,
|
||||
color,
|
||||
fontSize,
|
||||
}: {
|
||||
nominal: number;
|
||||
color?: string;
|
||||
fontSize?: number;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Text
|
||||
fz={fontSize ? fontSize : "md"}
|
||||
style={{
|
||||
color: color ? color : "black",
|
||||
}}
|
||||
>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", { maximumFractionDigits: 10 }).format(
|
||||
nominal
|
||||
)}
|
||||
</Text>
|
||||
</>
|
||||
);
|
||||
}
|
||||
5
src/app_modules/admin/_admin_global/index.ts
Normal file
5
src/app_modules/admin/_admin_global/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { ComponentAdminGlobal_TitlePage } from "./_component/title_page";
|
||||
import { ComponentAdminGlobal_TampilanRupiah } from "./comp_admin_teampilan_rupiah";
|
||||
|
||||
export { ComponentAdminGlobal_TampilanRupiah };
|
||||
export { ComponentAdminGlobal_TitlePage };
|
||||
@@ -1,53 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
Box,
|
||||
Center,
|
||||
Group,
|
||||
LoadingOverlay,
|
||||
Skeleton,
|
||||
Text,
|
||||
} from "@mantine/core";
|
||||
|
||||
export default function ComponentAdminGlobal_LoadingPage() {
|
||||
const listhHuruf = [
|
||||
{
|
||||
huruf: "H",
|
||||
},
|
||||
{
|
||||
huruf: "I",
|
||||
},
|
||||
{
|
||||
huruf: "P",
|
||||
},
|
||||
{
|
||||
huruf: "M",
|
||||
},
|
||||
{
|
||||
huruf: "I",
|
||||
},
|
||||
];
|
||||
const customLOader = (
|
||||
<Center h={"90vh"}>
|
||||
<Group>
|
||||
{listhHuruf.map((e, i) => (
|
||||
<Center key={i} h={"100%"}>
|
||||
<Skeleton height={50} circle radius={"100%"} />
|
||||
<Text sx={{ position: "absolute" }} c={"gray.4"} fw={"bold"}>
|
||||
{e.huruf}
|
||||
</Text>
|
||||
</Center>
|
||||
))}
|
||||
</Group>
|
||||
</Center>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* <LoadingOverlay visible loader={customLOader} /> */}
|
||||
<Box>
|
||||
{customLOader}
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
3
src/app_modules/admin/app_info/component/index.tsx
Normal file
3
src/app_modules/admin/app_info/component/index.tsx
Normal file
@@ -0,0 +1,3 @@
|
||||
import { AdminAppInformation_ComponentTitlePageBank } from "./info_bank/comp_title_page";
|
||||
|
||||
export { AdminAppInformation_ComponentTitlePageBank };
|
||||
@@ -0,0 +1,32 @@
|
||||
import { ComponentAdminGlobal_TitlePage } from "@/app_modules/admin/_admin_global";
|
||||
import { Button } from "@mantine/core";
|
||||
import { IconCirclePlus } from "@tabler/icons-react";
|
||||
|
||||
export function AdminAppInformation_ComponentTitlePageBank({
|
||||
onEventListener,
|
||||
}: {
|
||||
onEventListener: (val: any) => void;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<ComponentAdminGlobal_TitlePage
|
||||
name="Informasi Bank"
|
||||
component={
|
||||
<Button
|
||||
w={120}
|
||||
leftIcon={<IconCirclePlus />}
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
onEventListener({
|
||||
isCreate: true,
|
||||
isUpdate: false,
|
||||
});
|
||||
}}
|
||||
>
|
||||
Tambah
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { MODEL_MASTER_BANK } from "@/app_modules/investasi/_lib/interface";
|
||||
|
||||
export default async function adminAppInformation_createBank({
|
||||
data,
|
||||
}: {
|
||||
data: any;
|
||||
data: MODEL_MASTER_BANK;
|
||||
}) {
|
||||
const count = await prisma.masterBank.count({});
|
||||
const idBank = count + 1;
|
||||
@@ -13,8 +14,8 @@ export default async function adminAppInformation_createBank({
|
||||
const create = await prisma.masterBank.create({
|
||||
data: {
|
||||
id: idBank.toString(),
|
||||
namaBank: data.name,
|
||||
namaAkun: data.akun,
|
||||
namaBank: data.namaBank,
|
||||
namaAkun: data.namaAkun,
|
||||
norek: data.norek,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -17,6 +17,8 @@ export default async function adminAppInformation_updateStatusBankById({
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
|
||||
if (!updt) return { status: 400, message: "Gagal update" };
|
||||
return { status: 200, message: "Berhasil update" };
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ export default async function adminAppInformation_updateDataBankById({
|
||||
},
|
||||
data: {
|
||||
namaBank: data.namaBank,
|
||||
namaAkun: data.namaAkun,
|
||||
norek: data.norek,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
import AdminAppInformation_MainView from "./main";
|
||||
export { AdminAppInformation_MainView };
|
||||
3
src/app_modules/admin/app_info/ui/index.tsx
Normal file
3
src/app_modules/admin/app_info/ui/index.tsx
Normal file
@@ -0,0 +1,3 @@
|
||||
import AdminAppInformation_UiMain from "./ui_main";
|
||||
|
||||
export { AdminAppInformation_UiMain };
|
||||
@@ -1,14 +1,13 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
Space,
|
||||
Stack
|
||||
} from "@mantine/core";
|
||||
import { Space, Stack } from "@mantine/core";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||
import InformasiBank from "./info_bank";
|
||||
import InformasiWhatApps from "./info_whatsapp";
|
||||
import {
|
||||
AdminAppInformation_ViewInfoBank,
|
||||
AdminAppInformation_ViewInformasiWhatApps,
|
||||
} from "../view";
|
||||
|
||||
export default function AdminAppInformation_MainView({
|
||||
export default function AdminAppInformation_UiMain({
|
||||
nomorAdmin,
|
||||
listBank,
|
||||
}: {
|
||||
@@ -19,9 +18,9 @@ export default function AdminAppInformation_MainView({
|
||||
<>
|
||||
<Stack h={"100%"}>
|
||||
<ComponentAdminGlobal_HeaderTamplate name="App Information" />
|
||||
<InformasiWhatApps nomorAdmin={nomorAdmin} />
|
||||
<AdminAppInformation_ViewInformasiWhatApps nomorAdmin={nomorAdmin} />
|
||||
<Space h={50} />
|
||||
<InformasiBank listBank={listBank} />
|
||||
<AdminAppInformation_ViewInfoBank listBank={listBank} />
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
5
src/app_modules/admin/app_info/view/index.tsx
Normal file
5
src/app_modules/admin/app_info/view/index.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
import AdminAppInformation_ViewInfoBank from "./view_info_bank";
|
||||
import AdminAppInformation_ViewInformasiWhatApps from "./view_info_whatsapp";
|
||||
|
||||
export { AdminAppInformation_ViewInformasiWhatApps };
|
||||
export { AdminAppInformation_ViewInfoBank };
|
||||
@@ -16,12 +16,9 @@ import {
|
||||
Text,
|
||||
TextInput,
|
||||
Title,
|
||||
Tooltip
|
||||
Tooltip,
|
||||
} from "@mantine/core";
|
||||
import {
|
||||
IconCirclePlus,
|
||||
IconEdit
|
||||
} from "@tabler/icons-react";
|
||||
import { IconCirclePlus, IconEdit } from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
import { useState } from "react";
|
||||
import { ComponentAdminGlobal_NotifikasiBerhasil } from "../../_admin_global/admin_notifikasi/notifikasi_berhasil";
|
||||
@@ -30,23 +27,29 @@ import adminAppInformation_createBank from "../fun/create/fun_create_new_bank";
|
||||
import adminAppInformation_getMasterBank from "../fun/master/get_list_bank";
|
||||
import adminAppInformation_updateStatusBankById from "../fun/update/fun_udpate_status_bank";
|
||||
import adminAppInformation_updateDataBankById from "../fun/update/fun_update_data_bank";
|
||||
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global";
|
||||
import { AdminAppInformation_ComponentTitlePageBank } from "../component";
|
||||
|
||||
export default function InformasiBank({
|
||||
export default function AdminAppInformation_ViewInfoBank({
|
||||
listBank,
|
||||
}: {
|
||||
listBank: MODEL_MASTER_BANK[];
|
||||
}) {
|
||||
const [data, setData] = useState(listBank);
|
||||
const [isCreate, setIsCreate] = useState(false);
|
||||
const [newData, setNewData] = useState({
|
||||
name: "",
|
||||
const [isLoadingCreate, setLoadingCreate] = useState(false);
|
||||
|
||||
const [newData, setNewData] = useState<any>({
|
||||
namaBank: "",
|
||||
namaAkun: "",
|
||||
norek: "",
|
||||
});
|
||||
|
||||
const [isUpdate, setIsUpdate] = useState(false);
|
||||
const [updateData, setUpdateData] = useState({
|
||||
id: "",
|
||||
name: "",
|
||||
namaBank: "",
|
||||
namaAkun: "",
|
||||
norek: "",
|
||||
});
|
||||
|
||||
@@ -56,14 +59,18 @@ export default function InformasiBank({
|
||||
active: "",
|
||||
});
|
||||
|
||||
const [checked, setChecked] = useState(false);
|
||||
|
||||
async function onCreate() {
|
||||
const create = await adminAppInformation_createBank({ data: newData });
|
||||
if (create.status === 200) {
|
||||
const loadData = await adminAppInformation_getMasterBank();
|
||||
setData(loadData);
|
||||
ComponentAdminGlobal_NotifikasiBerhasil(create.message);
|
||||
try {
|
||||
const loadData = await adminAppInformation_getMasterBank();
|
||||
setData(loadData);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
setLoadingCreate(true);
|
||||
ComponentAdminGlobal_NotifikasiBerhasil(create.message);
|
||||
}
|
||||
} else {
|
||||
ComponentAdminGlobal_NotifikasiGagal(create.message);
|
||||
}
|
||||
@@ -93,11 +100,13 @@ export default function InformasiBank({
|
||||
}) {
|
||||
const data = {
|
||||
id: id,
|
||||
active: value,
|
||||
isActive: value,
|
||||
};
|
||||
|
||||
const updt = await adminAppInformation_updateStatusBankById({
|
||||
data: data as any,
|
||||
});
|
||||
|
||||
if (updt.status === 200) {
|
||||
const loadData = await adminAppInformation_getMasterBank();
|
||||
setData(loadData);
|
||||
@@ -118,15 +127,10 @@ export default function InformasiBank({
|
||||
data.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<Center>
|
||||
<Center w={150}>
|
||||
<Text>{e?.namaBank}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>
|
||||
<Text>{e?.norek}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>
|
||||
<Switch
|
||||
@@ -144,6 +148,17 @@ export default function InformasiBank({
|
||||
/>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>
|
||||
<Text>{e?.namaAkun}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>
|
||||
<Text>{e?.norek}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<Stack align="center" justify="center">
|
||||
<ActionIcon
|
||||
@@ -154,7 +169,8 @@ export default function InformasiBank({
|
||||
setIsCreate(false);
|
||||
setUpdateData({
|
||||
id: e?.id,
|
||||
name: e?.namaBank,
|
||||
namaBank: e?.namaBank,
|
||||
namaAkun: e?.namaAkun,
|
||||
norek: e?.norek,
|
||||
});
|
||||
}}
|
||||
@@ -172,50 +188,56 @@ export default function InformasiBank({
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"xs"}>
|
||||
<Group
|
||||
position="apart"
|
||||
bg={"gray.4"}
|
||||
p={"xs"}
|
||||
style={{ borderRadius: "6px" }}
|
||||
>
|
||||
<Title order={4}>Informasi Bank</Title>
|
||||
<Button
|
||||
w={120}
|
||||
leftIcon={<IconCirclePlus />}
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
setIsCreate(true);
|
||||
setIsUpdate(false);
|
||||
}}
|
||||
>
|
||||
Tambah
|
||||
</Button>
|
||||
</Group>
|
||||
<AdminAppInformation_ComponentTitlePageBank
|
||||
onEventListener={(val: { isCreate: any; isUpdate: any }) => {
|
||||
setIsCreate(val.isCreate);
|
||||
setIsUpdate(val.isUpdate);
|
||||
}}
|
||||
/>
|
||||
{/* <ComponentAdminGlobal_TitlePage
|
||||
name="Informasi Bank"
|
||||
component={
|
||||
<Button
|
||||
w={120}
|
||||
leftIcon={<IconCirclePlus />}
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
setIsCreate(true);
|
||||
setIsUpdate(false);
|
||||
}}
|
||||
>
|
||||
Tambah
|
||||
</Button>
|
||||
}
|
||||
/> */}
|
||||
</Stack>
|
||||
|
||||
<Grid>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Grid.Col span={9}>
|
||||
<Paper p={"md"} withBorder shadow="lg" h={"50vh"}>
|
||||
<ScrollArea w={"100%"} h={"90%"} offsetScrollbars>
|
||||
<Table
|
||||
verticalSpacing={"xs"}
|
||||
horizontalSpacing={"md"}
|
||||
p={"md"}
|
||||
w={"100%"}
|
||||
w={1000}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Nama Bank</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Nomor Rekening</Center>
|
||||
<Center w={150}>Bank</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Status</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Nama Rekening</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Nomor Rekening</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
@@ -224,36 +246,39 @@ export default function InformasiBank({
|
||||
<tbody>{rowTable}</tbody>
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
{/* <Center mt={"xl"}>
|
||||
<Pagination
|
||||
total={10}
|
||||
// value={isActivePage}
|
||||
// total={isNPage}
|
||||
// onChange={(val) => {
|
||||
// onPageClick(val);
|
||||
// }}
|
||||
/>
|
||||
</Center> */}
|
||||
</Paper>
|
||||
</Grid.Col>
|
||||
|
||||
<Grid.Col span={4}>
|
||||
<Grid.Col span={3}>
|
||||
{isCreate ? (
|
||||
<Paper p={"md"} withBorder shadow="lg">
|
||||
<Stack>
|
||||
<Center>
|
||||
<Title order={5}>Tambah Daftar Bank</Title>
|
||||
</Center>
|
||||
|
||||
<TextInput
|
||||
label={"Nama Bank"}
|
||||
placeholder="Masukan nama bank"
|
||||
onChange={(val) => {
|
||||
setNewData({
|
||||
...newData,
|
||||
name: val.currentTarget.value,
|
||||
namaBank: val.currentTarget.value,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
||||
<TextInput
|
||||
label={"Nama Rekening"}
|
||||
placeholder="Masukan nama rekening"
|
||||
onChange={(val) => {
|
||||
setNewData({
|
||||
...newData,
|
||||
namaAkun: val.currentTarget.value,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
||||
<TextInput
|
||||
label={"Nomor Rekening Bank"}
|
||||
placeholder=" Masukan nomor rekening bank"
|
||||
@@ -275,6 +300,8 @@ export default function InformasiBank({
|
||||
Batal
|
||||
</Button>
|
||||
<Button
|
||||
loading={isLoadingCreate}
|
||||
loaderPosition="center"
|
||||
style={{ transition: "0.5s" }}
|
||||
disabled={_.values(newData).includes("") ? true : false}
|
||||
radius={"xl"}
|
||||
@@ -291,6 +318,7 @@ export default function InformasiBank({
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
|
||||
{isUpdate ? (
|
||||
<Paper p={"md"} withBorder shadow="lg">
|
||||
<Stack>
|
||||
@@ -300,12 +328,23 @@ export default function InformasiBank({
|
||||
<TextInput
|
||||
label={"Nama Bank"}
|
||||
placeholder="Masukan nama bank"
|
||||
value={updateData.name}
|
||||
value={updateData.namaBank}
|
||||
onChange={(val) => {
|
||||
const value = val.currentTarget.value;
|
||||
setUpdateData({ ...updateData, name: value });
|
||||
setUpdateData({ ...updateData, namaBank: value });
|
||||
}}
|
||||
/>
|
||||
|
||||
<TextInput
|
||||
label={"Nama Rekening"}
|
||||
placeholder="Masukan nama rekening"
|
||||
value={updateData.namaAkun}
|
||||
onChange={(val) => {
|
||||
const value = val.currentTarget.value;
|
||||
setUpdateData({ ...updateData, namaAkun: value });
|
||||
}}
|
||||
/>
|
||||
|
||||
<TextInput
|
||||
label={"Nomor Rekening Bank"}
|
||||
placeholder=" Masukan nomor rekening bank"
|
||||
@@ -328,7 +367,9 @@ export default function InformasiBank({
|
||||
<Button
|
||||
style={{ transition: "0.5s" }}
|
||||
disabled={
|
||||
updateData?.name === "" || updateData?.norek === ""
|
||||
updateData?.namaBank === "" ||
|
||||
updateData?.namaAkun === "" ||
|
||||
updateData?.norek === ""
|
||||
? true
|
||||
: false
|
||||
}
|
||||
@@ -338,7 +379,7 @@ export default function InformasiBank({
|
||||
onUpdate();
|
||||
}}
|
||||
>
|
||||
Simpan
|
||||
Update
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
@@ -3,12 +3,13 @@
|
||||
import {
|
||||
ActionIcon,
|
||||
Button,
|
||||
Collapse,
|
||||
Group,
|
||||
Paper,
|
||||
Stack,
|
||||
TextInput,
|
||||
Title,
|
||||
Tooltip
|
||||
Tooltip,
|
||||
} from "@mantine/core";
|
||||
import { IconEdit, IconPhone } from "@tabler/icons-react";
|
||||
import { useState } from "react";
|
||||
@@ -16,11 +17,17 @@ import { ComponentAdminGlobal_NotifikasiBerhasil } from "../../_admin_global/adm
|
||||
import { ComponentAdminGlobal_NotifikasiGagal } from "../../_admin_global/admin_notifikasi/notifikasi_gagal";
|
||||
import adminAppInformation_getNomorAdmin from "../fun/master/get_nomor_admin";
|
||||
import adminAppInformation_funUpdateNomorAdmin from "../fun/update/fun_update_nomor";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||
|
||||
export default function InformasiWhatApps({ nomorAdmin }: { nomorAdmin: any }) {
|
||||
const [disabled, setDisable] = useState(true);
|
||||
export default function AdminAppInformation_ViewInformasiWhatApps({
|
||||
nomorAdmin,
|
||||
}: {
|
||||
nomorAdmin: any;
|
||||
}) {
|
||||
const [dataNomor, setDataNomor] = useState(nomorAdmin);
|
||||
const [updateNomor, setUpdateNomor] = useState("");
|
||||
const [opened, { toggle }] = useDisclosure(false);
|
||||
|
||||
async function onUpdate() {
|
||||
const newNumber = (dataNomor.nomor = updateNomor);
|
||||
@@ -33,14 +40,10 @@ export default function InformasiWhatApps({ nomorAdmin }: { nomorAdmin: any }) {
|
||||
data: dataNomor,
|
||||
});
|
||||
if (updt.status === 200) {
|
||||
setDisable(true);
|
||||
setUpdateNomor("");
|
||||
const loadDdata = await adminAppInformation_getNomorAdmin();
|
||||
setDataNomor(loadDdata);
|
||||
if (loadDdata) {
|
||||
ComponentAdminGlobal_NotifikasiBerhasil(updt.message);
|
||||
return;
|
||||
}
|
||||
toggle();
|
||||
ComponentAdminGlobal_NotifikasiBerhasil(updt.message);
|
||||
} else {
|
||||
ComponentAdminGlobal_NotifikasiGagal(updt.message);
|
||||
}
|
||||
@@ -68,29 +71,31 @@ export default function InformasiWhatApps({ nomorAdmin }: { nomorAdmin: any }) {
|
||||
<Tooltip label={"Edit"}>
|
||||
<ActionIcon
|
||||
style={{ transition: "0.2s" }}
|
||||
variant="subtle"
|
||||
disabled={disabled ? false : true}
|
||||
variant="transparent"
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
setDisable(false);
|
||||
toggle();
|
||||
setUpdateNomor(dataNomor.nomor);
|
||||
}}
|
||||
>
|
||||
<IconEdit
|
||||
style={{ transition: "0.2s" }}
|
||||
color={disabled ? "green" : "gray"}
|
||||
style={{
|
||||
transition: "0.2s",
|
||||
}}
|
||||
color={MainColor.darkblue}
|
||||
/>
|
||||
</ActionIcon>
|
||||
</Tooltip>
|
||||
</Group>
|
||||
</Paper>
|
||||
|
||||
{disabled ? (
|
||||
""
|
||||
) : (
|
||||
<Collapse
|
||||
in={opened}
|
||||
transitionDuration={300}
|
||||
transitionTimingFunction="linear"
|
||||
>
|
||||
<Stack>
|
||||
<TextInput
|
||||
disabled={disabled ? true : false}
|
||||
type="number"
|
||||
placeholder="Update nomor admin"
|
||||
icon={<IconPhone />}
|
||||
@@ -103,18 +108,16 @@ export default function InformasiWhatApps({ nomorAdmin }: { nomorAdmin: any }) {
|
||||
<Group position="right">
|
||||
<Button
|
||||
style={{ transition: "0.2s" }}
|
||||
disabled={disabled ? true : false}
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
setDisable(true);
|
||||
setUpdateNomor("");
|
||||
toggle();
|
||||
}}
|
||||
>
|
||||
Batal
|
||||
</Button>
|
||||
<Button
|
||||
style={{ transition: "0.2s" }}
|
||||
disabled={disabled || updateNomor === "" ? true : false}
|
||||
disabled={updateNomor === "" ? true : false}
|
||||
color="green"
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
@@ -125,7 +128,7 @@ export default function InformasiWhatApps({ nomorAdmin }: { nomorAdmin: any }) {
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
)}
|
||||
</Collapse>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Stack>
|
||||
3
src/app_modules/admin/event/_ui/index.ts
Normal file
3
src/app_modules/admin/event/_ui/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { AdminEvent_UiDetailPeserta } from "./ui_detail_peserta";
|
||||
|
||||
export { AdminEvent_UiDetailPeserta };
|
||||
28
src/app_modules/admin/event/_ui/ui_detail_peserta.tsx
Normal file
28
src/app_modules/admin/event/_ui/ui_detail_peserta.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
"use client";
|
||||
|
||||
import { Stack } from "@mantine/core";
|
||||
import ComponentAdminGlobal_BackButton from "../../_admin_global/back_button";
|
||||
import { AdminEvent_ViewDetailPeserta } from "../_view";
|
||||
import { MODEL_EVENT_PESERTA } from "@/app_modules/event/model/interface";
|
||||
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global";
|
||||
|
||||
export function AdminEvent_UiDetailPeserta({
|
||||
dataPeserta,
|
||||
eventId,
|
||||
}: {
|
||||
dataPeserta: any;
|
||||
eventId: string
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_BackButton />
|
||||
<ComponentAdminGlobal_TitlePage name="Detail Peserta" />
|
||||
<AdminEvent_ViewDetailPeserta
|
||||
dataPeserta={dataPeserta as any}
|
||||
eventId={eventId}
|
||||
/>
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
3
src/app_modules/admin/event/_view/index.ts
Normal file
3
src/app_modules/admin/event/_view/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { AdminEvent_ViewDetailPeserta } from "./view_detail_peserta";
|
||||
|
||||
export { AdminEvent_ViewDetailPeserta };
|
||||
112
src/app_modules/admin/event/_view/view_detail_peserta.tsx
Normal file
112
src/app_modules/admin/event/_view/view_detail_peserta.tsx
Normal file
@@ -0,0 +1,112 @@
|
||||
"use client";
|
||||
|
||||
import { MODEL_EVENT_PESERTA } from "@/app_modules/event/model/interface";
|
||||
import {
|
||||
Button,
|
||||
Center,
|
||||
Pagination,
|
||||
Paper,
|
||||
ScrollArea,
|
||||
Stack,
|
||||
Table,
|
||||
} from "@mantine/core";
|
||||
import { useState } from "react";
|
||||
import { adminEvent_getListPesertaById } from "../fun";
|
||||
import _ from "lodash";
|
||||
import ComponentAdminGlobal_IsEmptyData from "../../_admin_global/is_empty_data";
|
||||
|
||||
export function AdminEvent_ViewDetailPeserta({
|
||||
dataPeserta,
|
||||
eventId,
|
||||
}: {
|
||||
dataPeserta: any;
|
||||
eventId: string;
|
||||
}) {
|
||||
const [data, setData] = useState<MODEL_EVENT_PESERTA[]>(dataPeserta.data);
|
||||
const [isNPage, setNPage] = useState(dataPeserta.nPage);
|
||||
const [isActivePage, setActivePage] = useState(1);
|
||||
|
||||
async function onPageClick(p: any) {
|
||||
setActivePage(p);
|
||||
const loadData = await adminEvent_getListPesertaById({
|
||||
eventId: eventId,
|
||||
page: p,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
const tableRow = _.isEmpty(data)
|
||||
? []
|
||||
: data.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<Center>{e?.User?.username}</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>{e?.User?.Profile?.name}</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>+{e?.User?.nomor}</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>{e?.User?.Profile?.email}</Center>
|
||||
</td>
|
||||
</tr>
|
||||
));
|
||||
|
||||
return (
|
||||
<>
|
||||
<Paper p={"md"} withBorder shadow="lg" h={"75vh"}>
|
||||
<ScrollArea w={"100%"} h={"90%"}>
|
||||
<Table
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"md"}
|
||||
p={"md"}
|
||||
w={"100%"}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Username</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Name</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Nomor</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Email</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{tableRow}</tbody>
|
||||
</Table>
|
||||
{_.isEmpty(data) ? (
|
||||
<ComponentAdminGlobal_IsEmptyData
|
||||
text="Tidak ada peserta"
|
||||
marginTop={100}
|
||||
/>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</ScrollArea>
|
||||
|
||||
<Center mt={"xl"}>
|
||||
<Pagination
|
||||
value={isActivePage}
|
||||
total={isNPage}
|
||||
onChange={(val) => {
|
||||
onPageClick(val);
|
||||
}}
|
||||
/>
|
||||
</Center>
|
||||
</Paper>
|
||||
|
||||
{/* <pre>{JSON.stringify(dataPeserta, null, 2)}</pre> */}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,36 +1,36 @@
|
||||
"use client";
|
||||
|
||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import {
|
||||
MODEL_EVENT,
|
||||
MODEL_EVENT_PESERTA,
|
||||
} from "@/app_modules/event/model/interface";
|
||||
import {
|
||||
Avatar,
|
||||
Box,
|
||||
Button,
|
||||
Center,
|
||||
Divider,
|
||||
Grid,
|
||||
Group,
|
||||
Loader,
|
||||
Modal,
|
||||
Pagination,
|
||||
Paper,
|
||||
SimpleGrid,
|
||||
ScrollArea,
|
||||
Spoiler,
|
||||
Stack,
|
||||
Table,
|
||||
Text,
|
||||
TextInput,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||
import {
|
||||
MODEL_EVENT,
|
||||
MODEL_EVENT_PESERTA,
|
||||
} from "@/app_modules/event/model/interface";
|
||||
import { data } from "autoprefixer";
|
||||
import _ from "lodash";
|
||||
import moment from "moment";
|
||||
import { IconEyeShare } from "@tabler/icons-react";
|
||||
import { useDisclosure, useShallowEffect } from "@mantine/hooks";
|
||||
import { IconCircleCheck, IconSearch } from "@tabler/icons-react";
|
||||
import { useState } from "react";
|
||||
import { AdminEvent_getListPesertaById } from "../fun/get/get_list_peserta_by_id";
|
||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||
import { adminEvent_funGetListAllRiwayat } from "../fun";
|
||||
import { adminEvent_getListPesertaById } from "../fun/get/get_list_peserta_by_id";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
|
||||
|
||||
export default function AdminEvent_Riwayat({
|
||||
listRiwayat,
|
||||
@@ -47,68 +47,192 @@ export default function AdminEvent_Riwayat({
|
||||
);
|
||||
}
|
||||
|
||||
function DetailRiwayat({ listRiwayat }: { listRiwayat: MODEL_EVENT[] }) {
|
||||
const [opened, setOpen] = useState(false);
|
||||
function DetailRiwayat({ listRiwayat }: { listRiwayat: any }) {
|
||||
const router = useRouter();
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
const [peserta, setPeserta] = useState<MODEL_EVENT_PESERTA[]>();
|
||||
const [eventId, setEventId] = useState("");
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const TableRows = listRiwayat.map((e, i) => (
|
||||
<tr key={e.id}>
|
||||
const [data, setData] = useState<MODEL_EVENT[]>(listRiwayat.data);
|
||||
const [isNPage, setNPage] = useState(listRiwayat.nPage);
|
||||
const [isActivePage, setActivePage] = useState(1);
|
||||
const [isSearch, setSearch] = useState("");
|
||||
|
||||
async function onSearch(s: string) {
|
||||
setSearch(s);
|
||||
const loadData = await adminEvent_funGetListAllRiwayat({
|
||||
page: 1,
|
||||
search: s,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
async function onPageClick(p: any) {
|
||||
setActivePage(p);
|
||||
const loadData = await adminEvent_funGetListAllRiwayat({
|
||||
search: isSearch,
|
||||
page: p,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
const TableRows = data.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<Button
|
||||
loading={e.id === eventId ? (loading === true ? true : false) : false}
|
||||
loading={e.id === eventId && loading ? true : false}
|
||||
color={"green"}
|
||||
leftIcon={<IconEyeShare />}
|
||||
leftIcon={<IconCircleCheck />}
|
||||
radius={"xl"}
|
||||
onClick={async () => {
|
||||
setEventId(e.id);
|
||||
setLoading(true);
|
||||
await new Promise((r) => setTimeout(r, 500));
|
||||
await AdminEvent_getListPesertaById(e.id).then((res: any) => {
|
||||
setLoading(false);
|
||||
setPeserta(res);
|
||||
});
|
||||
setOpen(true);
|
||||
onClick={() => {
|
||||
router.push(RouterAdminEvent.detail_peserta + e.id);
|
||||
// setEventId(e.id);
|
||||
// setLoading(true);
|
||||
// await new Promise((v) => setTimeout(v, 500));
|
||||
// await AdminEvent_getListPesertaById(e.id).then((res: any) => {
|
||||
// setPeserta(res);
|
||||
// setLoading(false);
|
||||
// });
|
||||
// open();
|
||||
}}
|
||||
>
|
||||
Peserta
|
||||
Lihat Peserta
|
||||
</Button>
|
||||
</td>
|
||||
<td>{e?.Author?.Profile?.name}</td>
|
||||
<td>{e?.title}</td>
|
||||
<td>{e?.lokasi}</td>
|
||||
<td>{e?.EventMaster_TipeAcara?.name}</td>
|
||||
<td>{e?.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}</td>
|
||||
|
||||
<td>
|
||||
{e.tanggal.toLocaleTimeString([], {
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
})}
|
||||
<Center w={200}>
|
||||
<Text>{e?.Author?.username}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
||||
{e.deskripsi}
|
||||
</Spoiler>
|
||||
<Center w={200}>
|
||||
<Text lineClamp={2}>{e.title}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Text>{e.lokasi}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Text>{e.EventMaster_TipeAcara.name}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
{e.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
{e.tanggal.toLocaleTimeString([], {
|
||||
timeStyle: "short",
|
||||
hourCycle: "h24",
|
||||
})}
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={400}>
|
||||
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
||||
{e.deskripsi}
|
||||
</Spoiler>
|
||||
</Center>
|
||||
</td>
|
||||
</tr>
|
||||
));
|
||||
|
||||
useShallowEffect(() => {
|
||||
getAllPeserta(eventId);
|
||||
}, [eventId]);
|
||||
// useShallowEffect(() => {
|
||||
// getAllPeserta(eventId);
|
||||
// }, [eventId]);
|
||||
|
||||
async function getAllPeserta(eventId: string) {
|
||||
await AdminEvent_getListPesertaById(eventId).then((res: any) =>
|
||||
setPeserta(res)
|
||||
);
|
||||
}
|
||||
// async function getAllPeserta(eventId: string) {
|
||||
// await adminEvent_getListPesertaById(eventId).then((res: any) =>
|
||||
// setPeserta(res)
|
||||
// );
|
||||
// }
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"xs"} h={"100%"}>
|
||||
<Group
|
||||
position="apart"
|
||||
bg={"gray.4"}
|
||||
p={"xs"}
|
||||
style={{ borderRadius: "6px" }}
|
||||
>
|
||||
<Title order={4}>Riwayat</Title>
|
||||
<TextInput
|
||||
icon={<IconSearch size={20} />}
|
||||
radius={"xl"}
|
||||
placeholder="Masukan judul"
|
||||
onChange={(val) => {
|
||||
onSearch(val.currentTarget.value);
|
||||
}}
|
||||
/>
|
||||
</Group>
|
||||
|
||||
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||
<ScrollArea w={"100%"} h={"90%"}>
|
||||
<Table
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"md"}
|
||||
p={"md"}
|
||||
w={"100%"}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Username</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Judul</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Lokasi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Tipe Acara</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Tanggal</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Jam</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Deskripsi</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{TableRows}</tbody>
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
|
||||
<Center mt={"xl"}>
|
||||
<Pagination
|
||||
value={isActivePage}
|
||||
total={isNPage}
|
||||
onChange={(val) => {
|
||||
onPageClick(val);
|
||||
}}
|
||||
/>
|
||||
</Center>
|
||||
</Paper>
|
||||
</Stack>
|
||||
|
||||
<Modal
|
||||
opened={opened}
|
||||
onClose={() => setOpen(false)}
|
||||
onClose={close}
|
||||
size={"md"}
|
||||
// closeOnClickOutside={false}
|
||||
withCloseButton={false}
|
||||
@@ -145,55 +269,6 @@ function DetailRiwayat({ listRiwayat }: { listRiwayat: MODEL_EVENT[] }) {
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Modal>
|
||||
|
||||
<Box>
|
||||
<Box bg={"gray.1"} p={"xs"}>
|
||||
<Title order={6} c={"gray"}>
|
||||
RIWAYAT
|
||||
</Title>
|
||||
</Box>
|
||||
<Table
|
||||
withBorder
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"xl"}
|
||||
p={"md"}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Author</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Judul</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Lokasi</Center>
|
||||
</th>
|
||||
<th>Tipe Acara</th>
|
||||
<th>Tanggal</th>
|
||||
<th>Jam</th>
|
||||
<th>
|
||||
<Center>Deskripsi</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{TableRows}</tbody>
|
||||
</Table>
|
||||
<Center>
|
||||
{_.isEmpty(TableRows) ? (
|
||||
<Center h={"50vh"}>
|
||||
<Title order={6}>Tidak Ada Data</Title>
|
||||
</Center>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</Center>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
"use client";
|
||||
|
||||
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 { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/interface";
|
||||
import {
|
||||
ActionIcon,
|
||||
Box,
|
||||
Button,
|
||||
Divider,
|
||||
Group,
|
||||
List,
|
||||
Modal,
|
||||
Paper,
|
||||
SimpleGrid,
|
||||
@@ -15,20 +17,14 @@ import {
|
||||
TextInput,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import ComponentAdminDonasi_TombolKembali from "../../donasi/component/tombol_kembali";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||
import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/interface";
|
||||
import { useState } from "react";
|
||||
import { AdminEvent_funCreateTipeAcara } from "../fun/create/fun_create_tipe_acara";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
import { AdminEvent_getListTipeAcara } from "../fun/get/get_list_tipe_acara";
|
||||
import { IconEditCircle, IconTrash } from "@tabler/icons-react";
|
||||
import { AdminEvent_funEditTipeAcara } from "../fun/edit/fun_edit_tipe_acara";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import { IconCirclePlus, IconEditCircle, IconTrash } from "@tabler/icons-react";
|
||||
import { useState } from "react";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||
import { AdminEvent_funCreateTipeAcara } from "../fun/create/fun_create_tipe_acara";
|
||||
import { AdminEvent_funEditActivationTipeAcaraById } from "../fun/edit/fun_edit_activation_tipe_acara";
|
||||
import { number } from "echarts";
|
||||
import { AdminEvent_funEditTipeAcara } from "../fun/edit/fun_edit_tipe_acara";
|
||||
import { AdminEvent_getListTipeAcara } from "../fun/get/get_list_tipe_acara";
|
||||
|
||||
export default function AdminEvent_DetailTipeAcara({
|
||||
listTipe,
|
||||
@@ -38,14 +34,19 @@ export default function AdminEvent_DetailTipeAcara({
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Event: Tipe Acara" />
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Event" />
|
||||
|
||||
<DetailTipeAcara listTipe={listTipe} />
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function DetailTipeAcara({ listTipe }: { listTipe: MODEL_DEFAULT_MASTER_OLD[] }) {
|
||||
function DetailTipeAcara({
|
||||
listTipe,
|
||||
}: {
|
||||
listTipe: MODEL_DEFAULT_MASTER_OLD[];
|
||||
}) {
|
||||
const [tipe, setTipe] = useState(listTipe);
|
||||
const [name, setName] = useState("");
|
||||
const [openEditor, setOpenEditor] = useState(false);
|
||||
@@ -55,6 +56,7 @@ function DetailTipeAcara({ listTipe }: { listTipe: MODEL_DEFAULT_MASTER_OLD[] })
|
||||
id: "",
|
||||
name: "",
|
||||
});
|
||||
const [openCreate, setOpenCreate] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -79,8 +81,28 @@ function DetailTipeAcara({ listTipe }: { listTipe: MODEL_DEFAULT_MASTER_OLD[] })
|
||||
</Stack>
|
||||
</Modal>
|
||||
|
||||
<Group
|
||||
position="apart"
|
||||
bg={"gray.4"}
|
||||
p={"xs"}
|
||||
style={{ borderRadius: "6px" }}
|
||||
>
|
||||
<Title order={4}>Tipe Acara</Title>
|
||||
<Button
|
||||
leftIcon={<IconCirclePlus />}
|
||||
radius={"xl"}
|
||||
color="green"
|
||||
onClick={() => {
|
||||
setOpenCreate(true);
|
||||
setOpenEditor(false);
|
||||
}}
|
||||
>
|
||||
Tambah
|
||||
</Button>
|
||||
</Group>
|
||||
|
||||
<SimpleGrid
|
||||
cols={3}
|
||||
cols={2}
|
||||
spacing="lg"
|
||||
breakpoints={[
|
||||
{ maxWidth: "62rem", cols: 4, spacing: "lg" },
|
||||
@@ -88,26 +110,6 @@ function DetailTipeAcara({ listTipe }: { listTipe: MODEL_DEFAULT_MASTER_OLD[] })
|
||||
{ maxWidth: "36rem", cols: 1, spacing: "sm" },
|
||||
]}
|
||||
>
|
||||
<div>
|
||||
<Paper p={"sm"} shadow="lg" withBorder>
|
||||
<Stack>
|
||||
<TextInput
|
||||
value={name ? name : ""}
|
||||
label="Masukan Tipe"
|
||||
placeholder="Contoh: Seminar, Workshop, dll."
|
||||
onChange={(val) => {
|
||||
setName(val.target.value);
|
||||
}}
|
||||
/>
|
||||
<Group position="right">
|
||||
<Button onClick={() => onSave(name, setName, setTipe)}>
|
||||
Tambah
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Paper p={"md"} shadow="lg" withBorder>
|
||||
<Stack>
|
||||
@@ -122,6 +124,7 @@ function DetailTipeAcara({ listTipe }: { listTipe: MODEL_DEFAULT_MASTER_OLD[] })
|
||||
variant="transparent"
|
||||
onClick={() => {
|
||||
setOpenEditor(true);
|
||||
setOpenCreate(false);
|
||||
setEdit(e);
|
||||
}}
|
||||
>
|
||||
@@ -150,27 +153,67 @@ function DetailTipeAcara({ listTipe }: { listTipe: MODEL_DEFAULT_MASTER_OLD[] })
|
||||
</Paper>
|
||||
</div>
|
||||
|
||||
{openCreate ? (
|
||||
<div>
|
||||
<Paper p={"sm"} shadow="lg" withBorder>
|
||||
<Stack>
|
||||
<TextInput
|
||||
value={name ? name : ""}
|
||||
label="Masukan Tipe"
|
||||
placeholder="Contoh: Seminar, Workshop, dll."
|
||||
onChange={(val) => {
|
||||
setName(val.currentTarget.value);
|
||||
}}
|
||||
/>
|
||||
<Group position="right">
|
||||
<Button radius={"xl"} onClick={() => setOpenCreate(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
<Button
|
||||
disabled={!name}
|
||||
style={{
|
||||
transition: "all 0.5s ease",
|
||||
}}
|
||||
color="green"
|
||||
radius={"xl"}
|
||||
onClick={() => onSave(name, setName, setTipe)}
|
||||
>
|
||||
Simpan
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</div>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
|
||||
<div>
|
||||
{openEditor ? (
|
||||
<Paper p={"sm"} shadow="lg" withBorder>
|
||||
<Stack>
|
||||
<TextInput
|
||||
value={edit?.name ? edit?.name : ""}
|
||||
label="Edit Tipe Event"
|
||||
label="Edit Tipe"
|
||||
placeholder="Contoh: Ramah Tamah, dll"
|
||||
onChange={(val) => {
|
||||
setEdit({
|
||||
...(edit as any),
|
||||
name: val.target.value,
|
||||
namaBank: val.target.value,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<Group position="right">
|
||||
<Group position="apart">
|
||||
<Button color="red" onClick={() => setOpenEditor(false)}>
|
||||
<Button radius={"xl"} onClick={() => setOpenEditor(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
<Button
|
||||
disabled={!edit?.name}
|
||||
style={{
|
||||
transition: "all 0.5s ease",
|
||||
}}
|
||||
radius={"xl"}
|
||||
color="green"
|
||||
onClick={() =>
|
||||
onUpdate(edit?.id, edit?.name, setTipe, setOpenEditor)
|
||||
@@ -222,7 +265,11 @@ async function onUpdate(id: any, edit: any, setTipe: any, setOpenEditor: any) {
|
||||
});
|
||||
}
|
||||
|
||||
async function onDelete(data: MODEL_DEFAULT_MASTER_OLD, close: any, setTipe: any) {
|
||||
async function onDelete(
|
||||
data: MODEL_DEFAULT_MASTER_OLD,
|
||||
close: any,
|
||||
setTipe: any
|
||||
) {
|
||||
await AdminEvent_funEditActivationTipeAcaraById(data.id as any).then(
|
||||
async (res) => {
|
||||
if (res.status === 200) {
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import _ from "lodash";
|
||||
import _, { ceil } from "lodash";
|
||||
|
||||
export async function adminEvent_funGetListAllRiwayat({
|
||||
page,
|
||||
search,
|
||||
}: {
|
||||
page: number;
|
||||
search?: string;
|
||||
}) {
|
||||
let takeData = 10;
|
||||
let skipData = page * takeData - takeData;
|
||||
|
||||
export async function AdminEvent_getListAllRiwayat() {
|
||||
const data = await prisma.event.findMany({
|
||||
skip: skipData,
|
||||
take: takeData,
|
||||
orderBy: {
|
||||
tanggal: "desc",
|
||||
},
|
||||
@@ -13,33 +24,45 @@ export async function AdminEvent_getListAllRiwayat() {
|
||||
tanggal: {
|
||||
lte: new Date(),
|
||||
},
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
lokasi: true,
|
||||
tanggal: true,
|
||||
deskripsi: true,
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
include: {
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
EventMaster_TipeAcara: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
EventMaster_Status: true,
|
||||
EventMaster_TipeAcara: true,
|
||||
},
|
||||
});
|
||||
|
||||
return data;
|
||||
const nCount = await prisma.event.count({
|
||||
where: {
|
||||
eventMaster_StatusId: "1",
|
||||
tanggal: {
|
||||
lte: new Date(),
|
||||
},
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const allData = {
|
||||
data: data,
|
||||
nPage: ceil(nCount / takeData),
|
||||
};
|
||||
|
||||
return allData;
|
||||
}
|
||||
|
||||
@@ -1,21 +1,45 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { ceil } from "lodash";
|
||||
|
||||
export async function adminEvent_getListPesertaById({
|
||||
eventId,
|
||||
page,
|
||||
search,
|
||||
}: {
|
||||
eventId: string;
|
||||
page: number;
|
||||
search?: string;
|
||||
}) {
|
||||
let takeData = 10;
|
||||
let skipData = page * takeData - takeData;
|
||||
|
||||
export async function AdminEvent_getListPesertaById(eventId: string) {
|
||||
const data = await prisma.event_Peserta.findMany({
|
||||
skip: skipData,
|
||||
take: takeData,
|
||||
where: {
|
||||
eventId: eventId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
User: {
|
||||
select: {
|
||||
include: {
|
||||
Profile: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return data;
|
||||
const nCount = await prisma.event_Peserta.count({
|
||||
where: {
|
||||
eventId: eventId,
|
||||
},
|
||||
});
|
||||
|
||||
const allData = {
|
||||
data: data,
|
||||
nPage: ceil(nCount / takeData),
|
||||
};
|
||||
|
||||
return allData;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { ceil } from "lodash";
|
||||
|
||||
export async function adminEvent_funGetListPublish({
|
||||
page,
|
||||
search,
|
||||
}: {
|
||||
page: number;
|
||||
search?: string;
|
||||
}) {
|
||||
let takeData = 10;
|
||||
let skipData = page * takeData - takeData;
|
||||
|
||||
const data = await prisma.event.findMany({
|
||||
skip: skipData,
|
||||
take: takeData,
|
||||
orderBy: {
|
||||
tanggal: "desc",
|
||||
},
|
||||
where: {
|
||||
eventMaster_StatusId: "1",
|
||||
tanggal: {
|
||||
gte: new Date(),
|
||||
},
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
include: {
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
EventMaster_Status: true,
|
||||
EventMaster_TipeAcara: true,
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.event.count({
|
||||
where: {
|
||||
eventMaster_StatusId: "1",
|
||||
tanggal: {
|
||||
gte: new Date(),
|
||||
},
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const allData = {
|
||||
data: data,
|
||||
nPage: ceil(nCount / takeData),
|
||||
};
|
||||
|
||||
return allData;
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { ceil } from "lodash";
|
||||
|
||||
export async function adminEvent_funGetListReject({
|
||||
page,
|
||||
search,
|
||||
}: {
|
||||
page: number;
|
||||
search?: string;
|
||||
}) {
|
||||
let takeData = 10;
|
||||
let skipData = page * takeData - takeData;
|
||||
|
||||
const data = await prisma.event.findMany({
|
||||
skip: skipData,
|
||||
take: takeData,
|
||||
orderBy: {
|
||||
updatedAt: "desc",
|
||||
},
|
||||
where: {
|
||||
eventMaster_StatusId: "4",
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
include: {
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
EventMaster_Status: true,
|
||||
EventMaster_TipeAcara: true,
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.event.count({
|
||||
orderBy: {
|
||||
tanggal: "desc",
|
||||
},
|
||||
where: {
|
||||
eventMaster_StatusId: "4",
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const allData = {
|
||||
data: data,
|
||||
nPage: ceil(nCount / takeData),
|
||||
};
|
||||
|
||||
return allData;
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { ceil } from "lodash";
|
||||
|
||||
export async function adminEvent_funGetListReview({
|
||||
page,
|
||||
search,
|
||||
}: {
|
||||
page: number;
|
||||
search?: string;
|
||||
}) {
|
||||
let takeData = 10;
|
||||
let skipData = page * takeData - takeData;
|
||||
|
||||
const data = await prisma.event.findMany({
|
||||
skip: skipData,
|
||||
take: takeData,
|
||||
orderBy: {
|
||||
tanggal: "desc",
|
||||
},
|
||||
where: {
|
||||
eventMaster_StatusId: "2",
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
include: {
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
EventMaster_Status: true,
|
||||
EventMaster_TipeAcara: true,
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.event.count({
|
||||
orderBy: {
|
||||
tanggal: "desc",
|
||||
},
|
||||
where: {
|
||||
eventMaster_StatusId: "2",
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const allData = {
|
||||
data: data,
|
||||
nPage: ceil(nCount / takeData),
|
||||
};
|
||||
|
||||
return allData;
|
||||
}
|
||||
11
src/app_modules/admin/event/fun/index.ts
Normal file
11
src/app_modules/admin/event/fun/index.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { adminEvent_funGetListAllRiwayat } from "./get/get_list_all_riwayat";
|
||||
import { adminEvent_getListPesertaById } from "./get/get_list_peserta_by_id";
|
||||
import { adminEvent_funGetListPublish } from "./get/status/fun_get_list_publish";
|
||||
import { adminEvent_funGetListReject } from "./get/status/fun_get_list_reject";
|
||||
import { adminEvent_funGetListReview } from "./get/status/fun_get_list_review";
|
||||
|
||||
export { adminEvent_funGetListReview };
|
||||
export { adminEvent_funGetListReject };
|
||||
export { adminEvent_funGetListPublish };
|
||||
export { adminEvent_funGetListAllRiwayat };
|
||||
export { adminEvent_getListPesertaById };
|
||||
@@ -1,8 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||
import {
|
||||
ActionIcon,
|
||||
Avatar,
|
||||
Box,
|
||||
Button,
|
||||
@@ -11,99 +9,137 @@ import {
|
||||
Grid,
|
||||
Group,
|
||||
Modal,
|
||||
Pagination,
|
||||
Paper,
|
||||
ScrollArea,
|
||||
Spoiler,
|
||||
Stack,
|
||||
Table,
|
||||
Text,
|
||||
TextInput,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import {
|
||||
IconBan,
|
||||
IconChevronLeft,
|
||||
IconEyeCheck,
|
||||
IconEyeShare,
|
||||
IconShare,
|
||||
} from "@tabler/icons-react";
|
||||
import { IconCircleCheck, IconEyeShare, IconSearch } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
|
||||
import { useState } from "react";
|
||||
import TampilanRupiahDonasi from "@/app_modules/donasi/component/tampilan_rupiah";
|
||||
import ComponentAdminDonasi_TombolKembali from "../../donasi/component/tombol_kembali";
|
||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import {
|
||||
MODEL_EVENT,
|
||||
MODEL_EVENT_PESERTA,
|
||||
} from "@/app_modules/event/model/interface";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||
import moment from "moment";
|
||||
import _ from "lodash";
|
||||
import { AdminEvent_funEditStatusPublishById } from "../fun/edit/fun_edit_status_publish_by_id";
|
||||
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { AdminEvent_getListTableByStatusId } from "../fun/get/get_list_table_by_status_id";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import { AdminEvent_getListPesertaById } from "../fun/get/get_list_peserta_by_id";
|
||||
import { useState } from "react";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||
import { adminEvent_getListPesertaById } from "../fun/get/get_list_peserta_by_id";
|
||||
import { adminEvent_funGetListPublish } from "../fun";
|
||||
import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
|
||||
|
||||
export default function AdminEvent_TablePublish({
|
||||
listPublish,
|
||||
}: {
|
||||
listPublish: MODEL_EVENT[];
|
||||
listPublish: any;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Event: Table Publish" />
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Event" />
|
||||
<TableStatus listPublish={listPublish} />
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function TableStatus({ listPublish }: { listPublish: MODEL_EVENT[] }) {
|
||||
function TableStatus({ listPublish }: { listPublish: any }) {
|
||||
const router = useRouter();
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
const [data, setData] = useState(listPublish);
|
||||
const [data, setData] = useState<MODEL_EVENT[]>(listPublish.data);
|
||||
const [isNPage, setNPage] = useState(listPublish.nPage);
|
||||
const [isActivePage, setActivePage] = useState(1);
|
||||
const [isSearch, setSearch] = useState("");
|
||||
|
||||
const [peserta, setPeserta] = useState<MODEL_EVENT_PESERTA[]>();
|
||||
const [eventId, setEventId] = useState("");
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
async function onSearch(s: string) {
|
||||
setSearch(s);
|
||||
const loadData = await adminEvent_funGetListPublish({
|
||||
page: 1,
|
||||
search: s,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
async function onPageClick(p: any) {
|
||||
setActivePage(p);
|
||||
const loadData = await adminEvent_funGetListPublish({
|
||||
search: isSearch,
|
||||
page: p,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
const TableRows = data.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>{e?.Author?.Profile?.name}</td>
|
||||
<td>{e?.title}</td>
|
||||
<td>{e?.lokasi}</td>
|
||||
<td>{e?.EventMaster_TipeAcara?.name}</td>
|
||||
<td>{e?.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}</td>
|
||||
<td>
|
||||
{e.tanggal.toLocaleTimeString([], {
|
||||
timeStyle: "short",
|
||||
hourCycle: "h24",
|
||||
})}
|
||||
<Center w={200}>
|
||||
<Text>{e?.Author?.username}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
||||
{e.deskripsi}
|
||||
</Spoiler>
|
||||
<Center w={200}>
|
||||
<Text lineClamp={2}>{e.title}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Text>{e.lokasi}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Text>{e.EventMaster_TipeAcara.name}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
{e.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
{e.tanggal.toLocaleTimeString([], {
|
||||
timeStyle: "short",
|
||||
hourCycle: "h24",
|
||||
})}
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={400}>
|
||||
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
||||
{e.deskripsi}
|
||||
</Spoiler>
|
||||
</Center>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<Button
|
||||
loading={e.id === eventId ? (loading === true ? true : false) : false}
|
||||
color={"green"}
|
||||
leftIcon={<IconEyeShare />}
|
||||
leftIcon={<IconCircleCheck />}
|
||||
radius={"xl"}
|
||||
onClick={async () => {
|
||||
setEventId(e.id);
|
||||
setLoading(true);
|
||||
await new Promise((v) => setTimeout(v, 500));
|
||||
await AdminEvent_getListPesertaById(e.id).then((res: any) => {
|
||||
setPeserta(res);
|
||||
setLoading(false);
|
||||
});
|
||||
open();
|
||||
router.push(RouterAdminEvent.detail_peserta + e.id);
|
||||
// setEventId(e.id);
|
||||
// setLoading(true);
|
||||
// await new Promise((v) => setTimeout(v, 500));
|
||||
// await adminEvent_getListPesertaById(e.id).then((res: any) => {
|
||||
// setPeserta(res);
|
||||
// setLoading(false);
|
||||
// });
|
||||
// open();
|
||||
}}
|
||||
>
|
||||
Lihat Peserta
|
||||
@@ -114,6 +150,78 @@ function TableStatus({ listPublish }: { listPublish: MODEL_EVENT[] }) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"xs"} h={"100%"}>
|
||||
<Group
|
||||
position="apart"
|
||||
bg={"green.4"}
|
||||
p={"xs"}
|
||||
style={{ borderRadius: "6px" }}
|
||||
>
|
||||
<Title order={4}>Publish</Title>
|
||||
<TextInput
|
||||
icon={<IconSearch size={20} />}
|
||||
radius={"xl"}
|
||||
placeholder="Masukan judul"
|
||||
onChange={(val) => {
|
||||
onSearch(val.currentTarget.value);
|
||||
}}
|
||||
/>
|
||||
</Group>
|
||||
|
||||
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||
<ScrollArea w={"100%"} h={"90%"}>
|
||||
<Table
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"md"}
|
||||
p={"md"}
|
||||
w={1500}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Username</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Judul</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Lokasi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Tipe Acara</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Tanggal</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Jam</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Deskripsi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{TableRows}</tbody>
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
|
||||
<Center mt={"xl"}>
|
||||
<Pagination
|
||||
value={isActivePage}
|
||||
total={isNPage}
|
||||
onChange={(val) => {
|
||||
onPageClick(val);
|
||||
}}
|
||||
/>
|
||||
</Center>
|
||||
</Paper>
|
||||
</Stack>
|
||||
|
||||
<Modal opened={opened} onClose={close}>
|
||||
<Paper>
|
||||
<Stack>
|
||||
@@ -153,49 +261,6 @@ function TableStatus({ listPublish }: { listPublish: MODEL_EVENT[] }) {
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Modal>
|
||||
<Box>
|
||||
<Box bg={"green.1"} p={"xs"}>
|
||||
<Title order={6} c={"green"}>
|
||||
PUBLISH
|
||||
</Title>
|
||||
</Box>
|
||||
<Table
|
||||
withBorder
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"xl"}
|
||||
p={"md"}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Author</th>
|
||||
<th>Judul</th>
|
||||
<th>Lokasi</th>
|
||||
<th>Tipe Acara</th>
|
||||
<th>Tanggal</th>
|
||||
<th>Jam</th>
|
||||
<th>
|
||||
<Center>Deskripsi</Center>
|
||||
</th>
|
||||
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{TableRows}</tbody>
|
||||
</Table>
|
||||
<Center>
|
||||
{_.isEmpty(TableRows) ? (
|
||||
<Center h={"50vh"}>
|
||||
<Title order={6}>Tidak Ada Data</Title>
|
||||
</Center>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</Center>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,112 +1,138 @@
|
||||
"use client";
|
||||
|
||||
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||
import {
|
||||
ActionIcon,
|
||||
Box,
|
||||
Button,
|
||||
Center,
|
||||
Flex,
|
||||
Group,
|
||||
Modal,
|
||||
Pagination,
|
||||
Paper,
|
||||
ScrollArea,
|
||||
Spoiler,
|
||||
Stack,
|
||||
Table,
|
||||
Text,
|
||||
Textarea,
|
||||
TextInput,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import {
|
||||
IconBan,
|
||||
IconChevronLeft,
|
||||
IconEyeCheck,
|
||||
IconEyeShare,
|
||||
IconPencilPlus,
|
||||
IconShare,
|
||||
} from "@tabler/icons-react";
|
||||
import { IconPencilPlus, IconSearch } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
|
||||
import { useState } from "react";
|
||||
import TampilanRupiahDonasi from "@/app_modules/donasi/component/tampilan_rupiah";
|
||||
import ComponentAdminDonasi_TombolKembali from "../../donasi/component/tombol_kembali";
|
||||
import { MODEL_EVENT } from "@/app_modules/event/model/interface";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||
import moment from "moment";
|
||||
import _ from "lodash";
|
||||
import { AdminEvent_funEditStatusPublishById } from "../fun/edit/fun_edit_status_publish_by_id";
|
||||
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { AdminEvent_getListTableByStatusId } from "../fun/get/get_list_table_by_status_id";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
import { MODEL_EVENT } from "@/app_modules/event/model/interface";
|
||||
import { useState } from "react";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||
import { adminEvent_funGetListReject } from "../fun";
|
||||
import { AdminEvent_funEditCatatanById } from "../fun/edit/fun_edit_status_reject_by_id";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
|
||||
export default function AdminEvent_TableReject({
|
||||
listReject,
|
||||
}: {
|
||||
listReject: MODEL_EVENT[];
|
||||
listReject: any;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Event: Table Reject" />
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Event" />
|
||||
<TableStatus listReject={listReject} />
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function TableStatus({ listReject }: { listReject: MODEL_EVENT[] }) {
|
||||
function TableStatus({ listReject }: { listReject: any }) {
|
||||
const router = useRouter();
|
||||
const [data, setData] = useState<MODEL_EVENT[]>(listReject.data);
|
||||
const [isNPage, setNPage] = useState(listReject.nPage);
|
||||
const [isActivePage, setActivePage] = useState(1);
|
||||
const [isSearch, setSearch] = useState("");
|
||||
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
const [data, setData] = useState(listReject);
|
||||
const [eventId, setEventId] = useState("");
|
||||
const [catatan, setCatatan] = useState("");
|
||||
|
||||
async function onSearch(s: string) {
|
||||
setSearch(s);
|
||||
const loadData = await adminEvent_funGetListReject({
|
||||
page: 1,
|
||||
search: s,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
async function onPageClick(p: any) {
|
||||
setActivePage(p);
|
||||
const loadData = await adminEvent_funGetListReject({
|
||||
search: isSearch,
|
||||
page: p,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
async function onUpdate(eventId: string, catatan: string) {
|
||||
const body = {
|
||||
id: eventId,
|
||||
catatan: catatan,
|
||||
};
|
||||
const res = await AdminEvent_funEditCatatanById(body as any, "4");
|
||||
if (res.status === 200) {
|
||||
const loadData = await adminEvent_funGetListReject({
|
||||
search: isSearch,
|
||||
page: isActivePage,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
close();
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
const TableRows = data.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<Box w={200}>{e?.Author?.Profile?.name}</Box>
|
||||
<Center w={200}>{e?.Author?.username}</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Box w={200}>{e.title}</Box>
|
||||
<Center w={200}>{e.title}</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Box w={200}>{e.lokasi}</Box>
|
||||
<Center w={200}>{e.lokasi}</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Box w={200}>{e.EventMaster_TipeAcara.name}</Box>
|
||||
<Center w={200}>{e.EventMaster_TipeAcara.name}</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Box w={200}>
|
||||
<Center w={200}>
|
||||
{e.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}
|
||||
</Box>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Box w={100}>
|
||||
<Center w={100}>
|
||||
{e.tanggal.toLocaleTimeString([], {
|
||||
timeStyle: "short",
|
||||
hourCycle: "h24",
|
||||
})}
|
||||
</Box>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Box w={500}>
|
||||
<Center w={500}>
|
||||
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
||||
{e.deskripsi}
|
||||
</Spoiler>
|
||||
</Box>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
{" "}
|
||||
<Box w={400}>
|
||||
<Center w={400}>
|
||||
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
||||
{e.catatan}
|
||||
</Spoiler>
|
||||
</Box>
|
||||
</Center>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
@@ -128,12 +154,87 @@ function TableStatus({ listReject }: { listReject: MODEL_EVENT[] }) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"xs"} h={"100%"}>
|
||||
<Group
|
||||
position="apart"
|
||||
bg={"red.4"}
|
||||
p={"xs"}
|
||||
style={{ borderRadius: "6px" }}
|
||||
>
|
||||
<Title order={4}>Reject</Title>
|
||||
<TextInput
|
||||
icon={<IconSearch size={20} />}
|
||||
radius={"xl"}
|
||||
placeholder="Masukan judul"
|
||||
onChange={(val) => {
|
||||
onSearch(val.currentTarget.value);
|
||||
}}
|
||||
/>
|
||||
</Group>
|
||||
|
||||
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||
<ScrollArea w={"100%"} h={"90%"}>
|
||||
<Table
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"md"}
|
||||
p={"md"}
|
||||
w={1500}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Username</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Judul</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Lokasi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Tipe Acara</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Tanggal</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Jam</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Cacatan</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Deskripsi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{TableRows}</tbody>
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
|
||||
<Center mt={"xl"}>
|
||||
<Pagination
|
||||
value={isActivePage}
|
||||
total={isNPage}
|
||||
onChange={(val) => {
|
||||
onPageClick(val);
|
||||
}}
|
||||
/>
|
||||
</Center>
|
||||
</Paper>
|
||||
</Stack>
|
||||
|
||||
<Modal
|
||||
opened={opened}
|
||||
onClose={close}
|
||||
centered
|
||||
withCloseButton={false}
|
||||
size={"lg"}
|
||||
size={"md"}
|
||||
>
|
||||
<Stack>
|
||||
<Textarea
|
||||
@@ -152,7 +253,7 @@ function TableStatus({ listReject }: { listReject: MODEL_EVENT[] }) {
|
||||
<Button
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
onUpdate(eventId, catatan, close as any, setData);
|
||||
onUpdate(eventId, catatan);
|
||||
}}
|
||||
>
|
||||
Simpan
|
||||
@@ -160,79 +261,6 @@ function TableStatus({ listReject }: { listReject: MODEL_EVENT[] }) {
|
||||
</Group>
|
||||
</Stack>
|
||||
</Modal>
|
||||
|
||||
<Box>
|
||||
<Box bg={"red.1"} p={"xs"}>
|
||||
<Title order={6} c={"red"}>
|
||||
REJECT
|
||||
</Title>
|
||||
</Box>
|
||||
<ScrollArea w={"100%"}>
|
||||
<Table
|
||||
w={2000}
|
||||
withBorder
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"xl"}
|
||||
p={"md"}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Author</th>
|
||||
<th>Judul</th>
|
||||
<th>Lokasi</th>
|
||||
<th>Tipe Acara</th>
|
||||
<th>Tanggal</th>
|
||||
<th>Jam</th>
|
||||
<th>
|
||||
<Center>Deskripsi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Catatan</Center>
|
||||
</th>
|
||||
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{TableRows}</tbody>
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
<Center>
|
||||
{_.isEmpty(TableRows) ? (
|
||||
<Center h={"50vh"}>
|
||||
<Title order={6}>Tidak Ada Data</Title>
|
||||
</Center>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</Center>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
async function onUpdate(
|
||||
eventId: string,
|
||||
catatan: string,
|
||||
close: any,
|
||||
setData: any
|
||||
) {
|
||||
const body = {
|
||||
id: eventId,
|
||||
catatan: catatan,
|
||||
};
|
||||
await AdminEvent_funEditCatatanById(body as any, "4").then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
await AdminEvent_getListTableByStatusId("4").then((val) => {
|
||||
setData(val);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
close();
|
||||
});
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,110 +1,322 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Center,
|
||||
Group,
|
||||
Modal,
|
||||
Spoiler,
|
||||
Stack,
|
||||
Table,
|
||||
Textarea,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { IconBan, IconEyeShare } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
|
||||
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 { MODEL_EVENT } from "@/app_modules/event/model/interface";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import _ from "lodash";
|
||||
import {
|
||||
Button,
|
||||
Center,
|
||||
Group,
|
||||
Modal,
|
||||
Pagination,
|
||||
Paper,
|
||||
ScrollArea,
|
||||
Spoiler,
|
||||
Stack,
|
||||
Table,
|
||||
Text,
|
||||
Textarea,
|
||||
TextInput,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import { IconBan, IconCircleCheck, IconSearch } from "@tabler/icons-react";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { ComponentAdminGlobal_NotifikasiBerhasil } from "../../_admin_global/admin_notifikasi/notifikasi_berhasil";
|
||||
import { ComponentAdminGlobal_NotifikasiGagal } from "../../_admin_global/admin_notifikasi/notifikasi_gagal";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||
import adminNotifikasi_funCreateToUser from "../../notifikasi/fun/create/fun_create_notif_user";
|
||||
import { adminEvent_funGetListReview } from "../fun";
|
||||
import { AdminEvent_funEditStatusPublishById } from "../fun/edit/fun_edit_status_publish_by_id";
|
||||
import { AdminEvent_funEditCatatanById } from "../fun/edit/fun_edit_status_reject_by_id";
|
||||
import { AdminEvent_getListTableByStatusId } from "../fun/get/get_list_table_by_status_id";
|
||||
|
||||
export default function AdminEvent_TableReview({
|
||||
listReview,
|
||||
listData,
|
||||
}: {
|
||||
listReview: MODEL_EVENT[];
|
||||
listData: any;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Event: Table Review" />
|
||||
<TableStatus listReview={listReview} />
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Event" />
|
||||
<TableStatus listData={listData} />
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function TableStatus({ listReview }: { listReview: MODEL_EVENT[] }) {
|
||||
function TableStatus({ listData }: { listData: any }) {
|
||||
const router = useRouter();
|
||||
const [data, setData] = useState<MODEL_EVENT[]>(listData.data);
|
||||
const [isNPage, setNPage] = useState(listData.nPage);
|
||||
const [isActivePage, setActivePage] = useState(1);
|
||||
const [isSearch, setSearch] = useState("");
|
||||
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
const [data, setData] = useState(listReview);
|
||||
const [catatan, setCatatan] = useState("");
|
||||
const [eventId, setEventId] = useState("");
|
||||
|
||||
// const dataEvent = {} as Prisma.UserUncheckedCreateInput;
|
||||
|
||||
async function onSearch(s: string) {
|
||||
setSearch(s);
|
||||
const loadData = await adminEvent_funGetListReview({
|
||||
page: 1,
|
||||
search: s,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
async function onPageClick(p: any) {
|
||||
setActivePage(p);
|
||||
const loadData = await adminEvent_funGetListReview({
|
||||
search: isSearch,
|
||||
page: p,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
async function onPublish(eventId: string, tanggal: Date) {
|
||||
if (moment(tanggal).diff(Date.now(), "minutes") < 0)
|
||||
return ComponentGlobal_NotifikasiPeringatan(
|
||||
"Waktu acara telah lewat, Report untuk memberitahu user !"
|
||||
);
|
||||
|
||||
const res = await AdminEvent_funEditStatusPublishById(eventId, "1");
|
||||
if (res.status === 200) {
|
||||
const dataNotif = {
|
||||
appId: res.data?.id,
|
||||
status: res.data?.EventMaster_Status?.name as any,
|
||||
userId: res.data?.authorId as any,
|
||||
pesan: res.data?.title as any,
|
||||
kategoriApp: "EVENT",
|
||||
title: "Event publish",
|
||||
};
|
||||
|
||||
const notif = await adminNotifikasi_funCreateToUser({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish(
|
||||
"USER",
|
||||
JSON.stringify({ userId: res?.data?.authorId, count: 1 })
|
||||
);
|
||||
}
|
||||
|
||||
const loadData = await adminEvent_funGetListReview({
|
||||
search: isSearch,
|
||||
page: isActivePage,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
ComponentAdminGlobal_NotifikasiBerhasil("Berhasil update status");
|
||||
} else {
|
||||
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
async function onReject(eventId: string, catatan: string) {
|
||||
if (catatan === "")
|
||||
return ComponentGlobal_NotifikasiPeringatan("Lengkapi Catatan");
|
||||
const body = {
|
||||
id: eventId,
|
||||
catatan: catatan,
|
||||
};
|
||||
|
||||
const res = await AdminEvent_funEditCatatanById(body as any, "4");
|
||||
if (res.status === 200) {
|
||||
const dataNotif = {
|
||||
appId: res.data?.id,
|
||||
status: res.data?.EventMaster_Status?.name as any,
|
||||
userId: res.data?.authorId as any,
|
||||
pesan: res.data?.title as any,
|
||||
kategoriApp: "EVENT",
|
||||
title: "Event anda di tolak !",
|
||||
};
|
||||
|
||||
const notif = await adminNotifikasi_funCreateToUser({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish(
|
||||
"USER",
|
||||
JSON.stringify({ userId: res?.data?.authorId, count: 1 })
|
||||
);
|
||||
}
|
||||
|
||||
const loadData = await adminEvent_funGetListReview({
|
||||
search: isSearch,
|
||||
page: isActivePage,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
close();
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
const TableRows = data.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>{e?.Author?.Profile?.name}</td>
|
||||
<td>{e.title}</td>
|
||||
<td>{e.lokasi}</td>
|
||||
<td>{e.EventMaster_TipeAcara.name}</td>
|
||||
<td>{e.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}</td>
|
||||
<td>
|
||||
{e.tanggal.toLocaleTimeString([], {
|
||||
timeStyle: "short",
|
||||
hourCycle: "h24",
|
||||
})}
|
||||
<Center w={200}>
|
||||
<Text>{e?.Author?.username}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
||||
{e.deskripsi}
|
||||
</Spoiler>
|
||||
<Center w={200}>
|
||||
<Text lineClamp={2}>{e.title}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Text>{e.lokasi}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Text>{e.EventMaster_TipeAcara.name}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
{e.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
{e.tanggal.toLocaleTimeString([], {
|
||||
timeStyle: "short",
|
||||
hourCycle: "h24",
|
||||
})}
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={400}>
|
||||
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
||||
{e.deskripsi}
|
||||
</Spoiler>
|
||||
</Center>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<Stack>
|
||||
<Button
|
||||
color={"green"}
|
||||
leftIcon={<IconEyeShare />}
|
||||
radius={"xl"}
|
||||
onClick={() => onPublish(e.id, setData, e.tanggal)}
|
||||
>
|
||||
Publish
|
||||
</Button>
|
||||
<Button
|
||||
color={"red"}
|
||||
leftIcon={<IconBan />}
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
open();
|
||||
setEventId(e.id);
|
||||
}}
|
||||
>
|
||||
Reject
|
||||
</Button>
|
||||
</Stack>
|
||||
<Center>
|
||||
<Stack>
|
||||
<Button
|
||||
color={"green"}
|
||||
leftIcon={<IconCircleCheck />}
|
||||
radius={"xl"}
|
||||
onClick={() => onPublish(e.id, e.tanggal)}
|
||||
>
|
||||
Publish
|
||||
</Button>
|
||||
<Button
|
||||
color={"red"}
|
||||
leftIcon={<IconBan />}
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
open();
|
||||
setEventId(e.id);
|
||||
}}
|
||||
>
|
||||
Reject
|
||||
</Button>
|
||||
</Stack>
|
||||
</Center>
|
||||
</td>
|
||||
</tr>
|
||||
));
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"xs"} h={"100%"}>
|
||||
<Group
|
||||
position="apart"
|
||||
bg={"orange.4"}
|
||||
p={"xs"}
|
||||
style={{ borderRadius: "6px" }}
|
||||
>
|
||||
<Title order={4}>Review</Title>
|
||||
<TextInput
|
||||
icon={<IconSearch size={20} />}
|
||||
radius={"xl"}
|
||||
placeholder="Masukan judul"
|
||||
onChange={(val) => {
|
||||
onSearch(val.currentTarget.value);
|
||||
}}
|
||||
/>
|
||||
</Group>
|
||||
|
||||
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||
<ScrollArea w={"100%"} h={"90%"}>
|
||||
<Table
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"md"}
|
||||
p={"md"}
|
||||
w={1500}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Username</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Judul</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Lokasi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Tipe Acara</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Tanggal</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Jam</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Deskripsi</Center>
|
||||
</th>
|
||||
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{TableRows}</tbody>
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
|
||||
<Center mt={"xl"}>
|
||||
<Pagination
|
||||
value={isActivePage}
|
||||
total={isNPage}
|
||||
onChange={(val) => {
|
||||
onPageClick(val);
|
||||
}}
|
||||
/>
|
||||
</Center>
|
||||
</Paper>
|
||||
</Stack>
|
||||
|
||||
<Modal
|
||||
opened={opened}
|
||||
onClose={close}
|
||||
centered
|
||||
withCloseButton={false}
|
||||
size={"lg"}
|
||||
size={"md"}
|
||||
>
|
||||
<Stack>
|
||||
<Textarea
|
||||
@@ -119,10 +331,13 @@ function TableStatus({ listReview }: { listReview: MODEL_EVENT[] }) {
|
||||
}}
|
||||
/>
|
||||
<Group position="right">
|
||||
<Button radius={"xl"} onClick={close}>
|
||||
Batal
|
||||
</Button>
|
||||
<Button
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
onReject(eventId, catatan, setData, close);
|
||||
onReject(eventId, catatan);
|
||||
}}
|
||||
>
|
||||
Simpan
|
||||
@@ -130,133 +345,6 @@ function TableStatus({ listReview }: { listReview: MODEL_EVENT[] }) {
|
||||
</Group>
|
||||
</Stack>
|
||||
</Modal>
|
||||
|
||||
<Box>
|
||||
{/* <pre>{JSON.stringify(data, null, 2)}</pre> */}
|
||||
<Box bg={"orange.1"} p={"xs"}>
|
||||
<Title order={6} c={"orange"}>
|
||||
REVIEW
|
||||
</Title>
|
||||
</Box>
|
||||
<Table
|
||||
withBorder
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"xl"}
|
||||
p={"md"}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Author</th>
|
||||
<th>Judul</th>
|
||||
<th>Lokasi</th>
|
||||
<th>Tipe Acara</th>
|
||||
<th>Tanggal</th>
|
||||
<th>Jam</th>
|
||||
<th>
|
||||
<Center>Deskripsi</Center>
|
||||
</th>
|
||||
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{TableRows}</tbody>
|
||||
</Table>
|
||||
<Center>
|
||||
{_.isEmpty(TableRows) ? (
|
||||
<Center h={"50vh"}>
|
||||
<Title order={6}>Tidak Ada Data</Title>
|
||||
</Center>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</Center>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
async function onPublish(eventId: string, setData: any, tanggal: Date) {
|
||||
if (moment(tanggal).diff(Date.now(), "minutes") < 0)
|
||||
return ComponentGlobal_NotifikasiPeringatan(
|
||||
"Waktu acara telah lewat, Report untuk memberitahu user !"
|
||||
);
|
||||
|
||||
const res = await AdminEvent_funEditStatusPublishById(eventId, "1");
|
||||
if (res.status === 200) {
|
||||
const dataNotif = {
|
||||
appId: res.data?.id,
|
||||
status: res.data?.EventMaster_Status?.name as any,
|
||||
userId: res.data?.authorId as any,
|
||||
pesan: res.data?.title as any,
|
||||
kategoriApp: "EVENT",
|
||||
title: "Event publish",
|
||||
};
|
||||
|
||||
const notif = await adminNotifikasi_funCreateToUser({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish(
|
||||
"USER",
|
||||
JSON.stringify({ userId: res?.data?.authorId, count: 1 })
|
||||
);
|
||||
}
|
||||
|
||||
await AdminEvent_getListTableByStatusId("2").then((res) => {
|
||||
setData(res);
|
||||
ComponentGlobal_NotifikasiBerhasil("Berhasil update status");
|
||||
});
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
async function onReject(
|
||||
eventId: string,
|
||||
catatan: string,
|
||||
setData: any,
|
||||
close: any
|
||||
) {
|
||||
if (catatan === "")
|
||||
return ComponentGlobal_NotifikasiPeringatan("Lengkapi Catatan");
|
||||
const body = {
|
||||
id: eventId,
|
||||
catatan: catatan,
|
||||
};
|
||||
|
||||
const res = await AdminEvent_funEditCatatanById(body as any, "4");
|
||||
if (res.status === 200) {
|
||||
const dataNotif = {
|
||||
appId: res.data?.id,
|
||||
status: res.data?.EventMaster_Status?.name as any,
|
||||
userId: res.data?.authorId as any,
|
||||
pesan: res.data?.title as any,
|
||||
kategoriApp: "EVENT",
|
||||
title: "Event anda di tolak !",
|
||||
};
|
||||
|
||||
const notif = await adminNotifikasi_funCreateToUser({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish(
|
||||
"USER",
|
||||
JSON.stringify({ userId: res?.data?.authorId, count: 1 })
|
||||
);
|
||||
}
|
||||
|
||||
await AdminEvent_getListTableByStatusId("2").then((val) => {
|
||||
setData(val);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
close();
|
||||
});
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import { Group, Paper, SimpleGrid, Stack, Text, Title } from "@mantine/core";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||
import ComponentAdminGlobal_LoadingPage from "../../_admin_global/loading_admin_page";
|
||||
|
||||
export default function AdminForum_Main({
|
||||
countPublish,
|
||||
@@ -23,7 +22,6 @@ export default function AdminForum_Main({
|
||||
countLaporanKomentar={countLaporanKomentar}
|
||||
/>
|
||||
</Stack>
|
||||
{/* <ComponentAdminGlobal_LoadingPage /> */}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
"use client";
|
||||
|
||||
import { Button } from "@mantine/core";
|
||||
import { adminInvestasi_funAcceptTransaksiById, adminInvestasi_funGetAllTransaksiById } from "../../fun";
|
||||
import { ComponentAdminGlobal_NotifikasiBerhasil } from "@/app_modules/admin/_admin_global/admin_notifikasi/notifikasi_berhasil";
|
||||
import { ComponentAdminGlobal_NotifikasiGagal } from "@/app_modules/admin/_admin_global/admin_notifikasi/notifikasi_gagal";
|
||||
import { useState } from "react";
|
||||
|
||||
export function AdminInvestasi_ComponentButtonBandingTransaksi({
|
||||
invoiceId,
|
||||
investasiId,
|
||||
onLoadData,
|
||||
}: {
|
||||
invoiceId: string;
|
||||
investasiId: string
|
||||
onLoadData: (val: any) => void;
|
||||
}) {
|
||||
const [isLoading, setLoading] = useState(false)
|
||||
async function onAccept() {
|
||||
const res = await adminInvestasi_funAcceptTransaksiById({ invoiceId });
|
||||
|
||||
if (res.status == 200) {
|
||||
try {
|
||||
const dataTransaksi = await adminInvestasi_funGetAllTransaksiById({
|
||||
investasiId,
|
||||
page: 1,
|
||||
});
|
||||
onLoadData(dataTransaksi);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
||||
setLoading(true);
|
||||
}
|
||||
} else {
|
||||
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
radius={"xl"}
|
||||
color="orange"
|
||||
onClick={() => {
|
||||
onAccept();
|
||||
}}
|
||||
>
|
||||
Banding Diterima
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { RouterAdminInvestasi } from "@/app/lib/router_admin/router_admin_investasi";
|
||||
import { Button } from "@mantine/core";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
|
||||
export function AdminInvestasi_ComponentCekBuktiTransfer({
|
||||
imagesId,
|
||||
}: {
|
||||
imagesId: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false)
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={isLoading}
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
setLoading(true);
|
||||
router.push(RouterAdminInvestasi.bukti_transfer + `${imagesId}`);
|
||||
}}
|
||||
>
|
||||
Cek
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
import { Button, Stack } from "@mantine/core";
|
||||
import {
|
||||
adminInvestasi_funAcceptTransaksiById,
|
||||
adminInvestasi_funGetAllTransaksiById,
|
||||
adminInvestasi_funRejectInvoiceById,
|
||||
} from "../../fun";
|
||||
import { ComponentAdminGlobal_NotifikasiBerhasil } from "@/app_modules/admin/_admin_global/admin_notifikasi/notifikasi_berhasil";
|
||||
import { ComponentAdminGlobal_NotifikasiGagal } from "@/app_modules/admin/_admin_global/admin_notifikasi/notifikasi_gagal";
|
||||
import { useState } from "react";
|
||||
import { IconCircleCheck } from "@tabler/icons-react";
|
||||
import { IconBan } from "@tabler/icons-react";
|
||||
|
||||
export function AdminInvestasi_ComponentButtonKonfirmasiTransaksi({
|
||||
invoiceId,
|
||||
investasiId,
|
||||
onLoadData,
|
||||
}: {
|
||||
invoiceId: string;
|
||||
investasiId: string;
|
||||
onLoadData: (val: any) => void;
|
||||
}) {
|
||||
const [isLoadingAccpet, setLoadingAccept] = useState(false);
|
||||
const [isLoadingReject, setLoadingReject] = useState(false);
|
||||
|
||||
async function onReject() {
|
||||
const res = await adminInvestasi_funRejectInvoiceById({ invoiceId });
|
||||
if (res.status == 200) {
|
||||
try {
|
||||
const dataTransaksi = await adminInvestasi_funGetAllTransaksiById({
|
||||
investasiId,
|
||||
page: 1,
|
||||
});
|
||||
onLoadData(dataTransaksi);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
||||
setLoadingReject(true);
|
||||
}
|
||||
} else {
|
||||
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
async function onAccept() {
|
||||
const res = await adminInvestasi_funAcceptTransaksiById({ invoiceId });
|
||||
|
||||
if (res.status == 200) {
|
||||
try {
|
||||
const dataTransaksi = await adminInvestasi_funGetAllTransaksiById({
|
||||
investasiId,
|
||||
page: 1,
|
||||
});
|
||||
onLoadData(dataTransaksi);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
||||
setLoadingAccept(true);
|
||||
}
|
||||
} else {
|
||||
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={isLoadingAccpet}
|
||||
leftIcon={<IconCircleCheck />}
|
||||
radius={"xl"}
|
||||
color="green"
|
||||
onClick={() => {
|
||||
onAccept();
|
||||
}}
|
||||
>
|
||||
Terima
|
||||
</Button>
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={isLoadingReject}
|
||||
leftIcon={<IconBan />}
|
||||
radius={"xl"}
|
||||
color="red"
|
||||
onClick={() => onReject()}
|
||||
>
|
||||
Tolak
|
||||
</Button>
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
7
src/app_modules/admin/investasi/_component/index.ts
Normal file
7
src/app_modules/admin/investasi/_component/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { AdminInvestasi_ComponentButtonBandingTransaksi } from "./button/button_banding_transaksi";
|
||||
import { AdminInvestasi_ComponentCekBuktiTransfer } from "./button/button_cek_bukti_transaksi";
|
||||
import { AdminInvestasi_ComponentButtonKonfirmasiTransaksi } from "./button/button_konfirmasi_transaksi";
|
||||
|
||||
export { AdminInvestasi_ComponentButtonKonfirmasiTransaksi };
|
||||
export { AdminInvestasi_ComponentButtonBandingTransaksi };
|
||||
export { AdminInvestasi_ComponentCekBuktiTransfer };
|
||||
5
src/app_modules/admin/investasi/_lib/global_state.ts
Normal file
5
src/app_modules/admin/investasi/_lib/global_state.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { atomWithStorage } from "jotai/utils";
|
||||
|
||||
const gs_admin_invetasi_menu_publish = atomWithStorage("gs_admin_invetasi_menu_publish", "1")
|
||||
|
||||
export { gs_admin_invetasi_menu_publish }
|
||||
@@ -0,0 +1,22 @@
|
||||
import { RouterAdminInvestasi } from "@/app/lib/router_admin/router_admin_investasi";
|
||||
import { Center, Image, Paper, Text } from "@mantine/core";
|
||||
|
||||
export function AdminInvestasi_ViewBuktiTransfer({
|
||||
imageId,
|
||||
}: {
|
||||
imageId: string;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Center>
|
||||
<Paper withBorder p={"md"}>
|
||||
<Image
|
||||
width={300}
|
||||
alt="Foto"
|
||||
src={RouterAdminInvestasi.api_bukti_transfer + imageId}
|
||||
/>
|
||||
</Paper>
|
||||
</Center>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,38 +1,84 @@
|
||||
import { RouterAdminDonasi } from "@/app/lib/router_admin/router_admin_donasi";
|
||||
import TampilanRupiahDonasi from "@/app_modules/donasi/component/tampilan_rupiah";
|
||||
import { MODEL_DONASI_INVOICE } from "@/app_modules/donasi/model/interface";
|
||||
import { RouterAdminInvestasi } from "@/app/lib/router_admin/router_admin_investasi";
|
||||
import { ComponentAdminGlobal_TampilanRupiah } from "@/app_modules/admin/_admin_global";
|
||||
import {
|
||||
MODEL_INVOICE_INVESTASI,
|
||||
MODEL_STATUS_INVOICE_INVESTASI,
|
||||
} from "@/app_modules/investasi/_lib/interface";
|
||||
import {
|
||||
Stack,
|
||||
Group,
|
||||
Title,
|
||||
ActionIcon,
|
||||
Select,
|
||||
Paper,
|
||||
ScrollArea,
|
||||
Table,
|
||||
Center,
|
||||
Pagination,
|
||||
Badge,
|
||||
Button,
|
||||
Center,
|
||||
Group,
|
||||
Pagination,
|
||||
Paper,
|
||||
ScrollArea,
|
||||
Select,
|
||||
Stack,
|
||||
Table,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { IconReload } from "@tabler/icons-react";
|
||||
import { isEmpty } from "lodash";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import {
|
||||
AdminInvestasi_ComponentButtonBandingTransaksi,
|
||||
AdminInvestasi_ComponentButtonKonfirmasiTransaksi,
|
||||
AdminInvestasi_ComponentCekBuktiTransfer,
|
||||
} from "../../_component";
|
||||
import { adminInvestasi_funGetAllTransaksiById } from "../../fun";
|
||||
|
||||
export function AdminInvestasi_ViewDaftarTransaksi({
|
||||
dataTransaksi,
|
||||
statusTransaksi,
|
||||
investasiId,
|
||||
}: {
|
||||
dataTransaksi: any;
|
||||
statusTransaksi: MODEL_STATUS_INVOICE_INVESTASI[];
|
||||
investasiId: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
const [idData, setIdData] = useState("");
|
||||
const [data, setData] = useState<MODEL_DONASI_INVOICE[]>(
|
||||
const [listStatsus, setListStatus] = useState(statusTransaksi);
|
||||
|
||||
const [data, setData] = useState<MODEL_INVOICE_INVESTASI[]>(
|
||||
dataTransaksi.data
|
||||
);
|
||||
const [isNPage, setNPage] = useState(dataTransaksi.nPage);
|
||||
const [isActivePage, setActivePage] = useState(1);
|
||||
const [isSelect, setSelect] = useState("");
|
||||
const [selectedStatus, setSelectedStatus] = useState("");
|
||||
|
||||
async function onPageClick(p: any) {
|
||||
setActivePage(p);
|
||||
const loadData = await adminInvestasi_funGetAllTransaksiById({
|
||||
investasiId: investasiId,
|
||||
page: p,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
async function onSelected(selectStatus: any) {
|
||||
setSelectedStatus(selectStatus);
|
||||
const loadData = await adminInvestasi_funGetAllTransaksiById({
|
||||
investasiId: investasiId,
|
||||
page: isActivePage,
|
||||
selectStatus: selectStatus,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
async function onReload() {
|
||||
const loadData = await adminInvestasi_funGetAllTransaksiById({
|
||||
investasiId: investasiId,
|
||||
page: 1,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
const tableRows = data?.map((e, i) => (
|
||||
<tr key={i}>
|
||||
@@ -40,11 +86,18 @@ export function AdminInvestasi_ViewDaftarTransaksi({
|
||||
<Center>{e?.Author.username}</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>{e?.DonasiMaster_Bank?.name}</Center>
|
||||
<Center>{e?.MasterBank.namaBank}</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>
|
||||
<TampilanRupiahDonasi nominal={+e?.nominal} />
|
||||
<ComponentAdminGlobal_TampilanRupiah nominal={+e?.nominal} />
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>
|
||||
{new Intl.NumberFormat("id-ID", { maximumFractionDigits: 10 }).format(
|
||||
+e?.lembarTerbeli
|
||||
)}
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
@@ -56,63 +109,62 @@ export function AdminInvestasi_ViewDaftarTransaksi({
|
||||
</td>
|
||||
<td>
|
||||
<Center>
|
||||
<Badge w={150} variant="dot">
|
||||
{e?.DonasiMaster_StatusInvoice?.name}
|
||||
<Badge
|
||||
w={150}
|
||||
variant="light"
|
||||
color={
|
||||
e.statusInvoiceId === "1"
|
||||
? "green"
|
||||
: e.statusInvoiceId === "4"
|
||||
? "red"
|
||||
: "blue"
|
||||
}
|
||||
>
|
||||
{e?.StatusInvoice?.name}
|
||||
</Badge>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>
|
||||
{e?.donasiMaster_StatusInvoiceId === "1" ||
|
||||
e?.donasiMaster_StatusInvoiceId === "2" ? (
|
||||
<Button
|
||||
radius={"xl"}
|
||||
onClick={() =>
|
||||
router.push(
|
||||
RouterAdminDonasi.transfer_invoice + `${e?.imagesId}`
|
||||
)
|
||||
}
|
||||
>
|
||||
Cek
|
||||
</Button>
|
||||
{e?.statusInvoiceId !== "3" ? (
|
||||
<AdminInvestasi_ComponentCekBuktiTransfer imagesId={e?.imagesId} />
|
||||
) : (
|
||||
"-"
|
||||
)}
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
test
|
||||
{/* <Center>
|
||||
{e?.donasiMaster_StatusInvoiceId === "1" ? (
|
||||
<Button radius={"xl"} disabled>
|
||||
Selesai
|
||||
</Button>
|
||||
) : e?.DonasiMaster_StatusInvoice?.id === "2" ? (
|
||||
<ButtonAccept
|
||||
invoiceId={e?.id}
|
||||
donasiId={dataDonasi?.id}
|
||||
nominal={+e?.nominal}
|
||||
danaTerkumpul={+dataDonasi?.terkumpul}
|
||||
target={+dataDonasi?.target}
|
||||
onSuccessDonasi={(val) => {
|
||||
onSuccessDonasi(val);
|
||||
}}
|
||||
onSuccessDonatur={(val) => {
|
||||
setListDonatur(val.data);
|
||||
setNPage(val.nPage);
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<Text>-</Text>
|
||||
)}
|
||||
</Center> */}
|
||||
<Center>
|
||||
{e.statusInvoiceId === "1" && "-"}
|
||||
{e.statusInvoiceId === "2" && (
|
||||
<AdminInvestasi_ComponentButtonKonfirmasiTransaksi
|
||||
invoiceId={e.id}
|
||||
investasiId={investasiId}
|
||||
onLoadData={(val) => {
|
||||
setData(val.data);
|
||||
setNPage(val.nPage);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{e.statusInvoiceId === "3" && "-"}
|
||||
{e.statusInvoiceId === "4" && (
|
||||
<AdminInvestasi_ComponentButtonBandingTransaksi
|
||||
invoiceId={e.id}
|
||||
investasiId={investasiId}
|
||||
onLoadData={(val) => {
|
||||
setData(val.data);
|
||||
setNPage(val.nPage);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Center>
|
||||
</td>
|
||||
</tr>
|
||||
));
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"xs"} h={"100%"}>
|
||||
{/* <pre>{JSON.stringify(dataDonasi, null, 2)}</pre> */}
|
||||
<Group
|
||||
position="apart"
|
||||
bg={"gray.4"}
|
||||
@@ -126,22 +178,25 @@ export function AdminInvestasi_ViewDaftarTransaksi({
|
||||
radius={"xl"}
|
||||
variant="light"
|
||||
onClick={() => {
|
||||
// onRelaod();
|
||||
onReload();
|
||||
}}
|
||||
>
|
||||
<IconReload />
|
||||
</ActionIcon>
|
||||
<Select
|
||||
placeholder="Pilih status"
|
||||
value={isSelect}
|
||||
data={[]}
|
||||
// data={listMasterStatus.map((e) => ({
|
||||
// value: e.id,
|
||||
// label: e.name,
|
||||
// }))}
|
||||
// onChange={(val) => {
|
||||
// onSelect(val);
|
||||
// }}
|
||||
value={selectedStatus}
|
||||
data={
|
||||
isEmpty(listStatsus)
|
||||
? []
|
||||
: listStatsus.map((e) => ({
|
||||
value: e.id,
|
||||
label: e.name,
|
||||
}))
|
||||
}
|
||||
onChange={(val: any) => {
|
||||
onSelected(val);
|
||||
}}
|
||||
/>
|
||||
</Group>
|
||||
</Group>
|
||||
@@ -167,6 +222,9 @@ export function AdminInvestasi_ViewDaftarTransaksi({
|
||||
<th>
|
||||
<Center>Jumlah Investasi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Lembar Terbeli</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Tanggal</Center>
|
||||
</th>
|
||||
@@ -190,7 +248,7 @@ export function AdminInvestasi_ViewDaftarTransaksi({
|
||||
value={isActivePage}
|
||||
total={isNPage}
|
||||
onChange={(val) => {
|
||||
// onPageClick(val);
|
||||
onPageClick(val);
|
||||
}}
|
||||
/>
|
||||
</Center>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { AdminInvestasi_ViewBuktiTransfer } from "./detail/view_bukti_transfer";
|
||||
import { AdminInvestasi_ViewDaftarInvestor } from "./detail/view_daftar_investor";
|
||||
import { AdminInvestasi_ViewDaftarTransaksi } from "./detail/view_daftar_transaksi";
|
||||
import { AdminInvestasi_ViewDetailData } from "./detail/view_detail_data";
|
||||
@@ -5,3 +6,4 @@ import { AdminInvestasi_ViewDetailData } from "./detail/view_detail_data";
|
||||
export { AdminInvestasi_ViewDetailData };
|
||||
export { AdminInvestasi_ViewDaftarTransaksi };
|
||||
export { AdminInvestasi_ViewDaftarInvestor };
|
||||
export { AdminInvestasi_ViewBuktiTransfer };
|
||||
|
||||
@@ -16,7 +16,7 @@ import { IconChevronRight } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
export default function Admin_BuktiTransferInvestasi() {
|
||||
const router = useRouter()
|
||||
const router = useRouter();
|
||||
const listUsername = [
|
||||
{
|
||||
id: 1,
|
||||
@@ -41,7 +41,13 @@ export default function Admin_BuktiTransferInvestasi() {
|
||||
<>
|
||||
{/* Box Username */}
|
||||
{listUsername.map((e) => (
|
||||
<Paper key={e.id} bg={"gray"} p={"md"} mb={"xs"} onClick={() => router.push(RouterAdminInvestasi_OLD.status_transfer)}>
|
||||
<Paper
|
||||
key={e.id}
|
||||
bg={"gray"}
|
||||
p={"md"}
|
||||
mb={"xs"}
|
||||
onClick={() => router.push(RouterAdminInvestasi_OLD.status_transfer)}
|
||||
>
|
||||
<Grid align="center">
|
||||
<Grid.Col span={6}>
|
||||
<Text>Username</Text>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
"use client";
|
||||
|
||||
import { Stack } from "@mantine/core";
|
||||
import ComponentAdminGlobal_BackButton from "../../_admin_global/back_button";
|
||||
import { AdminInvestasi_ViewBuktiTransfer } from "../_view";
|
||||
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global";
|
||||
|
||||
export function AdminInvestasi_DetailBuktiTransfer({ imageId }: { imageId: string }) {
|
||||
return (
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_BackButton />
|
||||
<ComponentAdminGlobal_TitlePage name="Bukti Transfer" />
|
||||
<AdminInvestasi_ViewBuktiTransfer imageId={imageId} />
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
@@ -10,13 +10,21 @@ import {
|
||||
AdminInvestasi_ViewDaftarTransaksi,
|
||||
AdminInvestasi_ViewDetailData,
|
||||
} from "../_view";
|
||||
import { useAtom } from "jotai";
|
||||
import { gs_admin_invetasi_menu_publish } from "../_lib/global_state";
|
||||
|
||||
export function AdminInvestasi_DetailPublish({
|
||||
data,
|
||||
dataTransaksi,
|
||||
statusTransaksi,
|
||||
investasiId,
|
||||
}: {
|
||||
data: MODEL_INVESTASI;
|
||||
dataTransaksi: any[];
|
||||
statusTransaksi: any[];
|
||||
investasiId: string;
|
||||
}) {
|
||||
const [selectPage, setSelectPage] = useState("1");
|
||||
const [selectPage, setSelectPage] = useAtom(gs_admin_invetasi_menu_publish);
|
||||
const listPage = [
|
||||
{
|
||||
id: "1",
|
||||
@@ -37,7 +45,7 @@ export function AdminInvestasi_DetailPublish({
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack px={"lg"}>
|
||||
<Stack >
|
||||
<ComponentAdminGlobal_BackButton />
|
||||
|
||||
<Group>
|
||||
@@ -60,9 +68,13 @@ export function AdminInvestasi_DetailPublish({
|
||||
<AdminInvestasi_ViewDetailData data={data} />
|
||||
) : null}
|
||||
{selectPage == "2" ? (
|
||||
<AdminInvestasi_ViewDaftarTransaksi dataTransaksi={{}} />
|
||||
<AdminInvestasi_ViewDaftarTransaksi
|
||||
dataTransaksi={dataTransaksi}
|
||||
statusTransaksi={statusTransaksi}
|
||||
investasiId={investasiId}
|
||||
/>
|
||||
) : null}
|
||||
{selectPage == "3" ? <AdminInvestasi_ViewDaftarInvestor /> : null}
|
||||
{/* {selectPage == "3" ? <AdminInvestasi_ViewDaftarInvestor /> : null} */}
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
|
||||
3
src/app_modules/admin/investasi/detail/index.ts
Normal file
3
src/app_modules/admin/investasi/detail/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { AdminInvestasi_DetailBuktiTransfer } from "./detail_bukti_transfer";
|
||||
|
||||
export { AdminInvestasi_DetailBuktiTransfer };
|
||||
@@ -0,0 +1,27 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterAdminInvestasi } from "@/app/lib/router_admin/router_admin_investasi";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function adminInvestasi_funAcceptTransaksiById({
|
||||
invoiceId,
|
||||
}: {
|
||||
invoiceId: string;
|
||||
}) {
|
||||
const updt = await prisma.investasi_Invoice.update({
|
||||
where: {
|
||||
id: invoiceId,
|
||||
},
|
||||
data: {
|
||||
statusInvoiceId: "1",
|
||||
},
|
||||
});
|
||||
|
||||
if (!updt) return { status: 400, message: "Gagal Update" };
|
||||
revalidatePath(RouterAdminInvestasi.detail_publish);
|
||||
return {
|
||||
status: 200,
|
||||
message: "Update Berhasil",
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterAdminInvestasi } from "@/app/lib/router_admin/router_admin_investasi";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function adminInvestasi_funRejectInvoiceById({
|
||||
invoiceId,
|
||||
}: {
|
||||
invoiceId: string;
|
||||
}) {
|
||||
const updt = await prisma.investasi_Invoice.update({
|
||||
where: {
|
||||
id: invoiceId,
|
||||
},
|
||||
data: {
|
||||
statusInvoiceId: "4",
|
||||
},
|
||||
});
|
||||
|
||||
if (!updt) return { status: 400, message: "Gagal Update" };
|
||||
revalidatePath(RouterAdminInvestasi.detail_publish);
|
||||
return {
|
||||
status: 200,
|
||||
message: "Update Berhasil",
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { ceil } from "lodash";
|
||||
|
||||
export async function adminInvestasi_funGetAllTransaksiById({
|
||||
investasiId,
|
||||
page,
|
||||
selectStatus,
|
||||
}: {
|
||||
investasiId: string;
|
||||
page: number;
|
||||
selectStatus?: string;
|
||||
}) {
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
const data = await prisma.investasi_Invoice.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: [
|
||||
{
|
||||
createdAt: "desc",
|
||||
},
|
||||
],
|
||||
where: {
|
||||
investasiId: investasiId,
|
||||
isActive: true,
|
||||
statusInvoiceId: {
|
||||
contains: selectStatus,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
include: {
|
||||
Author: true,
|
||||
Images: true,
|
||||
StatusInvoice: true,
|
||||
MasterBank: true,
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.investasi_Invoice.count({
|
||||
where: {
|
||||
investasiId: investasiId,
|
||||
isActive: true,
|
||||
statusInvoiceId: {
|
||||
contains: selectStatus,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const allData = {
|
||||
data: data,
|
||||
nPage: ceil(nCount / takeData),
|
||||
};
|
||||
|
||||
return allData;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
"use client";
|
||||
|
||||
export async function adminInvestasi_funGetOneTransaksiById({
|
||||
invoiceId,
|
||||
}: {
|
||||
invoiceId: string;
|
||||
}) {}
|
||||
@@ -0,0 +1,12 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export async function adminInvestasi_getStatusInvestasi() {
|
||||
const data = await prisma.investasiMaster_StatusInvoice.findMany({
|
||||
where: {
|
||||
isActive: true,
|
||||
},
|
||||
});
|
||||
return data;
|
||||
}
|
||||
9
src/app_modules/admin/investasi/fun/index.ts
Normal file
9
src/app_modules/admin/investasi/fun/index.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { adminInvestasi_funAcceptTransaksiById } from "./edit/fun_accept_invoice_by_id";
|
||||
import { adminInvestasi_funRejectInvoiceById } from "./edit/fun_reject_invoice_by_id";
|
||||
import { adminInvestasi_funGetAllTransaksiById } from "./get/fun_get_all_transaksi_by_id";
|
||||
import { adminInvestasi_getStatusInvestasi } from "./get/fun_get_status_transaksi";
|
||||
|
||||
export { adminInvestasi_getStatusInvestasi };
|
||||
export { adminInvestasi_funGetAllTransaksiById };
|
||||
export { adminInvestasi_funRejectInvoiceById };
|
||||
export { adminInvestasi_funAcceptTransaksiById };
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/_admin_global/header_tamplate";
|
||||
import { AdminEvent_getListPesertaById } from "@/app_modules/admin/event/fun/get/get_list_peserta_by_id";
|
||||
import { adminEvent_getListPesertaById } from "@/app_modules/admin/event/fun/get/get_list_peserta_by_id";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import {
|
||||
MODEL_EVENT,
|
||||
|
||||
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}
|
||||
|
||||
@@ -85,7 +85,7 @@ export default function AdminUserAccess_View({ listUser }: { listUser: any }) {
|
||||
<Center>{e.username}</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>{e.nomor}</Center>
|
||||
<Center>+{e.nomor}</Center>
|
||||
</td>
|
||||
<td>
|
||||
{e.active === false ? (
|
||||
@@ -120,7 +120,6 @@ export default function AdminUserAccess_View({ listUser }: { listUser: any }) {
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"xs"} h={"90vh"}>
|
||||
{/* <pre>{JSON.stringify(listUser, null, 2)}</pre> */}
|
||||
<Group
|
||||
position="apart"
|
||||
bg={"blue.4"}
|
||||
@@ -138,8 +137,8 @@ export default function AdminUserAccess_View({ listUser }: { listUser: any }) {
|
||||
/>
|
||||
</Group>
|
||||
|
||||
<Paper p={"md"} withBorder shadow="lg" h={"100%"}>
|
||||
<ScrollArea>
|
||||
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||
<ScrollArea w={"100%"} h={"90%"}>
|
||||
<Table
|
||||
verticalSpacing={"xs"}
|
||||
horizontalSpacing={"md"}
|
||||
|
||||
@@ -32,6 +32,16 @@ export function Investasi_ComponentCardDaftarTransaksi({
|
||||
invoiceId: string;
|
||||
statusInvoiceId: string;
|
||||
}) {
|
||||
|
||||
// Berhasil
|
||||
if (statusInvoiceId === "1") {
|
||||
setVisible(true);
|
||||
return router.push(NEW_RouterInvestasi.transaksi_berhasil + invoiceId, {
|
||||
scroll: false,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Proses
|
||||
if (statusInvoiceId === "2") {
|
||||
setVisible(true);
|
||||
@@ -48,6 +58,13 @@ export function Investasi_ComponentCardDaftarTransaksi({
|
||||
});
|
||||
}
|
||||
|
||||
if (statusInvoiceId === "4") {
|
||||
setVisible(true);
|
||||
return router.push(NEW_RouterInvestasi.transaksi_gagal + invoiceId, {
|
||||
scroll: false,
|
||||
});
|
||||
}
|
||||
|
||||
ComponentGlobal_NotifikasiPeringatan("Status Belum Tersedia");
|
||||
}
|
||||
return (
|
||||
|
||||
@@ -16,7 +16,7 @@ export async function investasi_funGetTransaksiByUserId({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
updatedAt: "desc",
|
||||
},
|
||||
where: {
|
||||
authorId: authorId,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user