@@ -4,6 +4,7 @@ import _, { ceil } from "lodash";
|
|||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
|
|
||||||
// HOME
|
// HOME
|
||||||
export async function GET(request: Request) {
|
export async function GET(request: Request) {
|
||||||
try {
|
try {
|
||||||
@@ -71,24 +72,167 @@ export async function GET(request: Request) {
|
|||||||
createdAt: moment(v.dateStart).format("LL")
|
createdAt: moment(v.dateStart).format("LL")
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
} else if (kategori == "division") {
|
||||||
|
let kondisi
|
||||||
|
|
||||||
|
// klo perbekel == semua grup
|
||||||
|
if (roleUser == "supadmin") {
|
||||||
|
kondisi = {
|
||||||
|
isActive: true,
|
||||||
|
idVillage: idVillage,
|
||||||
|
Group: {
|
||||||
|
isActive: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
kondisi = {
|
||||||
|
isActive: true,
|
||||||
|
idGroup: idGroup
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// else if (kategori == "division") {
|
|
||||||
|
|
||||||
// } else if (kategori == "progress") {
|
const data = await prisma.division.findMany({
|
||||||
|
where: kondisi,
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
name: true,
|
||||||
|
DivisionProject: {
|
||||||
|
where: {
|
||||||
|
isActive: true,
|
||||||
|
NOT: {
|
||||||
|
status: 3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
// } else if (kategori == "dokumen") {
|
const format = data.map((v: any) => ({
|
||||||
|
..._.omit(v, ["DivisionProject"]),
|
||||||
|
jumlah: v.DivisionProject.length,
|
||||||
|
}))
|
||||||
|
|
||||||
// } else if (kategori == "event") {
|
allData = _.orderBy(format, 'jumlah', 'desc').slice(0, 5)
|
||||||
|
|
||||||
// } else if (kategori == "discussion") {
|
} else if (kategori == "progress") {
|
||||||
|
|
||||||
// }
|
} else if (kategori == "dokumen") {
|
||||||
|
|
||||||
|
} else if (kategori == "event") {
|
||||||
|
let kondisi
|
||||||
|
|
||||||
|
// klo perbekel == semua grup
|
||||||
|
if (roleUser == "supadmin") {
|
||||||
|
kondisi = {
|
||||||
|
isActive: true,
|
||||||
|
dateStart: new Date(),
|
||||||
|
Division: {
|
||||||
|
idVillage: idVillage,
|
||||||
|
Group: {
|
||||||
|
isActive: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
kondisi = {
|
||||||
|
isActive: true,
|
||||||
|
dateStart: new Date(),
|
||||||
|
Division: {
|
||||||
|
idGroup: idGroup
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const data = await prisma.divisionCalendar.findMany({
|
||||||
|
skip: 0,
|
||||||
|
take: 5,
|
||||||
|
where: kondisi,
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
idDivision: true,
|
||||||
|
title: true,
|
||||||
|
desc: true,
|
||||||
|
status: true,
|
||||||
|
timeStart: true,
|
||||||
|
dateStart: true,
|
||||||
|
timeEnd: true,
|
||||||
|
dateEnd: true,
|
||||||
|
createdAt: true,
|
||||||
|
User: {
|
||||||
|
select: {
|
||||||
|
name: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
orderBy: {
|
||||||
|
createdAt: 'desc'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
allData = data.map((v: any) => ({
|
||||||
|
..._.omit(v, ["User"]),
|
||||||
|
user_name: v.User.name,
|
||||||
|
timeStart: moment.utc(v.timeStart).format('HH:mm'),
|
||||||
|
timeEnd: moment.utc(v.timeEnd).format('HH:mm')
|
||||||
|
}))
|
||||||
|
|
||||||
|
} else if (kategori == "discussion") {
|
||||||
|
let kondisi
|
||||||
|
|
||||||
|
// klo perbekel == semua grup
|
||||||
|
if (roleUser == "supadmin") {
|
||||||
|
kondisi = {
|
||||||
|
isActive: true,
|
||||||
|
status: 1,
|
||||||
|
Division: {
|
||||||
|
idVillage: idVillage,
|
||||||
|
Group: {
|
||||||
|
isActive: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
kondisi = {
|
||||||
|
isActive: true,
|
||||||
|
status: 1,
|
||||||
|
Division: {
|
||||||
|
idGroup: idGroup
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = await prisma.divisionDisscussion.findMany({
|
||||||
|
skip: 0,
|
||||||
|
take: 5,
|
||||||
|
where: kondisi,
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
idDivision: true,
|
||||||
|
title: true,
|
||||||
|
desc: true,
|
||||||
|
createdAt: true,
|
||||||
|
User: {
|
||||||
|
select: {
|
||||||
|
name: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
orderBy: {
|
||||||
|
createdAt: "desc"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
allData = data.map((v: any) => ({
|
||||||
|
..._.omit(v, ["createdAt", "User"]),
|
||||||
|
date: moment(v.dateStart).format("LL"),
|
||||||
|
user: v.User.name
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Berhasil mendapatkan data", data: allData }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil mendapatkan data", data: allData }, { status: 200 });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan data, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan data, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
|
|||||||
@@ -1,77 +0,0 @@
|
|||||||
'use client'
|
|
||||||
import { WARNA } from "@/module/_global";
|
|
||||||
import { Box, Group, Text } from "@mantine/core";
|
|
||||||
import { GoDiscussionClosed } from "react-icons/go";
|
|
||||||
import { CiClock2, CiUser } from "react-icons/ci";
|
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
|
|
||||||
const dataDiskusi = [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
judul: 'Mengatasi Limbah Makanan ',
|
|
||||||
user: 'Fibra Marcell',
|
|
||||||
date: '21 Juni 2024'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
judul: 'Pentingnya Menjaga Kelestarian Hutan ',
|
|
||||||
user: 'Bayu Tegar',
|
|
||||||
date: '15 Juni 2024'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
judul: 'Mengatasi Limbah Industri ',
|
|
||||||
user: 'Nian Putri',
|
|
||||||
date: '11 Mei 2024'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 4,
|
|
||||||
judul: 'Manfaat Sampah Plastik',
|
|
||||||
user: 'Budi Prasetyo',
|
|
||||||
date: '10 Mei 2024'
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
export default function ListDiscussion() {
|
|
||||||
const router = useRouter()
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Box pt={10}>
|
|
||||||
<Text c={WARNA.biruTua} mb={10} fw={'bold'} fz={16}>Diskusi</Text>
|
|
||||||
<Box bg={"white"} style={{
|
|
||||||
borderRadius: 10,
|
|
||||||
border: `1px solid ${"#D6D8F6"}`,
|
|
||||||
padding: 20
|
|
||||||
}}>
|
|
||||||
{
|
|
||||||
dataDiskusi.map((v, i) => {
|
|
||||||
return (
|
|
||||||
<Box key={i} style={{
|
|
||||||
borderRadius: 10,
|
|
||||||
border: `1px solid ${"#D6D8F6"}`,
|
|
||||||
padding: 10
|
|
||||||
}} mb={10} onClick={() => router.push(`/discussion/1`)}>
|
|
||||||
<Group>
|
|
||||||
<GoDiscussionClosed size={25} />
|
|
||||||
<Box w={{ base: 230, md: 400 }}>
|
|
||||||
<Text fw={'bold'} truncate="end">{v.judul}</Text>
|
|
||||||
</Box>
|
|
||||||
</Group>
|
|
||||||
<Group justify="space-between" mt={20} c={'#8C8C8C'}>
|
|
||||||
<Group gap={5} align="center">
|
|
||||||
<CiUser size={18} />
|
|
||||||
<Text fz={13}>{v.user}</Text>
|
|
||||||
</Group >
|
|
||||||
<Group gap={5} align="center">
|
|
||||||
<CiClock2 size={18} />
|
|
||||||
<Text fz={13}>{v.date}</Text>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</Box>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</Box>
|
|
||||||
</Box>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
'use client'
|
|
||||||
import { WARNA } from "@/module/_global";
|
|
||||||
import { Carousel } from "@mantine/carousel";
|
|
||||||
import { Box, Card, Flex, Title, Text } from "@mantine/core";
|
|
||||||
import _ from "lodash";
|
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
|
|
||||||
const dataProject = [
|
|
||||||
{
|
|
||||||
id: 4,
|
|
||||||
title: 'Divisi Keuangan',
|
|
||||||
total: 24
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 5,
|
|
||||||
title: 'Divisi Kesekretariatan',
|
|
||||||
total: 18
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 6,
|
|
||||||
title: 'Divisi Kemasyarakatan',
|
|
||||||
total: 12
|
|
||||||
},
|
|
||||||
]
|
|
||||||
export default function ListDivisi() {
|
|
||||||
const router = useRouter()
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Box pt={10}>
|
|
||||||
<Text c={WARNA.biruTua} mb={10} fw={'bold'} fz={16}>Divisi Teraktif</Text>
|
|
||||||
<Carousel dragFree slideGap={"xs"} align="start" slideSize={"xs"} withIndicators withControls={false}>
|
|
||||||
{dataProject.map((v) =>
|
|
||||||
<Carousel.Slide key={v.id}>
|
|
||||||
<Box w={{ base: 300, md: 400 }}>
|
|
||||||
<Card shadow="sm" padding="md" component="a" radius={10} onClick={() => router.push(`/division/${v.id}`)}>
|
|
||||||
<Card.Section>
|
|
||||||
<Box h={120} bg={`linear-gradient(180deg, rgba(223,218,124,1) 25%, rgba(242,175,70,1) 100%)`}>
|
|
||||||
<Flex justify={'center'} align={'center'} h={"100%"}>
|
|
||||||
<Title order={3} c={WARNA.biruTua}>{_.toUpper(v.title)}</Title>
|
|
||||||
</Flex>
|
|
||||||
</Box>
|
|
||||||
</Card.Section>
|
|
||||||
<Box pt={10} mih={150}>
|
|
||||||
<Text fw={'bold'} fz={18}>KEGIATAN</Text>
|
|
||||||
<Text fw={'bolder'} ta={'center'} fz={70}>{v.total}</Text>
|
|
||||||
</Box>
|
|
||||||
</Card>
|
|
||||||
</Box>
|
|
||||||
</Carousel.Slide>
|
|
||||||
)}
|
|
||||||
</Carousel>
|
|
||||||
{/* {dataProject.map((v, i) => {
|
|
||||||
return (
|
|
||||||
<Box key={i} mb={20} >
|
|
||||||
<Card shadow="sm" padding="md" component="a" radius={10}>
|
|
||||||
<Card.Section>
|
|
||||||
<Box h={120} bg={`linear-gradient(180deg, rgba(223,218,124,1) 25%, rgba(242,175,70,1) 100%)`}>
|
|
||||||
<Flex justify={'center'} align={'center'} h={"100%"}>
|
|
||||||
<Title order={3} c={WARNA.biruTua}>{_.toUpper(v.title)}</Title>
|
|
||||||
</Flex>
|
|
||||||
</Box>
|
|
||||||
</Card.Section>
|
|
||||||
<Box pt={10} mih={150}>
|
|
||||||
<Text fw={'bold'} fz={18}>PROYEK</Text>
|
|
||||||
<Text fw={'bolder'} ta={'center'} fz={70}>{v.total}</Text>
|
|
||||||
</Box>
|
|
||||||
</Card>
|
|
||||||
</Box>
|
|
||||||
);
|
|
||||||
})} */}
|
|
||||||
</Box>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
'use client'
|
|
||||||
import { WARNA } from "@/module/_global"
|
|
||||||
import { Box, Divider, Group, Text } from "@mantine/core"
|
|
||||||
import { useRouter } from "next/navigation"
|
|
||||||
|
|
||||||
const dataEvent = [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
title: 'Pembahasan Mengenai Darmasaba',
|
|
||||||
jamAwal: "10.00",
|
|
||||||
jamAkhir: "11.00",
|
|
||||||
dibuat: "Jhon"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
title: 'Pembahasan Mengenai Darmasaba',
|
|
||||||
jamAwal: "11.00",
|
|
||||||
jamAkhir: "12.00",
|
|
||||||
dibuat: "Jhon"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
title: 'Pembahasan Mengenai Darmasaba',
|
|
||||||
jamAwal: "13.00",
|
|
||||||
jamAkhir: "14.00",
|
|
||||||
dibuat: "Jhon"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 4,
|
|
||||||
title: 'Pembahasan Mengenai Darmasaba',
|
|
||||||
jamAwal: "15.00",
|
|
||||||
jamAkhir: "16.00",
|
|
||||||
dibuat: "Jhon"
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
export default function ListEventHome() {
|
|
||||||
const router = useRouter()
|
|
||||||
return (
|
|
||||||
<Box pt={10}>
|
|
||||||
<Text c={WARNA.biruTua} mb={10} fw={'bold'} fz={16}>Event Hari Ini</Text>
|
|
||||||
<Box bg={"white"} style={{
|
|
||||||
borderRadius: 10,
|
|
||||||
border: `1px solid ${"#D6D8F6"}`,
|
|
||||||
padding: 10
|
|
||||||
}}>
|
|
||||||
{dataEvent.map((event, index) => {
|
|
||||||
const bgColor = ['#D8D8F1', '#FED6C5'][index % 2]
|
|
||||||
const colorDivider = ['#535FCA', '#A7A7A7'][index % 2]
|
|
||||||
return (
|
|
||||||
<Box key={event.id} m={10} onClick={() => router.push(`/calender?page=detail-event`)}>
|
|
||||||
<Box bg={bgColor} pl={15} p={10} style={{
|
|
||||||
borderRadius: 10
|
|
||||||
}} h={113}>
|
|
||||||
<Group>
|
|
||||||
<Divider h={92} size="lg" orientation="vertical" color={colorDivider} />
|
|
||||||
<Box>
|
|
||||||
<Text>{event.jamAwal} - {event.jamAkhir}</Text>
|
|
||||||
<Text fw={"bold"} truncate="end">{event.title}</Text>
|
|
||||||
<Text>Dibuat oleh : {event.dibuat}</Text>
|
|
||||||
</Box>
|
|
||||||
</Group>
|
|
||||||
</Box>
|
|
||||||
</Box>
|
|
||||||
)
|
|
||||||
})}
|
|
||||||
</Box>
|
|
||||||
</Box>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
'use client'
|
|
||||||
import { WARNA } from "@/module/_global";
|
|
||||||
import { Carousel } from "@mantine/carousel";
|
|
||||||
import { Box, Card, Flex, Title, Text, Progress, Stack } from "@mantine/core";
|
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
|
|
||||||
const dataProject = [
|
|
||||||
{
|
|
||||||
id: 4,
|
|
||||||
title: 'Project 4',
|
|
||||||
description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba',
|
|
||||||
status: 'PROSES',
|
|
||||||
progress: 60,
|
|
||||||
date: '05 Mei 2024'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 5,
|
|
||||||
title: 'Project5',
|
|
||||||
description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba',
|
|
||||||
status: 'PROSES',
|
|
||||||
progress: 80,
|
|
||||||
date: '08 Juni 2024'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 6,
|
|
||||||
title: 'Project 6',
|
|
||||||
description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba',
|
|
||||||
status: 'PROSES',
|
|
||||||
progress: 47,
|
|
||||||
date: '10 Mei 2024'
|
|
||||||
},
|
|
||||||
]
|
|
||||||
export default function ListProjects() {
|
|
||||||
const router = useRouter()
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Box pt={10}>
|
|
||||||
<Text c={WARNA.biruTua} mb={10} fw={'bold'} fz={16}>Kegiatan Terbaru</Text>
|
|
||||||
<Carousel dragFree slideGap={"xs"} align="start" slideSize={"xs"} withIndicators withControls={false}>
|
|
||||||
{dataProject.map((v) =>
|
|
||||||
<Carousel.Slide key={v.id}>
|
|
||||||
<Box w={{ base: 300, md: 400 }}>
|
|
||||||
<Card shadow="sm" padding="md" component="a" radius={10} onClick={() => router.push(`/project/${v.id}`)}>
|
|
||||||
<Card.Section>
|
|
||||||
<Box h={120} bg={WARNA.biruTua}>
|
|
||||||
<Flex justify={'center'} align={'center'} h={"100%"}>
|
|
||||||
<Title order={3} c={"white"}>{v.title}</Title>
|
|
||||||
</Flex>
|
|
||||||
</Box>
|
|
||||||
</Card.Section>
|
|
||||||
<Stack h={150} align="stretch" justify="center">
|
|
||||||
<Progress.Root size="xl" radius="xl" style={{ border: `1px solid ${'#BDBDBD'}` }}>
|
|
||||||
<Progress.Section value={v.progress} color="yellow" striped >
|
|
||||||
<Progress.Label>{v.progress}%</Progress.Label>
|
|
||||||
</Progress.Section>
|
|
||||||
</Progress.Root>
|
|
||||||
<Text c={WARNA.biruTua}>Progres {v.date}</Text>
|
|
||||||
</Stack>
|
|
||||||
</Card>
|
|
||||||
</Box>
|
|
||||||
</Carousel.Slide>
|
|
||||||
)}
|
|
||||||
</Carousel>
|
|
||||||
</Box>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import ViewDetailFeature from "./view/view_detail_feature";
|
import ViewDetailFeature from "./ui/view_detail_feature";
|
||||||
import ViewHome from "./view/view_home";
|
import ViewHome from "./ui/view_home";
|
||||||
import ViewNotification from "./view/view_notification";
|
import ViewNotification from "./ui/view_notification";
|
||||||
import ViewSearch from "./view/view_search";
|
import ViewSearch from "./ui/view_search";
|
||||||
|
|
||||||
export { ViewHome }
|
export { ViewHome }
|
||||||
export { ViewDetailFeature }
|
export { ViewDetailFeature }
|
||||||
|
|||||||
4
src/module/home/lib/api_home.ts
Normal file
4
src/module/home/lib/api_home.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export const funGetHome = async (path?: string) => {
|
||||||
|
const response = await fetch(`/api/home${(path) ? path : ''}`, { next: { tags: ['discussion'] } });
|
||||||
|
return await response.json().catch(() => null);
|
||||||
|
}
|
||||||
37
src/module/home/lib/type_home.ts
Normal file
37
src/module/home/lib/type_home.ts
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
export interface IDataHomeKegiatan {
|
||||||
|
id: string
|
||||||
|
title: string
|
||||||
|
desc: string
|
||||||
|
status: string
|
||||||
|
progress: number
|
||||||
|
createdAt: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IDataHomeDivision {
|
||||||
|
id: string
|
||||||
|
name: string
|
||||||
|
jumlah: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IDataHomeEvent {
|
||||||
|
id: string
|
||||||
|
idDivision: string
|
||||||
|
title: string
|
||||||
|
desc: string
|
||||||
|
status: number
|
||||||
|
timeStart: string
|
||||||
|
timeEnd: string
|
||||||
|
dateStart: string
|
||||||
|
dateEnd: string
|
||||||
|
createdAt: string
|
||||||
|
user_name: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IDataHomeDiskusi {
|
||||||
|
id: string
|
||||||
|
idDivision: string
|
||||||
|
desc: string
|
||||||
|
title: string
|
||||||
|
date: string
|
||||||
|
user: string
|
||||||
|
}
|
||||||
@@ -70,21 +70,21 @@ export default function ChartDocumentHome() {
|
|||||||
data: [
|
data: [
|
||||||
{
|
{
|
||||||
value: 78,
|
value: 78,
|
||||||
name: 'Confidence',
|
name: 'File',
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: "#F3C96B"
|
color: "#F3C96B"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 35,
|
value: 35,
|
||||||
name: 'Supportive',
|
name: 'Folder',
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: "#9EC97F"
|
color: "#9EC97F"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 58,
|
value: 58,
|
||||||
name: 'Positive',
|
name: 'Documen',
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: "#5971C0"
|
color: "#5971C0"
|
||||||
}
|
}
|
||||||
107
src/module/home/ui/list_discussion.tsx
Normal file
107
src/module/home/ui/list_discussion.tsx
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
'use client'
|
||||||
|
import { WARNA } from "@/module/_global";
|
||||||
|
import { Box, Group, Skeleton, Text } from "@mantine/core";
|
||||||
|
import { GoDiscussionClosed } from "react-icons/go";
|
||||||
|
import { CiClock2, CiUser } from "react-icons/ci";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { IDataHomeDiskusi } from "../lib/type_home";
|
||||||
|
import { funGetHome } from "../lib/api_home";
|
||||||
|
import toast from "react-hot-toast";
|
||||||
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
|
import _ from "lodash";
|
||||||
|
|
||||||
|
|
||||||
|
export default function ListDiscussion() {
|
||||||
|
const router = useRouter()
|
||||||
|
const [isData, setData] = useState<IDataHomeDiskusi[]>([])
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
|
||||||
|
const fetchData = async () => {
|
||||||
|
try {
|
||||||
|
setData([]);
|
||||||
|
setLoading(true);
|
||||||
|
const response = await funGetHome('?cat=discussion')
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
|
setData(response.data)
|
||||||
|
} else {
|
||||||
|
toast.error(response.message);
|
||||||
|
}
|
||||||
|
setLoading(false);
|
||||||
|
} catch (error) {
|
||||||
|
toast.error("Gagal mendapatkan data, coba lagi nanti");
|
||||||
|
console.error(error);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
useShallowEffect(() => {
|
||||||
|
fetchData();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Box pt={10}>
|
||||||
|
<Text c={WARNA.biruTua} mb={10} fw={'bold'} fz={16}>Diskusi</Text>
|
||||||
|
<Box bg={"white"} style={{
|
||||||
|
borderRadius: 10,
|
||||||
|
border: `1px solid ${"#D6D8F6"}`,
|
||||||
|
padding: 20
|
||||||
|
}}>
|
||||||
|
|
||||||
|
{
|
||||||
|
loading ?
|
||||||
|
Array(3)
|
||||||
|
.fill(null)
|
||||||
|
.map((_, i) => (
|
||||||
|
<Box key={i} mb={10}>
|
||||||
|
<Skeleton height={100} width={"100%"} radius={"md"} />
|
||||||
|
</Box>
|
||||||
|
))
|
||||||
|
:
|
||||||
|
_.isEmpty(isData)
|
||||||
|
?
|
||||||
|
<Box style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '50vh' }}>
|
||||||
|
<Text c="dimmed" ta={"center"} fs={"italic"}>Tidak ada diskusi</Text>
|
||||||
|
</Box>
|
||||||
|
:
|
||||||
|
<>
|
||||||
|
{
|
||||||
|
isData.map((v, i) => {
|
||||||
|
return (
|
||||||
|
<Box key={i} style={{
|
||||||
|
borderRadius: 10,
|
||||||
|
border: `1px solid ${"#D6D8F6"}`,
|
||||||
|
padding: 10
|
||||||
|
}} mb={10} onClick={() => router.push(`/division/${v.idDivision}/discussion/${v.id}`)}>
|
||||||
|
<Group>
|
||||||
|
<GoDiscussionClosed size={25} />
|
||||||
|
<Box w={{ base: 230, md: 400 }}>
|
||||||
|
<Text fw={"bold"} truncate="end">
|
||||||
|
{v.desc}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
</Group>
|
||||||
|
<Group justify="space-between" mt={20} c={"#8C8C8C"}>
|
||||||
|
<Group gap={5} align="center">
|
||||||
|
<CiUser size={18} />
|
||||||
|
<Text fz={13}>{v.user}</Text>
|
||||||
|
</Group>
|
||||||
|
<Group gap={5} align="center">
|
||||||
|
<CiClock2 size={18} />
|
||||||
|
<Text fz={13}>{v.date}</Text>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</Box>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</>
|
||||||
|
|
||||||
|
}
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
)
|
||||||
|
}
|
||||||
84
src/module/home/ui/list_divisi.tsx
Normal file
84
src/module/home/ui/list_divisi.tsx
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
'use client'
|
||||||
|
import { WARNA } from "@/module/_global";
|
||||||
|
import { Carousel } from "@mantine/carousel";
|
||||||
|
import { Box, Card, Flex, Title, Text, Skeleton } from "@mantine/core";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { IDataHomeDivision } from "../lib/type_home";
|
||||||
|
import { funGetHome } from "../lib/api_home";
|
||||||
|
import toast from "react-hot-toast";
|
||||||
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
|
|
||||||
|
export default function ListDivisi() {
|
||||||
|
const router = useRouter()
|
||||||
|
const [isData, setData] = useState<IDataHomeDivision[]>([])
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
|
||||||
|
const fetchData = async () => {
|
||||||
|
try {
|
||||||
|
setData([]);
|
||||||
|
setLoading(true);
|
||||||
|
const response = await funGetHome('?cat=division')
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
|
setData(response.data)
|
||||||
|
} else {
|
||||||
|
toast.error(response.message);
|
||||||
|
}
|
||||||
|
setLoading(false);
|
||||||
|
} catch (error) {
|
||||||
|
toast.error("Gagal mendapatkan data, coba lagi nanti");
|
||||||
|
console.error(error);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
useShallowEffect(() => {
|
||||||
|
fetchData();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Box pt={10}>
|
||||||
|
<Text c={WARNA.biruTua} mb={10} fw={'bold'} fz={16}>Divisi Teraktif</Text>
|
||||||
|
{loading ?
|
||||||
|
<Box pb={20}>
|
||||||
|
<Skeleton width={"100%"} height={200} radius={"md"} />
|
||||||
|
</Box>
|
||||||
|
:
|
||||||
|
_.isEmpty(isData)
|
||||||
|
?
|
||||||
|
<Box style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '50vh' }}>
|
||||||
|
<Text c="dimmed" ta={"center"} fs={"italic"}>Tidak ada divisi</Text>
|
||||||
|
</Box>
|
||||||
|
:
|
||||||
|
<Carousel dragFree slideGap={"xs"} align="start" slideSize={"xs"} withIndicators withControls={false}>
|
||||||
|
{isData.map((v) =>
|
||||||
|
<Carousel.Slide key={v.id}>
|
||||||
|
<Box w={{ base: 300, md: 400 }}>
|
||||||
|
<Card shadow="sm" padding="md" component="a" radius={10} onClick={() => router.push(`/division/${v.id}`)}>
|
||||||
|
<Card.Section>
|
||||||
|
<Box h={120} bg={`linear-gradient(180deg, rgba(223,218,124,1) 25%, rgba(242,175,70,1) 100%)`}>
|
||||||
|
<Flex justify={'center'} align={'center'} h={"100%"}>
|
||||||
|
<Title order={3} c={WARNA.biruTua}>{v.name}</Title>
|
||||||
|
</Flex>
|
||||||
|
</Box>
|
||||||
|
</Card.Section>
|
||||||
|
<Box pt={10} mih={150}>
|
||||||
|
<Text fw={'bold'} fz={18}>KEGIATAN</Text>
|
||||||
|
<Text fw={'bolder'} ta={'center'} fz={70}>{v.jumlah}</Text>
|
||||||
|
</Box>
|
||||||
|
</Card>
|
||||||
|
</Box>
|
||||||
|
</Carousel.Slide>
|
||||||
|
)}
|
||||||
|
</Carousel>
|
||||||
|
}
|
||||||
|
</Box>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
90
src/module/home/ui/list_event.tsx
Normal file
90
src/module/home/ui/list_event.tsx
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
'use client'
|
||||||
|
import { WARNA } from "@/module/_global"
|
||||||
|
import { Box, Divider, Group, Skeleton, Text } from "@mantine/core"
|
||||||
|
import { useRouter } from "next/navigation"
|
||||||
|
import { useState } from "react"
|
||||||
|
import { IDataHomeEvent } from "../lib/type_home"
|
||||||
|
import { funGetHome } from "../lib/api_home"
|
||||||
|
import toast from "react-hot-toast"
|
||||||
|
import { useShallowEffect } from "@mantine/hooks"
|
||||||
|
import _ from "lodash"
|
||||||
|
|
||||||
|
|
||||||
|
export default function ListEventHome() {
|
||||||
|
const router = useRouter()
|
||||||
|
const [isData, setData] = useState<IDataHomeEvent[]>([])
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
|
||||||
|
const fetchData = async () => {
|
||||||
|
try {
|
||||||
|
setData([]);
|
||||||
|
setLoading(true);
|
||||||
|
const response = await funGetHome('?cat=event')
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
|
setData(response.data)
|
||||||
|
} else {
|
||||||
|
toast.error(response.message);
|
||||||
|
}
|
||||||
|
setLoading(false);
|
||||||
|
} catch (error) {
|
||||||
|
toast.error("Gagal mendapatkan data, coba lagi nanti");
|
||||||
|
console.error(error);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
useShallowEffect(() => {
|
||||||
|
fetchData();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Box pt={10}>
|
||||||
|
<Text c={WARNA.biruTua} mb={10} fw={'bold'} fz={16}>Event Hari Ini</Text>
|
||||||
|
<Box bg={"white"} style={{
|
||||||
|
borderRadius: 10,
|
||||||
|
border: `1px solid ${"#D6D8F6"}`,
|
||||||
|
padding: 10
|
||||||
|
}}>
|
||||||
|
{loading ?
|
||||||
|
Array(3)
|
||||||
|
.fill(null)
|
||||||
|
.map((_, i) => (
|
||||||
|
<Box key={i} mb={10}>
|
||||||
|
<Skeleton height={100} width={"100%"} radius={"md"} />
|
||||||
|
</Box>
|
||||||
|
))
|
||||||
|
:
|
||||||
|
_.isEmpty(isData)
|
||||||
|
?
|
||||||
|
<Box style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '20vh' }}>
|
||||||
|
<Text c="dimmed" ta={"center"} fs={"italic"}>Tidak ada event</Text>
|
||||||
|
</Box>
|
||||||
|
:
|
||||||
|
isData.map((event, index) => {
|
||||||
|
const bgColor = ['#D8D8F1', '#FED6C5'][index % 2]
|
||||||
|
const colorDivider = ['#535FCA', '#A7A7A7'][index % 2]
|
||||||
|
return (
|
||||||
|
<Box key={event.id} mt={10}>
|
||||||
|
<Box onClick={() => router.push(`/division/${event.idDivision}/calender/${event.id}`)} bg={bgColor} pl={15} p={10} style={{
|
||||||
|
borderRadius: 10
|
||||||
|
}} h={113}>
|
||||||
|
<Group>
|
||||||
|
<Divider h={92} size="lg" orientation="vertical" color={colorDivider} />
|
||||||
|
<Box>
|
||||||
|
<Text>{event.timeStart} - {event.timeEnd}</Text>
|
||||||
|
<Text fw={"bold"}>{event.title}</Text>
|
||||||
|
<Text>Dibuat oleh : {event.user_name}</Text>
|
||||||
|
</Box>
|
||||||
|
</Group>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
)
|
||||||
|
}
|
||||||
87
src/module/home/ui/list_project.tsx
Normal file
87
src/module/home/ui/list_project.tsx
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
'use client'
|
||||||
|
import { WARNA } from "@/module/_global";
|
||||||
|
import { Carousel } from "@mantine/carousel";
|
||||||
|
import { Box, Card, Flex, Title, Text, Progress, Stack, Skeleton } from "@mantine/core";
|
||||||
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { useState } from "react";
|
||||||
|
import toast from "react-hot-toast";
|
||||||
|
import { funGetHome } from "../lib/api_home";
|
||||||
|
import { IDataHomeKegiatan } from "../lib/type_home";
|
||||||
|
import _ from "lodash";
|
||||||
|
|
||||||
|
export default function ListProjects() {
|
||||||
|
const router = useRouter()
|
||||||
|
const [isData, setData] = useState<IDataHomeKegiatan[]>([])
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
|
||||||
|
const fetchData = async () => {
|
||||||
|
try {
|
||||||
|
setData([]);
|
||||||
|
setLoading(true);
|
||||||
|
const response = await funGetHome('?cat=kegiatan')
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
|
setData(response.data)
|
||||||
|
} else {
|
||||||
|
toast.error(response.message);
|
||||||
|
}
|
||||||
|
setLoading(false);
|
||||||
|
} catch (error) {
|
||||||
|
toast.error("Gagal mendapatkan data, coba lagi nanti");
|
||||||
|
console.error(error);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
useShallowEffect(() => {
|
||||||
|
fetchData();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Box pt={10}>
|
||||||
|
<Text c={WARNA.biruTua} mb={10} fw={'bold'} fz={16}>Kegiatan Terbaru</Text>
|
||||||
|
{loading ?
|
||||||
|
<Box pb={20}>
|
||||||
|
<Skeleton width={"100%"} height={200} radius={"md"} />
|
||||||
|
</Box>
|
||||||
|
:
|
||||||
|
_.isEmpty(isData)
|
||||||
|
?
|
||||||
|
<Box style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '50vh' }}>
|
||||||
|
<Text c="dimmed" ta={"center"} fs={"italic"}>Tidak ada kegiatan terbaru</Text>
|
||||||
|
</Box>
|
||||||
|
:
|
||||||
|
<Carousel dragFree slideGap={"xs"} align="start" slideSize={"xs"} withIndicators withControls={false}>
|
||||||
|
{isData.map((v) =>
|
||||||
|
<Carousel.Slide key={v.id}>
|
||||||
|
<Box w={{ base: 300, md: 400 }}>
|
||||||
|
<Card shadow="sm" padding="md" component="a" radius={10} onClick={() => router.push(`/project/${v.id}`)}>
|
||||||
|
<Card.Section>
|
||||||
|
<Box h={120} bg={WARNA.biruTua}>
|
||||||
|
<Flex justify={'center'} align={'center'} h={"100%"}>
|
||||||
|
<Title order={3} c={"white"}>{v.title}</Title>
|
||||||
|
</Flex>
|
||||||
|
</Box>
|
||||||
|
</Card.Section>
|
||||||
|
<Stack h={150} align="stretch" justify="center">
|
||||||
|
<Progress.Root size="xl" radius="xl" style={{ border: `1px solid ${'#BDBDBD'}` }}>
|
||||||
|
<Progress.Section value={v.progress} color="yellow" striped >
|
||||||
|
<Progress.Label>{v.progress}%</Progress.Label>
|
||||||
|
</Progress.Section>
|
||||||
|
</Progress.Root>
|
||||||
|
<Text c={WARNA.biruTua}>{v.createdAt}</Text>
|
||||||
|
</Stack>
|
||||||
|
</Card>
|
||||||
|
</Box>
|
||||||
|
</Carousel.Slide>
|
||||||
|
)}
|
||||||
|
</Carousel>
|
||||||
|
}
|
||||||
|
</Box>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
import { LayoutNavbarHome } from '@/module/_global';
|
import { LayoutNavbarHome } from '@/module/_global';
|
||||||
import { Box, Group, Stack, Text } from '@mantine/core';
|
import { Box, Group, Stack, Text } from '@mantine/core';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Carosole from '../components/carosole';
|
import Carosole from './carosole';
|
||||||
import Features from '../components/features';
|
import Features from './features';
|
||||||
import IconNavbar from '../components/ui/icon_navbar';
|
import IconNavbar from './icon_navbar';
|
||||||
import ListProjects from '../components/list_project';
|
import ListProjects from './list_project';
|
||||||
import ListDivisi from '../components/list_divisi';
|
import ListDivisi from './list_divisi';
|
||||||
import ListDiscussion from '../components/list_discussion';
|
import ListDiscussion from './list_discussion';
|
||||||
import ListEventHome from '../components/list_event';
|
import ListEventHome from './list_event';
|
||||||
import ChartProgressHome from '../components/chart_progress_tugas';
|
import ChartProgressHome from './chart_progress_tugas';
|
||||||
import ChartDocumentHome from '../components/chart_document';
|
import ChartDocumentHome from './chart_document';
|
||||||
|
|
||||||
|
|
||||||
export default function ViewHome() {
|
export default function ViewHome() {
|
||||||
@@ -17,7 +17,7 @@ export default function ViewHome() {
|
|||||||
<>
|
<>
|
||||||
<LayoutNavbarHome>
|
<LayoutNavbarHome>
|
||||||
<Group justify='space-between'>
|
<Group justify='space-between'>
|
||||||
<Text fw={'bold'} c={'white'} >Perbekel Darmasaba</Text>
|
<Text fw={'bold'} c={'white'}>Perbekel Darmasaba</Text>
|
||||||
<IconNavbar />
|
<IconNavbar />
|
||||||
</Group>
|
</Group>
|
||||||
</LayoutNavbarHome>
|
</LayoutNavbarHome>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { LayoutNavbarNew } from '@/module/_global'
|
import { LayoutNavbarNew } from '@/module/_global'
|
||||||
import { Box, } from '@mantine/core'
|
import { Box, } from '@mantine/core'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import ListNotification from '../components/list_notification'
|
import ListNotification from './list_notification'
|
||||||
|
|
||||||
export default function ViewNotification() {
|
export default function ViewNotification() {
|
||||||
return (
|
return (
|
||||||
Reference in New Issue
Block a user