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 { NextResponse } from "next/server";
|
||||
export async function GET(req: Request,
|
||||
{ params }: { params: { id: any } }) {
|
||||
{ params }: { params: { id: string } }) {
|
||||
try {
|
||||
let fixData;
|
||||
const { id } = params
|
||||
const data = await prisma.investasi_Invoice.findMany({
|
||||
const data = await prisma.investasi_Invoice.findUnique({
|
||||
where: {
|
||||
investasiId: id,
|
||||
isActive: true,
|
||||
id: id
|
||||
},
|
||||
include: {
|
||||
Author: true,
|
||||
@@ -18,6 +17,7 @@ export async function GET(req: Request,
|
||||
MasterBank: true,
|
||||
}
|
||||
})
|
||||
|
||||
fixData = {
|
||||
data: data,
|
||||
}
|
||||
|
||||
@@ -58,7 +58,6 @@ export async function GET(
|
||||
MasterBank: true,
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.investasi_Invoice.count({
|
||||
where: {
|
||||
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 { Stack, Box, Center, Title, Grid, Text } from "@mantine/core";
|
||||
|
||||
@@ -11,20 +12,20 @@ export default function ComponentAdminColab_DetailData({
|
||||
<Stack>
|
||||
<Box>
|
||||
<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>
|
||||
<Stack spacing={"sm"}>
|
||||
<Grid>
|
||||
<Grid.Col span={2}>
|
||||
<Text fw={"bold"} fz={"sm"}>
|
||||
<Text c={AdminColor.white} fw={"bold"} fz={"sm"}>
|
||||
Industri
|
||||
</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={1}>
|
||||
<Text fz={"sm"}>:</Text>
|
||||
<Text c={AdminColor.white} fz={"sm"}>:</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Text fz={"sm"}>
|
||||
<Text c={AdminColor.white} fz={"sm"}>
|
||||
{data?.ProjectCollaborationMaster_Industri.name
|
||||
? data.ProjectCollaborationMaster_Industri.name
|
||||
: "Industri"}
|
||||
@@ -34,31 +35,31 @@ export default function ComponentAdminColab_DetailData({
|
||||
|
||||
<Grid>
|
||||
<Grid.Col span={2}>
|
||||
<Text fw={"bold"} fz={"sm"}>
|
||||
<Text c={AdminColor.white} fw={"bold"} fz={"sm"}>
|
||||
Lokasi
|
||||
</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={1}>
|
||||
<Text fz={"sm"}>:</Text>
|
||||
<Text c={AdminColor.white} fz={"sm"}>:</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Text fz={"sm"} lineClamp={1}>
|
||||
<Text c={AdminColor.white} fz={"sm"} lineClamp={1}>
|
||||
{data?.lokasi ? data.lokasi : " Lokasi dari proyek"}
|
||||
</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
<Stack spacing={5}>
|
||||
<Text fw={"bold"} fz={"sm"}>
|
||||
<Text c={AdminColor.white} fw={"bold"} fz={"sm"}>
|
||||
Tujuan proyek
|
||||
</Text>
|
||||
<Text fz={"sm"}>{data?.purpose ? data?.purpose : "-"}</Text>
|
||||
<Text c={AdminColor.white} fz={"sm"}>{data?.purpose ? data?.purpose : "-"}</Text>
|
||||
</Stack>
|
||||
<Stack spacing={5}>
|
||||
<Text fw={"bold"} fz={"sm"}>
|
||||
<Text c={AdminColor.white} fw={"bold"} fz={"sm"}>
|
||||
Keuntungan
|
||||
</Text>
|
||||
<Text fz={"sm"}>{data?.benefit ? data?.benefit : "-"}</Text>
|
||||
<Text c={AdminColor.white} fz={"sm"}>{data?.benefit ? data?.benefit : "-"}</Text>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Box>
|
||||
|
||||
@@ -205,6 +205,7 @@ function TableMenu({ listGroup }: { listGroup: any }) {
|
||||
</Stack>
|
||||
|
||||
<Modal
|
||||
styles={{ body: { backgroundColor: AccentColor.darkblue}}}
|
||||
opened={openDetail}
|
||||
onClose={() => setOpenDetail(false)}
|
||||
centered
|
||||
@@ -212,26 +213,26 @@ function TableMenu({ listGroup }: { listGroup: any }) {
|
||||
withCloseButton={false}
|
||||
>
|
||||
<SimpleGrid cols={2}>
|
||||
<Paper bg={"gray.1"} p={"md"} h={500}>
|
||||
<Paper bg={AdminColor.softBlue} p={"md"} h={500}>
|
||||
<ScrollArea h={"100%"} w={"100%"}>
|
||||
<ComponentAdminColab_DetailData
|
||||
data={detailData?.ProjectCollaboration as any}
|
||||
/>
|
||||
</ScrollArea>
|
||||
</Paper>
|
||||
<Paper bg={"gray.1"} p={"md"} h={500}>
|
||||
<Paper bg={AdminColor.softBlue} p={"md"} h={500}>
|
||||
<ScrollArea h={"100%"}>
|
||||
<Stack>
|
||||
<Center>
|
||||
<Title order={4}>Anggota</Title>
|
||||
<Title c={AdminColor.white} order={4}>Anggota</Title>
|
||||
</Center>
|
||||
<Stack>
|
||||
{detailData?.ProjectCollaboration_AnggotaRoomChat?.map(
|
||||
(e, i) => (
|
||||
<Box key={i}>
|
||||
<Text lineClamp={1}>
|
||||
<IconCircleDot size={10} />{" "}
|
||||
<Text span inherit>
|
||||
<IconCircleDot color={AdminColor.white} size={10} />{" "}
|
||||
<Text c={AdminColor.white} span inherit>
|
||||
{e?.User?.Profile?.name}
|
||||
</Text>
|
||||
</Text>
|
||||
|
||||
@@ -265,30 +265,32 @@ function TableMenu({ listData }: { listData: any }) {
|
||||
|
||||
{/* Detail Data */}
|
||||
<Modal
|
||||
styles={{body: { backgroundColor: AdminColor.softBlue}}}
|
||||
opened={openDetail}
|
||||
onClose={() => setOpenDetail(false)}
|
||||
centered
|
||||
withCloseButton={false}
|
||||
size={"lg"}
|
||||
>
|
||||
<Paper p={"md"} bg={"gray.1"}>
|
||||
<Paper p={"md"} bg={AdminColor.softBlue}>
|
||||
<ComponentAdminColab_DetailData data={detailData as any} />
|
||||
</Paper>
|
||||
</Modal>
|
||||
|
||||
{/* Reject Project */}
|
||||
<Modal
|
||||
styles={{body: { backgroundColor: AdminColor.softBlue}}}
|
||||
opened={openReject}
|
||||
onClose={() => setOpenReject(false)}
|
||||
centered
|
||||
withCloseButton={false}
|
||||
size={"lg"}
|
||||
>
|
||||
<Paper p={"md"}>
|
||||
<Paper bg={AdminColor.softBlue} p={"md"}>
|
||||
<Stack>
|
||||
<Text>
|
||||
<Text c={AdminColor.white}>
|
||||
Apakah anda yakin ingin mereport project{" "}
|
||||
<Text span inherit fw={"bold"}>
|
||||
<Text c={AdminColor.white} span inherit fw={"bold"}>
|
||||
{detailData?.title}
|
||||
</Text>
|
||||
?
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"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 {
|
||||
Badge,
|
||||
@@ -21,17 +22,17 @@ export default function ComponentAdminForum_ViewOneDetailKomentar({
|
||||
return (
|
||||
<>
|
||||
<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"}>
|
||||
Detail Komentar
|
||||
</Title>
|
||||
</Paper>
|
||||
|
||||
<Paper withBorder p={"md"} radius={"md"} shadow="sm">
|
||||
<Paper p={"md"} radius={"md"} bg={AdminColor.softBlue}>
|
||||
<Stack>
|
||||
<Stack spacing={5}>
|
||||
<Group position="apart">
|
||||
<Text fw={"bold"}>
|
||||
<Text fw={"bold"} c={AdminColor.white}>
|
||||
Username:{" "}
|
||||
<Text span inherit>
|
||||
{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 AdminGlobal_ComponentBackButton from "../../_admin_global/back_button";
|
||||
import ComponentAdminForum_ViewOneDetailPosting from "../component/detail_one_posting";
|
||||
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
||||
|
||||
export default function AdminForum_DetailPosting({
|
||||
listKomentar,
|
||||
@@ -110,22 +111,22 @@ function TableKomentar({
|
||||
const rowTable = data?.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Center c={AdminColor.white} w={150}>
|
||||
<Text lineClamp={1}>{e?.Author?.username}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Box w={500}>
|
||||
<Spoiler maxHeight={50} hideLabel="sembunyikan" showLabel="tampilkan">
|
||||
<Box w={300}>
|
||||
<Spoiler c={AdminColor.white} maxHeight={50} hideLabel="sembunyikan" showLabel="tampilkan">
|
||||
<div
|
||||
style={{ textAlign: "center" }}
|
||||
style={{ textAlign: "justify", textJustify: "auto" }}
|
||||
dangerouslySetInnerHTML={{ __html: e?.komentar }}
|
||||
/>
|
||||
</Spoiler>
|
||||
</Box>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Center c={AdminColor.white} w={150}>
|
||||
<Text>
|
||||
{new Intl.DateTimeFormat(["id-ID"], { dateStyle: "medium" }).format(
|
||||
e.createdAt
|
||||
@@ -136,7 +137,7 @@ function TableKomentar({
|
||||
<td>
|
||||
<Center w={100}>
|
||||
<Text
|
||||
c={e?.Forum_ReportKomentar?.length >= 3 ? "red" : "black"}
|
||||
c={e?.Forum_ReportKomentar?.length >= 3 ? "red" : AdminColor.white}
|
||||
fw={"bold"}
|
||||
fz={"lg"}
|
||||
>
|
||||
@@ -173,7 +174,7 @@ function TableKomentar({
|
||||
<Stack spacing={"xs"} h={"100%"}>
|
||||
<Group
|
||||
position="apart"
|
||||
bg={"gray"}
|
||||
bg={AdminColor.softBlue}
|
||||
p={"xs"}
|
||||
style={{ borderRadius: "6px" }}
|
||||
>
|
||||
@@ -198,7 +199,7 @@ function TableKomentar({
|
||||
{_.isEmpty(data) ? (
|
||||
<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>
|
||||
<Table
|
||||
verticalSpacing={"md"}
|
||||
@@ -206,25 +207,24 @@ function TableKomentar({
|
||||
p={"md"}
|
||||
w={"100%"}
|
||||
h={"100%"}
|
||||
striped
|
||||
highlightOnHover
|
||||
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center w={200}>Username</Center>
|
||||
<Center c={AdminColor.white} w={150}>Username</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center w={500}>Komentar</Center>
|
||||
<Center c={AdminColor.white} w={300}>Komentar</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center w={200}>Tgl Komentar</Center>
|
||||
<Center c={AdminColor.white} w={150}>Tgl Komentar</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center w={100}>Total Report</Center>
|
||||
<Center c={AdminColor.white} w={100}>Total Report</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center w={200}>Aksi</Center>
|
||||
<Center c={AdminColor.white} w={200}>Aksi</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</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_getListReportKomentarbyId } from "../fun/get/get_list_report_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({
|
||||
komentarId,
|
||||
@@ -199,12 +200,12 @@ function HasilReportPosting({
|
||||
const TableRows = data?.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Center w={150}>
|
||||
<Text>{e?.User?.Profile?.name}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Center w={150}>
|
||||
<Text>
|
||||
{e?.ForumMaster_KategoriReport?.title
|
||||
? e?.ForumMaster_KategoriReport?.title
|
||||
@@ -214,7 +215,7 @@ function HasilReportPosting({
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<Center w={500}>
|
||||
<Center w={300}>
|
||||
<Spoiler maxHeight={50} hideLabel="sembunyikan" showLabel="tampilkan">
|
||||
{e?.ForumMaster_KategoriReport?.deskripsi ? (
|
||||
<Text>{e?.ForumMaster_KategoriReport?.deskripsi}</Text>
|
||||
@@ -226,7 +227,7 @@ function HasilReportPosting({
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<Center w={500}>
|
||||
<Center w={300}>
|
||||
<Spoiler maxHeight={50} hideLabel="sembunyikan" showLabel="tampilkan">
|
||||
{e?.deskripsi ? <Text>{e?.deskripsi}</Text> : <Text>-</Text>}
|
||||
</Spoiler>
|
||||
@@ -241,7 +242,7 @@ function HasilReportPosting({
|
||||
<Stack spacing={"xs"} h={"100%"}>
|
||||
<Group
|
||||
position="apart"
|
||||
bg={"red.4"}
|
||||
bg={AdminColor.softBlue}
|
||||
p={"xs"}
|
||||
style={{ borderRadius: "6px" }}
|
||||
>
|
||||
@@ -261,7 +262,7 @@ function HasilReportPosting({
|
||||
{_.isEmpty(data) ? (
|
||||
<ComponentAdminGlobal_IsEmptyData />
|
||||
) : (
|
||||
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||
<Paper p={"md"} bg={AdminColor.softBlue} h={"80vh"}>
|
||||
<ScrollArea w={"100%"} h={"90%"} offsetScrollbars>
|
||||
<Table
|
||||
verticalSpacing={"md"}
|
||||
@@ -269,8 +270,7 @@ function HasilReportPosting({
|
||||
p={"md"}
|
||||
w={"100%"}
|
||||
h={"100%"}
|
||||
striped
|
||||
highlightOnHover
|
||||
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -178,12 +178,12 @@ function HasilReportPosting({
|
||||
const TableRows = data?.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<Center c={AdminColor.white} w={200}>
|
||||
<Center c={AdminColor.white} w={150}>
|
||||
<Text>{e?.User?.username}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center c={AdminColor.white} w={200}>
|
||||
<Center c={AdminColor.white} w={150}>
|
||||
<Text>
|
||||
{e?.ForumMaster_KategoriReport?.title
|
||||
? e?.ForumMaster_KategoriReport?.title
|
||||
@@ -193,10 +193,10 @@ function HasilReportPosting({
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<Center c={AdminColor.white} w={500}>
|
||||
<Center c={AdminColor.white} w={300}>
|
||||
<Spoiler maxHeight={50} hideLabel="sembunyikan" showLabel="tampilkan">
|
||||
{e?.ForumMaster_KategoriReport?.deskripsi ? (
|
||||
<Text>{e?.ForumMaster_KategoriReport?.deskripsi}</Text>
|
||||
<Text style={{textJustify: "auto", textAlign: "justify"}}>{e?.ForumMaster_KategoriReport?.deskripsi}</Text>
|
||||
) : (
|
||||
<Text>-</Text>
|
||||
)}
|
||||
@@ -205,9 +205,9 @@ function HasilReportPosting({
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<Center c={AdminColor.white} w={500}>
|
||||
<Center c={AdminColor.white} w={300}>
|
||||
<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>
|
||||
</Center>
|
||||
</td>
|
||||
@@ -252,16 +252,16 @@ function HasilReportPosting({
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center c={AdminColor.white}>Username</Center>
|
||||
<Center w={150} c={AdminColor.white}>Username</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center c={AdminColor.white}>Kategori</Center>
|
||||
<Center w={150} c={AdminColor.white}>Kategori</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center c={AdminColor.white}>Deskripsi</Center>
|
||||
<Center w={300} c={AdminColor.white}>Deskripsi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center c={AdminColor.white}>Deskripsi Lainnya</Center>
|
||||
<Center w={300} c={AdminColor.white}>Deskripsi Lainnya</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -107,7 +107,7 @@ function TablePublish() {
|
||||
return data?.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Center w={100}>
|
||||
<Text c={AdminColor.white} lineClamp={1}>{e?.Author?.username}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
@@ -122,23 +122,6 @@ function TablePublish() {
|
||||
</Badge>
|
||||
</Center>
|
||||
</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>
|
||||
<Center w={150}>
|
||||
<Text c={AdminColor.white}>
|
||||
@@ -243,9 +226,6 @@ function TablePublish() {
|
||||
<th>
|
||||
<Center c={AdminColor.white}>Status</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Text c={AdminColor.white}>Postingan</Text>
|
||||
</th>
|
||||
<th>
|
||||
<Center c={AdminColor.white}>Tanggal Publish</Center>
|
||||
</th>
|
||||
|
||||
@@ -110,12 +110,12 @@ function TableView() {
|
||||
return data?.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Center w={150}>
|
||||
<Text c={AdminColor.white} lineClamp={1}>{e?.User?.Profile?.name}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Center w={150}>
|
||||
{e?.forumMaster_KategoriReportId === null ? (
|
||||
<Text c={AdminColor.white}>Lainnya</Text>
|
||||
) : (
|
||||
@@ -126,8 +126,9 @@ function TableView() {
|
||||
|
||||
|
||||
<td>
|
||||
<Box w={400}>
|
||||
<Box w={250}>
|
||||
<Spoiler
|
||||
style={{ textAlign: "justify", textJustify: "auto"}}
|
||||
c={AdminColor.white}
|
||||
// w={400}
|
||||
maxHeight={60}
|
||||
@@ -238,7 +239,7 @@ function TableView() {
|
||||
|
||||
|
||||
<th>
|
||||
<Text c={AdminColor.white}>Komentar</Text>
|
||||
<Center c={AdminColor.white}>Komentar</Center>
|
||||
</th>
|
||||
|
||||
|
||||
|
||||
@@ -99,12 +99,12 @@ function TableView() {
|
||||
return data?.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<Center c={AdminColor.white} w={200}>
|
||||
<Center c={AdminColor.white} w={150}>
|
||||
<Text lineClamp={1}>{e?.User.username}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center c={AdminColor.white} w={200}>
|
||||
<Center c={AdminColor.white} w={150}>
|
||||
{e?.forumMaster_KategoriReportId === null ? (
|
||||
<Text>Lainnya</Text>
|
||||
) : (
|
||||
@@ -137,7 +137,7 @@ function TableView() {
|
||||
</td> */}
|
||||
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Center w={250}>
|
||||
<Badge
|
||||
color={
|
||||
(e?.Forum_Posting?.ForumMaster_StatusPosting?.id as any) === 1
|
||||
@@ -244,7 +244,7 @@ function TableView() {
|
||||
<Text>Postingan</Text>
|
||||
</th> */}
|
||||
<th>
|
||||
<Center c={AdminColor.white} w={200}>Status Posting</Center>
|
||||
<Center c={AdminColor.white} w={250}>Status Posting</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center c={AdminColor.white}>Tanggal Report</Center>
|
||||
|
||||
@@ -28,22 +28,22 @@ export function AdminInvestasi_ComponentButtonBandingTransaksi({
|
||||
lembarTerbeli,
|
||||
});
|
||||
|
||||
if (res.status == 200) {
|
||||
try {
|
||||
const dataTransaksi = await adminInvestasi_funGetAllTransaksiById({
|
||||
investasiId,
|
||||
page: 1,
|
||||
});
|
||||
onLoadData(dataTransaksi);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
||||
setLoading(true);
|
||||
}
|
||||
} else {
|
||||
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
// if (res.status == 200) {
|
||||
// try {
|
||||
// const dataTransaksi = await adminInvestasi_funGetAllTransaksiById({
|
||||
// investasiId,
|
||||
// page: 1,
|
||||
// });
|
||||
// onLoadData(dataTransaksi);
|
||||
// } catch (error) {
|
||||
// console.log(error);
|
||||
// } finally {
|
||||
// ComponentAdminGlobal_NotifikasiBerhasil(res.message);
|
||||
// setLoading(true);
|
||||
// }
|
||||
// } else {
|
||||
// ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||
// }
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -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}`,
|
||||
},
|
||||
});
|
||||
console.log("Ini response",response.json())
|
||||
|
||||
return await response.json().catch(() => null);
|
||||
}
|
||||
@@ -115,7 +114,6 @@ const apiGetAdminAllTransaksiById = async ({
|
||||
|
||||
// Fetch data
|
||||
const isStatus = status ? `&status=${status}` : "";
|
||||
console.log("Ini status", isStatus);
|
||||
const isPage = page ? `?page=${page}` : "";
|
||||
const response = await fetch(
|
||||
`/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 { apiGetMasterStatusTransaksi } from "@/app_modules/_global/lib/api_fetch_master";
|
||||
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 { useParams, useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import {
|
||||
AdminInvestasi_ComponentButtonBandingTransaksi,
|
||||
AdminInvestasi_ComponentButtonKonfirmasiTransaksi,
|
||||
AdminInvestasi_ComponentCekBuktiTransfer,
|
||||
} from "../../_component";
|
||||
import { apiGetAdminAllTransaksiById } from "../../_lib/api_fetch_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() {
|
||||
const params = useParams<{ id: string }>();
|
||||
|
||||
@@ -166,7 +166,7 @@ export function AdminInvestasi_ViewDaftarTransaksi() {
|
||||
</td>
|
||||
<td>
|
||||
<Center>
|
||||
{/* {e.statusInvoiceId === "1" && "-"}
|
||||
{e.statusInvoiceId === "1" && "-"}
|
||||
{e.statusInvoiceId === "2" && (
|
||||
<AdminInvestasi_ComponentButtonKonfirmasiTransaksi
|
||||
invoiceId={e.id}
|
||||
@@ -181,6 +181,7 @@ export function AdminInvestasi_ViewDaftarTransaksi() {
|
||||
{e.statusInvoiceId === "3" && "-"}
|
||||
{e.statusInvoiceId === "4" && (
|
||||
<AdminInvestasi_ComponentButtonBandingTransaksi
|
||||
|
||||
invoiceId={e.id}
|
||||
investasiId={investasiId}
|
||||
lembarTerbeli={e.lembarTerbeli}
|
||||
@@ -189,6 +190,9 @@ export function AdminInvestasi_ViewDaftarTransaksi() {
|
||||
setNPage(val.nPage);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Center>
|
||||
</td>
|
||||
)} */}
|
||||
<Button
|
||||
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 CustomSkeleton from '@/app_modules/components/CustomSkeleton';
|
||||
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 { Badge, Box, Grid, Group, Paper, Stack, Text, Title } from '@mantine/core';
|
||||
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() {
|
||||
const params = useParams<{ id: string }>();
|
||||
const investasiId = params.id;
|
||||
const [data, setData] = useState<MODEL_INVOICE_INVESTASI | null>(null);
|
||||
|
||||
useShallowEffect(() => {
|
||||
@@ -21,12 +28,11 @@ function DetailTransaksi() {
|
||||
|
||||
const loadInitialData = async () => {
|
||||
try {
|
||||
|
||||
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)
|
||||
} else {
|
||||
console.error("Invalid data format recieved:", response)
|
||||
@@ -42,27 +48,6 @@ function DetailTransaksi() {
|
||||
<Stack px={"lg"}>
|
||||
<Group position="apart">
|
||||
<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>
|
||||
|
||||
<>
|
||||
@@ -124,7 +109,17 @@ function DetailTransaksi() {
|
||||
<Text fw={"bold"}>Status:</Text>
|
||||
</Grid.Col>
|
||||
<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>
|
||||
<Grid>
|
||||
@@ -132,7 +127,36 @@ function DetailTransaksi() {
|
||||
<Text fw={"bold"}>Bukti Transfer:</Text>
|
||||
</Grid.Col>
|
||||
<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>
|
||||
</Stack>
|
||||
|
||||
@@ -14,6 +14,10 @@ export async function adminInvestasi_funAcceptTransaksiById({
|
||||
investasiId: 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({
|
||||
where: {
|
||||
id: investasiId,
|
||||
@@ -24,7 +28,6 @@ export async function adminInvestasi_funAcceptTransaksiById({
|
||||
lembarTerbeli: true,
|
||||
},
|
||||
});
|
||||
|
||||
// Hitung TOTAL SISA LEMBAR
|
||||
const investasi_sisaLembar = toNumber(dataInvestasi?.sisaLembar);
|
||||
const invoice_lembarTerbeli = toNumber(lembarTerbeli);
|
||||
@@ -48,6 +51,7 @@ export async function adminInvestasi_funAcceptTransaksiById({
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
if (!updt) {
|
||||
return { status: 400, message: "Gagal Update Status" };
|
||||
} else {
|
||||
@@ -83,3 +87,6 @@ export async function adminInvestasi_funAcceptTransaksiById({
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user