Fix UI Admin Menu Landing Page & PPID
This commit is contained in:
@@ -1,58 +1,104 @@
|
||||
'use client'
|
||||
import colors from '@/con/colors';
|
||||
import { Box, Paper, Skeleton, Stack, Table, TableTbody, TableTd, TableTh, TableThead, TableTr, Title } from '@mantine/core';
|
||||
import { useProxy } from 'valtio/utils';
|
||||
import { useShallowEffect } from '@mantine/hooks';
|
||||
import statepermohonanInformasiPublikForm from '../../_state/ppid/permohonan_informasi_publik/permohonanInformasiPublik';
|
||||
import { useProxy } from 'valtio/utils'
|
||||
import { useShallowEffect } from '@mantine/hooks'
|
||||
import { Box, Paper, Skeleton, Stack, Table, TableTbody, TableTd, TableTh, TableThead, TableTr, Title, Text, Group, Tooltip, Badge } from '@mantine/core'
|
||||
import { IconInfoCircle, IconUser, IconMail, IconPhone, IconId } from '@tabler/icons-react'
|
||||
import statepermohonanInformasiPublikForm from '../../_state/ppid/permohonan_informasi_publik/permohonanInformasiPublik'
|
||||
import colors from '@/con/colors'
|
||||
|
||||
function Page() {
|
||||
const permohonanInformasiPublikState = useProxy(statepermohonanInformasiPublikForm)
|
||||
|
||||
useShallowEffect(() => {
|
||||
permohonanInformasiPublikState.statepermohonanInformasiPublik.findMany.load()
|
||||
}, [])
|
||||
if (!permohonanInformasiPublikState.statepermohonanInformasiPublik.findMany.data)
|
||||
return <Stack pos={"relative"} bg={colors.Bg}>
|
||||
<Skeleton radius={5} h={200} />
|
||||
</Stack>
|
||||
|
||||
if (!permohonanInformasiPublikState.statepermohonanInformasiPublik.findMany.data) {
|
||||
return (
|
||||
<Stack pos="relative" bg={colors.Bg} p="lg" align="center">
|
||||
<Skeleton radius="md" h={40} w="60%" />
|
||||
<Skeleton radius="md" h={200} w="100%" />
|
||||
</Stack>
|
||||
)
|
||||
}
|
||||
|
||||
const data = permohonanInformasiPublikState.statepermohonanInformasiPublik.findMany.data
|
||||
|
||||
return (
|
||||
<Box py={5}>
|
||||
<Paper bg={colors['white-1']} p={'md'}>
|
||||
<Stack gap={"xs"}>
|
||||
<Title order={3}>Permohonan Informasi Publik</Title>
|
||||
<Box>
|
||||
<Table striped withRowBorders withColumnBorders withTableBorder>
|
||||
<TableThead>
|
||||
<TableTr>
|
||||
<TableTh>No</TableTh>
|
||||
<TableTh>Nama</TableTh>
|
||||
<TableTh>NIK</TableTh>
|
||||
<TableTh>Telepon</TableTh>
|
||||
<TableTh>Email</TableTh>
|
||||
<TableTh>Jenis Informasi</TableTh>
|
||||
<TableTh>Cara Memperoleh Informasi</TableTh>
|
||||
<TableTh>Cara Memperoleh Salinan Informasi</TableTh>
|
||||
</TableTr>
|
||||
</TableThead>
|
||||
<TableTbody>
|
||||
{permohonanInformasiPublikState.statepermohonanInformasiPublik.findMany.data?.map((item, index) => (
|
||||
<TableTr key={item.id}>
|
||||
<TableTd>{index + 1}</TableTd>
|
||||
<TableTd>{item.name}</TableTd>
|
||||
<TableTd>{item.nik}</TableTd>
|
||||
<TableTd>{item.notelp}</TableTd>
|
||||
<TableTd>{item.email}</TableTd>
|
||||
<TableTd>{item.jenisInformasiDiminta?.name}</TableTd>
|
||||
<TableTd>{item.caraMemperolehInformasi?.name}</TableTd>
|
||||
<TableTd>{item.caraMemperolehSalinanInformasi?.name}</TableTd>
|
||||
<Box py="md">
|
||||
<Paper bg={colors['white-1']} p="lg" radius="xl" shadow="sm" withBorder>
|
||||
<Stack gap="md">
|
||||
<Group justify="space-between">
|
||||
<Title order={2} c="dark">Daftar Permohonan Informasi Publik</Title>
|
||||
<Tooltip label="Data permohonan informasi sesuai dengan pengajuan masyarakat" position="bottom">
|
||||
<IconInfoCircle size={20} stroke={1.5} />
|
||||
</Tooltip>
|
||||
</Group>
|
||||
|
||||
{data.length === 0 ? (
|
||||
<Stack align="center" py="xl">
|
||||
<IconInfoCircle size={40} stroke={1.5} color={colors['blue-button']} />
|
||||
<Text fw={500} c="dimmed">Belum ada permohonan informasi yang tercatat</Text>
|
||||
</Stack>
|
||||
) : (
|
||||
<Box style={{ overflowX: 'auto' }}>
|
||||
<Table
|
||||
highlightOnHover
|
||||
withRowBorders
|
||||
withColumnBorders
|
||||
withTableBorder
|
||||
striped
|
||||
stickyHeader
|
||||
>
|
||||
<TableThead>
|
||||
<TableTr>
|
||||
<TableTh>No</TableTh>
|
||||
<TableTh><Group gap={5}><IconUser size={16} /> Nama</Group></TableTh>
|
||||
<TableTh><Group gap={5}><IconId size={16} /> NIK</Group></TableTh>
|
||||
<TableTh><Group gap={5}><IconPhone size={16} /> Telepon</Group></TableTh>
|
||||
<TableTh><Group gap={5}><IconMail size={16} /> Email</Group></TableTh>
|
||||
<TableTh>Jenis Informasi</TableTh>
|
||||
<TableTh>Cara Akses Informasi</TableTh>
|
||||
<TableTh>Salinan Informasi</TableTh>
|
||||
</TableTr>
|
||||
))}
|
||||
</TableTbody>
|
||||
</Table> </Box>
|
||||
</TableThead>
|
||||
<TableTbody>
|
||||
{data.map((item, index) => (
|
||||
<TableTr key={item.id}>
|
||||
<TableTd>{index + 1}</TableTd>
|
||||
<TableTd>
|
||||
<Tooltip label={item.name}>
|
||||
<Text lineClamp={1} fw={500}>{item.name}</Text>
|
||||
</Tooltip>
|
||||
</TableTd>
|
||||
<TableTd>{item.nik}</TableTd>
|
||||
<TableTd>{item.notelp}</TableTd>
|
||||
<TableTd>{item.email}</TableTd>
|
||||
<TableTd>
|
||||
<Badge variant="light" radius="sm" color="blue">
|
||||
{item.jenisInformasiDiminta?.name || '-'}
|
||||
</Badge>
|
||||
</TableTd>
|
||||
<TableTd>
|
||||
<Tooltip label={item.caraMemperolehInformasi?.name}>
|
||||
<Text lineClamp={1} size="sm">{item.caraMemperolehInformasi?.name || '-'}</Text>
|
||||
</Tooltip>
|
||||
</TableTd>
|
||||
<TableTd>
|
||||
<Tooltip label={item.caraMemperolehSalinanInformasi?.name}>
|
||||
<Text lineClamp={1} size="sm">{item.caraMemperolehSalinanInformasi?.name || '-'}</Text>
|
||||
</Tooltip>
|
||||
</TableTd>
|
||||
</TableTr>
|
||||
))}
|
||||
</TableTbody>
|
||||
</Table>
|
||||
</Box>
|
||||
)}
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Box>
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
export default Page;
|
||||
export default Page
|
||||
|
||||
Reference in New Issue
Block a user