Merge pull request #321 from bipproduction/amalia/30-okt-24
Amalia/30 okt 24
This commit is contained in:
@@ -185,9 +185,10 @@ export async function GET(request: Request) {
|
|||||||
const cek = data.some((i: any) => i.status == dataStatus[index].status)
|
const cek = data.some((i: any) => i.status == dataStatus[index].status)
|
||||||
if (cek) {
|
if (cek) {
|
||||||
const find = ((Number(data.find((i: any) => i.status == dataStatus[index].status)?._count) * 100) / data.reduce((n, { _count }) => n + _count, 0)).toFixed(2)
|
const find = ((Number(data.find((i: any) => i.status == dataStatus[index].status)?._count) * 100) / data.reduce((n, { _count }) => n + _count, 0)).toFixed(2)
|
||||||
|
const fix = find.substr(-2, 2) == "00" ? find.substr(0, 2) : find
|
||||||
input = {
|
input = {
|
||||||
name: dataStatus[index].name,
|
name: dataStatus[index].name,
|
||||||
value: find
|
value: fix
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
input = {
|
input = {
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import { ActionIcon, Box } from '@mantine/core';
|
|
||||||
import { useRouter } from 'next/navigation';
|
|
||||||
import React from 'react';
|
|
||||||
import { HiChevronLeft } from 'react-icons/hi2';
|
|
||||||
import { WARNA } from '../fun/WARNA';
|
|
||||||
import _ from 'lodash';
|
|
||||||
import { useHookstate } from '@hookstate/core';
|
import { useHookstate } from '@hookstate/core';
|
||||||
|
import { ActionIcon, Box } from '@mantine/core';
|
||||||
|
import _ from 'lodash';
|
||||||
|
import { useRouter } from 'next/navigation';
|
||||||
|
import { HiChevronLeft } from 'react-icons/hi2';
|
||||||
import { TEMA } from '../bin/val_global';
|
import { TEMA } from '../bin/val_global';
|
||||||
|
|
||||||
function LayoutIconBack({ back }: { back?: string }) {
|
function LayoutIconBack({ back }: { back?: string }) {
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import { ActionIcon, Box, Grid, Group, Text, Title } from '@mantine/core';
|
|
||||||
import React from 'react';
|
|
||||||
import { WARNA } from '../fun/WARNA';
|
|
||||||
import LayoutIconBack from './layout_icon_back';
|
|
||||||
import _ from 'lodash';
|
|
||||||
import { useHookstate } from '@hookstate/core';
|
import { useHookstate } from '@hookstate/core';
|
||||||
|
import { Box, Grid, Group, Title } from '@mantine/core';
|
||||||
|
import _ from 'lodash';
|
||||||
|
import React from 'react';
|
||||||
import { TEMA } from '../bin/val_global';
|
import { TEMA } from '../bin/val_global';
|
||||||
|
import LayoutIconBack from './layout_icon_back';
|
||||||
|
|
||||||
export const LayoutNavbarNew = ({ back, state, title, menu }: { back?: string, title: string, menu: React.ReactNode, state?: React.ReactNode }) => {
|
export const LayoutNavbarNew = ({ back, state, title, menu }: { back?: string, title: string, menu: React.ReactNode, state?: React.ReactNode }) => {
|
||||||
const tema = useHookstate(TEMA)
|
const tema = useHookstate(TEMA)
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import { LayoutDrawer, LayoutNavbarNew, TEMA } from "@/module/_global";
|
import { LayoutDrawer, LayoutNavbarNew, TEMA } from "@/module/_global";
|
||||||
import { ActionIcon, Box } from "@mantine/core";
|
|
||||||
import { useState } from "react";
|
|
||||||
import { HiMenu } from "react-icons/hi";
|
|
||||||
import DrawerDetailDivision from "./drawer_detail_division";
|
|
||||||
import { funGetDivisionById } from "../lib/api_division";
|
|
||||||
import { useParams } from "next/navigation";
|
|
||||||
import toast from "react-hot-toast";
|
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
|
||||||
import { useHookstate } from "@hookstate/core";
|
import { useHookstate } from "@hookstate/core";
|
||||||
|
import { ActionIcon } from "@mantine/core";
|
||||||
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
|
import { useParams } from "next/navigation";
|
||||||
|
import { useState } from "react";
|
||||||
|
import toast from "react-hot-toast";
|
||||||
|
import { HiMenu } from "react-icons/hi";
|
||||||
|
import { funGetDivisionById } from "../lib/api_division";
|
||||||
|
import DrawerDetailDivision from "./drawer_detail_division";
|
||||||
|
|
||||||
export default function NavbarDetailDivision() {
|
export default function NavbarDetailDivision() {
|
||||||
const [openDrawer, setOpenDrawer] = useState(false)
|
const [openDrawer, setOpenDrawer] = useState(false)
|
||||||
@@ -37,7 +37,7 @@ export default function NavbarDetailDivision() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<LayoutNavbarNew back="/division" title={name} menu={
|
<LayoutNavbarNew back="" title={name} menu={
|
||||||
<ActionIcon variant="light" onClick={() => (setOpenDrawer(true))} bg={tema.get().bgIcon} size="lg" radius="lg" aria-label="Settings">
|
<ActionIcon variant="light" onClick={() => (setOpenDrawer(true))} bg={tema.get().bgIcon} size="lg" radius="lg" aria-label="Settings">
|
||||||
<HiMenu size={20} color='white' />
|
<HiMenu size={20} color='white' />
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ export interface IDataHomeKegiatan {
|
|||||||
id: string
|
id: string
|
||||||
title: string
|
title: string
|
||||||
desc: string
|
desc: string
|
||||||
status: string
|
status: number
|
||||||
progress: number
|
progress: number
|
||||||
createdAt: string
|
createdAt: string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import { TEMA, WARNA } from "@/module/_global";
|
import { TEMA } from "@/module/_global";
|
||||||
import { Box, Text } from "@mantine/core";
|
import { useHookstate } from "@hookstate/core";
|
||||||
|
import { Box } from "@mantine/core";
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
import { EChartsOption } from "echarts";
|
import { EChartsOption } from "echarts";
|
||||||
import EChartsReact from "echarts-for-react";
|
import EChartsReact from "echarts-for-react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { funGetHome } from "../lib/api_home";
|
|
||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
import { useHookstate } from "@hookstate/core";
|
import { funGetHome } from "../lib/api_home";
|
||||||
|
|
||||||
export default function ChartProgressHome() {
|
export default function ChartProgressHome() {
|
||||||
const [options, setOptions] = useState<EChartsOption>({});
|
const [options, setOptions] = useState<EChartsOption>({});
|
||||||
@@ -41,7 +41,7 @@ export default function ChartProgressHome() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadData = (value:any) => {
|
const loadData = (value: any) => {
|
||||||
const option: EChartsOption = {
|
const option: EChartsOption = {
|
||||||
title: {
|
title: {
|
||||||
text: "PROGRES KEGIATAN",
|
text: "PROGRES KEGIATAN",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { TEMA } from "@/module/_global";
|
import { TEMA } from "@/module/_global";
|
||||||
import { useHookstate } from "@hookstate/core";
|
import { useHookstate } from "@hookstate/core";
|
||||||
import { Carousel } from "@mantine/carousel";
|
import { Carousel } from "@mantine/carousel";
|
||||||
import { Box, Card, Flex, Progress, Skeleton, Stack, Text, Title } from "@mantine/core";
|
import { Badge, Box, Card, Flex, Group, Progress, Skeleton, Stack, Text, Title } from "@mantine/core";
|
||||||
import { useMediaQuery, useShallowEffect } from "@mantine/hooks";
|
import { useMediaQuery, useShallowEffect } from "@mantine/hooks";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
@@ -79,7 +79,24 @@ export default function ListProjects() {
|
|||||||
<Progress.Label>{_.isNull(v.progress) ? 0 : v.progress}%</Progress.Label>
|
<Progress.Label>{_.isNull(v.progress) ? 0 : v.progress}%</Progress.Label>
|
||||||
</Progress.Section>
|
</Progress.Section>
|
||||||
</Progress.Root>
|
</Progress.Root>
|
||||||
|
<Group align='center' pt={10} justify='space-between'>
|
||||||
<Text c={tema.get().utama} fz={isMobile ? 14 : 16}>{v.createdAt}</Text>
|
<Text c={tema.get().utama} fz={isMobile ? 14 : 16}>{v.createdAt}</Text>
|
||||||
|
<Badge color={
|
||||||
|
v.status === 0 ? '#1372C4' :
|
||||||
|
v.status === 1 ? '#C5771A' :
|
||||||
|
v.status === 2 ? '#0B6025' :
|
||||||
|
v.status === 3 ? '#BB1F1F' :
|
||||||
|
"grey"
|
||||||
|
}>
|
||||||
|
{
|
||||||
|
v.status === 0 ? 'Segera' :
|
||||||
|
v.status === 1 ? 'Dikerjakan' :
|
||||||
|
v.status === 2 ? 'Selesai' :
|
||||||
|
v.status === 3 ? 'Dibatalkan' :
|
||||||
|
"Segera"
|
||||||
|
}
|
||||||
|
</Badge>
|
||||||
|
</Group>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Card>
|
</Card>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -1,62 +1,49 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { LayoutNavbarNew, TEMA, WARNA } from "@/module/_global";
|
import { LayoutNavbarNew, SkeletonList, TEMA, WARNA } from "@/module/_global";
|
||||||
import {
|
|
||||||
ActionIcon,
|
|
||||||
Avatar,
|
|
||||||
Box,
|
|
||||||
Divider,
|
|
||||||
Grid,
|
|
||||||
Group,
|
|
||||||
Text,
|
|
||||||
TextInput,
|
|
||||||
} from "@mantine/core";
|
|
||||||
import React, { useState } from "react";
|
|
||||||
import {
|
|
||||||
HiMagnifyingGlass,
|
|
||||||
HiMiniPresentationChartBar,
|
|
||||||
HiMiniUserGroup,
|
|
||||||
} from "react-icons/hi2";
|
|
||||||
import { funGetSearchAll } from "../lib/api_search";
|
|
||||||
import { useMediaQuery, useShallowEffect } from "@mantine/hooks";
|
|
||||||
import {
|
|
||||||
IDataDivisionSearch,
|
|
||||||
IDataProjectSearch,
|
|
||||||
IDataUserSearch,
|
|
||||||
} from "../lib/type_search";
|
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import _ from "lodash";
|
|
||||||
import { useHookstate } from "@hookstate/core";
|
import { useHookstate } from "@hookstate/core";
|
||||||
|
import { ActionIcon, Avatar, Box, Divider, Grid, Text, TextInput } from "@mantine/core";
|
||||||
|
import { useMediaQuery } from "@mantine/hooks";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { useState } from "react";
|
||||||
|
import toast from "react-hot-toast";
|
||||||
|
import { HiMagnifyingGlass, HiMiniPresentationChartBar, HiMiniUserGroup, } from "react-icons/hi2";
|
||||||
|
import { funGetSearchAll } from "../lib/api_search";
|
||||||
|
import { IDataDivisionSearch, IDataProjectSearch, IDataUserSearch, } from "../lib/type_search";
|
||||||
|
|
||||||
export default function ViewSearch() {
|
export default function ViewSearch() {
|
||||||
const [search, setSearch] = useState("");
|
const [search, setSearch] = useState("")
|
||||||
const [dataUser, setDataUser] = useState<IDataUserSearch[]>([]);
|
const [dataUser, setDataUser] = useState<IDataUserSearch[]>([])
|
||||||
const [dataProject, setDataProject] = useState<IDataProjectSearch[]>([]);
|
const [dataProject, setDataProject] = useState<IDataProjectSearch[]>([])
|
||||||
const [dataDivision, setDataDivision] = useState<IDataDivisionSearch[]>([]);
|
const [dataDivision, setDataDivision] = useState<IDataDivisionSearch[]>([])
|
||||||
const router = useRouter();
|
const [loading, setLoading] = useState(false)
|
||||||
const tema = useHookstate(TEMA);
|
const router = useRouter()
|
||||||
|
const tema = useHookstate(TEMA)
|
||||||
|
const isMobile2 = useMediaQuery("(max-width: 460px)");
|
||||||
|
|
||||||
async function featchSearch() {
|
async function featchSearch(cari: string) {
|
||||||
try {
|
try {
|
||||||
const res = await funGetSearchAll("?search=" + search);
|
setLoading(true)
|
||||||
|
setSearch(cari)
|
||||||
|
if (cari != "") {
|
||||||
|
const res = await funGetSearchAll("?search=" + cari);
|
||||||
setDataUser(res.data.user);
|
setDataUser(res.data.user);
|
||||||
setDataProject(res.data.project);
|
setDataProject(res.data.project);
|
||||||
setDataDivision(res.data.division);
|
setDataDivision(res.data.division);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
throw new Error("Error");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
useShallowEffect(() => {
|
|
||||||
if (search != "") {
|
|
||||||
featchSearch();
|
|
||||||
} else {
|
} else {
|
||||||
setDataUser([]);
|
setDataUser([]);
|
||||||
setDataProject([]);
|
setDataProject([]);
|
||||||
setDataDivision([]);
|
setDataDivision([]);
|
||||||
}
|
}
|
||||||
}, [search]);
|
} catch (error) {
|
||||||
const isMobile2 = useMediaQuery("(max-width: 460px)");
|
console.error(error);
|
||||||
|
toast.error("Gagal mendapatkan data, coba lagi nanti");
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -74,9 +61,20 @@ export default function ViewSearch() {
|
|||||||
radius={30}
|
radius={30}
|
||||||
leftSection={<HiMagnifyingGlass size={20} />}
|
leftSection={<HiMagnifyingGlass size={20} />}
|
||||||
placeholder="Pencarian"
|
placeholder="Pencarian"
|
||||||
onChange={(e) => setSearch(e.target.value)}
|
onChange={(e) => featchSearch(e.target.value)}
|
||||||
/>
|
/>
|
||||||
{dataUser.length || dataProject.length || dataDivision.length > 0 ? (
|
{
|
||||||
|
loading ?
|
||||||
|
Array(5)
|
||||||
|
.fill(null)
|
||||||
|
.map((_, i) => (
|
||||||
|
<Box key={i}>
|
||||||
|
<SkeletonList />
|
||||||
|
</Box>
|
||||||
|
))
|
||||||
|
:
|
||||||
|
dataUser.length || dataProject.length || dataDivision.length > 0 ?
|
||||||
|
(
|
||||||
<Box pt={20}>
|
<Box pt={20}>
|
||||||
<Box
|
<Box
|
||||||
style={{
|
style={{
|
||||||
@@ -330,7 +328,13 @@ export default function ViewSearch() {
|
|||||||
) : null}
|
) : null}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
) : null}
|
) :
|
||||||
|
search != '' ?
|
||||||
|
<Box style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '50vh' }}>
|
||||||
|
<Text c="dimmed" ta={"center"} fs={"italic"}>Tidak ada data</Text>
|
||||||
|
</Box>
|
||||||
|
: null
|
||||||
|
}
|
||||||
</Box>
|
</Box>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import { FaFileCirclePlus, FaPencil, FaUsers } from 'react-icons/fa6';
|
|||||||
import { HiMenu } from 'react-icons/hi';
|
import { HiMenu } from 'react-icons/hi';
|
||||||
import { IoAddCircle } from 'react-icons/io5';
|
import { IoAddCircle } from 'react-icons/io5';
|
||||||
import { MdCancel } from 'react-icons/md';
|
import { MdCancel } from 'react-icons/md';
|
||||||
import { funGetOneProjectById } from '../lib/api_project';
|
|
||||||
import { useWibuRealtime } from 'wibu-realtime';
|
import { useWibuRealtime } from 'wibu-realtime';
|
||||||
|
import { funGetOneProjectById } from '../lib/api_project';
|
||||||
|
|
||||||
export default function NavbarDetailProject() {
|
export default function NavbarDetailProject() {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@@ -54,7 +54,7 @@ export default function NavbarDetailProject() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<LayoutNavbarNew back="/project?status=0" title={name} menu={
|
<LayoutNavbarNew back="" title={name} menu={
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
variant="light"
|
variant="light"
|
||||||
bg={tema.get().bgIcon}
|
bg={tema.get().bgIcon}
|
||||||
|
|||||||
Reference in New Issue
Block a user