Merge pull request #324 from bipproduction/amalia/01-nov-24
fix: divisi
This commit is contained in:
@@ -8,14 +8,20 @@ export async function GET(request: Request) {
|
||||
try {
|
||||
const user = await funGetUserByCookies()
|
||||
const { searchParams } = new URL(request.url)
|
||||
const group = searchParams.get("group")
|
||||
const idGroup = searchParams.get("group")
|
||||
const division = searchParams.get("division")
|
||||
const date = searchParams.get("date")
|
||||
let grup
|
||||
|
||||
if (user.id == undefined) {
|
||||
return NextResponse.json({ success: false, message: "Anda harus login untuk mengakses ini" }, { status: 401 })
|
||||
}
|
||||
|
||||
if (idGroup == "null" || idGroup == undefined || idGroup == "") {
|
||||
grup = user.idGroup
|
||||
} else {
|
||||
grup = idGroup
|
||||
}
|
||||
|
||||
// CHART PROGRESS
|
||||
let kondisiProgress
|
||||
@@ -26,7 +32,7 @@ export async function GET(request: Request) {
|
||||
lte: new Date(String(date))
|
||||
},
|
||||
Division: {
|
||||
idGroup: String(group)
|
||||
idGroup: String(grup)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -52,9 +58,10 @@ export async function GET(request: Request) {
|
||||
const cek = data.some((i: any) => i.status == dataStatus[index].status)
|
||||
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 fix = find != "100.00" ? find.substr(-2, 2) == "00" ? find.substr(0, 2) : find : "100"
|
||||
input = {
|
||||
name: dataStatus[index].name,
|
||||
value: find
|
||||
value: fix
|
||||
}
|
||||
} else {
|
||||
input = {
|
||||
@@ -75,7 +82,7 @@ export async function GET(request: Request) {
|
||||
isActive: true,
|
||||
category: 'FILE',
|
||||
Division: {
|
||||
idGroup: String(group)
|
||||
idGroup: String(grup)
|
||||
},
|
||||
createdAt: {
|
||||
lte: new Date(String(date))
|
||||
@@ -137,7 +144,7 @@ export async function GET(request: Request) {
|
||||
kondisiEvent = {
|
||||
isActive: true,
|
||||
Division: {
|
||||
idGroup: String(group)
|
||||
idGroup: String(grup)
|
||||
},
|
||||
dateStart: new Date(String(date))
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ export async function GET(request: Request) {
|
||||
const cek = data.some((i: any) => i.status == dataStatus[index].status)
|
||||
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 fix = find.substr(-2, 2) == "00" ? find.substr(0, 2) : find
|
||||
const fix = find != "100.00" ? find.substr(-2, 2) == "00" ? find.substr(0, 2) : find : "100"
|
||||
input = {
|
||||
name: dataStatus[index].name,
|
||||
value: fix
|
||||
|
||||
@@ -50,6 +50,7 @@ export async function GET(request: Request) {
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
idUserRole: true,
|
||||
isActive: true,
|
||||
nik: true,
|
||||
name: true,
|
||||
@@ -92,6 +93,7 @@ export async function GET(request: Request) {
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
idUserRole: true,
|
||||
isActive: true,
|
||||
nik: true,
|
||||
name: true,
|
||||
|
||||
@@ -28,7 +28,8 @@ export default function CreateAnggotaDivision() {
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [onClickSearch, setOnClickSearch] = useState(false)
|
||||
const tema = useHookstate(TEMA)
|
||||
const isMobile2 = useMediaQuery("(max-width: 438px)");
|
||||
const isMobile2 = useMediaQuery("(max-width: 438px)")
|
||||
const [loadingModal, setLoadingModal] = useState(false)
|
||||
|
||||
const handleFileClick = (index: number) => {
|
||||
if (selectedFiles.some((i: any) => i.idUser == dataMember[index].id)) {
|
||||
@@ -44,16 +45,25 @@ export default function CreateAnggotaDivision() {
|
||||
|
||||
|
||||
async function loadMember(group: string, search: string) {
|
||||
setLoading(true)
|
||||
const res = await funGetAllmember('?active=true&group=' + group + '&search=' + search);
|
||||
const user = await funGetUserByCookies();
|
||||
try {
|
||||
setLoading(true)
|
||||
const res = await funGetAllmember('?active=true&group=' + group + '&search=' + search);
|
||||
const user = await funGetUserByCookies();
|
||||
|
||||
if (res.success) {
|
||||
setDataMember(res.data.filter((i: any) => i.id != user.id))
|
||||
} else {
|
||||
toast.error(res.message)
|
||||
if (res.success) {
|
||||
const dariUserLogin = res.data.filter((i: any) => i.id != user.id)
|
||||
const fixListUser = dariUserLogin.filter((i: any) => i.idUserRole == 'coadmin' || i.idUserRole == 'user')
|
||||
setDataMember(fixListUser)
|
||||
} else {
|
||||
toast.error(res.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
toast.error("Gagal memuat data, coba lagi nanti")
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
setLoading(false)
|
||||
|
||||
}
|
||||
|
||||
async function loadFirst() {
|
||||
@@ -69,6 +79,7 @@ export default function CreateAnggotaDivision() {
|
||||
|
||||
async function addMember() {
|
||||
try {
|
||||
setLoadingModal(true)
|
||||
const res = await funAddDivisionMember(param.id, selectedFiles)
|
||||
if (res.success) {
|
||||
toast.success(res.message)
|
||||
@@ -76,15 +87,22 @@ export default function CreateAnggotaDivision() {
|
||||
} else {
|
||||
toast.error(res.message)
|
||||
}
|
||||
setOpen(false)
|
||||
} catch (error) {
|
||||
setOpen(false)
|
||||
console.error(error);
|
||||
toast.error("Gagal menambahkan anggota divisi, coba lagi nanti");
|
||||
|
||||
} finally {
|
||||
setLoadingModal(false)
|
||||
setOpen(false)
|
||||
}
|
||||
}
|
||||
|
||||
function onCheck() {
|
||||
if (selectedFiles.length == 0) {
|
||||
return toast.error("Error! silahkan pilih anggota")
|
||||
}
|
||||
setOpen(true)
|
||||
}
|
||||
|
||||
|
||||
useShallowEffect(() => {
|
||||
loadFirst()
|
||||
@@ -149,7 +167,7 @@ export default function CreateAnggotaDivision() {
|
||||
borderBottom: `1px solid ${"#E0DFDF"}`
|
||||
}}>
|
||||
{selectedFiles.length > 0 ? (
|
||||
<Carousel dragFree slideGap={"xs"} align="start" slideSize={"xs"} withControls={false}>
|
||||
<Carousel dragFree slideGap={"xs"} align="start" slideSize={"xs"} withControls={false}>
|
||||
{selectedFiles.map((v: any, i: any) => {
|
||||
return (
|
||||
<Carousel.Slide key={i}>
|
||||
@@ -195,51 +213,51 @@ export default function CreateAnggotaDivision() {
|
||||
<Text c="dimmed" ta={"center"} fs={"italic"}>Tidak ada anggota</Text>
|
||||
</Stack>
|
||||
:
|
||||
<Box pt={90} mb={100}>
|
||||
{dataMember.map((v: any, index: any) => {
|
||||
const isSelected = selectedFiles.some((i: any) => i.idUser == dataMember[index].id)
|
||||
const found = memberDb.some((i: any) => i.idUser == v.id)
|
||||
return (
|
||||
<Box my={10} key={index} onClick={() => (!found) ? handleFileClick(index) : null}>
|
||||
<Grid align='center' >
|
||||
<Grid.Col
|
||||
span={{
|
||||
base: 1,
|
||||
xs: 1,
|
||||
sm: 1,
|
||||
md: 1,
|
||||
lg: 1,
|
||||
xl: 1,
|
||||
}}
|
||||
>
|
||||
<Avatar src={`https://wibu-storage.wibudev.com/api/files/${v.img}`} alt="it's me" size="lg" />
|
||||
</Grid.Col>
|
||||
<Grid.Col
|
||||
span={{
|
||||
base: 11,
|
||||
xs: 11,
|
||||
sm: 11,
|
||||
md: 11,
|
||||
lg: 11,
|
||||
xl: 11,
|
||||
}}
|
||||
>
|
||||
<Flex justify='space-between' align={"center"}>
|
||||
<Flex direction={'column'} align="flex-start" justify="flex-start">
|
||||
<Text pl={isMobile2 ? 40 : 30} lineClamp={1}>{v.name}</Text>
|
||||
<Text pl={isMobile2 ? 40 : 30} c={"dimmed"} lineClamp={1}>{(found) ? "sudah menjadi anggota divisi" : ""}</Text>
|
||||
<Box pt={90} mb={100}>
|
||||
{dataMember.map((v: any, index: any) => {
|
||||
const isSelected = selectedFiles.some((i: any) => i.idUser == dataMember[index].id)
|
||||
const found = memberDb.some((i: any) => i.idUser == v.id)
|
||||
return (
|
||||
<Box my={10} key={index} onClick={() => (!found) ? handleFileClick(index) : null}>
|
||||
<Grid align='center' >
|
||||
<Grid.Col
|
||||
span={{
|
||||
base: 1,
|
||||
xs: 1,
|
||||
sm: 1,
|
||||
md: 1,
|
||||
lg: 1,
|
||||
xl: 1,
|
||||
}}
|
||||
>
|
||||
<Avatar src={`https://wibu-storage.wibudev.com/api/files/${v.img}`} alt="it's me" size="lg" />
|
||||
</Grid.Col>
|
||||
<Grid.Col
|
||||
span={{
|
||||
base: 11,
|
||||
xs: 11,
|
||||
sm: 11,
|
||||
md: 11,
|
||||
lg: 11,
|
||||
xl: 11,
|
||||
}}
|
||||
>
|
||||
<Flex justify='space-between' align={"center"}>
|
||||
<Flex direction={'column'} align="flex-start" justify="flex-start">
|
||||
<Text pl={isMobile2 ? 40 : 30} lineClamp={1}>{v.name}</Text>
|
||||
<Text pl={isMobile2 ? 40 : 30} c={"dimmed"} lineClamp={1}>{(found) ? "sudah menjadi anggota divisi" : ""}</Text>
|
||||
</Flex>
|
||||
{isSelected ? <FaCheck /> : null}
|
||||
</Flex>
|
||||
{isSelected ? <FaCheck /> : null}
|
||||
</Flex>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Box mt={10}>
|
||||
<Divider size={"xs"} />
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Box mt={10}>
|
||||
<Divider size={"xs"} />
|
||||
</Box>
|
||||
</Box>
|
||||
</Box>
|
||||
)
|
||||
})}
|
||||
</Box>
|
||||
)
|
||||
})}
|
||||
</Box>
|
||||
}
|
||||
</Box>
|
||||
<Box pos={'fixed'} bottom={0} p={rem(20)} w={"100%"} style={{
|
||||
@@ -253,12 +271,12 @@ export default function CreateAnggotaDivision() {
|
||||
size="lg"
|
||||
radius={30}
|
||||
fullWidth
|
||||
onClick={() => { setOpen(true) }}
|
||||
onClick={() => { onCheck() }}
|
||||
>
|
||||
Simpan
|
||||
</Button>
|
||||
</Box>
|
||||
<LayoutModal opened={isOpen} onClose={() => setOpen(false)}
|
||||
<LayoutModal loading={loadingModal} opened={isOpen} onClose={() => setOpen(false)}
|
||||
description="Apakah Anda yakin ingin menambahkan anggota divisi?"
|
||||
onYes={(val) => {
|
||||
if (val) {
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
"use client";
|
||||
import { LayoutNavbarNew, TEMA } from "@/module/_global";
|
||||
import { Box, Select, Skeleton, Stack, Text } from "@mantine/core";
|
||||
import { DateInput } from "@mantine/dates";
|
||||
import React, { useState } from "react";
|
||||
import EchartPaiReport from "./echart_pai_report";
|
||||
import EchartBarReport from "./echart_bar_report";
|
||||
import EventReport from "./event_report";
|
||||
import DiscussionReport from "./discussion_report";
|
||||
import { globalRole, LayoutNavbarNew, TEMA } from "@/module/_global";
|
||||
import { funGetAllGroup, IDataGroup } from "@/module/group";
|
||||
import toast from "react-hot-toast";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { funGetReportDivision } from "../lib/api_division";
|
||||
import { useParams } from "next/navigation";
|
||||
import moment from "moment";
|
||||
import { useHookstate } from "@hookstate/core";
|
||||
import { Box, Select, Skeleton, Stack } from "@mantine/core";
|
||||
import { DateInput } from "@mantine/dates";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import moment from "moment";
|
||||
import { useParams } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
import { funGetReportDivision } from "../lib/api_division";
|
||||
import EchartBarReport from "./echart_bar_report";
|
||||
import EchartPaiReport from "./echart_pai_report";
|
||||
import EventReport from "./event_report";
|
||||
|
||||
export default function CreateReport() {
|
||||
const [value, setValue] = useState<Date | null>(null);
|
||||
@@ -23,6 +22,7 @@ export default function CreateReport() {
|
||||
const [isGroup, setIsGroup] = useState("");
|
||||
const param = useParams<{ id: string }>()
|
||||
const tema = useHookstate(TEMA)
|
||||
const roleLogin = useHookstate(globalRole)
|
||||
const [report, setReport] = useState({
|
||||
progress: [],
|
||||
dokumen: [],
|
||||
@@ -74,13 +74,20 @@ export default function CreateReport() {
|
||||
}
|
||||
|
||||
function onChangeDate(val: any) {
|
||||
if (val != null && val != "" && isGroup != "" && isGroup != "null") {
|
||||
onReport(isGroup, val)
|
||||
}
|
||||
|
||||
if (isGroup == null || isGroup == "") {
|
||||
setTampil(false)
|
||||
toast.error("Error! harus memilih grup")
|
||||
if (roleLogin.get() == "supadmin") {
|
||||
if (val != null && val != "" && isGroup != "" && isGroup != "null") {
|
||||
onReport(isGroup, val)
|
||||
}
|
||||
|
||||
if (isGroup == null || isGroup == "") {
|
||||
setTampil(false)
|
||||
toast.error("Error! harus memilih grup")
|
||||
}
|
||||
} else {
|
||||
if (val != null && val != "") {
|
||||
onReport(isGroup, val)
|
||||
}
|
||||
}
|
||||
|
||||
setValue(val)
|
||||
@@ -95,19 +102,23 @@ export default function CreateReport() {
|
||||
<LayoutNavbarNew back="/division" title="Laporan Divisi" menu />
|
||||
<Box p={20}>
|
||||
<Stack>
|
||||
<Select
|
||||
placeholder="Grup"
|
||||
label="Grup"
|
||||
size="md"
|
||||
required
|
||||
radius={10}
|
||||
data={dataGroup?.map((pro: any) => ({
|
||||
value: String(pro.id),
|
||||
label: pro.name
|
||||
}))}
|
||||
onChange={(val) => { onChooseGroup(val) }}
|
||||
/>
|
||||
{roleLogin.get() == "supadmin" &&
|
||||
<Select
|
||||
placeholder="Grup"
|
||||
label="Grup"
|
||||
size="md"
|
||||
required
|
||||
radius={10}
|
||||
data={dataGroup?.map((pro: any) => ({
|
||||
value: String(pro.id),
|
||||
label: pro.name
|
||||
}))}
|
||||
onChange={(val) => { onChooseGroup(val) }}
|
||||
/>
|
||||
}
|
||||
|
||||
<DateInput
|
||||
valueFormat="DD-MM-YYYY"
|
||||
value={value}
|
||||
onChange={(val) => { onChangeDate(val) }}
|
||||
radius={10}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
"use client"
|
||||
import { TEMA } from "@/module/_global";
|
||||
import { useHookstate } from "@hookstate/core";
|
||||
import { Box, Stack, SimpleGrid, Flex, Text } from "@mantine/core";
|
||||
import { Box, Flex, SimpleGrid, Stack, Text } from "@mantine/core";
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
import { BsInfoCircle } from "react-icons/bs";
|
||||
import { FaPencil } from "react-icons/fa6";
|
||||
import { TbReportAnalytics } from "react-icons/tb";
|
||||
|
||||
export default function DrawerDetailDivision() {
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import React, { useState } from 'react';
|
||||
import { EChartsOption, color } from "echarts";
|
||||
import EChartsReact from "echarts-for-react";
|
||||
import { useShallowEffect } from '@mantine/hooks';
|
||||
import * as echarts from 'echarts';
|
||||
import { Box } from '@mantine/core';
|
||||
import { TEMA } from '@/module/_global';
|
||||
import { useHookstate } from '@hookstate/core';
|
||||
import { Box } from '@mantine/core';
|
||||
import { useShallowEffect } from '@mantine/hooks';
|
||||
import { EChartsOption } from "echarts";
|
||||
import EChartsReact from "echarts-for-react";
|
||||
import { useState } from 'react';
|
||||
|
||||
export default function EchartPaiReport({ data }: { data: any }) {
|
||||
const [options, setOptions] = useState<EChartsOption>({});
|
||||
|
||||
@@ -70,8 +70,6 @@ export default function EditDivision() {
|
||||
} else {
|
||||
toast.error(res.message);
|
||||
}
|
||||
setLoading(false);
|
||||
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
toast.error("Gagal mendapatkan divisi, coba lagi nanti");
|
||||
@@ -87,6 +85,7 @@ export default function EditDivision() {
|
||||
const res = await funEditDivision(param.id, body)
|
||||
if (res.success) {
|
||||
toast.success(res.message)
|
||||
router.push("/division/info/" + param.id)
|
||||
} else {
|
||||
toast.error(res.message)
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { Box, Divider, Group, ScrollArea, Stack, Text } from '@mantine/core';
|
||||
import React from 'react';
|
||||
import { IDataReportDivision } from '../lib/type_division';
|
||||
import { Box, Divider, Group, Text } from '@mantine/core';
|
||||
import _ from 'lodash';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { IDataReportDivision } from '../lib/type_division';
|
||||
|
||||
export default function EventReport({ data, tgl }: { data: IDataReportDivision[], tgl: string }) {
|
||||
const router = useRouter()
|
||||
@@ -14,7 +13,7 @@ export default function EventReport({ data, tgl }: { data: IDataReportDivision[]
|
||||
_.isEmpty(data)
|
||||
?
|
||||
<Box style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '20vh' }}>
|
||||
<Text c="dimmed" ta={"center"} fs={"italic"}>Tidak ada event</Text>
|
||||
<Text c="dimmed" ta={"center"} fs={"italic"}>Tidak ada acara</Text>
|
||||
</Box>
|
||||
:
|
||||
data.map((event, index) => {
|
||||
|
||||
@@ -37,10 +37,11 @@ export default function InformationDivision() {
|
||||
const isMobile2 = useMediaQuery("(max-width: 438px)");
|
||||
const tema = useHookstate(TEMA)
|
||||
const [loadingStatus, setLoadingStatus] = useState(false)
|
||||
const [loadingDelete, setLoadingDelete] = useState(false)
|
||||
|
||||
async function getOneData() {
|
||||
async function getOneData(loading: boolean) {
|
||||
try {
|
||||
setLoading(true);
|
||||
setLoading(loading)
|
||||
const res = await funGetDivisionById(param.id);
|
||||
const login = await funGetUserByCookies()
|
||||
if (res.success) {
|
||||
@@ -53,18 +54,17 @@ export default function InformationDivision() {
|
||||
} else {
|
||||
toast.error(res.message);
|
||||
}
|
||||
setLoading(false);
|
||||
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
toast.error("Gagal mendapatkan divisi, coba lagi nanti");
|
||||
} finally {
|
||||
setLoading(false);
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
useShallowEffect(() => {
|
||||
getOneData();
|
||||
getOneData(true);
|
||||
}, [param.id])
|
||||
|
||||
|
||||
@@ -77,19 +77,21 @@ export default function InformationDivision() {
|
||||
|
||||
async function deleteMember() {
|
||||
try {
|
||||
setLoadingDelete(true)
|
||||
const res = await funDeleteMemberDivision(param.id, { id: valChooseMember })
|
||||
if (res.success) {
|
||||
toast.success(res.message)
|
||||
setDrawer(false)
|
||||
getOneData()
|
||||
getOneData(false)
|
||||
} else {
|
||||
toast.error(res.message)
|
||||
}
|
||||
setOpenModal(false)
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
setOpenModal(false)
|
||||
toast.error("Gagal mendapatkan divisi, coba lagi nanti");
|
||||
} finally {
|
||||
setLoadingDelete(false)
|
||||
setOpenModal(false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +101,7 @@ export default function InformationDivision() {
|
||||
const res = await funEditStatusAdminDivision(param.id, { id: valChooseMember, isAdmin: valChooseMemberStatus })
|
||||
if (res.success) {
|
||||
toast.success(res.message)
|
||||
getOneData()
|
||||
getOneData(false)
|
||||
} else {
|
||||
toast.error(res.message)
|
||||
}
|
||||
@@ -116,7 +118,7 @@ export default function InformationDivision() {
|
||||
const res = await funUpdateStatusDivision(param.id, { isActive: valActive })
|
||||
if (res.success) {
|
||||
toast.success(res.message)
|
||||
getOneData()
|
||||
getOneData(false)
|
||||
} else {
|
||||
toast.error(res.message)
|
||||
}
|
||||
@@ -276,7 +278,7 @@ export default function InformationDivision() {
|
||||
</Box>
|
||||
</LayoutDrawer>
|
||||
|
||||
<LayoutModal opened={isOpenModal} onClose={() => setOpenModal(false)}
|
||||
<LayoutModal loading={loadingDelete} opened={isOpenModal} onClose={() => setOpenModal(false)}
|
||||
description="Apakah Anda yakin ingin mengeluarkan anggota?"
|
||||
onYes={(val) => {
|
||||
if (!val) {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
"use client"
|
||||
import { TEMA } from "@/module/_global";
|
||||
import { useHookstate } from "@hookstate/core";
|
||||
import { Box, Grid, Group, Skeleton, Stack, Text } from "@mantine/core";
|
||||
import { useMediaQuery, useShallowEffect } from "@mantine/hooks";
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
import { CiUser, CiClock2 } from "react-icons/ci";
|
||||
import { CiClock2, CiUser } from "react-icons/ci";
|
||||
import { GoDiscussionClosed } from "react-icons/go";
|
||||
import { funGetDetailDivisionById } from "../lib/api_division";
|
||||
import { IDataDiscussionOnDetailDivision } from "../lib/type_division";
|
||||
import { useHookstate } from "@hookstate/core";
|
||||
|
||||
|
||||
export default function ListDiscussionOnDetailDivision() {
|
||||
@@ -30,7 +30,6 @@ export default function ListDiscussionOnDetailDivision() {
|
||||
} else {
|
||||
toast.error(res.message);
|
||||
}
|
||||
setLoading(false);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
toast.error("Gagal mendapatkan divisi, coba lagi nanti");
|
||||
@@ -49,106 +48,108 @@ export default function ListDiscussionOnDetailDivision() {
|
||||
<Text c={tema.get().utama} mb={10} fw={"bold"} fz={16}>
|
||||
Diskusi Terbaru
|
||||
</Text>
|
||||
<Box
|
||||
bg={"white"}
|
||||
style={{
|
||||
borderRadius: 10,
|
||||
border: `1px solid ${"#D6D8F6"}`,
|
||||
padding: 10,
|
||||
}}
|
||||
>
|
||||
{
|
||||
!loading && data.length === 0 ?
|
||||
<Stack align="stretch" justify="center" w={"100%"}>
|
||||
<Text c="dimmed" ta={"center"} fs={"italic"}>Tidak ada diskusi</Text>
|
||||
</Stack>
|
||||
:
|
||||
<Box
|
||||
bg={"white"}
|
||||
style={{
|
||||
borderRadius: 10,
|
||||
border: `1px solid ${"#D6D8F6"}`,
|
||||
padding: 10,
|
||||
}}
|
||||
>
|
||||
|
||||
{
|
||||
loading ?
|
||||
Array(2)
|
||||
.fill(null)
|
||||
.map((_, i) => (
|
||||
<Stack align="stretch" justify="center" key={i} pb={10}>
|
||||
<Skeleton height={80} radius="md" m={0} />
|
||||
<Group justify="space-between">
|
||||
<Skeleton height={10} radius="md" m={0} w={100} />
|
||||
<Skeleton height={10} radius="md" m={0} w={100} />
|
||||
</Group>
|
||||
</Stack>
|
||||
))
|
||||
:
|
||||
(data.length === 0) ?
|
||||
<Stack align="stretch" justify="center" w={"100%"}>
|
||||
<Text c="dimmed" ta={"center"} fs={"italic"}>Belum ada diskusi</Text>
|
||||
</Stack>
|
||||
: <></>
|
||||
}
|
||||
{data.map((v, i) => {
|
||||
return (
|
||||
<Box key={i} p={10}>
|
||||
<Box style={{
|
||||
borderRadius: 10,
|
||||
border: `1px solid ${"#D6D8F6"}`,
|
||||
padding: 10,
|
||||
}}
|
||||
onClick={() => router.push(`${param.id}/discussion/${v.id}`)}
|
||||
>
|
||||
<Grid align='center'>
|
||||
<Grid.Col
|
||||
span={{
|
||||
base: 1,
|
||||
xs: 1,
|
||||
sm: 1,
|
||||
md: 1,
|
||||
lg: 1,
|
||||
xl: 1,
|
||||
}}
|
||||
{
|
||||
loading ?
|
||||
Array(2)
|
||||
.fill(null)
|
||||
.map((_, i) => (
|
||||
<Stack align="stretch" justify="center" key={i} pb={10}>
|
||||
<Skeleton height={80} radius="md" m={0} />
|
||||
<Group justify="space-between">
|
||||
<Skeleton height={10} radius="md" m={0} w={100} />
|
||||
<Skeleton height={10} radius="md" m={0} w={100} />
|
||||
</Group>
|
||||
</Stack>
|
||||
))
|
||||
: <></>
|
||||
}
|
||||
{data.map((v, i) => {
|
||||
return (
|
||||
<Box key={i} p={10}>
|
||||
<Box style={{
|
||||
borderRadius: 10,
|
||||
border: `1px solid ${"#D6D8F6"}`,
|
||||
padding: 10,
|
||||
}}
|
||||
onClick={() => router.push(`${param.id}/discussion/${v.id}`)}
|
||||
>
|
||||
<GoDiscussionClosed size={25} />
|
||||
</Grid.Col>
|
||||
<Grid.Col
|
||||
span={{
|
||||
base: 11,
|
||||
xs: 11,
|
||||
sm: 11,
|
||||
md: 11,
|
||||
lg: 11,
|
||||
xl: 11,
|
||||
}}
|
||||
>
|
||||
<Text fw={"bold"} truncate="end" pl={isMobile2 ? 10 : 0} fz={isMobile ? 14 : 16}>
|
||||
{v.desc}
|
||||
</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid align="center" mt={20}>
|
||||
<Grid.Col span={{
|
||||
base: 7,
|
||||
xl: 9
|
||||
}}>
|
||||
<Group gap={5} align="center">
|
||||
<CiUser size={18} />
|
||||
<Box w={{
|
||||
base: isMobile ? 110 : 125,
|
||||
xl: 300
|
||||
}}>
|
||||
<Text fz={13} lineClamp={1}>
|
||||
{v.user}
|
||||
<Grid align='center'>
|
||||
<Grid.Col
|
||||
span={{
|
||||
base: 1,
|
||||
xs: 1,
|
||||
sm: 1,
|
||||
md: 1,
|
||||
lg: 1,
|
||||
xl: 1,
|
||||
}}
|
||||
>
|
||||
<GoDiscussionClosed size={25} />
|
||||
</Grid.Col>
|
||||
<Grid.Col
|
||||
span={{
|
||||
base: 11,
|
||||
xs: 11,
|
||||
sm: 11,
|
||||
md: 11,
|
||||
lg: 11,
|
||||
xl: 11,
|
||||
}}
|
||||
>
|
||||
<Text fw={"bold"} truncate="end" pl={isMobile2 ? 10 : 0} fz={isMobile ? 14 : 16}>
|
||||
{v.desc}
|
||||
</Text>
|
||||
</Box>
|
||||
</Group>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={{
|
||||
base: 5,
|
||||
xl: 3
|
||||
}}>
|
||||
<Group gap={5} align="center" justify="flex-end">
|
||||
<CiClock2 size={18} />
|
||||
<Text fz={isMobile ? 11 : 13}>{v.date}</Text>
|
||||
</Group>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Box>
|
||||
</Box>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid align="center" mt={20}>
|
||||
<Grid.Col span={{
|
||||
base: 7,
|
||||
xl: 9
|
||||
}}>
|
||||
<Group gap={5} align="center">
|
||||
<CiUser size={18} />
|
||||
<Box w={{
|
||||
base: isMobile ? 110 : 125,
|
||||
xl: 300
|
||||
}}>
|
||||
<Text fz={13} lineClamp={1}>
|
||||
{v.user}
|
||||
</Text>
|
||||
</Box>
|
||||
</Group>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={{
|
||||
base: 5,
|
||||
xl: 3
|
||||
}}>
|
||||
<Group gap={5} align="center" justify="flex-end">
|
||||
<CiClock2 size={18} />
|
||||
<Text fz={isMobile ? 11 : 13}>{v.date}</Text>
|
||||
</Group>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
);
|
||||
})}
|
||||
</Box>
|
||||
);
|
||||
})}
|
||||
</Box>
|
||||
}
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
'use client'
|
||||
import { currentScroll, globalNotifPage, globalRole, LayoutDrawer, LayoutNavbarNew, ReloadButtonTop, SkeletonList, TEMA } from '@/module/_global';
|
||||
import { currentScroll, globalNotifPage, globalRole, ReloadButtonTop, SkeletonList, TEMA } from '@/module/_global';
|
||||
import { useHookstate } from '@hookstate/core';
|
||||
import { ActionIcon, Avatar, Box, Card, Center, Divider, Flex, Grid, Group, Skeleton, Text, TextInput, Title } from '@mantine/core';
|
||||
import { useMediaQuery, useShallowEffect } from '@mantine/hooks';
|
||||
@@ -7,12 +7,10 @@ import _ from 'lodash';
|
||||
import { useRouter, useSearchParams } from 'next/navigation';
|
||||
import { useEffect, useState } from 'react';
|
||||
import toast from 'react-hot-toast';
|
||||
import { HiMenu } from 'react-icons/hi';
|
||||
import { HiMagnifyingGlass, HiMiniUserGroup, HiOutlineListBullet, HiSquares2X2 } from 'react-icons/hi2';
|
||||
import { MdAccountCircle } from 'react-icons/md';
|
||||
import { funGetAllDivision } from '../lib/api_division';
|
||||
import { IDataDivison } from '../lib/type_division';
|
||||
import DrawerDivision from './drawer_division';
|
||||
|
||||
export default function ListDivision() {
|
||||
const [isList, setIsList] = useState(false)
|
||||
@@ -243,36 +241,42 @@ export default function ListDivision() {
|
||||
</Box>
|
||||
))
|
||||
:
|
||||
data?.map((v: any, i: any) => {
|
||||
return (
|
||||
<Box key={i} mb={20}>
|
||||
<Card shadow="sm" padding="md" component="a" radius={10} onClick={() => router.push(`/division/${v.id}`)}>
|
||||
<Card.Section>
|
||||
<Box h={120} bg={tema.get().utama}>
|
||||
<Flex justify={'center'} align={'center'} h={"100%"} pl={20} pr={20}>
|
||||
<Title order={3} c={"white"} ta={"center"} lineClamp={2}>{v.name}</Title>
|
||||
</Flex>
|
||||
_.isEmpty(data)
|
||||
?
|
||||
<Box style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '50vh' }}>
|
||||
<Text c="dimmed" ta={"center"} fs={"italic"}>Tidak ada Divisi</Text>
|
||||
</Box>
|
||||
:
|
||||
data?.map((v: any, i: any) => {
|
||||
return (
|
||||
<Box key={i} mb={20}>
|
||||
<Card shadow="sm" padding="md" component="a" radius={10} onClick={() => router.push(`/division/${v.id}`)}>
|
||||
<Card.Section>
|
||||
<Box h={120} bg={tema.get().utama}>
|
||||
<Flex justify={'center'} align={'center'} h={"100%"} pl={20} pr={20}>
|
||||
<Title order={3} c={"white"} ta={"center"} lineClamp={2}>{v.name}</Title>
|
||||
</Flex>
|
||||
</Box>
|
||||
</Card.Section>
|
||||
<Box pt={10}>
|
||||
<Text lineClamp={2}>{v.desc}</Text>
|
||||
<Group align='center' pt={10} justify='flex-end'>
|
||||
<Avatar.Group>
|
||||
<Avatar>
|
||||
<MdAccountCircle size={32} color={tema.get().utama} />
|
||||
</Avatar>
|
||||
<Avatar>
|
||||
{
|
||||
(v.jumlah_member == 0) ? "0" : "+" + (v.jumlah_member - 1)
|
||||
}
|
||||
</Avatar>
|
||||
</Avatar.Group>
|
||||
</Group>
|
||||
</Box>
|
||||
</Card.Section>
|
||||
<Box pt={10}>
|
||||
<Text lineClamp={2}>{v.desc}</Text>
|
||||
<Group align='center' pt={10} justify='flex-end'>
|
||||
<Avatar.Group>
|
||||
<Avatar>
|
||||
<MdAccountCircle size={32} color={tema.get().utama} />
|
||||
</Avatar>
|
||||
<Avatar>
|
||||
{
|
||||
(v.jumlah_member == 0) ? "0" : "+" + (v.jumlah_member - 1)
|
||||
}
|
||||
</Avatar>
|
||||
</Avatar.Group>
|
||||
</Group>
|
||||
</Box>
|
||||
</Card>
|
||||
</Box>
|
||||
);
|
||||
})
|
||||
</Card>
|
||||
</Box>
|
||||
);
|
||||
})
|
||||
}
|
||||
</Box>
|
||||
)}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
'use client'
|
||||
import { TEMA, } from "@/module/_global";
|
||||
import { useHookstate } from "@hookstate/core";
|
||||
import { Carousel } from "@mantine/carousel";
|
||||
import { Box, Image, Text, Center, Paper, Stack, UnstyledButton, Skeleton, Group } from "@mantine/core";
|
||||
import * as ICON from '../lib/file_icon'
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
import { Box, Center, Group, Image, Skeleton, Stack, Text, UnstyledButton } from "@mantine/core";
|
||||
import { useMediaQuery, useShallowEffect } from "@mantine/hooks";
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
import { funGetDetailDivisionById } from "../lib/api_division";
|
||||
import * as ICON from '../lib/file_icon';
|
||||
import { IDataKalenderOnDetailDivision } from "../lib/type_division";
|
||||
import { useState } from "react";
|
||||
import { useHookstate } from "@hookstate/core";
|
||||
|
||||
const iconContainer = (icon: string) => 'data:image/svg+xml;base64,' + btoa(icon)
|
||||
|
||||
@@ -29,7 +29,6 @@ export default function ListDocumentOnDetailDivision() {
|
||||
} else {
|
||||
toast.error(res.message);
|
||||
}
|
||||
setLoading(false);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
toast.error("Gagal mendapatkan divisi, coba lagi nanti");
|
||||
@@ -60,7 +59,7 @@ export default function ListDocumentOnDetailDivision() {
|
||||
))
|
||||
: (data.length === 0) ?
|
||||
<Stack align="stretch" justify="center" w={"100%"}>
|
||||
<Text c="dimmed" ta={"center"} fs={"italic"}>Belum ada file</Text>
|
||||
<Text c="dimmed" ta={"center"} fs={"italic"}>Tidak ada dokumen</Text>
|
||||
</Stack>
|
||||
: <></>
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
'use client'
|
||||
import { TEMA } from "@/module/_global";
|
||||
import { useHookstate } from "@hookstate/core";
|
||||
import { Carousel } from "@mantine/carousel";
|
||||
import { Avatar, Box, Group, Skeleton, Stack, Text } from "@mantine/core";
|
||||
import { Box, Group, Skeleton, Stack, Text } from "@mantine/core";
|
||||
import { useMediaQuery, useShallowEffect } from "@mantine/hooks";
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
import { CiClock2 } from "react-icons/ci";
|
||||
import { funGetDetailDivisionById } from "../lib/api_division";
|
||||
import { useState } from "react";
|
||||
import { IDataTaskOnDetailDivision } from "../lib/type_division";
|
||||
import _ from "lodash";
|
||||
import { useHookstate } from "@hookstate/core";
|
||||
|
||||
|
||||
export default function ListTaskOnDetailDivision() {
|
||||
@@ -29,7 +28,6 @@ export default function ListTaskOnDetailDivision() {
|
||||
} else {
|
||||
toast.error(res.message);
|
||||
}
|
||||
setLoading(false);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
toast.error("Gagal mendapatkan divisi, coba lagi nanti");
|
||||
@@ -61,7 +59,7 @@ export default function ListTaskOnDetailDivision() {
|
||||
:
|
||||
(data.length === 0) ?
|
||||
<Stack align="stretch" justify="center" w={"100%"}>
|
||||
<Text c="dimmed" ta={"center"} fs={"italic"}>Belum ada tugas hari ini</Text>
|
||||
<Text c="dimmed" ta={"center"} fs={"italic"}>Tidak ada tugas hari ini</Text>
|
||||
</Stack>
|
||||
: <></>
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
'use client'
|
||||
import { LayoutDrawer, LayoutNavbarNew, TEMA } from "@/module/_global";
|
||||
import { globalRole, LayoutDrawer, LayoutNavbarNew, TEMA } from "@/module/_global";
|
||||
import { useHookstate } from "@hookstate/core";
|
||||
import { ActionIcon } from "@mantine/core";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
@@ -15,12 +15,16 @@ export default function NavbarDetailDivision() {
|
||||
const param = useParams<{ id: string }>()
|
||||
const [name, setName] = useState('')
|
||||
const tema = useHookstate(TEMA)
|
||||
const roleLogin = useHookstate(globalRole)
|
||||
const [grup, setGroup] = useState('')
|
||||
|
||||
|
||||
async function getOneData() {
|
||||
try {
|
||||
const res = await funGetDivisionById(param.id);
|
||||
if (res.success) {
|
||||
setName(res.data.division.name);
|
||||
setGroup(res.data.division.idGroup)
|
||||
} else {
|
||||
toast.error(res.message);
|
||||
}
|
||||
@@ -37,7 +41,7 @@ export default function NavbarDetailDivision() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<LayoutNavbarNew back="" title={name} menu={
|
||||
<LayoutNavbarNew back={roleLogin.get() == 'supadmin' ? `/division?group=${grup}` : '/division'} title={name} menu={
|
||||
<ActionIcon variant="light" onClick={() => (setOpenDrawer(true))} bg={tema.get().bgIcon} size="lg" radius="lg" aria-label="Settings">
|
||||
<HiMenu size={20} color='white' />
|
||||
</ActionIcon>
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
"use client"
|
||||
import { LayoutNavbarNew, TEMA } from '@/module/_global';
|
||||
import { useHookstate } from '@hookstate/core';
|
||||
import { Box, Skeleton, Stack } from '@mantine/core';
|
||||
import { DateInput } from '@mantine/dates';
|
||||
import React, { useState } from 'react';
|
||||
import EchartPaiReport from './echart_pai_report';
|
||||
import EchartBarReport from './echart_bar_report';
|
||||
import EventReport from './event_report';
|
||||
import DiscussionReport from './discussion_report';
|
||||
import { useParams } from 'next/navigation';
|
||||
import { funGetReportDivision } from '../lib/api_division';
|
||||
import moment from 'moment';
|
||||
import "moment/locale/id";
|
||||
import { useParams } from 'next/navigation';
|
||||
import { useState } from 'react';
|
||||
import toast from 'react-hot-toast';
|
||||
import { useHookstate } from '@hookstate/core';
|
||||
import { funGetReportDivision } from '../lib/api_division';
|
||||
import EchartBarReport from './echart_bar_report';
|
||||
import EchartPaiReport from './echart_pai_report';
|
||||
import EventReport from './event_report';
|
||||
|
||||
|
||||
export default function ReportDivisionId() {
|
||||
@@ -64,6 +63,7 @@ export default function ReportDivisionId() {
|
||||
<Box p={20}>
|
||||
<Stack>
|
||||
<DateInput
|
||||
valueFormat='DD-MM-YYYY'
|
||||
value={value}
|
||||
onChange={(val) => { onChangeDate(val) }}
|
||||
radius={10}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
export type TypeUser = {
|
||||
id: string
|
||||
idUserRole: string
|
||||
name: string
|
||||
nik: string
|
||||
phone: string
|
||||
email: string
|
||||
gender: string
|
||||
img:string
|
||||
img: string
|
||||
isActive: boolean,
|
||||
group: string,
|
||||
position: string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IEditDataMember, IFormMember, IStatusmember } from "./type_member";
|
||||
import { IStatusmember } from "./type_member";
|
||||
|
||||
export const funGetAllmember = async (path?: string) => {
|
||||
const response = await fetch(`/api/user${(path) ? path : ''}`, { next: { tags: ['member'] } });
|
||||
|
||||
Reference in New Issue
Block a user