Hold persiapan persentase pak fahmi

- Sudah bisa create
- Sudah bisa join proyek
- Tambahan untuk mengisi form jika ingin join
### No issue
This commit is contained in:
2024-04-18 14:14:08 +08:00
parent ed77b569a6
commit 4b78a45479
45 changed files with 809 additions and 143 deletions

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,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,12 +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() {
const listData = await colab_getListAllProyek()
const listData = await colab_getListAllProyek();
const userLoginId = await User_getUserId();
return (
<>
<Colab_Beranda listData={listData as any} />
</>
);
}
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

@@ -1,26 +1,39 @@
"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?: any[]
isAuthor?: boolean;
colabId?: string;
}) {
const router = useRouter();
@@ -59,15 +72,10 @@ export default function ComponentColab_CardSectionHeaderAuthorName({
</Stack>
</Grid.Col>
<Grid.Col span={"content"}>
<Stack justify="center" h={"100%"}>
{tglPublish ? (
<Text c={"gray"} fz={"xs"}>
{new Intl.DateTimeFormat("id-ID").format(tglPublish)}
</Text>
) : (
""
)}
</Stack>
<ButtonAction
isAuthor={isAuthor as any}
colabId={colabId as any}
/>
</Grid.Col>
</Grid>
{isPembatas ? <Divider /> : ""}
@@ -76,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,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

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

@@ -9,6 +9,7 @@ export default async function colab_getListAllProyek() {
},
where: {
projectCollaborationMaster_StatusId: 1,
isActive: true,
},
select: {
id: true,
@@ -19,6 +20,7 @@ export default async function colab_getListAllProyek() {
benefit: true,
Author: {
select: {
id: true,
Profile: true,
},
},

View File

@@ -1,5 +1,37 @@
"use server"
"use server";
export default async function colab_getListByStatusId(statusId: string, colabId: string) {
}
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

@@ -6,6 +6,7 @@ export default async function colab_getListPartisipanById(colabId: string) {
const data = await prisma.projectCollaboration_Partisipasi.findMany({
where: {
projectCollaborationId: colabId,
isActive: true
},
select: {
id: true,

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

@@ -14,6 +14,7 @@ export default async function colab_getOneCollaborationById(colabId: string) {
lokasi: true,
purpose: true,
benefit: true,
createdAt: true,
Author: {
select: {
id: true,

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

@@ -29,8 +29,10 @@ import ComponentColab_JumlahPartisipan from "../component/card_view/card_section
export default function Colab_Beranda({
listData,
userLoginId,
}: {
listData: MODEL_COLLABORATION[];
userLoginId: string;
}) {
const router = useRouter();
const [scroll, scrollTo] = useWindowScroll();
@@ -67,15 +69,17 @@ export default function Colab_Beranda({
authorName={e?.Author?.Profile?.name}
imagesId={e?.Author?.Profile?.imagesId}
profileId={e?.Author?.Profile?.id}
tglPublish={new Date()}
jumlah_partisipan={e?.ProjectCollaboration_Partisipasi}
isAuthor={userLoginId === e.Author.id ? true : false}
colabId={e.id}
/>
<ComponentColab_CardSectionData
colabId={e.id}
path={RouterColab.main_detail}
data={e}
/>
<ComponentColab_JumlahPartisipan jumlah={e.ProjectCollaboration_Partisipasi} />
<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={[]}
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

@@ -5,30 +5,42 @@ 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/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

@@ -7,31 +7,35 @@ import ComponentColab_AuthorNameOnHeader from "../../component/header_author_nam
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/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

@@ -23,7 +23,7 @@ export interface MODEL_COLLABORATION {
Author: MODEL_USER;
ProjectCollaborationMaster_Status: MODEL_COLLABORATION_MASTER;
projectCollaborationMaster_StatusId: number;
ProjectCollaboration_Partisipasi: any[];
ProjectCollaboration_Partisipasi: MODEL_COLLABORATION_PARTISIPASI[];
}
export interface MODEL_COLLABORATION_PARTISIPASI {
@@ -35,4 +35,5 @@ export interface MODEL_COLLABORATION_PARTISIPASI {
User: MODEL_USER;
projectCollaborationId: string;
projectCollaboration_RoomChatId: string;
ProjectCollaboration: MODEL_COLLABORATION;
}

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 {