Project Collaboration
## feat - Buat proyek baru - Tampilan list data pada beranda - Partisipasi user lain ### No issuee
This commit is contained in:
@@ -734,7 +734,7 @@ model ProjectCollaboration {
|
|||||||
title String
|
title String
|
||||||
lokasi String
|
lokasi String
|
||||||
purpose String @db.Text
|
purpose String @db.Text
|
||||||
benefit String @db.Text
|
benefit String? @db.Text
|
||||||
|
|
||||||
ProjectCollaborationMaster_Industri ProjectCollaborationMaster_Industri? @relation(fields: [projectCollaborationMaster_IndustriId], references: [id])
|
ProjectCollaborationMaster_Industri ProjectCollaborationMaster_Industri? @relation(fields: [projectCollaborationMaster_IndustriId], references: [id])
|
||||||
projectCollaborationMaster_IndustriId Int?
|
projectCollaborationMaster_IndustriId Int?
|
||||||
|
|||||||
@@ -1,13 +1,25 @@
|
|||||||
import { Colab_MainDetail } from "@/app_modules/colab";
|
import { Colab_MainDetail } from "@/app_modules/colab";
|
||||||
|
import colab_funCekPartisipasiById from "@/app_modules/colab/fun/get/cek_partisipasi_by_user_id";
|
||||||
|
import colab_getListPartisipanById from "@/app_modules/colab/fun/get/get_list_partisipan_by_id";
|
||||||
|
import colab_getOneCollaborationById from "@/app_modules/colab/fun/get/get_one_by_id";
|
||||||
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
|
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
|
||||||
|
|
||||||
export default async function Page({ params }: { params: { id: string } }) {
|
export default async function Page({ params }: { params: { id: string } }) {
|
||||||
let colabId = params.id
|
let colabId = params.id;
|
||||||
const userLoginId = await User_getUserId()
|
const userLoginId = await User_getUserId();
|
||||||
|
const dataColab = await colab_getOneCollaborationById(colabId);
|
||||||
|
const listPartisipan = await colab_getListPartisipanById(colabId)
|
||||||
|
const cekPartisipan = await colab_funCekPartisipasiById(colabId)
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Colab_MainDetail />
|
<Colab_MainDetail
|
||||||
|
dataColab={dataColab as any}
|
||||||
|
userLoginId={userLoginId}
|
||||||
|
listPartisipan={listPartisipan as any}
|
||||||
|
cekPartisipan={cekPartisipan}
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
import { Colab_Beranda } from "@/app_modules/colab";
|
import { Colab_Beranda } from "@/app_modules/colab";
|
||||||
|
import colab_getListAllProyek from "@/app_modules/colab/fun/get/get_list_all_proyek";
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
return<>
|
const listData = await colab_getListAllProyek()
|
||||||
<Colab_Beranda/>
|
|
||||||
</>
|
return (
|
||||||
|
<>
|
||||||
|
<Colab_Beranda listData={listData as any} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
@@ -6,13 +6,16 @@ import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_gl
|
|||||||
import { Card, Center, Title, Stack, Grid, Text } from "@mantine/core";
|
import { Card, Center, Title, Stack, Grid, Text } from "@mantine/core";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import { MODEL_COLLABORATION } from "../../model/interface";
|
||||||
|
|
||||||
export default function ComponentColab_CardSectionData({
|
export default function ComponentColab_CardSectionData({
|
||||||
colabId,
|
colabId,
|
||||||
path,
|
path,
|
||||||
|
data,
|
||||||
}: {
|
}: {
|
||||||
colabId?: any;
|
colabId?: any;
|
||||||
path?: any;
|
path?: any;
|
||||||
|
data?: MODEL_COLLABORATION;
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
@@ -30,7 +33,7 @@ export default function ComponentColab_CardSectionData({
|
|||||||
>
|
>
|
||||||
<Center px={"md"} mb={"lg"}>
|
<Center px={"md"} mb={"lg"}>
|
||||||
<Title order={5} lineClamp={1}>
|
<Title order={5} lineClamp={1}>
|
||||||
Judul Proyek{" "}
|
{data?.title ? data.title : "Judul Proyek"}
|
||||||
</Title>
|
</Title>
|
||||||
</Center>
|
</Center>
|
||||||
<Stack spacing={"xs"}>
|
<Stack spacing={"xs"}>
|
||||||
@@ -44,7 +47,11 @@ export default function ComponentColab_CardSectionData({
|
|||||||
<Text fz={"xs"}>:</Text>
|
<Text fz={"xs"}>:</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={"auto"}>
|
<Grid.Col span={"auto"}>
|
||||||
<Text fz={"xs"}>Industri</Text>
|
<Text fz={"xs"} lineClamp={1}>
|
||||||
|
{data?.ProjectCollaborationMaster_Industri.name
|
||||||
|
? data?.ProjectCollaborationMaster_Industri?.name
|
||||||
|
: "Industri"}
|
||||||
|
</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
@@ -59,7 +66,7 @@ export default function ComponentColab_CardSectionData({
|
|||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={"auto"}>
|
<Grid.Col span={"auto"}>
|
||||||
<Text fz={"xs"} lineClamp={1}>
|
<Text fz={"xs"} lineClamp={1}>
|
||||||
Lokasi dari proyek{" "}
|
{data?.lokasi ? data?.lokasi : "Lokasi dari proyek"}
|
||||||
</Text>
|
</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -69,10 +76,9 @@ export default function ComponentColab_CardSectionData({
|
|||||||
Tujuan proyek
|
Tujuan proyek
|
||||||
</Text>
|
</Text>
|
||||||
<Text lineClamp={3} fz={"xs"}>
|
<Text lineClamp={3} fz={"xs"}>
|
||||||
Lorem ipsum dolor sit amet consectetur adipisicing elit. Nam
|
{data?.purpose
|
||||||
repudiandae nostrum temporibus velit possimus, voluptate inventore
|
? data?.purpose
|
||||||
recusandae hic ipsa praesentium deserunt, fuga asperiores
|
: "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Maiores odio nihil in animi expedita, suscipit excepturi pariatur totam esse officiis enim cumque. Quidem, facere aliquam. Sunt laboriosam incidunt iste amet"}
|
||||||
doloremque amet incidunt explicabo ea eius earum.
|
|
||||||
</Text>
|
</Text>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -20,13 +20,13 @@ export default function ComponentColab_CardSectionHeaderAuthorName({
|
|||||||
authorName?: string;
|
authorName?: string;
|
||||||
tglPublish?: Date;
|
tglPublish?: Date;
|
||||||
isPembatas?: boolean;
|
isPembatas?: boolean;
|
||||||
jumlah_partisipan?: number;
|
jumlah_partisipan?: any[]
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Card.Section px={"md"} pb={"md"}>
|
<Card.Section px={"md"}>
|
||||||
<Stack spacing={"xs"}>
|
<Stack spacing={"xs"}>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.Col
|
<Grid.Col
|
||||||
@@ -60,11 +60,13 @@ export default function ComponentColab_CardSectionHeaderAuthorName({
|
|||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={"content"}>
|
<Grid.Col span={"content"}>
|
||||||
<Stack justify="center" h={"100%"}>
|
<Stack justify="center" h={"100%"}>
|
||||||
<Text c={"gray"} fz={"xs"}>
|
{tglPublish ? (
|
||||||
{jumlah_partisipan
|
<Text c={"gray"} fz={"xs"}>
|
||||||
? jumlah_partisipan + " " + "partisipan"
|
{new Intl.DateTimeFormat("id-ID").format(tglPublish)}
|
||||||
: 0 + " " + "partisipan"}
|
</Text>
|
||||||
</Text>
|
) : (
|
||||||
|
""
|
||||||
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { Stack, Divider, Center, Text, Grid, Card } from "@mantine/core";
|
||||||
|
import { IconUsersGroup } from "@tabler/icons-react";
|
||||||
|
|
||||||
|
export default function ComponentColab_JumlahPartisipan({
|
||||||
|
jumlah,
|
||||||
|
}: {
|
||||||
|
jumlah?: any[];
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Card.Section px={"md"}>
|
||||||
|
<Stack>
|
||||||
|
<Divider />
|
||||||
|
<Center>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={"content"}>
|
||||||
|
<Text c={"gray"} fz={"xs"} fw={"bold"}>
|
||||||
|
{jumlah?.length ? jumlah?.length : 0}
|
||||||
|
</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={"auto"}>
|
||||||
|
<Text c={"gray"} fz={"xs"} fw={"bold"}>
|
||||||
|
Partisipan
|
||||||
|
</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
</Center>
|
||||||
|
</Stack>
|
||||||
|
</Card.Section>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import { Stack, Divider, Center, Text, Grid } from "@mantine/core";
|
|
||||||
import { IconUsersGroup } from "@tabler/icons-react";
|
|
||||||
|
|
||||||
export default function ComponentColab_JumlahPartisipan() {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Stack>
|
|
||||||
<Divider />
|
|
||||||
<Center>
|
|
||||||
<Grid >
|
|
||||||
<Grid.Col span={"content"}>
|
|
||||||
<Text c={"gray"} fz={"xs"} fw={"bold"}>
|
|
||||||
12
|
|
||||||
</Text>
|
|
||||||
</Grid.Col>
|
|
||||||
<Grid.Col span={"auto"}>
|
|
||||||
<Text c={"gray"} fz={"xs"} fw={"bold"}>
|
|
||||||
Partisipan
|
|
||||||
</Text>
|
|
||||||
</Grid.Col>
|
|
||||||
</Grid>
|
|
||||||
</Center>
|
|
||||||
</Stack>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,15 +1,20 @@
|
|||||||
"use client"
|
"use client";
|
||||||
|
|
||||||
import { Stack, Box, Center, Title, Grid, Text } from "@mantine/core";
|
import { Stack, Box, Center, Title, Grid, Text } from "@mantine/core";
|
||||||
import ComponentColab_AuthorNameOnHeader from "../header_author_name";
|
import ComponentColab_AuthorNameOnHeader from "../header_author_name";
|
||||||
|
import { MODEL_COLLABORATION } from "../../model/interface";
|
||||||
|
|
||||||
export default function ComponentColab_DetailData() {
|
export default function ComponentColab_DetailData({
|
||||||
|
data,
|
||||||
|
}: {
|
||||||
|
data?: MODEL_COLLABORATION;
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Box>
|
<Box>
|
||||||
<Center px={"md"} mb={"lg"} >
|
<Center px={"md"} mb={"lg"}>
|
||||||
<Title order={4}>Judul Proyek </Title>
|
<Title order={4}>{data?.title ? data.title : "Judul Proyek"}</Title>
|
||||||
</Center>
|
</Center>
|
||||||
<Stack spacing={"sm"}>
|
<Stack spacing={"sm"}>
|
||||||
<Grid>
|
<Grid>
|
||||||
@@ -22,7 +27,11 @@ export default function ComponentColab_DetailData() {
|
|||||||
<Text fz={"sm"}>:</Text>
|
<Text fz={"sm"}>:</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={"auto"}>
|
<Grid.Col span={"auto"}>
|
||||||
<Text fz={"sm"}>Industri</Text>
|
<Text fz={"sm"}>
|
||||||
|
{data?.ProjectCollaborationMaster_Industri.name
|
||||||
|
? data.ProjectCollaborationMaster_Industri.name
|
||||||
|
: "Industri"}
|
||||||
|
</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
@@ -37,7 +46,7 @@ export default function ComponentColab_DetailData() {
|
|||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={"auto"}>
|
<Grid.Col span={"auto"}>
|
||||||
<Text fz={"sm"} lineClamp={1}>
|
<Text fz={"sm"} lineClamp={1}>
|
||||||
Lokasi dari proyek{" "}
|
{data?.lokasi ? data.lokasi : " Lokasi dari proyek"}
|
||||||
</Text>
|
</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -46,22 +55,14 @@ export default function ComponentColab_DetailData() {
|
|||||||
<Text fw={"bold"} fz={"sm"}>
|
<Text fw={"bold"} fz={"sm"}>
|
||||||
Tujuan proyek
|
Tujuan proyek
|
||||||
</Text>
|
</Text>
|
||||||
<Text fz={"sm"}>
|
<Text fz={"sm"}>{data?.purpose ? data?.purpose : "-"}</Text>
|
||||||
Lorem ipsum dolor sit amet consectetur adipisicing elit. Nam
|
|
||||||
repudiandae nostrum temporibus velit possimus, voluptate
|
|
||||||
inventore recusandae hic ipsa praesentium deserunt, fuga
|
|
||||||
asperiores doloremque amet incidunt explicabo ea eius earum.
|
|
||||||
</Text>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack spacing={5}>
|
<Stack spacing={5}>
|
||||||
<Text fw={"bold"} fz={"sm"}>
|
<Text fw={"bold"} fz={"sm"}>
|
||||||
Keutungan
|
Keutungan
|
||||||
</Text>
|
</Text>
|
||||||
<Text fz={"sm"}>
|
<Text fz={"sm"}>
|
||||||
Lorem ipsum dolor sit amet consectetur adipisicing elit. Nam
|
{data?.benefit ? data?.benefit : "-"}
|
||||||
repudiandae nostrum temporibus velit possimus, voluptate
|
|
||||||
inventore recusandae hic ipsa praesentium deserunt, fuga
|
|
||||||
asperiores doloremque amet incidunt explicabo ea eius earum.
|
|
||||||
</Text>
|
</Text>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -69,4 +70,4 @@ export default function ComponentColab_DetailData() {
|
|||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,29 +1,113 @@
|
|||||||
"use client"
|
"use client";
|
||||||
|
|
||||||
import { Paper, Center, Title, ScrollArea, Box, Stack } from "@mantine/core";
|
import {
|
||||||
|
Paper,
|
||||||
|
Center,
|
||||||
|
Title,
|
||||||
|
ScrollArea,
|
||||||
|
Box,
|
||||||
|
Stack,
|
||||||
|
Text,
|
||||||
|
Divider,
|
||||||
|
Button,
|
||||||
|
} from "@mantine/core";
|
||||||
import ComponentColab_AuthorNameOnHeader from "../header_author_name";
|
import ComponentColab_AuthorNameOnHeader from "../header_author_name";
|
||||||
|
import {
|
||||||
|
MODEL_COLLABORATION_MASTER,
|
||||||
|
MODEL_COLLABORATION_PARTISIPASI,
|
||||||
|
} from "../../model/interface";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { useState } from "react";
|
||||||
|
import colab_funCreatePartisipan from "../../fun/create/fun_create_partisipan_by_user_id";
|
||||||
|
import colab_getListPartisipanById from "../../fun/get/get_list_partisipan_by_id";
|
||||||
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||||
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
||||||
|
|
||||||
|
export default function ComponentColab_DetailListPartisipasiUser({
|
||||||
|
listPartisipan,
|
||||||
|
userLoginId,
|
||||||
|
authorId,
|
||||||
|
colabId,
|
||||||
|
cekPartisipan,
|
||||||
|
}: {
|
||||||
|
listPartisipan?: MODEL_COLLABORATION_PARTISIPASI[];
|
||||||
|
userLoginId?: string;
|
||||||
|
authorId?: string;
|
||||||
|
colabId?: string;
|
||||||
|
cekPartisipan?: boolean;
|
||||||
|
}) {
|
||||||
|
const [apply, setApply] = useState(false);
|
||||||
|
const [data, setData] = useState(listPartisipan);
|
||||||
|
|
||||||
|
async function onJoin() {
|
||||||
|
await colab_funCreatePartisipan(colabId as any, userLoginId as any).then(
|
||||||
|
async (res) => {
|
||||||
|
if (res.status === 201) {
|
||||||
|
await colab_getListPartisipanById(colabId as any).then((val) => {
|
||||||
|
setApply(true);
|
||||||
|
setData(val as any);
|
||||||
|
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export default function ComponentColab_DetailListPartisipasiUser() {
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Paper withBorder p={"md"}>
|
{/* <pre>{JSON.stringify(data, null, 2)}</pre> */}
|
||||||
<Center mb={"xl"}>
|
<Stack>
|
||||||
<Title order={4}>Partispasi User (12)</Title>
|
{userLoginId !== authorId ? (
|
||||||
</Center>{" "}
|
<Center>
|
||||||
<ScrollArea h={400}>
|
<Button
|
||||||
<Box h={400}>
|
radius={"xl"}
|
||||||
<Stack>
|
disabled={cekPartisipan ? true : false}
|
||||||
{Array(10)
|
color={cekPartisipan ? "green" : "blue"}
|
||||||
.fill(0)
|
onClick={() => {
|
||||||
.map((e, i) => (
|
onJoin();
|
||||||
<Box key={i}>
|
}}
|
||||||
<ComponentColab_AuthorNameOnHeader isPembatas={true} />
|
>
|
||||||
</Box>
|
{cekPartisipan ? "Telah Berpartisipasi" : "Partisipasi"}
|
||||||
))}
|
</Button>
|
||||||
</Stack>
|
</Center>
|
||||||
</Box>
|
) : (
|
||||||
</ScrollArea>
|
""
|
||||||
</Paper>
|
)}
|
||||||
|
|
||||||
|
<Paper withBorder p={"md"}>
|
||||||
|
<Stack spacing={"xl"}>
|
||||||
|
<Center>
|
||||||
|
<Title order={5}>Partispasi User ({data?.length})</Title>
|
||||||
|
</Center>{" "}
|
||||||
|
<ScrollArea h={data?.length === 0 ? 30 : 400}>
|
||||||
|
<Box>
|
||||||
|
<Stack>
|
||||||
|
{data?.length === 0 ? (
|
||||||
|
<Center>
|
||||||
|
<Text fz={"xs"} fw={"bold"} c={"gray"}>
|
||||||
|
Tidak ada partisipan
|
||||||
|
</Text>
|
||||||
|
</Center>
|
||||||
|
) : (
|
||||||
|
data?.map((e, i) => (
|
||||||
|
<Box key={i}>
|
||||||
|
<ComponentColab_AuthorNameOnHeader
|
||||||
|
isPembatas={true}
|
||||||
|
authorName={e?.User.Profile.name}
|
||||||
|
imagesId={e?.User?.Profile?.imagesId}
|
||||||
|
profileId={e?.User?.Profile?.id}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
</Box>
|
||||||
|
</ScrollArea>
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
</Stack>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,15 @@ import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
|
|||||||
import { Button, Select, Stack, TextInput, Textarea } from "@mantine/core";
|
import { Button, Select, Stack, TextInput, Textarea } from "@mantine/core";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { MODEL_COLLABORATION_MASTER } from "../model/interface";
|
import {
|
||||||
|
MODEL_COLLABORATION,
|
||||||
|
MODEL_COLLABORATION_MASTER,
|
||||||
|
} from "../model/interface";
|
||||||
import colab_funCreateProyek from "../fun/create/fun_create_proyek";
|
import colab_funCreateProyek from "../fun/create/fun_create_proyek";
|
||||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
|
||||||
|
|
||||||
export default function Colab_Create({
|
export default function Colab_Create({
|
||||||
listIndustri,
|
listIndustri,
|
||||||
@@ -80,7 +85,6 @@ export default function Colab_Create({
|
|||||||
<Textarea
|
<Textarea
|
||||||
label="Keuntungan "
|
label="Keuntungan "
|
||||||
placeholder="Masukan keuntungan dalam proyek"
|
placeholder="Masukan keuntungan dalam proyek"
|
||||||
withAsterisk
|
|
||||||
minRows={5}
|
minRows={5}
|
||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
setValue({
|
setValue({
|
||||||
@@ -89,7 +93,7 @@ export default function Colab_Create({
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ButtonAction value={value} />
|
<ButtonAction value={value as any} />
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@@ -100,13 +104,22 @@ function ButtonAction({ value }: { value: any }) {
|
|||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
async function onSave() {
|
async function onSave() {
|
||||||
|
if (value.title === "")
|
||||||
|
return ComponentGlobal_NotifikasiPeringatan("Lengkapi Data");
|
||||||
|
if (value.lokasi === "")
|
||||||
|
return ComponentGlobal_NotifikasiPeringatan("Lengkapi Data");
|
||||||
|
if (value.purpose === "")
|
||||||
|
return ComponentGlobal_NotifikasiPeringatan("Lengkapi Data");
|
||||||
|
if (value.projectCollaborationMaster_IndustriId === 0)
|
||||||
|
return ComponentGlobal_NotifikasiPeringatan("Pilih Industri");
|
||||||
|
|
||||||
await colab_funCreateProyek(value).then((res) => {
|
await colab_funCreateProyek(value).then((res) => {
|
||||||
if (res.status === 201) {
|
if (res.status === 201) {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
router.back();
|
router.back();
|
||||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||||
} else {
|
} else {
|
||||||
ComponentGlobal_NotifikasiGagal(res.message)
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,15 +17,36 @@ import { useState } from "react";
|
|||||||
import ComponentColab_ButtonPartisipasi from "../../component/detail/button_partisipasi";
|
import ComponentColab_ButtonPartisipasi from "../../component/detail/button_partisipasi";
|
||||||
import ComponentColab_DetailListPartisipasiUser from "../../component/detail/list_partisipasi_user";
|
import ComponentColab_DetailListPartisipasiUser from "../../component/detail/list_partisipasi_user";
|
||||||
import ComponentColab_DetailData from "../../component/detail/detail_data";
|
import ComponentColab_DetailData from "../../component/detail/detail_data";
|
||||||
|
import { MODEL_COLLABORATION } from "../../model/interface";
|
||||||
|
|
||||||
export default function Colab_MainDetail() {
|
export default function Colab_MainDetail({
|
||||||
|
dataColab,
|
||||||
|
userLoginId,
|
||||||
|
listPartisipan,
|
||||||
|
cekPartisipan,
|
||||||
|
}: {
|
||||||
|
dataColab?: MODEL_COLLABORATION;
|
||||||
|
userLoginId?: string;
|
||||||
|
listPartisipan?: any[];
|
||||||
|
cekPartisipan: boolean
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack px={5} spacing={"lg"}>
|
<Stack px={5} spacing={"xl"}>
|
||||||
<ComponentColab_AuthorNameOnHeader tglPublish={new Date}/>
|
<ComponentColab_AuthorNameOnHeader
|
||||||
<ComponentColab_DetailData />
|
tglPublish={new Date()}
|
||||||
<ComponentColab_ButtonPartisipasi />
|
authorName={dataColab?.Author?.Profile?.name}
|
||||||
<ComponentColab_DetailListPartisipasiUser />
|
imagesId={dataColab?.Author?.Profile?.imagesId}
|
||||||
|
profileId={dataColab?.Author?.Profile?.id}
|
||||||
|
/>
|
||||||
|
<ComponentColab_DetailData data={dataColab} />
|
||||||
|
<ComponentColab_DetailListPartisipasiUser
|
||||||
|
listPartisipan={listPartisipan}
|
||||||
|
userLoginId={userLoginId}
|
||||||
|
authorId={dataColab?.Author.id}
|
||||||
|
colabId={dataColab?.id}
|
||||||
|
cekPartisipan={cekPartisipan}
|
||||||
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
|
||||||
|
import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
|
export default async function colab_funCreatePartisipan(
|
||||||
|
colabId: string,
|
||||||
|
userId: string
|
||||||
|
) {
|
||||||
|
const create = await prisma.projectCollaboration_Partisipasi.create({
|
||||||
|
data: {
|
||||||
|
projectCollaborationId: colabId,
|
||||||
|
userId: userId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!create) return { status: 400, message: "Gagal menambahkan partisipan" };
|
||||||
|
revalidatePath(RouterColab.main_detail + colabId);
|
||||||
|
return { status: 201, message: "Berhasil menambahkan partisipan" };
|
||||||
|
}
|
||||||
@@ -3,12 +3,13 @@
|
|||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
import { MODEL_COLLABORATION } from "../../model/interface";
|
import { MODEL_COLLABORATION } from "../../model/interface";
|
||||||
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
|
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
|
||||||
|
import { revalidatePath } from "next/cache";
|
||||||
|
import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
|
||||||
|
|
||||||
export default async function colab_funCreateProyek(
|
export default async function colab_funCreateProyek(
|
||||||
value: MODEL_COLLABORATION
|
value: MODEL_COLLABORATION
|
||||||
) {
|
) {
|
||||||
const Author = await User_getUserId();
|
const AuthorId = await User_getUserId();
|
||||||
console.log(Author);
|
|
||||||
|
|
||||||
const create = await prisma.projectCollaboration.create({
|
const create = await prisma.projectCollaboration.create({
|
||||||
data: {
|
data: {
|
||||||
@@ -18,10 +19,11 @@ export default async function colab_funCreateProyek(
|
|||||||
benefit: value.benefit,
|
benefit: value.benefit,
|
||||||
projectCollaborationMaster_IndustriId:
|
projectCollaborationMaster_IndustriId:
|
||||||
value.projectCollaborationMaster_IndustriId,
|
value.projectCollaborationMaster_IndustriId,
|
||||||
userId: Author
|
userId: AuthorId
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!create) return { status: 400, message: "Gagal Membuat Proyek" };
|
if (!create) return { status: 400, message: "Gagal Membuat Proyek" };
|
||||||
|
revalidatePath(RouterColab.beranda)
|
||||||
return { status: 201, message: "Berhasil Membuar Proyek" };
|
return { status: 201, message: "Berhasil Membuar Proyek" };
|
||||||
}
|
}
|
||||||
|
|||||||
22
src/app_modules/colab/fun/get/cek_partisipasi_by_user_id.ts
Normal file
22
src/app_modules/colab/fun/get/cek_partisipasi_by_user_id.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
|
||||||
|
|
||||||
|
export default async function colab_funCekPartisipasiById(colabId: string) {
|
||||||
|
const UserLoginId = await User_getUserId();
|
||||||
|
|
||||||
|
const cek = await prisma.projectCollaboration_Partisipasi.findFirst({
|
||||||
|
where: {
|
||||||
|
projectCollaborationId: colabId,
|
||||||
|
userId: UserLoginId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
if (cek === null) {
|
||||||
|
return (false);
|
||||||
|
} else {
|
||||||
|
return (true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,36 @@
|
|||||||
"use server"
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
|
||||||
export default async function colab_getListAllProyek() {
|
export default async function colab_getListAllProyek() {
|
||||||
|
const data = await prisma.projectCollaboration.findMany({
|
||||||
}
|
orderBy: {
|
||||||
|
updatedAt: "desc",
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
projectCollaborationMaster_StatusId: 1,
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
isActive: true,
|
||||||
|
title: true,
|
||||||
|
lokasi: true,
|
||||||
|
purpose: true,
|
||||||
|
benefit: true,
|
||||||
|
Author: {
|
||||||
|
select: {
|
||||||
|
Profile: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
ProjectCollaborationMaster_Industri: true,
|
||||||
|
ProjectCollaboration_Partisipasi: {
|
||||||
|
where: {
|
||||||
|
isActive: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|||||||
5
src/app_modules/colab/fun/get/get_list_by_status_id.ts
Normal file
5
src/app_modules/colab/fun/get/get_list_by_status_id.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
"use server"
|
||||||
|
|
||||||
|
export default async function colab_getListByStatusId(statusId: string, colabId: string) {
|
||||||
|
|
||||||
|
}
|
||||||
22
src/app_modules/colab/fun/get/get_list_partisipan_by_id.ts
Normal file
22
src/app_modules/colab/fun/get/get_list_partisipan_by_id.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
|
||||||
|
export default async function colab_getListPartisipanById(colabId: string) {
|
||||||
|
const data = await prisma.projectCollaboration_Partisipasi.findMany({
|
||||||
|
where: {
|
||||||
|
projectCollaborationId: colabId,
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
User: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
Profile: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
33
src/app_modules/colab/fun/get/get_one_by_id.ts
Normal file
33
src/app_modules/colab/fun/get/get_one_by_id.ts
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
|
||||||
|
export default async function colab_getOneCollaborationById(colabId: string) {
|
||||||
|
const data = await prisma.projectCollaboration.findFirst({
|
||||||
|
where: {
|
||||||
|
id: colabId,
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
isActive: true,
|
||||||
|
title: true,
|
||||||
|
lokasi: true,
|
||||||
|
purpose: true,
|
||||||
|
benefit: true,
|
||||||
|
Author: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
Profile: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
ProjectCollaborationMaster_Industri: true,
|
||||||
|
ProjectCollaboration_Partisipasi: {
|
||||||
|
where: {
|
||||||
|
isActive: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
@@ -24,8 +24,14 @@ import ComponentColab_CardSectionData from "../component/card_view/card_section_
|
|||||||
import ComponentColab_SectionHeaderAuthorName from "../component/card_view/card_section_header_author_name";
|
import ComponentColab_SectionHeaderAuthorName from "../component/card_view/card_section_header_author_name";
|
||||||
import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2";
|
import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2";
|
||||||
import ComponentColab_CardSectionHeaderAuthorName from "../component/card_view/card_section_header_author_name";
|
import ComponentColab_CardSectionHeaderAuthorName from "../component/card_view/card_section_header_author_name";
|
||||||
|
import { MODEL_COLLABORATION } from "../model/interface";
|
||||||
|
import ComponentColab_JumlahPartisipan from "../component/card_view/card_section_jumlah_partisipan";
|
||||||
|
|
||||||
export default function Colab_Beranda() {
|
export default function Colab_Beranda({
|
||||||
|
listData,
|
||||||
|
}: {
|
||||||
|
listData: MODEL_COLLABORATION[];
|
||||||
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [scroll, scrollTo] = useWindowScroll();
|
const [scroll, scrollTo] = useWindowScroll();
|
||||||
const [loadingCreate, setLoadingCreate] = useState(false);
|
const [loadingCreate, setLoadingCreate] = useState(false);
|
||||||
@@ -52,17 +58,27 @@ export default function Colab_Beranda() {
|
|||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
</Affix>
|
</Affix>
|
||||||
|
|
||||||
{Array(5)
|
{/* <pre>{JSON.stringify(listData, null, 2)}</pre> */}
|
||||||
.fill(0)
|
|
||||||
.map((e, i) => (
|
{listData.map((e, i) => (
|
||||||
<Card key={i} withBorder shadow="lg" mb={"lg"} radius={"md"}>
|
<Card key={e.id} withBorder shadow="lg" mb={"lg"} radius={"md"}>
|
||||||
<ComponentColab_CardSectionHeaderAuthorName tglPublish={new Date} jumlah_partisipan={12} />
|
<Stack>
|
||||||
<ComponentColab_CardSectionData
|
<ComponentColab_CardSectionHeaderAuthorName
|
||||||
colabId={i}
|
authorName={e?.Author?.Profile?.name}
|
||||||
path={RouterColab.main_detail}
|
imagesId={e?.Author?.Profile?.imagesId}
|
||||||
|
profileId={e?.Author?.Profile?.id}
|
||||||
|
tglPublish={new Date()}
|
||||||
|
jumlah_partisipan={e?.ProjectCollaboration_Partisipasi}
|
||||||
/>
|
/>
|
||||||
</Card>
|
<ComponentColab_CardSectionData
|
||||||
))}
|
colabId={e.id}
|
||||||
|
path={RouterColab.main_detail}
|
||||||
|
data={e}
|
||||||
|
/>
|
||||||
|
<ComponentColab_JumlahPartisipan jumlah={e.ProjectCollaboration_Partisipasi} />
|
||||||
|
</Stack>
|
||||||
|
</Card>
|
||||||
|
))}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export default function Colab_PartisipasiProyek() {
|
|||||||
>
|
>
|
||||||
<ComponentColab_CardSectionHeaderAuthorName
|
<ComponentColab_CardSectionHeaderAuthorName
|
||||||
tglPublish={new Date()}
|
tglPublish={new Date()}
|
||||||
jumlah_partisipan={12}
|
jumlah_partisipan={[]}
|
||||||
/>
|
/>
|
||||||
<ComponentColab_CardSectionData
|
<ComponentColab_CardSectionData
|
||||||
colabId={i}
|
colabId={i}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
|
|||||||
import { Card, Stack } from "@mantine/core";
|
import { Card, Stack } from "@mantine/core";
|
||||||
import ComponentColab_CardSectionData from "../../component/card_view/card_section_data";
|
import ComponentColab_CardSectionData from "../../component/card_view/card_section_data";
|
||||||
import ComponentColab_CardSectionHeaderAuthorName from "../../component/card_view/card_section_header_author_name";
|
import ComponentColab_CardSectionHeaderAuthorName from "../../component/card_view/card_section_header_author_name";
|
||||||
import ComponentColab_JumlahPartisipan from "../../component/card_view/jumlah_partisipan";
|
import ComponentColab_JumlahPartisipan from "../../component/card_view/card_section_jumlah_partisipan";
|
||||||
|
|
||||||
export default function Colab_ProyekSaya() {
|
export default function Colab_ProyekSaya() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import ComponentColab_CardSectionData from "../../component/card_view/card_secti
|
|||||||
import ComponentColab_AuthorNameOnHeader from "../../component/header_author_name";
|
import ComponentColab_AuthorNameOnHeader from "../../component/header_author_name";
|
||||||
import ComponentColab_CardSectionHeaderAuthorName from "../../component/card_view/card_section_header_author_name";
|
import ComponentColab_CardSectionHeaderAuthorName from "../../component/card_view/card_section_header_author_name";
|
||||||
import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
|
import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
|
||||||
import ComponentColab_JumlahPartisipan from "../../component/card_view/jumlah_partisipan";
|
import ComponentColab_JumlahPartisipan from "../../component/card_view/card_section_jumlah_partisipan";
|
||||||
|
|
||||||
export default function Colab_StatusPublish() {
|
export default function Colab_StatusPublish() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -18,10 +18,21 @@ export interface MODEL_COLLABORATION {
|
|||||||
lokasi: string;
|
lokasi: string;
|
||||||
purpose: string;
|
purpose: string;
|
||||||
benefit: string;
|
benefit: string;
|
||||||
ProjectCollaborationMaster_Industri: MODEL_COLLABORATION_MASTER[];
|
ProjectCollaborationMaster_Industri: MODEL_COLLABORATION_MASTER;
|
||||||
projectCollaborationMaster_IndustriId: number;
|
projectCollaborationMaster_IndustriId: number;
|
||||||
Author: MODEL_USER;
|
Author: MODEL_USER;
|
||||||
ProjectCollaborationMaster_Status: MODEL_COLLABORATION_MASTER[];
|
ProjectCollaborationMaster_Status: MODEL_COLLABORATION_MASTER;
|
||||||
projectCollaborationMaster_StatusId: number
|
projectCollaborationMaster_StatusId: number;
|
||||||
// ProjectCollaboration_Partisipasi
|
ProjectCollaboration_Partisipasi: any[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MODEL_COLLABORATION_PARTISIPASI {
|
||||||
|
id: string;
|
||||||
|
isActive: boolean;
|
||||||
|
createdAt: Date;
|
||||||
|
updatedAt: Date;
|
||||||
|
userId: string;
|
||||||
|
User: MODEL_USER;
|
||||||
|
projectCollaborationId: string;
|
||||||
|
projectCollaboration_RoomChatId: string;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user