Merge pull request #56 from bipproduction/colab/create

Colab/create
This commit is contained in:
Bagasbanuna02
2024-04-18 14:18:23 +08:00
committed by GitHub
58 changed files with 1221 additions and 242 deletions

View File

@@ -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?

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

@@ -3,12 +3,17 @@ import React from "react";
export default async function Layout({ export default async function Layout({
children, children,
params,
}: { }: {
children: React.ReactNode; children: React.ReactNode;
params: { id: string };
}) { }) {
const colabId = params.id;
return ( return (
<> <>
<LayoutColab_MainDetail>{children}</LayoutColab_MainDetail> <LayoutColab_MainDetail colabId={colabId}>
{children}
</LayoutColab_MainDetail>
</> </>
); );
} }

View File

@@ -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}
/>
</> </>
); );
} }

View File

@@ -1,9 +1,18 @@
import { Colab_DetailPartisipasiProyek } from "@/app_modules/colab"; import { Colab_DetailPartisipasiProyek } from "@/app_modules/colab";
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";
export default async function Page({params}: {params: {id: string}}) {
const colabId = params.id
const dataColab = await colab_getOneCollaborationById(colabId)
const listPartisipan = await colab_getListPartisipanById(colabId)
export default async function Page() {
return ( return (
<> <>
<Colab_DetailPartisipasiProyek /> <Colab_DetailPartisipasiProyek
dataColab={dataColab as any}
listPartisipan={listPartisipan as any}
/>
</> </>
); );
} }

View File

@@ -0,0 +1,14 @@
import { LayoutColab_DetailProyekSaya } from "@/app_modules/colab";
import React from "react";
export default async function Layout({
children,
}: {
children: React.ReactNode;
}) {
return (
<>
<LayoutColab_DetailProyekSaya>{children}</LayoutColab_DetailProyekSaya>
</>
);
}

View File

@@ -0,0 +1,20 @@
import { Colab_DetailProyekSaya } from "@/app_modules/colab";
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";
export default async function Page({ params }: { params: { id: string } }) {
const colabId = params.id
const dataColab = await colab_getOneCollaborationById(colabId)
const listPartisipan = await colab_getListPartisipanById(colabId);
return (
<>
{/* <pre>{JSON.stringify(listPartisipan, null,2)}</pre> */}
<Colab_DetailProyekSaya
dataColab={dataColab as any}
listPartisipan={listPartisipan as any}
/>
</>
);
}

View File

@@ -1,7 +1,21 @@
import { Colab_Edit } from "@/app_modules/colab"; import { Colab_Edit } from "@/app_modules/colab";
import colab_getOneCollaborationById from "@/app_modules/colab/fun/get/get_one_by_id";
import colab_funGetMasterIndustri from "@/app_modules/colab/fun/master/fun_get_master_industri";
import _ from "lodash";
export default async function Page(){ export default async function Page({ params }: { params: { id: string } }) {
return<> const colabId = params.id;
<Colab_Edit/> const dataColab = await colab_getOneCollaborationById(colabId);
const selectedData = _.omit(dataColab, [
"ProjectCollaboration_Partisipasi",
"Author",
]);
// console.log(selectedData);
const listIndustri = await colab_funGetMasterIndustri()
return (
<>
<Colab_Edit selectedData={selectedData as any} listIndustri={listIndustri as any} />
</> </>
);
} }

View File

@@ -1,7 +1,14 @@
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";
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
export default async function Page() { export default async function Page() {
return<> const listData = await colab_getListAllProyek();
<Colab_Beranda/> const userLoginId = await User_getUserId();
return (
<>
<Colab_Beranda listData={listData as any} userLoginId={userLoginId} />
</> </>
);
} }

View File

@@ -0,0 +1,9 @@
import { Colab_NotifikasiView } from "@/app_modules/colab";
export default async function Page() {
return (
<>
<Colab_NotifikasiView />
</>
);
}

View File

@@ -1,10 +1,17 @@
import { Colab_Proyek } from "@/app_modules/colab"; import { Colab_Proyek } from "@/app_modules/colab";
import colab_getListPartisipasiByAuthorId from "@/app_modules/colab/fun/get/get_list_partisipasi_by_author_id";
import colab_getListAllProyekByAuthorId from "@/app_modules/colab/fun/get/get_list_proyek_by_author_id";
export default async function Page() { export default async function Page() {
const listPartisipasiUser = (await colab_getListPartisipasiByAuthorId()).data;
const listProyekSaya = (await colab_getListAllProyekByAuthorId()).data;
return ( return (
<> <>
<Colab_Proyek /> <Colab_Proyek
listPartisipasiUser={listPartisipasiUser as any}
listProyekSaya={listProyekSaya as any}
/>
</> </>
); );
} }

View File

@@ -1,9 +1,19 @@
import { Colab_Status } from "@/app_modules/colab"; import { Colab_Status } from "@/app_modules/colab";
import colab_getListByStatusId from "@/app_modules/colab/fun/get/get_list_by_status_id";
export default async function Page() { export default async function Page() {
const listPublish = (await colab_getListByStatusId(1)).data;
const listReview = (await colab_getListByStatusId(2)).data;
const listReject = (await colab_getListByStatusId(3)).data;
return ( return (
<> <>
<Colab_Status /> <Colab_Status
listPublish={listPublish as any}
listReview={listReview as any}
listReject={listReject as any}
/>
</> </>
); );
} }

View File

@@ -7,6 +7,7 @@ export const RouterColab = {
status: "/dev/colab/main/status", status: "/dev/colab/main/status",
proyek: "/dev/colab/main/proyek", proyek: "/dev/colab/main/proyek",
grup_diskusi: "/dev/colab/main/grup", grup_diskusi: "/dev/colab/main/grup",
notifikasi: "/dev/colab/main/notifikasi",
// create // create
create: "/dev/colab/create", create: "/dev/colab/create",
@@ -17,7 +18,8 @@ export const RouterColab = {
status_review: "/dev/colab/detail/status/review/", status_review: "/dev/colab/detail/status/review/",
status_reject: "/dev/colab/detail/status/reject/", status_reject: "/dev/colab/detail/status/reject/",
status_publish: "/dev/colab/detail/status/publish/", status_publish: "/dev/colab/detail/status/publish/",
partisipasi_proyek: "/dev/colab/detail/proyek/partisipasi/", detail_partisipasi_proyek: "/dev/colab/detail/proyek/partisipasi/",
detail_proyek_saya: "/dev/colab/detail/proyek/saya/",
detail_grup: "/dev/colab/detail/grup/", detail_grup: "/dev/colab/detail/grup/",
// proyek // proyek

View File

@@ -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>

View File

@@ -1,32 +1,45 @@
"use client"; "use client";
import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/component_global/author_name_on_header"; import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/component_global/author_name_on_header";
import { Avatar, Card, Divider, Grid, Stack, Text } from "@mantine/core"; import {
ActionIcon,
Avatar,
Card,
Divider,
Grid,
Menu,
Stack,
Text,
} from "@mantine/core";
import ComponentColab_AuthorNameOnHeader from "../header_author_name"; import ComponentColab_AuthorNameOnHeader from "../header_author_name";
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog"; import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan"; import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { IconDots, IconEdit } from "@tabler/icons-react";
import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
import { useDisclosure } from "@mantine/hooks";
import { useState } from "react";
export default function ComponentColab_CardSectionHeaderAuthorName({ export default function ComponentColab_CardSectionHeaderAuthorName({
profileId, profileId,
imagesId, imagesId,
authorName, authorName,
tglPublish,
isPembatas, isPembatas,
jumlah_partisipan, isAuthor,
colabId,
}: { }: {
profileId?: string; profileId?: string;
imagesId?: string; imagesId?: string;
authorName?: string; authorName?: string;
tglPublish?: Date;
isPembatas?: boolean; isPembatas?: boolean;
jumlah_partisipan?: number; isAuthor?: boolean;
colabId?: string;
}) { }) {
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
@@ -59,13 +72,10 @@ export default function ComponentColab_CardSectionHeaderAuthorName({
</Stack> </Stack>
</Grid.Col> </Grid.Col>
<Grid.Col span={"content"}> <Grid.Col span={"content"}>
<Stack justify="center" h={"100%"}> <ButtonAction
<Text c={"gray"} fz={"xs"}> isAuthor={isAuthor as any}
{jumlah_partisipan colabId={colabId as any}
? jumlah_partisipan + " " + "partisipan" />
: 0 + " " + "partisipan"}
</Text>
</Stack>
</Grid.Col> </Grid.Col>
</Grid> </Grid>
{isPembatas ? <Divider /> : ""} {isPembatas ? <Divider /> : ""}
@@ -74,3 +84,45 @@ export default function ComponentColab_CardSectionHeaderAuthorName({
</> </>
); );
} }
function ButtonAction({
isAuthor,
colabId,
}: {
isAuthor: boolean;
colabId: string;
}) {
const router = useRouter();
const [opened, setOpened] = useState(false);
return (
<>
<Menu
opened={opened}
onChange={setOpened}
position="left-start"
offset={0}
shadow="lg"
withArrow
arrowPosition="center"
>
<Menu.Target >
<Stack justify="center" h={"100%"} >
<ActionIcon variant="transparent">
{isAuthor ? <IconDots size={20} /> : ""}
</ActionIcon>
</Stack>
</Menu.Target>
<Menu.Dropdown bg={"gray.1"} >
<Menu.Item
icon={<IconEdit size={15} />}
onClick={() => {
router.push(RouterColab.edit + colabId);
}}
>
Edit
</Menu.Item>
</Menu.Dropdown>
</Menu>
</>
);
}

View File

@@ -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>
</>
);
}

View File

@@ -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>
</>
);
}

View File

@@ -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>

View File

@@ -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>
</> </>
); );
} }

View File

@@ -0,0 +1,13 @@
"use client";
import { Center } from "@mantine/core";
export default function ComponentColab_IsEmptyData({ text }: { text: string }) {
return (
<>
<Center h={"50vh"} fz={"sm"} c="gray" fw={"bold"}>
{text}
</Center>
</>
);
}

View File

@@ -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);
} }
}); });
} }

View File

@@ -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>
</> </>
); );

View File

@@ -3,16 +3,26 @@
import { AppShell } from "@mantine/core"; import { AppShell } from "@mantine/core";
import React from "react"; import React from "react";
import ComponentColab_HeaderTamplate from "../../component/header_tamplate"; import ComponentColab_HeaderTamplate from "../../component/header_tamplate";
import { IconEdit } from "@tabler/icons-react";
import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
export default function LayoutColab_MainDetail({ export default function LayoutColab_MainDetail({
children, children,
colabId,
}: { }: {
children: React.ReactNode; children: React.ReactNode;
colabId: string;
}) { }) {
return ( return (
<> <>
<AppShell <AppShell
header={<ComponentColab_HeaderTamplate title="Detail" />} header={
<ComponentColab_HeaderTamplate
title="Detail"
icon={<IconEdit />}
route2={RouterColab.edit + colabId}
/>
}
> >
{children} {children}
</AppShell> </AppShell>

View File

@@ -3,15 +3,28 @@
import ComponentColab_DetailData from "@/app_modules/colab/component/detail/detail_data"; import ComponentColab_DetailData from "@/app_modules/colab/component/detail/detail_data";
import ComponentColab_DetailListPartisipasiUser from "@/app_modules/colab/component/detail/list_partisipasi_user"; import ComponentColab_DetailListPartisipasiUser from "@/app_modules/colab/component/detail/list_partisipasi_user";
import ComponentColab_AuthorNameOnHeader from "@/app_modules/colab/component/header_author_name"; import ComponentColab_AuthorNameOnHeader from "@/app_modules/colab/component/header_author_name";
import { MODEL_COLLABORATION, MODEL_COLLABORATION_PARTISIPASI } from "@/app_modules/colab/model/interface";
import { Stack, Text } from "@mantine/core"; import { Stack, Text } from "@mantine/core";
export default function Colab_DetailPartisipasiProyek() { export default function Colab_DetailPartisipasiProyek({
dataColab,
listPartisipan,
}: {
dataColab: MODEL_COLLABORATION;
listPartisipan: MODEL_COLLABORATION_PARTISIPASI[]
}) {
return ( return (
<> <>
<Stack px={5} spacing={"xl"}> <Stack px={5} spacing={"xl"}>
<ComponentColab_AuthorNameOnHeader /> {/* <pre>{JSON.stringify(dataColab, null,2)}</pre> */}
<ComponentColab_DetailData /> <ComponentColab_AuthorNameOnHeader
<ComponentColab_DetailListPartisipasiUser /> authorName={dataColab?.Author.Profile.name}
profileId={dataColab?.Author.Profile.id}
imagesId={dataColab?.Author.Profile.imagesId}
tglPublish={dataColab?.createdAt}
/>
<ComponentColab_DetailData data={dataColab} />
<ComponentColab_DetailListPartisipasiUser listPartisipan={listPartisipan} />
</Stack> </Stack>
</> </>
); );

View File

@@ -0,0 +1,184 @@
"use client";
import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
import ComponentColab_DetailData from "@/app_modules/colab/component/detail/detail_data";
import ComponentColab_AuthorNameOnHeader from "@/app_modules/colab/component/header_author_name";
import { gs_colab_hot_menu } from "@/app_modules/colab/global_state";
import {
MODEL_COLLABORATION,
MODEL_COLLABORATION_PARTISIPASI,
} from "@/app_modules/colab/model/interface";
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
import {
Button,
Checkbox,
Drawer,
Grid,
Group,
Paper,
ScrollArea,
Stack,
Text,
TextInput,
Title,
} from "@mantine/core";
import { useDisclosure } from "@mantine/hooks";
import { useAtom } from "jotai";
import _ from "lodash";
import { useRouter } from "next/navigation";
import { useState } from "react";
export default function Colab_DetailProyekSaya({
dataColab,
listPartisipan,
}: {
dataColab: MODEL_COLLABORATION;
listPartisipan: MODEL_COLLABORATION_PARTISIPASI[];
}) {
return (
<>
<Stack px={5} spacing={"xl"}>
<ComponentColab_DetailData data={dataColab} />
<CheckBoxPartisipan listPartisipan={listPartisipan} />
</Stack>
</>
);
}
function CheckBoxPartisipan({
listPartisipan,
}: {
listPartisipan: MODEL_COLLABORATION_PARTISIPASI[];
}) {
const router = useRouter();
const [value, setValue] = useState<string[]>([]);
const [opened, { open, close }] = useDisclosure(false);
const [hotMenu, setHotMenu] = useAtom(gs_colab_hot_menu);
const listCheck = [
{
id: 1,
value: "satu",
label: "Satu",
},
{
id: 2,
value: "dua",
label: "Dua",
},
{
id: 3,
value: "tiga",
label: "Tiga",
},
{
id: 4,
value: "empat",
label: "Empat",
},
{
id: 5,
value: "lima",
label: "Lima",
},
{
id: 6,
value: "enam",
label: "Enam",
},
{
id: 7,
value: "tujuh",
label: "Tujuh",
},
{
id: 8,
value: "delapan",
label: "Delapan",
},
{
id: 9,
value: "sembilan",
label: "Sembilan",
},
{
id: 10,
value: "sepuluh",
label: "Sepuluh",
},
];
async function onSave() {
close();
ComponentGlobal_NotifikasiBerhasil("Berhasil Membuat Grup");
setHotMenu(4);
router.push(RouterColab.grup_diskusi);
}
return (
<>
<Stack>
{/* <pre>{JSON.stringify(listPartisipan,null,2)}</pre> */}
<Paper withBorder shadow="lg" p={"sm"}>
<Text c={"red"} fz={10}>
*
<Text px={"xs"} span inherit c={"gray"}>
Pilih user yang akan menjadi tim proyek anda
</Text>
</Text>
<ScrollArea h={400}>
<Checkbox.Group value={value} onChange={setValue}>
<Stack mt="xs">
{listPartisipan.map((e, i) => (
<Grid key={e.id} align="center">
<Grid.Col span={"content"}>
<Checkbox value={e.id.toString()} />
</Grid.Col>
<Grid.Col span={"auto"}>
<ComponentColab_AuthorNameOnHeader
isPembatas={true}
authorName={e?.User.Profile.name}
profileId={e?.User.Profile.id}
imagesId={e?.User.Profile.imagesId}
/>
</Grid.Col>
</Grid>
))}
</Stack>
</Checkbox.Group>
</ScrollArea>
</Paper>
<Button
radius={"xl"}
disabled={_.isEmpty(value) ? true : false}
onClick={() => {
open();
}}
>
Buat Ruang Diskusi{" "}
</Button>
</Stack>
<Drawer
opened={opened}
onClose={close}
position="bottom"
size={150}
withCloseButton={false}
>
<Stack>
<Title order={6}>Nama Grup Diskusi</Title>
<TextInput placeholder="Masukan nama grup diskusi .." radius={"xl"} />
<Group grow>
<Button radius={"xl"} onClick={close}>
Batal
</Button>
<Button radius={"xl"} color="green" onClick={() => onSave()}>
Simpan
</Button>
</Group>
</Stack>
</Drawer>
</>
);
}

View File

@@ -0,0 +1,20 @@
"use client";
import ComponentColab_HeaderTamplate from "@/app_modules/colab/component/header_tamplate";
import { AppShell } from "@mantine/core";
import { IconEdit } from "@tabler/icons-react";
import React from "react";
export default function LayoutColab_DetailProyekSaya({
children,
}: {
children: React.ReactNode;
}) {
return (
<>
<AppShell header={<ComponentColab_HeaderTamplate title="Proyek Saya" />}>
{children}
</AppShell>
</>
);
}

View File

@@ -2,7 +2,6 @@
import { RouterColab } from "@/app/lib/router_hipmi/router_colab"; import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
import ComponentColab_DetailData from "@/app_modules/colab/component/detail/detail_data"; import ComponentColab_DetailData from "@/app_modules/colab/component/detail/detail_data";
import ComponentColab_DetailListPartisipasiUser from "@/app_modules/colab/component/detail/list_partisipasi_user";
import ComponentColab_AuthorNameOnHeader from "@/app_modules/colab/component/header_author_name"; import ComponentColab_AuthorNameOnHeader from "@/app_modules/colab/component/header_author_name";
import { gs_colab_hot_menu } from "@/app_modules/colab/global_state"; import { gs_colab_hot_menu } from "@/app_modules/colab/global_state";
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";

View File

@@ -1,33 +1,73 @@
"use client" "use client";
import { Stack, TextInput, Select, Textarea, Button } from "@mantine/core"; import { Stack, TextInput, Select, Textarea, Button } from "@mantine/core";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useState } from "react"; import React, { useState } from "react";
import {
MODEL_COLLABORATION,
MODEL_COLLABORATION_MASTER,
} from "../model/interface";
import colab_funEditById from "../fun/edit/fun_edit_by_id";
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
export default function Colab_Edit() { export default function Colab_Edit({
selectedData,
listIndustri,
}: {
selectedData: MODEL_COLLABORATION;
listIndustri: MODEL_COLLABORATION_MASTER[];
}) {
const [value, setValue] = useState(selectedData);
return ( return (
<> <>
<Stack px={"sm"}> <Stack px={"sm"}>
{/* <pre>{JSON.stringify(value, null, 2)}</pre> */}
<TextInput <TextInput
label="Judul" label="Judul"
withAsterisk withAsterisk
placeholder="Masukan judul proyek" placeholder="Masukan judul proyek"
value={value.title}
onChange={(val) =>
setValue({
...value,
title: val.currentTarget.value,
})
}
/> />
<TextInput <TextInput
label="Lokasi" label="Lokasi"
withAsterisk withAsterisk
placeholder="Masukan lokasi proyek" placeholder="Masukan lokasi proyek"
value={value.lokasi}
onChange={(val) =>
setValue({
...value,
lokasi: val.currentTarget.value,
})
}
/> />
<Select <Select
placeholder="Pilih kategori industri" placeholder="Pilih kategori industri"
label="Pilih Industri" label="Pilih Industri"
withAsterisk withAsterisk
data={[ value={value?.ProjectCollaborationMaster_Industri.id}
{ value: "1", label: "Teknologi" }, data={listIndustri.map((e) => ({
{ value: "2", label: "Tambang Batu Bara" }, value: e.id,
]} label: e.name,
}))}
onChange={
(val) =>
setValue({
...(value as any),
ProjectCollaborationMaster_Industri: {
id: val as any,
},
})
// console.log(val)
}
/> />
<Textarea <Textarea
@@ -35,6 +75,13 @@ export default function Colab_Edit() {
placeholder="Masukan tujuan proyek" placeholder="Masukan tujuan proyek"
withAsterisk withAsterisk
minRows={5} minRows={5}
value={value.purpose}
onChange={(val) =>
setValue({
...value,
purpose: val.currentTarget.value,
})
}
/> />
<Textarea <Textarea
@@ -42,20 +89,34 @@ export default function Colab_Edit() {
placeholder="Masukan keuntungan dalam proyek" placeholder="Masukan keuntungan dalam proyek"
withAsterisk withAsterisk
minRows={5} minRows={5}
value={value.benefit}
onChange={(val) =>
setValue({
...value,
benefit: val.currentTarget.value,
})
}
/> />
<ButtonAction /> <ButtonAction value={value as any} />
</Stack> </Stack>
</> </>
); );
} }
function ButtonAction() { function ButtonAction({ value }: { value: React.ReactNode }) {
const router = useRouter(); const router = useRouter();
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
async function onUpdate() { async function onUpdate() {
setLoading(true); await colab_funEditById(value as any).then((res) => {
router.back(); if (res.status === 200) {
setLoading(true);
router.back();
ComponentGlobal_NotifikasiBerhasil(res.message);
} else {
ComponentGlobal_NotifikasiGagal(res.message);
}
});
} }
return ( return (

View File

@@ -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" };
}

View File

@@ -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" };
} }

View File

@@ -0,0 +1,28 @@
"use server";
import prisma from "@/app/lib/prisma";
import { MODEL_COLLABORATION } from "../../model/interface";
import { revalidatePath } from "next/cache";
import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
export default async function colab_funEditById(value: MODEL_COLLABORATION) {
console.log(value);
const updt = await prisma.projectCollaboration.update({
where: {
id: value.id,
},
data: {
title: value.title,
lokasi: value.lokasi,
purpose: value.purpose,
benefit: value.benefit,
projectCollaborationMaster_IndustriId: value
.ProjectCollaborationMaster_Industri.id as any,
},
});
if (!updt) return { status: 400, message: "Gagal update" };
revalidatePath(RouterColab.beranda);
revalidatePath(RouterColab.main_detail)
return { status: 200, message: "Berhasil update" };
}

View 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);
}
}

View File

@@ -1,5 +1,38 @@
"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,
isActive: true,
},
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;
} }

View File

@@ -0,0 +1,37 @@
"use server";
import prisma from "@/app/lib/prisma";
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
export default async function colab_getListByStatusId(statusId: number) {
const AuthorId = await User_getUserId();
const data = await prisma.projectCollaboration.findMany({
where: {
userId: AuthorId,
projectCollaborationMaster_StatusId: statusId,
},
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,
},
},
},
});
if (!data) return { status: 400, message: "Gagal Mengambil data" };
return { data: data, status: 200, message: "Berhasil mengambil data" };
}

View File

@@ -0,0 +1,23 @@
"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,
isActive: true
},
select: {
id: true,
User: {
select: {
id: true,
Profile: true,
},
},
},
});
return data
}

View File

@@ -0,0 +1,44 @@
"use server";
import prisma from "@/app/lib/prisma";
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
export default async function colab_getListPartisipasiByAuthorId() {
const AuthorId = await User_getUserId();
const get = await prisma.projectCollaboration_Partisipasi.findMany({
where: {
userId: AuthorId,
isActive: true,
},
select: {
id: true,
isActive: true,
ProjectCollaboration: {
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,
},
},
},
},
},
});
if (!get) return { status: 400, message: "Gagal mengambil data" };
return { data: get, status: 200, message: "Berhasil mengambil data" };
}

View File

@@ -0,0 +1,34 @@
"use server";
import prisma from "@/app/lib/prisma";
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
export default async function colab_getListAllProyekByAuthorId() {
const AuthorId = await User_getUserId();
const get = await prisma.projectCollaboration.findMany({
where: { userId: AuthorId, isActive: true },
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,
},
},
},
});
if (!get) return { status: 400, message: "Gagal mengambil data" };
return { data: get, status: 200, message: "Berhasil mengambil data" };
}

View File

@@ -0,0 +1,34 @@
"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,
createdAt: true,
Author: {
select: {
id: true,
Profile: true,
},
},
ProjectCollaborationMaster_Industri: true,
ProjectCollaboration_Partisipasi: {
where: {
isActive: true,
},
},
},
});
return data;
}

View File

@@ -20,6 +20,9 @@ import LayoutColab_DetailPartisipasiProyek from "./detail/proyek/partisipasi/lay
import Colab_GrupDiskus from "./main/grup"; import Colab_GrupDiskus from "./main/grup";
import Colab_DetailGrupDiskusi from "./detail/grup"; import Colab_DetailGrupDiskusi from "./detail/grup";
import LayoutColab_DetailGrupDiskusi from "./detail/grup/layout"; import LayoutColab_DetailGrupDiskusi from "./detail/grup/layout";
import Colab_NotifikasiView from "./main/pemberitahuan";
import Colab_DetailProyekSaya from "./detail/proyek/saya";
import LayoutColab_DetailProyekSaya from "./detail/proyek/saya/layout";
export { export {
Colab_Beranda, Colab_Beranda,
@@ -44,4 +47,7 @@ export {
Colab_GrupDiskus, Colab_GrupDiskus,
Colab_DetailGrupDiskusi, Colab_DetailGrupDiskusi,
LayoutColab_DetailGrupDiskusi, LayoutColab_DetailGrupDiskusi,
Colab_NotifikasiView,
Colab_DetailProyekSaya,
LayoutColab_DetailProyekSaya,
}; };

View File

@@ -24,8 +24,16 @@ 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,
userLoginId,
}: {
listData: MODEL_COLLABORATION[];
userLoginId: string;
}) {
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 +60,29 @@ 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}
isAuthor={userLoginId === e.Author.id ? true : false}
colabId={e.id}
/> />
</Card> <ComponentColab_CardSectionData
))} colabId={e.id}
path={RouterColab.main_detail}
data={e}
/>
<ComponentColab_JumlahPartisipan
jumlah={e.ProjectCollaboration_Partisipasi}
/>
</Stack>
</Card>
))}
</> </>
); );
} }

View File

@@ -13,6 +13,7 @@ import React, { useState } from "react";
import ComponentColab_HeaderTamplate from "../component/header_tamplate"; import ComponentColab_HeaderTamplate from "../component/header_tamplate";
import router from "next/router"; import router from "next/router";
import { import {
IconBell,
IconHistory, IconHistory,
IconHome, IconHome,
IconMessages, IconMessages,
@@ -42,12 +43,12 @@ export default function LayoutColab_Main({
icon: <IconHome />, icon: <IconHome />,
}, },
{ // {
id: 2, // id: 2,
name: "Status", // name: "Status",
path: RouterColab.status, // path: RouterColab.status,
icon: <IconReservedLine />, // icon: <IconReservedLine />,
}, // },
{ {
id: 3, id: 3,
@@ -55,13 +56,18 @@ export default function LayoutColab_Main({
path: RouterColab.proyek, path: RouterColab.proyek,
icon: <IconUsersGroup />, icon: <IconUsersGroup />,
}, },
{ {
id: 4, id: 4,
name: "Grup Diskusi", name: "Grup Diskusi",
path: RouterColab.grup_diskusi, path: RouterColab.grup_diskusi,
icon: <IconMessages />, icon: <IconMessages />,
}, },
{
id: 5,
name: "Notifikasi",
path: RouterColab.notifikasi,
icon: <IconBell />,
},
]; ];
return ( return (

View File

@@ -0,0 +1,11 @@
"use client"
import { Text, Title } from "@mantine/core";
export default function Colab_NotifikasiView() {
return (
<>
<Text>ini notif</Text>
</>
);
}

View File

@@ -7,8 +7,18 @@ import Colab_ProyekSaya from "./saya";
import Colab_PartisipasiProyek from "./partisipasi"; import Colab_PartisipasiProyek from "./partisipasi";
import { useAtom } from "jotai"; import { useAtom } from "jotai";
import { gs_colab_proyek } from "../../global_state"; import { gs_colab_proyek } from "../../global_state";
import {
MODEL_COLLABORATION,
MODEL_COLLABORATION_PARTISIPASI,
} from "../../model/interface";
export default function Colab_Proyek() { export default function Colab_Proyek({
listPartisipasiUser,
listProyekSaya,
}: {
listPartisipasiUser: MODEL_COLLABORATION_PARTISIPASI[];
listProyekSaya: MODEL_COLLABORATION[];
}) {
const [activeTab, setActiveTab] = useAtom(gs_colab_proyek); const [activeTab, setActiveTab] = useAtom(gs_colab_proyek);
const listTabs = [ const listTabs = [
@@ -17,14 +27,18 @@ export default function Colab_Proyek() {
icon: <IconUsersGroup />, icon: <IconUsersGroup />,
label: "Partisipasi Proyek", label: "Partisipasi Proyek",
value: "Partisipasi", value: "Partisipasi",
path: <Colab_PartisipasiProyek />, path: (
<Colab_PartisipasiProyek
listPartisipasiUser={listPartisipasiUser as any}
/>
),
}, },
{ {
id: 2, id: 2,
icon: <IconUser />, icon: <IconUser />,
label: "Proyek Saya", label: "Proyek Saya",
value: "Saya", value: "Saya",
path: <Colab_ProyekSaya />, path: <Colab_ProyekSaya listProyekSaya={listProyekSaya as any} />,
}, },
]; ];

View File

@@ -1,34 +1,50 @@
"use client"; "use client";
import { RouterColab } from "@/app/lib/router_hipmi/router_colab"; import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
import { Card } 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 { MODEL_COLLABORATION_PARTISIPASI } from "../../model/interface";
import ComponentColab_JumlahPartisipan from "../../component/card_view/card_section_jumlah_partisipan";
import ComponentColab_IsEmptyData from "../../component/is_empty_data";
import _ from "lodash";
export default function Colab_PartisipasiProyek({
listPartisipasiUser,
}: {
listPartisipasiUser: MODEL_COLLABORATION_PARTISIPASI[];
}) {
if (_.isEmpty(listPartisipasiUser))
return <ComponentColab_IsEmptyData text="Tidak ikut berpartisipasi" />;
export default function Colab_PartisipasiProyek() {
return ( return (
<> <>
{Array(5) {listPartisipasiUser.map((e, i) => (
.fill(0) <Card
.map((e, i) => ( key={i}
<Card withBorder
key={i} shadow="lg"
withBorder mb={"lg"}
shadow="lg" radius={"md"}
mb={"lg"} style={{ borderColor: "indigo", borderWidth: "0.5px" }}
radius={"md"} >
style={{ borderColor: "indigo", borderWidth: "0.5px" }} <Stack>
>
<ComponentColab_CardSectionHeaderAuthorName <ComponentColab_CardSectionHeaderAuthorName
tglPublish={new Date()} authorName={e?.ProjectCollaboration.Author.Profile.name}
jumlah_partisipan={12} imagesId={e?.ProjectCollaboration.Author.Profile.imagesId}
profileId={e?.ProjectCollaboration.Author.Profile.id}
/> />
<ComponentColab_CardSectionData <ComponentColab_CardSectionData
colabId={i} colabId={e?.ProjectCollaboration.id}
path={RouterColab.partisipasi_proyek} path={RouterColab.detail_partisipasi_proyek}
data={e?.ProjectCollaboration}
/> />
</Card> <ComponentColab_JumlahPartisipan
))} jumlah={e?.ProjectCollaboration.ProjectCollaboration_Partisipasi}
/>
</Stack>
</Card>
))}
</> </>
); );
} }

View File

@@ -4,31 +4,43 @@ 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";
import { MODEL_COLLABORATION } from "../../model/interface";
import _ from "lodash";
import ComponentColab_IsEmptyData from "../../component/is_empty_data";
export default function Colab_ProyekSaya({
listProyekSaya,
}: {
listProyekSaya: MODEL_COLLABORATION[];
}) {
if (_.isEmpty(listProyekSaya))
return <ComponentColab_IsEmptyData text="Tidak ada data" />;
export default function Colab_ProyekSaya() {
return ( return (
<> <>
{Array(5) {listProyekSaya.map((e, i) => (
.fill(0) <Card
.map((e, i) => ( key={i}
<Card withBorder
key={i} shadow="lg"
withBorder mb={"lg"}
shadow="lg" radius={"md"}
mb={"lg"} style={{ borderColor: "violet", borderWidth: "0.5px" }}
radius={"md"} >
style={{ borderColor: "violet", borderWidth: "0.5px" }} <Stack>
> <ComponentColab_CardSectionData
<Stack> colabId={e.id}
<ComponentColab_CardSectionData path={RouterColab.detail_proyek_saya}
colabId={i} data={e}
path={RouterColab.status_publish}
/> />
<ComponentColab_JumlahPartisipan /> <ComponentColab_JumlahPartisipan
</Stack> jumlah={e.ProjectCollaboration_Partisipasi}
</Card> />
))} </Stack>
</Card>
))}
</> </>
); );
} }

View File

@@ -8,23 +8,31 @@ import Colab_StatusReview from "./review";
import { useAtom } from "jotai"; import { useAtom } from "jotai";
import { gs_colab_status } from "../../global_state"; import { gs_colab_status } from "../../global_state";
export default function Colab_Status() { export default function Colab_Status({
listPublish,
listReview,
listReject,
}: {
listPublish: any[];
listReview: any[];
listReject: any[];
}) {
const [tabsStatus, setTabsStatus] = useAtom(gs_colab_status); const [tabsStatus, setTabsStatus] = useAtom(gs_colab_status);
const [colorTab, setColorTab] = useState<string | null>(""); const [colorTab, setColorTab] = useState<string | null>("");
const listTabs = [ const listTabs = [
{ {
id: 1, id: 1,
path: <Colab_StatusPublish />, path: <Colab_StatusPublish listPublish={listPublish as any} />,
value: "Publish", value: "Publish",
bg: "green", bg: "green",
}, },
{ // {
id: 2, // id: 2,
path: <Colab_StatusReview />, // path: <Colab_StatusReview />,
value: "Review", // value: "Review",
bg: "orange", // bg: "orange",
}, // },
{ {
id: 3, id: 3,
path: <Colab_StatusReject />, path: <Colab_StatusReject />,

View File

@@ -6,32 +6,36 @@ 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";
import { MODEL_COLLABORATION } from "../../model/interface";
export default function Colab_StatusPublish() { export default function Colab_StatusPublish({
listPublish,
}: {
listPublish: MODEL_COLLABORATION[];
}) {
return ( return (
<> <>
{Array(5) {listPublish.map((e, i) => (
.fill(0) <Card
.map((e, i) => ( key={i}
<Card withBorder
key={i} shadow="lg"
withBorder mb={"lg"}
shadow="lg" radius={"md"}
mb={"lg"} // bg={"green.0.5"}
radius={"md"} style={{ borderColor: "green", borderWidth: "0.5px" }}
// bg={"green.0.5"} >
style={{ borderColor: "green", borderWidth: "0.5px" }} <Stack>
> <ComponentColab_CardSectionData
<Stack> colabId={e.id}
<ComponentColab_CardSectionData path={RouterColab.status_publish}
colabId={i} data={e}
path={RouterColab.status_publish} />
/> <ComponentColab_JumlahPartisipan jumlah={e.ProjectCollaboration_Partisipasi} />
<ComponentColab_JumlahPartisipan/> </Stack>
</Stack> </Card>
</Card> ))}
))}
</> </>
); );
} }

View File

@@ -18,10 +18,22 @@ 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: MODEL_COLLABORATION_PARTISIPASI[];
}
export interface MODEL_COLLABORATION_PARTISIPASI {
id: string;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
userId: string;
User: MODEL_USER;
projectCollaborationId: string;
projectCollaboration_RoomChatId: string;
ProjectCollaboration: MODEL_COLLABORATION;
} }

View File

@@ -78,7 +78,7 @@ export default function HomeView({ dataUser }: { dataUser: MODEL_USER }) {
id: 5, id: 5,
name: "Project Collaboration", name: "Project Collaboration",
icon: <IconAffiliate size={50} />, icon: <IconAffiliate size={50} />,
link: RouterColab.splash, link: "",
}, },
{ {
id: 6, id: 6,

View File

@@ -88,9 +88,9 @@ export default function CreateProfile({ userId }: { userId: any }) {
const buffer = URL.createObjectURL( const buffer = URL.createObjectURL(
new Blob([new Uint8Array(await files.arrayBuffer())]) new Blob([new Uint8Array(await files.arrayBuffer())])
); );
if (files.size > 1000000) { if (files.size > 2000000) {
ComponentGlobal_NotifikasiPeringatan( ComponentGlobal_NotifikasiPeringatan(
"Maaf, Ukuran file terlalu besar, maximum 1mb", "Maaf, Ukuran file terlalu besar, maximum 2mb",
3000 3000
); );
} else { } else {

View File

@@ -58,9 +58,9 @@ export default function Profile_UpdateFotoBackground({
const buffer = URL.createObjectURL( const buffer = URL.createObjectURL(
new Blob([new Uint8Array(await files.arrayBuffer())]) new Blob([new Uint8Array(await files.arrayBuffer())])
); );
if (files.size > 1000000) { if (files.size > 2000000) {
ComponentGlobal_NotifikasiPeringatan( ComponentGlobal_NotifikasiPeringatan(
"Maaf, Ukuran file terlalu besar, maximum 1mb", "Maaf, Ukuran file terlalu besar, maximum 2mb",
3000 3000
); );
} else { } else {

View File

@@ -54,9 +54,9 @@ export default function UploadFotoProfile({
const buffer = URL.createObjectURL( const buffer = URL.createObjectURL(
new Blob([new Uint8Array(await files.arrayBuffer())]) new Blob([new Uint8Array(await files.arrayBuffer())])
); );
if (files.size > 1000000) { if (files.size > 2000000) {
ComponentGlobal_NotifikasiPeringatan( ComponentGlobal_NotifikasiPeringatan(
"Maaf, Ukuran file terlalu besar, maximum 1mb", "Maaf, Ukuran file terlalu besar, maximum 2mb",
3000 3000
); );
} else { } else {