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
lokasi String
purpose String @db.Text
benefit String @db.Text
benefit String? @db.Text
ProjectCollaborationMaster_Industri ProjectCollaborationMaster_Industri? @relation(fields: [projectCollaborationMaster_IndustriId], references: [id])
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({
children,
params,
}: {
children: React.ReactNode;
params: { id: string };
}) {
const colabId = params.id;
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_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";
export default async function Page({ params }: { params: { id: string } }) {
let colabId = params.id
const userLoginId = await User_getUserId()
let colabId = params.id;
const userLoginId = await User_getUserId();
const dataColab = await colab_getOneCollaborationById(colabId);
const listPartisipan = await colab_getListPartisipanById(colabId)
const cekPartisipan = await colab_funCekPartisipasiById(colabId)
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_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 (
<>
<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_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(){
return<>
<Colab_Edit/>
export default async function Page({ params }: { params: { id: string } }) {
const colabId = params.id;
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_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() {
return<>
<Colab_Beranda/>
const listData = await colab_getListAllProyek();
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_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() {
const listPartisipasiUser = (await colab_getListPartisipasiByAuthorId()).data;
const listProyekSaya = (await colab_getListAllProyekByAuthorId()).data;
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_getListByStatusId from "@/app_modules/colab/fun/get/get_list_by_status_id";
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 (
<>
<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",
proyek: "/dev/colab/main/proyek",
grup_diskusi: "/dev/colab/main/grup",
notifikasi: "/dev/colab/main/notifikasi",
// create
create: "/dev/colab/create",
@@ -17,7 +18,8 @@ export const RouterColab = {
status_review: "/dev/colab/detail/status/review/",
status_reject: "/dev/colab/detail/status/reject/",
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/",
// 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 { useRouter } from "next/navigation";
import { useState } from "react";
import { MODEL_COLLABORATION } from "../../model/interface";
export default function ComponentColab_CardSectionData({
colabId,
path,
data,
}: {
colabId?: any;
path?: any;
data?: MODEL_COLLABORATION;
}) {
const router = useRouter();
@@ -30,7 +33,7 @@ export default function ComponentColab_CardSectionData({
>
<Center px={"md"} mb={"lg"}>
<Title order={5} lineClamp={1}>
Judul Proyek{" "}
{data?.title ? data.title : "Judul Proyek"}
</Title>
</Center>
<Stack spacing={"xs"}>
@@ -44,7 +47,11 @@ export default function ComponentColab_CardSectionData({
<Text fz={"xs"}>:</Text>
</Grid.Col>
<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>
@@ -59,7 +66,7 @@ export default function ComponentColab_CardSectionData({
</Grid.Col>
<Grid.Col span={"auto"}>
<Text fz={"xs"} lineClamp={1}>
Lokasi dari proyek{" "}
{data?.lokasi ? data?.lokasi : "Lokasi dari proyek"}
</Text>
</Grid.Col>
</Grid>
@@ -69,10 +76,9 @@ export default function ComponentColab_CardSectionData({
Tujuan proyek
</Text>
<Text lineClamp={3} fz={"xs"}>
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.
{data?.purpose
? data?.purpose
: "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"}
</Text>
</Stack>
</Stack>

View File

@@ -1,32 +1,45 @@
"use client";
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 { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
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({
profileId,
imagesId,
authorName,
tglPublish,
isPembatas,
jumlah_partisipan,
isAuthor,
colabId,
}: {
profileId?: string;
imagesId?: string;
authorName?: string;
tglPublish?: Date;
isPembatas?: boolean;
jumlah_partisipan?: number;
isAuthor?: boolean;
colabId?: string;
}) {
const router = useRouter();
return (
<>
<Card.Section px={"md"} pb={"md"}>
<Card.Section px={"md"}>
<Stack spacing={"xs"}>
<Grid>
<Grid.Col
@@ -59,13 +72,10 @@ export default function ComponentColab_CardSectionHeaderAuthorName({
</Stack>
</Grid.Col>
<Grid.Col span={"content"}>
<Stack justify="center" h={"100%"}>
<Text c={"gray"} fz={"xs"}>
{jumlah_partisipan
? jumlah_partisipan + " " + "partisipan"
: 0 + " " + "partisipan"}
</Text>
</Stack>
<ButtonAction
isAuthor={isAuthor as any}
colabId={colabId as any}
/>
</Grid.Col>
</Grid>
{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 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 (
<>
<Stack>
<Box>
<Center px={"md"} mb={"lg"} >
<Title order={4}>Judul Proyek </Title>
<Center px={"md"} mb={"lg"}>
<Title order={4}>{data?.title ? data.title : "Judul Proyek"}</Title>
</Center>
<Stack spacing={"sm"}>
<Grid>
@@ -22,7 +27,11 @@ export default function ComponentColab_DetailData() {
<Text fz={"sm"}>:</Text>
</Grid.Col>
<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>
@@ -37,7 +46,7 @@ export default function ComponentColab_DetailData() {
</Grid.Col>
<Grid.Col span={"auto"}>
<Text fz={"sm"} lineClamp={1}>
Lokasi dari proyek{" "}
{data?.lokasi ? data.lokasi : " Lokasi dari proyek"}
</Text>
</Grid.Col>
</Grid>
@@ -46,22 +55,14 @@ export default function ComponentColab_DetailData() {
<Text fw={"bold"} fz={"sm"}>
Tujuan proyek
</Text>
<Text fz={"sm"}>
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>
<Text fz={"sm"}>{data?.purpose ? data?.purpose : "-"}</Text>
</Stack>
<Stack spacing={5}>
<Text fw={"bold"} fz={"sm"}>
Keutungan
</Text>
<Text fz={"sm"}>
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.
{data?.benefit ? data?.benefit : "-"}
</Text>
</Stack>
</Stack>
@@ -69,4 +70,4 @@ export default function ComponentColab_DetailData() {
</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 {
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 (
<>
<Paper withBorder p={"md"}>
<Center mb={"xl"}>
<Title order={4}>Partispasi User (12)</Title>
</Center>{" "}
<ScrollArea h={400}>
<Box h={400}>
<Stack>
{Array(10)
.fill(0)
.map((e, i) => (
<Box key={i}>
<ComponentColab_AuthorNameOnHeader isPembatas={true} />
</Box>
))}
</Stack>
</Box>
</ScrollArea>
</Paper>
{/* <pre>{JSON.stringify(data, null, 2)}</pre> */}
<Stack>
{userLoginId !== authorId ? (
<Center>
<Button
radius={"xl"}
disabled={cekPartisipan ? true : false}
color={cekPartisipan ? "green" : "blue"}
onClick={() => {
onJoin();
}}
>
{cekPartisipan ? "Telah Berpartisipasi" : "Partisipasi"}
</Button>
</Center>
) : (
""
)}
<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 { useRouter } from "next/navigation";
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 { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
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({
listIndustri,
@@ -80,7 +85,6 @@ export default function Colab_Create({
<Textarea
label="Keuntungan "
placeholder="Masukan keuntungan dalam proyek"
withAsterisk
minRows={5}
onChange={(val) => {
setValue({
@@ -89,7 +93,7 @@ export default function Colab_Create({
});
}}
/>
<ButtonAction value={value} />
<ButtonAction value={value as any} />
</Stack>
</>
);
@@ -100,13 +104,22 @@ function ButtonAction({ value }: { value: any }) {
const [loading, setLoading] = useState(false);
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) => {
if (res.status === 201) {
setLoading(true);
router.back();
ComponentGlobal_NotifikasiBerhasil(res.message);
} 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_DetailListPartisipasiUser from "../../component/detail/list_partisipasi_user";
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 (
<>
<Stack px={5} spacing={"lg"}>
<ComponentColab_AuthorNameOnHeader tglPublish={new Date}/>
<ComponentColab_DetailData />
<ComponentColab_ButtonPartisipasi />
<ComponentColab_DetailListPartisipasiUser />
<Stack px={5} spacing={"xl"}>
<ComponentColab_AuthorNameOnHeader
tglPublish={new Date()}
authorName={dataColab?.Author?.Profile?.name}
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>
</>
);

View File

@@ -3,16 +3,26 @@
import { AppShell } from "@mantine/core";
import React from "react";
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({
children,
colabId,
}: {
children: React.ReactNode;
colabId: string;
}) {
return (
<>
<AppShell
header={<ComponentColab_HeaderTamplate title="Detail" />}
header={
<ComponentColab_HeaderTamplate
title="Detail"
icon={<IconEdit />}
route2={RouterColab.edit + colabId}
/>
}
>
{children}
</AppShell>

View File

@@ -3,15 +3,28 @@
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 { MODEL_COLLABORATION, MODEL_COLLABORATION_PARTISIPASI } from "@/app_modules/colab/model/interface";
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 (
<>
<Stack px={5} spacing={"xl"}>
<ComponentColab_AuthorNameOnHeader />
<ComponentColab_DetailData />
<ComponentColab_DetailListPartisipasiUser />
{/* <pre>{JSON.stringify(dataColab, null,2)}</pre> */}
<ComponentColab_AuthorNameOnHeader
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>
</>
);

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 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 { gs_colab_hot_menu } from "@/app_modules/colab/global_state";
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 { 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 (
<>
<Stack px={"sm"}>
{/* <pre>{JSON.stringify(value, null, 2)}</pre> */}
<TextInput
label="Judul"
withAsterisk
placeholder="Masukan judul proyek"
value={value.title}
onChange={(val) =>
setValue({
...value,
title: val.currentTarget.value,
})
}
/>
<TextInput
label="Lokasi"
withAsterisk
placeholder="Masukan lokasi proyek"
value={value.lokasi}
onChange={(val) =>
setValue({
...value,
lokasi: val.currentTarget.value,
})
}
/>
<Select
placeholder="Pilih kategori industri"
label="Pilih Industri"
withAsterisk
data={[
{ value: "1", label: "Teknologi" },
{ value: "2", label: "Tambang Batu Bara" },
]}
value={value?.ProjectCollaborationMaster_Industri.id}
data={listIndustri.map((e) => ({
value: e.id,
label: e.name,
}))}
onChange={
(val) =>
setValue({
...(value as any),
ProjectCollaborationMaster_Industri: {
id: val as any,
},
})
// console.log(val)
}
/>
<Textarea
@@ -35,6 +75,13 @@ export default function Colab_Edit() {
placeholder="Masukan tujuan proyek"
withAsterisk
minRows={5}
value={value.purpose}
onChange={(val) =>
setValue({
...value,
purpose: val.currentTarget.value,
})
}
/>
<Textarea
@@ -42,20 +89,34 @@ export default function Colab_Edit() {
placeholder="Masukan keuntungan dalam proyek"
withAsterisk
minRows={5}
value={value.benefit}
onChange={(val) =>
setValue({
...value,
benefit: val.currentTarget.value,
})
}
/>
<ButtonAction />
<ButtonAction value={value as any} />
</Stack>
</>
);
}
function ButtonAction() {
function ButtonAction({ value }: { value: React.ReactNode }) {
const router = useRouter();
const [loading, setLoading] = useState(false);
async function onUpdate() {
setLoading(true);
router.back();
await colab_funEditById(value as any).then((res) => {
if (res.status === 200) {
setLoading(true);
router.back();
ComponentGlobal_NotifikasiBerhasil(res.message);
} else {
ComponentGlobal_NotifikasiGagal(res.message);
}
});
}
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 { MODEL_COLLABORATION } from "../../model/interface";
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(
value: MODEL_COLLABORATION
) {
const Author = await User_getUserId();
console.log(Author);
const AuthorId = await User_getUserId();
const create = await prisma.projectCollaboration.create({
data: {
@@ -18,10 +19,11 @@ export default async function colab_funCreateProyek(
benefit: value.benefit,
projectCollaborationMaster_IndustriId:
value.projectCollaborationMaster_IndustriId,
userId: Author
userId: AuthorId
},
});
if (!create) return { status: 400, message: "Gagal Membuat Proyek" };
revalidatePath(RouterColab.beranda)
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() {
}
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_DetailGrupDiskusi from "./detail/grup";
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 {
Colab_Beranda,
@@ -44,4 +47,7 @@ export {
Colab_GrupDiskus,
Colab_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 ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2";
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 [scroll, scrollTo] = useWindowScroll();
const [loadingCreate, setLoadingCreate] = useState(false);
@@ -52,17 +60,29 @@ export default function Colab_Beranda() {
</ActionIcon>
</Affix>
{Array(5)
.fill(0)
.map((e, i) => (
<Card key={i} withBorder shadow="lg" mb={"lg"} radius={"md"}>
<ComponentColab_CardSectionHeaderAuthorName tglPublish={new Date} jumlah_partisipan={12} />
<ComponentColab_CardSectionData
colabId={i}
path={RouterColab.main_detail}
{/* <pre>{JSON.stringify(listData, null, 2)}</pre> */}
{listData.map((e, i) => (
<Card key={e.id} withBorder shadow="lg" mb={"lg"} radius={"md"}>
<Stack>
<ComponentColab_CardSectionHeaderAuthorName
authorName={e?.Author?.Profile?.name}
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 router from "next/router";
import {
IconBell,
IconHistory,
IconHome,
IconMessages,
@@ -42,12 +43,12 @@ export default function LayoutColab_Main({
icon: <IconHome />,
},
{
id: 2,
name: "Status",
path: RouterColab.status,
icon: <IconReservedLine />,
},
// {
// id: 2,
// name: "Status",
// path: RouterColab.status,
// icon: <IconReservedLine />,
// },
{
id: 3,
@@ -55,13 +56,18 @@ export default function LayoutColab_Main({
path: RouterColab.proyek,
icon: <IconUsersGroup />,
},
{
id: 4,
name: "Grup Diskusi",
path: RouterColab.grup_diskusi,
icon: <IconMessages />,
},
{
id: 5,
name: "Notifikasi",
path: RouterColab.notifikasi,
icon: <IconBell />,
},
];
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 { useAtom } from "jotai";
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 listTabs = [
@@ -17,14 +27,18 @@ export default function Colab_Proyek() {
icon: <IconUsersGroup />,
label: "Partisipasi Proyek",
value: "Partisipasi",
path: <Colab_PartisipasiProyek />,
path: (
<Colab_PartisipasiProyek
listPartisipasiUser={listPartisipasiUser as any}
/>
),
},
{
id: 2,
icon: <IconUser />,
label: "Proyek Saya",
value: "Saya",
path: <Colab_ProyekSaya />,
path: <Colab_ProyekSaya listProyekSaya={listProyekSaya as any} />,
},
];

View File

@@ -1,34 +1,50 @@
"use client";
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_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 (
<>
{Array(5)
.fill(0)
.map((e, i) => (
<Card
key={i}
withBorder
shadow="lg"
mb={"lg"}
radius={"md"}
style={{ borderColor: "indigo", borderWidth: "0.5px" }}
>
{listPartisipasiUser.map((e, i) => (
<Card
key={i}
withBorder
shadow="lg"
mb={"lg"}
radius={"md"}
style={{ borderColor: "indigo", borderWidth: "0.5px" }}
>
<Stack>
<ComponentColab_CardSectionHeaderAuthorName
tglPublish={new Date()}
jumlah_partisipan={12}
authorName={e?.ProjectCollaboration.Author.Profile.name}
imagesId={e?.ProjectCollaboration.Author.Profile.imagesId}
profileId={e?.ProjectCollaboration.Author.Profile.id}
/>
<ComponentColab_CardSectionData
colabId={i}
path={RouterColab.partisipasi_proyek}
colabId={e?.ProjectCollaboration.id}
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 ComponentColab_CardSectionData from "../../component/card_view/card_section_data";
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 (
<>
{Array(5)
.fill(0)
.map((e, i) => (
<Card
key={i}
withBorder
shadow="lg"
mb={"lg"}
radius={"md"}
style={{ borderColor: "violet", borderWidth: "0.5px" }}
>
<Stack>
<ComponentColab_CardSectionData
colabId={i}
path={RouterColab.status_publish}
/>
<ComponentColab_JumlahPartisipan />
</Stack>
</Card>
))}
{listProyekSaya.map((e, i) => (
<Card
key={i}
withBorder
shadow="lg"
mb={"lg"}
radius={"md"}
style={{ borderColor: "violet", borderWidth: "0.5px" }}
>
<Stack>
<ComponentColab_CardSectionData
colabId={e.id}
path={RouterColab.detail_proyek_saya}
data={e}
/>
<ComponentColab_JumlahPartisipan
jumlah={e.ProjectCollaboration_Partisipasi}
/>
</Stack>
</Card>
))}
</>
);
}

View File

@@ -8,23 +8,31 @@ import Colab_StatusReview from "./review";
import { useAtom } from "jotai";
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 [colorTab, setColorTab] = useState<string | null>("");
const listTabs = [
{
id: 1,
path: <Colab_StatusPublish />,
path: <Colab_StatusPublish listPublish={listPublish as any} />,
value: "Publish",
bg: "green",
},
{
id: 2,
path: <Colab_StatusReview />,
value: "Review",
bg: "orange",
},
// {
// id: 2,
// path: <Colab_StatusReview />,
// value: "Review",
// bg: "orange",
// },
{
id: 3,
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_CardSectionHeaderAuthorName from "../../component/card_view/card_section_header_author_name";
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 (
<>
{Array(5)
.fill(0)
.map((e, i) => (
<Card
key={i}
withBorder
shadow="lg"
mb={"lg"}
radius={"md"}
// bg={"green.0.5"}
style={{ borderColor: "green", borderWidth: "0.5px" }}
>
<Stack>
<ComponentColab_CardSectionData
colabId={i}
path={RouterColab.status_publish}
/>
<ComponentColab_JumlahPartisipan/>
</Stack>
</Card>
))}
{listPublish.map((e, i) => (
<Card
key={i}
withBorder
shadow="lg"
mb={"lg"}
radius={"md"}
// bg={"green.0.5"}
style={{ borderColor: "green", borderWidth: "0.5px" }}
>
<Stack>
<ComponentColab_CardSectionData
colabId={e.id}
path={RouterColab.status_publish}
data={e}
/>
<ComponentColab_JumlahPartisipan jumlah={e.ProjectCollaboration_Partisipasi} />
</Stack>
</Card>
))}
</>
);
}

View File

@@ -18,10 +18,22 @@ export interface MODEL_COLLABORATION {
lokasi: string;
purpose: string;
benefit: string;
ProjectCollaborationMaster_Industri: MODEL_COLLABORATION_MASTER[];
ProjectCollaborationMaster_Industri: MODEL_COLLABORATION_MASTER;
projectCollaborationMaster_IndustriId: number;
Author: MODEL_USER;
ProjectCollaborationMaster_Status: MODEL_COLLABORATION_MASTER[];
projectCollaborationMaster_StatusId: number
// ProjectCollaboration_Partisipasi
ProjectCollaborationMaster_Status: MODEL_COLLABORATION_MASTER;
projectCollaborationMaster_StatusId: number;
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,
name: "Project Collaboration",
icon: <IconAffiliate size={50} />,
link: RouterColab.splash,
link: "",
},
{
id: 6,

View File

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

View File

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

View File

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