Admin
# feat: - Admin ganti status review ke publish
This commit is contained in:
@@ -110,6 +110,7 @@ model Investasi {
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
author User? @relation(fields: [authorId], references: [id])
|
||||
authorId String?
|
||||
catatan String?
|
||||
|
||||
MasterPeriodeDeviden MasterPeriodeDeviden? @relation(fields: [masterPeriodeDevidenId], references: [id])
|
||||
masterPeriodeDevidenId String?
|
||||
|
||||
BIN
public/file/57017e7b-bd18-4822-bea6-18e4f17823ac.pdf
Normal file
BIN
public/file/57017e7b-bd18-4822-bea6-18e4f17823ac.pdf
Normal file
Binary file not shown.
BIN
public/file/ad7680d8-8ccd-4ae5-99e9-08f292f26e65.pdf
Normal file
BIN
public/file/ad7680d8-8ccd-4ae5-99e9-08f292f26e65.pdf
Normal file
Binary file not shown.
BIN
public/investasi/21cb9f77-be9e-4f10-b7d5-b7d6935d445a.png
Normal file
BIN
public/investasi/21cb9f77-be9e-4f10-b7d5-b7d6935d445a.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 263 KiB |
BIN
public/investasi/90a63208-8257-4de8-8138-7fce204c2a76.png
Normal file
BIN
public/investasi/90a63208-8257-4de8-8138-7fce204c2a76.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 94 KiB |
22
src/app/api/investasi/dokumen/[id]/route.ts
Normal file
22
src/app/api/investasi/dokumen/[id]/route.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import fs from "fs";
|
||||
|
||||
export async function GET(
|
||||
req: NextRequest,
|
||||
{ params }: { params: { id: string } }
|
||||
) {
|
||||
const data = await prisma.dokumenInvestasi.findUnique({
|
||||
where: { id: params.id },
|
||||
select: {
|
||||
url: true,
|
||||
},
|
||||
});
|
||||
|
||||
const file = fs.readFileSync(`./public/file/${data?.url}`);
|
||||
return new NextResponse(file, {
|
||||
headers: {
|
||||
"Content-Type": "application/pdf",
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
import { Admin_HalamanAksi } from "@/app_modules/admin/investasi";
|
||||
|
||||
export default async function Page() {
|
||||
export default async function Page({params}:{params: {id: string}}) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Admin_HalamanAksi />
|
||||
<Admin_HalamanAksi idInves={params.id} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
16
src/app/dev/admin/investasi/konfirmasi/[id]/page.tsx
Normal file
16
src/app/dev/admin/investasi/konfirmasi/[id]/page.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import { Admin_KonfirmasiInvestasi } from "@/app_modules/admin/investasi";
|
||||
import { funGetUserProfile } from "@/app_modules/fun/get_user_profile";
|
||||
import getOneInvestasiById from "@/app_modules/investasi/fun/get_one_investasi_by_id";
|
||||
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const dataInvestasi = await getOneInvestasiById(params.id)
|
||||
const dataUser = await funGetUserProfile(dataInvestasi?.authorId as any)
|
||||
// console.log(dataUser)
|
||||
|
||||
return (
|
||||
<>
|
||||
<Admin_KonfirmasiInvestasi dataInvestasi={dataInvestasi as any} dataUser={dataUser as any} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
import { Admin_KonfirmasiInvestasi } from "@/app_modules/admin/investasi";
|
||||
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
return (
|
||||
<>
|
||||
<Admin_KonfirmasiInvestasi id={params.id} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -6,7 +6,7 @@ export const RouterAdminDashboard = {
|
||||
export const RouterAdminInvestasi = {
|
||||
main_investasi: "/dev/admin/main/investasi",
|
||||
halaman_aksi: "/dev/admin/investasi/halaman_aksi/",
|
||||
konfirmasi: "/dev/admin/investasi/konfirmasi",
|
||||
konfirmasi: "/dev/admin/investasi/konfirmasi/",
|
||||
bukti_transfer: "/dev/admin/investasi/bukti_transfer",
|
||||
status_transfer: "/dev/admin/investasi/status_transfer"
|
||||
};
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
export const RouterInvestasi = {
|
||||
api_gambar: "/api/investasi/gambar/",
|
||||
api_file_prospektus: "/api/investasi/prospektus/",
|
||||
api_file_dokumen: "/api/investasi/dokumen/",
|
||||
|
||||
//INVESTASI
|
||||
main: "/dev/investasi/main",
|
||||
main_porto: "/dev/investasi/main/portofolio",
|
||||
|
||||
3
src/app/lib/router_hipmi/router_user_profile.ts
Normal file
3
src/app/lib/router_hipmi/router_user_profile.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export const RouterUserProfile = {
|
||||
api_foto: "/api/profile/foto/",
|
||||
};
|
||||
@@ -11,8 +11,8 @@ export default function Admin_LayoutHalamanAksi({
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
{/* {children} */}
|
||||
<AppShell header={<HeaderTamplate title="Pilih Aksi" />}>
|
||||
{/* {children} */}
|
||||
<AppShell padding={"md"} header={<HeaderTamplate title="Pilih Aksi" />}>
|
||||
{children}
|
||||
</AppShell>
|
||||
</>
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
import { IconChevronRight } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
export default function Admin_HalamanAksi() {
|
||||
export default function Admin_HalamanAksi({idInves}: {idInves: string}) {
|
||||
const router = useRouter();
|
||||
const listHalamanAksi = [
|
||||
{
|
||||
@@ -58,7 +58,7 @@ export default function Admin_HalamanAksi() {
|
||||
compact
|
||||
radius={50}
|
||||
w={100}
|
||||
onClick={() => router.push(e.route)}
|
||||
onClick={() => router.push(e.route + `${idInves}`)}
|
||||
>
|
||||
Lihat
|
||||
</Button>
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
"use client";
|
||||
|
||||
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { RouterUserProfile } from "@/app/lib/router_hipmi/router_user_profile";
|
||||
import { Warna } from "@/app/lib/warna";
|
||||
import funEditInvestasi from "@/app_modules/investasi/fun/fun_edit_investasi";
|
||||
import funGantiStatusInvestasi from "@/app_modules/investasi/fun/fun_ganti_status";
|
||||
import { gs_StatusPortoInvestasi } from "@/app_modules/investasi/g_state";
|
||||
import { MODEL_Investasi } from "@/app_modules/investasi/model/model_investasi";
|
||||
import { MODEL_User_profile } from "@/app_modules/models/user_profile";
|
||||
import {
|
||||
Group,
|
||||
Flex,
|
||||
@@ -20,24 +27,46 @@ import {
|
||||
Image,
|
||||
Collapse,
|
||||
Textarea,
|
||||
Divider,
|
||||
Mark,
|
||||
Modal,
|
||||
} from "@mantine/core";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import { useDisclosure, useShallowEffect } from "@mantine/hooks";
|
||||
import {
|
||||
IconAlertHexagonFilled,
|
||||
IconBan,
|
||||
IconBookDownload,
|
||||
IconCheck,
|
||||
IconChevronDown,
|
||||
IconChevronLeft,
|
||||
IconChevronRight,
|
||||
IconFile,
|
||||
IconFileDescription,
|
||||
IconFileTypePdf,
|
||||
IconPdf,
|
||||
IconSpeakerphone,
|
||||
} from "@tabler/icons-react";
|
||||
import { useAtom } from "jotai";
|
||||
import _ from "lodash";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import toast from "react-simple-toasts";
|
||||
|
||||
export default function Admin_KonfirmasiInvestasi({ id }: { id: string }) {
|
||||
export default function Admin_KonfirmasiInvestasi({
|
||||
dataInvestasi,
|
||||
dataUser,
|
||||
}: {
|
||||
dataInvestasi: MODEL_Investasi;
|
||||
dataUser: MODEL_User_profile;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [investasi, setInvestasi] = useState(dataInvestasi);
|
||||
const [user, setUser] = useState(dataUser);
|
||||
const [publish, setPublish] = useState(true);
|
||||
const [opened, { toggle }] = useDisclosure(false);
|
||||
const [catatan, setCatatan] = useState<string | number>("");
|
||||
const [status, setStatus] = useAtom(gs_StatusPortoInvestasi);
|
||||
|
||||
const listBox = [
|
||||
{
|
||||
@@ -59,178 +88,244 @@ export default function Admin_KonfirmasiInvestasi({ id }: { id: string }) {
|
||||
route: RouterInvestasi.berita,
|
||||
},
|
||||
];
|
||||
|
||||
// useShallowEffect(() => {
|
||||
// cekStatusPublish()
|
||||
// },[])
|
||||
|
||||
// async function cekStatusPublish() {
|
||||
// if(investasi.MasterStatusInvestasi.id === "3")
|
||||
// setPublish(false)
|
||||
// }
|
||||
|
||||
async function onCatatan() {
|
||||
if (_.isEmpty(catatan)) return toast("Lengkapi alasan");
|
||||
console.log(catatan);
|
||||
toggle();
|
||||
}
|
||||
|
||||
async function onPublish() {
|
||||
// const res = await funGantiStatusInvestasi(investasi.id, "3")
|
||||
setTimeout(() => setPublish(false), 1000);
|
||||
toast("Proyek Investasi Di Publish");
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Group position="left" mb={"md"}>
|
||||
<Group position="apart" px={"md"}>
|
||||
<Flex align={"center"} gap={"xs"}>
|
||||
<Avatar src={"/aset/avatar.png"} />
|
||||
<Text>Username</Text>
|
||||
<Avatar
|
||||
radius={50}
|
||||
size={"lg"}
|
||||
src={
|
||||
RouterUserProfile.api_foto + `${user.Profile?.ImageProfile?.url}`
|
||||
}
|
||||
/>
|
||||
<Text>{user.username}</Text>
|
||||
</Flex>
|
||||
{/* <Text>Sisa waktu : 20 Hari</Text> */}
|
||||
<Group>
|
||||
{" "}
|
||||
<Center>
|
||||
{publish ? (
|
||||
<Button
|
||||
radius={50}
|
||||
bg={"green"}
|
||||
color="green"
|
||||
leftIcon={<IconCheck />}
|
||||
onClick={() => {
|
||||
onPublish();
|
||||
}}
|
||||
>
|
||||
Publish
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
radius={50}
|
||||
leftIcon={<IconBan />}
|
||||
bg={"orange"}
|
||||
color="orange"
|
||||
onClick={() => {
|
||||
setTimeout(() => setPublish(true), 1000);
|
||||
toast("Proyek Investasi Di Non-Aktifkan");
|
||||
}}
|
||||
>
|
||||
Non - aktifkan
|
||||
</Button>
|
||||
)}
|
||||
</Center>
|
||||
<Button
|
||||
radius={50}
|
||||
bg={"red"}
|
||||
color="red"
|
||||
onClick={toggle}
|
||||
rightIcon={<IconAlertHexagonFilled />}
|
||||
>
|
||||
Reject
|
||||
</Button>
|
||||
</Group>
|
||||
</Group>
|
||||
|
||||
<Paper withBorder mb={"md"}>
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
<Image alt="" src={"/aset/no-img.png"} />
|
||||
</AspectRatio>
|
||||
</Paper>
|
||||
<Divider my={"md"} />
|
||||
|
||||
{/* Title dan Persentase */}
|
||||
<Box mb={"md"}>
|
||||
<Title order={4} mb={"xs"}>
|
||||
Judul Proyek
|
||||
</Title>
|
||||
<Slider
|
||||
disabled
|
||||
size={10}
|
||||
value={60}
|
||||
marks={[{ value: 60, label: "60%" }]}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
{/* Rincian Data */}
|
||||
<Grid p={"md"} mb={"md"}>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>Terkumpul</Text>
|
||||
<Text>Rp. </Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Dana Dibutuhkan</Text>
|
||||
<Text>Rp. </Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Harga Per Lembar</Text>
|
||||
<Text>Rp. </Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Jadwal Pembagian</Text>
|
||||
<Text>3 Bulan </Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>Investor</Text>
|
||||
<Text>4657</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>ROI</Text>
|
||||
<Text>%</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Total Lembar</Text>
|
||||
<Text>0</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Pembagian Deviden</Text>
|
||||
<Text>Selamanya</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
{/* List Box */}
|
||||
<Grid mb={"xl"}>
|
||||
{listBox.map((e) => (
|
||||
<Grid.Col
|
||||
span={"auto"}
|
||||
key={e.id}
|
||||
onClick={() => router.push(e.route + `${id}`)}
|
||||
>
|
||||
<Paper h={100} w={100} bg={"gray.4"} withBorder py={"xs"}>
|
||||
<Flex direction={"column"} align={"center"} justify={"center"}>
|
||||
<Text fz={12}>{e.name}</Text>
|
||||
<ActionIcon variant="transparent" size={60}>
|
||||
{e.icon}
|
||||
</ActionIcon>
|
||||
</Flex>
|
||||
<Stack spacing={"lg"}>
|
||||
<Grid>
|
||||
<Grid.Col span={4}>
|
||||
{/* Title */}
|
||||
<Center my={"sm"}>
|
||||
<Title order={4} mb={"xs"}>
|
||||
{investasi.title}
|
||||
</Title>
|
||||
</Center>
|
||||
<Paper withBorder mb={"md"} mah={300} maw={400} mx={"auto"} p={5}>
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
<Image
|
||||
alt=""
|
||||
src={RouterInvestasi.api_gambar + `${investasi.imagesId}`}
|
||||
/>
|
||||
</AspectRatio>
|
||||
</Paper>
|
||||
</Grid.Col>
|
||||
))}
|
||||
</Grid>
|
||||
|
||||
<Stack mb={40}>
|
||||
{/* Button publish dan reject */}
|
||||
<Grid>
|
||||
{/* Publish */}
|
||||
<Grid.Col span={6}>
|
||||
<Center>
|
||||
{publish ? (
|
||||
<Button
|
||||
radius={50}
|
||||
w={200}
|
||||
bg={"green"}
|
||||
color="green"
|
||||
onClick={() => {
|
||||
setTimeout(() => setPublish(false), 1000);
|
||||
toast("Proyek Investasi Di Publish");
|
||||
}}
|
||||
>
|
||||
Publish
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
radius={50}
|
||||
w={200}
|
||||
bg={"orange"}
|
||||
color="orange"
|
||||
onClick={() => {
|
||||
setTimeout(() => setPublish(true), 1000);
|
||||
toast("Proyek Investasi Di Non-Aktifkan");
|
||||
}}
|
||||
>
|
||||
Non - aktif
|
||||
</Button>
|
||||
)}
|
||||
</Center>
|
||||
{/* Rincian Data */}
|
||||
<Grid.Col span={4}>
|
||||
<Grid p={"md"} mb={"md"}>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>Dana Dibutuhkan</Text>
|
||||
<Text>Rp. {investasi.targetDana}</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Harga Per Lembar</Text>
|
||||
<Text>Rp.{investasi.hargaLembar} </Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Jadwal Pembagian</Text>
|
||||
<Text>{investasi.MasterPembagianDeviden.name} bulan </Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Pencarian Investor</Text>
|
||||
<Text>{investasi.MasterPencarianInvestor.name} hari </Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Stack>
|
||||
<Box>
|
||||
<Text>ROI</Text>
|
||||
<Text>{investasi.roi} %</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Total Lembar</Text>
|
||||
<Text> {investasi.totalLembar} lembar</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>Pembagian Deviden</Text>
|
||||
<Text>{investasi.MasterPeriodeDeviden.name}</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Grid.Col>
|
||||
{/* Reject */}
|
||||
<Grid.Col span={6}>
|
||||
<Center>
|
||||
<Button
|
||||
w={200}
|
||||
radius={50}
|
||||
bg={"red"}
|
||||
color="red"
|
||||
onClick={toggle}
|
||||
rightIcon={!opened ? <IconChevronLeft /> : <IconChevronDown />}
|
||||
>
|
||||
Reject
|
||||
</Button>
|
||||
</Center>
|
||||
|
||||
{/* Note dan dokumen */}
|
||||
<Grid.Col span={4}>
|
||||
<Stack>
|
||||
{/* Note */}
|
||||
<Stack spacing={0}>
|
||||
<Text fw={"bold"}>Note :</Text>
|
||||
<Text fw={"lighter"} fs={"italic"}>
|
||||
Cek kembali kelengkapan file prospektus & semua dokumen
|
||||
terkait investasi sebelum mem-publish. Jika kelengkapan file
|
||||
kurang lengkap maka reject dan berikan pesan terkait
|
||||
kekurangnya.
|
||||
</Text>
|
||||
</Stack>
|
||||
{/* File file */}
|
||||
<Stack>
|
||||
{/* Prospektus */}
|
||||
<Stack spacing={0}>
|
||||
<Title order={6}>Prospektus :</Title>
|
||||
{investasi.ProspektusInvestasi === null ? (
|
||||
<Text>Tidak ada file</Text>
|
||||
) : (
|
||||
<Paper p={"xs"}>
|
||||
<Group>
|
||||
<IconFileTypePdf />
|
||||
<Text>Prospektus_{investasi.title}</Text>
|
||||
<Link
|
||||
target="_blank"
|
||||
href={
|
||||
RouterInvestasi.api_file_prospektus +
|
||||
`${
|
||||
investasi.ProspektusInvestasi === null
|
||||
? ""
|
||||
: investasi.ProspektusInvestasi.id
|
||||
}`
|
||||
}
|
||||
>
|
||||
<Button compact radius={50}>
|
||||
Buka
|
||||
</Button>
|
||||
</Link>
|
||||
</Group>
|
||||
</Paper>
|
||||
)}
|
||||
</Stack>
|
||||
|
||||
{/* Dokumen */}
|
||||
<Stack spacing={0}>
|
||||
<Title order={6}>Dokumen :</Title>
|
||||
{_.isEmpty(investasi.DokumenInvestasi) ? (
|
||||
<Text>Tidak ada dokumen</Text>
|
||||
) : (
|
||||
investasi.DokumenInvestasi.map((e) => (
|
||||
<Paper p={"xs"} key={e.id}>
|
||||
<Group>
|
||||
<IconFileTypePdf />
|
||||
<Text>{e.title}</Text>
|
||||
<Link
|
||||
target="_blank"
|
||||
href={
|
||||
RouterInvestasi.api_file_dokumen + `${e.id}`
|
||||
}
|
||||
>
|
||||
<Button compact radius={50}>
|
||||
Buka
|
||||
</Button>
|
||||
</Link>
|
||||
</Group>
|
||||
</Paper>
|
||||
))
|
||||
)}
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
{/* Text area reject */}
|
||||
<Collapse in={opened}>
|
||||
<Paper bg={"gray.4"} p={"xs"}>
|
||||
<Stack>
|
||||
<Textarea
|
||||
withAsterisk
|
||||
label="Alasan:"
|
||||
placeholder="Masukan alasan penolakan"
|
||||
autosize
|
||||
minRows={2}
|
||||
maxRows={4}
|
||||
/>
|
||||
<Group position="right">
|
||||
<Button
|
||||
w={100}
|
||||
radius={50}
|
||||
bg={Warna.biru}
|
||||
compact
|
||||
onClick={toggle}
|
||||
>
|
||||
Kirim
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Collapse>
|
||||
<Modal
|
||||
centered
|
||||
opened={opened}
|
||||
onClose={toggle}
|
||||
// withCloseButton={false}
|
||||
title="Masukan alasan penolakan"
|
||||
>
|
||||
<Textarea
|
||||
mb={"md"}
|
||||
autosize
|
||||
minRows={2}
|
||||
maxRows={4}
|
||||
onChange={(val) => setCatatan(val.target.value)}
|
||||
/>
|
||||
<Group position="right">
|
||||
<Button radius={50} compact onClick={() => onCatatan()}>
|
||||
Simpan
|
||||
</Button>
|
||||
</Group>
|
||||
</Modal>
|
||||
</Stack>
|
||||
{/* <pre>{JSON.stringify(investasi, null, 2)}</pre> */}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ export default function Admin_Investasi({
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
onClick={() =>
|
||||
router.push(RouterAdminInvestasi.halaman_aksi + `${e.id}`)
|
||||
router.push(RouterAdminInvestasi.konfirmasi + `${e.id}`)
|
||||
}
|
||||
>
|
||||
<IconEdit />
|
||||
|
||||
@@ -2,34 +2,35 @@
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function funGetUserProfile(userId: string) {
|
||||
export async function funGetUserProfile( userId: string ) {
|
||||
|
||||
const user = await prisma.user.findUnique({
|
||||
where: {
|
||||
id: userId
|
||||
id: userId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
nomor: true,
|
||||
Profile: {
|
||||
select: {
|
||||
id: true,
|
||||
alamat: true,
|
||||
email: true,
|
||||
jenisKelamin: true,
|
||||
name: true,
|
||||
ImageProfile: {
|
||||
select: {
|
||||
url: true,
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
nomor: true,
|
||||
Profile: {
|
||||
select: {
|
||||
id: true,
|
||||
alamat: true,
|
||||
email: true,
|
||||
jenisKelamin: true,
|
||||
name: true,
|
||||
ImageProfile: {
|
||||
select: {
|
||||
url: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
revalidatePath("/dev/home");
|
||||
revalidatePath("/dev/katalog/view")
|
||||
revalidatePath("/dev/katalog/view");
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
@@ -44,13 +44,13 @@ import { gs_ListPortofolio } from "../katalog/portofolio/state/global_state";
|
||||
import { myConsole } from "@/app/fun/my_console";
|
||||
import { getFotoProfile } from "../katalog/profile/api/get-foto-profile";
|
||||
import { funGetUserProfile } from "../fun/get_user_profile";
|
||||
import { USER_PROFILE } from "../models/user_profile";
|
||||
import { MODEL_User_profile } from "../models/user_profile";
|
||||
import AppNotif from "../notif";
|
||||
|
||||
// export const dynamic = "force-dynamic"
|
||||
// export const revalidate = 0
|
||||
|
||||
export default function HomeView({ user }: { user: USER_PROFILE }) {
|
||||
export default function HomeView({ user }: { user: MODEL_User_profile }) {
|
||||
const router = useRouter();
|
||||
const [stateUser, setStateUser] = useState(user);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import { funCreateInvestasi } from "../fun/fun_create_investasi";
|
||||
import toast from "react-simple-toasts";
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { useAtom } from "jotai";
|
||||
import { gs_TabPortoInvestasi, gs_investasiFooter } from "../g_state";
|
||||
import { gs_StatusPortoInvestasi, gs_investasiFooter } from "../g_state";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
|
||||
export default function InvestasiCreate({
|
||||
@@ -44,7 +44,7 @@ export default function InvestasiCreate({
|
||||
const [fl, setFl] = useState<File | null>(null);
|
||||
const [img, setImg] = useState<any | null>();
|
||||
const [changeColor, setChangeColor] = useAtom(gs_investasiFooter);
|
||||
const [activeTab, setActiveTab] = useAtom(gs_TabPortoInvestasi);
|
||||
const [activeTab, setActiveTab] = useAtom(gs_StatusPortoInvestasi);
|
||||
const [totalLembar, setTotalLembar] = useState(0);
|
||||
|
||||
const [value, setValue] = useState({
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
} from "@tabler/icons-react";
|
||||
import { useAtom } from "jotai";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { gs_TabPortoInvestasi } from "../../g_state";
|
||||
import { gs_StatusPortoInvestasi } from "../../g_state";
|
||||
import toast from "react-simple-toasts";
|
||||
import { MODEL_Investasi } from "../../model/model_investasi";
|
||||
import { useState } from "react";
|
||||
@@ -39,7 +39,7 @@ export default function DetailDraftInvestasi({
|
||||
dataInvestasi: any;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [activeTab, setActiveTab] = useAtom(gs_TabPortoInvestasi);
|
||||
const [activeTab, setActiveTab] = useAtom(gs_StatusPortoInvestasi);
|
||||
const [investasi, setInvestasi] = useState<MODEL_Investasi>(dataInvestasi);
|
||||
|
||||
const listBox = [
|
||||
|
||||
@@ -27,12 +27,12 @@ import {
|
||||
} from "@tabler/icons-react";
|
||||
import { useAtom } from "jotai";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { gs_TabPortoInvestasi } from "../../g_state";
|
||||
import { gs_StatusPortoInvestasi } from "../../g_state";
|
||||
import toast from "react-simple-toasts";
|
||||
|
||||
export default function DetailRejectInvestasi() {
|
||||
const router = useRouter();
|
||||
const [activeTab, setActiveTab] = useAtom(gs_TabPortoInvestasi);
|
||||
const [activeTab, setActiveTab] = useAtom(gs_StatusPortoInvestasi);
|
||||
|
||||
const listBox = [
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
} from "@tabler/icons-react";
|
||||
import { useAtom } from "jotai";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { gs_TabPortoInvestasi } from "../../g_state";
|
||||
import { gs_StatusPortoInvestasi } from "../../g_state";
|
||||
import toast from "react-simple-toasts";
|
||||
import { MODEL_Investasi } from "../../model/model_investasi";
|
||||
import funGantiStatusInvestasi from "../../fun/fun_ganti_status";
|
||||
@@ -34,7 +34,7 @@ import { useState } from "react";
|
||||
|
||||
export default function DetailReviewInvestasi({dataInvestasi}:{dataInvestasi: MODEL_Investasi}) {
|
||||
const router = useRouter();
|
||||
const [activeTab, setActiveTab] = useAtom(gs_TabPortoInvestasi);
|
||||
const [activeTab, setActiveTab] = useAtom(gs_StatusPortoInvestasi);
|
||||
const [investasi,setInvestasi] = useState<MODEL_Investasi>(dataInvestasi)
|
||||
|
||||
const listBox = [
|
||||
|
||||
@@ -16,6 +16,7 @@ export default function DetailPropektus({
|
||||
}) {
|
||||
const [prospek, setProspek] = useState(dataInvestasi);
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
{prospek.ProspektusInvestasi !== null ? (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { atomWithStorage } from "jotai/utils";
|
||||
|
||||
export const gs_investasiFooter = atomWithStorage<number>("changeColor", 0)
|
||||
export const gs_TabPortoInvestasi = atomWithStorage<any | string>("gs_TabPortoInvestasi" , "Draft")
|
||||
export const gs_StatusPortoInvestasi = atomWithStorage<any | string>("gs_TabPortoInvestasi" , "Draft")
|
||||
|
||||
@@ -41,7 +41,7 @@ import {
|
||||
} from "@tabler/icons-react";
|
||||
import { atomWithStorage } from "jotai/utils";
|
||||
import { useAtom } from "jotai";
|
||||
import { gs_TabPortoInvestasi } from "../g_state";
|
||||
import { gs_StatusPortoInvestasi } from "../g_state";
|
||||
import {
|
||||
MODEL_Investasi,
|
||||
MODEL_Status_investasi,
|
||||
@@ -56,7 +56,7 @@ export default function PortofolioInvestasi({
|
||||
listStatusInvestasi: any;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [activeTab, setActiveTab] = useAtom(gs_TabPortoInvestasi);
|
||||
const [activeTab, setActiveTab] = useAtom(gs_StatusPortoInvestasi);
|
||||
|
||||
const [investasi, setInvestasi] = useState<MODEL_Investasi[]>(dataInvestasi);
|
||||
const [status_inves, setStatus_inves] =
|
||||
|
||||
@@ -34,10 +34,10 @@ import { getFotoProfile } from "../profile/api/get-foto-profile";
|
||||
import { ApiHipmi } from "@/app/lib/api";
|
||||
import { ListPortofolioView } from "../portofolio";
|
||||
import { User } from "@prisma/client";
|
||||
import { USER_PROFILE } from "@/app_modules/models/user_profile";
|
||||
import { MODEL_User_profile } from "@/app_modules/models/user_profile";
|
||||
import { LIST_PORTOFOLIO } from "@/app_modules/models/portofolio";
|
||||
|
||||
export default function KatalogView({ user, listPorto }: { user: USER_PROFILE, listPorto: LIST_PORTOFOLIO }) {
|
||||
export default function KatalogView({ user, listPorto }: { user: MODEL_User_profile, listPorto: LIST_PORTOFOLIO }) {
|
||||
return (
|
||||
<>
|
||||
<ProfileView user={user} />
|
||||
|
||||
@@ -13,10 +13,10 @@ import { useState } from "react";
|
||||
import toast from "react-simple-toasts";
|
||||
import { gs_profile } from "../state/global_state";
|
||||
import { loadDataProfile } from "../fun/fun_get_profile";
|
||||
import { USER_PROFILE } from "@/app_modules/models/user_profile";
|
||||
import { MODEL_User_profile } from "@/app_modules/models/user_profile";
|
||||
import funEditProfile from "../fun/fun_edit_profile";
|
||||
|
||||
export default function EditProfile({ data }: { data: USER_PROFILE }) {
|
||||
export default function EditProfile({ data }: { data: MODEL_User_profile }) {
|
||||
const router = useRouter();
|
||||
|
||||
//Get data profile
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { USER_PROFILE } from "@/app_modules/models/user_profile";
|
||||
import { MODEL_User_profile } from "@/app_modules/models/user_profile";
|
||||
|
||||
export default async function funEditProfile(data: USER_PROFILE) {
|
||||
export default async function funEditProfile(data: MODEL_User_profile) {
|
||||
const res = await prisma.profile.update({
|
||||
where: {
|
||||
id: data.Profile?.id,
|
||||
|
||||
@@ -32,10 +32,10 @@ import { loadDataProfile } from "../fun/fun_get_profile";
|
||||
import { getFotoProfile } from "../api/get-foto-profile";
|
||||
import { gs_fotoProfile, gs_profile } from "../state/global_state";
|
||||
import { getProfile } from "..";
|
||||
import { USER_PROFILE } from "@/app_modules/models/user_profile";
|
||||
import { MODEL_User_profile } from "@/app_modules/models/user_profile";
|
||||
import { funGetUserProfile } from "@/app_modules/fun/get_user_profile";
|
||||
|
||||
export default function ProfileView({ user }: { user: USER_PROFILE }) {
|
||||
export default function ProfileView({ user }: { user: MODEL_User_profile }) {
|
||||
const router = useRouter();
|
||||
const [stateUser, setStateUser] = useState(user);
|
||||
useShallowEffect(() => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export interface USER_PROFILE {
|
||||
export interface MODEL_User_profile {
|
||||
id: string;
|
||||
username: string;
|
||||
nomor: string;
|
||||
|
||||
Reference in New Issue
Block a user