fix: File view
Deksripsi: - Tampilan file view pdf - Optimalisasi admin ## No Isuue
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { ComponentAdminGlobal_TitlePage } from "./_component/title_page";
|
||||
import { ComponentAdminGlobal_TampilanRupiah } from "./comp_admin_teampilan_rupiah";
|
||||
import { ComponentAdminGlobal_TitlePage } from "./title_page";
|
||||
import { ComponentAdminGlobal_TampilanRupiah } from "./comp_admin_tampilan_rupiah";
|
||||
|
||||
export { ComponentAdminGlobal_TampilanRupiah };
|
||||
export { ComponentAdminGlobal_TitlePage };
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ComponentAdminGlobal_TitlePage } from "@/app_modules/admin/_admin_global";
|
||||
import { ComponentAdminGlobal_TitlePage } from "@/app_modules/admin/_admin_global/_component";
|
||||
import { Button } from "@mantine/core";
|
||||
import { IconCirclePlus } from "@tabler/icons-react";
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterAdminAppInformation } from "@/app/lib/router_admin/router_app_information";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function adminAppInformation_funCreateBidangBisnis({
|
||||
name,
|
||||
}: {
|
||||
name: string;
|
||||
}) {
|
||||
const count = await prisma.masterBidangBisnis.count({});
|
||||
const idBidangBisnis = count + 1;
|
||||
|
||||
const createData = await prisma.masterBidangBisnis.create({
|
||||
data: {
|
||||
id: idBidangBisnis.toString(),
|
||||
name: name,
|
||||
},
|
||||
});
|
||||
|
||||
if (!createData) return { status: 400, message: "Gagal menambahkan" };
|
||||
revalidatePath(RouterAdminAppInformation.main);
|
||||
return { status: 201, message: "Berhasil menambahkan" };
|
||||
}
|
||||
7
src/app_modules/admin/app_info/fun/index.ts
Normal file
7
src/app_modules/admin/app_info/fun/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { adminAppInformation_funCreateBidangBisnis } from "./create/fun_create_bidang_bisnis";
|
||||
import { adminAppInformation_funGetBidangBisnis } from "./master/fun_get_master_bidang_bisnis";
|
||||
import { adminAppInformation_funUpdateBidangBisnis } from "./update/fun_update_bidang_bisnis";
|
||||
|
||||
export { adminAppInformation_funGetBidangBisnis };
|
||||
export { adminAppInformation_funCreateBidangBisnis };
|
||||
export { adminAppInformation_funUpdateBidangBisnis };
|
||||
@@ -0,0 +1,13 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export async function adminAppInformation_funGetBidangBisnis() {
|
||||
const data = await prisma.masterBidangBisnis.findMany({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
});
|
||||
|
||||
return data;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterAdminAppInformation } from "@/app/lib/router_admin/router_app_information";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function adminAppInformation_funUpdateBidangBisnis({
|
||||
data,
|
||||
}: {
|
||||
data: { id: string; active?: boolean; name?: string };
|
||||
}) {
|
||||
if (data.name) {
|
||||
const updateData = await prisma.masterBidangBisnis.update({
|
||||
where: {
|
||||
id: data.id,
|
||||
},
|
||||
data: {
|
||||
name: data.name,
|
||||
},
|
||||
});
|
||||
|
||||
if (!updateData) return { status: 400, message: "Gagal update data" };
|
||||
revalidatePath(RouterAdminAppInformation.main);
|
||||
return { status: 200, message: "Berhasil update data" };
|
||||
}
|
||||
|
||||
if (data.active !== null) {
|
||||
const updateAktivasi = await prisma.masterBidangBisnis.update({
|
||||
where: {
|
||||
id: data.id,
|
||||
},
|
||||
data: {
|
||||
active: data.active,
|
||||
},
|
||||
});
|
||||
|
||||
if (!updateAktivasi)
|
||||
return { status: 400, message: "Gagal update aktivasi" };
|
||||
revalidatePath(RouterAdminAppInformation.main);
|
||||
return { status: 200, message: "Berhasil update aktivasi" };
|
||||
}
|
||||
}
|
||||
9
src/app_modules/admin/app_info/lib/global_state.ts
Normal file
9
src/app_modules/admin/app_info/lib/global_state.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { atomWithStorage } from "jotai/utils";
|
||||
|
||||
/**
|
||||
* @param index | 0 - 3 | 1: Whatsapp, 2: Bank, 3: Bidang Bisnis
|
||||
*/
|
||||
export const gs_app_information_menu = atomWithStorage(
|
||||
"gs_app_information_menu",
|
||||
"1"
|
||||
);
|
||||
3
src/app_modules/admin/app_info/lib/index.ts
Normal file
3
src/app_modules/admin/app_info/lib/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { gs_app_information_menu } from "./global_state";
|
||||
|
||||
export { gs_app_information_menu };
|
||||
@@ -1,26 +1,76 @@
|
||||
"use client";
|
||||
|
||||
import { Space, Stack } from "@mantine/core";
|
||||
import { Button, Group, Stack } from "@mantine/core";
|
||||
import { useAtom } from "jotai";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||
import { gs_app_information_menu } from "../lib";
|
||||
import {
|
||||
AdminAppInformation_ViewInfoBank,
|
||||
AdminAppInformation_ViewInformasiWhatApps,
|
||||
AdminAppInformation_ViewKategoriPortofolio,
|
||||
} from "../view";
|
||||
|
||||
export default function AdminAppInformation_UiMain({
|
||||
nomorAdmin,
|
||||
listBank,
|
||||
dataBidangBisnis,
|
||||
}: {
|
||||
nomorAdmin: any;
|
||||
listBank: any[];
|
||||
dataBidangBisnis: any[];
|
||||
}) {
|
||||
const [selectPage, setSelectPage] = useAtom(gs_app_information_menu);
|
||||
const listPage = [
|
||||
{
|
||||
id: "1",
|
||||
name: "Whatsapp",
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
name: "Informasi Bank",
|
||||
},
|
||||
{
|
||||
id: "3",
|
||||
name: "Bidang Bisnis",
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack h={"100%"}>
|
||||
<ComponentAdminGlobal_HeaderTamplate name="App Information" />
|
||||
<AdminAppInformation_ViewInformasiWhatApps nomorAdmin={nomorAdmin} />
|
||||
<Space h={50} />
|
||||
<AdminAppInformation_ViewInfoBank listBank={listBank} />
|
||||
|
||||
<Group>
|
||||
{listPage.map((e, i) => (
|
||||
<Button
|
||||
key={i}
|
||||
radius={"xl"}
|
||||
c={"white"}
|
||||
bg={selectPage === e.id ? "blue" : "gray.3"}
|
||||
onClick={() => {
|
||||
setSelectPage(e.id);
|
||||
}}
|
||||
style={{
|
||||
transition: "all 0.5s",
|
||||
}}
|
||||
>
|
||||
{e.name}
|
||||
</Button>
|
||||
))}
|
||||
</Group>
|
||||
|
||||
{selectPage === "1" && (
|
||||
<AdminAppInformation_ViewInformasiWhatApps nomorAdmin={nomorAdmin} />
|
||||
)}
|
||||
|
||||
{selectPage === "2" && (
|
||||
<AdminAppInformation_ViewInfoBank listBank={listBank} />
|
||||
)}
|
||||
{selectPage === "3" && (
|
||||
<AdminAppInformation_ViewKategoriPortofolio
|
||||
dataBidangBisnis={dataBidangBisnis}
|
||||
/>
|
||||
)}
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import AdminAppInformation_ViewInfoBank from "./view_info_bank";
|
||||
import AdminAppInformation_ViewInformasiWhatApps from "./view_info_whatsapp";
|
||||
import { AdminAppInformation_ViewKategoriPortofolio } from "./view_kategori_portofolio";
|
||||
|
||||
export { AdminAppInformation_ViewInformasiWhatApps };
|
||||
export { AdminAppInformation_ViewInfoBank };
|
||||
export { AdminAppInformation_ViewKategoriPortofolio };
|
||||
|
||||
@@ -27,7 +27,7 @@ import adminAppInformation_createBank from "../fun/create/fun_create_new_bank";
|
||||
import adminAppInformation_getMasterBank from "../fun/master/get_list_bank";
|
||||
import adminAppInformation_updateStatusBankById from "../fun/update/fun_udpate_status_bank";
|
||||
import adminAppInformation_updateDataBankById from "../fun/update/fun_update_data_bank";
|
||||
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global";
|
||||
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global/_component";
|
||||
import { AdminAppInformation_ComponentTitlePageBank } from "../component";
|
||||
|
||||
export default function AdminAppInformation_ViewInfoBank({
|
||||
@@ -187,249 +187,235 @@ export default function AdminAppInformation_ViewInfoBank({
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"xs"}>
|
||||
<AdminAppInformation_ComponentTitlePageBank
|
||||
onEventListener={(val: { isCreate: any; isUpdate: any }) => {
|
||||
setIsCreate(val.isCreate);
|
||||
setIsUpdate(val.isUpdate);
|
||||
}}
|
||||
/>
|
||||
{/* <ComponentAdminGlobal_TitlePage
|
||||
name="Informasi Bank"
|
||||
component={
|
||||
<Button
|
||||
w={120}
|
||||
leftIcon={<IconCirclePlus />}
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
setIsCreate(true);
|
||||
setIsUpdate(false);
|
||||
}}
|
||||
>
|
||||
Tambah
|
||||
</Button>
|
||||
}
|
||||
/> */}
|
||||
</Stack>
|
||||
|
||||
<Grid>
|
||||
<Grid.Col span={9}>
|
||||
<Paper p={"md"} withBorder shadow="lg" h={"50vh"}>
|
||||
<ScrollArea w={"100%"} h={"90%"} offsetScrollbars>
|
||||
<Table
|
||||
verticalSpacing={"xs"}
|
||||
horizontalSpacing={"md"}
|
||||
p={"md"}
|
||||
w={1000}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center w={150}>Bank</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Status</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Nama Rekening</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Nomor Rekening</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{rowTable}</tbody>
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
</Paper>
|
||||
</Grid.Col>
|
||||
|
||||
<Grid.Col span={3}>
|
||||
{isCreate ? (
|
||||
<Paper p={"md"} withBorder shadow="lg">
|
||||
<Stack>
|
||||
<Center>
|
||||
<Title order={5}>Tambah Daftar Bank</Title>
|
||||
</Center>
|
||||
|
||||
<TextInput
|
||||
label={"Nama Bank"}
|
||||
placeholder="Masukan nama bank"
|
||||
onChange={(val) => {
|
||||
setNewData({
|
||||
...newData,
|
||||
namaBank: val.currentTarget.value,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
||||
<TextInput
|
||||
label={"Nama Rekening"}
|
||||
placeholder="Masukan nama rekening"
|
||||
onChange={(val) => {
|
||||
setNewData({
|
||||
...newData,
|
||||
namaAkun: val.currentTarget.value,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
||||
<TextInput
|
||||
label={"Nomor Rekening Bank"}
|
||||
placeholder=" Masukan nomor rekening bank"
|
||||
type="number"
|
||||
onChange={(val) => {
|
||||
setNewData({
|
||||
...newData,
|
||||
norek: val.currentTarget.value,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<Group position="right" align="flex-end">
|
||||
<Button
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
setIsCreate(false);
|
||||
}}
|
||||
>
|
||||
Batal
|
||||
</Button>
|
||||
<Button
|
||||
loading={isLoadingCreate}
|
||||
loaderPosition="center"
|
||||
style={{ transition: "0.5s" }}
|
||||
disabled={_.values(newData).includes("") ? true : false}
|
||||
radius={"xl"}
|
||||
color="green"
|
||||
onClick={() => {
|
||||
onCreate();
|
||||
}}
|
||||
>
|
||||
Simpan
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Paper>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
|
||||
{isUpdate ? (
|
||||
<Paper p={"md"} withBorder shadow="lg">
|
||||
<Stack>
|
||||
<Center>
|
||||
<Title order={5}>Update Data Bank</Title>
|
||||
</Center>
|
||||
<TextInput
|
||||
label={"Nama Bank"}
|
||||
placeholder="Masukan nama bank"
|
||||
value={updateData.namaBank}
|
||||
onChange={(val) => {
|
||||
const value = val.currentTarget.value;
|
||||
setUpdateData({ ...updateData, namaBank: value });
|
||||
}}
|
||||
/>
|
||||
|
||||
<TextInput
|
||||
label={"Nama Rekening"}
|
||||
placeholder="Masukan nama rekening"
|
||||
value={updateData.namaAkun}
|
||||
onChange={(val) => {
|
||||
const value = val.currentTarget.value;
|
||||
setUpdateData({ ...updateData, namaAkun: value });
|
||||
}}
|
||||
/>
|
||||
|
||||
<TextInput
|
||||
label={"Nomor Rekening Bank"}
|
||||
placeholder=" Masukan nomor rekening bank"
|
||||
type="number"
|
||||
value={updateData.norek}
|
||||
onChange={(val) => {
|
||||
const value = val.currentTarget.value;
|
||||
setUpdateData({ ...updateData, norek: value });
|
||||
}}
|
||||
/>
|
||||
<Group position="right">
|
||||
<Button
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
setIsUpdate(false);
|
||||
}}
|
||||
>
|
||||
Batal
|
||||
</Button>
|
||||
<Button
|
||||
style={{ transition: "0.5s" }}
|
||||
disabled={
|
||||
updateData?.namaBank === "" ||
|
||||
updateData?.namaAkun === "" ||
|
||||
updateData?.norek === ""
|
||||
? true
|
||||
: false
|
||||
}
|
||||
radius={"xl"}
|
||||
color="green"
|
||||
onClick={() => {
|
||||
onUpdate();
|
||||
}}
|
||||
>
|
||||
Update
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Paper>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
{/* Activasi bank */}
|
||||
<Modal
|
||||
centered
|
||||
withCloseButton={false}
|
||||
opened={isActivation}
|
||||
onClose={() => setIsActivation(false)}
|
||||
>
|
||||
<Stack align="center">
|
||||
<Title order={5}>
|
||||
Anda ingin{" "}
|
||||
{updateStatus.active ? (
|
||||
<Text span inherit>
|
||||
mengaktifkan
|
||||
</Text>
|
||||
) : (
|
||||
<Text span inherit>
|
||||
menonaktifkan
|
||||
</Text>
|
||||
)}{" "}
|
||||
Bank ini ?
|
||||
</Title>
|
||||
<Group>
|
||||
<Button radius={"xl"} onClick={() => setIsActivation(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
<Button
|
||||
color="green"
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
onUpdateActivation({
|
||||
id: updateStatus.id,
|
||||
value: updateStatus.active as any,
|
||||
});
|
||||
}}
|
||||
>
|
||||
Iya
|
||||
</Button>
|
||||
</Group>
|
||||
<Stack>
|
||||
<Stack spacing={"xs"}>
|
||||
<AdminAppInformation_ComponentTitlePageBank
|
||||
onEventListener={(val: { isCreate: any; isUpdate: any }) => {
|
||||
setIsCreate(val.isCreate);
|
||||
setIsUpdate(val.isUpdate);
|
||||
}}
|
||||
/>
|
||||
</Stack>
|
||||
</Modal>
|
||||
|
||||
<Grid>
|
||||
<Grid.Col span={9}>
|
||||
<Paper p={"md"} withBorder shadow="lg" h={"65vh"}>
|
||||
<ScrollArea w={"100%"} h={"90%"} offsetScrollbars>
|
||||
<Table
|
||||
verticalSpacing={"xs"}
|
||||
horizontalSpacing={"md"}
|
||||
p={"md"}
|
||||
w={1000}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center w={150}>Bank</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Status</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Nama Rekening</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Nomor Rekening</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{rowTable}</tbody>
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
</Paper>
|
||||
</Grid.Col>
|
||||
|
||||
<Grid.Col span={3}>
|
||||
{isCreate ? (
|
||||
<Paper p={"md"} withBorder shadow="lg">
|
||||
<Stack>
|
||||
<Center>
|
||||
<Title order={5}>Tambah Daftar Bank</Title>
|
||||
</Center>
|
||||
|
||||
<TextInput
|
||||
label={"Nama Bank"}
|
||||
placeholder="Masukan nama bank"
|
||||
onChange={(val) => {
|
||||
setNewData({
|
||||
...newData,
|
||||
namaBank: val.currentTarget.value,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
||||
<TextInput
|
||||
label={"Nama Rekening"}
|
||||
placeholder="Masukan nama rekening"
|
||||
onChange={(val) => {
|
||||
setNewData({
|
||||
...newData,
|
||||
namaAkun: val.currentTarget.value,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
||||
<TextInput
|
||||
label={"Nomor Rekening Bank"}
|
||||
placeholder=" Masukan nomor rekening bank"
|
||||
type="number"
|
||||
onChange={(val) => {
|
||||
setNewData({
|
||||
...newData,
|
||||
norek: val.currentTarget.value,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<Group position="right" align="flex-end">
|
||||
<Button
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
setIsCreate(false);
|
||||
}}
|
||||
>
|
||||
Batal
|
||||
</Button>
|
||||
<Button
|
||||
loading={isLoadingCreate}
|
||||
loaderPosition="center"
|
||||
style={{ transition: "0.5s" }}
|
||||
disabled={_.values(newData).includes("") ? true : false}
|
||||
radius={"xl"}
|
||||
color="green"
|
||||
onClick={() => {
|
||||
onCreate();
|
||||
}}
|
||||
>
|
||||
Simpan
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Paper>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
|
||||
{isUpdate ? (
|
||||
<Paper p={"md"} withBorder shadow="lg">
|
||||
<Stack>
|
||||
<Center>
|
||||
<Title order={5}>Update Data Bank</Title>
|
||||
</Center>
|
||||
<TextInput
|
||||
label={"Nama Bank"}
|
||||
placeholder="Masukan nama bank"
|
||||
value={updateData.namaBank}
|
||||
onChange={(val) => {
|
||||
const value = val.currentTarget.value;
|
||||
setUpdateData({ ...updateData, namaBank: value });
|
||||
}}
|
||||
/>
|
||||
|
||||
<TextInput
|
||||
label={"Nama Rekening"}
|
||||
placeholder="Masukan nama rekening"
|
||||
value={updateData.namaAkun}
|
||||
onChange={(val) => {
|
||||
const value = val.currentTarget.value;
|
||||
setUpdateData({ ...updateData, namaAkun: value });
|
||||
}}
|
||||
/>
|
||||
|
||||
<TextInput
|
||||
label={"Nomor Rekening Bank"}
|
||||
placeholder=" Masukan nomor rekening bank"
|
||||
type="number"
|
||||
value={updateData.norek}
|
||||
onChange={(val) => {
|
||||
const value = val.currentTarget.value;
|
||||
setUpdateData({ ...updateData, norek: value });
|
||||
}}
|
||||
/>
|
||||
<Group position="right">
|
||||
<Button
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
setIsUpdate(false);
|
||||
}}
|
||||
>
|
||||
Batal
|
||||
</Button>
|
||||
<Button
|
||||
style={{ transition: "0.5s" }}
|
||||
disabled={
|
||||
updateData?.namaBank === "" ||
|
||||
updateData?.namaAkun === "" ||
|
||||
updateData?.norek === ""
|
||||
? true
|
||||
: false
|
||||
}
|
||||
radius={"xl"}
|
||||
color="green"
|
||||
onClick={() => {
|
||||
onUpdate();
|
||||
}}
|
||||
>
|
||||
Update
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Paper>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
{/* Activasi bank */}
|
||||
<Modal
|
||||
centered
|
||||
withCloseButton={false}
|
||||
opened={isActivation}
|
||||
onClose={() => setIsActivation(false)}
|
||||
>
|
||||
<Stack align="center">
|
||||
<Title order={5}>
|
||||
Anda ingin{" "}
|
||||
{updateStatus.active ? (
|
||||
<Text span inherit>
|
||||
mengaktifkan
|
||||
</Text>
|
||||
) : (
|
||||
<Text span inherit>
|
||||
menonaktifkan
|
||||
</Text>
|
||||
)}{" "}
|
||||
Bank ini ?
|
||||
</Title>
|
||||
<Group>
|
||||
<Button radius={"xl"} onClick={() => setIsActivation(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
<Button
|
||||
color="green"
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
onUpdateActivation({
|
||||
id: updateStatus.id,
|
||||
value: updateStatus.active as any,
|
||||
});
|
||||
}}
|
||||
>
|
||||
Iya
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Modal>
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
358
src/app_modules/admin/app_info/view/view_kategori_portofolio.tsx
Normal file
358
src/app_modules/admin/app_info/view/view_kategori_portofolio.tsx
Normal file
@@ -0,0 +1,358 @@
|
||||
import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/interface";
|
||||
import {
|
||||
ActionIcon,
|
||||
Button,
|
||||
Center,
|
||||
Grid,
|
||||
Group,
|
||||
Modal,
|
||||
Paper,
|
||||
ScrollArea,
|
||||
Stack,
|
||||
Switch,
|
||||
Table,
|
||||
Text,
|
||||
TextInput,
|
||||
Title,
|
||||
Tooltip,
|
||||
} from "@mantine/core";
|
||||
import { IconCirclePlus, IconEdit } from "@tabler/icons-react";
|
||||
import { useState } from "react";
|
||||
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global/_component";
|
||||
import { ComponentAdminGlobal_NotifikasiBerhasil } from "../../_admin_global/admin_notifikasi/notifikasi_berhasil";
|
||||
import { ComponentAdminGlobal_NotifikasiGagal } from "../../_admin_global/admin_notifikasi/notifikasi_gagal";
|
||||
import {
|
||||
adminAppInformation_funCreateBidangBisnis,
|
||||
adminAppInformation_funGetBidangBisnis,
|
||||
adminAppInformation_funUpdateBidangBisnis,
|
||||
} from "../fun";
|
||||
|
||||
export function AdminAppInformation_ViewKategoriPortofolio({
|
||||
dataBidangBisnis,
|
||||
}: {
|
||||
dataBidangBisnis: MODEL_DEFAULT_MASTER_OLD[];
|
||||
}) {
|
||||
const [data, setData] = useState(dataBidangBisnis);
|
||||
|
||||
// Create
|
||||
const [isLoadingCreate, setLoadingCreate] = useState(false);
|
||||
const [isCreate, setIsCreate] = useState(false);
|
||||
const [newData, setNewData] = useState("");
|
||||
async function onCreate() {
|
||||
const create = await adminAppInformation_funCreateBidangBisnis({
|
||||
name: newData,
|
||||
});
|
||||
|
||||
if (create.status === 201) {
|
||||
try {
|
||||
setLoadingCreate(true);
|
||||
const loadData = await adminAppInformation_funGetBidangBisnis();
|
||||
setData(loadData);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
setNewData("");
|
||||
setLoadingCreate(false);
|
||||
ComponentAdminGlobal_NotifikasiBerhasil(create.message);
|
||||
}
|
||||
} else {
|
||||
ComponentAdminGlobal_NotifikasiGagal(create.message);
|
||||
}
|
||||
}
|
||||
|
||||
// Update Data
|
||||
const [isLoadingUpdate, setLoadingUpdate] = useState(false);
|
||||
const [isUpdate, setIsUpdate] = useState(false);
|
||||
const [updateData, setUpdateData] = useState({
|
||||
id: "",
|
||||
name: "",
|
||||
});
|
||||
|
||||
async function onUpdate() {
|
||||
const updt = await adminAppInformation_funUpdateBidangBisnis({
|
||||
data: updateData as any,
|
||||
});
|
||||
if (updt?.status === 200) {
|
||||
try {
|
||||
setLoadingUpdate(true);
|
||||
const loadData = await adminAppInformation_funGetBidangBisnis();
|
||||
setData(loadData);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
setLoadingUpdate(false);
|
||||
ComponentAdminGlobal_NotifikasiBerhasil(updt.message);
|
||||
}
|
||||
} else {
|
||||
ComponentAdminGlobal_NotifikasiGagal(updt?.message as any);
|
||||
}
|
||||
}
|
||||
|
||||
// Activation
|
||||
const [openModal, setOpenModal] = useState(false);
|
||||
const [updateStatus, setUpdateStatus] = useState({
|
||||
id: "",
|
||||
active: null,
|
||||
});
|
||||
|
||||
async function onUpdateActivation({
|
||||
id,
|
||||
active,
|
||||
}: {
|
||||
id: string;
|
||||
active: boolean;
|
||||
}) {
|
||||
const updt = await adminAppInformation_funUpdateBidangBisnis({
|
||||
data: { id: id, active: active },
|
||||
});
|
||||
|
||||
if (updt?.status === 200) {
|
||||
try {
|
||||
setLoadingUpdate(true);
|
||||
const loadData = await adminAppInformation_funGetBidangBisnis();
|
||||
setData(loadData);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
setOpenModal(false);
|
||||
setLoadingUpdate(false);
|
||||
ComponentAdminGlobal_NotifikasiBerhasil(updt?.message);
|
||||
}
|
||||
} else {
|
||||
ComponentAdminGlobal_NotifikasiGagal(updt?.message as any);
|
||||
}
|
||||
}
|
||||
|
||||
// Row Table
|
||||
const rowTable = data.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<Center>
|
||||
<Text>{e?.name}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>
|
||||
<Switch
|
||||
color="orange"
|
||||
onLabel="ON"
|
||||
offLabel="OFF"
|
||||
checked={e?.active}
|
||||
onChange={(val) => {
|
||||
setOpenModal(true);
|
||||
setUpdateStatus({
|
||||
id: e?.id,
|
||||
active: val.currentTarget.checked as any,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</Center>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<Stack align="center" justify="center">
|
||||
<ActionIcon
|
||||
radius={"xl"}
|
||||
variant="transparent"
|
||||
onClick={() => {
|
||||
setIsUpdate(true);
|
||||
setIsCreate(false);
|
||||
setUpdateData({
|
||||
id: e?.id,
|
||||
name: e?.name,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Tooltip label="Edit">
|
||||
<IconEdit color="green" />
|
||||
</Tooltip>
|
||||
</ActionIcon>
|
||||
</Stack>
|
||||
</td>
|
||||
</tr>
|
||||
));
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_TitlePage
|
||||
name="Kategori Bidang Bisnis"
|
||||
component={
|
||||
<Button
|
||||
radius={"xl"}
|
||||
leftIcon={<IconCirclePlus />}
|
||||
onClick={() => {
|
||||
setIsCreate(true);
|
||||
setIsUpdate(false);
|
||||
}}
|
||||
>
|
||||
Tambah
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
|
||||
<Grid>
|
||||
<Grid.Col span={9}>
|
||||
<Paper p={"md"} withBorder shadow="lg" h={"65vh"}>
|
||||
<ScrollArea w={"100%"} h={"90%"} offsetScrollbars>
|
||||
<Table
|
||||
verticalSpacing={"xs"}
|
||||
horizontalSpacing={"md"}
|
||||
p={"md"}
|
||||
w={"100%"}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Kategori</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Status</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{rowTable}</tbody>
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
</Paper>
|
||||
</Grid.Col>
|
||||
|
||||
<Grid.Col span={3}>
|
||||
{/* Form Create */}
|
||||
{isCreate ? (
|
||||
<Paper p={"md"} withBorder shadow="lg">
|
||||
<Stack>
|
||||
<Center>
|
||||
<Title order={5}>Tambah Bidang Bisnis</Title>
|
||||
</Center>
|
||||
|
||||
<TextInput
|
||||
placeholder="Masukan nama bidang bisnis"
|
||||
value={newData}
|
||||
onChange={(val) => {
|
||||
setNewData(val.currentTarget.value);
|
||||
}}
|
||||
/>
|
||||
|
||||
<Group position="right" align="flex-end">
|
||||
<Button
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
setIsCreate(false);
|
||||
}}
|
||||
>
|
||||
Batal
|
||||
</Button>
|
||||
<Button
|
||||
loading={isLoadingCreate}
|
||||
loaderPosition="center"
|
||||
style={{ transition: "0.5s" }}
|
||||
disabled={newData == ""}
|
||||
radius={"xl"}
|
||||
color="green"
|
||||
onClick={() => {
|
||||
onCreate();
|
||||
}}
|
||||
>
|
||||
Simpan
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Paper>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{/* Form Update */}
|
||||
{isUpdate ? (
|
||||
<Paper p={"md"} withBorder shadow="lg">
|
||||
<Stack>
|
||||
<Center>
|
||||
<Title order={5}>Update Bidang Bisnis</Title>
|
||||
</Center>
|
||||
<TextInput
|
||||
placeholder="Masukan bidang bisnis"
|
||||
value={updateData.name}
|
||||
onChange={(val) => {
|
||||
const value = val.currentTarget.value;
|
||||
setUpdateData({ ...updateData, name: value });
|
||||
}}
|
||||
/>
|
||||
|
||||
<Group position="right">
|
||||
<Button
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
setIsUpdate(false);
|
||||
}}
|
||||
>
|
||||
Batal
|
||||
</Button>
|
||||
<Button
|
||||
style={{ transition: "0.5s" }}
|
||||
disabled={updateData?.name === ""}
|
||||
radius={"xl"}
|
||||
color="green"
|
||||
onClick={() => {
|
||||
onUpdate();
|
||||
}}
|
||||
>
|
||||
Update
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Paper>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Stack>
|
||||
|
||||
{/* Activasi bank */}
|
||||
<Modal
|
||||
centered
|
||||
withCloseButton={false}
|
||||
opened={openModal}
|
||||
onClose={() => setOpenModal(false)}
|
||||
>
|
||||
<Stack align="center">
|
||||
<Title order={5}>
|
||||
Anda ingin{" "}
|
||||
{updateStatus.active ? (
|
||||
<Text span inherit>
|
||||
mengaktifkan
|
||||
</Text>
|
||||
) : (
|
||||
<Text span inherit>
|
||||
menonaktifkan
|
||||
</Text>
|
||||
)}{" "}
|
||||
Bidang Bisnis ini ?
|
||||
</Title>
|
||||
<Group>
|
||||
<Button radius={"xl"} onClick={() => setOpenModal(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
<Button
|
||||
color="green"
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
onUpdateActivation({
|
||||
id: updateStatus.id,
|
||||
active: updateStatus.active as any,
|
||||
});
|
||||
}}
|
||||
>
|
||||
Iya
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -44,13 +44,13 @@ export default function AdminDonasi_Main({
|
||||
link: RouterAdminDonasi_OLD.table_review,
|
||||
color: "orange",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Draft",
|
||||
jumlah: countDraft,
|
||||
link: "",
|
||||
color: "yellow",
|
||||
},
|
||||
// {
|
||||
// id: 3,
|
||||
// name: "Draft",
|
||||
// jumlah: countDraft,
|
||||
// link: "",
|
||||
// color: "yellow",
|
||||
// },
|
||||
{
|
||||
id: 4,
|
||||
name: "Reject",
|
||||
@@ -65,7 +65,7 @@ export default function AdminDonasi_Main({
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Donasi" />
|
||||
|
||||
<SimpleGrid
|
||||
cols={4}
|
||||
cols={listBox.length}
|
||||
spacing="lg"
|
||||
breakpoints={[
|
||||
{ maxWidth: "62rem", cols: 4, spacing: "lg" },
|
||||
@@ -92,47 +92,6 @@ export default function AdminDonasi_Main({
|
||||
))}
|
||||
</SimpleGrid>
|
||||
</Stack>
|
||||
|
||||
{/* <Stack spacing={"sm"}>
|
||||
<Title>Donasi</Title>
|
||||
<Divider mb={"md"} />
|
||||
<SimpleGrid
|
||||
cols={4}
|
||||
spacing="lg"
|
||||
breakpoints={[
|
||||
{ maxWidth: "62rem", cols: 4, spacing: "lg" },
|
||||
{ maxWidth: "48rem", cols: 2, spacing: "sm" },
|
||||
{ maxWidth: "36rem", cols: 1, spacing: "sm" },
|
||||
]}
|
||||
>
|
||||
{listBox.map((e, i) => (
|
||||
<Paper
|
||||
key={i}
|
||||
bg={`${e.color}.2`}
|
||||
shadow="md"
|
||||
radius="md"
|
||||
p="md"
|
||||
// sx={{ borderColor: e.color, borderStyle: "solid" }}
|
||||
>
|
||||
<Group position="apart">
|
||||
<IconChevronsRight color={`${e.color}.2`} />
|
||||
<Stack align="center" spacing={0}>
|
||||
<Text>{e.name}</Text>
|
||||
<Title>{e.jumlah}</Title>
|
||||
</Stack>
|
||||
{e.link !== "" ? (
|
||||
<ActionIcon radius={"xl"} onClick={() => router.push(e.link)}>
|
||||
{" "}
|
||||
<IconChevronsRight />
|
||||
</ActionIcon>
|
||||
) : (
|
||||
<ActionIcon variant="transparent" disabled></ActionIcon>
|
||||
)}
|
||||
</Group>
|
||||
</Paper>
|
||||
))}
|
||||
</SimpleGrid>
|
||||
</Stack> */}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Stack } from "@mantine/core";
|
||||
import ComponentAdminGlobal_BackButton from "../../_admin_global/back_button";
|
||||
import { AdminEvent_ViewDetailPeserta } from "../_view";
|
||||
import { MODEL_EVENT_PESERTA } from "@/app_modules/event/model/interface";
|
||||
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global";
|
||||
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global/_component";
|
||||
|
||||
export function AdminEvent_UiDetailPeserta({
|
||||
dataPeserta,
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import { Button } from "@mantine/core";
|
||||
import { adminInvestasi_funAcceptTransaksiById, adminInvestasi_funGetAllTransaksiById } from "../../fun";
|
||||
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";
|
||||
@@ -9,15 +12,21 @@ import { useState } from "react";
|
||||
export function AdminInvestasi_ComponentButtonBandingTransaksi({
|
||||
invoiceId,
|
||||
investasiId,
|
||||
lembarTerbeli,
|
||||
onLoadData,
|
||||
}: {
|
||||
invoiceId: string;
|
||||
investasiId: string
|
||||
investasiId: string;
|
||||
lembarTerbeli: string;
|
||||
onLoadData: (val: any) => void;
|
||||
}) {
|
||||
const [isLoading, setLoading] = useState(false)
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
async function onAccept() {
|
||||
const res = await adminInvestasi_funAcceptTransaksiById({ invoiceId });
|
||||
const res = await adminInvestasi_funAcceptTransaksiById({
|
||||
invoiceId,
|
||||
investasiId,
|
||||
lembarTerbeli,
|
||||
});
|
||||
|
||||
if (res.status == 200) {
|
||||
try {
|
||||
|
||||
@@ -9,14 +9,17 @@ import { ComponentAdminGlobal_NotifikasiGagal } from "@/app_modules/admin/_admin
|
||||
import { useState } from "react";
|
||||
import { IconCircleCheck } from "@tabler/icons-react";
|
||||
import { IconBan } from "@tabler/icons-react";
|
||||
import { MODEL_INVOICE_INVESTASI } from "@/app_modules/investasi/_lib/interface";
|
||||
|
||||
export function AdminInvestasi_ComponentButtonKonfirmasiTransaksi({
|
||||
invoiceId,
|
||||
investasiId,
|
||||
lembarTerbeli,
|
||||
onLoadData,
|
||||
}: {
|
||||
invoiceId: string;
|
||||
investasiId: string;
|
||||
lembarTerbeli: string;
|
||||
onLoadData: (val: any) => void;
|
||||
}) {
|
||||
const [isLoadingAccpet, setLoadingAccept] = useState(false);
|
||||
@@ -43,7 +46,11 @@ export function AdminInvestasi_ComponentButtonKonfirmasiTransaksi({
|
||||
}
|
||||
|
||||
async function onAccept() {
|
||||
const res = await adminInvestasi_funAcceptTransaksiById({ invoiceId });
|
||||
const res = await adminInvestasi_funAcceptTransaksiById({
|
||||
invoiceId,
|
||||
investasiId,
|
||||
lembarTerbeli,
|
||||
});
|
||||
|
||||
if (res.status == 200) {
|
||||
try {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { RouterAdminInvestasi } from "@/app/lib/router_admin/router_admin_investasi";
|
||||
import { ComponentAdminGlobal_TampilanRupiah } from "@/app_modules/admin/_admin_global";
|
||||
import { ComponentAdminGlobal_TampilanRupiah } from "@/app_modules/admin/_admin_global/_component";
|
||||
import {
|
||||
MODEL_INVOICE_INVESTASI,
|
||||
MODEL_STATUS_INVOICE_INVESTASI,
|
||||
@@ -7,7 +6,6 @@ import {
|
||||
import {
|
||||
ActionIcon,
|
||||
Badge,
|
||||
Button,
|
||||
Center,
|
||||
Group,
|
||||
Pagination,
|
||||
@@ -140,6 +138,7 @@ export function AdminInvestasi_ViewDaftarTransaksi({
|
||||
<AdminInvestasi_ComponentButtonKonfirmasiTransaksi
|
||||
invoiceId={e.id}
|
||||
investasiId={investasiId}
|
||||
lembarTerbeli={e.lembarTerbeli}
|
||||
onLoadData={(val) => {
|
||||
setData(val.data);
|
||||
setNPage(val.nPage);
|
||||
@@ -151,6 +150,7 @@ export function AdminInvestasi_ViewDaftarTransaksi({
|
||||
<AdminInvestasi_ComponentButtonBandingTransaksi
|
||||
invoiceId={e.id}
|
||||
investasiId={investasiId}
|
||||
lembarTerbeli={e.lembarTerbeli}
|
||||
onLoadData={(val) => {
|
||||
setData(val.data);
|
||||
setNPage(val.nPage);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { Stack } from "@mantine/core";
|
||||
import ComponentAdminGlobal_BackButton from "../../_admin_global/back_button";
|
||||
import { AdminInvestasi_ViewBuktiTransfer } from "../_view";
|
||||
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global";
|
||||
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global/_component";
|
||||
|
||||
export function AdminInvestasi_DetailBuktiTransfer({ imageId }: { imageId: string }) {
|
||||
return (
|
||||
|
||||
@@ -2,13 +2,43 @@
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterAdminInvestasi } from "@/app/lib/router_admin/router_admin_investasi";
|
||||
import { toNumber } from "lodash";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function adminInvestasi_funAcceptTransaksiById({
|
||||
invoiceId,
|
||||
investasiId,
|
||||
lembarTerbeli,
|
||||
}: {
|
||||
invoiceId: string;
|
||||
investasiId: string;
|
||||
lembarTerbeli: string;
|
||||
}) {
|
||||
const dataInvestasi: any = await prisma.investasi.findFirst({
|
||||
where: {
|
||||
id: investasiId,
|
||||
},
|
||||
select: {
|
||||
totalLembar: true,
|
||||
sisaLembar: true,
|
||||
lembarTerbeli: true,
|
||||
},
|
||||
});
|
||||
|
||||
// Hitung TOTAL SISA LEMBAR
|
||||
const investasi_sisaLembar = toNumber(dataInvestasi?.sisaLembar);
|
||||
const invoice_lembarTerbeli = toNumber(lembarTerbeli);
|
||||
const resultSisaLembar = investasi_sisaLembar - invoice_lembarTerbeli;
|
||||
|
||||
// TAMBAH LEMBAR TERBELI
|
||||
const investasi_lembarTerbeli = toNumber(dataInvestasi?.lembarTerbeli);
|
||||
const resultLembarTerbeli = investasi_lembarTerbeli + invoice_lembarTerbeli;
|
||||
|
||||
// Progress
|
||||
const investasi_totalLembar = toNumber(dataInvestasi?.totalLembar);
|
||||
const progress = (resultLembarTerbeli / investasi_totalLembar) * 100;
|
||||
const resultProgres = toNumber(progress).toFixed(2);
|
||||
|
||||
const updt = await prisma.investasi_Invoice.update({
|
||||
where: {
|
||||
id: invoiceId,
|
||||
@@ -18,10 +48,27 @@ export async function adminInvestasi_funAcceptTransaksiById({
|
||||
},
|
||||
});
|
||||
|
||||
if (!updt) return { status: 400, message: "Gagal Update" };
|
||||
revalidatePath(RouterAdminInvestasi.detail_publish);
|
||||
return {
|
||||
status: 200,
|
||||
message: "Update Berhasil",
|
||||
};
|
||||
if (!updt) {
|
||||
return { status: 400, message: "Gagal Update Status" };
|
||||
} else {
|
||||
const updateInvestasi = await prisma.investasi.update({
|
||||
where: {
|
||||
id: investasiId,
|
||||
},
|
||||
data: {
|
||||
sisaLembar: resultSisaLembar.toString(),
|
||||
lembarTerbeli: resultLembarTerbeli.toString(),
|
||||
progress: resultProgres,
|
||||
},
|
||||
});
|
||||
|
||||
if (!updateInvestasi)
|
||||
return { status: 400, message: "Gagal Update Data Investasi" };
|
||||
|
||||
revalidatePath(RouterAdminInvestasi.detail_publish);
|
||||
return {
|
||||
status: 200,
|
||||
message: "Update Berhasil",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,11 @@ export async function adminInvestasi_funGetAllPublish({
|
||||
const data = await prisma.investasi.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: {
|
||||
countDown: "desc",
|
||||
},
|
||||
orderBy: [
|
||||
{
|
||||
countDown: "desc",
|
||||
},
|
||||
],
|
||||
where: {
|
||||
active: true,
|
||||
masterStatusInvestasiId: "1",
|
||||
@@ -27,17 +29,7 @@ export async function adminInvestasi_funGetAllPublish({
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
authorId: true,
|
||||
hargaLembar: true,
|
||||
targetDana: true,
|
||||
totalLembar: true,
|
||||
roi: true,
|
||||
active: true,
|
||||
imagesId: true,
|
||||
catatan: true,
|
||||
include: {
|
||||
MasterStatusInvestasi: true,
|
||||
BeritaInvestasi: true,
|
||||
DokumenInvestasi: true,
|
||||
@@ -46,8 +38,11 @@ export async function adminInvestasi_funGetAllPublish({
|
||||
MasterPencarianInvestor: true,
|
||||
MasterPeriodeDeviden: true,
|
||||
author: true,
|
||||
progress: true,
|
||||
sisaLembar: true,
|
||||
Investasi_Invoice: {
|
||||
where: {
|
||||
statusInvoiceId: "2",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -98,6 +98,11 @@ function TableView({ listData }: { listData: any }) {
|
||||
}).format(+e.totalLembar)}
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Text lineClamp={1}>{e.Investasi_Invoice.length}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Button
|
||||
@@ -172,6 +177,9 @@ function TableView({ listData }: { listData: any }) {
|
||||
<th>
|
||||
<Center w={200}>Total Saham</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center w={200}>Validasi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center w={200}>Aksi</Center>
|
||||
</th>
|
||||
|
||||
Reference in New Issue
Block a user