From 75218f5dc314db1de0e39de5bb8f9bc154d16b32 Mon Sep 17 00:00:00 2001 From: lukman Date: Wed, 25 Sep 2024 12:17:27 +0800 Subject: [PATCH] style : update revisi style --- .../ui/create_anggota_division.tsx | 38 ++- .../division_new/ui/create_division.tsx | 4 +- .../ui/drawer_detail_division.tsx | 2 +- src/module/division_new/ui/event_report.tsx | 2 +- .../division_new/ui/information_division.tsx | 38 +-- src/module/division_new/ui/list_division.tsx | 28 +- .../division_new/ui/navbar_admin_division.tsx | 8 +- .../division_new/ui/navbar_create_users.tsx | 245 ++++++++++-------- .../project/ui/add_member_detail_project.tsx | 99 +++---- src/module/project/ui/edit_task_project.tsx | 8 +- .../ui/list_anggota_detail_project.tsx | 25 +- .../project/ui/list_file_detail_project.tsx | 43 ++- .../project/ui/list_tugas_detail_project.tsx | 27 +- .../project/ui/navbar_detail_project.tsx | 46 ++-- .../project/ui/progress_detail_project.tsx | 114 +++++--- 15 files changed, 441 insertions(+), 286 deletions(-) diff --git a/src/module/division_new/ui/create_anggota_division.tsx b/src/module/division_new/ui/create_anggota_division.tsx index 64910df..03ec094 100644 --- a/src/module/division_new/ui/create_anggota_division.tsx +++ b/src/module/division_new/ui/create_anggota_division.tsx @@ -1,5 +1,5 @@ "use client" -import { LayoutNavbarNew, SkeletonSingle, TEMA } from '@/module/_global'; +import { LayoutNavbarNew, SkeletonList, SkeletonSingle, TEMA } from '@/module/_global'; import LayoutModal from '@/module/_global/layout/layout_modal'; import { funGetUserByCookies } from '@/module/auth'; import { funGetAllmember, TypeUser } from '@/module/user'; @@ -9,7 +9,7 @@ import React, { useState } from 'react'; import toast from 'react-hot-toast'; import { FaCheck } from 'react-icons/fa6'; import { HiMagnifyingGlass } from 'react-icons/hi2'; -import { useShallowEffect } from '@mantine/hooks'; +import { useMediaQuery, useShallowEffect } from '@mantine/hooks'; import { IDataMemberDivision } from '../lib/type_division'; import { funAddDivisionMember, funGetDivisionById } from '../lib/api_division'; import { IoArrowBackOutline, IoClose } from 'react-icons/io5'; @@ -28,6 +28,7 @@ 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 handleFileClick = (index: number) => { if (selectedFiles.some((i: any) => i.idUser == dataMember[index].id)) { @@ -185,10 +186,15 @@ export default function CreateAnggotaDivision() { .fill(null) .map((_, i) => ( - + )) : + (dataMember.length === 0) ? + + Tidak ada anggota + + : {dataMember.map((v: any, index: any) => { const isSelected = selectedFiles.some((i: any) => i.idUser == dataMember[index].id) @@ -196,14 +202,32 @@ export default function CreateAnggotaDivision() { return ( (!found) ? handleFileClick(index) : null}> - + - + - {v.name} - {(found) ? "sudah menjadi anggota divisi" : ""} + {v.name} + {(found) ? "sudah menjadi anggota divisi" : ""} {isSelected ? : null} diff --git a/src/module/division_new/ui/create_division.tsx b/src/module/division_new/ui/create_division.tsx index c9f5de5..6618c5a 100644 --- a/src/module/division_new/ui/create_division.tsx +++ b/src/module/division_new/ui/create_division.tsx @@ -125,7 +125,7 @@ export default function CreateDivision() { label="Grup" size="md" required - radius={40} + radius={10} data={dataGroup?.map((pro: any) => ({ value: String(pro.id), label: pro.name @@ -148,7 +148,7 @@ export default function CreateDivision() { label="Nama Divisi" size="md" required - radius={40} + radius={10} value={body.name} onChange={(val) => { setBody({ ...body, name: val.target.value }) }} onBlur={() => setTouched({ ...touched, name: true })} diff --git a/src/module/division_new/ui/drawer_detail_division.tsx b/src/module/division_new/ui/drawer_detail_division.tsx index bc79051..8cb498d 100644 --- a/src/module/division_new/ui/drawer_detail_division.tsx +++ b/src/module/division_new/ui/drawer_detail_division.tsx @@ -33,7 +33,7 @@ export default function DrawerDetailDivision() { - Report Divisi + Laporan Divisi diff --git a/src/module/division_new/ui/event_report.tsx b/src/module/division_new/ui/event_report.tsx index 232791d..85fafb1 100644 --- a/src/module/division_new/ui/event_report.tsx +++ b/src/module/division_new/ui/event_report.tsx @@ -9,7 +9,7 @@ export default function EventReport({ data, tgl }: { data: IDataReportDivision[] return ( - EVENT
{tgl}
+ ACARA
{tgl}
{ _.isEmpty(data) ? diff --git a/src/module/division_new/ui/information_division.tsx b/src/module/division_new/ui/information_division.tsx index 88c49e6..ef72ac8 100644 --- a/src/module/division_new/ui/information_division.tsx +++ b/src/module/division_new/ui/information_division.tsx @@ -1,5 +1,5 @@ "use client" -import { globalRole, LayoutDrawer, LayoutNavbarNew, SkeletonSingle, TEMA } from '@/module/_global'; +import { globalRole, LayoutDrawer, LayoutNavbarNew, SkeletonList, SkeletonSingle, TEMA } from '@/module/_global'; import { ActionIcon, Avatar, Box, Button, Divider, Flex, Grid, Group, Skeleton, Stack, Text } from '@mantine/core'; import { useMediaQuery, useShallowEffect } from '@mantine/hooks'; import { useParams, useRouter } from 'next/navigation'; @@ -150,30 +150,16 @@ export default function InformationDivision() {
{loading ? - - - - - - - - - - + + + + + + + + + + : ((roleLogin.get() != 'user' && roleLogin.get() != 'coadmin') || isAdmin) ? @@ -193,7 +179,7 @@ export default function InformationDivision() { .fill(null) .map((_, i) => ( - + )) : member.map((v, i) => { diff --git a/src/module/division_new/ui/list_division.tsx b/src/module/division_new/ui/list_division.tsx index 8f7792c..0a0a257 100644 --- a/src/module/division_new/ui/list_division.tsx +++ b/src/module/division_new/ui/list_division.tsx @@ -1,5 +1,5 @@ 'use client' -import { currentScroll, globalRole, LayoutDrawer, LayoutNavbarNew, SkeletonSingle, TEMA } from '@/module/_global'; +import { currentScroll, globalRole, LayoutDrawer, LayoutNavbarNew, SkeletonList, SkeletonSingle, TEMA } from '@/module/_global'; import { ActionIcon, Avatar, Box, Card, Center, Divider, Flex, Grid, Group, Skeleton, Text, TextInput, Title } from '@mantine/core'; import { useRouter, useSearchParams } from 'next/navigation'; import React, { useEffect, useState } from 'react'; @@ -12,6 +12,7 @@ import { IDataDivison } from '../lib/type_division'; import { funGetAllDivision } from '../lib/api_division'; import toast from 'react-hot-toast'; import { useHookstate } from '@hookstate/core'; +import _ from 'lodash'; export default function ListDivision() { const [isList, setIsList] = useState(false) @@ -138,18 +139,12 @@ export default function ListDivision() { {roleLogin.get() == 'supadmin' && Filter by: {nameGroup}} - {loading ? - <> - - - : - - Total Divisi + + Total Divisi - {jumlah} + {jumlah} - } {isList ? ( @@ -158,10 +153,16 @@ export default function ListDivision() { .fill(null) .map((_, i) => ( - + )) : + _.isEmpty(data) + ? + + Tidak ada Divisi + + : data?.map((v: any, i: any) => { return ( @@ -181,11 +182,6 @@ export default function ListDivision() { size={50} aria-label="Gradient action icon" radius={100} - // gradient={{ - // from: '#DFDA7C', - // to: '#F2AF46', - // deg: 174 - // }} bg={tema.get().bgFiturHome} > diff --git a/src/module/division_new/ui/navbar_admin_division.tsx b/src/module/division_new/ui/navbar_admin_division.tsx index e350715..8ef22ec 100644 --- a/src/module/division_new/ui/navbar_admin_division.tsx +++ b/src/module/division_new/ui/navbar_admin_division.tsx @@ -48,7 +48,7 @@ export default function NavbarAdminDivision({ data, onSuccess }: { data: any, on } /> - } placeholder="Pencarian" - /> - + /> */} + { (member.length === 0) ? ( @@ -91,7 +91,7 @@ export default function NavbarAdminDivision({ data, onSuccess }: { data: any, on - + ); diff --git a/src/module/division_new/ui/navbar_create_users.tsx b/src/module/division_new/ui/navbar_create_users.tsx index 6727c42..d5fa916 100644 --- a/src/module/division_new/ui/navbar_create_users.tsx +++ b/src/module/division_new/ui/navbar_create_users.tsx @@ -1,8 +1,8 @@ "use client" -import { LayoutNavbarNew, SkeletonSingle, TEMA } from '@/module/_global'; +import { LayoutNavbarNew, SkeletonList, SkeletonSingle, TEMA } from '@/module/_global'; import { useHookstate } from '@hookstate/core'; import { ActionIcon, Avatar, Box, Button, Center, Divider, Flex, Grid, Indicator, Input, rem, SimpleGrid, Skeleton, Stack, Text, TextInput } from '@mantine/core'; -import { useShallowEffect } from '@mantine/hooks'; +import { useMediaQuery, useShallowEffect } from '@mantine/hooks'; import { useRouter } from 'next/navigation'; import React, { useState } from 'react'; import { HiChevronLeft, HiMagnifyingGlass } from 'react-icons/hi2'; @@ -23,6 +23,7 @@ export default function NavbarCreateUsers({ grup, onClose }: { grup?: string, on const [loading, setLoading] = useState(true) const [onClickSearch, setOnClickSearch] = useState(false) const tema = useHookstate(TEMA) + const isMobile2 = useMediaQuery("(max-width: 438px)"); const handleFileClick = (index: number) => { if (selectedFiles.some((i: any) => i.idUser == dataMember[index].id)) { @@ -88,123 +89,141 @@ export default function NavbarCreateUsers({ grup, onClose }: { grup?: string, on menu={ } /> - {/* SEARCH */} - {onClickSearch - ? ( - - - - - - - - - loadData(e.target.value)} - /> - - - - ) - : null - } - {/* Close User */} - - {selectedFiles.length > 0 ? ( - - {selectedFiles.map((v: any, i: any) => { - return ( - - { handleXMember(v.idUser) }} - > -
- }> - - -
- {v.name} -
-
- ) - })} -
- ) : ( - - - Tidak ada anggota yang dipilih - - - )} -
+ {/* SEARCH */} + {onClickSearch + ? ( + + + + + + + + + loadData(e.target.value)} + /> + + + + ) + : null + } + {/* Close User */} + + {selectedFiles.length > 0 ? ( + + {selectedFiles.map((v: any, i: any) => { + return ( + + { handleXMember(v.idUser) }} + > +
+ }> + + +
+ {v.name} +
+
+ ) + })} +
+ ) : ( + + + Tidak ada anggota yang dipilih + + + )} +
{loading ? Array(6) - .fill(null) - .map((_, i) => ( - - - - )) - : dataMember.map((v, index) => { - const isSelected = selectedFiles.some((i: any) => i.idUser == dataMember[index].id); - return ( - handleFileClick(index)}> - - - - - - - - {v.name} - - {isSelected ? : null} - - - - - - + .fill(null) + .map((_, i) => ( + + - ); - }) + )) + : + (dataMember.length === 0) ? + + Tidak ada anggota + + : + dataMember.map((v, index) => { + const isSelected = selectedFiles.some((i: any) => i.idUser == dataMember[index].id); + return ( + handleFileClick(index)}> + + + + + + + + {v.name} + + {isSelected ? : null} + + + + + + + + ); + }) } diff --git a/src/module/project/ui/add_member_detail_project.tsx b/src/module/project/ui/add_member_detail_project.tsx index 16b1f83..198b6b2 100644 --- a/src/module/project/ui/add_member_detail_project.tsx +++ b/src/module/project/ui/add_member_detail_project.tsx @@ -6,7 +6,7 @@ import toast from 'react-hot-toast'; import { funAddMemberProject, funGetAllMemberById, funGetOneProjectById } from '../lib/api_project'; import { useMediaQuery, useShallowEffect } from '@mantine/hooks'; import { ActionIcon, Avatar, Box, Button, Center, Divider, Flex, Grid, Group, Indicator, rem, Skeleton, Stack, Text, TextInput } from '@mantine/core'; -import { LayoutNavbarNew, SkeletonSingle, TEMA, WARNA } from '@/module/_global'; +import { LayoutNavbarNew, SkeletonList, SkeletonSingle, TEMA, WARNA } from '@/module/_global'; import { FaCheck } from 'react-icons/fa6'; import LayoutModal from '@/module/_global/layout/layout_modal'; import { HiMagnifyingGlass } from 'react-icons/hi2'; @@ -32,7 +32,7 @@ export default function AddMemberDetailProject() { async function getData() { try { setLoading(true) - const response = await funGetAllMemberById('?search=' + searchQuery, param.id ) + const response = await funGetAllMemberById('?search=' + searchQuery, param.id) if (response.success) { setData(response.data.member) } else { @@ -57,7 +57,7 @@ export default function AddMemberDetailProject() { if (selectedFiles.some((i: any) => i.idUser == isData[index].idUser)) { setSelectedFiles(selectedFiles.filter((i: any) => i.idUser != isData[index].idUser)) } else { - setSelectedFiles([...selectedFiles, { idUser: isData[index].idUser, name: isData[index].name, img: isData[index].img }]) + setSelectedFiles([...selectedFiles, { idUser: isData[index].idUser, name: isData[index].name, img: isData[index].img }]) } }; @@ -221,55 +221,60 @@ export default function AddMemberDetailProject() { .fill(null) .map((_, i) => ( - + )) : - - {isData.map((v, i) => { - const isSelected = selectedFiles.some((i: any) => i?.idUser == v.idUser); - const found = isDataMember.some((i: any) => i.idUser == v.idUser) - return ( - (!found) ? handleFileClick(i) : null}> - - - - - - - - {v.name} - {(found) ? "sudah menjadi anggota" : ""} + (isData.length === 0) ? + + Tidak ada anggota + + : + + {isData.map((v, i) => { + const isSelected = selectedFiles.some((i: any) => i?.idUser == v.idUser); + const found = isDataMember.some((i: any) => i.idUser == v.idUser) + return ( + (!found) ? handleFileClick(i) : null}> + + + + + + + + {v.name} + {(found) ? "sudah menjadi anggota" : ""} + + {isSelected ? : null} - {isSelected ? : null} - - - - - + + + + + - - ); - })} - + ); + })} + }
setTouched({ ...touched, name: true })} @@ -121,7 +121,7 @@ export default function EditTaskProject() { setOpenModal(false)} - description="Apakah Anda yakin ingin mengedit tugas ini?" + description="Apakah Anda yakin ingin mengedit Kegiatan ini?" onYes={(val) => { if (val) { onSubmit() diff --git a/src/module/project/ui/list_anggota_detail_project.tsx b/src/module/project/ui/list_anggota_detail_project.tsx index e0e6281..80a8e01 100644 --- a/src/module/project/ui/list_anggota_detail_project.tsx +++ b/src/module/project/ui/list_anggota_detail_project.tsx @@ -23,6 +23,27 @@ export default function ListAnggotaDetailProject() { const router = useRouter() const roleLogin = useHookstate(globalRole) const tema = useHookstate(TEMA) + const [reason, setReason] = useState("") + + async function getOneDataCancel() { + try { + const res = await funGetOneProjectById(param.id, 'data'); + console.log(res.data) + if (res.success) { + setReason(res.data.reason); + } else { + toast.error(res.message); + } + + } catch (error) { + console.error(error); + toast.error("Gagal mendapatkan data Kegiatan, coba lagi nanti"); + } + } + + useShallowEffect(() => { + getOneDataCancel(); + }, [param.id]) async function getOneData() { try { @@ -98,7 +119,9 @@ const isMobile = useMediaQuery('(max-width: 369px)'); { setDataChoose({ id: v.idUser, name: v.name }) - setOpenDrawer(true) + reason == null ? + setOpenDrawer(true) + : setOpenDrawer(false) }} > diff --git a/src/module/project/ui/list_file_detail_project.tsx b/src/module/project/ui/list_file_detail_project.tsx index 380dad1..d0628bc 100644 --- a/src/module/project/ui/list_file_detail_project.tsx +++ b/src/module/project/ui/list_file_detail_project.tsx @@ -25,6 +25,27 @@ export default function ListFileDetailProject() { const [isExtension, setExtension] = useState('') const tema = useHookstate(TEMA) const isMobile = useMediaQuery("(max-width: 350px)"); + const [reason, setReason] = useState("") + + async function getOneDataCancel() { + try { + const res = await funGetOneProjectById(param.id, 'data'); + console.log(res.data) + if (res.success) { + setReason(res.data.reason); + } else { + toast.error(res.message); + } + + } catch (error) { + console.error(error); + toast.error("Gagal mendapatkan data Kegiatan, coba lagi nanti"); + } + } + + useShallowEffect(() => { + getOneDataCancel(); + }, [param.id]) async function getOneData() { try { @@ -120,12 +141,12 @@ export default function ListFileDetailProject() { lg: 1, xl: 1, }}> - {item.extension == "pdf" && } - {item.extension == "csv" && } - {item.extension == "png" && } - {item.extension == "jpg" && } - {item.extension == "jpeg" && } - {item.extension == "heic" && } + {item.extension == "pdf" && } + {item.extension == "csv" && } + {item.extension == "png" && } + {item.extension == "jpg" && } + {item.extension == "jpeg" && } + {item.extension == "heic" && } - { setOpenModal(true) }} justify={'center'} align={'center'} direction={'column'} > + { + reason == null ? + setOpenModal(true) + : setOpenModal(false) + }} justify={'center'} align={'center'} direction={'column'} > - + - Hapus file + Hapus file diff --git a/src/module/project/ui/list_tugas_detail_project.tsx b/src/module/project/ui/list_tugas_detail_project.tsx index a335b12..6cf303a 100644 --- a/src/module/project/ui/list_tugas_detail_project.tsx +++ b/src/module/project/ui/list_tugas_detail_project.tsx @@ -25,6 +25,27 @@ export default function ListTugasDetailProject() { const [isOpenModal, setOpenModal] = useState(false) const router = useRouter() const tema = useHookstate(TEMA) + const [reason, setReason] = useState("") + + async function getOneDataCancel() { + try { + const res = await funGetOneProjectById(param.id, 'data'); + console.log(res.data) + if (res.success) { + setReason(res.data.reason); + } else { + toast.error(res.message); + } + + } catch (error) { + console.error(error); + toast.error("Gagal mendapatkan data Kegiatan, coba lagi nanti"); + } + } + + useShallowEffect(() => { + getOneDataCancel(); + }, [param.id]) async function getOneData() { try { @@ -111,10 +132,12 @@ export default function ListTugasDetailProject() { isData.map((item, index) => { return ( - { + { setIdData(item.id) setStatusData(item.status) - setOpenDrawer(true) + reason == null ? + setOpenDrawer(true) + : setOpenDrawer(false) }} my={18}> { - router.push(param.id + '/add-task') + reason == null ? + router.push(param.id + '/add-task') + : null }} pb={20} > - + - Tambah Tugas + Tambah Tugas @@ -86,14 +90,16 @@ export default function NavbarDetailProject() { cursor: 'pointer' }} onClick={() => { - router.push(param.id + '/add-file') + reason == null ? + router.push(param.id + '/add-file') + : null }} > - + - Tambah file + Tambah file @@ -105,14 +111,16 @@ export default function NavbarDetailProject() { cursor: 'pointer' }} onClick={() => { - router.push(param.id + '/add-member') + reason == null ? + router.push(param.id + '/add-member') + : null }} > - + - Tambah anggota + Tambah anggota @@ -120,13 +128,17 @@ export default function NavbarDetailProject() { style={{ cursor: 'pointer' }} - onClick={() => { router.push(param.id + '/edit') }} + onClick={() => { + reason == null ? + router.push(param.id + '/edit') + : null + }} > - + - Edit + Edit @@ -134,13 +146,17 @@ export default function NavbarDetailProject() { style={{ cursor: 'pointer' }} - onClick={() => { router.push(param.id + '/cancel') }} + onClick={() => { + reason == null ? + router.push(param.id + '/cancel') + : null + }} > - + - Batal + Batal diff --git a/src/module/project/ui/progress_detail_project.tsx b/src/module/project/ui/progress_detail_project.tsx index 77f34f6..aea3707 100644 --- a/src/module/project/ui/progress_detail_project.tsx +++ b/src/module/project/ui/progress_detail_project.tsx @@ -1,6 +1,6 @@ 'use client' import { useHookstate } from '@hookstate/core'; -import { ActionIcon, Box, Grid, Progress, Skeleton, Text } from '@mantine/core'; +import { ActionIcon, Box, Grid, Group, Progress, Skeleton, Text } from '@mantine/core'; import { useParams } from 'next/navigation'; import React, { useState } from 'react'; import { HiMiniPresentationChartBar } from 'react-icons/hi2'; @@ -9,6 +9,7 @@ import toast from 'react-hot-toast'; import { funGetOneProjectById } from '../lib/api_project'; import { useShallowEffect } from '@mantine/hooks'; import { TEMA } from '@/module/_global'; +import { IoIosWarning } from 'react-icons/io'; export default function ProgressDetailProject() { const [valProgress, setValProgress] = useState(0) @@ -17,7 +18,8 @@ export default function ProgressDetailProject() { const refresh = useHookstate(globalRefreshProject) const [loading, setLoading] = useState(true) const tema = useHookstate(TEMA) - + const [reason, setReason] = useState("") + async function getOneData() { try { setLoading(true) @@ -37,6 +39,26 @@ export default function ProgressDetailProject() { } } + async function getOneDataCancel() { + try { + const res = await funGetOneProjectById(param.id, 'data'); + console.log(res.data) + if (res.success) { + setReason(res.data.reason); + } else { + toast.error(res.message); + } + + } catch (error) { + console.error(error); + toast.error("Gagal mendapatkan data Kegiatan, coba lagi nanti"); + } + } + + useShallowEffect(() => { + getOneDataCancel(); + }, [param.id]) + function onRefresh() { if (refresh.get()) { getOneData() @@ -55,46 +77,62 @@ export default function ProgressDetailProject() { return ( <> - {loading ? + {reason !== null ? + ( + + + + + Kegiatan dibatalkan + + {reason} + + + ) + : null + } + {loading ? : - - - - + + + - - - - - - Kemajuan Kegiatan {valProgress}% - - - - - + > + + + + + + Kemajuan Kegiatan {valProgress}% + + + + + }