# feat
## Deskripsi : - Notifikasi donasi ### No Issue
This commit is contained in:
BIN
public/donasi/pencairan/ba62da22-8973-4789-88a3-b20acd726dc9.jpg
Normal file
BIN
public/donasi/pencairan/ba62da22-8973-4789-88a3-b20acd726dc9.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.1 KiB |
BIN
public/profile/foto/02fd0df2-337e-474f-972f-cd3748ac19a7.jpg
Normal file
BIN
public/profile/foto/02fd0df2-337e-474f-972f-cd3748ac19a7.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
BIN
public/profile/foto/f29acfca-8c7d-4613-9c4c-51eba880a979.jpg
Normal file
BIN
public/profile/foto/f29acfca-8c7d-4613-9c4c-51eba880a979.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.7 KiB |
11
src/app/dev/donasi/bukti-transfer/[id]/page.tsx
Normal file
11
src/app/dev/donasi/bukti-transfer/[id]/page.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import { LayoutDonasi_BuktiTransfer } from "@/app_modules/donasi";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
let imageId = params.id;
|
||||
|
||||
return (
|
||||
<>
|
||||
<LayoutDonasi_BuktiTransfer imageId={imageId} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import ComponentGlobal_V2_LoadingPage from "@/app_modules/_global/loading_page_v2";
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<ComponentGlobal_V2_LoadingPage />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import ComponentGlobal_V2_LoadingPage from "@/app_modules/_global/loading_page_v2";
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<ComponentGlobal_V2_LoadingPage />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import ComponentGlobal_V2_LoadingPage from "@/app_modules/_global/loading_page_v2";
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<ComponentGlobal_V2_LoadingPage />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -88,7 +88,7 @@ export default function AdminDonasi_DetailPublish({
|
||||
<>
|
||||
{/* <pre>{JSON.stringify(pencairan, null, 2)}</pre> */}
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_BackButton />
|
||||
<ComponentAdminGlobal_BackButton path={RouterAdminDonasi.table_publish} />
|
||||
<TampilanDetailDonasi donasi={dataDonasi} countDonatur={countDonatur} />
|
||||
<TampilanListDonatur
|
||||
donatur={listDonatur}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
"use client";
|
||||
|
||||
import ComponentGlobal_ErrorInput from "@/app_modules/_global/component/error_input";
|
||||
import { ComponentAdminGlobal_NotifikasiBerhasil } from "@/app_modules/admin/component_global/admin_notifikasi/notifikasi_berhasil";
|
||||
import { ComponentAdminGlobal_NotifikasiGagal } from "@/app_modules/admin/component_global/admin_notifikasi/notifikasi_gagal";
|
||||
import { ComponentAdminGlobal_NotifikasiPeringatan } from "@/app_modules/admin/component_global/admin_notifikasi/notifikasi_peringatan";
|
||||
import ComponentAdminGlobal_TampilanRupiahDonasi from "@/app_modules/admin/component_global/tampilan_rupiah";
|
||||
import adminNotifikasi_funCreateToUser from "@/app_modules/admin/notifikasi/fun/create/fun_create_notif_user";
|
||||
import ComponentDonasi_NotedBox from "@/app_modules/donasi/component/noted_box";
|
||||
import { NotifBerhasil } from "@/app_modules/donasi/component/notifikasi/notif_berhasil";
|
||||
import { NotifGagal } from "@/app_modules/donasi/component/notifikasi/notif_gagal";
|
||||
import { NotifPeringatan } from "@/app_modules/donasi/component/notifikasi/notif_peringatan";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import {
|
||||
AspectRatio,
|
||||
Button,
|
||||
@@ -25,12 +28,8 @@ import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import ComponentAdminDonasi_TombolKembali from "../../component/tombol_kembali";
|
||||
import { AdminDonasi_funCreatePencairanDana } from "../../fun/create/fun_create_pencairan_dana";
|
||||
import { AdminDonasi_AkumulasiPencairanById } from "../../fun/update/fun_update_akumulasi_pencairan";
|
||||
import ComponentGlobal_ErrorInput from "@/app_modules/_global/component/error_input";
|
||||
import { ComponentAdminGlobal_NotifikasiPeringatan } from "@/app_modules/admin/component_global/admin_notifikasi/notifikasi_peringatan";
|
||||
import { ComponentAdminGlobal_NotifikasiBerhasil } from "@/app_modules/admin/component_global/admin_notifikasi/notifikasi_berhasil";
|
||||
import { ComponentAdminGlobal_NotifikasiGagal } from "@/app_modules/admin/component_global/admin_notifikasi/notifikasi_gagal";
|
||||
import { AdminDonasi_getOneById } from "../../fun/get/get_one_by_id";
|
||||
import { AdminDonasi_AkumulasiPencairanById } from "../../fun/update/fun_update_akumulasi_pencairan";
|
||||
|
||||
export default function AdminDonasi_PencairanDana({
|
||||
donasiId,
|
||||
@@ -56,7 +55,7 @@ export default function AdminDonasi_PencairanDana({
|
||||
onSuccess={(val) => {
|
||||
setTerkumpul(val.terkumpul);
|
||||
setTotal(val.totalPencairan);
|
||||
console.log(val)
|
||||
console.log(val);
|
||||
}}
|
||||
/>
|
||||
</Stack>
|
||||
@@ -148,15 +147,6 @@ function FormView({
|
||||
}
|
||||
value={value.nilai}
|
||||
onChange={(val) => {
|
||||
// const nilai = val.currentTarget.value;
|
||||
// const nilaiTypeNumber = toNumber(val.currentTarget.value);
|
||||
|
||||
// if (nilaiTypeNumber > sisaDana) {
|
||||
// console.log("lebih");
|
||||
// } else {
|
||||
// console.log("kurang");
|
||||
// }
|
||||
|
||||
const match = val.currentTarget.value
|
||||
.replace(/\./g, "")
|
||||
.match(/^[0-9]+$/);
|
||||
@@ -314,24 +304,41 @@ async function onSave({
|
||||
const gambar = new FormData();
|
||||
gambar.append("file", file as any);
|
||||
|
||||
await AdminDonasi_funCreatePencairanDana(body as any, gambar).then(
|
||||
async (res) => {
|
||||
if (res.status === 200) {
|
||||
await AdminDonasi_AkumulasiPencairanById(
|
||||
body.donasiId as any,
|
||||
body.nominalCair as any
|
||||
).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
const loadData = await AdminDonasi_getOneById(donasiId);
|
||||
onSuccess1(loadData);
|
||||
ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
||||
} else {
|
||||
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
NotifGagal(res.message);
|
||||
const res = await AdminDonasi_funCreatePencairanDana(body as any, gambar);
|
||||
if (res.status === 200) {
|
||||
const res2 = await AdminDonasi_AkumulasiPencairanById(
|
||||
body.donasiId as any,
|
||||
body.nominalCair as any
|
||||
);
|
||||
if (res2.status === 200) {
|
||||
const loadData = await AdminDonasi_getOneById(donasiId);
|
||||
onSuccess1(loadData);
|
||||
|
||||
const dataNotif = {
|
||||
appId: loadData?.id,
|
||||
userId: loadData?.authorId,
|
||||
pesan: loadData?.title as any,
|
||||
status: "Pencairan Dana",
|
||||
kategoriApp: "DONASI",
|
||||
title: "Dana donasi berhasil dicairkan",
|
||||
};
|
||||
|
||||
const notif = await adminNotifikasi_funCreateToUser({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish(
|
||||
"USER",
|
||||
JSON.stringify({ userId: loadData?.authorId, count: 1 })
|
||||
);
|
||||
}
|
||||
|
||||
ComponentAdminGlobal_NotifikasiBerhasil(res2.message);
|
||||
} else {
|
||||
ComponentAdminGlobal_NotifikasiGagal(res2.message);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,14 +60,15 @@ export default function MainCrowd() {
|
||||
border: `2px solid ${AccentColor.blue}`,
|
||||
borderRadius: "10px",
|
||||
backgroundColor: MainColor.darkblue,
|
||||
color: "white",
|
||||
// color: "white",
|
||||
color: "gray",
|
||||
}}
|
||||
onClick={() => {
|
||||
// setLoadingInv(true);
|
||||
// router.push(RouterCrowd.investasi);
|
||||
// setChangeColor(0);
|
||||
ComponentGlobal_NotifikasiPeringatan(
|
||||
"Sementara ini sedang maintenance",
|
||||
"Sedang Perbaikan",
|
||||
3000
|
||||
);
|
||||
}}
|
||||
@@ -103,13 +104,13 @@ export default function MainCrowd() {
|
||||
color: "white",
|
||||
}}
|
||||
onClick={() => {
|
||||
// setLoadingDon(true);
|
||||
// router.push(RouterCrowd.donasi);
|
||||
// setDonasiHotMenu(0);
|
||||
ComponentGlobal_NotifikasiPeringatan(
|
||||
"Sementara ini sedang maintenance",
|
||||
3000
|
||||
);
|
||||
setLoadingDon(true);
|
||||
router.push(RouterCrowd.donasi);
|
||||
setDonasiHotMenu(0);
|
||||
// ComponentGlobal_NotifikasiPeringatan(
|
||||
// "Sementara ini sedang maintenance",
|
||||
// 3000
|
||||
// );
|
||||
}}
|
||||
>
|
||||
<Grid>
|
||||
|
||||
@@ -69,18 +69,7 @@ export function ComponentDonasi_DetailDataMain({
|
||||
radius={"sm"}
|
||||
/>
|
||||
</AspectRatio>
|
||||
{/* <Center>
|
||||
<Image
|
||||
maw={200}
|
||||
radius={"xs"}
|
||||
alt="Foto"
|
||||
src={RouterDonasi?.api_gambar + `${donasi?.imagesId}`}
|
||||
/>
|
||||
</Center> */}
|
||||
{/* <AspectRatio ratio={16 / 9}>
|
||||
<Paper radius={"md"}>
|
||||
</Paper>
|
||||
</AspectRatio> */}
|
||||
|
||||
<Stack spacing={0} mt={"lg"}>
|
||||
<Title order={4}>{donasi?.title}</Title>
|
||||
<ComponentDonasi_TampilanHitungMundur
|
||||
@@ -172,8 +161,12 @@ export function ComponentDonasi_DetailDataMain({
|
||||
<Grid.Col
|
||||
span={"auto"}
|
||||
onClick={() => {
|
||||
setLoadingPencairan(true);
|
||||
onPencairanDana(router, donasi, userLoginId);
|
||||
onPencairanDana(
|
||||
router,
|
||||
donasi,
|
||||
userLoginId,
|
||||
setLoadingPencairan
|
||||
);
|
||||
}}
|
||||
>
|
||||
<Stack spacing={"sm"} align="center">
|
||||
@@ -199,19 +192,19 @@ export function ComponentDonasi_DetailDataMain({
|
||||
async function onPencairanDana(
|
||||
router: AppRouterInstance,
|
||||
donasi: MODEL_DONASI,
|
||||
userLoginId: string
|
||||
userLoginId: string,
|
||||
setLoadingPencairan: any
|
||||
) {
|
||||
// console.log(userLoginId)
|
||||
// console.log(donasi.authorId)
|
||||
const cek = await Donasi_findDonaturByTokenId(donasi.id, userLoginId);
|
||||
|
||||
if (userLoginId == donasi.authorId)
|
||||
if (userLoginId == donasi.authorId) {
|
||||
setLoadingPencairan(true);
|
||||
return router.push(RouterDonasi.pencairan_dana + `${donasi.id}`);
|
||||
}
|
||||
|
||||
if (!cek) return NotifPeringatan("Halaman khusus donatur");
|
||||
router.push(RouterDonasi.pencairan_dana + `${donasi.id}`);
|
||||
|
||||
// if (userLoginId != donasi.authorId)
|
||||
// return NotifPeringatan("Halaman khusus donatur");
|
||||
// router.push(RouterDonasi.pencairan_dana + `${donasi.id}`);
|
||||
if (!cek) {
|
||||
return NotifPeringatan("Halaman khusus donatur");
|
||||
} else {
|
||||
setLoadingPencairan(true);
|
||||
router.push(RouterDonasi.pencairan_dana + `${donasi.id}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import {
|
||||
import ComponentGlobal_BoxInformation from "@/app_modules/_global/component/box_information";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import ComponentGlobal_InputCountDown from "@/app_modules/_global/component/input_countdown";
|
||||
import { notifikasiToUser_CreateKabarDonasi } from "@/app_modules/notifikasi/fun/create/create_notif_to_user_kabar_donasi";
|
||||
|
||||
export default function Donasi_CreateKabar({ donasiId }: { donasiId: string }) {
|
||||
const router = useRouter();
|
||||
@@ -74,6 +75,7 @@ export default function Donasi_CreateKabar({ donasiId }: { donasiId: string }) {
|
||||
label="Deskripsi"
|
||||
withAsterisk
|
||||
placeholder="Masukan deskripsi kabar"
|
||||
autosize
|
||||
onChange={(val) => {
|
||||
setKabar({
|
||||
...kabar,
|
||||
@@ -188,7 +190,13 @@ async function onSave(
|
||||
|
||||
const res = await Donasi_funCreateKabar(body as any, gambar);
|
||||
if (res.status === 200) {
|
||||
// Notif ke setiap donatur
|
||||
await notifikasiToUser_CreateKabarDonasi({
|
||||
donasiId: donasiId,
|
||||
kabarId: res.kabarId as any,
|
||||
});
|
||||
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
router.back();
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
|
||||
48
src/app_modules/donasi/detail/detail_main/bukti_transfer.tsx
Normal file
48
src/app_modules/donasi/detail/detail_main/bukti_transfer.tsx
Normal file
@@ -0,0 +1,48 @@
|
||||
"use client";
|
||||
|
||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||
import {
|
||||
AccentColor,
|
||||
MainColor,
|
||||
} from "@/app_modules/_global/color/color_pallet";
|
||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import { AspectRatio, Box, Image, Paper } from "@mantine/core";
|
||||
|
||||
export function LayoutDonasi_BuktiTransfer({ imageId }: { imageId: string }) {
|
||||
return (
|
||||
<>
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={<UIGlobal_LayoutHeaderTamplate title="Bukti Transfer" />}
|
||||
>
|
||||
<ViewBuktiTransfer imageId={imageId} />
|
||||
</UIGlobal_LayoutTamplate>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function ViewBuktiTransfer({ imageId }: { imageId: string }) {
|
||||
return (
|
||||
<>
|
||||
<Paper
|
||||
style={{
|
||||
backgroundColor: MainColor.darkblue,
|
||||
border: `2px solid ${AccentColor.blue}`,
|
||||
padding: "15px",
|
||||
borderRadius: "10px",
|
||||
}}
|
||||
>
|
||||
<AspectRatio ratio={1 / 1} mah={400}>
|
||||
<Box>
|
||||
<Image
|
||||
p={"md"}
|
||||
width={250}
|
||||
alt="Foto"
|
||||
src={RouterDonasi.api_gambar_pencairan + `${imageId}`}
|
||||
/>
|
||||
</Box>
|
||||
</AspectRatio>
|
||||
</Paper>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
Stack
|
||||
} from "@mantine/core";
|
||||
import { Stack } from "@mantine/core";
|
||||
import ComponentDonasi_CeritaPenggalangMain from "../../component/detail_main/cerita_penggalang";
|
||||
import { ComponentDonasi_DetailDataMain } from "../../component/detail_main/detail_data_donasi";
|
||||
import ComponentDonasi_InformasiPenggalangMain from "../../component/detail_main/informasi_penggalang";
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
"use client";
|
||||
|
||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||
import {
|
||||
AccentColor,
|
||||
MainColor,
|
||||
} from "@/app_modules/_global/color/color_pallet";
|
||||
import ComponentGlobal_BoxInformation from "@/app_modules/_global/component/box_information";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import ComponentDonasi_NotedBox from "@/app_modules/donasi/component/noted_box";
|
||||
import TampilanRupiahDonasi from "@/app_modules/donasi/component/tampilan_rupiah";
|
||||
import {
|
||||
@@ -23,8 +29,10 @@ import {
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import { IconTransferIn } from "@tabler/icons-react";
|
||||
import { IconImageInPicture, IconTransferIn } from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
|
||||
export default function PencairanDanaDonasi({
|
||||
@@ -49,7 +57,17 @@ export default function PencairanDanaDonasi({
|
||||
function BoxDanaDicarikan({ akumulasi }: { akumulasi: MODEL_DONASI }) {
|
||||
return (
|
||||
<>
|
||||
<Paper bg={"gray.1"} p={"md"}>
|
||||
<Paper
|
||||
style={{
|
||||
backgroundColor: MainColor.darkblue,
|
||||
border: `2px solid ${AccentColor.blue}`,
|
||||
padding: "15px",
|
||||
cursor: "pointer",
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
marginBottom: "10px",
|
||||
}}
|
||||
>
|
||||
<Stack>
|
||||
<Grid>
|
||||
<Grid.Col span={6}>
|
||||
@@ -63,7 +81,7 @@ function BoxDanaDicarikan({ akumulasi }: { akumulasi: MODEL_DONASI }) {
|
||||
<Text fz={"xs"}>Pencairan dana</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<ComponentDonasi_NotedBox
|
||||
<ComponentGlobal_BoxInformation
|
||||
informasi=" Pencairan dana akan dilakukan oleh Admin HIPMI tanpa campur tangan
|
||||
pihak manapun, jika berita pencairan dana dibawah tidak sesuai
|
||||
dengan kabar yang diberikan oleh PENGGALANG DANA. Maka pegguna lain
|
||||
@@ -80,6 +98,7 @@ function InformasiPencairanDana({
|
||||
}: {
|
||||
listPD: MODEL_DONASI_PENCAIRAN_DANA[];
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
const [idGambar, setIdGambar] = useState("");
|
||||
return (
|
||||
@@ -94,34 +113,53 @@ function InformasiPencairanDana({
|
||||
</Paper>
|
||||
</AspectRatio>
|
||||
</Modal>
|
||||
{listPD.map((e, i) => (
|
||||
<Paper key={i} withBorder p={"md"}>
|
||||
<Text fz={"xs"}>{moment(e.createdAt).format("ll")}</Text>
|
||||
<Stack spacing={"lg"}>
|
||||
<Title order={5}>{e.title}</Title>
|
||||
<Spoiler
|
||||
maxHeight={50}
|
||||
hideLabel="Sembunyikan"
|
||||
showLabel="Baca Selengkapnya"
|
||||
>
|
||||
{e.deskripsi}
|
||||
</Spoiler>
|
||||
<Center>
|
||||
<Button
|
||||
radius={"xl"}
|
||||
variant="outline"
|
||||
leftIcon={<IconTransferIn />}
|
||||
onClick={() => {
|
||||
open();
|
||||
setIdGambar(e.imagesId);
|
||||
}}
|
||||
|
||||
{_.isEmpty(listPD) ? (
|
||||
<ComponentGlobal_IsEmptyData height={20} />
|
||||
) : (
|
||||
listPD.map((e, i) => (
|
||||
<Paper
|
||||
key={i}
|
||||
style={{
|
||||
padding: "15px",
|
||||
border: `2px solid ${AccentColor.blue}`,
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
}}
|
||||
>
|
||||
<Text fz={"xs"}>{moment(e.createdAt).format("ll")}</Text>
|
||||
<Stack spacing={"lg"}>
|
||||
<Title order={5}>{e.title}</Title>
|
||||
<Spoiler
|
||||
maxHeight={50}
|
||||
hideLabel="Sembunyikan"
|
||||
showLabel="Baca Selengkapnya"
|
||||
>
|
||||
Bukti Transfer
|
||||
</Button>
|
||||
</Center>
|
||||
</Stack>
|
||||
</Paper>
|
||||
))}
|
||||
{e.deskripsi}
|
||||
</Spoiler>
|
||||
<Center>
|
||||
<Button
|
||||
radius={"xl"}
|
||||
leftIcon={<IconImageInPicture />}
|
||||
onClick={() => {
|
||||
// open();
|
||||
// setIdGambar(e.imagesId);
|
||||
router.push(`/dev/donasi/bukti-transfer/${e.imagesId}`, {
|
||||
scroll: false,
|
||||
});
|
||||
}}
|
||||
bg={MainColor.yellow}
|
||||
color="yellow"
|
||||
c={"black"}
|
||||
>
|
||||
Bukti Transfer
|
||||
</Button>
|
||||
</Center>
|
||||
</Stack>
|
||||
</Paper>
|
||||
))
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate";
|
||||
import ComponentDonasi_HeaderTamplate from "@/app_modules/donasi/component/header_tamplate";
|
||||
import { AppShell } from "@mantine/core";
|
||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import React from "react";
|
||||
|
||||
export default function LayoutPencairanDanaDonasi({
|
||||
@@ -12,11 +11,11 @@ export default function LayoutPencairanDanaDonasi({
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<AppComponentGlobal_LayoutTamplate
|
||||
header={<ComponentDonasi_HeaderTamplate title="Pencairan Dana" />}
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={<UIGlobal_LayoutHeaderTamplate title="Pencairan Dana" />}
|
||||
>
|
||||
{children}
|
||||
</AppComponentGlobal_LayoutTamplate>
|
||||
</UIGlobal_LayoutTamplate>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import { AccentColor, MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import ComponentDonasi_CardPublish from "@/app_modules/donasi/component/card_view/box_publish";
|
||||
import TampilanRupiahDonasi from "@/app_modules/donasi/component/tampilan_rupiah";
|
||||
import {
|
||||
@@ -61,12 +62,20 @@ function InformasiPenggalang({ value }: { value: MODEL_USER }) {
|
||||
return (
|
||||
<>
|
||||
{/* <pre>{JSON.stringify(value, null, 2)}</pre> */}
|
||||
<Paper radius={"md"}>
|
||||
<Box
|
||||
style={{
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
border: `2px solid ${AccentColor.blue}`,
|
||||
padding: "20px",
|
||||
cursor: "pointer",
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
marginBottom: "10px",
|
||||
}}
|
||||
>
|
||||
<Stack
|
||||
bg={"gray.1"}
|
||||
p={"md"}
|
||||
|
||||
spacing={"xl"}
|
||||
sx={{ borderRadius: "10px" }}
|
||||
>
|
||||
<Stack align="center" spacing={0}>
|
||||
<Paper
|
||||
@@ -87,16 +96,16 @@ function InformasiPenggalang({ value }: { value: MODEL_USER }) {
|
||||
/>
|
||||
</Center>
|
||||
</Paper>
|
||||
<Title order={3}>@{value.username}</Title>
|
||||
<Title order={3}>@{value?.username}</Title>
|
||||
</Stack>
|
||||
<Stack>
|
||||
<Group>
|
||||
<IconMoodSmile />
|
||||
<Text>Nama Penggalang Dana</Text>
|
||||
<Text>{value?.Profile.name}</Text>
|
||||
</Group>
|
||||
<Group>
|
||||
<IconPhone />
|
||||
<Text>+{value.nomor}</Text>
|
||||
<Text>+{value?.nomor}</Text>
|
||||
</Group>
|
||||
<Group>
|
||||
<IconBrandGmail />
|
||||
@@ -104,7 +113,7 @@ function InformasiPenggalang({ value }: { value: MODEL_USER }) {
|
||||
</Group>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -35,13 +35,19 @@ export default function ListKabarDonasi({
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [kabar, setKabar] = useState(listKabar);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={isLoading ? true : false}
|
||||
leftIcon={<IconCirclePlus />}
|
||||
radius={"xl"}
|
||||
onClick={() => router.push(RouterDonasi.create_kabar + `${donasiId}`)}
|
||||
onClick={() => {
|
||||
setIsLoading(true);
|
||||
router.push(RouterDonasi.create_kabar + `${donasiId}`);
|
||||
}}
|
||||
bg={MainColor.yellow}
|
||||
color="yellow"
|
||||
c={"black"}
|
||||
|
||||
@@ -40,22 +40,14 @@ export async function Donasi_funCreateKabar(
|
||||
donasiId: req.donasiId,
|
||||
imagesId: upload.id,
|
||||
},
|
||||
select: {
|
||||
Donasi: {
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
authorId: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
if (!createWithPhoto) return { status: 400, message: "Gagal membuat data" };
|
||||
return {
|
||||
status: 200,
|
||||
message: "Berhasil disimpan",
|
||||
data: createWithPhoto,
|
||||
kabarId: createWithPhoto.id,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -65,21 +57,12 @@ export async function Donasi_funCreateKabar(
|
||||
deskripsi: req.deskripsi,
|
||||
donasiId: req.donasiId,
|
||||
},
|
||||
select: {
|
||||
Donasi: {
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
authorId: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
revalidatePath("/dev/donasi/list_kabar");
|
||||
return {
|
||||
status: 200,
|
||||
message: "Berhasil disimpan",
|
||||
data: create,
|
||||
kabarId: create.id,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ import Donasi_DetailNotif from "./detail/deail_notif";
|
||||
import LayoutDonasi_DetailNotif from "./detail/deail_notif/layout";
|
||||
import Donasi_EditRekening from "./edit/edit_rekening";
|
||||
import LayoutDonasi_EditRekening from "./edit/edit_rekening/layout";
|
||||
export { LayoutDonasi_BuktiTransfer } from "./detail/detail_main/bukti_transfer";
|
||||
|
||||
export {
|
||||
MainDonasi,
|
||||
|
||||
@@ -216,7 +216,7 @@ export function Home_UiView({
|
||||
<Stack h={"100%"} align="center" justify="flex-start">
|
||||
<IconUserSearch size={20} color="white" />
|
||||
</Stack>
|
||||
<Stack spacing={0} bg={"cyan"} w={"70%"}>
|
||||
<Stack spacing={0} w={"60%"}>
|
||||
<Text
|
||||
lineClamp={1}
|
||||
fz={"sm"}
|
||||
|
||||
@@ -46,4 +46,14 @@ export function redirectDonasiPage({
|
||||
});
|
||||
router.push(pathDetail, { scroll: false });
|
||||
}
|
||||
|
||||
if (data.status === "Kabar Donasi") {
|
||||
const pathKabar = RouterDonasi.detail_kabar + data.appId;
|
||||
router.push(pathKabar, { scroll: false });
|
||||
}
|
||||
|
||||
if (data.status === "Pencairan Dana") {
|
||||
const pathPencairan = RouterDonasi.pencairan_dana + data.appId;
|
||||
router.push(pathPencairan, { scroll: false });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,58 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import _ from "lodash";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
|
||||
export async function notifikasiToUser_CreateKabarDonasi({
|
||||
donasiId,
|
||||
kabarId,
|
||||
}: {
|
||||
donasiId: string;
|
||||
kabarId: string;
|
||||
}) {
|
||||
const getDataDonasi = await prisma.donasi.findFirst({
|
||||
where: {
|
||||
id: donasiId,
|
||||
},
|
||||
});
|
||||
|
||||
const getDonatur = await prisma.donasi_Invoice.findMany({
|
||||
where: {
|
||||
donasiId: donasiId,
|
||||
},
|
||||
select: {
|
||||
Donasi: {
|
||||
select: {
|
||||
id: true,
|
||||
authorId: true,
|
||||
title: true,
|
||||
},
|
||||
},
|
||||
authorId: true,
|
||||
},
|
||||
});
|
||||
|
||||
console.log(getDonatur)
|
||||
const data = new Set(getDonatur.map((e) => e.authorId));
|
||||
const dataFix = Array.from(data);
|
||||
|
||||
for (let authorId of dataFix) {
|
||||
console.log(authorId);
|
||||
const createNotifikasi = await prisma.notifikasi.create({
|
||||
data: {
|
||||
userRoleId: "1",
|
||||
userId: authorId,
|
||||
appId: kabarId,
|
||||
pesan: getDataDonasi?.title as any,
|
||||
kategoriApp: "DONASI",
|
||||
status: "Kabar Donasi",
|
||||
title: "Kabar terupdate donasi anda !",
|
||||
},
|
||||
});
|
||||
|
||||
if (!createNotifikasi)
|
||||
return { status: 400, message: "Gagal membuat notifikasi" };
|
||||
|
||||
mqtt_client.publish(
|
||||
"USER",
|
||||
JSON.stringify({
|
||||
userId: authorId,
|
||||
count: 1,
|
||||
})
|
||||
);
|
||||
}
|
||||
return { status: 201, message: "Berhasil membuat notifikasi" };
|
||||
}
|
||||
|
||||
@@ -31,7 +31,9 @@ export interface MODEL_NOTIFIKASI {
|
||||
| "Proses"
|
||||
| "Berhasil"
|
||||
| "Gagal"
|
||||
| "Donatur Baru";
|
||||
| "Donatur Baru"
|
||||
| "Kabar Donasi"
|
||||
| "Pencairan Dana"
|
||||
|
||||
Role: MODEL_NEW_DEFAULT_MASTER;
|
||||
userRoleId: String;
|
||||
|
||||
98
zCoba.js
98
zCoba.js
@@ -1,75 +1,25 @@
|
||||
const moment = require("moment");
|
||||
var fs = require("fs");
|
||||
const _ = require("lodash");
|
||||
const data = [
|
||||
{
|
||||
authorId: "clx8pl7r90005su4mldioo0v1",
|
||||
Donasi: {
|
||||
id: "clyr304q0000410ljvzms3mag",
|
||||
title: "Donasi Bencana Alam Aceh",
|
||||
},
|
||||
},
|
||||
{
|
||||
authorId: "clx8pl7r90005su4mldioo0v1",
|
||||
Donasi: {
|
||||
id: "clyr304q0000410ljvzms3mag",
|
||||
title: "Donasi Bencana Alam Aceh",
|
||||
},
|
||||
},
|
||||
{
|
||||
authorId: "clycka5eu0001ina3i1ssgze9",
|
||||
Donasi: {
|
||||
id: "clyr304q0000410ljvzms3mag",
|
||||
title: "Donasi Bencana Alam Aceh",
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
// function Coba() {
|
||||
// let total = 100;
|
||||
// let sisa = 1;
|
||||
|
||||
// const hasil = (total - sisa)
|
||||
// console.log(hasil)
|
||||
// }
|
||||
|
||||
// Coba();
|
||||
|
||||
// function Coba1() {
|
||||
// const fruits = [];
|
||||
// const data = 10 - 4
|
||||
// fruits.push(data);
|
||||
// console.log(fruits);
|
||||
// }
|
||||
|
||||
// Coba1();
|
||||
|
||||
// include node fs module
|
||||
|
||||
// delete file named 'sample.txt' Synchronously
|
||||
// fs.unlinkSync('coba.sh');
|
||||
// console.log('File deleted!');
|
||||
|
||||
// function CobaProgress() {
|
||||
// const t = 560000000;
|
||||
// const b = 180000000
|
||||
|
||||
// const progress = (b / t) * 100;
|
||||
// const pembulatan = Math.round(progress);
|
||||
// console.log(progress, "progres");
|
||||
// console.log(pembulatan, "pembulatan");
|
||||
// // console.log(t/2)
|
||||
// }
|
||||
|
||||
// CobaProgress();
|
||||
|
||||
// function randomNumberPerSecond(){
|
||||
// let lower = 0;
|
||||
// let upper = 100;
|
||||
|
||||
// // Printing 5 random values
|
||||
// // in range 2 and 11
|
||||
// for (let i = 0; i < 1; i++) {
|
||||
// setInterval(() => console.log("Hello" + " " + _.random(lower, upper)), 1000);
|
||||
// }
|
||||
// }
|
||||
|
||||
// randomNumberPerSecond()
|
||||
|
||||
// function CobaTanggal() {
|
||||
// const tgl = "2024-01-25T12:00:24.008Z";
|
||||
// const i = _.random(0, 100);
|
||||
// // setInterval(() => console.log("hello" + i), 1000);
|
||||
// const waktu = Date.now()
|
||||
// const dt = moment(waktu).locale("fr").format()
|
||||
// console.log(dt)
|
||||
|
||||
// }
|
||||
|
||||
// CobaTanggal();
|
||||
|
||||
function CobaSplice() {
|
||||
let array = [1, 2, 3, 4, 5];
|
||||
let indexToRemove = 1;
|
||||
array.splice(indexToRemove, 1);
|
||||
console.log(array);
|
||||
}
|
||||
|
||||
CobaSplice();
|
||||
console.log(new Set(data.map((d) => d.authorId)));
|
||||
|
||||
Reference in New Issue
Block a user