- Deskripsi:
- Notifikasi collaboration
## Issue: Scroll dari chat akan di ubah dengan package yang mas malik buat
This commit is contained in:
2024-07-29 10:07:52 +08:00
parent 01114e8405
commit 810ce1c00d
42 changed files with 892 additions and 997 deletions

View File

@@ -14,6 +14,7 @@
"dependencies": { "dependencies": {
"@emotion/react": "^11.11.1", "@emotion/react": "^11.11.1",
"@emotion/server": "^11.11.0", "@emotion/server": "^11.11.0",
"@hookstate/core": "^4.0.1",
"@mantine/carousel": "^7.1.5", "@mantine/carousel": "^7.1.5",
"@mantine/core": "^6.0.17", "@mantine/core": "^6.0.17",
"@mantine/dates": "^6.0.17", "@mantine/dates": "^6.0.17",

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@@ -1,5 +1,8 @@
import adminColab_getOneRoomChatById from "@/app_modules/admin/colab/fun/get/get_one_room_chat_by_id"; import adminColab_getOneRoomChatById from "@/app_modules/admin/colab/fun/get/get_one_room_chat_by_id";
import { Colab_GroupChatView } from "@/app_modules/colab"; import {
Colab_DetailGrupDiskusi,
Colab_GroupChatView,
} from "@/app_modules/colab";
import colab_getMessageByRoomId from "@/app_modules/colab/fun/get/room_chat/get_message_by_room_id"; import colab_getMessageByRoomId from "@/app_modules/colab/fun/get/room_chat/get_message_by_room_id";
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token"; import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id"; import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id";
@@ -16,14 +19,15 @@ export default async function Page({ params }: { params: { id: string } }) {
]); ]);
let listMsg = await colab_getMessageByRoomId({ roomId: roomId, page: 1 }); let listMsg = await colab_getMessageByRoomId({ roomId: roomId, page: 1 });
const dataUserLogin = await user_getOneByUserId(userLoginId); const dataUserLogin = await user_getOneByUserId(userLoginId);
// console.log(dataUserLogin);
return ( return (
<> <>
{/* <ColabViewChat {/* <Colab_DetailGrupDiskusi
listMsg={listMsg as any}
dataRoom={dataRoom as any}
userLoginId={userLoginId} userLoginId={userLoginId}
listMsg={listMsg}
selectRoom={dataRoom as any}
dataUserLogin={dataUserLogin as any}
roomId={roomId}
/> */} /> */}
<Colab_GroupChatView <Colab_GroupChatView

View File

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

View File

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

View File

@@ -0,0 +1,45 @@
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
import { Affix, rem, Center, Button } from "@mantine/core";
import { useState } from "react";
import colab_getListAllProyek from "../../fun/get/get_list_all_proyek";
export function ComponentColab_ButtonUpdateBeranda({
onLoad,
setIsNewPost,
}: {
onLoad: (val: any) => void;
setIsNewPost: any;
}) {
const [isLoading, setIsLoading] = useState(false);
async function onLoadData() {
const loadData = await colab_getListAllProyek({ page: 1 });
onLoad(loadData);
setIsNewPost(false);
}
return (
<>
<Affix position={{ top: rem(70) }} w={"100%"}>
<Center>
<Button
style={{
transition: "0.5s",
border: `1px solid ${AccentColor.skyblue}`,
backgroundColor: AccentColor.softblue,
}}
loaderPosition="center"
loading={isLoading ? true : false}
radius={"xl"}
opacity={0.8}
onClick={() => {
onLoadData();
}}
>
Update Beranda
</Button>
</Center>
</Affix>
</>
);
}

View File

@@ -128,7 +128,7 @@ export default function ComponentColab_AuthorNameOnListPartisipan({
radius={"xl"} radius={"xl"}
variant="transparent" variant="transparent"
> >
<IconCaretRight color={opened ? "blue" : "gray"} /> <IconCaretRight color={"white"} />
</ActionIcon> </ActionIcon>
) : ( ) : (
"" ""

View File

@@ -19,18 +19,17 @@ import {
Stack, Stack,
Text, Text,
Textarea, Textarea,
Title Title,
} from "@mantine/core"; } from "@mantine/core";
import { useDisclosure } from "@mantine/hooks"; import { useDisclosure } from "@mantine/hooks";
import { IconX } from "@tabler/icons-react"; import { IconX } from "@tabler/icons-react";
import { useState } from "react"; import { useState } from "react";
import colab_funCreatePartisipan from "../../fun/create/fun_create_partisipan_by_user_id"; import colab_funCreatePartisipan from "../../fun/create/fun_create_partisipan_by_user_id";
import colab_getListPartisipanByColabId from "../../fun/get/get_list_partisipan_by_id"; import colab_getListPartisipanByColabId from "../../fun/get/get_list_partisipan_by_id";
import { import { MODEL_COLLABORATION_PARTISIPASI } from "../../model/interface";
MODEL_COLLABORATION_PARTISIPASI
} from "../../model/interface";
import ComponentColab_AuthorNameOnListPartisipan from "./header_author_list_partisipan"; import ComponentColab_AuthorNameOnListPartisipan from "./header_author_list_partisipan";
import notifikasiToUser_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_user";
import mqtt_client from "@/util/mqtt_client";
export default function ComponentColab_DetailListPartisipasiUser({ export default function ComponentColab_DetailListPartisipasiUser({
listPartisipan, listPartisipan,
userLoginId, userLoginId,
@@ -50,22 +49,43 @@ export default function ComponentColab_DetailListPartisipasiUser({
const [deskripsi, setDeskripsi] = useState(""); const [deskripsi, setDeskripsi] = useState("");
async function onJoin() { async function onJoin() {
await colab_funCreatePartisipan( const res = await colab_funCreatePartisipan(
colabId as any, colabId as any,
userLoginId as any, userLoginId as any,
deskripsi deskripsi
).then(async (res) => { );
if (res.status === 201) { if (res.status === 201) {
await colab_getListPartisipanByColabId(colabId as any).then((val) => { const dataNotif = {
setApply(true); appId: res?.data?.ProjectCollaboration?.id,
close(); userId: res?.data?.ProjectCollaboration?.userId,
setData(val as any); pesan: res?.data?.ProjectCollaboration?.title,
ComponentGlobal_NotifikasiBerhasil(res.message); status: "Partisipan Project",
}); kategoriApp: "COLLABORATION",
} else { title: "Partisipan baru telah bergabung !",
ComponentGlobal_NotifikasiGagal(res.message); };
const createNotifikasi = await notifikasiToUser_funCreate({
data: dataNotif as any,
});
if (createNotifikasi.status === 201) {
mqtt_client.publish(
"USER",
JSON.stringify({
userId: dataNotif.userId,
count: 1,
})
);
} }
});
const resList = await colab_getListPartisipanByColabId(colabId as any);
setApply(true);
close();
setData(resList as any);
ComponentGlobal_NotifikasiBerhasil(res.message);
} else {
ComponentGlobal_NotifikasiGagal(res.message);
}
} }
return ( return (
@@ -104,7 +124,7 @@ export default function ComponentColab_DetailListPartisipasiUser({
</ActionIcon> </ActionIcon>
</Group> </Group>
<Textarea <Textarea
maxLength={300} maxLength={300}
label="Deskripsi Diri" label="Deskripsi Diri"
placeholder="Deskripsikan diri anda yang sesuai dengan proyek ini.." placeholder="Deskripsikan diri anda yang sesuai dengan proyek ini.."
minRows={4} minRows={4}
@@ -116,7 +136,10 @@ export default function ComponentColab_DetailListPartisipasiUser({
{/* <Button radius={"xl"} onClick={() => close()}> {/* <Button radius={"xl"} onClick={() => close()}>
Batal Batal
</Button> */} </Button> */}
<ComponentGlobal_InputCountDown lengthInput={deskripsi?.length} maxInput={300}/> <ComponentGlobal_InputCountDown
lengthInput={deskripsi?.length}
maxInput={300}
/>
<Button <Button
disabled={!deskripsi} disabled={!deskripsi}
radius={"xl"} radius={"xl"}
@@ -124,7 +147,7 @@ export default function ComponentColab_DetailListPartisipasiUser({
bg={MainColor.yellow} bg={MainColor.yellow}
onClick={() => onJoin()} onClick={() => onJoin()}
style={{ style={{
transition: "0.5s" transition: "0.5s",
}} }}
> >
Simpan Simpan

View File

@@ -1,29 +1,18 @@
"use client"; "use client";
import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
import {
Button,
NumberInput,
Select,
Stack,
Text,
TextInput,
Textarea,
} from "@mantine/core";
import { useRouter } from "next/navigation";
import { useState } from "react";
import {
MODEL_COLLABORATION,
MODEL_COLLABORATION_MASTER,
} from "../model/interface";
import colab_funCreateProyek from "../fun/create/fun_create_proyek";
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
import _ from "lodash";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
import { MainColor } from "@/app_modules/_global/color/color_pallet"; import { MainColor } from "@/app_modules/_global/color/color_pallet";
import ComponentGlobal_InputCountDown from "@/app_modules/_global/component/input_countdown"; import ComponentGlobal_InputCountDown from "@/app_modules/_global/component/input_countdown";
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
import { Button, Select, Stack, TextInput, Textarea } from "@mantine/core";
import { useRouter } from "next/navigation";
import { useState } from "react";
import colab_funCreateProyek from "../fun/create/fun_create_proyek";
import { MODEL_COLLABORATION_MASTER } from "../model/interface";
import mqtt_client from "@/util/mqtt_client"; import mqtt_client from "@/util/mqtt_client";
import { useHookstate } from "@hookstate/core";
import { useGsCollabCreate } from "../global_state/state";
export default function Colab_Create({ export default function Colab_Create({
listIndustri, listIndustri,
@@ -40,7 +29,7 @@ export default function Colab_Create({
}); });
return ( return (
<> <>
<Stack px={"sm"} py={"md"}> <Stack px={"xl"} py={"md"}>
<TextInput <TextInput
maxLength={100} maxLength={100}
styles={{ styles={{
@@ -176,7 +165,12 @@ function ButtonAction({ value }: { value: any }) {
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
async function onSave() { async function onSave() {
// console.log(value.jumlah_partisipan); mqtt_client.publish(
"Colab_create",
JSON.stringify({ isNewPost: true, count: 1 })
);
console.log(value.jumlah_partisipan);
if (value.title === "") if (value.title === "")
return ComponentGlobal_NotifikasiPeringatan("Lengkapi Data"); return ComponentGlobal_NotifikasiPeringatan("Lengkapi Data");
if (value.lokasi === "") if (value.lokasi === "")
@@ -188,15 +182,6 @@ function ButtonAction({ value }: { value: any }) {
const res = await colab_funCreateProyek(value); const res = await colab_funCreateProyek(value);
if (res.status === 201) { if (res.status === 201) {
// const dataNotif: any = {
// appId: res.data?.id as any,
// kategoriApp: "VOTING",
// status: create.data?.MasterStatus?.name as any,
// userId: create.data?.authorId as any,
// pesan: create.data?.title as any,
// title: "Job baru",
// };
setLoading(true); setLoading(true);
router.back(); router.back();
ComponentGlobal_NotifikasiBerhasil(res.message); ComponentGlobal_NotifikasiBerhasil(res.message);
@@ -223,9 +208,12 @@ function ButtonAction({ value }: { value: any }) {
loading={loading ? true : false} loading={loading ? true : false}
mt={"xl"} mt={"xl"}
radius={"xl"} radius={"xl"}
onClick={() => onSave()} onClick={() => {
onSave();
}}
bg={MainColor.yellow} bg={MainColor.yellow}
color={"yellow"} color={"yellow"}
c={"black"}
style={{ style={{
transition: "0.5s", transition: "0.5s",
}} }}

View File

@@ -387,35 +387,4 @@ export default function Colab_GroupChatView({
</Box> </Box>
</> </>
); );
// return (
// <Stack bg={"dark"}>
// <Button
// onClick={() => {
// const dd = _.clone(data[0]);
// dd.message = "apa kabar";
// console.log(dd);
// mqtt_client.publish(selectRoom.id, JSON.stringify(dd));
// }}
// >
// kirim pesan
// </Button>
// <div
// ref={ref as any}
// style={{
// overflowY: "auto",
// }}
// >
// {data.map((v, k) => (
// <Stack key={k}>
// <Card withBorder shadow="md" mt={"md"}>
// <Code>
// <pre>{JSON.stringify(v, null, 2)}</pre>
// </Code>
// </Card>
// </Stack>
// ))}
// </div>
// </Stack>
// );
} }

View File

@@ -1,199 +1,347 @@
"use client"; "use client";
import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal"; import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
import { MODEL_USER } from "@/app_modules/home/model/interface";
import mqtt_client from "@/util/mqtt_client"; import mqtt_client from "@/util/mqtt_client";
import { import {
ActionIcon, ActionIcon,
Affix,
Box, Box,
Center, Center,
Container,
Flex,
Grid, Grid,
Group, Group,
Loader, Loader,
Paper, Paper,
rem,
Stack, Stack,
Text, Text,
Textarea, Textarea,
rem Title,
} from "@mantine/core"; } from "@mantine/core";
import { useShallowEffect } from "@mantine/hooks";
import { import {
useShallowEffect IconChevronLeft,
} from "@mantine/hooks"; IconCircle,
import { IconCircle, IconSend } from "@tabler/icons-react"; IconInfoSquareRounded,
IconSend,
} from "@tabler/icons-react";
import _ from "lodash"; import _ from "lodash";
import { useRouter } from "next/navigation";
import { useState } from "react"; import { useState } from "react";
import useInfiniteScroll, {
ScrollDirection,
} from "react-easy-infinite-scroll-hook";
import ComponentColab_IsEmptyData from "../../component/is_empty_data"; import ComponentColab_IsEmptyData from "../../component/is_empty_data";
import colab_funCreateMessageByUserId from "../../fun/create/room/fun_create_message_by_user_id"; import colab_funCreateMessageByUserId from "../../fun/create/room/fun_create_message_by_user_id";
import colab_getMessageByRoomId from "../../fun/get/room_chat/get_message_by_room_id"; import colab_getMessageByRoomId from "../../fun/get/room_chat/get_message_by_room_id";
import {
MODEL_COLLABORATION_MESSAGE,
MODEL_COLLABORATION_ROOM_CHAT,
} from "../../model/interface";
import {
AccentColor,
MainColor,
} from "@/app_modules/_global/color/color_pallet";
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
import { ScrollOnly } from "next-scroll-loader";
export default function Colab_DetailGrupDiskusi({ export default function Colab_DetailGrupDiskusi({
roomId,
listMsg,
userLoginId, userLoginId,
listMsg,
selectRoom,
dataUserLogin,
roomId,
}: { }: {
roomId: string;
listMsg?: any[];
userLoginId: string; userLoginId: string;
listMsg: any;
selectRoom: MODEL_COLLABORATION_ROOM_CHAT;
dataUserLogin: MODEL_USER;
roomId: string;
}) { }) {
const [msg, setMsg] = useState(""); const [msg, setMsg] = useState("");
const [data, setData] = useState<any[]>(listMsg as any); const [newMessage, setNewMessage] = useState<any>();
const [page, setPage] = useState(1); const [data, setData] = useState<any[]>(listMsg);
const [totalPage, setTotalPage] = useState(1);
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const [isGet, setIsGet] = useState(true); const [isGet, setIsGet] = useState(true);
const [newMessageId, setIdMessage] = useState("");
// const next = async (direction: ScrollDirection) => { const [activePage, setActivePage] = useState(1);
// try {
// setIsLoading(true);
// await new Promise((a) => setTimeout(a, 100));
// setPage(page + 1); // async function onSend() {
// const newData = await colab_getMessageByRoomId(roomId, page + 1); // await colab_funCreateMessageByUserId(msg, selectRoom.id).then(
// async (res) => {
// console.log(newData); // if (res.status === 200) {
// setIdMessage(res.data?.id as any);
// if (_.isEmpty(newData)) { // setMsg("");
// setIsGet(false); // const kiriman: MODEL_COLLABORATION_MESSAGE = {
// } else { // createdAt: new Date(),
// setData((prev) => (direction === "up" ? [...newData, ...prev] : [])); // id: newMessageId,
// isActive: true,
// message: msg,
// isFile: false,
// updatedAt: new Date(),
// userId: dataUserLogin.id,
// User: {
// id: dataUserLogin.id,
// Profile: {
// id: dataUserLogin.Profile?.id as any,
// name: dataUserLogin.Profile?.name as any,
// },
// },
// };
// mqtt_client.publish(selectRoom.id, JSON.stringify(kiriman));
// } else {
// ComponentGlobal_NotifikasiGagal(res.message);
// }
// } // }
// } finally { // );
// setIsLoading(false); // }
// }
// };
// const ref = useInfiniteScroll({ // useShallowEffect(() => {
// next, // mqtt_client.subscribe(selectRoom.id);
// rowCount: data.length, // // mqtt_client.on("message", (topic: any, message: any) => {
// hasMore: { up: isGet }, // // onList(message.toString());
// scrollThreshold: 0.1, // // });
// initialScroll: { top: 100 },
// });
useShallowEffect(() => { // mqtt_client.on("message", (topic: any, message: any) => {
mqtt_client.subscribe(roomId); // let dd = _.clone(data);
// const a = [...dd, JSON.parse(message)];
// // console.log(dd.length);
// setData(a);
// });
// }, [data]);
mqtt_client.on("message", (data: any, msg: any) => { // async function onList(message: any) {
onList(setData); // const kiriman: MODEL_COLLABORATION_MESSAGE = {
}); // createdAt: new Date(),
}, [setData]); // id: newMessageId,
// isActive: true,
async function onList(setData: any) { // message: message,
await colab_getMessageByRoomId({ page: page, roomId: roomId }).then((val) => // isFile: false,
setData(val) // updatedAt: new Date(),
); // userId: dataUserLogin.id,
} // User: {
// id: dataUserLogin.id,
async function onSend() { // Profile: {
await colab_funCreateMessageByUserId(msg, roomId).then(async (res) => { // id: dataUserLogin.Profile?.id as any,
if (res.status === 200) { // name: dataUserLogin.Profile?.name as any,
mqtt_client.publish(roomId, msg); // },
setMsg(""); // },
} else { // };
ComponentGlobal_NotifikasiGagal(res.message);
}
});
}
// const dataLama = _.clone(data);
// setData([...dataLama, { ...kiriman }]);
// }
return ( return (
<> <>
<Box h={"80vh"} bg={"blue.1"}> <Box
<Stack justify="flex-end" h={"100%"}> w={"100%"}
<div h={"100%"}
style={{ style={{
// overflow: "scroll", overflowY: "auto",
overflowY: "auto", overflowX: "auto",
// height: "100vh", backgroundColor: MainColor.black,
// justifyContent: "flex-end", position: "fixed",
// flexDirection: "column", }}
// display: "flex", >
}} <Container mih={"100vh"} p={0} size={rem(500)} bg={MainColor.darkblue}>
> {/* Header */}
{isLoading && ( <HeaderGrup selectRoom={selectRoom} />
<Center>
<Loader size={20} color="gray" />
</Center>
)}
{_.isEmpty(data) ? (
<ComponentColab_IsEmptyData text="Belum ada pesan" />
) : (
data.map((e, i) => (
<Box key={i}>
{userLoginId === e?.User?.id ? (
<Group position="right">
<Paper key={e.id} bg={"blue.2"} p={"sm"} mt={"sm"}>
<Stack spacing={0}>
<Text lineClamp={1} fw={"bold"} fz={"xs"}>
{e.User.Profile.name}
</Text>
<div
dangerouslySetInnerHTML={{ __html: e.message }}
/>
<Group spacing={"xs"}> {/* Main View */}
<Text fz={7}> <Box
{new Intl.DateTimeFormat("id-ID", { py={"xs"}
timeStyle: "medium", px={"xs"}
}).format(e.createdAt)} pos={"static"}
</Text> style={{ zIndex: 0 }}
<IconCircle size={3} /> h={"82vh"}
<Text fz={7}> >
{new Intl.DateTimeFormat("id-ID", { {/* Chat View */}
dateStyle: "medium", {_.isEmpty(data) ? (
}).format(e.createdAt)} <ComponentGlobal_IsEmptyData />
</Text> ) : (
</Group> // --- Main component --- //
</Stack> <Box bg={"red"}>
</Paper> <ScrollOnly
</Group> height="80vh"
) : ( renderLoading={() => (
<Group> <Center mt={"lg"}>
<Paper key={e.id} bg={"cyan.2"} p={"sm"} mt={"sm"}> <Loader color={"yellow"} />
<Stack spacing={0}> </Center>
<Text lineClamp={1} fw={"bold"} fz={"xs"}>
{e.User.Profile.name}
</Text>
<div
dangerouslySetInnerHTML={{ __html: e.message }}
/>
<Group spacing={"xs"}>
<Text fz={7}>
{new Intl.DateTimeFormat("id-ID", {
timeStyle: "medium",
}).format(e.createdAt)}
</Text>
<IconCircle size={3} />
<Text fz={7}>
{new Intl.DateTimeFormat("id-ID", {
dateStyle: "medium",
}).format(e.createdAt)}
</Text>
</Group>
</Stack>
</Paper>
</Group>
)} )}
</Box> data={data}
)) setData={setData}
moreData={async () => {
let loadData = await colab_getMessageByRoomId({
roomId: roomId,
page: 1,
});
setActivePage((val) => val + 1);
return loadData;
}}
>
{(item) => (
<Flex >{item.message}</Flex>
// <Flex bg={"cyan"} align={"flex-end"}>
// {userLoginId === item?.User?.id ? (
// <Group position="right">
// <Paper
// key={item?.id}
// bg={"blue.2"}
// p={"sm"}
// mt={"sm"}
// >
// <Stack spacing={0}>
// <Text lineClamp={1} fw={"bold"} fz={"xs"}>
// {item?.User?.Profile?.name}
// </Text>
// <div
// dangerouslySetInnerHTML={{
// __html: item?.message,
// }}
// />
// </Stack>
// </Paper>
// </Group>
// ) : (
// <Group>
// <Paper
// key={item?.id}
// bg={"cyan.2"}
// p={"sm"}
// mt={"sm"}
// >
// <Stack spacing={0}>
// <Text lineClamp={1} fw={"bold"} fz={"xs"}>
// {item?.User?.Profile?.name}
// </Text>
// <div
// dangerouslySetInnerHTML={{
// __html: item?.message,
// }}
// />
// </Stack>
// </Paper>
// </Group>
// )}
// </Flex>
)}
</ScrollOnly>
</Box>
)} )}
{/* {isLoading && ( </Box>
{/* Footer */}
<FooterGrup msg={msg} setMsg={setMsg} />
</Container>
</Box>
</>
);
}
function HeaderGrup({
selectRoom,
}: {
selectRoom: MODEL_COLLABORATION_ROOM_CHAT;
}) {
const router = useRouter();
const [loadingBack, setLoadingBack] = useState(false);
const [loadingInfo, setLoadingInfo] = useState(false);
return (
<>
<Box
h={"8vh"}
style={{
zIndex: 10,
}}
w={"100%"}
pos={"sticky"}
top={0}
bg={MainColor.darkblue}
>
<Stack h={"100%"} justify="center" px={"sm"}>
<Grid grow gutter={"lg"}>
<Grid.Col span={2}>
<ActionIcon
variant="transparent"
radius={"xl"}
onClick={() => {
setLoadingBack(true);
router.back();
}}
>
{loadingBack ? (
<ComponentGlobal_Loader />
) : (
<IconChevronLeft color="white" />
)}
</ActionIcon>
</Grid.Col>
<Grid.Col span={8}>
<Center> <Center>
<Loader variant="bars" size={20} color="gray" /> <Title c={"white"} order={5} lineClamp={1}>
{selectRoom?.name}
</Title>
</Center> </Center>
)} */} </Grid.Col>
</div> <Grid.Col span={2}>
<Group position="right">
<ActionIcon
variant="transparent"
radius={"xl"}
onClick={() => {
setLoadingInfo(true);
router.push(RouterColab.info_grup + selectRoom.id, {
scroll: false,
});
}}
>
{loadingInfo ? (
<ComponentGlobal_Loader />
) : (
<IconInfoSquareRounded color="white" />
)}
</ActionIcon>
</Group>
</Grid.Col>
</Grid>
</Stack> </Stack>
</Box> </Box>
{/* <pre>{JSON.stringify(data, null, 2)}</pre> */} </>
);
}
<Affix function FooterGrup({
bg={"gray.2"} msg,
h={"10vh"} setMsg,
position={{ bottom: rem(0) }} }: {
w={"100%"} msg: string;
zIndex={99} setMsg: (val: any) => any;
p={"xs"} }) {
async function onSend() {
console.log(msg);
}
return (
<>
<Box
style={{
position: "relative",
bottom: 0,
height: "10vh",
zIndex: 10,
// borderRadius: "20px 20px 0px 0px",
borderTop: `2px solid ${AccentColor.blue}`,
borderRight: `1px solid ${AccentColor.blue}`,
borderLeft: `1px solid ${AccentColor.blue}`,
}}
bg={AccentColor.darkblue}
> >
<Stack justify="center" h={"100%"} px={"sm"}> <Stack justify="center" h={"100%"} px={"sm"}>
<Grid align="center"> <Grid align="center">
@@ -210,11 +358,15 @@ export default function Colab_DetailGrupDiskusi({
<ActionIcon <ActionIcon
disabled={msg === "" ? true : false} disabled={msg === "" ? true : false}
variant="filled" variant="filled"
bg={"cyan"} bg={AccentColor.softblue}
color={"cyan"}
radius={"xl"} radius={"xl"}
size={"xl"} size={"xl"}
onClick={() => { onClick={() => {
onSend(); onSend()
}}
style={{
transition: "0.5s",
}} }}
> >
<IconSend size={20} /> <IconSend size={20} />
@@ -222,216 +374,7 @@ export default function Colab_DetailGrupDiskusi({
</Grid.Col> </Grid.Col>
</Grid> </Grid>
</Stack> </Stack>
</Affix> </Box>
</> </>
); );
// "use client";
// import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
// import {
// ActionIcon,
// Box,
// Button,
// Card,
// Center,
// Code,
// Grid,
// Group,
// Header,
// Loader,
// Paper,
// ScrollArea,
// Stack,
// Text,
// Textarea,
// Title,
// } from "@mantine/core";
// import {
// IconChevronLeft,
// IconCircle,
// IconInfoSquareRounded,
// IconSend,
// } from "@tabler/icons-react";
// import { useRouter } from "next/navigation";
// import router from "next/router";
// import { useRef, useState } from "react";
// import {
// MODEL_COLLABORATION_MESSAGE,
// MODEL_COLLABORATION_ROOM_CHAT,
// } from "../../model/interface";
// import _ from "lodash";
// import ComponentColab_IsEmptyData from "../../component/is_empty_data";
// import colab_getMessageByRoomId from "../../fun/get/room_chat/get_message_by_room_id";
// import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
// import colab_funCreateMessageByUserId from "../../fun/create/room/fun_create_message_by_user_id";
// import { useShallowEffect } from "@mantine/hooks";
// import mqtt_client from "@/util/mqtt_client";
// import useInfiniteScroll, {
// ScrollDirection,
// } from "react-easy-infinite-scroll-hook";
// import toast from "react-simple-toasts";
// import colab_getOneMessageById from "../../fun/get/room_chat/get_one_message_by_id";
// const list = Array(100).fill(0);
// export default function ColabViewChat({
// userLoginId,
// listMsg,
// dataRoom,
// }: {
// userLoginId: string;
// listMsg: any;
// dataRoom?: MODEL_COLLABORATION_ROOM_CHAT;
// }) {
// // Tamplate app layout
// const router = useRouter();
// const [loadingBack, setLoadingBack] = useState(false);
// const [loadingInfo, setLoadingInfo] = useState(false);
// // State message
// const [msg, setMsg] = useState("");
// const [data, setData] = useState(listMsg);
// const [ls, setLs] = useState(list);
// const viewport = useRef<HTMLDivElement>(null);
// const scrollBottom = () => {
// viewport.current?.scrollTo({
// top: viewport.current.scrollHeight,
// behavior: "smooth",
// });
// };
// // Kirim pesan
// async function onSend() {
// setMsg("");
// setLs([...[msg], ...ls]);
// scrollBottom();
// }
// return (
// <>
// <Box h={"100vh"}>
// {/* Header */}
// <Box
// style={{
// zIndex: 99,
// }}
// w={"100%"}
// pos={"fixed"}
// top={0}
// h={"7vh"}
// >
// <Stack bg={"gray.2"} h={"100%"} justify="center" px={"sm"}>
// <Grid grow gutter={"lg"}>
// <Grid.Col span={2}>
// <ActionIcon
// loading={loadingBack ? true : false}
// variant="transparent"
// radius={"xl"}
// onClick={() => {
// setLoadingBack(true);
// router.back();
// }}
// >
// <IconChevronLeft />
// </ActionIcon>
// </Grid.Col>
// <Grid.Col span={8}>
// <Center>
// <Title order={5} lineClamp={1}>
// {dataRoom?.name}
// </Title>
// </Center>
// </Grid.Col>
// <Grid.Col span={2}>
// <Group position="right">
// <ActionIcon
// loading={loadingInfo ? true : false}
// variant="transparent"
// radius={"xl"}
// onClick={() => {
// setLoadingInfo(true);
// router.push(RouterColab.info_grup + dataRoom?.id);
// }}
// >
// <IconInfoSquareRounded />
// </ActionIcon>
// </Group>
// </Grid.Col>
// </Grid>
// </Stack>
// </Box>
// {/* Main View */}
// <Box pos={"static"}>
// <Box
// style={{
// height: "7vh",
// }}
// />
// {/* Chat View */}
// <Box h={"83vh"} bg={"blue"}>
// <ScrollArea h={"100%"} viewportRef={viewport}>
// {ls.map((e, i) => (
// <Text key={i}>{`${e + 1 + i++}`}</Text>
// ))}
// </ScrollArea>
// </Box>
// <Box
// style={{
// height: "10vh",
// }}
// />
// </Box>
// {/* Footer */}
// <Box
// style={{
// zIndex: 98,
// }}
// w={"100%"}
// pos={"fixed"}
// bottom={0}
// h={"10vh"}
// bg={"gray.2"}
// >
// <Stack justify="center" h={"100%"} px={"sm"}>
// <Grid align="center">
// <Grid.Col span={"auto"}>
// <Textarea
// minRows={1}
// radius={"md"}
// placeholder="Ketik pesan anda..."
// onChange={(val) => {
// setMsg(val.currentTarget.value);
// }}
// />
// </Grid.Col>
// <Grid.Col span={"content"}>
// <ActionIcon
// disabled={msg ? false : true}
// variant="filled"
// bg={"cyan"}
// radius={"xl"}
// size={"xl"}
// onClick={() => {
// onSend();
// }}
// >
// <IconSend size={20} />
// </ActionIcon>
// </Grid.Col>
// </Grid>
// </Stack>
// </Box>
// </Box>
// </>
// );
// }
} }

View File

@@ -1,125 +0,0 @@
"use client";
import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
import {
ActionIcon,
Box,
Center,
Grid,
Group,
Header,
Stack,
Title
} from "@mantine/core";
import {
IconChevronLeft,
IconInfoSquareRounded
} from "@tabler/icons-react";
import { useRouter } from "next/navigation";
import React, { useState } from "react";
import { MODEL_COLLABORATION_ROOM_CHAT } from "../../model/interface";
export default function LayoutColab_DetailGrupDiskusi({
children,
dataRoom,
}: {
children: React.ReactNode;
dataRoom: MODEL_COLLABORATION_ROOM_CHAT;
}) {
const router = useRouter();
const [loadingBack, setLoadingBack] = useState(false);
const [loadingInfo, setLoadingInfo] = useState(false);
return (
<>
<Box>
{/* Header */}
<Box
style={{
zIndex: 99,
}}
w={"100%"}
bg={"black"}
pos={"fixed"}
top={0}
h={50}
>
{/* <ComponentColab_HeaderTamplate
title={dataRoom.name + " " + "fwf wfwe efewf wef"}
bg={"gray.2"}
icon={<IconInfoSquareRounded />}
route2={RouterColab.info_grup + dataRoom?.id}
/> */}
<Header height={50} sx={{ borderStyle: "none" }} bg={"gray.2"}>
<Stack h={50} justify="center" px={"sm"}>
<Grid grow gutter={"lg"}>
<Grid.Col span={2}>
<ActionIcon
loading={loadingBack ? true : false}
variant="transparent"
radius={"xl"}
onClick={() => {
setLoadingBack(true);
router.back();
}}
>
<IconChevronLeft />
</ActionIcon>
</Grid.Col>
<Grid.Col span={8}>
<Center>
<Title order={5} lineClamp={1}>
{dataRoom.name}
</Title>
</Center>
</Grid.Col>
<Grid.Col span={2}>
<Group position="right">
<ActionIcon
loading={loadingInfo ? true : false}
variant="transparent"
radius={"xl"}
onClick={() => {
setLoadingInfo(true);
router.push(RouterColab.info_grup + dataRoom?.id);
}}
>
<IconInfoSquareRounded />
</ActionIcon>
</Group>
</Grid.Col>
</Grid>
</Stack>
{/* <Group position="apart" px={"sm"} h={"100%"}>
<ActionIcon>
<IconChevronLeft />
</ActionIcon>
<Box w={width > 375 ? 300 : 200}>
<Text truncate>ff fsafsdfdaf sadsadf asdfda ewfw wefewf</Text>
</Box>
<ActionIcon>
<IconInfoSquareRounded />
</ActionIcon>
</Group> */}
</Header>
</Box>
{/* Children */}
<Box py={"xs"} px={"xs"} pos={"static"}>
<Box
style={{
height: 50,
}}
></Box>
<Stack>
{children}
<Box
style={{
height: "10vh",
}}
></Box>
</Stack>
</Box>
</Box>
</>
);
}

View File

@@ -17,6 +17,7 @@ import {
MODEL_COLLABORATION, MODEL_COLLABORATION,
MODEL_COLLABORATION_PARTISIPASI, MODEL_COLLABORATION_PARTISIPASI,
} from "@/app_modules/colab/model/interface"; } from "@/app_modules/colab/model/interface";
import { notifikasiToUser_CreateGroupCollaboration } from "@/app_modules/notifikasi/fun/create/create_notif_to_user_collaboration";
import { import {
ActionIcon, ActionIcon,
Button, Button,
@@ -37,6 +38,8 @@ import { useAtom } from "jotai";
import _ from "lodash"; import _ from "lodash";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useState } from "react"; import { useState } from "react";
import mqtt_client from "@/util/mqtt_client";
export default function Colab_DetailProyekSaya({ export default function Colab_DetailProyekSaya({
dataColab, dataColab,
@@ -78,59 +81,6 @@ function CheckBoxPartisipan({
}) { }) {
const [value, setValue] = useState<string[]>([]); const [value, setValue] = useState<string[]>([]);
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",
},
];
return ( return (
<> <>
<Stack> <Stack>
@@ -208,17 +158,29 @@ function ButtonAction({
async function onSave() { async function onSave() {
if (nameRoom === "") if (nameRoom === "")
return ComponentGlobal_NotifikasiPeringatan("Isi Nama Grup"); return ComponentGlobal_NotifikasiPeringatan("Lengkapi Nama Grup");
await colab_funCreateRoomChat(nameRoom, value, colabId).then((res) => {
if (res.status === 201) { // await notifikasiToUser_CreateGroupCollaboration({ colabId: colabId });
setLoading(true);
ComponentGlobal_NotifikasiBerhasil("Berhasil Membuat Grup"); const res = await colab_funCreateRoomChat(nameRoom, value, colabId);
setHotMenu(4); if (res.status === 201) {
router.push(RouterColab.grup_diskusi); for (let a of value) {
} else { mqtt_client.publish(
ComponentGlobal_NotifikasiGagal("Gagal Membuat Grup"); "USER",
JSON.stringify({
userId: a,
count: 1,
})
);
} }
});
setLoading(true);
ComponentGlobal_NotifikasiBerhasil("Berhasil Membuat Grup");
setHotMenu(4);
router.push(RouterColab.grup_diskusi);
} else {
ComponentGlobal_NotifikasiGagal("Gagal Membuat Grup");
}
} }
return ( return (
@@ -231,6 +193,7 @@ function ButtonAction({
}} }}
bg={MainColor.yellow} bg={MainColor.yellow}
color="yellow" color="yellow"
c={"black"}
style={{ style={{
transition: "0.5s", transition: "0.5s",
}} }}
@@ -286,6 +249,7 @@ function ButtonAction({
loading={loading ? true : false} loading={loading ? true : false}
radius={"xl"} radius={"xl"}
color="yellow" color="yellow"
c={"black"}
bg={MainColor.yellow} bg={MainColor.yellow}
onClick={() => onSave()} onClick={() => onSave()}
style={{ style={{

View File

@@ -1,25 +1,18 @@
"use client"; "use client";
import { import { MainColor } from "@/app_modules/_global/color/color_pallet";
Stack, import ComponentGlobal_InputCountDown from "@/app_modules/_global/component/input_countdown";
TextInput, import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
Select, import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
Textarea, import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
Button, import { Button, Select, Stack, Textarea, TextInput } from "@mantine/core";
Text,
} from "@mantine/core";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import React, { useState } from "react"; import { useState } from "react";
import colab_funEditById from "../fun/edit/fun_edit_by_id";
import { import {
MODEL_COLLABORATION, MODEL_COLLABORATION,
MODEL_COLLABORATION_MASTER, MODEL_COLLABORATION_MASTER,
} from "../model/interface"; } from "../model/interface";
import colab_funEditById from "../fun/edit/fun_edit_by_id";
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
import ComponentGlobal_InputCountDown from "@/app_modules/_global/component/input_countdown";
import { MainColor } from "@/app_modules/_global/color/color_pallet";
export default function Colab_Edit({ export default function Colab_Edit({
selectedData, selectedData,
@@ -31,7 +24,7 @@ export default function Colab_Edit({
const [value, setValue] = useState(selectedData); const [value, setValue] = useState(selectedData);
return ( return (
<> <>
<Stack px={"sm"} py={"md"}> <Stack px={"xl"} py={"md"}>
{/* <pre>{JSON.stringify(value, null, 2)}</pre> */} {/* <pre>{JSON.stringify(value, null, 2)}</pre> */}
<TextInput <TextInput
maxLength={100} maxLength={100}
@@ -217,6 +210,7 @@ function ButtonAction({ value }: { value: any }) {
onClick={() => onUpdate()} onClick={() => onUpdate()}
bg={MainColor.yellow} bg={MainColor.yellow}
color={"yellow"} color={"yellow"}
c={"black"}
style={{ style={{
transition: "0.5s", transition: "0.5s",
}} }}

View File

@@ -13,11 +13,24 @@ export default async function colab_funCreatePartisipan(
data: { data: {
projectCollaborationId: colabId, projectCollaborationId: colabId,
userId: userId, userId: userId,
deskripsi_diri: deskripsi deskripsi_diri: deskripsi,
},
select: {
ProjectCollaboration: {
select: {
id: true,
title: true,
userId: true,
},
},
}, },
}); });
if (!create) return { status: 400, message: "Gagal menambahkan partisipan" }; if (!create) return { status: 400, message: "Gagal menambahkan partisipan" };
revalidatePath(RouterColab.main_detail + colabId); revalidatePath(RouterColab.main_detail + colabId);
return { status: 201, message: "Berhasil menambahkan partisipan" }; return {
} data: create,
status: 201,
message: "Berhasil menambahkan partisipan",
};
}

View File

@@ -32,6 +32,20 @@ export default async function colab_funCreateRoomChat(
if (!createAnggota) if (!createAnggota)
return { status: 400, message: "Gagal Menambah Anggota" }; return { status: 400, message: "Gagal Menambah Anggota" };
const createdNotifikasi = await prisma.notifikasi.create({
data: {
userId: v,
appId: createRoom.id,
status: "Collaboration Group",
title: "Grup Kolaborasi Baru",
pesan: createRoom.name,
kategoriApp: "COLLABORATION",
userRoleId: "1",
},
});
if (!createdNotifikasi)
return { status: 400, message: "Gagal mengirim notifikasi" };
} }
const createForAuthor = const createForAuthor =

View File

@@ -0,0 +1,8 @@
import { hookstate, useHookstate } from "@hookstate/core";
const gs_colab_create = hookstate<boolean>(false);
export function useGsCollabCreate(){
const state = useHookstate(gs_colab_create);
const value = state.get();
return [value, state.set] as const
}

View File

@@ -19,7 +19,6 @@ import Colab_DetailPartisipasiProyek from "./detail/proyek/partisipasi";
import LayoutColab_DetailPartisipasiProyek from "./detail/proyek/partisipasi/layout"; import LayoutColab_DetailPartisipasiProyek from "./detail/proyek/partisipasi/layout";
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 Colab_NotifikasiView from "./main/pemberitahuan"; import Colab_NotifikasiView from "./main/pemberitahuan";
import Colab_DetailProyekSaya from "./detail/proyek/saya"; import Colab_DetailProyekSaya from "./detail/proyek/saya";
import LayoutColab_DetailProyekSaya from "./detail/proyek/saya/layout"; import LayoutColab_DetailProyekSaya from "./detail/proyek/saya/layout";
@@ -49,7 +48,6 @@ export {
LayoutColab_DetailPartisipasiProyek, LayoutColab_DetailPartisipasiProyek,
Colab_GrupDiskus, Colab_GrupDiskus,
Colab_DetailGrupDiskusi, Colab_DetailGrupDiskusi,
LayoutColab_DetailGrupDiskusi,
Colab_NotifikasiView, Colab_NotifikasiView,
Colab_DetailProyekSaya, Colab_DetailProyekSaya,
LayoutColab_DetailProyekSaya, LayoutColab_DetailProyekSaya,

View File

@@ -1,20 +1,19 @@
"use client"; "use client";
import { RouterColab } from "@/app/lib/router_hipmi/router_colab"; import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
import ComponentGlobal_CreateButton from "@/app_modules/_global/component/button_create"; import ComponentGlobal_CreateButton from "@/app_modules/_global/component/button_create";
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data"; import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
import { event_getListAllPublish } from "@/app_modules/event/fun/get/get_list_all_publish"; import mqtt_client from "@/util/mqtt_client";
import { import { Affix, Box, Button, Center, Loader, rem } from "@mantine/core";
Box, import { useShallowEffect } from "@mantine/hooks";
Center,
Loader
} from "@mantine/core";
import _ from "lodash"; import _ from "lodash";
import { ScrollOnly } from "next-scroll-loader"; import { ScrollOnly } from "next-scroll-loader";
import { useState } from "react"; import { useState } from "react";
import { ComponentColab_CardBeranda } from "../component/card_view/card_beranda"; import { ComponentColab_CardBeranda } from "../component/card_view/card_beranda";
import { MODEL_COLLABORATION } from "../model/interface";
import colab_getListAllProyek from "../fun/get/get_list_all_proyek"; import colab_getListAllProyek from "../fun/get/get_list_all_proyek";
import { MODEL_COLLABORATION } from "../model/interface";
import { ComponentColab_ButtonUpdateBeranda } from "../component/button/button_update_beranda";
export default function Colab_Beranda({ export default function Colab_Beranda({
listData, listData,
@@ -26,9 +25,30 @@ export default function Colab_Beranda({
const [data, setData] = useState(listData); const [data, setData] = useState(listData);
const [activePage, setActivePage] = useState(1); const [activePage, setActivePage] = useState(1);
const [isNewPost, setIsNewPost] = useState(false);
useShallowEffect(() => {
mqtt_client.subscribe("Colab_create");
mqtt_client.on("message", (topic, message) => {
if (topic === "Colab_create") {
setIsNewPost(JSON.parse(message.toString()).isNewPost);
}
});
}, []);
return ( return (
<> <>
<Box> <Box>
{isNewPost && (
<ComponentColab_ButtonUpdateBeranda
onLoad={(val) => {
setData(val);
}}
setIsNewPost={setIsNewPost}
/>
)}
<ComponentGlobal_CreateButton path={RouterColab.create} /> <ComponentGlobal_CreateButton path={RouterColab.create} />
{_.isEmpty(data) ? ( {_.isEmpty(data) ? (

View File

@@ -1,33 +1,19 @@
"use client"; "use client";
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
import { import {
Box, Box,
Center, Center,
Grid, Loader
Group,
Loader,
Paper,
Stack,
Text,
Title,
} from "@mantine/core"; } from "@mantine/core";
import ComponentColab_AuthorNameOnHeader from "../../component/header_author_name";
import { IconChevronCompactRight, IconChevronRight } from "@tabler/icons-react";
import { useRouter } from "next/navigation";
import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
import {
MODEL_COLLABORATION_ANGGOTA_ROOM_CHAT,
MODEL_COLLABORATION_ROOM_CHAT,
} from "../../model/interface";
import { useState } from "react";
import _ from "lodash"; import _ from "lodash";
import ComponentColab_IsEmptyData from "../../component/is_empty_data";
import { ComponentColab_CardGrup } from "../../component/card_view/crad_grup";
import ComponentGlobal_CreateButton from "@/app_modules/_global/component/button_create";
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
import { ScrollOnly } from "next-scroll-loader"; import { ScrollOnly } from "next-scroll-loader";
import colab_getListAllProyek from "../../fun/get/get_list_all_proyek"; import { useState } from "react";
import { ComponentColab_CardGrup } from "../../component/card_view/crad_grup";
import colab_getListRoomChatByAuthorId from "../../fun/get/room_chat/get_list_room_by_author_id"; import colab_getListRoomChatByAuthorId from "../../fun/get/room_chat/get_list_room_by_author_id";
import {
MODEL_COLLABORATION_ANGGOTA_ROOM_CHAT
} from "../../model/interface";
export default function Colab_GrupDiskus({ export default function Colab_GrupDiskus({
listRoom, listRoom,

View File

@@ -63,13 +63,13 @@ export default function MainCrowd() {
color: "white", color: "white",
}} }}
onClick={() => { onClick={() => {
// setLoadingInv(true); setLoadingInv(true);
// router.push(RouterCrowd.investasi); router.push(RouterCrowd.investasi);
// setChangeColor(0); setChangeColor(0);
ComponentGlobal_NotifikasiPeringatan( // ComponentGlobal_NotifikasiPeringatan(
"Sementara ini sedang maintenance", // "Sementara ini sedang maintenance",
3000 // 3000
); // );
}} }}
> >
<Grid> <Grid>
@@ -103,13 +103,13 @@ export default function MainCrowd() {
color: "white", color: "white",
}} }}
onClick={() => { onClick={() => {
// setLoadingDon(true); setLoadingDon(true);
// router.push(RouterCrowd.donasi); router.push(RouterCrowd.donasi);
// setDonasiHotMenu(0); setDonasiHotMenu(0);
ComponentGlobal_NotifikasiPeringatan( // ComponentGlobal_NotifikasiPeringatan(
"Sementara ini sedang maintenance", // "Sementara ini sedang maintenance",
3000 // 3000
); // );
}} }}
> >
<Grid> <Grid>

View File

@@ -95,7 +95,7 @@ export default function CreateCeritaPenggalangDonasi({
} }
return ( return (
<> <>
<Stack spacing={50} px={"md"} py={"md"}> <Stack spacing={50} px={"xl"} py={"md"}>
{/* <pre>{JSON.stringify(dataTempo, null, 2)}</pre> */} {/* <pre>{JSON.stringify(dataTempo, null, 2)}</pre> */}
<Stack spacing={"sm"}> <Stack spacing={"sm"}>
<ComponentGlobal_BoxInformation informasi="Ceritakan dengan jujur & benar mengapa Penggalanagn Dana ini harus diadakan!" /> <ComponentGlobal_BoxInformation informasi="Ceritakan dengan jujur & benar mengapa Penggalanagn Dana ini harus diadakan!" />

View File

@@ -87,7 +87,7 @@ export default function CreateDonasi({
return ( return (
<> <>
<Stack spacing={"md"} px={"xs"}> <Stack spacing={"md"} px={"xl"}>
<ComponentGlobal_BoxInformation informasi="Lengkapi semua data di bawah untuk selanjutnya mengisi cerita Penggalangan Dana!" /> <ComponentGlobal_BoxInformation informasi="Lengkapi semua data di bawah untuk selanjutnya mengisi cerita Penggalangan Dana!" />
<Select <Select
styles={{ styles={{

View File

@@ -1,9 +1,12 @@
"use client"; "use client";
import React, { useState } from "react"; import { RouterCrowd } from "@/app/lib/router_hipmi/router_crowd";
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi"; import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
import { MainColor } from "@/app_modules/_global/color/color_pallet";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate"; import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate"; import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
import { ActionIcon, SimpleGrid, Stack, Text } from "@mantine/core";
import { import {
IconGiftCardFilled, IconGiftCardFilled,
IconHome, IconHome,
@@ -11,12 +14,8 @@ import {
} from "@tabler/icons-react"; } from "@tabler/icons-react";
import { useAtom } from "jotai"; import { useAtom } from "jotai";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import React, { useState } from "react";
import { gs_donasi_hot_menu } from "../global_state"; import { gs_donasi_hot_menu } from "../global_state";
import { MainColor } from "@/app_modules/_global/color/color_pallet";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
import { SimpleGrid, Stack, ActionIcon, Text } from "@mantine/core";
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
import { RouterCrowd } from "@/app/lib/router_hipmi/router_crowd";
export default function LayoutDonasi({ export default function LayoutDonasi({
children, children,

View File

@@ -87,7 +87,7 @@ async function onJoin(
appId: res?.data?.Event?.id, appId: res?.data?.Event?.id,
userId: res?.data?.Event?.authorId, userId: res?.data?.Event?.authorId,
pesan: res?.data?.Event?.title, pesan: res?.data?.Event?.title,
status: "Peserta event", status: "Peserta Event",
kategoriApp: "EVENT", kategoriApp: "EVENT",
title: "Peserta baru telah masuk !", title: "Peserta baru telah masuk !",
}; };

View File

@@ -2,9 +2,9 @@
import { RouterForum } from "@/app/lib/router_hipmi/router_forum"; import { RouterForum } from "@/app/lib/router_hipmi/router_forum";
import { AccentColor } from "@/app_modules/_global/color/color_pallet"; import { AccentColor } from "@/app_modules/_global/color/color_pallet";
import ComponentGlobal_CreateButton from "@/app_modules/_global/component/button_create";
import mqtt_client from "@/util/mqtt_client"; import mqtt_client from "@/util/mqtt_client";
import { import {
ActionIcon,
Affix, Affix,
Button, Button,
Center, Center,
@@ -15,7 +15,7 @@ import {
rem, rem,
} from "@mantine/core"; } from "@mantine/core";
import { useShallowEffect, useWindowScroll } from "@mantine/hooks"; import { useShallowEffect, useWindowScroll } from "@mantine/hooks";
import { IconPencilPlus, IconSearchOff } from "@tabler/icons-react"; import { IconSearchOff } from "@tabler/icons-react";
import _ from "lodash"; import _ from "lodash";
import { ScrollOnly } from "next-scroll-loader"; import { ScrollOnly } from "next-scroll-loader";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
@@ -23,7 +23,6 @@ import { useState } from "react";
import ComponentForum_BerandaCardView from "../component/main_component/card_view"; import ComponentForum_BerandaCardView from "../component/main_component/card_view";
import { forum_new_getAllPosting } from "../fun/get/new_get_all_posting"; import { forum_new_getAllPosting } from "../fun/get/new_get_all_posting";
import { MODEL_FORUM_POSTING } from "../model/interface"; import { MODEL_FORUM_POSTING } from "../model/interface";
import ComponentGlobal_CreateButton from "@/app_modules/_global/component/button_create";
export default function Forum_Beranda({ export default function Forum_Beranda({
listForum, listForum,
@@ -134,31 +133,6 @@ export default function Forum_Beranda({
</Affix> </Affix>
)} )}
{/* <pre>{JSON.stringify(listForum, null, 2)}</pre> */}
{/* <Affix position={{ bottom: rem(100), right: rem(30) }}>
<ActionIcon
opacity={scroll.y > 0 ? 0.5 : ""}
style={{
transition: "0.5s",
border: `1px solid ${AccentColor.skyblue}`,
}}
size={"xl"}
radius={"xl"}
variant="transparent"
bg={AccentColor.blue}
onClick={() => {
setLoadingCreate(true);
router.push(RouterForum.create);
}}
>
{loadingCreate ? (
<Loader color={AccentColor.yellow} size={25} />
) : (
<IconPencilPlus color="white" />
)}
</ActionIcon>
</Affix> */}
<ComponentGlobal_CreateButton path={RouterForum.create} /> <ComponentGlobal_CreateButton path={RouterForum.create} />
<Stack spacing={"xl"}> <Stack spacing={"xl"}>

View File

@@ -2,6 +2,8 @@
import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate"; import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate";
import ComponentGlobal_HeaderTamplate from "@/app_modules/_global/header_tamplate"; import ComponentGlobal_HeaderTamplate from "@/app_modules/_global/header_tamplate";
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
import { AppShell } from "@mantine/core"; import { AppShell } from "@mantine/core";
import React from "react"; import React from "react";
@@ -12,13 +14,11 @@ export default function InvestasiCreateLayout({
}) { }) {
return ( return (
<> <>
<AppComponentGlobal_LayoutTamplate <UIGlobal_LayoutTamplate
header={ header={<UIGlobal_LayoutHeaderTamplate title="Investasi Baru" />}
<ComponentGlobal_HeaderTamplate title="Investasi Baru" />
}
> >
{children} {children}
</AppComponentGlobal_LayoutTamplate> </UIGlobal_LayoutTamplate>
</> </>
); );
} }

View File

@@ -1,18 +1,11 @@
"use client"; "use client";
import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate"; import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate";
import ComponentGlobal_HeaderTamplate from "@/app_modules/_global/header_tamplate"; import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
import { import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
ActionIcon, import { ActionIcon, Group, Header, Title } from "@mantine/core";
AppShell, import { IconChevronLeft } from "@tabler/icons-react";
Group,
Header,
Text,
Title,
} from "@mantine/core";
import { IconArrowLeft, IconChevronLeft, IconEdit } from "@tabler/icons-react";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { title } from "process";
import React from "react"; import React from "react";
export default function LayoutDetailInvestasi({ export default function LayoutDetailInvestasi({
@@ -23,34 +16,35 @@ export default function LayoutDetailInvestasi({
const router = useRouter(); const router = useRouter();
return ( return (
<> <>
<AppComponentGlobal_LayoutTamplate <UIGlobal_LayoutTamplate
header={ header={
<Header height={50} style={{ borderStyle: "none" }}> <UIGlobal_LayoutHeaderTamplate title="Detail" />
<Group h={50} position="apart" px={"md"}> // <Header height={50} style={{ borderStyle: "none" }}>
<ActionIcon // <Group h={50} position="apart" px={"md"}>
variant="transparent" // <ActionIcon
onClick={() => { // variant="transparent"
router.back(); // onClick={() => {
}} // router.back();
> // }}
<IconChevronLeft /> // >
</ActionIcon> // <IconChevronLeft />
<Title order={5}>Detail Investasi</Title> // </ActionIcon>
<ActionIcon // <Title order={5}>Detail Investasi</Title>
variant="transparent" // <ActionIcon
disabled // variant="transparent"
onClick={() => { // disabled
router.replace(""); // onClick={() => {
}} // router.replace("");
> // }}
{/* <IconEdit /> */} // >
</ActionIcon> // {/* <IconEdit /> */}
</Group> // </ActionIcon>
</Header> // </Group>
// </Header>
} }
> >
{children} {children}
</AppComponentGlobal_LayoutTamplate> </UIGlobal_LayoutTamplate>
</> </>
); );
} }

View File

@@ -2,10 +2,11 @@
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi"; import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
import { Warna } from "@/app/lib/warna"; import { Warna } from "@/app/lib/warna";
import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/_global/author_name_on_header";
import { MODEL_PROFILE_OLD } from "@/app_modules/home/model/user_profile";
import { import {
ActionIcon, ActionIcon,
AspectRatio, AspectRatio,
Avatar,
Box, Box,
Button, Button,
Center, Center,
@@ -15,10 +16,9 @@ import {
Image, Image,
Paper, Paper,
Progress, Progress,
Slider,
Stack, Stack,
Text, Text,
Title, Title
} from "@mantine/core"; } from "@mantine/core";
import { import {
IconBookDownload, IconBookDownload,
@@ -27,16 +27,13 @@ import {
IconSpeakerphone, IconSpeakerphone,
IconXboxX, IconXboxX,
} from "@tabler/icons-react"; } from "@tabler/icons-react";
import { useAtom } from "jotai";
import moment from "moment";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useState } from "react"; import { useState } from "react";
import { MODEL_Investasi } from "../model/model_investasi";
import moment from "moment";
import { MODEL_PROFILE_OLD } from "@/app_modules/home/model/user_profile";
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
import { gs_TransferValue } from "../g_state"; import { gs_TransferValue } from "../g_state";
import { useAtom } from "jotai"; import { MODEL_Investasi } from "../model/model_investasi";
import _ from "lodash"; import { AccentColor } from "@/app_modules/_global/color/color_pallet";
import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/_global/author_name_on_header";
export default function DetailInvestasi({ export default function DetailInvestasi({
dataInvestasi, dataInvestasi,
@@ -92,7 +89,16 @@ export default function DetailInvestasi({
return ( return (
<> <>
<Box px={"sm"}> <Box
style={{
padding: "15px",
backgroundColor: AccentColor.darkblue,
borderRadius: "10px",
border: `2px solid ${AccentColor.blue}`,
color: "white",
marginBottom: "15px",
}}
>
{/* Foto username dan sisa waktu */} {/* Foto username dan sisa waktu */}
<Group position="apart" mb={"md"}> <Group position="apart" mb={"md"}>
{/* <pre>{JSON.stringify(dataUser, null, 2)}</pre> */} {/* <pre>{JSON.stringify(dataUser, null, 2)}</pre> */}

View File

@@ -1,14 +1,15 @@
"use client"; "use client";
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate";
import ComponentGlobal_HeaderTamplate from "@/app_modules/_global/header_tamplate"; import ComponentGlobal_HeaderTamplate from "@/app_modules/_global/header_tamplate";
import { import {
ActionIcon, ActionIcon,
AppShell,
Center, Center,
Flex, Flex,
Footer, Footer,
Grid, Grid,
Group, SimpleGrid,
Stack, Stack,
Text, Text,
} from "@mantine/core"; } from "@mantine/core";
@@ -16,17 +17,18 @@ import {
IconCash, IconCash,
IconChartHistogram, IconChartHistogram,
IconChartPie, IconChartPie,
IconChartPieFilled,
IconMoneybag,
IconNotes, IconNotes,
IconPencilPlus,
} from "@tabler/icons-react"; } from "@tabler/icons-react";
import { useAtom } from "jotai"; import { useAtom } from "jotai";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import React, { useState } from "react"; import React from "react";
import { gs_investasiFooter } from "../g_state"; import { gs_investasiFooter } from "../g_state";
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi"; import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate"; import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
import { MainColor } from "@/app_modules/_global/color/color_pallet";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
import { RouterCrowd } from "@/app/lib/router_hipmi/router_crowd";
export default function LayoutMainInvestasi({ export default function LayoutMainInvestasi({
children, children,
@@ -65,49 +67,79 @@ export default function LayoutMainInvestasi({
return ( return (
<> <>
<AppComponentGlobal_LayoutTamplate <UIGlobal_LayoutTamplate
header={ header={
<ComponentGlobal_HeaderTamplate <UIGlobal_LayoutHeaderTamplate
route="/dev/crowd/main" routerLeft={RouterCrowd.main}
title="Investasi" title="Investasi"
// icon={<IconPencilPlus />} // icon={<IconPencilPlus />}
// route2={"/dev/investasi/create"} // route2={"/dev/investasi/create"}
/> />
} }
footer={ footer={
<Footer height={"10vh"} bg={"black"}> <SimpleGrid cols={listFooter.length} h={"9vh"} mx={"xs"}>
<Grid align="center" h={"10vh"} pt={"xs"} grow> {listFooter.map((e, i) => (
{/* Tampilan Bursa */} <Stack key={i} align="center" justify="center" spacing={0}>
{listFooter.map((e, k) => ( <ActionIcon
<Grid.Col // disabled={e.path === "" ? true : false}
key={e.id} variant="transparent"
span={3} c={active === i ? MainColor.yellow : "white"}
onClick={() => { onClick={
router.push(e.route); () => {
setActive(k); router.push(e.route);
}} setActive(i);
}
// e.route === ""
// ? ComponentGlobal_NotifikasiPeringatan("Cooming Soon")
// : (router.replace(e.route), setActive(i))
}
> >
<Center h={"100%"}> {e.icon}
<Flex direction={"column"} align={"center"} w={"100%"}> </ActionIcon>
<ActionIcon <Text
variant="transparent" c={active === i ? MainColor.yellow : "white"}
c={active === k ? "blue" : "white"} fz={"xs"}
> lineClamp={1}
{e.icon} >
</ActionIcon> {e.name}
<Text c={active === k ? "blue" : "white"} fz={"xs"}> </Text>
{e.name} </Stack>
</Text> ))}
</Flex> </SimpleGrid>
</Center>
</Grid.Col> // <Footer height={"10vh"} bg={"black"}>
))} // <Grid align="center" h={"10vh"} pt={"xs"} grow>
</Grid>
</Footer> // {listFooter.map((e, k) => (
// <Grid.Col
// key={e.id}
// span={3}
// onClick={() => {
// router.push(e.route);
// setActive(k);
// }}
// >
// <Center h={"100%"}>
// <Flex direction={"column"} align={"center"} w={"100%"}>
// <ActionIcon
// variant="transparent"
// c={active === k ? "blue" : "white"}
// >
// {e.icon}
// </ActionIcon>
// <Text c={active === k ? "blue" : "white"} fz={"xs"}>
// {e.name}
// </Text>
// </Flex>
// </Center>
// </Grid.Col>
// ))}
// </Grid>
// </Footer>
} }
> >
{children} {children}
</AppComponentGlobal_LayoutTamplate> </UIGlobal_LayoutTamplate>
</> </>
); );
} }

View File

@@ -1,47 +1,42 @@
"use client"; "use client";
import { ApiHipmi } from "@/app/lib/api"; import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/model_default_master"; import { Warna } from "@/app/lib/warna";
import { import {
ActionIcon, ActionIcon,
Affix, Affix,
AspectRatio, AspectRatio,
Badge,
Box, Box,
Button, Button,
Card, Card,
CardSection, CardSection,
Center, Center,
Divider, Divider,
Flex,
Grid, Grid,
Group, Group,
Image, Image,
Paper, Paper,
Progress, Progress,
Slider,
Stack, Stack,
Text, Text,
Title, Title,
rem, rem,
} from "@mantine/core"; } from "@mantine/core";
import { useRouter } from "next/navigation"; import { useWindowScroll } from "@mantine/hooks";
import dataDummy from "../dummy/data_dummy.json";
import moment from "moment";
import { import {
IconCheck,
IconCircleCheck, IconCircleCheck,
IconPencilPlus, IconPencilPlus,
IconXboxX, IconXboxX,
} from "@tabler/icons-react"; } from "@tabler/icons-react";
import { MODEL_Investasi } from "../model/model_investasi";
import _ from "lodash"; import _ from "lodash";
import moment from "moment";
import { useRouter } from "next/navigation";
import { useState } from "react"; import { useState } from "react";
import { useShallowEffect, useWindowScroll } from "@mantine/hooks";
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
import { Warna } from "@/app/lib/warna";
import ComponentInvestasi_IsEmptyData from "../component/is_empty_data"; import ComponentInvestasi_IsEmptyData from "../component/is_empty_data";
import { RouterJob } from "@/app/lib/router_hipmi/router_job"; import { MODEL_Investasi } from "../model/model_investasi";
import ComponentGlobal_CreateButton from "@/app_modules/_global/component/button_create";
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
export default function MainInvestasi({ export default function MainInvestasi({
listData, listData,
@@ -66,7 +61,7 @@ export default function MainInvestasi({
return ( return (
<> <>
<Affix position={{ bottom: rem(150), right: rem(30) }}> {/* <Affix position={{ bottom: rem(150), right: rem(30) }}>
<ActionIcon <ActionIcon
loading={isLoading ? true : false} loading={isLoading ? true : false}
opacity={scroll.y > 0 ? 0.5 : ""} opacity={scroll.y > 0 ? 0.5 : ""}
@@ -84,20 +79,29 @@ export default function MainInvestasi({
> >
<IconPencilPlus color="white" /> <IconPencilPlus color="white" />
</ActionIcon> </ActionIcon>
</Affix> </Affix> */}
<ComponentGlobal_CreateButton path={RouterInvestasi.create} />
{_.isEmpty(investasi) && _.isEmpty(invesDone) && _.isEmpty(invesFail) ? ( {_.isEmpty(investasi) && _.isEmpty(invesDone) && _.isEmpty(invesFail) ? (
<ComponentInvestasi_IsEmptyData text="Tidak ada data" /> <ComponentGlobal_IsEmptyData />
) : ( ) : (
investasi.map((e) => ( investasi.map((e) => (
<Card <Card
// sx={{ borderStyle: "solid", borderColor: "black", borderWidth: "0.5px" }}
radius={"sm"}
key={e.id} key={e.id}
mb={"lg"} style={{
withBorder padding: "15px",
p={"xl"} backgroundColor: AccentColor.darkblue,
shadow="lg" borderRadius: "10px",
border: `2px solid ${AccentColor.blue}`,
color: "white",
marginBottom: "15px",
marginInline: "15px",
}}
onClick={() => {
setLoadingDetail(true);
router.push(RouterInvestasi.detail + `${e.id}`);
}}
> >
<CardSection> <CardSection>
<AspectRatio ratio={16 / 9}> <AspectRatio ratio={16 / 9}>
@@ -176,8 +180,8 @@ export default function MainInvestasi({
</CardSection> </CardSection>
<Divider color="gray.4" /> <Divider color="gray.4" />
<CardSection p={"md"}> <CardSection p={"md"}>
<Group position="apart"> <Group position="right">
<Button {/* <Button
loaderPosition="center" loaderPosition="center"
loading={isLoadingDetail ? true : false} loading={isLoadingDetail ? true : false}
radius={"xl"} radius={"xl"}
@@ -190,7 +194,7 @@ export default function MainInvestasi({
}} }}
> >
Detail Detail
</Button> </Button> */}
{e.progress === "100" ? ( {e.progress === "100" ? (
<Group position="right" spacing={"xs"}> <Group position="right" spacing={"xs"}>

View File

@@ -20,6 +20,8 @@ import { useRouter } from "next/navigation";
import { MODEL_Investasi } from "../model/model_investasi"; import { MODEL_Investasi } from "../model/model_investasi";
import _ from "lodash"; import _ from "lodash";
import ComponentInvestasi_IsEmptyData from "../component/is_empty_data"; import ComponentInvestasi_IsEmptyData from "../component/is_empty_data";
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
export default function Draft({ data }: { data: MODEL_Investasi[] }) { export default function Draft({ data }: { data: MODEL_Investasi[] }) {
const router = useRouter(); const router = useRouter();
@@ -28,7 +30,7 @@ export default function Draft({ data }: { data: MODEL_Investasi[] }) {
if (_.isEmpty(data)) if (_.isEmpty(data))
return ( return (
<> <>
<ComponentInvestasi_IsEmptyData text="Tidak ada data" /> <ComponentGlobal_IsEmptyData />
</> </>
); );
@@ -37,12 +39,16 @@ export default function Draft({ data }: { data: MODEL_Investasi[] }) {
{/* <pre> {JSON.stringify(data,null, 2)}</pre> */} {/* <pre> {JSON.stringify(data,null, 2)}</pre> */}
{data.map((e) => ( {data.map((e) => (
<Paper <Paper
// sx={{ borderStyle: "solid", borderColor: "yellow", borderWidth: "0.5px" }}
p={"xs"}
key={e.id} key={e.id}
mb={"md"}
withBorder
onClick={() => router.push(RouterInvestasi.detail_draft + `${e.id}`)} onClick={() => router.push(RouterInvestasi.detail_draft + `${e.id}`)}
style={{
padding: "15px",
backgroundColor: AccentColor.darkblue,
borderRadius: "10px",
border: `2px solid ${AccentColor.blue}`,
color: "white",
marginBottom: "15px",
}}
> >
<Grid> <Grid>
<Grid.Col span={8}> <Grid.Col span={8}>

View File

@@ -1,31 +1,24 @@
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi"; import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
import { import {
Card,
CardSection,
AspectRatio, AspectRatio,
Box, Box,
Title,
Slider,
Divider, Divider,
Group,
Badge,
Image,
Text,
Center,
Grid, Grid,
Stack, Group,
Image,
Paper, Paper,
Stack,
Text,
} from "@mantine/core"; } from "@mantine/core";
import { useRouter } from "next/navigation"; import { IconChecklist, IconCircleCheck } from "@tabler/icons-react";
import {
MODEL_Investasi,
MODEL_Status_investasi,
} from "../model/model_investasi";
import _ from "lodash"; import _ from "lodash";
import moment from "moment"; import moment from "moment";
import { useRouter } from "next/navigation";
import { useState } from "react"; import { useState } from "react";
import { IconChecklist, IconCircleCheck } from "@tabler/icons-react";
import ComponentInvestasi_IsEmptyData from "../component/is_empty_data"; import ComponentInvestasi_IsEmptyData from "../component/is_empty_data";
import { MODEL_Investasi } from "../model/model_investasi";
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
export default function Publish({ data }: { data: MODEL_Investasi[] }) { export default function Publish({ data }: { data: MODEL_Investasi[] }) {
const router = useRouter(); const router = useRouter();
@@ -34,7 +27,7 @@ export default function Publish({ data }: { data: MODEL_Investasi[] }) {
if (_.isEmpty(data)) if (_.isEmpty(data))
return ( return (
<> <>
<ComponentInvestasi_IsEmptyData text="Tidak ada data" /> <ComponentGlobal_IsEmptyData />
</> </>
); );
@@ -43,12 +36,17 @@ export default function Publish({ data }: { data: MODEL_Investasi[] }) {
{data.map((e) => ( {data.map((e) => (
<Paper <Paper
key={e.id} key={e.id}
withBorder
mb={"md"}
p={"xs"}
onClick={() => onClick={() =>
router.push(RouterInvestasi.detail_publish + `${e.id}`) router.push(RouterInvestasi.detail_publish + `${e.id}`)
} }
style={{
padding: "15px",
backgroundColor: AccentColor.darkblue,
borderRadius: "10px",
border: `2px solid ${AccentColor.blue}`,
color: "white",
marginBottom: "15px",
}}
> >
<Grid> <Grid>
<Grid.Col span={8}> <Grid.Col span={8}>
@@ -101,9 +99,13 @@ export default function Publish({ data }: { data: MODEL_Investasi[] }) {
<Box> <Box>
Sisa Waktu : {} Sisa Waktu : {}
{Number(e.MasterPencarianInvestor.name) - {Number(e.MasterPencarianInvestor.name) -
moment(new Date()).diff(new Date(e.countDown), "days")} hari moment(new Date()).diff(
new Date(e.countDown),
"days"
)}{" "}
hari
</Box> </Box>
)} )}
</Group> </Group>
</Group> </Group>
)} )}

View File

@@ -1,60 +1,23 @@
"use client"; "use client";
import { import {
AspectRatio,
Avatar,
Badge,
Box,
Button,
Card,
CardSection,
Collapse,
Divider,
Flex,
Grid,
Group,
Image,
Paper,
ScrollArea,
Select,
Slider,
Stack, Stack,
Tabs, Tabs
Text,
Title,
} from "@mantine/core"; } from "@mantine/core";
import dataDummy from "../dummy/data_dummy.json";
import moment from "moment";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import {
IconCaretDown,
IconCircleCheck,
IconCirclePlus,
} from "@tabler/icons-react";
import { useState } from "react"; import { useState } from "react";
import "react-responsive-carousel/lib/styles/carousel.min.css"; // requires a loader
import { Carousel } from "react-responsive-carousel";
import { useDisclosure } from "@mantine/hooks";
import { Warna } from "@/app/lib/warna";
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
import {
IconPhoto,
IconMessageCircle,
IconSettings,
} from "@tabler/icons-react";
import { atomWithStorage } from "jotai/utils";
import { useAtom } from "jotai"; import { useAtom } from "jotai";
import "react-responsive-carousel/lib/styles/carousel.min.css"; // requires a loader
import { gs_StatusPortoInvestasi } from "../g_state"; import { gs_StatusPortoInvestasi } from "../g_state";
import { import {
MODEL_Investasi, MODEL_Status_investasi
MODEL_Status_investasi,
} from "../model/model_investasi"; } from "../model/model_investasi";
import _ from "lodash";
import Draft from "./draft"; import Draft from "./draft";
import Review from "./review";
import Publish from "./publish"; import Publish from "./publish";
import Reject from "./reject"; import Reject from "./reject";
import Review from "./review";
import { AccentColor, MainColor } from "@/app_modules/_global/color/color_pallet";
export default function PortofolioInvestasi({ export default function PortofolioInvestasi({
listStatusInvestasi, listStatusInvestasi,
@@ -77,60 +40,59 @@ export default function PortofolioInvestasi({
return ( return (
<> <>
{/* <pre>{JSON.stringify(dataInvestasi, null, 2)}</pre> */} {/* <pre>{JSON.stringify(dataInvestasi, null, 2)}</pre> */}
<Stack> <Tabs
{/* <Button color="orange"
radius={"xl"} variant="pills"
bg={Warna.hijau_muda} radius="xl"
color="green" defaultValue="Draft"
leftIcon={<IconCirclePlus />} value={activeTab}
onClick={() => router.push(RouterInvestasi.create)} onTabChange={setActiveTab}
> styles={{
Buat Proyek Invetasi tabsList: {
</Button> */} backgroundColor: MainColor.darkblue,
<Tabs position: "sticky",
variant="pills" top: 0,
radius="xl" zIndex: 99,
defaultValue="Draft" },
value={activeTab} }}
onTabChange={setActiveTab} >
> <Stack>
<Stack> <Tabs.List grow>
<Tabs.List grow> {status_inves.map((e) => (
{status_inves.map((e) => ( <Tabs.Tab
<Tabs.Tab key={e.id}
sx={ value={e.name}
fw={"bold"}
c={"black"}
style={{
transition: "0.5s",
backgroundColor:
activeTab === e.name ? MainColor.yellow : "white",
border:
activeTab === e.name activeTab === e.name
? { ? `1px solid ${AccentColor.yellow}`
boxShadow: : `1px solid white`,
"0 2px 4px 0 rgba(0, 0, 0, 0.1), 0 2px 6px 0 rgba(0, 0, 0, 0.2)", }}
} >
: {} {e.name}
} </Tabs.Tab>
key={e.id} ))}
value={e.name} </Tabs.List>
bg={activeTab === e.name ? "blue" : "gray.1"}
fw={activeTab === e.name ? "bold" : "normal"}
>
{e.name}
</Tabs.Tab>
))}
</Tabs.List>
<Tabs.Panel key={"1"} value="Draft"> <Tabs.Panel key={"1"} value="Draft">
<Draft data={dataDraft as any} /> <Draft data={dataDraft as any} />
</Tabs.Panel> </Tabs.Panel>
<Tabs.Panel key={"2"} value="Review"> <Tabs.Panel key={"2"} value="Review">
<Review data={dataReview as any} /> <Review data={dataReview as any} />
</Tabs.Panel> </Tabs.Panel>
<Tabs.Panel key={"3"} value="Publish"> <Tabs.Panel key={"3"} value="Publish">
<Publish data={dataPublish as any} /> <Publish data={dataPublish as any} />
</Tabs.Panel> </Tabs.Panel>
<Tabs.Panel key={"4"} value="Reject"> <Tabs.Panel key={"4"} value="Reject">
<Reject data={dataReject as any} /> <Reject data={dataReject as any} />
</Tabs.Panel> </Tabs.Panel>
</Stack> </Stack>
</Tabs> </Tabs>
</Stack>
</> </>
); );
} }

View File

@@ -14,6 +14,7 @@ import {
import notifikasi_getByUserId from "../fun/get/get_notifiaksi_by_id"; import notifikasi_getByUserId from "../fun/get/get_notifiaksi_by_id";
import { redirectVotingPage } from "./path/voting"; import { redirectVotingPage } from "./path/voting";
import { redirectEventPage } from "./path/event"; import { redirectEventPage } from "./path/event";
import { redirectDetailCollaborationPage } from "./path/collaboration";
export function ComponentNotifiaksi_CardView({ export function ComponentNotifiaksi_CardView({
data, data,
@@ -42,7 +43,6 @@ export function ComponentNotifiaksi_CardView({
}} }}
my={"xs"} my={"xs"}
onClick={async () => { onClick={async () => {
await notifikasi_funUpdateIsReadById({ await notifikasi_funUpdateIsReadById({
notifId: data?.id, notifId: data?.id,
}); });
@@ -53,6 +53,7 @@ export function ComponentNotifiaksi_CardView({
// }); // });
// onLoadData(loadData); // onLoadData(loadData);
// } // }
console.log(data.status);
data?.kategoriApp === "JOB" && data?.kategoriApp === "JOB" &&
redirectJobPage({ redirectJobPage({
@@ -86,6 +87,12 @@ export function ComponentNotifiaksi_CardView({
onSetMenu(val); onSetMenu(val);
}, },
}); });
data?.kategoriApp === "COLLABORATION" &&
redirectDetailCollaborationPage({
data: data,
router: router,
});
}} }}
> >
{/* <pre>{JSON.stringify(e, null, 2)}</pre> */} {/* <pre>{JSON.stringify(e, null, 2)}</pre> */}

View File

@@ -0,0 +1,33 @@
import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
import { MODEL_NOTIFIKASI } from "../../model/interface";
export function redirectDetailCollaborationPage({
data,
router,
}: {
data: MODEL_NOTIFIKASI;
router: AppRouterInstance;
}) {
if (data.status === "Partisipan Project") {
const path = RouterColab.main_detail + data.appId;
router.push(path, { scroll: false });
}
if (data.status === "Collaboration Group") {
const path = RouterColab.grup_diskusi;
router.push(path, { scroll: false });
}
// if (data.status === "Report Komentar") {
// const path = RouterForum.detail_report_komentar + data.appId;
// router.push(path, { scroll: false });
// }
// if (data.status === "Report Posting") {
// const path = RouterForum.detail_report_posting + data.appId;
// router.push(path, { scroll: false });
// }
}

View File

@@ -30,7 +30,7 @@ export function redirectEventPage({
router.push(path, { scroll: false }); router.push(path, { scroll: false });
} }
if (data.status === "Peserta event") { if (data.status === "Peserta Event") {
router.push(RouterEvent.detail_main + data.appId, { scroll: false }); router.push(RouterEvent.detail_main + data.appId, { scroll: false });
} }
} }

View File

@@ -0,0 +1,32 @@
"use server";
import prisma from "@/app/lib/prisma";
export async function notifikasiToUser_CreateGroupCollaboration({
colabId,
}: {
colabId: string;
}) {
const userPartisipasi =
await prisma.projectCollaboration_Partisipasi.findMany({
where: {
ProjectCollaboration: {
id: colabId,
},
},
select: {
// User: true,
userId: true,
// ProjectCollaboration: {
// select: {
// id
// title: true
// }
// },
},
});
console.log(userPartisipasi);
}

View File

@@ -8,13 +8,25 @@ export interface MODEL_NOTIFIKASI {
appId: string; appId: string;
kategoriApp: string; kategoriApp: string;
isRead: boolean; isRead: boolean;
title: string, title: string;
pesan: string; pesan: string;
User: MODEL_USER; User: MODEL_USER;
userId: string; userId: string;
Admin: MODEL_USER; Admin: MODEL_USER;
adminId: string; adminId: string;
status?: string; status?:
| "Publish"
| "Reject"
| "Review"
| "Draft"
| "Voting Masuk"
| "Voting Selesai"
| "Voting Selesai"
| "Peserta Event"
| "Report Komentar"
| "Report Posting"
| "Partisipan Project"
| "Collaboration Group";
Role: MODEL_NEW_DEFAULT_MASTER; Role: MODEL_NEW_DEFAULT_MASTER;
userRoleId: String; userRoleId: String;
} }

View File

@@ -128,7 +128,7 @@ export default function Vote_Create() {
<Stack spacing={0}> <Stack spacing={0}>
<Center> <Center>
<Text fw={"bold"} fz={"sm"}> <Text fw={"bold"} fz={"sm"} c={"white"}>
Daftar Pilihan Daftar Pilihan
</Text> </Text>
</Center> </Center>

View File

@@ -493,6 +493,11 @@
resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.2.1.tgz#16308cea045f0fc777b6ff20a9f25474dd8293d2" resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.2.1.tgz#16308cea045f0fc777b6ff20a9f25474dd8293d2"
integrity sha512-9TANp6GPoMtYzQdt54kfAyMmz1+osLlXdg2ENroU7zzrtflTLrrC/lgrIfaSe+Wu0b89GKccT7vxXA0MoAIO+Q== integrity sha512-9TANp6GPoMtYzQdt54kfAyMmz1+osLlXdg2ENroU7zzrtflTLrrC/lgrIfaSe+Wu0b89GKccT7vxXA0MoAIO+Q==
"@hookstate/core@^4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@hookstate/core/-/core-4.0.1.tgz#6744380e96ce13fe3488c926c1cbae93bbea0ff6"
integrity sha512-Uh2D8Z0z/pqOJ7t+SfC+2sj13JQcB4yFhtL+T1choCaBxTSlgOS/CKRBohgJ4cjTKoxOmTT8uSQysu3gUjX+Gw==
"@humanwhocodes/config-array@^0.11.10": "@humanwhocodes/config-array@^0.11.10":
version "0.11.14" version "0.11.14"
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.14.tgz#d78e481a039f7566ecc9660b4ea7fe6b1fec442b" resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.14.tgz#d78e481a039f7566ecc9660b4ea7fe6b1fec442b"