Merge pull request #365 from bipproduction/Nico/6-mar-25
Nico/6 mar 25 Fix Tampilan UI Collab & Forum
This commit is contained in:
@@ -2,14 +2,13 @@ import prisma from "@/lib/prisma";
|
|||||||
import backendLogger from "@/util/backendLogger";
|
import backendLogger from "@/util/backendLogger";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
export async function GET(req: Request,
|
export async function GET(req: Request,
|
||||||
{ params }: { params: { id: any } }) {
|
{ params }: { params: { id: string } }) {
|
||||||
try {
|
try {
|
||||||
let fixData;
|
let fixData;
|
||||||
const { id } = params
|
const { id } = params
|
||||||
const data = await prisma.investasi_Invoice.findMany({
|
const data = await prisma.investasi_Invoice.findUnique({
|
||||||
where: {
|
where: {
|
||||||
investasiId: id,
|
id: id
|
||||||
isActive: true,
|
|
||||||
},
|
},
|
||||||
include: {
|
include: {
|
||||||
Author: true,
|
Author: true,
|
||||||
@@ -18,6 +17,7 @@ export async function GET(req: Request,
|
|||||||
MasterBank: true,
|
MasterBank: true,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
fixData = {
|
fixData = {
|
||||||
data: data,
|
data: data,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ export async function GET(
|
|||||||
MasterBank: true,
|
MasterBank: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const nCount = await prisma.investasi_Invoice.count({
|
const nCount = await prisma.investasi_Invoice.count({
|
||||||
where: {
|
where: {
|
||||||
investasiId: id,
|
investasiId: id,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
import { MODEL_COLLABORATION } from "@/app_modules/colab/model/interface";
|
import { MODEL_COLLABORATION } from "@/app_modules/colab/model/interface";
|
||||||
import { Stack, Box, Center, Title, Grid, Text } from "@mantine/core";
|
import { Stack, Box, Center, Title, Grid, Text } from "@mantine/core";
|
||||||
|
|
||||||
@@ -11,20 +12,20 @@ export default function ComponentAdminColab_DetailData({
|
|||||||
<Stack>
|
<Stack>
|
||||||
<Box>
|
<Box>
|
||||||
<Center px={"md"} mb={"lg"}>
|
<Center px={"md"} mb={"lg"}>
|
||||||
<Title order={4}>{data?.title ? data.title : "Judul Proyek"}</Title>
|
<Title c={AdminColor.white} order={4}>{data?.title ? data.title : "Judul Proyek"}</Title>
|
||||||
</Center>
|
</Center>
|
||||||
<Stack spacing={"sm"}>
|
<Stack spacing={"sm"}>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.Col span={2}>
|
<Grid.Col span={2}>
|
||||||
<Text fw={"bold"} fz={"sm"}>
|
<Text c={AdminColor.white} fw={"bold"} fz={"sm"}>
|
||||||
Industri
|
Industri
|
||||||
</Text>
|
</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={1}>
|
<Grid.Col span={1}>
|
||||||
<Text fz={"sm"}>:</Text>
|
<Text c={AdminColor.white} fz={"sm"}>:</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={"auto"}>
|
<Grid.Col span={"auto"}>
|
||||||
<Text fz={"sm"}>
|
<Text c={AdminColor.white} fz={"sm"}>
|
||||||
{data?.ProjectCollaborationMaster_Industri.name
|
{data?.ProjectCollaborationMaster_Industri.name
|
||||||
? data.ProjectCollaborationMaster_Industri.name
|
? data.ProjectCollaborationMaster_Industri.name
|
||||||
: "Industri"}
|
: "Industri"}
|
||||||
@@ -34,31 +35,31 @@ export default function ComponentAdminColab_DetailData({
|
|||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.Col span={2}>
|
<Grid.Col span={2}>
|
||||||
<Text fw={"bold"} fz={"sm"}>
|
<Text c={AdminColor.white} fw={"bold"} fz={"sm"}>
|
||||||
Lokasi
|
Lokasi
|
||||||
</Text>
|
</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={1}>
|
<Grid.Col span={1}>
|
||||||
<Text fz={"sm"}>:</Text>
|
<Text c={AdminColor.white} fz={"sm"}>:</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={"auto"}>
|
<Grid.Col span={"auto"}>
|
||||||
<Text fz={"sm"} lineClamp={1}>
|
<Text c={AdminColor.white} fz={"sm"} lineClamp={1}>
|
||||||
{data?.lokasi ? data.lokasi : " Lokasi dari proyek"}
|
{data?.lokasi ? data.lokasi : " Lokasi dari proyek"}
|
||||||
</Text>
|
</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Stack spacing={5}>
|
<Stack spacing={5}>
|
||||||
<Text fw={"bold"} fz={"sm"}>
|
<Text c={AdminColor.white} fw={"bold"} fz={"sm"}>
|
||||||
Tujuan proyek
|
Tujuan proyek
|
||||||
</Text>
|
</Text>
|
||||||
<Text fz={"sm"}>{data?.purpose ? data?.purpose : "-"}</Text>
|
<Text c={AdminColor.white} fz={"sm"}>{data?.purpose ? data?.purpose : "-"}</Text>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack spacing={5}>
|
<Stack spacing={5}>
|
||||||
<Text fw={"bold"} fz={"sm"}>
|
<Text c={AdminColor.white} fw={"bold"} fz={"sm"}>
|
||||||
Keuntungan
|
Keuntungan
|
||||||
</Text>
|
</Text>
|
||||||
<Text fz={"sm"}>{data?.benefit ? data?.benefit : "-"}</Text>
|
<Text c={AdminColor.white} fz={"sm"}>{data?.benefit ? data?.benefit : "-"}</Text>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -205,6 +205,7 @@ function TableMenu({ listGroup }: { listGroup: any }) {
|
|||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
|
styles={{ body: { backgroundColor: AccentColor.darkblue}}}
|
||||||
opened={openDetail}
|
opened={openDetail}
|
||||||
onClose={() => setOpenDetail(false)}
|
onClose={() => setOpenDetail(false)}
|
||||||
centered
|
centered
|
||||||
@@ -212,26 +213,26 @@ function TableMenu({ listGroup }: { listGroup: any }) {
|
|||||||
withCloseButton={false}
|
withCloseButton={false}
|
||||||
>
|
>
|
||||||
<SimpleGrid cols={2}>
|
<SimpleGrid cols={2}>
|
||||||
<Paper bg={"gray.1"} p={"md"} h={500}>
|
<Paper bg={AdminColor.softBlue} p={"md"} h={500}>
|
||||||
<ScrollArea h={"100%"} w={"100%"}>
|
<ScrollArea h={"100%"} w={"100%"}>
|
||||||
<ComponentAdminColab_DetailData
|
<ComponentAdminColab_DetailData
|
||||||
data={detailData?.ProjectCollaboration as any}
|
data={detailData?.ProjectCollaboration as any}
|
||||||
/>
|
/>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
</Paper>
|
</Paper>
|
||||||
<Paper bg={"gray.1"} p={"md"} h={500}>
|
<Paper bg={AdminColor.softBlue} p={"md"} h={500}>
|
||||||
<ScrollArea h={"100%"}>
|
<ScrollArea h={"100%"}>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Center>
|
<Center>
|
||||||
<Title order={4}>Anggota</Title>
|
<Title c={AdminColor.white} order={4}>Anggota</Title>
|
||||||
</Center>
|
</Center>
|
||||||
<Stack>
|
<Stack>
|
||||||
{detailData?.ProjectCollaboration_AnggotaRoomChat?.map(
|
{detailData?.ProjectCollaboration_AnggotaRoomChat?.map(
|
||||||
(e, i) => (
|
(e, i) => (
|
||||||
<Box key={i}>
|
<Box key={i}>
|
||||||
<Text lineClamp={1}>
|
<Text lineClamp={1}>
|
||||||
<IconCircleDot size={10} />{" "}
|
<IconCircleDot color={AdminColor.white} size={10} />{" "}
|
||||||
<Text span inherit>
|
<Text c={AdminColor.white} span inherit>
|
||||||
{e?.User?.Profile?.name}
|
{e?.User?.Profile?.name}
|
||||||
</Text>
|
</Text>
|
||||||
</Text>
|
</Text>
|
||||||
|
|||||||
@@ -265,30 +265,32 @@ function TableMenu({ listData }: { listData: any }) {
|
|||||||
|
|
||||||
{/* Detail Data */}
|
{/* Detail Data */}
|
||||||
<Modal
|
<Modal
|
||||||
|
styles={{body: { backgroundColor: AdminColor.softBlue}}}
|
||||||
opened={openDetail}
|
opened={openDetail}
|
||||||
onClose={() => setOpenDetail(false)}
|
onClose={() => setOpenDetail(false)}
|
||||||
centered
|
centered
|
||||||
withCloseButton={false}
|
withCloseButton={false}
|
||||||
size={"lg"}
|
size={"lg"}
|
||||||
>
|
>
|
||||||
<Paper p={"md"} bg={"gray.1"}>
|
<Paper p={"md"} bg={AdminColor.softBlue}>
|
||||||
<ComponentAdminColab_DetailData data={detailData as any} />
|
<ComponentAdminColab_DetailData data={detailData as any} />
|
||||||
</Paper>
|
</Paper>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
{/* Reject Project */}
|
{/* Reject Project */}
|
||||||
<Modal
|
<Modal
|
||||||
|
styles={{body: { backgroundColor: AdminColor.softBlue}}}
|
||||||
opened={openReject}
|
opened={openReject}
|
||||||
onClose={() => setOpenReject(false)}
|
onClose={() => setOpenReject(false)}
|
||||||
centered
|
centered
|
||||||
withCloseButton={false}
|
withCloseButton={false}
|
||||||
size={"lg"}
|
size={"lg"}
|
||||||
>
|
>
|
||||||
<Paper p={"md"}>
|
<Paper bg={AdminColor.softBlue} p={"md"}>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Text>
|
<Text c={AdminColor.white}>
|
||||||
Apakah anda yakin ingin mereport project{" "}
|
Apakah anda yakin ingin mereport project{" "}
|
||||||
<Text span inherit fw={"bold"}>
|
<Text c={AdminColor.white} span inherit fw={"bold"}>
|
||||||
{detailData?.title}
|
{detailData?.title}
|
||||||
</Text>
|
</Text>
|
||||||
?
|
?
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
import { MODEL_FORUM_KOMENTAR, MODEL_FORUM_POSTING } from "@/app_modules/forum/model/interface";
|
import { MODEL_FORUM_KOMENTAR, MODEL_FORUM_POSTING } from "@/app_modules/forum/model/interface";
|
||||||
import {
|
import {
|
||||||
Badge,
|
Badge,
|
||||||
@@ -21,17 +22,17 @@ export default function ComponentAdminForum_ViewOneDetailKomentar({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack spacing={"xs"} h={"100%"} w={"50%"}>
|
<Stack spacing={"xs"} h={"100%"} w={"50%"}>
|
||||||
<Paper bg={"gray"} p={"xs"} style={{ borderRadius: "6px" }}>
|
<Paper bg={AdminColor.softBlue} p={"xs"} style={{ borderRadius: "6px" }}>
|
||||||
<Title order={4} c={"white"}>
|
<Title order={4} c={"white"}>
|
||||||
Detail Komentar
|
Detail Komentar
|
||||||
</Title>
|
</Title>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
|
||||||
<Paper withBorder p={"md"} radius={"md"} shadow="sm">
|
<Paper p={"md"} radius={"md"} bg={AdminColor.softBlue}>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack spacing={5}>
|
<Stack spacing={5}>
|
||||||
<Group position="apart">
|
<Group position="apart">
|
||||||
<Text fw={"bold"}>
|
<Text fw={"bold"} c={AdminColor.white}>
|
||||||
Username:{" "}
|
Username:{" "}
|
||||||
<Text span inherit>
|
<Text span inherit>
|
||||||
{dataKomentar?.Author?.username}
|
{dataKomentar?.Author?.username}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import ComponentAdminGlobal_IsEmptyData from "../../_admin_global/is_empty_data"
|
|||||||
import { adminForum_getListKomentarById } from "../fun/get/get_list_komentar_by_id";
|
import { adminForum_getListKomentarById } from "../fun/get/get_list_komentar_by_id";
|
||||||
import AdminGlobal_ComponentBackButton from "../../_admin_global/back_button";
|
import AdminGlobal_ComponentBackButton from "../../_admin_global/back_button";
|
||||||
import ComponentAdminForum_ViewOneDetailPosting from "../component/detail_one_posting";
|
import ComponentAdminForum_ViewOneDetailPosting from "../component/detail_one_posting";
|
||||||
|
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
|
|
||||||
export default function AdminForum_DetailPosting({
|
export default function AdminForum_DetailPosting({
|
||||||
listKomentar,
|
listKomentar,
|
||||||
@@ -110,22 +111,22 @@ function TableKomentar({
|
|||||||
const rowTable = data?.map((e, i) => (
|
const rowTable = data?.map((e, i) => (
|
||||||
<tr key={i}>
|
<tr key={i}>
|
||||||
<td>
|
<td>
|
||||||
<Center w={200}>
|
<Center c={AdminColor.white} w={150}>
|
||||||
<Text lineClamp={1}>{e?.Author?.username}</Text>
|
<Text lineClamp={1}>{e?.Author?.username}</Text>
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Box w={500}>
|
<Box w={300}>
|
||||||
<Spoiler maxHeight={50} hideLabel="sembunyikan" showLabel="tampilkan">
|
<Spoiler c={AdminColor.white} maxHeight={50} hideLabel="sembunyikan" showLabel="tampilkan">
|
||||||
<div
|
<div
|
||||||
style={{ textAlign: "center" }}
|
style={{ textAlign: "justify", textJustify: "auto" }}
|
||||||
dangerouslySetInnerHTML={{ __html: e?.komentar }}
|
dangerouslySetInnerHTML={{ __html: e?.komentar }}
|
||||||
/>
|
/>
|
||||||
</Spoiler>
|
</Spoiler>
|
||||||
</Box>
|
</Box>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center w={200}>
|
<Center c={AdminColor.white} w={150}>
|
||||||
<Text>
|
<Text>
|
||||||
{new Intl.DateTimeFormat(["id-ID"], { dateStyle: "medium" }).format(
|
{new Intl.DateTimeFormat(["id-ID"], { dateStyle: "medium" }).format(
|
||||||
e.createdAt
|
e.createdAt
|
||||||
@@ -134,9 +135,9 @@ function TableKomentar({
|
|||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center w={100}>
|
<Center w={100}>
|
||||||
<Text
|
<Text
|
||||||
c={e?.Forum_ReportKomentar?.length >= 3 ? "red" : "black"}
|
c={e?.Forum_ReportKomentar?.length >= 3 ? "red" : AdminColor.white}
|
||||||
fw={"bold"}
|
fw={"bold"}
|
||||||
fz={"lg"}
|
fz={"lg"}
|
||||||
>
|
>
|
||||||
@@ -173,7 +174,7 @@ function TableKomentar({
|
|||||||
<Stack spacing={"xs"} h={"100%"}>
|
<Stack spacing={"xs"} h={"100%"}>
|
||||||
<Group
|
<Group
|
||||||
position="apart"
|
position="apart"
|
||||||
bg={"gray"}
|
bg={AdminColor.softBlue}
|
||||||
p={"xs"}
|
p={"xs"}
|
||||||
style={{ borderRadius: "6px" }}
|
style={{ borderRadius: "6px" }}
|
||||||
>
|
>
|
||||||
@@ -198,7 +199,7 @@ function TableKomentar({
|
|||||||
{_.isEmpty(data) ? (
|
{_.isEmpty(data) ? (
|
||||||
<ComponentAdminGlobal_IsEmptyData text="Tidak Ada Komentar" />
|
<ComponentAdminGlobal_IsEmptyData text="Tidak Ada Komentar" />
|
||||||
) : (
|
) : (
|
||||||
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
<Paper p={"md"} bg={AdminColor.softBlue} h={"80vh"}>
|
||||||
<ScrollArea w={"100%"} h={"90%"} offsetScrollbars>
|
<ScrollArea w={"100%"} h={"90%"} offsetScrollbars>
|
||||||
<Table
|
<Table
|
||||||
verticalSpacing={"md"}
|
verticalSpacing={"md"}
|
||||||
@@ -206,25 +207,24 @@ function TableKomentar({
|
|||||||
p={"md"}
|
p={"md"}
|
||||||
w={"100%"}
|
w={"100%"}
|
||||||
h={"100%"}
|
h={"100%"}
|
||||||
striped
|
|
||||||
highlightOnHover
|
|
||||||
>
|
>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
<Center w={200}>Username</Center>
|
<Center c={AdminColor.white} w={150}>Username</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center w={500}>Komentar</Center>
|
<Center c={AdminColor.white} w={300}>Komentar</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center w={200}>Tgl Komentar</Center>
|
<Center c={AdminColor.white} w={150}>Tgl Komentar</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center w={100}>Total Report</Center>
|
<Center c={AdminColor.white} w={100}>Total Report</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center w={200}>Aksi</Center>
|
<Center c={AdminColor.white} w={200}>Aksi</Center>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import ComponentAdminForum_ViewOneDetailKomentar from "../component/detail_one_k
|
|||||||
import { adminForum_funDeleteKomentarById } from "../fun/delete/fun_delete_komentar_by_id";
|
import { adminForum_funDeleteKomentarById } from "../fun/delete/fun_delete_komentar_by_id";
|
||||||
import { adminForum_getListReportKomentarbyId } from "../fun/get/get_list_report_komentar_by_id";
|
import { adminForum_getListReportKomentarbyId } from "../fun/get/get_list_report_komentar_by_id";
|
||||||
import adminForum_funGetOneKomentarById from "../fun/get/get_one_komentar_by_id";
|
import adminForum_funGetOneKomentarById from "../fun/get/get_one_komentar_by_id";
|
||||||
|
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
|
|
||||||
export default function AdminForum_HasilReportKomentar({
|
export default function AdminForum_HasilReportKomentar({
|
||||||
komentarId,
|
komentarId,
|
||||||
@@ -199,12 +200,12 @@ function HasilReportPosting({
|
|||||||
const TableRows = data?.map((e, i) => (
|
const TableRows = data?.map((e, i) => (
|
||||||
<tr key={i}>
|
<tr key={i}>
|
||||||
<td>
|
<td>
|
||||||
<Center w={200}>
|
<Center w={150}>
|
||||||
<Text>{e?.User?.Profile?.name}</Text>
|
<Text>{e?.User?.Profile?.name}</Text>
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center w={200}>
|
<Center w={150}>
|
||||||
<Text>
|
<Text>
|
||||||
{e?.ForumMaster_KategoriReport?.title
|
{e?.ForumMaster_KategoriReport?.title
|
||||||
? e?.ForumMaster_KategoriReport?.title
|
? e?.ForumMaster_KategoriReport?.title
|
||||||
@@ -214,7 +215,7 @@ function HasilReportPosting({
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<Center w={500}>
|
<Center w={300}>
|
||||||
<Spoiler maxHeight={50} hideLabel="sembunyikan" showLabel="tampilkan">
|
<Spoiler maxHeight={50} hideLabel="sembunyikan" showLabel="tampilkan">
|
||||||
{e?.ForumMaster_KategoriReport?.deskripsi ? (
|
{e?.ForumMaster_KategoriReport?.deskripsi ? (
|
||||||
<Text>{e?.ForumMaster_KategoriReport?.deskripsi}</Text>
|
<Text>{e?.ForumMaster_KategoriReport?.deskripsi}</Text>
|
||||||
@@ -226,7 +227,7 @@ function HasilReportPosting({
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<Center w={500}>
|
<Center w={300}>
|
||||||
<Spoiler maxHeight={50} hideLabel="sembunyikan" showLabel="tampilkan">
|
<Spoiler maxHeight={50} hideLabel="sembunyikan" showLabel="tampilkan">
|
||||||
{e?.deskripsi ? <Text>{e?.deskripsi}</Text> : <Text>-</Text>}
|
{e?.deskripsi ? <Text>{e?.deskripsi}</Text> : <Text>-</Text>}
|
||||||
</Spoiler>
|
</Spoiler>
|
||||||
@@ -241,7 +242,7 @@ function HasilReportPosting({
|
|||||||
<Stack spacing={"xs"} h={"100%"}>
|
<Stack spacing={"xs"} h={"100%"}>
|
||||||
<Group
|
<Group
|
||||||
position="apart"
|
position="apart"
|
||||||
bg={"red.4"}
|
bg={AdminColor.softBlue}
|
||||||
p={"xs"}
|
p={"xs"}
|
||||||
style={{ borderRadius: "6px" }}
|
style={{ borderRadius: "6px" }}
|
||||||
>
|
>
|
||||||
@@ -261,7 +262,7 @@ function HasilReportPosting({
|
|||||||
{_.isEmpty(data) ? (
|
{_.isEmpty(data) ? (
|
||||||
<ComponentAdminGlobal_IsEmptyData />
|
<ComponentAdminGlobal_IsEmptyData />
|
||||||
) : (
|
) : (
|
||||||
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
<Paper p={"md"} bg={AdminColor.softBlue} h={"80vh"}>
|
||||||
<ScrollArea w={"100%"} h={"90%"} offsetScrollbars>
|
<ScrollArea w={"100%"} h={"90%"} offsetScrollbars>
|
||||||
<Table
|
<Table
|
||||||
verticalSpacing={"md"}
|
verticalSpacing={"md"}
|
||||||
@@ -269,8 +270,7 @@ function HasilReportPosting({
|
|||||||
p={"md"}
|
p={"md"}
|
||||||
w={"100%"}
|
w={"100%"}
|
||||||
h={"100%"}
|
h={"100%"}
|
||||||
striped
|
|
||||||
highlightOnHover
|
|
||||||
>
|
>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -178,12 +178,12 @@ function HasilReportPosting({
|
|||||||
const TableRows = data?.map((e, i) => (
|
const TableRows = data?.map((e, i) => (
|
||||||
<tr key={i}>
|
<tr key={i}>
|
||||||
<td>
|
<td>
|
||||||
<Center c={AdminColor.white} w={200}>
|
<Center c={AdminColor.white} w={150}>
|
||||||
<Text>{e?.User?.username}</Text>
|
<Text>{e?.User?.username}</Text>
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center c={AdminColor.white} w={200}>
|
<Center c={AdminColor.white} w={150}>
|
||||||
<Text>
|
<Text>
|
||||||
{e?.ForumMaster_KategoriReport?.title
|
{e?.ForumMaster_KategoriReport?.title
|
||||||
? e?.ForumMaster_KategoriReport?.title
|
? e?.ForumMaster_KategoriReport?.title
|
||||||
@@ -193,10 +193,10 @@ function HasilReportPosting({
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<Center c={AdminColor.white} w={500}>
|
<Center c={AdminColor.white} w={300}>
|
||||||
<Spoiler maxHeight={50} hideLabel="sembunyikan" showLabel="tampilkan">
|
<Spoiler maxHeight={50} hideLabel="sembunyikan" showLabel="tampilkan">
|
||||||
{e?.ForumMaster_KategoriReport?.deskripsi ? (
|
{e?.ForumMaster_KategoriReport?.deskripsi ? (
|
||||||
<Text>{e?.ForumMaster_KategoriReport?.deskripsi}</Text>
|
<Text style={{textJustify: "auto", textAlign: "justify"}}>{e?.ForumMaster_KategoriReport?.deskripsi}</Text>
|
||||||
) : (
|
) : (
|
||||||
<Text>-</Text>
|
<Text>-</Text>
|
||||||
)}
|
)}
|
||||||
@@ -205,9 +205,9 @@ function HasilReportPosting({
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<Center c={AdminColor.white} w={500}>
|
<Center c={AdminColor.white} w={300}>
|
||||||
<Spoiler maxHeight={50} hideLabel="sembunyikan" showLabel="tampilkan">
|
<Spoiler maxHeight={50} hideLabel="sembunyikan" showLabel="tampilkan">
|
||||||
{e?.deskripsi ? <Text>{e?.deskripsi}</Text> : <Text>-</Text>}
|
{e?.deskripsi ? <Text style={{textJustify: "auto", textAlign: "justify"}}>{e?.deskripsi}</Text> : <Text>-</Text>}
|
||||||
</Spoiler>
|
</Spoiler>
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
@@ -252,16 +252,16 @@ function HasilReportPosting({
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
<Center c={AdminColor.white}>Username</Center>
|
<Center w={150} c={AdminColor.white}>Username</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center c={AdminColor.white}>Kategori</Center>
|
<Center w={150} c={AdminColor.white}>Kategori</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center c={AdminColor.white}>Deskripsi</Center>
|
<Center w={300} c={AdminColor.white}>Deskripsi</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center c={AdminColor.white}>Deskripsi Lainnya</Center>
|
<Center w={300} c={AdminColor.white}>Deskripsi Lainnya</Center>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ function TablePublish() {
|
|||||||
return data?.map((e, i) => (
|
return data?.map((e, i) => (
|
||||||
<tr key={i}>
|
<tr key={i}>
|
||||||
<td>
|
<td>
|
||||||
<Center w={200}>
|
<Center w={100}>
|
||||||
<Text c={AdminColor.white} lineClamp={1}>{e?.Author?.username}</Text>
|
<Text c={AdminColor.white} lineClamp={1}>{e?.Author?.username}</Text>
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
@@ -122,23 +122,6 @@ function TablePublish() {
|
|||||||
</Badge>
|
</Badge>
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
|
||||||
<Box w={400}>
|
|
||||||
<Spoiler
|
|
||||||
// w={400}
|
|
||||||
c={AdminColor.white}
|
|
||||||
maxHeight={60}
|
|
||||||
hideLabel="sembunyikan"
|
|
||||||
showLabel="tampilkan"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
dangerouslySetInnerHTML={{
|
|
||||||
__html: e?.diskusi,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Spoiler>
|
|
||||||
</Box>
|
|
||||||
</td>
|
|
||||||
<td>
|
<td>
|
||||||
<Center w={150}>
|
<Center w={150}>
|
||||||
<Text c={AdminColor.white}>
|
<Text c={AdminColor.white}>
|
||||||
@@ -243,9 +226,6 @@ function TablePublish() {
|
|||||||
<th>
|
<th>
|
||||||
<Center c={AdminColor.white}>Status</Center>
|
<Center c={AdminColor.white}>Status</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
|
||||||
<Text c={AdminColor.white}>Postingan</Text>
|
|
||||||
</th>
|
|
||||||
<th>
|
<th>
|
||||||
<Center c={AdminColor.white}>Tanggal Publish</Center>
|
<Center c={AdminColor.white}>Tanggal Publish</Center>
|
||||||
</th>
|
</th>
|
||||||
|
|||||||
@@ -110,12 +110,12 @@ function TableView() {
|
|||||||
return data?.map((e, i) => (
|
return data?.map((e, i) => (
|
||||||
<tr key={i}>
|
<tr key={i}>
|
||||||
<td>
|
<td>
|
||||||
<Center w={200}>
|
<Center w={150}>
|
||||||
<Text c={AdminColor.white} lineClamp={1}>{e?.User?.Profile?.name}</Text>
|
<Text c={AdminColor.white} lineClamp={1}>{e?.User?.Profile?.name}</Text>
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center w={200}>
|
<Center w={150}>
|
||||||
{e?.forumMaster_KategoriReportId === null ? (
|
{e?.forumMaster_KategoriReportId === null ? (
|
||||||
<Text c={AdminColor.white}>Lainnya</Text>
|
<Text c={AdminColor.white}>Lainnya</Text>
|
||||||
) : (
|
) : (
|
||||||
@@ -126,8 +126,9 @@ function TableView() {
|
|||||||
|
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<Box w={400}>
|
<Box w={250}>
|
||||||
<Spoiler
|
<Spoiler
|
||||||
|
style={{ textAlign: "justify", textJustify: "auto"}}
|
||||||
c={AdminColor.white}
|
c={AdminColor.white}
|
||||||
// w={400}
|
// w={400}
|
||||||
maxHeight={60}
|
maxHeight={60}
|
||||||
@@ -238,7 +239,7 @@ function TableView() {
|
|||||||
|
|
||||||
|
|
||||||
<th>
|
<th>
|
||||||
<Text c={AdminColor.white}>Komentar</Text>
|
<Center c={AdminColor.white}>Komentar</Center>
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -99,12 +99,12 @@ function TableView() {
|
|||||||
return data?.map((e, i) => (
|
return data?.map((e, i) => (
|
||||||
<tr key={i}>
|
<tr key={i}>
|
||||||
<td>
|
<td>
|
||||||
<Center c={AdminColor.white} w={200}>
|
<Center c={AdminColor.white} w={150}>
|
||||||
<Text lineClamp={1}>{e?.User.username}</Text>
|
<Text lineClamp={1}>{e?.User.username}</Text>
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center c={AdminColor.white} w={200}>
|
<Center c={AdminColor.white} w={150}>
|
||||||
{e?.forumMaster_KategoriReportId === null ? (
|
{e?.forumMaster_KategoriReportId === null ? (
|
||||||
<Text>Lainnya</Text>
|
<Text>Lainnya</Text>
|
||||||
) : (
|
) : (
|
||||||
@@ -137,7 +137,7 @@ function TableView() {
|
|||||||
</td> */}
|
</td> */}
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<Center w={200}>
|
<Center w={250}>
|
||||||
<Badge
|
<Badge
|
||||||
color={
|
color={
|
||||||
(e?.Forum_Posting?.ForumMaster_StatusPosting?.id as any) === 1
|
(e?.Forum_Posting?.ForumMaster_StatusPosting?.id as any) === 1
|
||||||
@@ -244,7 +244,7 @@ function TableView() {
|
|||||||
<Text>Postingan</Text>
|
<Text>Postingan</Text>
|
||||||
</th> */}
|
</th> */}
|
||||||
<th>
|
<th>
|
||||||
<Center c={AdminColor.white} w={200}>Status Posting</Center>
|
<Center c={AdminColor.white} w={250}>Status Posting</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center c={AdminColor.white}>Tanggal Report</Center>
|
<Center c={AdminColor.white}>Tanggal Report</Center>
|
||||||
|
|||||||
@@ -28,22 +28,22 @@ export function AdminInvestasi_ComponentButtonBandingTransaksi({
|
|||||||
lembarTerbeli,
|
lembarTerbeli,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res.status == 200) {
|
// if (res.status == 200) {
|
||||||
try {
|
// try {
|
||||||
const dataTransaksi = await adminInvestasi_funGetAllTransaksiById({
|
// const dataTransaksi = await adminInvestasi_funGetAllTransaksiById({
|
||||||
investasiId,
|
// investasiId,
|
||||||
page: 1,
|
// page: 1,
|
||||||
});
|
// });
|
||||||
onLoadData(dataTransaksi);
|
// onLoadData(dataTransaksi);
|
||||||
} catch (error) {
|
// } catch (error) {
|
||||||
console.log(error);
|
// console.log(error);
|
||||||
} finally {
|
// } finally {
|
||||||
ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
// ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
||||||
setLoading(true);
|
// setLoading(true);
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
// ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { Button } from "@mantine/core";
|
||||||
|
import {
|
||||||
|
adminInvestasi_funAcceptTransaksiById,
|
||||||
|
adminInvestasi_funGetAllTransaksiById,
|
||||||
|
} from "../../fun";
|
||||||
|
import { ComponentAdminGlobal_NotifikasiBerhasil } from "@/app_modules/admin/_admin_global/admin_notifikasi/notifikasi_berhasil";
|
||||||
|
import { ComponentAdminGlobal_NotifikasiGagal } from "@/app_modules/admin/_admin_global/admin_notifikasi/notifikasi_gagal";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
|
export function AdminInvestasi_ComponentButtonBandingTransaksi({
|
||||||
|
invoiceId,
|
||||||
|
investasiId,
|
||||||
|
lembarTerbeli,
|
||||||
|
|
||||||
|
}: {
|
||||||
|
invoiceId: string;
|
||||||
|
investasiId: string;
|
||||||
|
lembarTerbeli: string;
|
||||||
|
|
||||||
|
}) {
|
||||||
|
console.log("Ini invoiceid", invoiceId)
|
||||||
|
console.log("Ini investasiid", investasiId)
|
||||||
|
console.log("Ini lembar terbeli", lembarTerbeli)
|
||||||
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
const router = useRouter();
|
||||||
|
async function onAccept() {
|
||||||
|
try {
|
||||||
|
setLoading(true);
|
||||||
|
const res = await adminInvestasi_funAcceptTransaksiById({
|
||||||
|
invoiceId,
|
||||||
|
investasiId,
|
||||||
|
lembarTerbeli,
|
||||||
|
});
|
||||||
|
if (res.status == 200) {
|
||||||
|
router.back();
|
||||||
|
ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
||||||
|
} else {
|
||||||
|
console.error("reject error", res.message);
|
||||||
|
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Button
|
||||||
|
radius={"xl"}
|
||||||
|
color="orange"
|
||||||
|
onClick={() => {
|
||||||
|
onAccept();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Banding Diterima
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import { RouterAdminGlobal } from "@/lib";
|
||||||
|
import { Button } from "@mantine/core";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
export function AdminInvestasi_ComponentCekBuktiTransfer({
|
||||||
|
imageId,
|
||||||
|
}: {
|
||||||
|
imageId: string;
|
||||||
|
}) {
|
||||||
|
const router = useRouter();
|
||||||
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Button
|
||||||
|
loaderPosition="center"
|
||||||
|
loading={isLoading}
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={() => {
|
||||||
|
setLoading(true);
|
||||||
|
router.push(RouterAdminGlobal.preview_image({ id: imageId }));
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Cek Transaksi
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,168 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { ComponentAdminGlobal_NotifikasiBerhasil } from "@/app_modules/admin/_admin_global/admin_notifikasi/notifikasi_berhasil";
|
||||||
|
import { ComponentAdminGlobal_NotifikasiGagal } from "@/app_modules/admin/_admin_global/admin_notifikasi/notifikasi_gagal";
|
||||||
|
import { Box, Button, Flex, Stack } from "@mantine/core";
|
||||||
|
import { IconBan, IconCircleCheck } from "@tabler/icons-react";
|
||||||
|
import { useState } from "react";
|
||||||
|
import {
|
||||||
|
adminInvestasi_funAcceptTransaksiById,
|
||||||
|
adminInvestasi_funGetAllTransaksiById,
|
||||||
|
adminInvestasi_funRejectInvoiceById,
|
||||||
|
} from "../../fun";
|
||||||
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
|
import { IRealtimeData } from "@/lib/global_state";
|
||||||
|
import {
|
||||||
|
notifikasiToAdmin_funCreate,
|
||||||
|
notifikasiToUser_funCreate,
|
||||||
|
} from "@/app_modules/notifikasi/fun";
|
||||||
|
import { WibuRealtime } from "wibu-pkg";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
|
export function AdminInvestasi_ComponentButtonKonfirmasiTransaksi({
|
||||||
|
invoiceId,
|
||||||
|
investasiId,
|
||||||
|
lembarTerbeli,
|
||||||
|
|
||||||
|
}: {
|
||||||
|
invoiceId: string;
|
||||||
|
investasiId: string;
|
||||||
|
lembarTerbeli: string;
|
||||||
|
|
||||||
|
}) {
|
||||||
|
const [isLoadingAccpet, setLoadingAccept] = useState(false);
|
||||||
|
const [isLoadingReject, setLoadingReject] = useState(false);
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
async function onReject() {
|
||||||
|
try {
|
||||||
|
setLoadingReject(true);
|
||||||
|
|
||||||
|
const res = await adminInvestasi_funRejectInvoiceById({ invoiceId });
|
||||||
|
if (res.status == 200) {
|
||||||
|
const notifikasiInvestor: IRealtimeData = {
|
||||||
|
appId: invoiceId as string,
|
||||||
|
userId: res.userId as string,
|
||||||
|
status: res.statusName as any,
|
||||||
|
pesan: "Transaksi anda gagal, coba hubungi admin",
|
||||||
|
kategoriApp: "INVESTASI",
|
||||||
|
title: "Transaksi Gagal",
|
||||||
|
};
|
||||||
|
|
||||||
|
const notifToInvestor = await notifikasiToUser_funCreate({
|
||||||
|
data: notifikasiInvestor as any,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (notifToInvestor.status === 201) {
|
||||||
|
WibuRealtime.setData({
|
||||||
|
type: "notification",
|
||||||
|
pushNotificationTo: "USER",
|
||||||
|
dataMessage: notifikasiInvestor,
|
||||||
|
});
|
||||||
|
ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
||||||
|
}
|
||||||
|
router.back();
|
||||||
|
} else {
|
||||||
|
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
clientLogger.error("Error rejected investasi:", error);
|
||||||
|
} finally {
|
||||||
|
setLoadingReject(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onAccept() {
|
||||||
|
try {
|
||||||
|
setLoadingAccept(true);
|
||||||
|
const res = await adminInvestasi_funAcceptTransaksiById({
|
||||||
|
invoiceId,
|
||||||
|
investasiId,
|
||||||
|
lembarTerbeli,
|
||||||
|
});
|
||||||
|
if (res.status == 200) {
|
||||||
|
const dataNotifikasi: IRealtimeData = {
|
||||||
|
appId: investasiId,
|
||||||
|
status: res.data?.dataInvestasi?.MasterStatusInvestasi?.name as any,
|
||||||
|
userId: res.data?.dataInvestasi.authorId as string,
|
||||||
|
pesan: "Cek investasi anda, Anda memiliki investor baru",
|
||||||
|
kategoriApp: "INVESTASI",
|
||||||
|
title: "Investor baru",
|
||||||
|
};
|
||||||
|
|
||||||
|
const notif = await notifikasiToUser_funCreate({
|
||||||
|
data: dataNotifikasi as any,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (notif.status === 201) {
|
||||||
|
WibuRealtime.setData({
|
||||||
|
type: "notification",
|
||||||
|
pushNotificationTo: "USER",
|
||||||
|
dataMessage: dataNotifikasi,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const notifikasiInvestor: IRealtimeData = {
|
||||||
|
appId: res.data?.dataInvestor.id as string,
|
||||||
|
status: "Berhasil",
|
||||||
|
userId: res.data?.dataInvestor.authorId as string,
|
||||||
|
pesan: "Selamat, anda telah menjadi investor baru",
|
||||||
|
kategoriApp: "INVESTASI",
|
||||||
|
title: "Investasi berhasil",
|
||||||
|
};
|
||||||
|
|
||||||
|
const notifToInvestor = await notifikasiToUser_funCreate({
|
||||||
|
data: notifikasiInvestor as any,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (notifToInvestor.status === 201) {
|
||||||
|
WibuRealtime.setData({
|
||||||
|
type: "notification",
|
||||||
|
pushNotificationTo: "USER",
|
||||||
|
dataMessage: notifikasiInvestor,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
||||||
|
router.back();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
clientLogger.error("Error accept invoice", error);
|
||||||
|
setLoadingAccept(false);
|
||||||
|
} finally {
|
||||||
|
setLoadingAccept(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Flex px={135} align={"center"} justify={"center"} gap={"md"} >
|
||||||
|
<Box>
|
||||||
|
<Button
|
||||||
|
loaderPosition="center"
|
||||||
|
loading={isLoadingAccpet}
|
||||||
|
leftIcon={<IconCircleCheck />}
|
||||||
|
radius={"xl"}
|
||||||
|
color="green"
|
||||||
|
onClick={() => {
|
||||||
|
onAccept();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Terima
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Button
|
||||||
|
loaderPosition="center"
|
||||||
|
loading={isLoadingReject}
|
||||||
|
leftIcon={<IconBan />}
|
||||||
|
radius={"xl"}
|
||||||
|
color="red"
|
||||||
|
onClick={() => onReject()}
|
||||||
|
>
|
||||||
|
Tolak
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
</Flex>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -74,7 +74,6 @@ const apiGetAdminDetailTransaksi = async ({ id }: { id: string }) => {
|
|||||||
Authorization: `Bearer ${token}`,
|
Authorization: `Bearer ${token}`,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log("Ini response",response.json())
|
|
||||||
|
|
||||||
return await response.json().catch(() => null);
|
return await response.json().catch(() => null);
|
||||||
}
|
}
|
||||||
@@ -115,7 +114,6 @@ const apiGetAdminAllTransaksiById = async ({
|
|||||||
|
|
||||||
// Fetch data
|
// Fetch data
|
||||||
const isStatus = status ? `&status=${status}` : "";
|
const isStatus = status ? `&status=${status}` : "";
|
||||||
console.log("Ini status", isStatus);
|
|
||||||
const isPage = page ? `?page=${page}` : "";
|
const isPage = page ? `?page=${page}` : "";
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`/api/admin/investasi/${id}/transaksi${isPage}${isStatus}`,
|
`/api/admin/investasi/${id}/transaksi${isPage}${isStatus}`,
|
||||||
|
|||||||
@@ -1,3 +1,348 @@
|
|||||||
|
// import { ComponentAdminGlobal_TampilanRupiah, ComponentAdminGlobal_TitlePage } from "@/app_modules/admin/_admin_global/_component";
|
||||||
|
// import {
|
||||||
|
// MODEL_INVOICE_INVESTASI,
|
||||||
|
// MODEL_STATUS_INVOICE_INVESTASI,
|
||||||
|
// } from "@/app_modules/investasi/_lib/interface";
|
||||||
|
// import {
|
||||||
|
// ActionIcon,
|
||||||
|
// Badge,
|
||||||
|
// Center,
|
||||||
|
// Group,
|
||||||
|
// Pagination,
|
||||||
|
// Paper,
|
||||||
|
// ScrollArea,
|
||||||
|
// Select,
|
||||||
|
// Stack,
|
||||||
|
// Table,
|
||||||
|
// Text,
|
||||||
|
// Title,
|
||||||
|
// } from "@mantine/core";
|
||||||
|
// import { IconReload } from "@tabler/icons-react";
|
||||||
|
// import { isEmpty } from "lodash";
|
||||||
|
// import { useParams, useRouter } from "next/navigation";
|
||||||
|
// import { useState } from "react";
|
||||||
|
// import {
|
||||||
|
// AdminInvestasi_ComponentButtonBandingTransaksi,
|
||||||
|
// AdminInvestasi_ComponentButtonKonfirmasiTransaksi,
|
||||||
|
// AdminInvestasi_ComponentCekBuktiTransfer,
|
||||||
|
// } from "../../_component";
|
||||||
|
// import { adminInvestasi_funGetAllTransaksiById } from "../../fun";
|
||||||
|
// import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
|
// import { useShallowEffect } from "@mantine/hooks";
|
||||||
|
// import { apiGetAdminAllTransaksiById, apiGetAdminStatusTransaksi } from "../../_lib/api_fetch_admin_investasi";
|
||||||
|
// import { clientLogger } from "@/util/clientLogger";
|
||||||
|
// import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||||
|
// import { apiGetMasterStatusTransaksi } from "@/app_modules/_global/lib/api_fetch_master";
|
||||||
|
|
||||||
|
// export function AdminInvestasi_ViewDaftarTransaksi() {
|
||||||
|
// const params = useParams<{ id: string }>();
|
||||||
|
// const investasiId = params.id;
|
||||||
|
// const router = useRouter();
|
||||||
|
// const [isLoading, setLoading] = useState(false);
|
||||||
|
// const [idData, setIdData] = useState("");
|
||||||
|
// const [listStatus, setListStatus] = useState<MODEL_STATUS_INVOICE_INVESTASI[] | null>(null);
|
||||||
|
|
||||||
|
// const [data, setData] = useState<MODEL_INVOICE_INVESTASI[] | null>(null);
|
||||||
|
// const [isNPage, setNPage] = useState<number>(1);
|
||||||
|
// const [isActivePage, setActivePage] = useState(1);
|
||||||
|
// const [selectedStatus, setSelectedStatus] = useState("");
|
||||||
|
|
||||||
|
// useShallowEffect(() => {
|
||||||
|
// loadInitialData();
|
||||||
|
// }, [isActivePage, selectedStatus])
|
||||||
|
|
||||||
|
// useShallowEffect(() => {
|
||||||
|
// loadStatus();
|
||||||
|
// }, [])
|
||||||
|
|
||||||
|
// const loadInitialData = async () => {
|
||||||
|
// try {
|
||||||
|
// const response = await apiGetAdminAllTransaksiById({
|
||||||
|
// id: investasiId,
|
||||||
|
// page: `${isNPage}`,
|
||||||
|
// status: selectedStatus,
|
||||||
|
// })
|
||||||
|
|
||||||
|
// if (response?.success && response?.data?.data) {
|
||||||
|
// setData(response.data.data);
|
||||||
|
// setNPage(response.nPage || 1);
|
||||||
|
// setListStatus(response.data.data);
|
||||||
|
// } else {
|
||||||
|
// console.error("Invalid data format received:", response);
|
||||||
|
// setData([]);
|
||||||
|
// }
|
||||||
|
// } catch (error) {
|
||||||
|
// clientLogger.error("Error get data daftar tramnsaksi", error);
|
||||||
|
// setData([]);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// const loadStatus = async () => {
|
||||||
|
// try {
|
||||||
|
// const response = await apiGetMasterStatusTransaksi()
|
||||||
|
|
||||||
|
// if (response?.success && response?.data) {
|
||||||
|
// setListStatus(response.data);
|
||||||
|
// console.log("status", response.data)
|
||||||
|
// } else {
|
||||||
|
// console.error("Invalid data format received:", response);
|
||||||
|
// setListStatus(null);
|
||||||
|
// }
|
||||||
|
// } catch (error) {
|
||||||
|
// clientLogger.error("Error get status transaksi", error);
|
||||||
|
// setListStatus(null);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// const onPageClick = async (page: number) => {
|
||||||
|
// const loadData = await apiGetAdminAllTransaksiById({
|
||||||
|
// id: investasiId,
|
||||||
|
// page: `${isNPage}`
|
||||||
|
// })
|
||||||
|
// setActivePage(page);
|
||||||
|
// setData(loadData.data as any);
|
||||||
|
// setNPage(loadData.nPage);
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
// async function onSelected(selectStatus: any) {
|
||||||
|
// setSelectedStatus(selectStatus);
|
||||||
|
// // const loadData = await apiGetAdminStatusTransaksi();
|
||||||
|
// // setData(loadData.data as any);
|
||||||
|
// // setNPage(loadData.nPage);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// async function onReload() {
|
||||||
|
// const loadData = await apiGetAdminAllTransaksiById({
|
||||||
|
// id: investasiId,
|
||||||
|
// page: '1'
|
||||||
|
// });
|
||||||
|
// setData(loadData.data as any);
|
||||||
|
// setNPage(loadData.nPage);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// const renderTableBody = () => {
|
||||||
|
// if (!Array.isArray(data) || data.length === 0) {
|
||||||
|
// return (
|
||||||
|
// <tr>
|
||||||
|
// <td colSpan={12}>
|
||||||
|
// <Center>
|
||||||
|
// <Text color="gray">Tidak ada data</Text>
|
||||||
|
// </Center>
|
||||||
|
// </td>
|
||||||
|
// </tr>
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// return data?.map((e, i) => (
|
||||||
|
// <tr key={i}>
|
||||||
|
// <td>
|
||||||
|
// <Center c={AdminColor.white}>{e?.Author?.username}</Center>
|
||||||
|
// </td>
|
||||||
|
// <td>
|
||||||
|
// <Center c={AdminColor.white}>{e?.MasterBank?.namaBank}</Center>
|
||||||
|
// </td>
|
||||||
|
// <td>
|
||||||
|
// <Center c={AdminColor.white}>
|
||||||
|
// <ComponentAdminGlobal_TampilanRupiah nominal={+e?.nominal} />
|
||||||
|
// </Center>
|
||||||
|
// </td>
|
||||||
|
// <td>
|
||||||
|
// <Center c={AdminColor.white}>
|
||||||
|
// {new Intl.NumberFormat("id-ID", { maximumFractionDigits: 10 }).format(
|
||||||
|
// +e?.lembarTerbeli
|
||||||
|
// )}
|
||||||
|
// </Center>
|
||||||
|
// </td>
|
||||||
|
// <td>
|
||||||
|
// <Center c={AdminColor.white}>
|
||||||
|
// {new Intl.DateTimeFormat("id-ID", { dateStyle: "full" }).format(new Date(e?.createdAt))}
|
||||||
|
// </Center>
|
||||||
|
// </td>
|
||||||
|
// <td>
|
||||||
|
// <Center>
|
||||||
|
// <Badge
|
||||||
|
// w={150}
|
||||||
|
// variant="light"
|
||||||
|
// color={
|
||||||
|
// e.statusInvoiceId === "1"
|
||||||
|
// ? "green"
|
||||||
|
// : e.statusInvoiceId === "4"
|
||||||
|
// ? "red"
|
||||||
|
// : "blue"
|
||||||
|
// }
|
||||||
|
// >
|
||||||
|
// {e?.StatusInvoice?.name}
|
||||||
|
// </Badge>
|
||||||
|
// </Center>
|
||||||
|
// </td>
|
||||||
|
// <td>
|
||||||
|
// <Center>
|
||||||
|
// {e?.statusInvoiceId !== "3" ? (
|
||||||
|
// <AdminInvestasi_ComponentCekBuktiTransfer imageId={e?.imageId} />
|
||||||
|
// ) : (
|
||||||
|
// "-"
|
||||||
|
// )}
|
||||||
|
// </Center>
|
||||||
|
// </td>
|
||||||
|
// <td>
|
||||||
|
// <Center>
|
||||||
|
// {e.statusInvoiceId === "1" && "-"}
|
||||||
|
// {e.statusInvoiceId === "2" && (
|
||||||
|
// <AdminInvestasi_ComponentButtonKonfirmasiTransaksi
|
||||||
|
// invoiceId={e.id}
|
||||||
|
// investasiId={investasiId}
|
||||||
|
// lembarTerbeli={e.lembarTerbeli}
|
||||||
|
// onLoadData={(val) => {
|
||||||
|
// setData(val.data);
|
||||||
|
// setNPage(val.nPage);
|
||||||
|
// }}
|
||||||
|
// />
|
||||||
|
// )}
|
||||||
|
// {e.statusInvoiceId === "3" && "-"}
|
||||||
|
// {e.statusInvoiceId === "4" && (
|
||||||
|
// <AdminInvestasi_ComponentButtonBandingTransaksi
|
||||||
|
|
||||||
|
// invoiceId={e.id}
|
||||||
|
// investasiId={investasiId}
|
||||||
|
// lembarTerbeli={e.lembarTerbeli}
|
||||||
|
// onLoadData={(val) => {
|
||||||
|
// setData(val.data);
|
||||||
|
// setNPage(val.nPage);
|
||||||
|
// }}
|
||||||
|
// />
|
||||||
|
// )}
|
||||||
|
// </Center>
|
||||||
|
// </td>
|
||||||
|
// </tr>
|
||||||
|
// ));
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return (
|
||||||
|
// <>
|
||||||
|
// <Stack spacing={"xs"} h={"100%"}>
|
||||||
|
// <ComponentAdminGlobal_TitlePage
|
||||||
|
// name="Transkasi"
|
||||||
|
// color={AdminColor.softBlue}
|
||||||
|
// component={<Group>
|
||||||
|
// <ActionIcon
|
||||||
|
// size={"lg"}
|
||||||
|
// radius={"xl"}
|
||||||
|
// variant="light"
|
||||||
|
// onClick={() => {
|
||||||
|
// onReload();
|
||||||
|
// }}
|
||||||
|
// >
|
||||||
|
// <IconReload />
|
||||||
|
// </ActionIcon>
|
||||||
|
// <Select
|
||||||
|
// placeholder="Pilih status"
|
||||||
|
// value={selectedStatus}
|
||||||
|
// data={listStatus?.map(status => ({
|
||||||
|
// value: status.id,
|
||||||
|
// label: status.name,
|
||||||
|
|
||||||
|
// })) || []}
|
||||||
|
// onChange={(val: any) => {
|
||||||
|
// console.log(val)
|
||||||
|
// onSelected(val);
|
||||||
|
// }}
|
||||||
|
// />
|
||||||
|
// </Group>}
|
||||||
|
// />
|
||||||
|
// {/* <Group
|
||||||
|
// position="apart"
|
||||||
|
// bg={"gray.4"}
|
||||||
|
// p={"xs"}
|
||||||
|
// style={{ borderRadius: "6px" }}
|
||||||
|
// >
|
||||||
|
// <Title order={4}>Transaksi</Title>
|
||||||
|
// <Group>
|
||||||
|
// <ActionIcon
|
||||||
|
// size={"lg"}
|
||||||
|
// radius={"xl"}
|
||||||
|
// variant="light"
|
||||||
|
// onClick={() => {
|
||||||
|
// onReload();
|
||||||
|
// }}
|
||||||
|
// >
|
||||||
|
// <IconReload />
|
||||||
|
// </ActionIcon>
|
||||||
|
// <Select
|
||||||
|
// placeholder="Pilih status"
|
||||||
|
// value={selectedStatus}
|
||||||
|
// data={
|
||||||
|
// isEmpty(listStatsus)
|
||||||
|
// ? []
|
||||||
|
// : listStatsus.map((e) => ({
|
||||||
|
// value: e.id,
|
||||||
|
// label: e.name,
|
||||||
|
// }))
|
||||||
|
// }
|
||||||
|
// onChange={(val: any) => {
|
||||||
|
// onSelected(val);
|
||||||
|
// }}
|
||||||
|
// />
|
||||||
|
// </Group>
|
||||||
|
// </Group> */}
|
||||||
|
|
||||||
|
// {!data ? (<CustomSkeleton height={"80vh"} width={"100%"} />) : (
|
||||||
|
// <Paper bg={AdminColor.softBlue} p={"md"} shadow="lg" h={"80vh"}>
|
||||||
|
// <ScrollArea w={"100%"} h={"90%"}>
|
||||||
|
// <Table
|
||||||
|
// verticalSpacing={"xl"}
|
||||||
|
// horizontalSpacing={"md"}
|
||||||
|
// p={"md"}
|
||||||
|
// w={1500}
|
||||||
|
// >
|
||||||
|
// <thead>
|
||||||
|
// <tr>
|
||||||
|
// <th>
|
||||||
|
// <Center c={AdminColor.white}>Nama Investor</Center>
|
||||||
|
// </th>
|
||||||
|
// <th>
|
||||||
|
// <Center c={AdminColor.white}>Nama Bank</Center>
|
||||||
|
// </th>
|
||||||
|
// <th>
|
||||||
|
// <Center c={AdminColor.white}>Jumlah Investasi</Center>
|
||||||
|
// </th>
|
||||||
|
// <th>
|
||||||
|
// <Center c={AdminColor.white}>Lembar Terbeli</Center>
|
||||||
|
// </th>
|
||||||
|
// <th>
|
||||||
|
// <Center c={AdminColor.white}>Tanggal</Center>
|
||||||
|
// </th>
|
||||||
|
// <th>
|
||||||
|
// <Center c={AdminColor.white}>Status</Center>
|
||||||
|
// </th>
|
||||||
|
// <th>
|
||||||
|
// <Center c={AdminColor.white}>Bukti Transfer</Center>
|
||||||
|
// </th>
|
||||||
|
// <th>
|
||||||
|
// <Center c={AdminColor.white}>Aksi</Center>
|
||||||
|
// </th>
|
||||||
|
// </tr>
|
||||||
|
// </thead>
|
||||||
|
// <tbody>{renderTableBody()}</tbody>
|
||||||
|
// </Table>
|
||||||
|
// </ScrollArea>
|
||||||
|
|
||||||
|
// <Center mt={"xl"}>
|
||||||
|
// <Pagination
|
||||||
|
// value={isActivePage}
|
||||||
|
// total={isNPage}
|
||||||
|
// onChange={(val) => {
|
||||||
|
// onPageClick(val);
|
||||||
|
// }}
|
||||||
|
// />
|
||||||
|
// </Center>
|
||||||
|
// </Paper>
|
||||||
|
// )}
|
||||||
|
// </Stack>
|
||||||
|
// </>
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
import { apiGetMasterStatusTransaksi } from "@/app_modules/_global/lib/api_fetch_master";
|
import { apiGetMasterStatusTransaksi } from "@/app_modules/_global/lib/api_fetch_master";
|
||||||
import { globalStatusTransaksi } from "@/app_modules/_global/lib/master_list_app";
|
import { globalStatusTransaksi } from "@/app_modules/_global/lib/master_list_app";
|
||||||
@@ -29,13 +374,9 @@ import { useShallowEffect } from "@mantine/hooks";
|
|||||||
import { IconEyeCheck, IconReload } from "@tabler/icons-react";
|
import { IconEyeCheck, IconReload } from "@tabler/icons-react";
|
||||||
import { useParams, useRouter } from "next/navigation";
|
import { useParams, useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import {
|
|
||||||
AdminInvestasi_ComponentButtonBandingTransaksi,
|
|
||||||
AdminInvestasi_ComponentButtonKonfirmasiTransaksi,
|
|
||||||
AdminInvestasi_ComponentCekBuktiTransfer,
|
|
||||||
} from "../../_component";
|
|
||||||
import { apiGetAdminAllTransaksiById } from "../../_lib/api_fetch_admin_investasi";
|
import { apiGetAdminAllTransaksiById } from "../../_lib/api_fetch_admin_investasi";
|
||||||
import { RouterAdminInvestasi } from "@/lib/router_admin/router_admin_investasi";
|
import { RouterAdminInvestasi } from "@/lib/router_admin/router_admin_investasi";
|
||||||
|
import { AdminInvestasi_ComponentCekBuktiTransfer } from "../../_component/new_button/button_cek_bukti_transfer";
|
||||||
|
|
||||||
export function AdminInvestasi_ViewDaftarTransaksi() {
|
export function AdminInvestasi_ViewDaftarTransaksi() {
|
||||||
const params = useParams<{ id: string }>();
|
const params = useParams<{ id: string }>();
|
||||||
|
|||||||
@@ -164,9 +164,9 @@ export function AdminInvestasi_ViewDaftarTransaksi() {
|
|||||||
)}
|
)}
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center>
|
<Center>
|
||||||
{/* {e.statusInvoiceId === "1" && "-"}
|
{e.statusInvoiceId === "1" && "-"}
|
||||||
{e.statusInvoiceId === "2" && (
|
{e.statusInvoiceId === "2" && (
|
||||||
<AdminInvestasi_ComponentButtonKonfirmasiTransaksi
|
<AdminInvestasi_ComponentButtonKonfirmasiTransaksi
|
||||||
invoiceId={e.id}
|
invoiceId={e.id}
|
||||||
@@ -181,6 +181,7 @@ export function AdminInvestasi_ViewDaftarTransaksi() {
|
|||||||
{e.statusInvoiceId === "3" && "-"}
|
{e.statusInvoiceId === "3" && "-"}
|
||||||
{e.statusInvoiceId === "4" && (
|
{e.statusInvoiceId === "4" && (
|
||||||
<AdminInvestasi_ComponentButtonBandingTransaksi
|
<AdminInvestasi_ComponentButtonBandingTransaksi
|
||||||
|
|
||||||
invoiceId={e.id}
|
invoiceId={e.id}
|
||||||
investasiId={investasiId}
|
investasiId={investasiId}
|
||||||
lembarTerbeli={e.lembarTerbeli}
|
lembarTerbeli={e.lembarTerbeli}
|
||||||
@@ -189,6 +190,9 @@ export function AdminInvestasi_ViewDaftarTransaksi() {
|
|||||||
setNPage(val.nPage);
|
setNPage(val.nPage);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
|
</Center>
|
||||||
|
</td>
|
||||||
)} */}
|
)} */}
|
||||||
<Button
|
<Button
|
||||||
loading={isLoading && idData == e.id}
|
loading={isLoading && idData == e.id}
|
||||||
|
|||||||
@@ -3,16 +3,23 @@ import { AdminColor } from '@/app_modules/_global/color/color_pallet';
|
|||||||
import AdminGlobal_ComponentBackButton from '@/app_modules/admin/_admin_global/back_button';
|
import AdminGlobal_ComponentBackButton from '@/app_modules/admin/_admin_global/back_button';
|
||||||
import CustomSkeleton from '@/app_modules/components/CustomSkeleton';
|
import CustomSkeleton from '@/app_modules/components/CustomSkeleton';
|
||||||
import { MODEL_INVOICE_INVESTASI } from '@/app_modules/investasi/_lib/interface';
|
import { MODEL_INVOICE_INVESTASI } from '@/app_modules/investasi/_lib/interface';
|
||||||
import { Button, Grid, Group, Paper, Stack, Text, Title } from '@mantine/core';
|
|
||||||
import { useState } from 'react';
|
|
||||||
import { apiGetAdminDetailTransaksi } from '../../_lib/api_fetch_admin_investasi';
|
|
||||||
import { useParams } from 'next/navigation';
|
|
||||||
import { clientLogger } from '@/util/clientLogger';
|
import { clientLogger } from '@/util/clientLogger';
|
||||||
|
import { Badge, Box, Grid, Group, Paper, Stack, Text, Title } from '@mantine/core';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useShallowEffect } from '@mantine/hooks';
|
||||||
|
import { useParams } from 'next/navigation';
|
||||||
|
import { useState } from 'react';
|
||||||
|
|
||||||
|
import { apiGetAdminDetailTransaksi } from '../../_lib/api_fetch_admin_investasi';
|
||||||
|
import { AdminInvestasi_ComponentButtonKonfirmasiTransaksi } from '../../_component/new_button/button_konfirmasi_transaksi';
|
||||||
|
|
||||||
|
import { AdminInvestasi_ComponentCekBuktiTransfer } from '../../_component/new_button/button_cek_bukti_transfer';
|
||||||
|
import { AdminInvestasi_ComponentButtonBandingTransaksi } from '../../_component/new_button/button_banding_transaksi';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function DetailTransaksi() {
|
function DetailTransaksi() {
|
||||||
const params = useParams<{ id: string }>();
|
const params = useParams<{ id: string }>();
|
||||||
|
const investasiId = params.id;
|
||||||
const [data, setData] = useState<MODEL_INVOICE_INVESTASI | null>(null);
|
const [data, setData] = useState<MODEL_INVOICE_INVESTASI | null>(null);
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
@@ -21,18 +28,17 @@ function DetailTransaksi() {
|
|||||||
|
|
||||||
const loadInitialData = async () => {
|
const loadInitialData = async () => {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
const response = await apiGetAdminDetailTransaksi({
|
const response = await apiGetAdminDetailTransaksi({
|
||||||
id: params.id
|
id: investasiId
|
||||||
})
|
})
|
||||||
|
|
||||||
if (response?.success && response?.data.data) {
|
if (response?.success && response?.data?.data) {
|
||||||
setData(response.data.data)
|
setData(response.data.data)
|
||||||
} else {
|
} else {
|
||||||
console.error("Invalid data format recieved:", response)
|
console.error("Invalid data format recieved:", response)
|
||||||
setData(null)
|
setData(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
clientLogger.error("Invalid data format recieved:", error)
|
clientLogger.error("Invalid data format recieved:", error)
|
||||||
setData(null)
|
setData(null)
|
||||||
@@ -42,27 +48,6 @@ function DetailTransaksi() {
|
|||||||
<Stack px={"lg"}>
|
<Stack px={"lg"}>
|
||||||
<Group position="apart">
|
<Group position="apart">
|
||||||
<AdminGlobal_ComponentBackButton />
|
<AdminGlobal_ComponentBackButton />
|
||||||
|
|
||||||
{/* {data?.masterStatusInvestasiId === "2" ? ( */}
|
|
||||||
<Group>
|
|
||||||
<Button
|
|
||||||
radius={"xl"}
|
|
||||||
color="green"
|
|
||||||
// onClick={() => setOpenModalPublish(true)}
|
|
||||||
>
|
|
||||||
Publish
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
radius={"xl"}
|
|
||||||
color="red"
|
|
||||||
// onClick={() => setOpenModalReject(true)}
|
|
||||||
>
|
|
||||||
Reject
|
|
||||||
</Button>
|
|
||||||
</Group>
|
|
||||||
{/* // ) : (
|
|
||||||
// ""
|
|
||||||
// )} */}
|
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
<>
|
<>
|
||||||
@@ -124,7 +109,17 @@ function DetailTransaksi() {
|
|||||||
<Text fw={"bold"}>Status:</Text>
|
<Text fw={"bold"}>Status:</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={6}>
|
<Grid.Col span={6}>
|
||||||
<Text>{data?.statusInvoiceId}</Text>
|
<Badge
|
||||||
|
w={150}
|
||||||
|
variant='light'
|
||||||
|
color={
|
||||||
|
data?.StatusInvoice?.id === "1"
|
||||||
|
? "green"
|
||||||
|
: data?.StatusInvoice?.id === "4"
|
||||||
|
? "red"
|
||||||
|
: "blue"
|
||||||
|
}
|
||||||
|
>{data?.StatusInvoice?.name}</Badge>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid>
|
<Grid>
|
||||||
@@ -132,7 +127,36 @@ function DetailTransaksi() {
|
|||||||
<Text fw={"bold"}>Bukti Transfer:</Text>
|
<Text fw={"bold"}>Bukti Transfer:</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={6}>
|
<Grid.Col span={6}>
|
||||||
<Text>{data?.Profile?.alamat}</Text>
|
<Box>
|
||||||
|
{data?.statusInvoiceId !== "3" ? (
|
||||||
|
<AdminInvestasi_ComponentCekBuktiTransfer imageId={data?.imageId} />
|
||||||
|
) : (
|
||||||
|
"-"
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
<Grid pt={"md"}>
|
||||||
|
<Grid.Col span={6}>
|
||||||
|
<Group>
|
||||||
|
{data?.statusInvoiceId === "1" && "-"}
|
||||||
|
{data?.statusInvoiceId === "2" && (
|
||||||
|
<AdminInvestasi_ComponentButtonKonfirmasiTransaksi
|
||||||
|
investasiId={data?.investasiId}
|
||||||
|
invoiceId={data?.id}
|
||||||
|
lembarTerbeli={data?.lembarTerbeli}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{data?.statusInvoiceId === "3" && "-"}
|
||||||
|
{data?.statusInvoiceId === "4" && (
|
||||||
|
<AdminInvestasi_ComponentButtonBandingTransaksi
|
||||||
|
invoiceId={data?.id}
|
||||||
|
investasiId={data?.investasiId}
|
||||||
|
lembarTerbeli={data?.lembarTerbeli}
|
||||||
|
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Group>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -13,7 +13,11 @@ export async function adminInvestasi_funAcceptTransaksiById({
|
|||||||
invoiceId: string;
|
invoiceId: string;
|
||||||
investasiId: string;
|
investasiId: string;
|
||||||
lembarTerbeli: string;
|
lembarTerbeli: string;
|
||||||
}) {
|
}) {
|
||||||
|
console.log("Ini invoiceid", invoiceId)
|
||||||
|
console.log("Ini investasid", investasiId)
|
||||||
|
console.log("Ini lembar terbeli", lembarTerbeli)
|
||||||
|
|
||||||
const dataInvestasi: any = await prisma.investasi.findFirst({
|
const dataInvestasi: any = await prisma.investasi.findFirst({
|
||||||
where: {
|
where: {
|
||||||
id: investasiId,
|
id: investasiId,
|
||||||
@@ -24,7 +28,6 @@ export async function adminInvestasi_funAcceptTransaksiById({
|
|||||||
lembarTerbeli: true,
|
lembarTerbeli: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// Hitung TOTAL SISA LEMBAR
|
// Hitung TOTAL SISA LEMBAR
|
||||||
const investasi_sisaLembar = toNumber(dataInvestasi?.sisaLembar);
|
const investasi_sisaLembar = toNumber(dataInvestasi?.sisaLembar);
|
||||||
const invoice_lembarTerbeli = toNumber(lembarTerbeli);
|
const invoice_lembarTerbeli = toNumber(lembarTerbeli);
|
||||||
@@ -47,6 +50,7 @@ export async function adminInvestasi_funAcceptTransaksiById({
|
|||||||
statusInvoiceId: "1",
|
statusInvoiceId: "1",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if (!updt) {
|
if (!updt) {
|
||||||
return { status: 400, message: "Gagal Update Status" };
|
return { status: 400, message: "Gagal Update Status" };
|
||||||
@@ -83,3 +87,6 @@ export async function adminInvestasi_funAcceptTransaksiById({
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user