upd: tampilan kegiatan dan tugas divisi
Deskripsi: - menambahkan chart progres pada list kegiatan - menambahkan label status pada list tugas divisi No Issues
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { DIR, funSendWebPush, funUploadFile, prisma } from "@/module/_global";
|
||||
import { funGetUserByCookies } from "@/module/auth";
|
||||
import { createLogUser } from "@/module/user";
|
||||
import _ from "lodash";
|
||||
import _, { ceil } from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
|
||||
@@ -94,6 +94,15 @@ export async function GET(request: Request) {
|
||||
select: {
|
||||
idUser: true
|
||||
}
|
||||
},
|
||||
ProjectTask: {
|
||||
where: {
|
||||
isActive: true
|
||||
},
|
||||
select: {
|
||||
title: true,
|
||||
status: true
|
||||
}
|
||||
}
|
||||
},
|
||||
orderBy: {
|
||||
@@ -102,11 +111,11 @@ export async function GET(request: Request) {
|
||||
})
|
||||
|
||||
const omitData = data.map((v: any) => ({
|
||||
..._.omit(v, ["ProjectMember"]),
|
||||
..._.omit(v, ["ProjectMember", "ProjectTask"]),
|
||||
progress: ceil((v.ProjectTask.filter((i: any) => i.status == 1).length * 100) / v.ProjectTask.length),
|
||||
member: v.ProjectMember.length
|
||||
}))
|
||||
|
||||
|
||||
const totalData = await prisma.project.count({
|
||||
where: kondisi
|
||||
})
|
||||
|
||||
@@ -4,6 +4,7 @@ export interface IDataProject {
|
||||
desc: string
|
||||
status: number
|
||||
member: number
|
||||
progress: number
|
||||
}
|
||||
|
||||
export interface IDataListTaskProject {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client"
|
||||
import { currentScroll, globalNotifPage, globalRole, ReloadButtonTop, SkeletonList, TEMA } from '@/module/_global';
|
||||
import { useHookstate } from '@hookstate/core';
|
||||
import { ActionIcon, Avatar, Badge, Box, Card, Center, Divider, Flex, Grid, Group, Skeleton, Text, TextInput, Title } from '@mantine/core';
|
||||
import { ActionIcon, Avatar, Badge, Box, Card, Center, Divider, Flex, Grid, Group, Progress, Skeleton, Text, TextInput, Title } from '@mantine/core';
|
||||
import { useMediaQuery, useShallowEffect } from '@mantine/hooks';
|
||||
import _ from 'lodash';
|
||||
import { useRouter, useSearchParams } from 'next/navigation';
|
||||
@@ -260,8 +260,16 @@ export default function ListProject() {
|
||||
</Flex>
|
||||
</Box>
|
||||
</Card.Section>
|
||||
<Box pt={10}>
|
||||
<Text>{v.desc}</Text>
|
||||
<Box pt={15}>
|
||||
{
|
||||
v.status > 0 &&
|
||||
<Progress.Root size="xl" radius="xl" style={{ border: `1px solid ${'#BDBDBD'}` }}>
|
||||
<Progress.Section value={_.isNull(v.progress) ? 0 : v.progress} color="yellow" striped >
|
||||
<Progress.Label>{_.isNull(v.progress) ? 0 : v.progress}%</Progress.Label>
|
||||
</Progress.Section>
|
||||
</Progress.Root>
|
||||
}
|
||||
<Text lineClamp={2} my={v.status > 0 ? 10 : 0}>{v.desc}</Text>
|
||||
<Group align='center' pt={10} justify='space-between'>
|
||||
<Badge color={
|
||||
v.status === 0 ? '#1372C4' :
|
||||
@@ -273,7 +281,7 @@ export default function ListProject() {
|
||||
v.status === 0 ? 'Segera' :
|
||||
v.status === 1 ? 'Dikerjakan' :
|
||||
v.status === 2 ? 'Selesai' :
|
||||
v.status === 3 ? 'Dibatalkan' :
|
||||
v.status === 3 ? 'Batal' :
|
||||
""
|
||||
}</Badge>
|
||||
<Avatar.Group>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { currentScroll, globalNotifPage, ReloadButtonTop, SkeletonList, TEMA } from "@/module/_global";
|
||||
import { useHookstate } from "@hookstate/core";
|
||||
import { ActionIcon, Avatar, Box, Card, Center, Divider, Flex, Grid, Group, Progress, Skeleton, Text, TextInput, Title } from "@mantine/core";
|
||||
import { ActionIcon, Avatar, Badge, Box, Card, Center, Divider, Flex, Grid, Group, Progress, Skeleton, Text, TextInput, Title } from "@mantine/core";
|
||||
import { useMediaQuery, useShallowEffect } from "@mantine/hooks";
|
||||
import _ from "lodash";
|
||||
import { useParams, useRouter, useSearchParams } from "next/navigation";
|
||||
@@ -246,14 +246,30 @@ export default function ListDivisionTask() {
|
||||
</Flex>
|
||||
</Box>
|
||||
</Card.Section>
|
||||
<Box pt={10}>
|
||||
<Progress.Root size="xl" radius="xl" style={{ border: `1px solid ${'#BDBDBD'}` }}>
|
||||
<Progress.Section value={_.isNull(v.progress) ? 0 : v.progress} color="yellow" striped >
|
||||
<Progress.Label>{_.isNull(v.progress) ? 0 : v.progress}%</Progress.Label>
|
||||
</Progress.Section>
|
||||
</Progress.Root>
|
||||
<Text my={10}>{v.desc}</Text>
|
||||
<Box pt={15}>
|
||||
{
|
||||
v.status > 0 &&
|
||||
<Progress.Root size="xl" radius="xl" style={{ border: `1px solid ${'#BDBDBD'}` }}>
|
||||
<Progress.Section value={_.isNull(v.progress) ? 0 : v.progress} color="yellow" striped >
|
||||
<Progress.Label>{_.isNull(v.progress) ? 0 : v.progress}%</Progress.Label>
|
||||
</Progress.Section>
|
||||
</Progress.Root>
|
||||
}
|
||||
<Text lineClamp={2} my={v.status > 0 ? 10 : 0}>{v.desc}</Text>
|
||||
<Group align='center' pt={10} justify='space-between'>
|
||||
<Badge color={
|
||||
v.status === 0 ? '#1372C4' :
|
||||
v.status === 1 ? '#C5771A' :
|
||||
v.status === 2 ? '#0B6025' :
|
||||
v.status === 3 ? '#BB1F1F' :
|
||||
""
|
||||
}>{
|
||||
v.status === 0 ? 'Segera' :
|
||||
v.status === 1 ? 'Dikerjakan' :
|
||||
v.status === 2 ? 'Selesai' :
|
||||
v.status === 3 ? 'Batal' :
|
||||
""
|
||||
}</Badge>
|
||||
<Avatar.Group>
|
||||
<Avatar>
|
||||
<MdAccountCircle size={32} color={tema.get().utama} />
|
||||
|
||||
Reference in New Issue
Block a user