QC Investasi
# fix Tampilan admin investasi Tampilan admin donasi ## No issuee
@@ -838,3 +838,11 @@ model ProjectCollaboration_Notifikasi {
|
|||||||
User User @relation("UserNotifProjectToUser", fields: [userId], references: [id], map: "UserNotifProjectUser")
|
User User @relation("UserNotifProjectToUser", fields: [userId], references: [id], map: "UserNotifProjectUser")
|
||||||
userId String
|
userId String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model NomorAdmin {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
isActive Boolean @default(true)
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
nomor String
|
||||||
|
}
|
||||||
|
|||||||
BIN
public/donasi/image/502a25ff-c27a-4b70-a267-1ad5c986df66.jpeg
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
public/donasi/image/87bc7622-092e-4f51-aa73-62f0027fb0c2.jpeg
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
public/donasi/image/93440447-b6af-49d9-91be-d0b5ab12d4c0.jpeg
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
public/donasi/image/b7441f61-56eb-43b6-929d-087de8ca29a7.jpeg
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
public/donasi/image/c26bcc5f-15fc-4d43-aa6a-fa4d69801ca8.jpeg
Normal file
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 136 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 12 KiB |
BIN
public/donasi/invoice/0b61d934-f5f6-419c-b897-a27ca9b73c81.jpg
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
public/donasi/invoice/192d0ce2-7106-4276-83c6-e65f5a4b7534.jpg
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
public/donasi/invoice/1b2c6f27-f4da-4188-a3f7-f3969a84ee6f.jpg
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
public/donasi/invoice/636a9e95-ea4e-43f5-8958-1b9c6f7014e5.jpg
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
public/donasi/invoice/661edfa5-61e6-44e9-b8c2-67bc79811822.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
public/donasi/invoice/b0bdcb6a-b884-4878-9bcc-d33360ace33b.jpg
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
public/donasi/invoice/c3acfd53-b383-42f1-a800-3f3c433d8bd5.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
public/donasi/invoice/e6c8f3d0-b7ac-45f4-ab00-67383439feea.jpg
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
public/donasi/invoice/e88dfb69-d708-4543-9d6d-d3a07cfe66e3.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
public/donasi/invoice/f6f73b86-92e7-47d7-afd8-c87f731002cc.jpg
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
public/donasi/invoice/f9a95f41-0cb7-4fb8-b582-0e7d331bc21a.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
public/donasi/invoice/fd0780a8-ffa4-4db7-b834-0b5c97ad4de7.jpg
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
public/donasi/invoice/fd95563a-04af-4e77-bf76-2ef51777e705.jpg
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
public/file/1e56f93e-df1a-4062-9d67-7fda5302bef2.jpeg
Normal file
|
After Width: | Height: | Size: 274 KiB |
BIN
public/file/516c7e01-3fb2-47e3-be42-fe7a28e011ee.jpg
Normal file
|
After Width: | Height: | Size: 609 KiB |
BIN
public/investasi/1d0bb6c1-ea62-4b2d-bdb7-d66630aa2719.jpg
Normal file
|
After Width: | Height: | Size: 125 KiB |
BIN
public/investasi/1d19b0b3-614c-4354-8799-baf1f1303901.jpg
Normal file
|
After Width: | Height: | Size: 609 KiB |
BIN
public/investasi/9bedc4ca-3557-4378-83fb-6d5854442a11.jpeg
Normal file
|
After Width: | Height: | Size: 274 KiB |
BIN
public/investasi/ed92f5af-98eb-4d13-9c01-50b778f3b9e3.jpg
Normal file
|
After Width: | Height: | Size: 125 KiB |
BIN
public/job/75b1d1ae-acba-4a4a-b904-dd5aeaaa3d65.jpg
Normal file
|
After Width: | Height: | Size: 13 KiB |
@@ -24,7 +24,7 @@ import forum_status_posting from "../../../bin/seeder/forum/master_status.json";
|
|||||||
import collaboration_industri from "../../../bin/seeder/colab/master_industri.json";
|
import collaboration_industri from "../../../bin/seeder/colab/master_industri.json";
|
||||||
import collaboration_status from "../../../bin/seeder/colab/master_status.json";
|
import collaboration_status from "../../../bin/seeder/colab/master_status.json";
|
||||||
import collaboration_jumlah_minimal_room from "../../../bin/seeder/colab/jumlah_minimal_room.json";
|
import collaboration_jumlah_minimal_room from "../../../bin/seeder/colab/jumlah_minimal_room.json";
|
||||||
import { randomId } from "@mantine/hooks";
|
import nomor_admin from "../../../bin/seeder/nomor_admin.json";
|
||||||
|
|
||||||
export async function GET(req: Request) {
|
export async function GET(req: Request) {
|
||||||
const dev = new URL(req.url).searchParams.get("dev");
|
const dev = new URL(req.url).searchParams.get("dev");
|
||||||
@@ -392,6 +392,22 @@ export async function GET(req: Request) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (let a of nomor_admin) {
|
||||||
|
await prisma.nomorAdmin.upsert({
|
||||||
|
where: {
|
||||||
|
id: a.id,
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
id: a.id,
|
||||||
|
nomor: a.nomor,
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
id: a.id,
|
||||||
|
nomor: a.nomor,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return NextResponse.json({ success: true });
|
return NextResponse.json({ success: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
9
src/app/dev/admin/app-information/main/page.tsx
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { AdminAppInformation_MainView } from "@/app_modules/admin/app-info";
|
||||||
|
|
||||||
|
export default async function Page() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<AdminAppInformation_MainView />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,23 +1,29 @@
|
|||||||
import { AdminDonasi_DetailPublish } from "@/app_modules/admin/donasi";
|
import { AdminDonasi_DetailPublish } from "@/app_modules/admin/donasi";
|
||||||
import { AdminDonasi_funCountDonatur } from "@/app_modules/admin/donasi/fun/count/fun_count_donatur";
|
import { AdminDonasi_funCountDonatur } from "@/app_modules/admin/donasi/fun/count/fun_count_donatur";
|
||||||
import { AdminDonasi_getListDonatur } from "@/app_modules/admin/donasi/fun/get/get_list_donatur_by_id";
|
import { adminDonasi_getListDonatur } from "@/app_modules/admin/donasi/fun/get/get_list_donatur_by_id";
|
||||||
import { AdminDonasi_getListPencairanDana } from "@/app_modules/admin/donasi/fun/get/get_list_pencairan_dana_by_id";
|
import { AdminDonasi_getListPencairanDana } from "@/app_modules/admin/donasi/fun/get/get_list_pencairan_dana_by_id";
|
||||||
import { AdminDonasi_getOneById } from "@/app_modules/admin/donasi/fun/get/get_one_by_id";
|
import { AdminDonasi_getOneById } from "@/app_modules/admin/donasi/fun/get/get_one_by_id";
|
||||||
|
import adminDonasi_getMasterStatus from "@/app_modules/admin/donasi/fun/master/get_status_id";
|
||||||
|
|
||||||
export default async function Page({ params }: { params: { id: string } }) {
|
export default async function Page({ params }: { params: { id: string } }) {
|
||||||
|
let donasiId = params.id;
|
||||||
const dataPublish = await AdminDonasi_getOneById(params.id);
|
const dataPublish = await AdminDonasi_getOneById(params.id);
|
||||||
const listDonatur = await AdminDonasi_getListDonatur(params.id);
|
const listDonatur = await adminDonasi_getListDonatur({
|
||||||
|
donasiId: donasiId,
|
||||||
|
page: 1,
|
||||||
|
});
|
||||||
const countDonatur = await AdminDonasi_funCountDonatur(params.id);
|
const countDonatur = await AdminDonasi_funCountDonatur(params.id);
|
||||||
const listPencairan = await AdminDonasi_getListPencairanDana(params.id);
|
const listPencairan = await AdminDonasi_getListPencairanDana(params.id);
|
||||||
// console.log(listDonatur)
|
const listMasterStatus = await adminDonasi_getMasterStatus();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AdminDonasi_DetailPublish
|
<AdminDonasi_DetailPublish
|
||||||
dataPublish={dataPublish as any}
|
dataPublish={dataPublish as any}
|
||||||
listDonatur={listDonatur}
|
listDonatur={listDonatur as any}
|
||||||
countDonatur={countDonatur}
|
countDonatur={countDonatur}
|
||||||
listPencairan={listPencairan as any}
|
listPencairan={listPencairan as any}
|
||||||
|
listMasterStatus={listMasterStatus as any}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { AdminDonasi_BuktiTransfer } from "@/app_modules/admin/donasi";
|
||||||
|
|
||||||
|
export default async function Page({ params }: { params: { id: string } }) {
|
||||||
|
let imageId = params.id;
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<AdminDonasi_BuktiTransfer imageId={imageId} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
9
src/app/dev/admin/donasi/sub-menu/informasi/page.tsx
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
|
||||||
|
export default async function Page() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
12
src/app/dev/admin/donasi/sub-menu/kategori/page.tsx
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { AdminDonasi_TableKategori } from "@/app_modules/admin/donasi";
|
||||||
|
import adminDonasi_getMasterKategori from "@/app_modules/admin/donasi/fun/master/get_list_kategori";
|
||||||
|
|
||||||
|
export default async function Page() {
|
||||||
|
const listKategori = await adminDonasi_getMasterKategori();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<AdminDonasi_TableKategori listKategori={listKategori} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
import { AdminDonasi_TablePublish } from "@/app_modules/admin/donasi";
|
import { AdminDonasi_TablePublish } from "@/app_modules/admin/donasi";
|
||||||
import { AdminDonasi_getByStatus } from "@/app_modules/admin/donasi/fun/get/get_list_donasi_by_status";
|
import adminDonasi_getListPublish from "@/app_modules/admin/donasi/fun/get/get_list_publish";
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
const listPublish = await AdminDonasi_getByStatus("1")
|
const listPublish = await adminDonasi_getListPublish({
|
||||||
|
page: 1,
|
||||||
|
});
|
||||||
// console.log(listPublish)
|
// console.log(listPublish)
|
||||||
return<>
|
return<>
|
||||||
<AdminDonasi_TablePublish listPublish={listPublish as any}/>
|
<AdminDonasi_TablePublish listPublish={listPublish as any}/>
|
||||||
12
src/app/dev/admin/donasi/sub-menu/reject/page.tsx
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { AdminDonasi_TableReject } from "@/app_modules/admin/donasi";
|
||||||
|
import adminDonasi_getListReject from "@/app_modules/admin/donasi/fun/get/get_list_reject";
|
||||||
|
|
||||||
|
export default async function Page() {
|
||||||
|
const dataReject = await adminDonasi_getListReject({ page: 1 });
|
||||||
|
// console.log(dataReject)
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<AdminDonasi_TableReject dataReject={dataReject as any} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
import { AdminDonasi_TableReview } from "@/app_modules/admin/donasi";
|
import { AdminDonasi_TableReview } from "@/app_modules/admin/donasi";
|
||||||
import { AdminDonasi_getByStatus } from "@/app_modules/admin/donasi/fun/get/get_list_donasi_by_status";
|
import adminDonasi_getListReview from "@/app_modules/admin/donasi/fun/get/get_list_review";
|
||||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
const listReview = await AdminDonasi_getByStatus("2");
|
const listReview = await adminDonasi_getListReview({page: 1});
|
||||||
// console.log(listReview);
|
// console.log(listReview);
|
||||||
return <AdminDonasi_TableReview listReview={listReview as any} />;
|
return <AdminDonasi_TableReview listReview={listReview as any} />;
|
||||||
}
|
}
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
import { AdminDonasi_TableReject } from "@/app_modules/admin/donasi";
|
|
||||||
import { AdminDonasi_getByStatus } from "@/app_modules/admin/donasi/fun/get/get_list_donasi_by_status";
|
|
||||||
|
|
||||||
export default async function Page() {
|
|
||||||
const dataReject = await AdminDonasi_getByStatus("4")
|
|
||||||
// console.log(dataReject)
|
|
||||||
return<>
|
|
||||||
<AdminDonasi_TableReject dataReject={dataReject as any}/>
|
|
||||||
</>
|
|
||||||
}
|
|
||||||
12
src/app/dev/admin/investasi/sub-menu/publish/page.tsx
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { Admin_TablePublishInvestasi } from "@/app_modules/admin/investasi";
|
||||||
|
import Admin_funGetAllInvestasi from "@/app_modules/admin/investasi/fun/get_all_investasi";
|
||||||
|
|
||||||
|
export default async function Page() {
|
||||||
|
const listInvestasi = await Admin_funGetAllInvestasi();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Admin_TablePublishInvestasi dataInvestsi={listInvestasi as any} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
10
src/app/dev/admin/investasi/sub-menu/reject/page.tsx
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { Admin_TableRejectInvestasi } from "@/app_modules/admin/investasi";
|
||||||
|
import Admin_funGetAllInvestasi from "@/app_modules/admin/investasi/fun/get_all_investasi";
|
||||||
|
|
||||||
|
export default async function Page() {
|
||||||
|
const dataInvestsi = await Admin_funGetAllInvestasi()
|
||||||
|
return <>
|
||||||
|
<Admin_TableRejectInvestasi dataInvestsi={dataInvestsi as any}/>
|
||||||
|
|
||||||
|
</>
|
||||||
|
}
|
||||||
9
src/app/dev/admin/investasi/sub-menu/review/page.tsx
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { Admin_TableReviewInvestasi } from "@/app_modules/admin/investasi";
|
||||||
|
import Admin_funGetAllInvestasi from "@/app_modules/admin/investasi/fun/get_all_investasi";
|
||||||
|
|
||||||
|
export default async function Page() {
|
||||||
|
const dataInvestsi = await Admin_funGetAllInvestasi()
|
||||||
|
return <>
|
||||||
|
<Admin_TableReviewInvestasi dataInvestsi={dataInvestsi as any}/>
|
||||||
|
</>
|
||||||
|
}
|
||||||
@@ -2,11 +2,11 @@ import { AdminUserAccess_View } from "@/app_modules/admin/user-access";
|
|||||||
import adminUserAccess_getListUser from "@/app_modules/admin/user-access/fun/get/get_list_all_user";
|
import adminUserAccess_getListUser from "@/app_modules/admin/user-access/fun/get/get_list_all_user";
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
const listUser = await adminUserAccess_getListUser()
|
const listUser = await adminUserAccess_getListUser({ page: 1 });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AdminUserAccess_View listUser={listUser as any} />
|
<AdminUserAccess_View listUser={listUser as any} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ export default async function Page({ params }: { params: { id: string } }) {
|
|||||||
let invoiceId = params.id;
|
let invoiceId = params.id;
|
||||||
const dataDonasi = await Donasi_getOneInvoiceById(invoiceId);
|
const dataDonasi = await Donasi_getOneInvoiceById(invoiceId);
|
||||||
const countDonatur= await Donasi_getCountDonatur(dataDonasi?.donasiId as any)
|
const countDonatur= await Donasi_getCountDonatur(dataDonasi?.donasiId as any)
|
||||||
console.log(dataDonasi?.Donasi?.progres)
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { MasukanDonasi } from "@/app_modules/donasi";
|
import { MasukanDonasi } from "@/app_modules/donasi";
|
||||||
|
|
||||||
export default async function Page({params}: {params : {id: string}}) {
|
export default async function Page({ params }: { params: { id: string } }) {
|
||||||
let donasiId = params.id
|
let donasiId = params.id;
|
||||||
return <MasukanDonasi donasiId={donasiId}/>
|
return <MasukanDonasi donasiId={donasiId} />;
|
||||||
}
|
}
|
||||||
|
|||||||
9
src/app/lib/router_admin/router_admin_donasi.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
export const RouterAdminDonasi = {
|
||||||
|
main: "/dev/admin/donasi/main",
|
||||||
|
table_publish: "/dev/admin/donasi/sub-menu/publish",
|
||||||
|
table_review: "/dev/admin/donasi/sub-menu/review",
|
||||||
|
table_reject: "/dev/admin/donasi/sub-menu/reject",
|
||||||
|
table_kategori: "/dev/admin/donasi/sub-menu/kategori",
|
||||||
|
transfer_invoice: "/dev/admin/donasi/sub-detail/transfer-invoice/",
|
||||||
|
informasi: "/dev/admin/donasi/sub-menu/informasi",
|
||||||
|
};
|
||||||
6
src/app/lib/router_admin/router_admin_investasi.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export const RouterAdminInvestasi = {
|
||||||
|
main: "/dev/admin/investasi/main",
|
||||||
|
table_publish: "/dev/admin/investasi/sub-menu/publish",
|
||||||
|
table_review: "/dev/admin/investasi/sub-menu/review",
|
||||||
|
table_reject: "/dev/admin/investasi/sub-menu/reject",
|
||||||
|
};
|
||||||
3
src/app/lib/router_admin/router_app_information.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export const RouterAdminAppInformation = {
|
||||||
|
main: "/dev/admin/app-information/main",
|
||||||
|
};
|
||||||
@@ -3,7 +3,7 @@ export const RouterAdminDashboard = {
|
|||||||
splash_admin: "/dev/splash/admin",
|
splash_admin: "/dev/splash/admin",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const RouterAdminInvestasi = {
|
export const RouterAdminInvestasi_OLD = {
|
||||||
main_investasi: "/dev/admin/investasi/main",
|
main_investasi: "/dev/admin/investasi/main",
|
||||||
halaman_aksi: "/dev/admin/investasi/halaman_aksi/",
|
halaman_aksi: "/dev/admin/investasi/halaman_aksi/",
|
||||||
konfirmasi: "/dev/admin/investasi/konfirmasi/",
|
konfirmasi: "/dev/admin/investasi/konfirmasi/",
|
||||||
@@ -14,7 +14,7 @@ export const RouterAdminInvestasi = {
|
|||||||
table_status_reject: "/dev/admin/investasi/table_status/reject",
|
table_status_reject: "/dev/admin/investasi/table_status/reject",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const RouterAdminDonasi = {
|
export const RouterAdminDonasi_OLD = {
|
||||||
api_gambar_bukti_transfer: "/api/donasi/gambar_bukti_transfer/",
|
api_gambar_bukti_transfer: "/api/donasi/gambar_bukti_transfer/",
|
||||||
|
|
||||||
main_donasi: "/dev/admin/donasi/main",
|
main_donasi: "/dev/admin/donasi/main",
|
||||||
|
|||||||
2
src/app_modules/admin/app-info/index.ts
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
import AdminAppInformation_MainView from "./main";
|
||||||
|
export { AdminAppInformation_MainView };
|
||||||
45
src/app_modules/admin/app-info/main/index.tsx
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { Group, Stack, Text, Title } from "@mantine/core";
|
||||||
|
import { list } from "postcss";
|
||||||
|
import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate";
|
||||||
|
|
||||||
|
export default function AdminAppInformation_MainView() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack h={"100%"}>
|
||||||
|
<ComponentAdminGlobal_HeaderTamplate name="App Information" />
|
||||||
|
<InformasiWhatApps />
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function InformasiWhatApps() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack spacing={"xs"}>
|
||||||
|
<Group
|
||||||
|
position="apart"
|
||||||
|
bg={"gray.4"}
|
||||||
|
p={"xs"}
|
||||||
|
style={{ borderRadius: "6px" }}
|
||||||
|
>
|
||||||
|
<Title order={4}>Informasi WhatsApp</Title>
|
||||||
|
{/* <TextInput
|
||||||
|
icon={<IconSearch size={20} />}
|
||||||
|
radius={"xl"}
|
||||||
|
placeholder="Masukan username"
|
||||||
|
onChange={(val) => {
|
||||||
|
onSearch(val.currentTarget.value);
|
||||||
|
}}
|
||||||
|
/> */}
|
||||||
|
</Group>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import { Center, Text } from "@mantine/core";
|
||||||
|
import { notifications } from "@mantine/notifications";
|
||||||
|
import {
|
||||||
|
IconAlertTriangle,
|
||||||
|
IconChecklist,
|
||||||
|
IconCircleCheck,
|
||||||
|
} from "@tabler/icons-react";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param text | masukan text untuk peringatan
|
||||||
|
* @type string
|
||||||
|
* @param durasi | durasi autoClose
|
||||||
|
* @type number
|
||||||
|
* @returns notifikasi berhasil warna hijau
|
||||||
|
*/
|
||||||
|
export async function ComponentGlobalAdmin_NotifikasiBerhasil(
|
||||||
|
text: string,
|
||||||
|
durasi?: number
|
||||||
|
) {
|
||||||
|
return notifications.show({
|
||||||
|
message: (
|
||||||
|
<Center>
|
||||||
|
<Text fw={"bold"}>{text}</Text>
|
||||||
|
</Center>
|
||||||
|
),
|
||||||
|
color: "green",
|
||||||
|
radius: "md",
|
||||||
|
autoClose: durasi ? durasi : 2000,
|
||||||
|
icon: <IconCircleCheck color="white" />,
|
||||||
|
withCloseButton: false,
|
||||||
|
|
||||||
|
styles: (theme) => ({
|
||||||
|
description: { color: theme.white },
|
||||||
|
root: {
|
||||||
|
backgroundColor: theme.colors.green[7],
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
import { Center, Text } from "@mantine/core";
|
||||||
|
import { notifications } from "@mantine/notifications";
|
||||||
|
import { IconAlertTriangle } from "@tabler/icons-react";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param text | masukan text untuk peringatan
|
||||||
|
* @type string
|
||||||
|
* @returns notifikasi peringatan
|
||||||
|
*/
|
||||||
|
export async function ComponentGlobalAdmin_NotifikasiGagal(text: string) {
|
||||||
|
return notifications.show({
|
||||||
|
message: (
|
||||||
|
<Center>
|
||||||
|
<Text fw={"bold"}>{text}</Text>
|
||||||
|
</Center>
|
||||||
|
),
|
||||||
|
color: "red",
|
||||||
|
radius: "md",
|
||||||
|
autoClose: 2000,
|
||||||
|
icon: <IconAlertTriangle color="white" />,
|
||||||
|
withCloseButton: false,
|
||||||
|
|
||||||
|
styles: (theme) => ({
|
||||||
|
description: { color: theme.white },
|
||||||
|
root: {
|
||||||
|
backgroundColor: theme.colors.red[7],
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import { ActionIcon, Avatar, Center, Text } from "@mantine/core";
|
||||||
|
import { notifications } from "@mantine/notifications";
|
||||||
|
import { IconAlertTriangle } from "@tabler/icons-react";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param text | masukan text untuk peringatan
|
||||||
|
* @type string
|
||||||
|
* @returns notifikasi peringatan
|
||||||
|
*/
|
||||||
|
export async function ComponentGlobalAdmin_NotifikasiPeringatan(
|
||||||
|
text: string,
|
||||||
|
durasi?: number
|
||||||
|
) {
|
||||||
|
return notifications.show({
|
||||||
|
message: (
|
||||||
|
<Center>
|
||||||
|
<Text fw={"bold"}>{text}</Text>
|
||||||
|
</Center>
|
||||||
|
),
|
||||||
|
color: "yellow.1",
|
||||||
|
radius: "md",
|
||||||
|
autoClose: durasi ? durasi : 2000,
|
||||||
|
style: {
|
||||||
|
borderWidth: "0.5px",
|
||||||
|
borderStyle: "solid",
|
||||||
|
borderColor: "red"
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
icon: (
|
||||||
|
<ActionIcon variant="transparent" radius={"xl"} p={3}>
|
||||||
|
<IconAlertTriangle
|
||||||
|
color="red"
|
||||||
|
style={{ backgroundColor: "transparent" }}
|
||||||
|
/>
|
||||||
|
</ActionIcon>
|
||||||
|
),
|
||||||
|
withCloseButton: false,
|
||||||
|
|
||||||
|
styles: (theme) => ({
|
||||||
|
description: { color: theme.white },
|
||||||
|
root: {
|
||||||
|
backgroundColor: theme.colors.orange[5],
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
34
src/app_modules/admin/component/back_button.tsx
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { Group, Button, Loader } from "@mantine/core";
|
||||||
|
import { IconChevronLeft } from "@tabler/icons-react";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
export default function ComponentGlobalAdmin_BackButton() {
|
||||||
|
const router = useRouter();
|
||||||
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Group>
|
||||||
|
<Button
|
||||||
|
// loaderPosition="center"
|
||||||
|
// loading={isLoading ? true : false}
|
||||||
|
c={"gray"}
|
||||||
|
leftIcon={
|
||||||
|
isLoading ? <Loader size={"xs"} color={"gray"} /> : <IconChevronLeft />
|
||||||
|
}
|
||||||
|
variant="white"
|
||||||
|
onClick={() => {
|
||||||
|
setLoading(true);
|
||||||
|
// setTimeout(() => , 3000);
|
||||||
|
router.back();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Kembali
|
||||||
|
</Button>
|
||||||
|
</Group>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@ import { Box, Title, Divider, Stack } from "@mantine/core";
|
|||||||
export default function ComponentAdminGlobal_HeaderTamplate({name}: {name: string}) {
|
export default function ComponentAdminGlobal_HeaderTamplate({name}: {name: string}) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack spacing={"xs"} >
|
<Stack spacing={5} >
|
||||||
<Title>{name ? name : null}</Title>
|
<Title>{name ? name : null}</Title>
|
||||||
<Divider/>
|
<Divider/>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
"use server"
|
"use server";
|
||||||
import prisma from "@/app/lib/prisma"
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
import _, { ceil } from "lodash";
|
import _, { ceil } from "lodash";
|
||||||
|
|
||||||
export default async function adminDeveloper_funGetListAllAdmin({ search, page }: { search?: any, page: any }) {
|
export default async function adminDeveloper_funGetListAllAdmin({
|
||||||
const dataSkip = _.toNumber(page) * 9 - 9
|
search,
|
||||||
|
page,
|
||||||
|
}: {
|
||||||
|
search?: any;
|
||||||
|
page: any;
|
||||||
|
}) {
|
||||||
|
const dataSkip = _.toNumber(page) * 9 - 9;
|
||||||
const data = await prisma.user.findMany({
|
const data = await prisma.user.findMany({
|
||||||
skip: dataSkip,
|
skip: dataSkip,
|
||||||
take: 9,
|
take: 9,
|
||||||
@@ -14,8 +21,8 @@ export default async function adminDeveloper_funGetListAllAdmin({ search, page }
|
|||||||
masterUserRoleId: "2",
|
masterUserRoleId: "2",
|
||||||
username: {
|
username: {
|
||||||
contains: search,
|
contains: search,
|
||||||
mode: 'insensitive'
|
mode: "insensitive",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -24,15 +31,15 @@ export default async function adminDeveloper_funGetListAllAdmin({ search, page }
|
|||||||
masterUserRoleId: "2",
|
masterUserRoleId: "2",
|
||||||
username: {
|
username: {
|
||||||
contains: search,
|
contains: search,
|
||||||
mode: 'insensitive'
|
mode: "insensitive",
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
|
|
||||||
const allData = {
|
const allData = {
|
||||||
data: data,
|
data: data,
|
||||||
nPage: ceil(nCount / 9)
|
nPage: ceil(nCount / 9),
|
||||||
}
|
};
|
||||||
|
|
||||||
return allData;
|
return allData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,14 @@
|
|||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
import _, { ceil } from "lodash";
|
import _, { ceil } from "lodash";
|
||||||
|
|
||||||
export default async function adminDeveloper_funGetListAllUser({ search, page }: { search?: any, page: any }) {
|
export default async function adminDeveloper_funGetListAllUser({
|
||||||
const dataSkip = _.toNumber(page) * 9 - 9
|
search,
|
||||||
|
page,
|
||||||
|
}: {
|
||||||
|
search?: any;
|
||||||
|
page: any;
|
||||||
|
}) {
|
||||||
|
const dataSkip = _.toNumber(page) * 9 - 9;
|
||||||
|
|
||||||
const data = await prisma.user.findMany({
|
const data = await prisma.user.findMany({
|
||||||
skip: dataSkip,
|
skip: dataSkip,
|
||||||
@@ -15,8 +21,8 @@ export default async function adminDeveloper_funGetListAllUser({ search, page }:
|
|||||||
masterUserRoleId: "1",
|
masterUserRoleId: "1",
|
||||||
username: {
|
username: {
|
||||||
contains: search,
|
contains: search,
|
||||||
mode: 'insensitive'
|
mode: "insensitive",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -25,15 +31,15 @@ export default async function adminDeveloper_funGetListAllUser({ search, page }:
|
|||||||
masterUserRoleId: "1",
|
masterUserRoleId: "1",
|
||||||
username: {
|
username: {
|
||||||
contains: search,
|
contains: search,
|
||||||
mode: 'insensitive'
|
mode: "insensitive",
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
|
|
||||||
const allData = {
|
const allData = {
|
||||||
data: data,
|
data: data,
|
||||||
nPage: ceil(nCount / 9)
|
nPage: ceil(nCount / 9),
|
||||||
}
|
};
|
||||||
|
|
||||||
return allData;
|
return allData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,12 +29,12 @@ export default function AdminDeveloper({
|
|||||||
listUser,
|
listUser,
|
||||||
listAdmin,
|
listAdmin,
|
||||||
pUser,
|
pUser,
|
||||||
pAdmin
|
pAdmin,
|
||||||
}: {
|
}: {
|
||||||
listUser: MODEL_USER[];
|
listUser: MODEL_USER[];
|
||||||
listAdmin: MODEL_USER[];
|
listAdmin: MODEL_USER[];
|
||||||
pUser: any,
|
pUser: any;
|
||||||
pAdmin: any
|
pAdmin: any;
|
||||||
}) {
|
}) {
|
||||||
const [dataUser, setDataUser] = useState(listUser);
|
const [dataUser, setDataUser] = useState(listUser);
|
||||||
const [dataAdmin, setDataAdmin] = useState(listAdmin);
|
const [dataAdmin, setDataAdmin] = useState(listAdmin);
|
||||||
@@ -56,16 +56,20 @@ export default function AdminDeveloper({
|
|||||||
setDataUser={setDataUser}
|
setDataUser={setDataUser}
|
||||||
setDataAdmin={setDataAdmin}
|
setDataAdmin={setDataAdmin}
|
||||||
/> */}
|
/> */}
|
||||||
<NewTableAdmin data={dataAdmin} nPage={pageAdmin}
|
<NewTableAdmin
|
||||||
|
data={dataAdmin}
|
||||||
|
nPage={pageAdmin}
|
||||||
onUpdated={(val) => {
|
onUpdated={(val) => {
|
||||||
setDataUser(val.data)
|
setDataUser(val.data);
|
||||||
setPageUser(val.nPage)
|
setPageUser(val.nPage);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<NewTableUser data={dataUser} nPage={pageUser}
|
<NewTableUser
|
||||||
|
data={dataUser}
|
||||||
|
nPage={pageUser}
|
||||||
onUpdated={(val) => {
|
onUpdated={(val) => {
|
||||||
setDataAdmin(val.data)
|
setDataAdmin(val.data);
|
||||||
setPageAdmin(val.nPage)
|
setPageAdmin(val.nPage);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
@@ -74,48 +78,66 @@ export default function AdminDeveloper({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function NewTableUser({ data, nPage, onUpdated }: { data: any, nPage: any, onUpdated: (val: any) => void }) {
|
function NewTableUser({
|
||||||
const [isChoosePage, setChoosePage] = useState(1)
|
data,
|
||||||
const [dataUser, setDataUser] = useState(data)
|
nPage,
|
||||||
const [isNPage, setNPage] = useState(nPage)
|
onUpdated,
|
||||||
const [isSearch, setSearch] = useState('')
|
}: {
|
||||||
|
data: any;
|
||||||
|
nPage: any;
|
||||||
|
onUpdated: (val: any) => void;
|
||||||
|
}) {
|
||||||
|
const [isChoosePage, setChoosePage] = useState(1);
|
||||||
|
const [dataUser, setDataUser] = useState(data);
|
||||||
|
const [isNPage, setNPage] = useState(nPage);
|
||||||
|
const [isSearch, setSearch] = useState("");
|
||||||
|
|
||||||
async function onPageClick(p: any) {
|
async function onPageClick(p: any) {
|
||||||
setChoosePage(p)
|
setChoosePage(p);
|
||||||
const loadData = await adminDeveloper_funGetListAllUser({ search: isSearch, page: p })
|
const loadData = await adminDeveloper_funGetListAllUser({
|
||||||
setDataUser(loadData.data)
|
search: isSearch,
|
||||||
setNPage(loadData.nPage)
|
page: p,
|
||||||
|
});
|
||||||
|
setDataUser(loadData.data);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onSearch(s: any) {
|
async function onSearch(s: any) {
|
||||||
setSearch(s)
|
setSearch(s);
|
||||||
setChoosePage(1)
|
setChoosePage(1);
|
||||||
const loadData = await adminDeveloper_funGetListAllUser({ search: s, page: 1 })
|
const loadData = await adminDeveloper_funGetListAllUser({
|
||||||
setDataUser(loadData.data)
|
search: s,
|
||||||
setNPage(loadData.nPage)
|
page: 1,
|
||||||
|
});
|
||||||
|
setDataUser(loadData.data);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onAccess(id: string) {
|
async function onAccess(id: string) {
|
||||||
const upd = await adminDeveloper_funEditUserAksesById(id, "2")
|
const upd = await adminDeveloper_funEditUserAksesById(id, "2");
|
||||||
if (upd.status == 200) {
|
if (upd.status == 200) {
|
||||||
const loadData = await adminDeveloper_funGetListAllUser({ search: isSearch, page: isChoosePage })
|
const loadData = await adminDeveloper_funGetListAllUser({
|
||||||
setDataUser(loadData.data)
|
search: isSearch,
|
||||||
setNPage(loadData.nPage)
|
page: isChoosePage,
|
||||||
const loadDataAdmin = await adminDeveloper_funGetListAllAdmin({ page: 1 })
|
});
|
||||||
onUpdated(loadDataAdmin)
|
setDataUser(loadData.data);
|
||||||
ComponentGlobal_NotifikasiBerhasil(upd.message)
|
setNPage(loadData.nPage);
|
||||||
|
const loadDataAdmin = await adminDeveloper_funGetListAllAdmin({
|
||||||
|
page: 1,
|
||||||
|
});
|
||||||
|
onUpdated(loadDataAdmin);
|
||||||
|
ComponentGlobal_NotifikasiBerhasil(upd.message);
|
||||||
} else {
|
} else {
|
||||||
ComponentGlobal_NotifikasiGagal(upd.message)
|
ComponentGlobal_NotifikasiGagal(upd.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setDataUser(data)
|
setDataUser(data);
|
||||||
setNPage(nPage)
|
setNPage(nPage);
|
||||||
setSearch('')
|
setSearch("");
|
||||||
setChoosePage(1)
|
setChoosePage(1);
|
||||||
}, [data, nPage])
|
}, [data, nPage]);
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -132,7 +154,7 @@ function NewTableUser({ data, nPage, onUpdated }: { data: any, nPage: any, onUpd
|
|||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
placeholder="Masukan username"
|
placeholder="Masukan username"
|
||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
onSearch(val.currentTarget.value)
|
onSearch(val.currentTarget.value);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Group>
|
</Group>
|
||||||
@@ -168,9 +190,7 @@ function NewTableUser({ data, nPage, onUpdated }: { data: any, nPage: any, onUpd
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center>
|
<Center>
|
||||||
<Button radius={"xl"}
|
<Button radius={"xl"} onClick={() => onAccess(v.id)}>
|
||||||
onClick={() => onAccess(v.id)}
|
|
||||||
>
|
|
||||||
Admin Access
|
Admin Access
|
||||||
</Button>
|
</Button>
|
||||||
</Center>
|
</Center>
|
||||||
@@ -183,7 +203,7 @@ function NewTableUser({ data, nPage, onUpdated }: { data: any, nPage: any, onUpd
|
|||||||
<Pagination
|
<Pagination
|
||||||
value={isChoosePage}
|
value={isChoosePage}
|
||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
onPageClick(val)
|
onPageClick(val);
|
||||||
}}
|
}}
|
||||||
total={isNPage}
|
total={isNPage}
|
||||||
/>
|
/>
|
||||||
@@ -191,50 +211,67 @@ function NewTableUser({ data, nPage, onUpdated }: { data: any, nPage: any, onUpd
|
|||||||
</Paper>
|
</Paper>
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function NewTableAdmin({ data, nPage, onUpdated }: { data: any, nPage: any, onUpdated: (val: any) => void }) {
|
function NewTableAdmin({
|
||||||
const [isChoosePage, setChoosePage] = useState(1)
|
data,
|
||||||
const [dataAdmin, setDataAdmin] = useState(data)
|
nPage,
|
||||||
const [isNPage, setNPage] = useState(nPage)
|
onUpdated,
|
||||||
const [isSearch, setSearch] = useState('')
|
}: {
|
||||||
|
data: any;
|
||||||
|
nPage: any;
|
||||||
|
onUpdated: (val: any) => void;
|
||||||
|
}) {
|
||||||
|
const [isChoosePage, setChoosePage] = useState(1);
|
||||||
|
const [dataAdmin, setDataAdmin] = useState(data);
|
||||||
|
const [isNPage, setNPage] = useState(nPage);
|
||||||
|
const [isSearch, setSearch] = useState("");
|
||||||
|
|
||||||
async function onPageClick(p: any) {
|
async function onPageClick(p: any) {
|
||||||
setChoosePage(p)
|
setChoosePage(p);
|
||||||
const loadData = await adminDeveloper_funGetListAllAdmin({ search: isSearch, page: p })
|
const loadData = await adminDeveloper_funGetListAllAdmin({
|
||||||
setDataAdmin(loadData.data)
|
search: isSearch,
|
||||||
setNPage(loadData.nPage)
|
page: p,
|
||||||
|
});
|
||||||
|
setDataAdmin(loadData.data);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onSearch(s: any) {
|
async function onSearch(s: any) {
|
||||||
setSearch(s)
|
setSearch(s);
|
||||||
setChoosePage(1)
|
setChoosePage(1);
|
||||||
const loadData = await adminDeveloper_funGetListAllAdmin({ search: s, page: 1 })
|
const loadData = await adminDeveloper_funGetListAllAdmin({
|
||||||
setDataAdmin(loadData.data)
|
search: s,
|
||||||
setNPage(loadData.nPage)
|
page: 1,
|
||||||
|
});
|
||||||
|
setDataAdmin(loadData.data);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onAccess(id: string) {
|
async function onAccess(id: string) {
|
||||||
const upd = await adminDeveloper_funEditUserAksesById(id, "1")
|
const upd = await adminDeveloper_funEditUserAksesById(id, "1");
|
||||||
if (upd.status == 200) {
|
if (upd.status == 200) {
|
||||||
const loadData = await adminDeveloper_funGetListAllAdmin({ search: isSearch, page: isChoosePage })
|
const loadData = await adminDeveloper_funGetListAllAdmin({
|
||||||
setDataAdmin(loadData.data)
|
search: isSearch,
|
||||||
setNPage(loadData.nPage)
|
page: isChoosePage,
|
||||||
const loadDataUser = await adminDeveloper_funGetListAllUser({ page: 1 })
|
});
|
||||||
onUpdated(loadDataUser)
|
setDataAdmin(loadData.data);
|
||||||
ComponentGlobal_NotifikasiBerhasil(upd.message)
|
setNPage(loadData.nPage);
|
||||||
|
const loadDataUser = await adminDeveloper_funGetListAllUser({ page: 1 });
|
||||||
|
onUpdated(loadDataUser);
|
||||||
|
ComponentGlobal_NotifikasiBerhasil(upd.message);
|
||||||
} else {
|
} else {
|
||||||
ComponentGlobal_NotifikasiGagal(upd.message)
|
ComponentGlobal_NotifikasiGagal(upd.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setDataAdmin(data)
|
setDataAdmin(data);
|
||||||
setNPage(nPage)
|
setNPage(nPage);
|
||||||
setSearch('')
|
setSearch("");
|
||||||
setChoosePage(1)
|
setChoosePage(1);
|
||||||
}, [data, nPage])
|
}, [data, nPage]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -251,7 +288,7 @@ function NewTableAdmin({ data, nPage, onUpdated }: { data: any, nPage: any, onUp
|
|||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
placeholder="Masukan username"
|
placeholder="Masukan username"
|
||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
onSearch(val.currentTarget.value)
|
onSearch(val.currentTarget.value);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Group>
|
</Group>
|
||||||
@@ -287,7 +324,9 @@ function NewTableAdmin({ data, nPage, onUpdated }: { data: any, nPage: any, onUp
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center>
|
<Center>
|
||||||
<Button radius={"xl"} color="red"
|
<Button
|
||||||
|
radius={"xl"}
|
||||||
|
color="red"
|
||||||
onClick={() => onAccess(v.id)}
|
onClick={() => onAccess(v.id)}
|
||||||
>
|
>
|
||||||
Delete Access
|
Delete Access
|
||||||
@@ -302,7 +341,7 @@ function NewTableAdmin({ data, nPage, onUpdated }: { data: any, nPage: any, onUp
|
|||||||
<Pagination
|
<Pagination
|
||||||
value={isChoosePage}
|
value={isChoosePage}
|
||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
onPageClick(val)
|
onPageClick(val);
|
||||||
}}
|
}}
|
||||||
total={isNPage}
|
total={isNPage}
|
||||||
/>
|
/>
|
||||||
@@ -310,11 +349,9 @@ function NewTableAdmin({ data, nPage, onUpdated }: { data: any, nPage: any, onUp
|
|||||||
</Paper>
|
</Paper>
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function TableAdmin({
|
function TableAdmin({
|
||||||
dataAdmin,
|
dataAdmin,
|
||||||
setDataAdmin,
|
setDataAdmin,
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import { AdminDonasi_funUpdateCatatanReject } from "../fun/update/fun_update_cat
|
|||||||
import { NotifBerhasil } from "@/app_modules/donasi/component/notifikasi/notif_berhasil";
|
import { NotifBerhasil } from "@/app_modules/donasi/component/notifikasi/notif_berhasil";
|
||||||
import { NotifGagal } from "@/app_modules/donasi/component/notifikasi/notif_gagal";
|
import { NotifGagal } from "@/app_modules/donasi/component/notifikasi/notif_gagal";
|
||||||
import { AdminDonasi_getOneById } from "../fun/get/get_one_by_id";
|
import { AdminDonasi_getOneById } from "../fun/get/get_one_by_id";
|
||||||
|
import ComponentGlobal_InputCountDown from "@/app_modules/component_global/input_countdown";
|
||||||
|
|
||||||
export default function AdminDonasi_DetailReject({
|
export default function AdminDonasi_DetailReject({
|
||||||
dataReject,
|
dataReject,
|
||||||
@@ -66,11 +67,11 @@ function ButtonOnHeader({
|
|||||||
donasiId: string;
|
donasiId: string;
|
||||||
setDonasi: any;
|
setDonasi: any;
|
||||||
}) {
|
}) {
|
||||||
const [catat, setCatat] = useState(catatan);
|
const [report, setReport] = useState(catatan);
|
||||||
const [opened, { open, close }] = useDisclosure(false);
|
const [opened, { open, close }] = useDisclosure(false);
|
||||||
|
|
||||||
async function onUpdate() {
|
async function onUpdate() {
|
||||||
await AdminDonasi_funUpdateCatatanReject(donasiId, catat).then(
|
await AdminDonasi_funUpdateCatatanReject(donasiId, report).then(
|
||||||
async (res) => {
|
async (res) => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
NotifBerhasil(res.message);
|
NotifBerhasil(res.message);
|
||||||
@@ -94,19 +95,45 @@ function ButtonOnHeader({
|
|||||||
</Group>
|
</Group>
|
||||||
<Divider />
|
<Divider />
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
opened={opened}
|
opened={opened}
|
||||||
onClose={close}
|
onClose={close}
|
||||||
centered
|
centered
|
||||||
title="Tambah catatan penolakan"
|
size={"lg"}
|
||||||
|
withCloseButton={false}
|
||||||
>
|
>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Textarea
|
<Textarea
|
||||||
value={catat}
|
autosize
|
||||||
onChange={(val) => setCatat(val.target.value)}
|
minRows={3}
|
||||||
|
maxRows={5}
|
||||||
|
maxLength={300}
|
||||||
|
label="Update alasan penolakan"
|
||||||
|
placeholder="Masukan alasan penolakan"
|
||||||
|
value={report}
|
||||||
|
onChange={(val) => setReport(val.target.value)}
|
||||||
/>
|
/>
|
||||||
|
<ComponentGlobal_InputCountDown
|
||||||
|
maxInput={300}
|
||||||
|
lengthInput={report.length}
|
||||||
|
/>
|
||||||
|
|
||||||
<Group position="right">
|
<Group position="right">
|
||||||
<Button radius="xl" onClick={() => onUpdate()}>
|
<Button
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={() => {
|
||||||
|
close();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Batal
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={() => {
|
||||||
|
onUpdate();
|
||||||
|
}}
|
||||||
|
>
|
||||||
Simpan
|
Simpan
|
||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
@@ -33,17 +33,24 @@ import toast from "react-simple-toasts";
|
|||||||
import { AdminDonasi_funUpdateStatusReject } from "../fun/update/fun_status_reject";
|
import { AdminDonasi_funUpdateStatusReject } from "../fun/update/fun_status_reject";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { NotifGagal } from "@/app_modules/donasi/component/notifikasi/notif_gagal";
|
import { NotifGagal } from "@/app_modules/donasi/component/notifikasi/notif_gagal";
|
||||||
|
import { ComponentGlobalAdmin_NotifikasiPeringatan } from "../../component/admin_notifikasi/notifikasi_peringatan";
|
||||||
|
import ComponentGlobal_InputCountDown from "@/app_modules/component_global/input_countdown";
|
||||||
|
import { ComponentGlobalAdmin_NotifikasiBerhasil } from "../../component/admin_notifikasi/notifikasi_berhasil";
|
||||||
|
import { ComponentGlobalAdmin_NotifikasiGagal } from "../../component/admin_notifikasi/notifikasi_gagal";
|
||||||
|
import adminDonasi_getListReview from "../fun/get/get_list_review";
|
||||||
|
import { AdminDonasi_getOneById } from "../fun/get/get_one_by_id";
|
||||||
|
|
||||||
export default function AdminDonasi_DetailReview({
|
export default function AdminDonasi_DetailReview({
|
||||||
dataReview,
|
dataReview,
|
||||||
}: {
|
}: {
|
||||||
dataReview: MODEL_DONASI;
|
dataReview: MODEL_DONASI;
|
||||||
}) {
|
}) {
|
||||||
const [donasi, setDonasi] = useState(dataReview);
|
const [data, setData] = useState(dataReview);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack>
|
||||||
<ButtonOnHeader donasi={donasi} />
|
<ButtonOnHeader donasi={data} setData={setData} />
|
||||||
<SimpleGrid
|
<SimpleGrid
|
||||||
cols={2}
|
cols={2}
|
||||||
spacing="lg"
|
spacing="lg"
|
||||||
@@ -53,40 +60,62 @@ export default function AdminDonasi_DetailReview({
|
|||||||
{ maxWidth: "xs", cols: 1, spacing: "xs" },
|
{ maxWidth: "xs", cols: 1, spacing: "xs" },
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<TampilanDetailDonasi donasi={donasi} />
|
<TampilanDetailDonasi donasi={data} />
|
||||||
<CeritaPenggalangDana cerita={donasi.CeritaDonasi} />
|
<CeritaPenggalangDana cerita={data.CeritaDonasi} />
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ButtonOnHeader({ donasi }: { donasi: MODEL_DONASI }) {
|
function ButtonOnHeader({
|
||||||
|
donasi,
|
||||||
|
setData,
|
||||||
|
}: {
|
||||||
|
donasi: MODEL_DONASI;
|
||||||
|
setData: any;
|
||||||
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const [isLoadingPublish, setLoadingPublish] = useState(false);
|
||||||
|
const [isLoadingReject, setLoadingReject] = useState(false);
|
||||||
const [opened, { open, close }] = useDisclosure(false);
|
const [opened, { open, close }] = useDisclosure(false);
|
||||||
const [catatan, setCatatan] = useState("");
|
const [catatan, setCatatan] = useState("");
|
||||||
|
|
||||||
async function onPulish() {
|
async function onPulish() {
|
||||||
await AdminDonasi_funUpdateStatusPublish(donasi.id, "1").then((res) => {
|
await AdminDonasi_funUpdateStatusPublish(donasi.id, "1").then(
|
||||||
if (res.status === 200) {
|
async (res) => {
|
||||||
NotifBerhasil("Berhasil Mengubah Status Donasi");
|
if (res.status === 200) {
|
||||||
router.back();
|
const newData = await AdminDonasi_getOneById(donasi?.id);
|
||||||
} else {
|
setData(newData);
|
||||||
NotifPeringatan("Gagal Mengubah Status Donasi");
|
ComponentGlobalAdmin_NotifikasiBerhasil(
|
||||||
|
"Berhasil Mengubah Status Donasi"
|
||||||
|
);
|
||||||
|
setLoadingPublish(true);
|
||||||
|
} else {
|
||||||
|
ComponentGlobalAdmin_NotifikasiPeringatan(
|
||||||
|
"Gagal Mengubah Status Donasi"
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onReject() {
|
async function onReject() {
|
||||||
if (catatan === "") return NotifPeringatan("Lengkapi Alasan Penolakan");
|
if (catatan === "")
|
||||||
|
return ComponentGlobalAdmin_NotifikasiPeringatan(
|
||||||
|
"Lengkapi Alasan Penolakan"
|
||||||
|
);
|
||||||
|
|
||||||
await AdminDonasi_funUpdateStatusReject(donasi.id, "4", catatan).then(
|
await AdminDonasi_funUpdateStatusReject(donasi.id, "4", catatan).then(
|
||||||
(res) => {
|
async (res) => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
NotifBerhasil(res.message);
|
const newData = await AdminDonasi_getOneById(donasi?.id);
|
||||||
router.back();
|
setData(newData);
|
||||||
|
close();
|
||||||
|
ComponentGlobalAdmin_NotifikasiBerhasil(res.message);
|
||||||
|
setLoadingReject(true);
|
||||||
} else {
|
} else {
|
||||||
NotifGagal(res.message);
|
ComponentGlobalAdmin_NotifikasiGagal(res.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -96,19 +125,23 @@ function ButtonOnHeader({ donasi }: { donasi: MODEL_DONASI }) {
|
|||||||
<>
|
<>
|
||||||
<Group position="apart">
|
<Group position="apart">
|
||||||
<ComponentAdminDonasi_TombolKembali />
|
<ComponentAdminDonasi_TombolKembali />
|
||||||
<Group>
|
{donasi.donasiMaster_StatusDonasiId === "2" ? (
|
||||||
<Button
|
<Group>
|
||||||
radius={"xl"}
|
<Button
|
||||||
bg={"green"}
|
radius={"xl"}
|
||||||
color="green"
|
bg={"green"}
|
||||||
onClick={() => onPulish()}
|
color="green"
|
||||||
>
|
onClick={() => onPulish()}
|
||||||
Publish
|
>
|
||||||
</Button>
|
Publish
|
||||||
<Button radius={"xl"} bg={"red"} color="red" onClick={open}>
|
</Button>
|
||||||
Reject
|
<Button radius={"xl"} bg={"red"} color="red" onClick={open}>
|
||||||
</Button>
|
Reject
|
||||||
</Group>
|
</Button>
|
||||||
|
</Group>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)}
|
||||||
</Group>
|
</Group>
|
||||||
<Divider />
|
<Divider />
|
||||||
|
|
||||||
@@ -124,11 +157,28 @@ function ButtonOnHeader({ donasi }: { donasi: MODEL_DONASI }) {
|
|||||||
autosize
|
autosize
|
||||||
minRows={3}
|
minRows={3}
|
||||||
maxRows={5}
|
maxRows={5}
|
||||||
label="Masukan alasan penolakan"
|
maxLength={300}
|
||||||
|
label="Alasan penolakan"
|
||||||
|
placeholder="Masukan alasan penolakan"
|
||||||
onChange={(val) => setCatatan(val.target.value)}
|
onChange={(val) => setCatatan(val.target.value)}
|
||||||
/>
|
/>
|
||||||
|
<ComponentGlobal_InputCountDown
|
||||||
|
maxInput={300}
|
||||||
|
lengthInput={catatan.length}
|
||||||
|
/>
|
||||||
|
|
||||||
<Group position="right">
|
<Group position="right">
|
||||||
<Button
|
<Button
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={() => {
|
||||||
|
close();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Batal
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
loaderPosition="center"
|
||||||
|
loading={isLoadingReject ? true : false}
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
onReject();
|
onReject();
|
||||||
655
src/app_modules/admin/donasi/detail/publish/detail_publish.tsx
Normal file
@@ -0,0 +1,655 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import {
|
||||||
|
ActionIcon,
|
||||||
|
AspectRatio,
|
||||||
|
Badge,
|
||||||
|
Box,
|
||||||
|
Button,
|
||||||
|
Center,
|
||||||
|
Divider,
|
||||||
|
Grid,
|
||||||
|
Group,
|
||||||
|
Image,
|
||||||
|
Modal,
|
||||||
|
Pagination,
|
||||||
|
Paper,
|
||||||
|
Progress,
|
||||||
|
ScrollArea,
|
||||||
|
Select,
|
||||||
|
SimpleGrid,
|
||||||
|
Spoiler,
|
||||||
|
Stack,
|
||||||
|
Table,
|
||||||
|
Text,
|
||||||
|
TextInput,
|
||||||
|
Title,
|
||||||
|
} from "@mantine/core";
|
||||||
|
import ComponentAdminDonasi_TombolKembali from "../../component/tombol_kembali";
|
||||||
|
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||||
|
import {
|
||||||
|
IconClover,
|
||||||
|
IconMessageChatbot,
|
||||||
|
IconMoneybag,
|
||||||
|
IconReload,
|
||||||
|
} from "@tabler/icons-react";
|
||||||
|
import router from "next/router";
|
||||||
|
import moment from "moment";
|
||||||
|
import {
|
||||||
|
MODEL_DONASI,
|
||||||
|
MODEL_DONASI_INVOICE,
|
||||||
|
MODEL_DONASI_PENCAIRAN_DANA,
|
||||||
|
} from "@/app_modules/donasi/model/interface";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||||
|
import TampilanRupiahDonasi from "@/app_modules/donasi/component/tampilan_rupiah";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { useDisclosure, useInterval, useShallowEffect } from "@mantine/hooks";
|
||||||
|
import { Donasi_getOneById } from "@/app_modules/donasi/fun/get/get_one_donasi_by_id";
|
||||||
|
import { AdminDonasi_getOneById } from "../../fun/get/get_one_by_id";
|
||||||
|
import ComponentGlobalAdmin_BackButton from "@/app_modules/admin/component/back_button";
|
||||||
|
import { MODEL_NEW_DEFAULT_MASTER } from "@/app_modules/model_global/interface";
|
||||||
|
import { adminDonasi_getListDonatur } from "../../fun/get/get_list_donatur_by_id";
|
||||||
|
import { RouterAdminDonasi } from "@/app/lib/router_admin/router_admin_donasi";
|
||||||
|
import adminDonasi_funUpdateStatusDanTotal from "../../fun/update/fun_update_status_dan_total";
|
||||||
|
import { ComponentGlobalAdmin_NotifikasiBerhasil } from "@/app_modules/admin/component/admin_notifikasi/notifikasi_berhasil";
|
||||||
|
import { ComponentGlobalAdmin_NotifikasiGagal } from "@/app_modules/admin/component/admin_notifikasi/notifikasi_gagal";
|
||||||
|
|
||||||
|
export default function AdminDonasi_DetailPublish({
|
||||||
|
dataPublish,
|
||||||
|
listDonatur,
|
||||||
|
countDonatur,
|
||||||
|
listPencairan,
|
||||||
|
listMasterStatus,
|
||||||
|
}: {
|
||||||
|
dataPublish: MODEL_DONASI;
|
||||||
|
listDonatur: any[];
|
||||||
|
countDonatur: number;
|
||||||
|
listPencairan: MODEL_DONASI_PENCAIRAN_DANA[];
|
||||||
|
listMasterStatus: MODEL_NEW_DEFAULT_MASTER[];
|
||||||
|
}) {
|
||||||
|
const [dataDonasi, setDataDonasi] = useState(dataPublish);
|
||||||
|
const [pencairan, setPencairan] = useState(listPencairan);
|
||||||
|
const selectedData = _.omit(dataDonasi, [
|
||||||
|
"Author",
|
||||||
|
"imageDonasi",
|
||||||
|
"CeritaDonasi",
|
||||||
|
"DonasiMaster_Ketegori",
|
||||||
|
"DonasiMaster_Durasi",
|
||||||
|
"DonasiMaster_Status",
|
||||||
|
]);
|
||||||
|
|
||||||
|
// fungsi manggil serveraction
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{/* <pre>{JSON.stringify(pencairan, null, 2)}</pre> */}
|
||||||
|
<Stack>
|
||||||
|
<ComponentGlobalAdmin_BackButton />
|
||||||
|
<TampilanDetailDonasi donasi={dataDonasi} countDonatur={countDonatur} />
|
||||||
|
<TampilanListDonatur
|
||||||
|
donatur={listDonatur}
|
||||||
|
listMasterStatus={listMasterStatus}
|
||||||
|
dataDonasi={selectedData as any}
|
||||||
|
onSuccessDonasi={(val) => {
|
||||||
|
setDataDonasi(val);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<TampilanListPencairan pencairan={pencairan} />
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function TampilanDetailDonasi({
|
||||||
|
donasi,
|
||||||
|
countDonatur,
|
||||||
|
}: {
|
||||||
|
donasi: MODEL_DONASI;
|
||||||
|
countDonatur: number;
|
||||||
|
}) {
|
||||||
|
const [opened, { open, close }] = useDisclosure(false);
|
||||||
|
const router = useRouter();
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Paper radius={"md"} p={"md"}>
|
||||||
|
<Stack>
|
||||||
|
<SimpleGrid
|
||||||
|
cols={3}
|
||||||
|
spacing="lg"
|
||||||
|
breakpoints={[
|
||||||
|
{ maxWidth: "62rem", cols: 3, spacing: "md" },
|
||||||
|
{ maxWidth: "48rem", cols: 2, spacing: "sm" },
|
||||||
|
{ maxWidth: "36rem", cols: 1, spacing: "sm" },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Paper withBorder>
|
||||||
|
<AspectRatio ratio={1 / 1}>
|
||||||
|
<Image
|
||||||
|
// mah={500}
|
||||||
|
// mx={"auto"}
|
||||||
|
alt="Foto"
|
||||||
|
src={RouterDonasi.api_gambar + `${donasi.imagesId}`}
|
||||||
|
/>
|
||||||
|
</AspectRatio>
|
||||||
|
</Paper>
|
||||||
|
|
||||||
|
<Paper withBorder p={"sm"}>
|
||||||
|
<Stack spacing={5}>
|
||||||
|
<Title order={4}>{donasi.title}</Title>
|
||||||
|
<Group>
|
||||||
|
<Text fz={"xs"}>Penggalang Dana</Text>
|
||||||
|
<Title order={5} c="blue">
|
||||||
|
{donasi.Author.username}
|
||||||
|
</Title>
|
||||||
|
</Group>
|
||||||
|
<Group>
|
||||||
|
<Text fz={12}>Durasi</Text>
|
||||||
|
<Title order={5} c="blue">
|
||||||
|
{donasi.DonasiMaster_Durasi.name} hari
|
||||||
|
</Title>
|
||||||
|
</Group>
|
||||||
|
|
||||||
|
<Group>
|
||||||
|
<Text fz={12}>Dana dibutuhkan</Text>
|
||||||
|
<Title order={5} c="blue">
|
||||||
|
<TampilanRupiahDonasi nominal={+donasi.target} />
|
||||||
|
</Title>
|
||||||
|
</Group>
|
||||||
|
<Group>
|
||||||
|
<Text fz={12}>Kategori</Text>
|
||||||
|
<Title order={5} c="blue">
|
||||||
|
{donasi.DonasiMaster_Ketegori.name}
|
||||||
|
</Title>
|
||||||
|
</Group>
|
||||||
|
<Group>
|
||||||
|
<Text fz={12}>Total donatur</Text>
|
||||||
|
<Title order={5} c="blue">
|
||||||
|
{countDonatur}
|
||||||
|
</Title>
|
||||||
|
</Group>
|
||||||
|
<Group>
|
||||||
|
<Text fz={12}>Progres</Text>
|
||||||
|
<Title order={5} c="blue">
|
||||||
|
{donasi.progres} %
|
||||||
|
</Title>
|
||||||
|
</Group>
|
||||||
|
<Group>
|
||||||
|
<Text fz={12}>Dana terkumpul</Text>
|
||||||
|
<Title order={5} c="blue">
|
||||||
|
<TampilanRupiahDonasi nominal={+donasi.terkumpul} />
|
||||||
|
</Title>
|
||||||
|
</Group>
|
||||||
|
{/* <Button w={200} bg={"green.5"} color="green">Pencairan Dana</Button> */}
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
|
||||||
|
<Paper withBorder p={"sm"}>
|
||||||
|
<Stack spacing={"xl"}>
|
||||||
|
<Center>
|
||||||
|
<Title order={4}>Pencairan Dana</Title>
|
||||||
|
</Center>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={"auto"}>
|
||||||
|
<Stack spacing={0}>
|
||||||
|
<Text fz={"xs"}>Total Dana Dicairkan</Text>
|
||||||
|
<Title>
|
||||||
|
<TampilanRupiahDonasi
|
||||||
|
nominal={donasi.totalPencairan}
|
||||||
|
fontSize={14}
|
||||||
|
/>
|
||||||
|
</Title>
|
||||||
|
</Stack>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={"auto"}>
|
||||||
|
<Stack spacing={0}>
|
||||||
|
<Text fz={"xs"}>Bank Tujuan</Text>
|
||||||
|
<Title order={6}>{donasi.namaBank}</Title>
|
||||||
|
</Stack>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={"auto"}>
|
||||||
|
<Stack spacing={0}>
|
||||||
|
<Text fz={"xs"}>Akumulasi Pencairan</Text>
|
||||||
|
<Title order={6}>{donasi.akumulasiPencairan} Kali</Title>
|
||||||
|
</Stack>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={"auto"}>
|
||||||
|
<Stack spacing={0}>
|
||||||
|
<Text fz={"xs"}>Nomor Rekening</Text>
|
||||||
|
<Title order={6}>{donasi.rekening}</Title>
|
||||||
|
</Stack>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={() =>
|
||||||
|
router.push(
|
||||||
|
RouterAdminDonasi_OLD.pencairan_dana + `${donasi.id}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
Cairkan Dana
|
||||||
|
</Button>
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
</SimpleGrid>
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
<Modal opened={opened} onClose={close} centered>
|
||||||
|
<PencairanDana />
|
||||||
|
</Modal>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function PencairanDana() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack>
|
||||||
|
<TextInput label="Masukan nominal" />
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//######################## LIST DONATUR #####################//
|
||||||
|
function TampilanListDonatur({
|
||||||
|
donatur,
|
||||||
|
listMasterStatus,
|
||||||
|
dataDonasi,
|
||||||
|
onSuccessDonasi,
|
||||||
|
}: {
|
||||||
|
donatur: any;
|
||||||
|
listMasterStatus: MODEL_NEW_DEFAULT_MASTER[];
|
||||||
|
dataDonasi: MODEL_DONASI;
|
||||||
|
|
||||||
|
onSuccessDonasi: (val: any) => void;
|
||||||
|
}) {
|
||||||
|
const router = useRouter();
|
||||||
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
const [idData, setIdData] = useState("");
|
||||||
|
const [lisDonatur, setListDonatur] = useState<MODEL_DONASI_INVOICE[]>(
|
||||||
|
donatur.data
|
||||||
|
);
|
||||||
|
const [isNPage, setNPage] = useState(donatur.nPage);
|
||||||
|
const [isActivePage, setActivePage] = useState(1);
|
||||||
|
const [isSelect, setSelect] = useState("");
|
||||||
|
|
||||||
|
async function onRelaod() {
|
||||||
|
const loadData = await adminDonasi_getListDonatur({
|
||||||
|
donasiId: dataDonasi?.id,
|
||||||
|
page: 1,
|
||||||
|
});
|
||||||
|
setSelect("");
|
||||||
|
setListDonatur(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onSelect(s: any) {
|
||||||
|
setSelect(s);
|
||||||
|
const loadData = await adminDonasi_getListDonatur({
|
||||||
|
donasiId: dataDonasi?.id,
|
||||||
|
page: 1,
|
||||||
|
selectStatusId: s,
|
||||||
|
});
|
||||||
|
setListDonatur(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
setActivePage(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onPageClick(p: any) {
|
||||||
|
setActivePage(p);
|
||||||
|
const loadData = await adminDonasi_getListDonatur({
|
||||||
|
donasiId: dataDonasi?.id,
|
||||||
|
page: p,
|
||||||
|
selectStatusId: isSelect,
|
||||||
|
});
|
||||||
|
setListDonatur(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
const tableRows = lisDonatur.map((e, i) => (
|
||||||
|
<tr key={i}>
|
||||||
|
<td>
|
||||||
|
<Center>{e?.Author.username}</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>{e?.DonasiMaster_Bank?.name}</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>
|
||||||
|
<TampilanRupiahDonasi nominal={+e?.nominal} />
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>
|
||||||
|
{new Intl.DateTimeFormat("id-ID", { dateStyle: "full" }).format(
|
||||||
|
e?.createdAt
|
||||||
|
)}
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>
|
||||||
|
<Badge w={150} variant="dot">
|
||||||
|
{e?.DonasiMaster_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>
|
||||||
|
) : (
|
||||||
|
"-"
|
||||||
|
)}
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<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>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack spacing={"xs"} h={"100%"}>
|
||||||
|
{/* <pre>{JSON.stringify(dataDonasi, null, 2)}</pre> */}
|
||||||
|
<Group
|
||||||
|
position="apart"
|
||||||
|
bg={"gray.4"}
|
||||||
|
p={"xs"}
|
||||||
|
style={{ borderRadius: "6px" }}
|
||||||
|
>
|
||||||
|
<Title order={4}>Daftar Donatur</Title>
|
||||||
|
<Group>
|
||||||
|
<ActionIcon
|
||||||
|
size={"lg"}
|
||||||
|
radius={"xl"}
|
||||||
|
variant="light"
|
||||||
|
onClick={() => {
|
||||||
|
onRelaod();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<IconReload />
|
||||||
|
</ActionIcon>
|
||||||
|
<Select
|
||||||
|
placeholder="Pilih status"
|
||||||
|
value={isSelect}
|
||||||
|
data={listMasterStatus.map((e) => ({
|
||||||
|
value: e.id,
|
||||||
|
label: e.name,
|
||||||
|
}))}
|
||||||
|
onChange={(val) => {
|
||||||
|
onSelect(val);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
|
||||||
|
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||||
|
<ScrollArea w={"100%"} h={"90%"}>
|
||||||
|
<Table
|
||||||
|
verticalSpacing={"xl"}
|
||||||
|
horizontalSpacing={"md"}
|
||||||
|
p={"md"}
|
||||||
|
w={1500}
|
||||||
|
striped
|
||||||
|
highlightOnHover
|
||||||
|
>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<Center>Nama Donatur</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Nama Bank</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Jumlah Donasi</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Tanggal</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Status</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Bukti Transfer</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>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ButtonAccept({
|
||||||
|
invoiceId,
|
||||||
|
donasiId,
|
||||||
|
nominal,
|
||||||
|
danaTerkumpul,
|
||||||
|
target,
|
||||||
|
onSuccessDonasi,
|
||||||
|
onSuccessDonatur,
|
||||||
|
}: {
|
||||||
|
invoiceId: string;
|
||||||
|
donasiId: string;
|
||||||
|
nominal: number;
|
||||||
|
danaTerkumpul: number;
|
||||||
|
target: number;
|
||||||
|
onSuccessDonasi: (val: any) => void;
|
||||||
|
onSuccessDonatur: (val: any) => void;
|
||||||
|
}) {
|
||||||
|
const [opened, { open, close }] = useDisclosure(false);
|
||||||
|
|
||||||
|
async function onAccept() {
|
||||||
|
let nominalDonasi = nominal;
|
||||||
|
let jumlahTerkumpul = danaTerkumpul;
|
||||||
|
|
||||||
|
const updateStatus = await adminDonasi_funUpdateStatusDanTotal({
|
||||||
|
invoiceId: invoiceId,
|
||||||
|
donasiId: donasiId,
|
||||||
|
jumlahTerkumpul: jumlahTerkumpul,
|
||||||
|
nominal: nominalDonasi,
|
||||||
|
statusInvoiceId: "1",
|
||||||
|
target: target,
|
||||||
|
});
|
||||||
|
if (updateStatus.status == 200) {
|
||||||
|
const updateData = await AdminDonasi_getOneById(donasiId);
|
||||||
|
onSuccessDonasi(updateData as any);
|
||||||
|
const updatelistDonatur = await adminDonasi_getListDonatur({
|
||||||
|
donasiId: donasiId,
|
||||||
|
page: 1,
|
||||||
|
});
|
||||||
|
onSuccessDonatur(updatelistDonatur);
|
||||||
|
|
||||||
|
ComponentGlobalAdmin_NotifikasiBerhasil(updateStatus.message);
|
||||||
|
} else {
|
||||||
|
ComponentGlobalAdmin_NotifikasiGagal(updateStatus.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Button
|
||||||
|
color="green"
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={() => {
|
||||||
|
open();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Terima
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Modal opened={opened} onClose={close} centered withCloseButton={false}>
|
||||||
|
<Paper>
|
||||||
|
<Stack align="center">
|
||||||
|
<Title
|
||||||
|
order={6}
|
||||||
|
>{`${"Anda yakin sudah melihat bukti transfer ?"}`}</Title>
|
||||||
|
<Group position="center">
|
||||||
|
<Button radius={"xl"} onClick={() => close()}>
|
||||||
|
Batal
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={() => {
|
||||||
|
onAccept();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Terima
|
||||||
|
</Button>
|
||||||
|
</Group>
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
</Modal>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//######################## LIST PENCAIRAN #####################//
|
||||||
|
function TampilanListPencairan({
|
||||||
|
pencairan,
|
||||||
|
}: {
|
||||||
|
pencairan: MODEL_DONASI_PENCAIRAN_DANA[];
|
||||||
|
}) {
|
||||||
|
const [opened, { open, close }] = useDisclosure(false);
|
||||||
|
const [gambarId, setGambarId] = useState("");
|
||||||
|
|
||||||
|
const rowTable = pencairan.map((e) => (
|
||||||
|
<tr key={e.id}>
|
||||||
|
<td>
|
||||||
|
<TampilanRupiahDonasi nominal={e.nominalCair} />
|
||||||
|
</td>
|
||||||
|
<td>{moment(e.createdAt).format("ll")}</td>
|
||||||
|
<td>
|
||||||
|
<Text>{e.title}</Text>
|
||||||
|
</td>
|
||||||
|
<td width={500}>
|
||||||
|
<Box w={"100%"}>
|
||||||
|
<Spoiler hideLabel="Sembunyikan" maxHeight={70} showLabel="Lihat">
|
||||||
|
{e.deskripsi}
|
||||||
|
</Spoiler>
|
||||||
|
</Box>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{
|
||||||
|
<Box>
|
||||||
|
<Center>
|
||||||
|
<Button
|
||||||
|
radius={"xl"}
|
||||||
|
compact
|
||||||
|
bg={"green"}
|
||||||
|
color="green"
|
||||||
|
onClick={() => {
|
||||||
|
open();
|
||||||
|
setGambarId(e.imagesId);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Detail
|
||||||
|
</Button>
|
||||||
|
</Center>
|
||||||
|
</Box>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Modal opened={opened} onClose={close} centered>
|
||||||
|
<AspectRatio ratio={9 / 16}>
|
||||||
|
<Image
|
||||||
|
src={RouterDonasi.api_gambar_pencairan + `${gambarId}`}
|
||||||
|
alt="Foto"
|
||||||
|
/>
|
||||||
|
</AspectRatio>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<Stack p={"md"}>
|
||||||
|
<Title order={3}>Rincian Pencairan Dana</Title>
|
||||||
|
{/* <pre>{JSON.stringify(pencairan, null, 2)}</pre> */}
|
||||||
|
{_.isEmpty(pencairan) ? (
|
||||||
|
<Paper bg={"gray.1"} p={"xs"}>
|
||||||
|
<Center>BELUM ADA PENCAIRAN DANA</Center>
|
||||||
|
</Paper>
|
||||||
|
) : (
|
||||||
|
<Paper withBorder p={"xs"}>
|
||||||
|
<Table horizontalSpacing={"md"} verticalSpacing={"md"}>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Nominal</th>
|
||||||
|
<th>Tanggal</th>
|
||||||
|
<th>Judul</th>
|
||||||
|
<th>
|
||||||
|
<Center>Deskripsi</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Bukti Transfer</Center>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>{rowTable}</tbody>
|
||||||
|
</Table>
|
||||||
|
</Paper>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -28,7 +28,7 @@ import { NotifGagal } from "@/app_modules/donasi/component/notifikasi/notif_gaga
|
|||||||
import { AdminDonasi_getListStatusInvoiceProses } from "../../fun/get/get_list_status_invoice_proses";
|
import { AdminDonasi_getListStatusInvoiceProses } from "../../fun/get/get_list_status_invoice_proses";
|
||||||
import { AdminDonasi_funUpdateProgresDanTerkumpul } from "../../fun/update/fun_update_progres_dan_terkumpul";
|
import { AdminDonasi_funUpdateProgresDanTerkumpul } from "../../fun/update/fun_update_progres_dan_terkumpul";
|
||||||
import { useDisclosure } from "@mantine/hooks";
|
import { useDisclosure } from "@mantine/hooks";
|
||||||
import { RouterAdminDonasi } from "@/app/lib/router_hipmi/router_admin";
|
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||||
|
|
||||||
export default function AdminDonasi_ProsesTransaksi({
|
export default function AdminDonasi_ProsesTransaksi({
|
||||||
listProses,
|
listProses,
|
||||||
@@ -183,7 +183,7 @@ function ModalBuktiTransfer({ imageId }: { imageId: string }) {
|
|||||||
<AspectRatio ratio={9 / 16}>
|
<AspectRatio ratio={9 / 16}>
|
||||||
<Image
|
<Image
|
||||||
alt="Foto"
|
alt="Foto"
|
||||||
src={RouterAdminDonasi.api_gambar_bukti_transfer + `${imageId}`}
|
src={RouterAdminDonasi_OLD.api_gambar_bukti_transfer + `${imageId}`}
|
||||||
/>
|
/>
|
||||||
</AspectRatio>
|
</AspectRatio>
|
||||||
</>
|
</>
|
||||||
@@ -1,406 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import {
|
|
||||||
AspectRatio,
|
|
||||||
Badge,
|
|
||||||
Box,
|
|
||||||
Button,
|
|
||||||
Center,
|
|
||||||
Divider,
|
|
||||||
Grid,
|
|
||||||
Group,
|
|
||||||
Image,
|
|
||||||
Modal,
|
|
||||||
Pagination,
|
|
||||||
Paper,
|
|
||||||
Progress,
|
|
||||||
ScrollArea,
|
|
||||||
SimpleGrid,
|
|
||||||
Spoiler,
|
|
||||||
Stack,
|
|
||||||
Table,
|
|
||||||
Text,
|
|
||||||
TextInput,
|
|
||||||
Title,
|
|
||||||
} from "@mantine/core";
|
|
||||||
import ComponentAdminDonasi_TombolKembali from "../../component/tombol_kembali";
|
|
||||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
|
||||||
import {
|
|
||||||
IconClover,
|
|
||||||
IconMessageChatbot,
|
|
||||||
IconMoneybag,
|
|
||||||
} from "@tabler/icons-react";
|
|
||||||
import router from "next/router";
|
|
||||||
import moment from "moment";
|
|
||||||
import {
|
|
||||||
MODEL_DONASI,
|
|
||||||
MODEL_DONASI_INVOICE,
|
|
||||||
MODEL_DONASI_PENCAIRAN_DANA,
|
|
||||||
} from "@/app_modules/donasi/model/interface";
|
|
||||||
import { useState } from "react";
|
|
||||||
import { RouterAdminDonasi } from "@/app/lib/router_hipmi/router_admin";
|
|
||||||
import TampilanRupiahDonasi from "@/app_modules/donasi/component/tampilan_rupiah";
|
|
||||||
import _ from "lodash";
|
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import { useDisclosure, useInterval, useShallowEffect } from "@mantine/hooks";
|
|
||||||
import { Donasi_getOneById } from "@/app_modules/donasi/fun/get/get_one_donasi_by_id";
|
|
||||||
import { AdminDonasi_getOneById } from "../../fun/get/get_one_by_id";
|
|
||||||
|
|
||||||
export default function AdminDonasi_DetailPublish({
|
|
||||||
dataPublish,
|
|
||||||
listDonatur,
|
|
||||||
countDonatur,
|
|
||||||
listPencairan,
|
|
||||||
}: {
|
|
||||||
dataPublish: MODEL_DONASI;
|
|
||||||
listDonatur: any[];
|
|
||||||
countDonatur: number;
|
|
||||||
listPencairan: MODEL_DONASI_PENCAIRAN_DANA[];
|
|
||||||
}) {
|
|
||||||
const [donasi, setDonasi] = useState(dataPublish);
|
|
||||||
const [donatur, setDoanutur] = useState(listDonatur);
|
|
||||||
const interval = useInterval(() => reloadData(donasi.id), 5000);
|
|
||||||
const [pencairan, setPencairan] = useState(listPencairan);
|
|
||||||
|
|
||||||
useShallowEffect(() => {
|
|
||||||
interval.start();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
async function reloadData(donasiId: string) {
|
|
||||||
const data = await AdminDonasi_getOneById(donasiId);
|
|
||||||
setDonasi(data as any);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{/* <pre>{JSON.stringify(pencairan, null, 2)}</pre> */}
|
|
||||||
<Stack>
|
|
||||||
<ComponentAdminDonasi_TombolKembali />
|
|
||||||
<TampilanDetailDonasi donasi={donasi} countDonatur={countDonatur} />
|
|
||||||
<TampilanListDonatur donatur={donatur} donasi={donasi} />
|
|
||||||
<TampilanListPencairan pencairan={pencairan} />
|
|
||||||
</Stack>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function TampilanDetailDonasi({
|
|
||||||
donasi,
|
|
||||||
countDonatur,
|
|
||||||
}: {
|
|
||||||
donasi: MODEL_DONASI;
|
|
||||||
countDonatur: number;
|
|
||||||
}) {
|
|
||||||
const [opened, { open, close }] = useDisclosure(false);
|
|
||||||
const router = useRouter();
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Paper radius={"md"} p={"md"}>
|
|
||||||
<Stack>
|
|
||||||
<Grid>
|
|
||||||
<Grid.Col md={6} lg={4}>
|
|
||||||
<AspectRatio ratio={16 / 9}>
|
|
||||||
<Paper radius={"md"} h={{ lg: 200, md: 200, sm: 200 }}>
|
|
||||||
<Image
|
|
||||||
alt="Foto"
|
|
||||||
src={RouterDonasi.api_gambar + `${donasi.imagesId}`}
|
|
||||||
/>
|
|
||||||
</Paper>
|
|
||||||
</AspectRatio>
|
|
||||||
</Grid.Col>
|
|
||||||
<Grid.Col md={6} lg={4}>
|
|
||||||
<Paper withBorder p={"sm"} mah={250} h={250}>
|
|
||||||
<Stack spacing={5}>
|
|
||||||
<Title order={4}>{donasi.title}</Title>
|
|
||||||
<Group>
|
|
||||||
<Text fz={"xs"}>Penggalang Dana</Text>
|
|
||||||
<Title order={5} c="blue">
|
|
||||||
{donasi.Author.username}
|
|
||||||
</Title>
|
|
||||||
</Group>
|
|
||||||
<Group>
|
|
||||||
<Text fz={12}>Durasi</Text>
|
|
||||||
<Title order={5} c="blue">
|
|
||||||
{donasi.DonasiMaster_Durasi.name} hari
|
|
||||||
</Title>
|
|
||||||
</Group>
|
|
||||||
|
|
||||||
<Group>
|
|
||||||
<Text fz={12}>Dana dibutuhkan</Text>
|
|
||||||
<Title order={5} c="blue">
|
|
||||||
<TampilanRupiahDonasi nominal={+donasi.target} />
|
|
||||||
</Title>
|
|
||||||
</Group>
|
|
||||||
<Group>
|
|
||||||
<Text fz={12}>Kategori</Text>
|
|
||||||
<Title order={5} c="blue">
|
|
||||||
{donasi.DonasiMaster_Ketegori.name}
|
|
||||||
</Title>
|
|
||||||
</Group>
|
|
||||||
<Group>
|
|
||||||
<Text fz={12}>Total donatur</Text>
|
|
||||||
<Title order={5} c="blue">
|
|
||||||
{countDonatur}
|
|
||||||
</Title>
|
|
||||||
</Group>
|
|
||||||
<Group>
|
|
||||||
<Text fz={12}>Progres</Text>
|
|
||||||
<Title order={5} c="blue">
|
|
||||||
{donasi.progres} %
|
|
||||||
</Title>
|
|
||||||
</Group>
|
|
||||||
<Group>
|
|
||||||
<Text fz={12}>Dana terkumpul</Text>
|
|
||||||
<Title order={5} c="blue">
|
|
||||||
<TampilanRupiahDonasi nominal={+donasi.terkumpul} />
|
|
||||||
</Title>
|
|
||||||
</Group>
|
|
||||||
{/* <Button w={200} bg={"green.5"} color="green">Pencairan Dana</Button> */}
|
|
||||||
</Stack>
|
|
||||||
</Paper>
|
|
||||||
</Grid.Col>
|
|
||||||
|
|
||||||
<Grid.Col md={6} lg={4}>
|
|
||||||
<Paper withBorder p={"sm"} mah={250} h={250}>
|
|
||||||
<Stack spacing={"xl"}>
|
|
||||||
<Center>
|
|
||||||
<Title order={4}>Pencairan Dana</Title>
|
|
||||||
</Center>
|
|
||||||
<Grid>
|
|
||||||
<Grid.Col span={"auto"}>
|
|
||||||
<Stack spacing={0}>
|
|
||||||
<Text fz={"xs"}>Total Dana Dicairkan</Text>
|
|
||||||
<Title>
|
|
||||||
<TampilanRupiahDonasi
|
|
||||||
nominal={donasi.totalPencairan}
|
|
||||||
fontSize={14}
|
|
||||||
/>
|
|
||||||
</Title>
|
|
||||||
</Stack>
|
|
||||||
</Grid.Col>
|
|
||||||
<Grid.Col span={"auto"}>
|
|
||||||
<Stack spacing={0}>
|
|
||||||
<Text fz={"xs"}>Bank Tujuan</Text>
|
|
||||||
<Title order={6}>{donasi.namaBank}</Title>
|
|
||||||
</Stack>
|
|
||||||
</Grid.Col>
|
|
||||||
</Grid>
|
|
||||||
<Grid>
|
|
||||||
<Grid.Col span={"auto"}>
|
|
||||||
<Stack spacing={0}>
|
|
||||||
<Text fz={"xs"}>Akumulasi Pencairan</Text>
|
|
||||||
<Title order={6}>
|
|
||||||
{donasi.akumulasiPencairan} Kali
|
|
||||||
</Title>
|
|
||||||
</Stack>
|
|
||||||
</Grid.Col>
|
|
||||||
<Grid.Col span={"auto"}>
|
|
||||||
<Stack spacing={0}>
|
|
||||||
<Text fz={"xs"}>Nomor Rekening</Text>
|
|
||||||
<Title order={6}>{donasi.rekening}</Title>
|
|
||||||
</Stack>
|
|
||||||
</Grid.Col>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
radius={"xl"}
|
|
||||||
onClick={() =>
|
|
||||||
router.push(
|
|
||||||
RouterAdminDonasi.pencairan_dana + `${donasi.id}`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
>
|
|
||||||
Cairkan Dana
|
|
||||||
</Button>
|
|
||||||
</Stack>
|
|
||||||
</Paper>
|
|
||||||
</Grid.Col>
|
|
||||||
</Grid>
|
|
||||||
</Stack>
|
|
||||||
</Paper>
|
|
||||||
<Modal opened={opened} onClose={close} centered>
|
|
||||||
<PencairanDana />
|
|
||||||
</Modal>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function PencairanDana() {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Stack>
|
|
||||||
<TextInput label="Masukan nominal" />
|
|
||||||
</Stack>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//######################## LIST DONATUR #####################//
|
|
||||||
function TampilanListDonatur({
|
|
||||||
donatur,
|
|
||||||
donasi,
|
|
||||||
}: {
|
|
||||||
donatur: MODEL_DONASI_INVOICE[];
|
|
||||||
donasi: MODEL_DONASI;
|
|
||||||
}) {
|
|
||||||
const router = useRouter();
|
|
||||||
const tableRows = donatur.map((e, i) => (
|
|
||||||
<tr key={i}>
|
|
||||||
<td>{e.Author.username}</td>
|
|
||||||
<td>
|
|
||||||
<TampilanRupiahDonasi nominal={+e.nominal} />
|
|
||||||
</td>
|
|
||||||
<td> {`${moment(e.createdAt).format("ll")}`}</td>
|
|
||||||
<td>
|
|
||||||
<Center>
|
|
||||||
<Badge w={150} variant="dot">
|
|
||||||
{e.DonasiMaster_StatusInvoice.name}
|
|
||||||
</Badge>
|
|
||||||
</Center>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
));
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Paper radius={"md"} p={"md"}>
|
|
||||||
<Stack>
|
|
||||||
<Group position="apart">
|
|
||||||
<Title order={3}>Update List Donatur</Title>
|
|
||||||
<Button
|
|
||||||
radius={"xl"}
|
|
||||||
variant="outline"
|
|
||||||
onClick={() =>
|
|
||||||
router.push(RouterAdminDonasi.proses_transaksi + `${donasi.id}`)
|
|
||||||
}
|
|
||||||
>
|
|
||||||
Proses transaksi
|
|
||||||
</Button>
|
|
||||||
</Group>
|
|
||||||
|
|
||||||
{_.isEmpty(donatur) ? (
|
|
||||||
<Paper bg={"gray.1"} p={"xs"}>
|
|
||||||
<Center>BELUM ADA DONATUR</Center>
|
|
||||||
</Paper>
|
|
||||||
) : (
|
|
||||||
<Paper withBorder p={"xs"}>
|
|
||||||
<Table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Nama Donatur</th>
|
|
||||||
<th>Jumlah Donasi</th>
|
|
||||||
<th>Tanggal</th>
|
|
||||||
<th>
|
|
||||||
<Center>Status</Center>
|
|
||||||
</th>
|
|
||||||
{/* <th>
|
|
||||||
<Center>Aksi</Center>
|
|
||||||
</th> */}
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>{tableRows}</tbody>
|
|
||||||
</Table>
|
|
||||||
</Paper>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* <Group position="apart">
|
|
||||||
{[{ id: 1 }, { id: 2 },{ id: 3 }, { id: 4 }].map((e, i) => (
|
|
||||||
<Button key={i}>Status</Button>
|
|
||||||
))}
|
|
||||||
</Group> */}
|
|
||||||
</Stack>
|
|
||||||
</Paper>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//######################## LIST PENCAIRAN #####################//
|
|
||||||
function TampilanListPencairan({
|
|
||||||
pencairan,
|
|
||||||
}: {
|
|
||||||
pencairan: MODEL_DONASI_PENCAIRAN_DANA[];
|
|
||||||
}) {
|
|
||||||
const [opened, { open, close }] = useDisclosure(false);
|
|
||||||
const [gambarId, setGambarId] = useState("");
|
|
||||||
|
|
||||||
const rowTable = pencairan.map((e) => (
|
|
||||||
<tr key={e.id}>
|
|
||||||
<td>
|
|
||||||
<TampilanRupiahDonasi nominal={e.nominalCair} />
|
|
||||||
</td>
|
|
||||||
<td>{moment(e.createdAt).format("ll")}</td>
|
|
||||||
<td>
|
|
||||||
<Text>{e.title}</Text>
|
|
||||||
</td>
|
|
||||||
<td width={500}>
|
|
||||||
<Box w={"100%"}>
|
|
||||||
<Spoiler hideLabel="Sembunyikan" maxHeight={70} showLabel="Lihat">
|
|
||||||
{e.deskripsi}
|
|
||||||
</Spoiler>
|
|
||||||
</Box>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{
|
|
||||||
<Box>
|
|
||||||
<Center>
|
|
||||||
<Button
|
|
||||||
radius={"xl"}
|
|
||||||
compact
|
|
||||||
bg={"green"}
|
|
||||||
color="green"
|
|
||||||
onClick={() => {
|
|
||||||
open();
|
|
||||||
setGambarId(e.imagesId);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Detail
|
|
||||||
</Button>
|
|
||||||
</Center>
|
|
||||||
</Box>
|
|
||||||
}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
));
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Modal opened={opened} onClose={close} centered>
|
|
||||||
<AspectRatio ratio={9 / 16}>
|
|
||||||
<Image
|
|
||||||
src={RouterDonasi.api_gambar_pencairan + `${gambarId}`}
|
|
||||||
alt="Foto"
|
|
||||||
/>
|
|
||||||
</AspectRatio>
|
|
||||||
</Modal>
|
|
||||||
|
|
||||||
<Stack p={"md"}>
|
|
||||||
<Title order={3}>Rincian Pencairan Dana</Title>
|
|
||||||
{/* <pre>{JSON.stringify(pencairan, null, 2)}</pre> */}
|
|
||||||
{_.isEmpty(pencairan) ? (
|
|
||||||
<Paper bg={"gray.1"} p={"xs"}>
|
|
||||||
<Center>BELUM ADA PENCAIRAN DANA</Center>
|
|
||||||
</Paper>
|
|
||||||
) : (
|
|
||||||
<Paper withBorder p={"xs"}>
|
|
||||||
<Table horizontalSpacing={"md"} verticalSpacing={"md"}>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Nominal</th>
|
|
||||||
<th>Tanggal</th>
|
|
||||||
<th>Judul</th>
|
|
||||||
<th>
|
|
||||||
<Center>Deskripsi</Center>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<Center>Bukti Transfer</Center>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>{rowTable}</tbody>
|
|
||||||
</Table>
|
|
||||||
</Paper>
|
|
||||||
)}
|
|
||||||
</Stack>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { RouterAdminDonasi } from "@/app/lib/router_admin/router_admin_donasi";
|
||||||
|
import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
|
export default async function adminDonasi_funCreateKategori({
|
||||||
|
newKategori,
|
||||||
|
}: {
|
||||||
|
newKategori: string;
|
||||||
|
}) {
|
||||||
|
const getCount = await prisma.donasiMaster_Kategori.findMany({});
|
||||||
|
const idKategori = getCount.length + 1;
|
||||||
|
|
||||||
|
const create = await prisma.donasiMaster_Kategori.create({
|
||||||
|
data: {
|
||||||
|
id: idKategori.toString(),
|
||||||
|
name: newKategori,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!create) return { status: 400, message: "Gagal menambahkan" };
|
||||||
|
revalidatePath(RouterAdminDonasi.table_kategori);
|
||||||
|
return { status: 200, message: "Berhasil menambahkan" };
|
||||||
|
}
|
||||||
25
src/app_modules/admin/donasi/fun/delete/fun_delete_by_id.ts
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { RouterAdminDonasi } from "@/app/lib/router_admin/router_admin_donasi";
|
||||||
|
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||||
|
import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
|
export default async function adminDonasi_funDeleteKategori({
|
||||||
|
kategoriId,
|
||||||
|
}: {
|
||||||
|
kategoriId: string;
|
||||||
|
}) {
|
||||||
|
const del = await prisma.donasiMaster_Kategori.update({
|
||||||
|
where: {
|
||||||
|
id: kategoriId,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!del) return { status: 400, message: "Gagal hapus kategori" };
|
||||||
|
revalidatePath(RouterAdminDonasi.table_kategori);
|
||||||
|
return { status: 200, message: "Kategori terhapus" };
|
||||||
|
}
|
||||||
@@ -1,113 +0,0 @@
|
|||||||
"use server";
|
|
||||||
|
|
||||||
import prisma from "@/app/lib/prisma";
|
|
||||||
|
|
||||||
export async function AdminDonasi_getByStatus(status: string) {
|
|
||||||
if (status === "1") {
|
|
||||||
const getPublish = await prisma.donasi.findMany({
|
|
||||||
orderBy: {
|
|
||||||
createdAt: "desc",
|
|
||||||
},
|
|
||||||
where: {
|
|
||||||
donasiMaster_StatusDonasiId: "1",
|
|
||||||
},
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
title: true,
|
|
||||||
target: true,
|
|
||||||
// active: true,
|
|
||||||
// createdAt: true,
|
|
||||||
// updatedAt: true,
|
|
||||||
// publishTime: true,
|
|
||||||
authorId: true,
|
|
||||||
// imagesId: true,
|
|
||||||
terkumpul: true,
|
|
||||||
// donasiMaster_KategoriId: true,
|
|
||||||
// donasiMaster_DurasiId: true,
|
|
||||||
// donasiMaster_StatusDonasiId: true,
|
|
||||||
// Author: true,
|
|
||||||
imageDonasi: true,
|
|
||||||
// CeritaDonasi: true,
|
|
||||||
DonasiMaster_Ketegori: true,
|
|
||||||
DonasiMaster_Durasi: true,
|
|
||||||
// DonasiMaster_Status: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
return getPublish;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status === "2") {
|
|
||||||
const getReview = await prisma.donasi.findMany({
|
|
||||||
where: {
|
|
||||||
donasiMaster_StatusDonasiId: "2",
|
|
||||||
},
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
title: true,
|
|
||||||
target: true,
|
|
||||||
active: true,
|
|
||||||
createdAt: true,
|
|
||||||
updatedAt: true,
|
|
||||||
publishTime: true,
|
|
||||||
authorId: true,
|
|
||||||
imagesId: true,
|
|
||||||
donasiMaster_KategoriId: true,
|
|
||||||
donasiMaster_DurasiId: true,
|
|
||||||
donasiMaster_StatusDonasiId: true,
|
|
||||||
Author: true,
|
|
||||||
imageDonasi: true,
|
|
||||||
CeritaDonasi: true,
|
|
||||||
DonasiMaster_Ketegori: true,
|
|
||||||
DonasiMaster_Durasi: true,
|
|
||||||
DonasiMaster_Status: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
return getReview;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status === "3") {
|
|
||||||
const getReview = await prisma.donasi.findMany({
|
|
||||||
where: {
|
|
||||||
donasiMaster_StatusDonasiId: "3",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
return getReview;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status === "4") {
|
|
||||||
const getReview = await prisma.donasi.findMany({
|
|
||||||
where: {
|
|
||||||
donasiMaster_StatusDonasiId: "4",
|
|
||||||
},
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
title: true,
|
|
||||||
target: true,
|
|
||||||
active: true,
|
|
||||||
createdAt: true,
|
|
||||||
updatedAt: true,
|
|
||||||
publishTime: true,
|
|
||||||
catatan: true,
|
|
||||||
authorId: true,
|
|
||||||
imagesId: true,
|
|
||||||
donasiMaster_KategoriId: true,
|
|
||||||
donasiMaster_DurasiId: true,
|
|
||||||
donasiMaster_StatusDonasiId: true,
|
|
||||||
Author: true,
|
|
||||||
imageDonasi: true,
|
|
||||||
CeritaDonasi: true,
|
|
||||||
DonasiMaster_Ketegori: true,
|
|
||||||
DonasiMaster_Durasi: true,
|
|
||||||
DonasiMaster_Status: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
return getReview;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status === undefined) {
|
|
||||||
return {
|
|
||||||
status: 400,
|
|
||||||
message: "Not Found",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +1,59 @@
|
|||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { ceil } from "lodash";
|
||||||
|
|
||||||
export async function AdminDonasi_getListDonatur(donasiId: string) {
|
export async function adminDonasi_getListDonatur({
|
||||||
// console.log(donasiId)
|
donasiId,
|
||||||
const data = await prisma.donasi_Invoice.findMany({
|
page,
|
||||||
|
selectStatusId,
|
||||||
|
}: {
|
||||||
|
donasiId: string;
|
||||||
|
page: number;
|
||||||
|
selectStatusId?: string;
|
||||||
|
}) {
|
||||||
|
let takeData = 5;
|
||||||
|
let skipData = page * takeData - takeData;
|
||||||
|
|
||||||
|
const getData = await prisma.donasi_Invoice.findMany({
|
||||||
|
skip: skipData,
|
||||||
|
take: takeData,
|
||||||
|
orderBy: {
|
||||||
|
createdAt: "desc",
|
||||||
|
},
|
||||||
where: {
|
where: {
|
||||||
donasiId: donasiId,
|
donasiId: donasiId,
|
||||||
|
donasiMaster_StatusInvoiceId: {
|
||||||
|
contains: selectStatusId,
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
nominal: true,
|
nominal: true,
|
||||||
createdAt: true,
|
createdAt: true,
|
||||||
Author: true,
|
Author: true,
|
||||||
DonasiMaster_StatusInvoice: true
|
DonasiMaster_Bank: true,
|
||||||
|
DonasiMaster_StatusInvoice: true,
|
||||||
|
donasiMaster_StatusInvoiceId: true,
|
||||||
|
imagesId: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log(data)
|
const nCount = await prisma.donasi_Invoice.count({
|
||||||
|
where: {
|
||||||
|
donasiId: donasiId,
|
||||||
|
donasiMaster_StatusInvoiceId: {
|
||||||
|
contains: selectStatusId,
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
return data;
|
const allData = {
|
||||||
|
data: getData,
|
||||||
|
nPage: ceil(nCount / takeData),
|
||||||
|
};
|
||||||
|
|
||||||
|
return allData;
|
||||||
}
|
}
|
||||||
|
|||||||
60
src/app_modules/admin/donasi/fun/get/get_list_publish.ts
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { count } from "console";
|
||||||
|
import _, { ceil } from "lodash";
|
||||||
|
|
||||||
|
export default async function adminDonasi_getListPublish({
|
||||||
|
page,
|
||||||
|
search,
|
||||||
|
}: {
|
||||||
|
page: number;
|
||||||
|
search?: string;
|
||||||
|
}) {
|
||||||
|
let takeData = 10;
|
||||||
|
let skipData = page * takeData - takeData;
|
||||||
|
|
||||||
|
const dataPublish = await prisma.donasi.findMany({
|
||||||
|
skip: skipData,
|
||||||
|
take: takeData,
|
||||||
|
orderBy: {
|
||||||
|
createdAt: "desc",
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
donasiMaster_StatusDonasiId: "1",
|
||||||
|
active: true,
|
||||||
|
title: {
|
||||||
|
contains: search,
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
title: true,
|
||||||
|
target: true,
|
||||||
|
authorId: true,
|
||||||
|
terkumpul: true,
|
||||||
|
imageDonasi: true,
|
||||||
|
DonasiMaster_Ketegori: true,
|
||||||
|
DonasiMaster_Durasi: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const nCount = await prisma.donasi.count({
|
||||||
|
where: {
|
||||||
|
donasiMaster_StatusDonasiId: "1",
|
||||||
|
active: true,
|
||||||
|
title: {
|
||||||
|
contains: search,
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const allData = {
|
||||||
|
data: dataPublish,
|
||||||
|
nPage: ceil(nCount / takeData),
|
||||||
|
};
|
||||||
|
|
||||||
|
return allData;
|
||||||
|
}
|
||||||
69
src/app_modules/admin/donasi/fun/get/get_list_reject.ts
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { RouterAdminDonasi } from "@/app/lib/router_admin/router_admin_donasi";
|
||||||
|
import { count } from "console";
|
||||||
|
import _, { ceil } from "lodash";
|
||||||
|
import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
|
export default async function adminDonasi_getListReject({
|
||||||
|
page,
|
||||||
|
search,
|
||||||
|
}: {
|
||||||
|
page: number;
|
||||||
|
search?: string;
|
||||||
|
}) {
|
||||||
|
let takeData = 2;
|
||||||
|
let skipData = page * takeData - takeData;
|
||||||
|
|
||||||
|
const dataReview = await prisma.donasi.findMany({
|
||||||
|
skip: skipData,
|
||||||
|
take: takeData,
|
||||||
|
orderBy: {
|
||||||
|
createdAt: "desc",
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
donasiMaster_StatusDonasiId: "4",
|
||||||
|
active: true,
|
||||||
|
title: {
|
||||||
|
contains: search,
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
title: true,
|
||||||
|
target: true,
|
||||||
|
authorId: true,
|
||||||
|
terkumpul: true,
|
||||||
|
imageDonasi: true,
|
||||||
|
DonasiMaster_Ketegori: true,
|
||||||
|
DonasiMaster_Durasi: true,
|
||||||
|
Author: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
username: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const nCount = await prisma.donasi.count({
|
||||||
|
where: {
|
||||||
|
donasiMaster_StatusDonasiId: "4",
|
||||||
|
active: true,
|
||||||
|
title: {
|
||||||
|
contains: search,
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// console.log(nCount)
|
||||||
|
const allData = {
|
||||||
|
data: dataReview,
|
||||||
|
nPage: ceil(nCount / takeData),
|
||||||
|
};
|
||||||
|
|
||||||
|
return allData;
|
||||||
|
}
|
||||||
69
src/app_modules/admin/donasi/fun/get/get_list_review.ts
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { RouterAdminDonasi } from "@/app/lib/router_admin/router_admin_donasi";
|
||||||
|
import { count } from "console";
|
||||||
|
import _, { ceil } from "lodash";
|
||||||
|
import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
|
export default async function adminDonasi_getListReview({
|
||||||
|
page,
|
||||||
|
search,
|
||||||
|
}: {
|
||||||
|
page: number;
|
||||||
|
search?: string;
|
||||||
|
}) {
|
||||||
|
let takeData = 10;
|
||||||
|
let skipData = page * takeData - takeData;
|
||||||
|
|
||||||
|
const dataReview = await prisma.donasi.findMany({
|
||||||
|
skip: skipData,
|
||||||
|
take: takeData,
|
||||||
|
orderBy: {
|
||||||
|
createdAt: "desc",
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
donasiMaster_StatusDonasiId: "2",
|
||||||
|
active: true,
|
||||||
|
title: {
|
||||||
|
contains: search,
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
title: true,
|
||||||
|
target: true,
|
||||||
|
authorId: true,
|
||||||
|
terkumpul: true,
|
||||||
|
imageDonasi: true,
|
||||||
|
DonasiMaster_Ketegori: true,
|
||||||
|
DonasiMaster_Durasi: true,
|
||||||
|
Author: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
username: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const nCount = await prisma.donasi.count({
|
||||||
|
where: {
|
||||||
|
donasiMaster_StatusDonasiId: "2",
|
||||||
|
active: true,
|
||||||
|
title: {
|
||||||
|
contains: search,
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// console.log(nCount)
|
||||||
|
const allData = {
|
||||||
|
data: dataReview,
|
||||||
|
nPage: ceil(nCount / takeData),
|
||||||
|
};
|
||||||
|
|
||||||
|
return allData;
|
||||||
|
}
|
||||||
@@ -4,6 +4,9 @@ import prisma from "@/app/lib/prisma";
|
|||||||
|
|
||||||
export async function AdminDonasi_getListStatusInvoiceProses(donasiId: string) {
|
export async function AdminDonasi_getListStatusInvoiceProses(donasiId: string) {
|
||||||
const dataStatus = await prisma.donasi_Invoice.findMany({
|
const dataStatus = await prisma.donasi_Invoice.findMany({
|
||||||
|
orderBy: {
|
||||||
|
createdAt: "desc",
|
||||||
|
},
|
||||||
where: {
|
where: {
|
||||||
donasiId: donasiId,
|
donasiId: donasiId,
|
||||||
donasiMaster_StatusInvoiceId: {
|
donasiMaster_StatusInvoiceId: {
|
||||||
@@ -18,31 +21,30 @@ export async function AdminDonasi_getListStatusInvoiceProses(donasiId: string) {
|
|||||||
imagesId: true,
|
imagesId: true,
|
||||||
Donasi: {
|
Donasi: {
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
title: true,
|
title: true,
|
||||||
target: true,
|
target: true,
|
||||||
active: true,
|
active: true,
|
||||||
createdAt: true,
|
createdAt: true,
|
||||||
updatedAt: true,
|
updatedAt: true,
|
||||||
publishTime: true,
|
publishTime: true,
|
||||||
catatan: true,
|
catatan: true,
|
||||||
terkumpul: true,
|
terkumpul: true,
|
||||||
donasiMaster_KategoriId: true,
|
donasiMaster_KategoriId: true,
|
||||||
donasiMaster_DurasiId: true,
|
donasiMaster_DurasiId: true,
|
||||||
donasiMaster_StatusDonasiId: true,
|
donasiMaster_StatusDonasiId: true,
|
||||||
Author: true,
|
Author: true,
|
||||||
imageDonasi: true,
|
imageDonasi: true,
|
||||||
CeritaDonasi: true,
|
CeritaDonasi: true,
|
||||||
DonasiMaster_Ketegori: true,
|
DonasiMaster_Ketegori: true,
|
||||||
DonasiMaster_Durasi: true,
|
DonasiMaster_Durasi: true,
|
||||||
DonasiMaster_Status: true,
|
DonasiMaster_Status: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
DonasiMaster_Bank: true,
|
DonasiMaster_Bank: true,
|
||||||
DonasiMaster_StatusInvoice: true,
|
DonasiMaster_StatusInvoice: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
return dataStatus;
|
return dataStatus;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,5 @@ export async function AdminDonasi_getOneById(id: string) {
|
|||||||
DonasiMaster_Status: true,
|
DonasiMaster_Status: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
// console.log(res)
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
15
src/app_modules/admin/donasi/fun/master/get_list_kategori.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
|
||||||
|
export default async function adminDonasi_getMasterKategori() {
|
||||||
|
const data = await prisma.donasiMaster_Kategori.findMany({
|
||||||
|
orderBy: {
|
||||||
|
createdAt: "asc",
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
active: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
}
|
||||||
9
src/app_modules/admin/donasi/fun/master/get_status_id.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
|
||||||
|
export default async function adminDonasi_getMasterStatus() {
|
||||||
|
const data = await prisma.donasiMaster_StatusInvoice.findMany({});
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
import { RouterAdminDonasi } from "@/app/lib/router_hipmi/router_admin";
|
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
import { RouterAdminDonasi } from "@/app/lib/router_hipmi/router_admin";
|
import { RouterAdminDonasi } from "@/app/lib/router_admin/router_admin_donasi";
|
||||||
|
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
@@ -21,7 +22,7 @@ export async function AdminDonasi_funUpdateStatusReject(
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!data) return { status: 400, message: "Data tidak ditemukan" };
|
if (!data) return { status: 400, message: "Data tidak ditemukan" };
|
||||||
revalidatePath("/dev/admin/donasi/table/review");
|
revalidatePath(RouterAdminDonasi.table_review);
|
||||||
return {
|
return {
|
||||||
status: 200,
|
status: 200,
|
||||||
message: "Status berhasil diganti",
|
message: "Status berhasil diganti",
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { update } from "lodash";
|
||||||
|
|
||||||
|
export default async function adminDonasi_funUpdatekategoriById({
|
||||||
|
kategoriId,
|
||||||
|
name,
|
||||||
|
}: {
|
||||||
|
kategoriId: string;
|
||||||
|
name: string;
|
||||||
|
}) {
|
||||||
|
const updt = await prisma.donasiMaster_Kategori.update({
|
||||||
|
where: {
|
||||||
|
id: kategoriId,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
name: name,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!updt) return { status: 200, message: "Gagal update" };
|
||||||
|
return { status: 200, message: "Berhasil update" };
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||||
|
import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
|
// NEW FUNCTION
|
||||||
|
export default async function adminDonasi_funUpdateStatusDanTotal({
|
||||||
|
invoiceId,
|
||||||
|
donasiId,
|
||||||
|
statusInvoiceId,
|
||||||
|
nominal,
|
||||||
|
jumlahTerkumpul,
|
||||||
|
target,
|
||||||
|
}: {
|
||||||
|
invoiceId: string;
|
||||||
|
donasiId: string;
|
||||||
|
statusInvoiceId: string;
|
||||||
|
nominal: number;
|
||||||
|
jumlahTerkumpul: number;
|
||||||
|
target: number;
|
||||||
|
}) {
|
||||||
|
let totalNominal = nominal + jumlahTerkumpul;
|
||||||
|
const progres = (totalNominal / target) * 100;
|
||||||
|
|
||||||
|
const updateInvoice = await prisma.donasi_Invoice.update({
|
||||||
|
where: {
|
||||||
|
id: invoiceId,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
donasiMaster_StatusInvoiceId: statusInvoiceId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (!updateInvoice) return { status: 400, message: "Update invoice gagal" };
|
||||||
|
|
||||||
|
const updateDonasi = await prisma.donasi.update({
|
||||||
|
where: {
|
||||||
|
id: donasiId,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
terkumpul: "" + totalNominal,
|
||||||
|
progres: "" + progres,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!updateDonasi) return { status: 400, message: "Update donasi gagal" };
|
||||||
|
revalidatePath(RouterAdminDonasi_OLD.detail_publish + donasiId);
|
||||||
|
return { status: 200, message: "Update Berhasil" };
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
import { RouterAdminDonasi } from "@/app/lib/router_hipmi/router_admin";
|
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
export async function AdminDonasi_funUpdateStatusInvoice(
|
export async function AdminDonasi_funUpdateStatusInvoice(
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
import AdminDonasi_Main from "./main";
|
import AdminDonasi_Main from "./main";
|
||||||
import AdminDonasi_TablePublish from "./table_status/table_publish";
|
import AdminDonasi_TablePublish from "./sub_menu/table_publish";
|
||||||
import AdminDonasi_DetailPublish from "./detail_table/publish/detail_publish";
|
import AdminDonasi_DetailPublish from "./detail/publish/detail_publish";
|
||||||
import AdminDonasi_TableReview from "./table_status/table_review";
|
import AdminDonasi_TableReview from "./sub_menu/table_review";
|
||||||
import AdminDonasi_DetailReview from "./detail_table/detail_review";
|
import AdminDonasi_DetailReview from "./detail/detail_review";
|
||||||
import AdminDonasi_TableReject from "./table_status/table_reject";
|
import AdminDonasi_TableReject from "./sub_menu/table_reject";
|
||||||
import AdminDonasi_DetailReject from "./detail_table/detail_reject";
|
import AdminDonasi_DetailReject from "./detail/detail_reject";
|
||||||
import AdminDonasi_ProsesTransaksi from "./detail_table/publish/proses_transaksi";
|
import AdminDonasi_ProsesTransaksi from "./detail/publish/proses_transaksi";
|
||||||
import AdminDonasi_PencairanDana from "./detail_table/publish/pencairan_dana";
|
import AdminDonasi_PencairanDana from "./detail/publish/pencairan_dana";
|
||||||
|
import AdminDonasi_TableKategori from "./sub_menu/table_kategori";
|
||||||
|
import AdminDonasi_BuktiTransfer from "./sub-detail/bukti_transfer";
|
||||||
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
AdminDonasi_Main,
|
AdminDonasi_Main,
|
||||||
@@ -18,4 +21,7 @@ export {
|
|||||||
AdminDonasi_DetailReject,
|
AdminDonasi_DetailReject,
|
||||||
AdminDonasi_ProsesTransaksi,
|
AdminDonasi_ProsesTransaksi,
|
||||||
AdminDonasi_PencairanDana,
|
AdminDonasi_PencairanDana,
|
||||||
|
AdminDonasi_TableKategori,
|
||||||
|
AdminDonasi_BuktiTransfer,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { RouterAdminDonasi } from "@/app/lib/router_hipmi/router_admin";
|
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||||
import {
|
import {
|
||||||
Stack,
|
Stack,
|
||||||
Title,
|
Title,
|
||||||
@@ -15,6 +15,7 @@ import {
|
|||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { IconChevronsRight } from "@tabler/icons-react";
|
import { IconChevronsRight } from "@tabler/icons-react";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
|
import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate";
|
||||||
|
|
||||||
export default function AdminDonasi_Main({
|
export default function AdminDonasi_Main({
|
||||||
countPublish,
|
countPublish,
|
||||||
@@ -33,14 +34,14 @@ export default function AdminDonasi_Main({
|
|||||||
id: 1,
|
id: 1,
|
||||||
name: "Publish",
|
name: "Publish",
|
||||||
jumlah: countPublish,
|
jumlah: countPublish,
|
||||||
link: RouterAdminDonasi.table_publish,
|
link: RouterAdminDonasi_OLD.table_publish,
|
||||||
color: "green",
|
color: "green",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
name: "Review",
|
name: "Review",
|
||||||
jumlah: countReview,
|
jumlah: countReview,
|
||||||
link: RouterAdminDonasi.table_review,
|
link: RouterAdminDonasi_OLD.table_review,
|
||||||
color: "orange",
|
color: "orange",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -54,13 +55,45 @@ export default function AdminDonasi_Main({
|
|||||||
id: 4,
|
id: 4,
|
||||||
name: "Reject",
|
name: "Reject",
|
||||||
jumlah: countReject,
|
jumlah: countReject,
|
||||||
link: RouterAdminDonasi.table_reject,
|
link: RouterAdminDonasi_OLD.table_reject,
|
||||||
color: "red",
|
color: "red",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack spacing={"sm"}>
|
<Stack spacing={"xl"}>
|
||||||
|
<ComponentAdminGlobal_HeaderTamplate name="Donasi" />
|
||||||
|
|
||||||
|
<SimpleGrid
|
||||||
|
cols={4}
|
||||||
|
spacing="lg"
|
||||||
|
breakpoints={[
|
||||||
|
{ maxWidth: "62rem", cols: 4, spacing: "lg" },
|
||||||
|
{ maxWidth: "48rem", cols: 2, spacing: "sm" },
|
||||||
|
{ maxWidth: "36rem", cols: 1, spacing: "sm" },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
{listBox.map((e, i) => (
|
||||||
|
<Paper
|
||||||
|
key={i}
|
||||||
|
bg={`${e.color}.2`}
|
||||||
|
shadow="md"
|
||||||
|
radius="md"
|
||||||
|
p="md"
|
||||||
|
// sx={{ borderColor: e.color, borderStyle: "solid" }}
|
||||||
|
>
|
||||||
|
<Group position="center">
|
||||||
|
<Stack align="center" spacing={0}>
|
||||||
|
<Text>{e.name}</Text>
|
||||||
|
<Title>{e.jumlah}</Title>
|
||||||
|
</Stack>
|
||||||
|
</Group>
|
||||||
|
</Paper>
|
||||||
|
))}
|
||||||
|
</SimpleGrid>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
|
{/* <Stack spacing={"sm"}>
|
||||||
<Title>Donasi</Title>
|
<Title>Donasi</Title>
|
||||||
<Divider mb={"md"} />
|
<Divider mb={"md"} />
|
||||||
<SimpleGrid
|
<SimpleGrid
|
||||||
@@ -99,7 +132,7 @@ export default function AdminDonasi_Main({
|
|||||||
</Paper>
|
</Paper>
|
||||||
))}
|
))}
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
</Stack>
|
</Stack> */}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
47
src/app_modules/admin/donasi/sub-detail/bukti_transfer.tsx
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { AspectRatio, Box, Image, Paper, Stack } from "@mantine/core";
|
||||||
|
import ComponentGlobalAdmin_BackButton from "../../component/back_button";
|
||||||
|
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||||
|
|
||||||
|
export default function AdminDonasi_BuktiTransfer({
|
||||||
|
imageId,
|
||||||
|
}: {
|
||||||
|
imageId: string;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack>
|
||||||
|
<ComponentGlobalAdmin_BackButton />
|
||||||
|
<BuktiTransfer imageId={imageId} />
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function BuktiTransfer({ imageId }: { imageId: string }) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Paper withBorder p={"lg"} bg={"gray.3"}>
|
||||||
|
<AspectRatio ratio={2 / 1} mx="auto">
|
||||||
|
<Image
|
||||||
|
alt="Foto"
|
||||||
|
src={RouterAdminDonasi_OLD.api_gambar_bukti_transfer + `${imageId}`}
|
||||||
|
/>
|
||||||
|
</AspectRatio>
|
||||||
|
{/* <AspectRatio ratio={1 / 1} mah={500} p={"lg"} bg={"cyan"}>
|
||||||
|
<Paper bg={"grape"} h={"100%"}>
|
||||||
|
<Image
|
||||||
|
// height={500}
|
||||||
|
// width={"100%"}
|
||||||
|
alt="Foto"
|
||||||
|
src={
|
||||||
|
RouterAdminDonasi_OLD.api_gambar_bukti_transfer + `${imageId}`
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Paper>
|
||||||
|
</AspectRatio> */}
|
||||||
|
</Paper>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
263
src/app_modules/admin/donasi/sub_menu/table_kategori.tsx
Normal file
@@ -0,0 +1,263 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import {
|
||||||
|
Stack,
|
||||||
|
Group,
|
||||||
|
Title,
|
||||||
|
Paper,
|
||||||
|
ScrollArea,
|
||||||
|
Center,
|
||||||
|
Pagination,
|
||||||
|
Table,
|
||||||
|
Grid,
|
||||||
|
TextInput,
|
||||||
|
Button,
|
||||||
|
Text,
|
||||||
|
ActionIcon,
|
||||||
|
Overlay,
|
||||||
|
} from "@mantine/core";
|
||||||
|
import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate";
|
||||||
|
import { MODEL_NEW_DEFAULT_MASTER } from "@/app_modules/model_global/interface";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { IconEdit, IconTrash } from "@tabler/icons-react";
|
||||||
|
import adminDonasi_funCreateKategori from "../fun/create/fun_create_kategori";
|
||||||
|
import { ComponentGlobalAdmin_NotifikasiBerhasil } from "../../component/admin_notifikasi/notifikasi_berhasil";
|
||||||
|
import { ComponentGlobalAdmin_NotifikasiGagal } from "../../component/admin_notifikasi/notifikasi_gagal";
|
||||||
|
import adminDonasi_getMasterKategori from "../fun/master/get_list_kategori";
|
||||||
|
import adminDonasi_funDeleteKategori from "../fun/delete/fun_delete_by_id";
|
||||||
|
import adminDonasi_funUpdatekategoriById from "../fun/update/fun_update_kategori_by_id";
|
||||||
|
|
||||||
|
export default function AdminDonasi_TableKategori({
|
||||||
|
listKategori,
|
||||||
|
}: {
|
||||||
|
listKategori: MODEL_NEW_DEFAULT_MASTER[];
|
||||||
|
}) {
|
||||||
|
const [list, setList] = useState(listKategori);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack h={"100%"}>
|
||||||
|
<ComponentAdminGlobal_HeaderTamplate name="Donasi" />
|
||||||
|
<TableView
|
||||||
|
list={list}
|
||||||
|
onLoadData={(val) => {
|
||||||
|
setList(val);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function TableView({
|
||||||
|
list,
|
||||||
|
onLoadData,
|
||||||
|
}: {
|
||||||
|
list: MODEL_NEW_DEFAULT_MASTER[];
|
||||||
|
onLoadData: (val: any) => void;
|
||||||
|
}) {
|
||||||
|
const [create, setCreate] = useState("");
|
||||||
|
const [visible, setVisible] = useState(true);
|
||||||
|
const [kategoriId, setKategoriId] = useState("");
|
||||||
|
const [updateName, setUpdateName] = useState("");
|
||||||
|
|
||||||
|
async function onCreateNewKategori() {
|
||||||
|
const tambahData = await adminDonasi_funCreateKategori({
|
||||||
|
newKategori: create,
|
||||||
|
});
|
||||||
|
if (tambahData.status === 200) {
|
||||||
|
const loadNewdata = await adminDonasi_getMasterKategori();
|
||||||
|
onLoadData(loadNewdata);
|
||||||
|
setCreate("");
|
||||||
|
ComponentGlobalAdmin_NotifikasiBerhasil(tambahData.message);
|
||||||
|
} else {
|
||||||
|
ComponentGlobalAdmin_NotifikasiGagal(tambahData.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onDelete(id: string) {
|
||||||
|
const del = await adminDonasi_funDeleteKategori({ kategoriId: id });
|
||||||
|
if (del.status === 200) {
|
||||||
|
const loadNewdata = await adminDonasi_getMasterKategori();
|
||||||
|
onLoadData(loadNewdata);
|
||||||
|
ComponentGlobalAdmin_NotifikasiBerhasil(del.message);
|
||||||
|
} else {
|
||||||
|
ComponentGlobalAdmin_NotifikasiGagal(del.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onUpdate() {
|
||||||
|
const updt = await adminDonasi_funUpdatekategoriById({
|
||||||
|
kategoriId: kategoriId,
|
||||||
|
name: updateName,
|
||||||
|
});
|
||||||
|
if (updt.status === 200) {
|
||||||
|
setVisible(true);
|
||||||
|
setKategoriId("");
|
||||||
|
setUpdateName("");
|
||||||
|
ComponentGlobalAdmin_NotifikasiBerhasil(updt.message);
|
||||||
|
const loadData = await adminDonasi_getMasterKategori();
|
||||||
|
onLoadData(loadData);
|
||||||
|
} else {
|
||||||
|
ComponentGlobalAdmin_NotifikasiGagal(updt.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const rowTable = list.map((e, i) => (
|
||||||
|
<tr key={i}>
|
||||||
|
<td>
|
||||||
|
<Center>
|
||||||
|
<Text>{e?.name}</Text>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Group position="center">
|
||||||
|
<ActionIcon
|
||||||
|
onClick={() => {
|
||||||
|
setVisible(false);
|
||||||
|
setKategoriId(e?.id);
|
||||||
|
setUpdateName(e?.name);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<IconEdit color="green" />
|
||||||
|
</ActionIcon>
|
||||||
|
<ActionIcon
|
||||||
|
onClick={() => {
|
||||||
|
onDelete(e?.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<IconTrash color="red" />
|
||||||
|
</ActionIcon>
|
||||||
|
</Group>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack spacing={"xs"} h={"100%"}>
|
||||||
|
{/* <pre>{JSON.stringify(listUser, null, 2)}</pre> */}
|
||||||
|
<Group
|
||||||
|
position="apart"
|
||||||
|
bg={"gray.4"}
|
||||||
|
p={"xs"}
|
||||||
|
style={{ borderRadius: "6px" }}
|
||||||
|
>
|
||||||
|
<Title order={4}>Kategori</Title>
|
||||||
|
</Group>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={"auto"}>
|
||||||
|
<Stack>
|
||||||
|
<Paper p={"md"} withBorder>
|
||||||
|
<Stack>
|
||||||
|
<TextInput
|
||||||
|
value={create}
|
||||||
|
label={<Title order={6}>Tambah Kategori</Title>}
|
||||||
|
placeholder="Masukan kategori baru"
|
||||||
|
onChange={(val) => {
|
||||||
|
setCreate(val.currentTarget.value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Group position="right">
|
||||||
|
<Button
|
||||||
|
style={{
|
||||||
|
transition: "0.5s",
|
||||||
|
}}
|
||||||
|
disabled={create === "" ? true : false}
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={() => {
|
||||||
|
onCreateNewKategori();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Simpan
|
||||||
|
</Button>
|
||||||
|
</Group>
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
|
||||||
|
<Paper p={"md"} withBorder style={{ transition: "1s" }}>
|
||||||
|
<Stack>
|
||||||
|
<TextInput
|
||||||
|
value={updateName}
|
||||||
|
disabled={visible ? true : false}
|
||||||
|
label={<Title order={6}>Update Kategori</Title>}
|
||||||
|
placeholder="Update kategori"
|
||||||
|
onChange={(val) => {
|
||||||
|
setUpdateName(val.currentTarget.value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Group position="right">
|
||||||
|
<Button
|
||||||
|
disabled={visible ? true : false}
|
||||||
|
style={{
|
||||||
|
transition: "0.5s",
|
||||||
|
}}
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={() => {
|
||||||
|
setKategoriId("");
|
||||||
|
setUpdateName("");
|
||||||
|
setVisible(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Batal
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
style={{
|
||||||
|
transition: "0.5s",
|
||||||
|
}}
|
||||||
|
color="green"
|
||||||
|
disabled={visible ? true : false}
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={() => {
|
||||||
|
onUpdate();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Update
|
||||||
|
</Button>
|
||||||
|
</Group>
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
</Stack>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={8} h={"80vh"}>
|
||||||
|
<Paper p={"md"} withBorder shadow="lg" h={"100%"}>
|
||||||
|
<ScrollArea w={"100%"} h={"90%"}>
|
||||||
|
<Table
|
||||||
|
verticalSpacing={"xs"}
|
||||||
|
horizontalSpacing={"md"}
|
||||||
|
p={"md"}
|
||||||
|
w={"100%"}
|
||||||
|
striped
|
||||||
|
highlightOnHover
|
||||||
|
>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<Center>Kategori</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Aksi</Center>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>{rowTable}</tbody>
|
||||||
|
</Table>
|
||||||
|
</ScrollArea>
|
||||||
|
{/* <Center mt={"xl"}>
|
||||||
|
<Pagination
|
||||||
|
total={10}
|
||||||
|
// value={isActivePage}
|
||||||
|
// total={isNPage}
|
||||||
|
// onChange={(val) => {
|
||||||
|
// onPageClick(val);
|
||||||
|
// }}
|
||||||
|
/>
|
||||||
|
</Center> */}
|
||||||
|
</Paper>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
187
src/app_modules/admin/donasi/sub_menu/table_publish.tsx
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||||
|
import {
|
||||||
|
ActionIcon,
|
||||||
|
Box,
|
||||||
|
Button,
|
||||||
|
Center,
|
||||||
|
Group,
|
||||||
|
Pagination,
|
||||||
|
Paper,
|
||||||
|
ScrollArea,
|
||||||
|
Stack,
|
||||||
|
Table,
|
||||||
|
Text,
|
||||||
|
TextInput,
|
||||||
|
Title,
|
||||||
|
} from "@mantine/core";
|
||||||
|
import { IconChevronLeft, IconEyeCheck, IconSearch } from "@tabler/icons-react";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import ComponentAdminDonasi_TombolKembali from "../component/tombol_kembali";
|
||||||
|
import { MODEL_DONASI } from "@/app_modules/donasi/model/interface";
|
||||||
|
import { useState } from "react";
|
||||||
|
import TampilanRupiahDonasi from "@/app_modules/donasi/component/tampilan_rupiah";
|
||||||
|
import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate";
|
||||||
|
import adminDonasi_getListPublish from "../fun/get/get_list_publish";
|
||||||
|
|
||||||
|
export default function AdminDonasi_TablePublish({
|
||||||
|
listPublish,
|
||||||
|
}: {
|
||||||
|
listPublish: any;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack h={"100%"}>
|
||||||
|
<ComponentAdminGlobal_HeaderTamplate name="Donasi" />
|
||||||
|
<TableStatus listPublish={listPublish as any} />
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function TableStatus({ listPublish }: { listPublish: any }) {
|
||||||
|
const router = useRouter();
|
||||||
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
const [idData, setIdData] = useState("");
|
||||||
|
|
||||||
|
const [data, setData] = useState<MODEL_DONASI[]>(listPublish.data);
|
||||||
|
const [isNPage, setNPage] = useState(listPublish.nPage);
|
||||||
|
const [isActivePage, setActivePage] = useState(1);
|
||||||
|
const [isSearch, setSearch] = useState("");
|
||||||
|
|
||||||
|
async function onSearch(s: string) {
|
||||||
|
setSearch(s);
|
||||||
|
const loadData = await adminDonasi_getListPublish({
|
||||||
|
page: 1,
|
||||||
|
search: s,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onPageClick(p: any) {
|
||||||
|
setActivePage(p);
|
||||||
|
const loadData = await adminDonasi_getListPublish({
|
||||||
|
search: isSearch,
|
||||||
|
page: p,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
const TableRows = data.map((e, i) => (
|
||||||
|
<tr key={i}>
|
||||||
|
<td>
|
||||||
|
<Center>{e.title}</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>
|
||||||
|
<TampilanRupiahDonasi nominal={+e.target} />
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>
|
||||||
|
<TampilanRupiahDonasi nominal={+e.terkumpul} />
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>{e.DonasiMaster_Ketegori.name}</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>{e.DonasiMaster_Durasi.name} hari</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>
|
||||||
|
<Button
|
||||||
|
loaderPosition="center"
|
||||||
|
loading={isLoading && e?.id === idData ? true : false}
|
||||||
|
color={"green"}
|
||||||
|
leftIcon={<IconEyeCheck />}
|
||||||
|
radius={"xl"}
|
||||||
|
variant="outline"
|
||||||
|
onClick={() => {
|
||||||
|
setLoading(true);
|
||||||
|
setIdData(e?.id);
|
||||||
|
router.push(RouterAdminDonasi_OLD.detail_publish + `${e.id}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Tampilkan
|
||||||
|
</Button>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack spacing={"xs"} h={"100%"}>
|
||||||
|
{/* <pre>{JSON.stringify(listUser, null, 2)}</pre> */}
|
||||||
|
<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>Judul</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Target</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Terkumpul</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Ketegori</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Durasi</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Aksi</Center>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>{TableRows}</tbody>
|
||||||
|
</Table>
|
||||||
|
</ScrollArea>
|
||||||
|
{/* <ScrollArea>
|
||||||
|
</ScrollArea> */}
|
||||||
|
<Center mt={"xl"}>
|
||||||
|
<Pagination
|
||||||
|
value={isActivePage}
|
||||||
|
total={isNPage}
|
||||||
|
onChange={(val) => {
|
||||||
|
onPageClick(val);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Center>
|
||||||
|
</Paper>
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
220
src/app_modules/admin/donasi/sub_menu/table_reject.tsx
Normal file
@@ -0,0 +1,220 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||||
|
import {
|
||||||
|
ActionIcon,
|
||||||
|
Box,
|
||||||
|
Button,
|
||||||
|
Center,
|
||||||
|
Group,
|
||||||
|
Modal,
|
||||||
|
Pagination,
|
||||||
|
Paper,
|
||||||
|
ScrollArea,
|
||||||
|
Stack,
|
||||||
|
Table,
|
||||||
|
Text,
|
||||||
|
TextInput,
|
||||||
|
Title,
|
||||||
|
} from "@mantine/core";
|
||||||
|
import {
|
||||||
|
IconChevronLeft,
|
||||||
|
IconEyeCheck,
|
||||||
|
IconEyeClosed,
|
||||||
|
IconEyeEdit,
|
||||||
|
IconSearch,
|
||||||
|
} from "@tabler/icons-react";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import ComponentAdminDonasi_TombolKembali from "../component/tombol_kembali";
|
||||||
|
import { useDisclosure } from "@mantine/hooks";
|
||||||
|
import AdminDonasi_DetailReview from "../detail/detail_review";
|
||||||
|
import { MODEL_DONASI } from "@/app_modules/donasi/model/interface";
|
||||||
|
import { useState } from "react";
|
||||||
|
import TampilanRupiahDonasi from "@/app_modules/donasi/component/tampilan_rupiah";
|
||||||
|
import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate";
|
||||||
|
import adminDonasi_getListReject from "../fun/get/get_list_reject";
|
||||||
|
|
||||||
|
export default function AdminDonasi_TableReject({
|
||||||
|
dataReject,
|
||||||
|
}: {
|
||||||
|
dataReject: any;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack h={"100%"}>
|
||||||
|
<ComponentAdminGlobal_HeaderTamplate name="Donasi" />
|
||||||
|
<TableStatus dataReject={dataReject} />
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function TableStatus({ dataReject }: { dataReject: any }) {
|
||||||
|
const router = useRouter();
|
||||||
|
const [opened, { open, close }] = useDisclosure(false);
|
||||||
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
const [idData, setIdData] = useState("");
|
||||||
|
const [data, setData] = useState<MODEL_DONASI[]>(dataReject.data);
|
||||||
|
const [isNPage, setNPage] = useState(dataReject.nPage);
|
||||||
|
const [isActivePage, setActivePage] = useState(1);
|
||||||
|
const [isSearch, setSearch] = useState("");
|
||||||
|
|
||||||
|
async function onSearch(s: string) {
|
||||||
|
setSearch(s);
|
||||||
|
const loadData = await adminDonasi_getListReject({
|
||||||
|
page: 1,
|
||||||
|
search: s,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onPageClick(p: any) {
|
||||||
|
setActivePage(p);
|
||||||
|
const loadData = await adminDonasi_getListReject({
|
||||||
|
search: isSearch,
|
||||||
|
page: p,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
const TableRows = data.map((e, i) => (
|
||||||
|
<tr key={i}>
|
||||||
|
<td>
|
||||||
|
<Center>{e?.Author?.username}</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>{e?.title}</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>
|
||||||
|
<TampilanRupiahDonasi nominal={+e?.target} />
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>{e?.DonasiMaster_Ketegori.name}</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>{e?.DonasiMaster_Durasi.name} hari</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>
|
||||||
|
<Button
|
||||||
|
color={"red"}
|
||||||
|
leftIcon={<IconEyeEdit />}
|
||||||
|
radius={"xl"}
|
||||||
|
variant="outline"
|
||||||
|
onClick={() =>
|
||||||
|
router.push(RouterAdminDonasi_OLD.detail_reject + `${e.id}`)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
Lihat Alasan
|
||||||
|
</Button>
|
||||||
|
</Center>
|
||||||
|
|
||||||
|
{/* <ModalReject opened={opened} close={close} /> */}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack spacing={"xs"} h={"100%"}>
|
||||||
|
{/* <pre>{JSON.stringify(listUser, null, 2)}</pre> */}
|
||||||
|
<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>Target</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Ketegori</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Durasi</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Alasan</Center>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>{TableRows}</tbody>
|
||||||
|
</Table>
|
||||||
|
</ScrollArea>
|
||||||
|
{/* <ScrollArea>
|
||||||
|
</ScrollArea> */}
|
||||||
|
<Center mt={"xl"}>
|
||||||
|
<Pagination
|
||||||
|
value={isActivePage}
|
||||||
|
total={isNPage}
|
||||||
|
onChange={(val) => {
|
||||||
|
onPageClick(val);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Center>
|
||||||
|
</Paper>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
|
{data.map((e, i) => (
|
||||||
|
<Modal
|
||||||
|
key={e.id}
|
||||||
|
opened={opened}
|
||||||
|
onClose={close}
|
||||||
|
centered
|
||||||
|
withCloseButton={false}
|
||||||
|
>
|
||||||
|
<Stack>
|
||||||
|
<Title order={6}>Alasan penolakan</Title>
|
||||||
|
<Text>{i}</Text>
|
||||||
|
</Stack>
|
||||||
|
</Modal>
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function ModalReject(opened: any, close: any) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Modal opened={opened} onClose={close} centered withCloseButton={false}>
|
||||||
|
<Stack>
|
||||||
|
<Title order={6}>Alasan penolakan</Title>
|
||||||
|
<Text>{"test"}</Text>
|
||||||
|
</Stack>
|
||||||
|
</Modal>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
187
src/app_modules/admin/donasi/sub_menu/table_review.tsx
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||||
|
import {
|
||||||
|
ActionIcon,
|
||||||
|
Box,
|
||||||
|
Button,
|
||||||
|
Center,
|
||||||
|
Group,
|
||||||
|
Modal,
|
||||||
|
Pagination,
|
||||||
|
Paper,
|
||||||
|
ScrollArea,
|
||||||
|
Stack,
|
||||||
|
Table,
|
||||||
|
Text,
|
||||||
|
TextInput,
|
||||||
|
Title,
|
||||||
|
} from "@mantine/core";
|
||||||
|
import { IconChevronLeft, IconEyeCheck, IconSearch } from "@tabler/icons-react";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import ComponentAdminDonasi_TombolKembali from "../component/tombol_kembali";
|
||||||
|
import { useDisclosure } from "@mantine/hooks";
|
||||||
|
import AdminDonasi_DetailReview from "../detail/detail_review";
|
||||||
|
import { MODEL_DONASI } from "@/app_modules/donasi/model/interface";
|
||||||
|
import { useState } from "react";
|
||||||
|
import TampilanRupiahDonasi from "@/app_modules/donasi/component/tampilan_rupiah";
|
||||||
|
import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate";
|
||||||
|
import _ from "lodash";
|
||||||
|
import adminDonasi_getListReview from "../fun/get/get_list_review";
|
||||||
|
|
||||||
|
export default function AdminDonasi_TableReview({
|
||||||
|
listReview,
|
||||||
|
}: {
|
||||||
|
listReview: MODEL_DONASI[];
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack h={"100%"}>
|
||||||
|
<ComponentAdminGlobal_HeaderTamplate name="Donasi" />
|
||||||
|
<TableStatus listReview={listReview} />
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function TableStatus({ listReview }: { listReview: any }) {
|
||||||
|
const router = useRouter();
|
||||||
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
const [idData, setIdData] = useState("");
|
||||||
|
const [data, setData] = useState<MODEL_DONASI[]>(listReview.data);
|
||||||
|
const [isNPage, setNPage] = useState(listReview.nPage);
|
||||||
|
const [isActivePage, setActivePage] = useState(1);
|
||||||
|
const [isSearch, setSearch] = useState("");
|
||||||
|
|
||||||
|
async function onSearch(s: string) {
|
||||||
|
setSearch(s);
|
||||||
|
const loadData = await adminDonasi_getListReview({
|
||||||
|
page: 1,
|
||||||
|
search: s,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onPageClick(p: any) {
|
||||||
|
setActivePage(p);
|
||||||
|
const loadData = await adminDonasi_getListReview({
|
||||||
|
search: isSearch,
|
||||||
|
page: p,
|
||||||
|
});
|
||||||
|
setData(loadData.data as any);
|
||||||
|
setNPage(loadData.nPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
const TableRows = data.map((e, i) => (
|
||||||
|
<tr key={i}>
|
||||||
|
<td>
|
||||||
|
<Center>{e?.Author?.username}</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>{e?.title}</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>
|
||||||
|
<TampilanRupiahDonasi nominal={+e?.target} />
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>{e?.DonasiMaster_Ketegori.name}</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>{e?.DonasiMaster_Durasi.name} hari</Center>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Center>
|
||||||
|
<Button
|
||||||
|
loaderPosition="center"
|
||||||
|
loading={isLoading && e?.id == idData ? true : false}
|
||||||
|
color={"orange"}
|
||||||
|
leftIcon={<IconEyeCheck />}
|
||||||
|
radius={"xl"}
|
||||||
|
variant="outline"
|
||||||
|
onClick={() => {
|
||||||
|
setLoading(true);
|
||||||
|
setIdData(e?.id);
|
||||||
|
router.push(RouterAdminDonasi_OLD.detail_review + `${e?.id}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Tampilkan
|
||||||
|
</Button>
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack spacing={"xs"} h={"100%"}>
|
||||||
|
{/* <pre>{JSON.stringify(listUser, null, 2)}</pre> */}
|
||||||
|
<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}
|
||||||
|
h={"100%"}
|
||||||
|
striped
|
||||||
|
highlightOnHover
|
||||||
|
>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<Center>Username</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Judul</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Target</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Ketegori</Center>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<Center>Durasi</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>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import { RouterAdminDonasi } from "@/app/lib/router_hipmi/router_admin";
|
|
||||||
import {
|
|
||||||
ActionIcon,
|
|
||||||
Box,
|
|
||||||
Button,
|
|
||||||
Center,
|
|
||||||
Group,
|
|
||||||
Stack,
|
|
||||||
Table,
|
|
||||||
Text,
|
|
||||||
Title,
|
|
||||||
} from "@mantine/core";
|
|
||||||
import { IconChevronLeft, IconEyeCheck } from "@tabler/icons-react";
|
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import ComponentAdminDonasi_TombolKembali from "../component/tombol_kembali";
|
|
||||||
import { MODEL_DONASI } from "@/app_modules/donasi/model/interface";
|
|
||||||
import { useState } from "react";
|
|
||||||
import TampilanRupiahDonasi from "@/app_modules/donasi/component/tampilan_rupiah";
|
|
||||||
|
|
||||||
export default function AdminDonasi_TablePublish({
|
|
||||||
listPublish,
|
|
||||||
}: {
|
|
||||||
listPublish: MODEL_DONASI;
|
|
||||||
}) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Stack>
|
|
||||||
<ComponentAdminDonasi_TombolKembali />
|
|
||||||
<TableStatus listPublish={listPublish as any} />
|
|
||||||
</Stack>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function TableStatus({ listPublish }: { listPublish: MODEL_DONASI[] }) {
|
|
||||||
const router = useRouter();
|
|
||||||
const [donasi, setDonasi] = useState(listPublish);
|
|
||||||
|
|
||||||
|
|
||||||
const TableRows = donasi.map((e, i) => (
|
|
||||||
<tr key={i}>
|
|
||||||
<td>{e.title}</td>
|
|
||||||
<td>
|
|
||||||
<TampilanRupiahDonasi nominal={+e.target} />
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<TampilanRupiahDonasi nominal={+e.terkumpul}/>
|
|
||||||
</td>
|
|
||||||
<td>{e.DonasiMaster_Ketegori.name}</td>
|
|
||||||
<td>{e.DonasiMaster_Durasi.name} hari</td>
|
|
||||||
<td>
|
|
||||||
<Center>
|
|
||||||
<Button
|
|
||||||
compact
|
|
||||||
color={"green"}
|
|
||||||
leftIcon={<IconEyeCheck />}
|
|
||||||
radius={"xl"}
|
|
||||||
variant="outline"
|
|
||||||
onClick={() => router.push(RouterAdminDonasi.detail_publish + `${e.id}`)}
|
|
||||||
>
|
|
||||||
Tampilkan
|
|
||||||
</Button>
|
|
||||||
</Center>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
));
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<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>Judul</th>
|
|
||||||
<th>Target</th>
|
|
||||||
<th>Terkumpul</th>
|
|
||||||
<th>Ketegori</th>
|
|
||||||
<th>Durasi</th>
|
|
||||||
<th><Center>Aksi</Center></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>{TableRows}</tbody>
|
|
||||||
</Table>
|
|
||||||
</Box>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,131 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import { RouterAdminDonasi } from "@/app/lib/router_hipmi/router_admin";
|
|
||||||
import {
|
|
||||||
ActionIcon,
|
|
||||||
Box,
|
|
||||||
Button,
|
|
||||||
Center,
|
|
||||||
Group,
|
|
||||||
Modal,
|
|
||||||
Stack,
|
|
||||||
Table,
|
|
||||||
Text,
|
|
||||||
Title,
|
|
||||||
} from "@mantine/core";
|
|
||||||
import { IconChevronLeft, IconEyeCheck } from "@tabler/icons-react";
|
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import ComponentAdminDonasi_TombolKembali from "../component/tombol_kembali";
|
|
||||||
import { useDisclosure } from "@mantine/hooks";
|
|
||||||
import AdminDonasi_DetailReview from "../detail_table/detail_review";
|
|
||||||
import { MODEL_DONASI } from "@/app_modules/donasi/model/interface";
|
|
||||||
import { useState } from "react";
|
|
||||||
import TampilanRupiahDonasi from "@/app_modules/donasi/component/tampilan_rupiah";
|
|
||||||
|
|
||||||
export default function AdminDonasi_TableReject({
|
|
||||||
dataReject,
|
|
||||||
}: {
|
|
||||||
dataReject: MODEL_DONASI[];
|
|
||||||
}) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Stack>
|
|
||||||
<ComponentAdminDonasi_TombolKembali />
|
|
||||||
<TableStatus dataReject={dataReject} />
|
|
||||||
</Stack>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function TableStatus({ dataReject }: { dataReject: MODEL_DONASI[] }) {
|
|
||||||
const router = useRouter();
|
|
||||||
const [opened, { open, close }] = useDisclosure(false);
|
|
||||||
const [donasi, setDonasi] = useState(dataReject);
|
|
||||||
|
|
||||||
const TableRows = donasi.map((e, i) => (
|
|
||||||
<tr key={i}>
|
|
||||||
<td>{e.title}</td>
|
|
||||||
<td>
|
|
||||||
<TampilanRupiahDonasi nominal={+e.target} />
|
|
||||||
</td>
|
|
||||||
<td>{e.DonasiMaster_Ketegori.name}</td>
|
|
||||||
<td>{e.DonasiMaster_Durasi.name} hari</td>
|
|
||||||
<td>
|
|
||||||
<Center>
|
|
||||||
<Button
|
|
||||||
compact
|
|
||||||
color={"red"}
|
|
||||||
leftIcon={<IconEyeCheck />}
|
|
||||||
radius={"xl"}
|
|
||||||
variant="outline"
|
|
||||||
onClick={() => router.push(RouterAdminDonasi.detail_reject + `${e.id}`)}
|
|
||||||
>
|
|
||||||
Tampilkan
|
|
||||||
</Button>
|
|
||||||
</Center>
|
|
||||||
|
|
||||||
{/* <ModalReject opened={opened} close={close} /> */}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
));
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{donasi.map((e,i) => (
|
|
||||||
<Modal
|
|
||||||
key={e.id}
|
|
||||||
opened={opened}
|
|
||||||
onClose={close}
|
|
||||||
centered
|
|
||||||
withCloseButton={false}
|
|
||||||
>
|
|
||||||
<Stack>
|
|
||||||
<Title order={6}>Alasan penolakan</Title>
|
|
||||||
<Text>{i}</Text>
|
|
||||||
</Stack>
|
|
||||||
</Modal>
|
|
||||||
))}
|
|
||||||
<Box>
|
|
||||||
<Box bg={"red.1"} p={"xs"}>
|
|
||||||
<Title order={6} c={"red"}>
|
|
||||||
REJECT
|
|
||||||
</Title>
|
|
||||||
</Box>
|
|
||||||
<Table
|
|
||||||
withBorder
|
|
||||||
verticalSpacing={"md"}
|
|
||||||
horizontalSpacing={"xl"}
|
|
||||||
p={"md"}
|
|
||||||
striped
|
|
||||||
highlightOnHover
|
|
||||||
>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Judul</th>
|
|
||||||
<th>Target</th>
|
|
||||||
<th>Ketegori</th>
|
|
||||||
<th>Durasi</th>
|
|
||||||
<th>
|
|
||||||
<Center>Lihat alasan</Center>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>{TableRows}</tbody>
|
|
||||||
</Table>
|
|
||||||
</Box>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function ModalReject(opened: any, close: any) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Modal opened={opened} onClose={close} centered withCloseButton={false}>
|
|
||||||
<Stack>
|
|
||||||
<Title order={6}>Alasan penolakan</Title>
|
|
||||||
<Text>{"test"}</Text>
|
|
||||||
</Stack>
|
|
||||||
</Modal>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import { RouterAdminDonasi } from "@/app/lib/router_hipmi/router_admin";
|
|
||||||
import {
|
|
||||||
ActionIcon,
|
|
||||||
Box,
|
|
||||||
Button,
|
|
||||||
Center,
|
|
||||||
Group,
|
|
||||||
Modal,
|
|
||||||
Stack,
|
|
||||||
Table,
|
|
||||||
Text,
|
|
||||||
Title,
|
|
||||||
} from "@mantine/core";
|
|
||||||
import { IconChevronLeft, IconEyeCheck } from "@tabler/icons-react";
|
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import ComponentAdminDonasi_TombolKembali from "../component/tombol_kembali";
|
|
||||||
import { useDisclosure } from "@mantine/hooks";
|
|
||||||
import AdminDonasi_DetailReview from "../detail_table/detail_review";
|
|
||||||
import { MODEL_DONASI } from "@/app_modules/donasi/model/interface";
|
|
||||||
import { useState } from "react";
|
|
||||||
import TampilanRupiahDonasi from "@/app_modules/donasi/component/tampilan_rupiah";
|
|
||||||
|
|
||||||
export default function AdminDonasi_TableReview({
|
|
||||||
listReview,
|
|
||||||
}: {
|
|
||||||
listReview: MODEL_DONASI[];
|
|
||||||
}) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Stack>
|
|
||||||
<ComponentAdminDonasi_TombolKembali />
|
|
||||||
<TableStatus listReview={listReview} />
|
|
||||||
</Stack>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function TableStatus({ listReview }: { listReview: MODEL_DONASI[] }) {
|
|
||||||
const router = useRouter();
|
|
||||||
const [opened, { open, close }] = useDisclosure(false);
|
|
||||||
const [donasi, setDonasi] = useState(listReview);
|
|
||||||
|
|
||||||
async function onClick() {
|
|
||||||
// router.push(RouterAdminDonasi.detail_publish);
|
|
||||||
}
|
|
||||||
|
|
||||||
const TableRows = donasi.map((e, i) => (
|
|
||||||
<tr key={i}>
|
|
||||||
<td>{e.title}</td>
|
|
||||||
<td>
|
|
||||||
<TampilanRupiahDonasi nominal={+e.target} />
|
|
||||||
</td>
|
|
||||||
<td>{e.DonasiMaster_Ketegori.name}</td>
|
|
||||||
<td>{e.DonasiMaster_Durasi.name} hari</td>
|
|
||||||
<td>
|
|
||||||
<Center>
|
|
||||||
<Button
|
|
||||||
compact
|
|
||||||
color={"orange"}
|
|
||||||
leftIcon={<IconEyeCheck />}
|
|
||||||
radius={"xl"}
|
|
||||||
variant="outline"
|
|
||||||
onClick={() => router.push(RouterAdminDonasi.detail_review + `${e.id}`)}
|
|
||||||
>
|
|
||||||
Tampilkan
|
|
||||||
</Button>
|
|
||||||
</Center>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
));
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Box>
|
|
||||||
<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>Judul</th>
|
|
||||||
<th>Target</th>
|
|
||||||
<th>Ketegori</th>
|
|
||||||
<th>Durasi</th>
|
|
||||||
<th>
|
|
||||||
<Center>Aksi</Center>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>{TableRows}</tbody>
|
|
||||||
</Table>
|
|
||||||
</Box>
|
|
||||||
|
|
||||||
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -17,7 +17,7 @@ import {
|
|||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import ComponentAdminDonasi_TombolKembali from "../../donasi/component/tombol_kembali";
|
import ComponentAdminDonasi_TombolKembali from "../../donasi/component/tombol_kembali";
|
||||||
import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate";
|
import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate";
|
||||||
import { MODEL_DEFAULT_MASTER } from "@/app_modules/model_global/interface";
|
import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/interface";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { AdminEvent_funCreateTipeAcara } from "../fun/create/fun_create_tipe_acara";
|
import { AdminEvent_funCreateTipeAcara } from "../fun/create/fun_create_tipe_acara";
|
||||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
|
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
|
||||||
@@ -45,11 +45,11 @@ export default function AdminEvent_DetailTipeAcara({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function DetailTipeAcara({ listTipe }: { listTipe: MODEL_DEFAULT_MASTER[] }) {
|
function DetailTipeAcara({ listTipe }: { listTipe: MODEL_DEFAULT_MASTER_OLD[] }) {
|
||||||
const [tipe, setTipe] = useState(listTipe);
|
const [tipe, setTipe] = useState(listTipe);
|
||||||
const [name, setName] = useState("");
|
const [name, setName] = useState("");
|
||||||
const [openEditor, setOpenEditor] = useState(false);
|
const [openEditor, setOpenEditor] = useState(false);
|
||||||
const [edit, setEdit] = useState<MODEL_DEFAULT_MASTER | null>(null);
|
const [edit, setEdit] = useState<MODEL_DEFAULT_MASTER_OLD | null>(null);
|
||||||
const [opened, { open, close }] = useDisclosure(false);
|
const [opened, { open, close }] = useDisclosure(false);
|
||||||
const [hapusTipe, setHapusTipe] = useState({
|
const [hapusTipe, setHapusTipe] = useState({
|
||||||
id: "",
|
id: "",
|
||||||
@@ -222,7 +222,7 @@ async function onUpdate(id: any, edit: any, setTipe: any, setOpenEditor: any) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onDelete(data: MODEL_DEFAULT_MASTER, close: any, setTipe: any) {
|
async function onDelete(data: MODEL_DEFAULT_MASTER_OLD, close: any, setTipe: any) {
|
||||||
await AdminEvent_funEditActivationTipeAcaraById(data.id as any).then(
|
await AdminEvent_funEditActivationTipeAcaraById(data.id as any).then(
|
||||||
async (res) => {
|
async (res) => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { RouterAdminDonasi } from "@/app/lib/router_hipmi/router_admin";
|
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
Avatar,
|
Avatar,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { RouterAdminDonasi } from "@/app/lib/router_hipmi/router_admin";
|
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
Box,
|
Box,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { RouterAdminDonasi } from "@/app/lib/router_hipmi/router_admin";
|
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
Box,
|
Box,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { RouterAdminInvestasi } from "@/app/lib/router_hipmi/router_admin";
|
import { RouterAdminInvestasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||||
import {
|
import {
|
||||||
Avatar,
|
Avatar,
|
||||||
@@ -41,7 +41,7 @@ export default function Admin_BuktiTransferInvestasi() {
|
|||||||
<>
|
<>
|
||||||
{/* Box Username */}
|
{/* Box Username */}
|
||||||
{listUsername.map((e) => (
|
{listUsername.map((e) => (
|
||||||
<Paper key={e.id} bg={"gray"} p={"md"} mb={"xs"} onClick={() => router.push(RouterAdminInvestasi.status_transfer)}>
|
<Paper key={e.id} bg={"gray"} p={"md"} mb={"xs"} onClick={() => router.push(RouterAdminInvestasi_OLD.status_transfer)}>
|
||||||
<Grid align="center">
|
<Grid align="center">
|
||||||
<Grid.Col span={6}>
|
<Grid.Col span={6}>
|
||||||
<Text>Username</Text>
|
<Text>Username</Text>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use server"
|
"use server"
|
||||||
|
|
||||||
import prisma from "@/app/lib/prisma"
|
import prisma from "@/app/lib/prisma"
|
||||||
import { RouterAdminInvestasi } from "@/app/lib/router_hipmi/router_admin"
|
import { RouterAdminInvestasi_OLD } from "@/app/lib/router_hipmi/router_admin"
|
||||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi"
|
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi"
|
||||||
import { revalidatePath } from "next/cache"
|
import { revalidatePath } from "next/cache"
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ export default async function Admin_funRejectInvestasi(data: any) {
|
|||||||
})
|
})
|
||||||
if(!res) return {status: 400, message: "Gagal reject"}
|
if(!res) return {status: 400, message: "Gagal reject"}
|
||||||
|
|
||||||
revalidatePath(RouterAdminInvestasi.main_investasi)
|
revalidatePath(RouterAdminInvestasi_OLD.main_investasi)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
status: 200,
|
status: 200,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { RouterAdminInvestasi } from "@/app/lib/router_hipmi/router_admin";
|
import { RouterAdminInvestasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
@@ -24,13 +24,13 @@ export default function Admin_HalamanAksi({idInves}: {idInves: string}) {
|
|||||||
id: 1,
|
id: 1,
|
||||||
name: "Konfirmasi",
|
name: "Konfirmasi",
|
||||||
desc: "Publis atau non - aktifkan proyek invetsasi",
|
desc: "Publis atau non - aktifkan proyek invetsasi",
|
||||||
route: RouterAdminInvestasi.konfirmasi,
|
route: RouterAdminInvestasi_OLD.konfirmasi,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
name: "Bukti Transfer",
|
name: "Bukti Transfer",
|
||||||
desc: "Lihat bukti transfer investor",
|
desc: "Lihat bukti transfer investor",
|
||||||
route: RouterAdminInvestasi.bukti_transfer,
|
route: RouterAdminInvestasi_OLD.bukti_transfer,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ import { useRouter } from "next/navigation";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import toast, { toastConfig } from "react-simple-toasts";
|
import toast, { toastConfig } from "react-simple-toasts";
|
||||||
import Admin_funRejectInvestasi from "../fun/fun_reject_investasi";
|
import Admin_funRejectInvestasi from "../fun/fun_reject_investasi";
|
||||||
import { RouterAdminInvestasi } from "@/app/lib/router_hipmi/router_admin";
|
import { RouterAdminInvestasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||||
import "react-simple-toasts/dist/theme/dark.css";
|
import "react-simple-toasts/dist/theme/dark.css";
|
||||||
import { BeritaInvestasi } from "@/app_modules/investasi";
|
import { BeritaInvestasi } from "@/app_modules/investasi";
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ export default function Admin_KonfirmasiInvestasi({
|
|||||||
await funGantiStatusInvestasi(investasi.id, "3", "1").then((res) => {
|
await funGantiStatusInvestasi(investasi.id, "3", "1").then((res) => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
setTimeout(() => setPublish(false), 1000);
|
setTimeout(() => setPublish(false), 1000);
|
||||||
router.push(RouterAdminInvestasi.table_status_review);
|
router.push(RouterAdminInvestasi_OLD.table_status_review);
|
||||||
toast("Proyek Investasi Di Publish");
|
toast("Proyek Investasi Di Publish");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||