Compare commits
3 Commits
nico/23-de
...
nico/5-jan
| Author | SHA1 | Date | |
|---|---|---|---|
| daaed8089b | |||
| f436aa2ef0 | |||
| 50bc54ceca |
@@ -68,7 +68,7 @@ const category = proxy({
|
|||||||
const res = await ApiFetch.api.desa.kategoripengumuman[
|
const res = await ApiFetch.api.desa.kategoripengumuman[
|
||||||
"findMany"
|
"findMany"
|
||||||
].get({
|
].get({
|
||||||
query: { page, limit },
|
query: { page, limit, search },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res.status === 200 && res.data?.success) {
|
if (res.status === 200 && res.data?.success) {
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ const potensiDesa = proxy({
|
|||||||
const res = await ApiFetch.api.desa.potensi[
|
const res = await ApiFetch.api.desa.potensi[
|
||||||
"find-many"
|
"find-many"
|
||||||
].get({
|
].get({
|
||||||
query: { page, limit },
|
query: { page, limit, search },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res.status === 200 && res.data?.success) {
|
if (res.status === 200 && res.data?.success) {
|
||||||
|
|||||||
@@ -312,15 +312,15 @@ const kategoriProduk = proxy({
|
|||||||
page: 1,
|
page: 1,
|
||||||
totalPages: 1,
|
totalPages: 1,
|
||||||
loading: false,
|
loading: false,
|
||||||
search2: "",
|
search: "",
|
||||||
load: async (page = 1, limit = 10, search2 = "") => {
|
load: async (page = 1, limit = 10, search = "") => {
|
||||||
kategoriProduk.findMany.loading = true; // ✅ Akses langsung via nama path
|
kategoriProduk.findMany.loading = true; // ✅ Akses langsung via nama path
|
||||||
kategoriProduk.findMany.page = page;
|
kategoriProduk.findMany.page = page;
|
||||||
kategoriProduk.findMany.search2 = search2;
|
kategoriProduk.findMany.search = search;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const query: any = { page, limit };
|
const query: any = { page, limit };
|
||||||
if (search2) query.search2 = search2;
|
if (search) query.search = search;
|
||||||
|
|
||||||
const res = await ApiFetch.api.ekonomi.kategoriproduk["find-many"].get({ query });
|
const res = await ApiFetch.api.ekonomi.kategoriproduk["find-many"].get({ query });
|
||||||
|
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ const posisiOrganisasi = proxy({
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
const res = await ApiFetch.api.ekonomi['struktur-organisasi']['posisi-organisasi']['create'].post(this.form);
|
const res = await ApiFetch.api.ekonomi["struktur-organisasi"]["posisi-organisasi"]["create"].post(this.form);
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
toast.success("Berhasil menambahkan posisi organisasi");
|
toast.success("Berhasil menambahkan posisi organisasi");
|
||||||
posisiOrganisasi.findMany.load();
|
posisiOrganisasi.findMany.load();
|
||||||
|
|||||||
@@ -60,13 +60,18 @@ const responden = proxy({
|
|||||||
totalPages: 1,
|
totalPages: 1,
|
||||||
total: 0,
|
total: 0,
|
||||||
loading: false,
|
loading: false,
|
||||||
load: async (page = 1, limit = 10) => {
|
search: "",
|
||||||
|
load: async (page = 1, limit = 10, search = "") => {
|
||||||
// Change to arrow function
|
// Change to arrow function
|
||||||
responden.findMany.loading = true; // Use the full path to access the property
|
responden.findMany.loading = true; // Use the full path to access the property
|
||||||
responden.findMany.page = page;
|
responden.findMany.page = page;
|
||||||
|
responden.findMany.search = search;
|
||||||
try {
|
try {
|
||||||
|
const query: any = { page, limit };
|
||||||
|
if (search) query.search = search;
|
||||||
|
|
||||||
const res = await ApiFetch.api.landingpage.responden["findMany"].get({
|
const res = await ApiFetch.api.landingpage.responden["findMany"].get({
|
||||||
query: { page, limit },
|
query,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res.status === 200 && res.data?.success) {
|
if (res.status === 200 && res.data?.success) {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
import ApiFetch from "@/lib/api-fetch";
|
import ApiFetch from "@/lib/api-fetch";
|
||||||
import { Prisma } from "@prisma/client";
|
import { Prisma } from "@prisma/client";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
@@ -65,13 +66,46 @@ const dataPendidikan = proxy({
|
|||||||
select: { id: true; name: true; jumlah: true };
|
select: { id: true; name: true; jumlah: true };
|
||||||
}>[]
|
}>[]
|
||||||
| null,
|
| null,
|
||||||
|
page: 1,
|
||||||
|
totalPages: 1,
|
||||||
|
total: 0,
|
||||||
loading: false,
|
loading: false,
|
||||||
async load() {
|
search: "",
|
||||||
|
load: async (page = 1, limit = 10, search = "") => {
|
||||||
|
// Change to arrow function
|
||||||
|
dataPendidikan.findMany.loading = true; // Use the full path to access the property
|
||||||
|
dataPendidikan.findMany.page = page;
|
||||||
|
dataPendidikan.findMany.search = search;
|
||||||
|
try {
|
||||||
|
const query: any = { page, limit };
|
||||||
|
if (search) query.search = search;
|
||||||
|
|
||||||
const res = await ApiFetch.api.pendidikan.datapendidikan[
|
const res = await ApiFetch.api.pendidikan.datapendidikan[
|
||||||
"findMany"
|
"findMany"
|
||||||
].get();
|
].get({
|
||||||
if (res.status === 200) {
|
query,
|
||||||
dataPendidikan.findMany.data = res.data?.data ?? [];
|
});
|
||||||
|
|
||||||
|
if (res.status === 200 && res.data?.success) {
|
||||||
|
dataPendidikan.findMany.data = res.data.data || [];
|
||||||
|
dataPendidikan.findMany.total = res.data.total || 0;
|
||||||
|
dataPendidikan.findMany.totalPages = res.data.totalPages || 1;
|
||||||
|
} else {
|
||||||
|
console.error(
|
||||||
|
"Failed to load data pendidikan:",
|
||||||
|
res.data?.message
|
||||||
|
);
|
||||||
|
dataPendidikan.findMany.data = [];
|
||||||
|
dataPendidikan.findMany.total = 0;
|
||||||
|
dataPendidikan.findMany.totalPages = 1;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error loading data pendidikan:", error);
|
||||||
|
dataPendidikan.findMany.data = [];
|
||||||
|
dataPendidikan.findMany.total = 0;
|
||||||
|
dataPendidikan.findMany.totalPages = 1;
|
||||||
|
} finally {
|
||||||
|
dataPendidikan.findMany.loading = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -220,11 +220,34 @@ const roleState = proxy({
|
|||||||
isActive: true;
|
isActive: true;
|
||||||
};
|
};
|
||||||
}>[],
|
}>[],
|
||||||
|
page: 1,
|
||||||
|
totalPages: 1,
|
||||||
loading: false,
|
loading: false,
|
||||||
async load() {
|
search: "",
|
||||||
const res = await ApiFetch.api.role["findMany"].get();
|
load: async (page = 1, limit = 10, search = "") => {
|
||||||
if (res.status === 200) {
|
roleState.findMany.loading = true; // ✅ Akses langsung via nama path
|
||||||
roleState.findMany.data = res.data?.data ?? [];
|
roleState.findMany.page = page;
|
||||||
|
roleState.findMany.search = search;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const query: any = { page, limit };
|
||||||
|
if (search) query.search = search;
|
||||||
|
|
||||||
|
const res = await ApiFetch.api.role["findMany"].get({ query });
|
||||||
|
|
||||||
|
if (res.status === 200 && res.data?.success) {
|
||||||
|
roleState.findMany.data = res.data.data ?? [];
|
||||||
|
roleState.findMany.totalPages = res.data.totalPages ?? 1;
|
||||||
|
} else {
|
||||||
|
roleState.findMany.data = [];
|
||||||
|
roleState.findMany.totalPages = 1;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error("Gagal fetch role paginated:", err);
|
||||||
|
roleState.findMany.data = [];
|
||||||
|
roleState.findMany.totalPages = 1;
|
||||||
|
} finally {
|
||||||
|
roleState.findMany.loading = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -73,17 +73,17 @@ function LayoutTabsLayanan({ children }: { children: React.ReactNode }) {
|
|||||||
>
|
>
|
||||||
{/* ✅ Scroll horizontal wrapper */}
|
{/* ✅ Scroll horizontal wrapper */}
|
||||||
<Box visibleFrom='md' pb={10}>
|
<Box visibleFrom='md' pb={10}>
|
||||||
<ScrollArea type="auto" offsetScrollbars>
|
<ScrollArea type="auto" offsetScrollbars w="100%">
|
||||||
<TabsList
|
<TabsList
|
||||||
p="sm"
|
p="sm"
|
||||||
style={{
|
style={{
|
||||||
background: "linear-gradient(135deg, #e7ebf7, #f9faff)",
|
background: "linear-gradient(135deg, #e7ebf7, #f9faff)",
|
||||||
borderRadius: "1rem",
|
borderRadius: "1rem",
|
||||||
boxShadow: "inset 0 0 10px rgba(0,0,0,0.05)",
|
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexWrap: "nowrap",
|
flexWrap: "nowrap",
|
||||||
gap: "0.5rem",
|
gap: "0.5rem",
|
||||||
paddingInline: "0.5rem", // ✅ biar nggak nempel ke tepi
|
width: "max-content", // ⬅️ kunci
|
||||||
|
maxWidth: "100%",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{tabs.map((tab, i) => (
|
{tabs.map((tab, i) => (
|
||||||
|
|||||||
@@ -88,7 +88,8 @@ function ListVideo({ search }: { search: string }) {
|
|||||||
|
|
||||||
{/* Desktop Table */}
|
{/* Desktop Table */}
|
||||||
<Box visibleFrom="md">
|
<Box visibleFrom="md">
|
||||||
<Table highlightOnHover w="100%">
|
<Box style={{ overflowX: 'auto' }}>
|
||||||
|
<Table highlightOnHover striped verticalSpacing="sm">
|
||||||
<TableThead>
|
<TableThead>
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTh>Judul Video</TableTh>
|
<TableTh>Judul Video</TableTh>
|
||||||
@@ -101,12 +102,12 @@ function ListVideo({ search }: { search: string }) {
|
|||||||
{filteredData.length > 0 ? (
|
{filteredData.length > 0 ? (
|
||||||
filteredData.map((item) => (
|
filteredData.map((item) => (
|
||||||
<TableTr key={item.id}>
|
<TableTr key={item.id}>
|
||||||
<TableTd>
|
<TableTd style={{ maxWidth: 250 }}>
|
||||||
<Text fz="md" fw={500} lh={1.45} truncate="end" lineClamp={1}>
|
<Text fz="md" fw={500} lh={1.45} truncate="end" lineClamp={1}>
|
||||||
{item.name}
|
{item.name}
|
||||||
</Text>
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd style={{ maxWidth: 250 }}>
|
||||||
<Text fz="sm" c="dimmed" lh={1.45}>
|
<Text fz="sm" c="dimmed" lh={1.45}>
|
||||||
{new Date(item.createdAt).toLocaleDateString('id-ID', {
|
{new Date(item.createdAt).toLocaleDateString('id-ID', {
|
||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
@@ -115,10 +116,10 @@ function ListVideo({ search }: { search: string }) {
|
|||||||
})}
|
})}
|
||||||
</Text>
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd style={{ maxWidth: 250 }}>
|
||||||
<Text fz="sm" lh={1.45} truncate="end" lineClamp={1} dangerouslySetInnerHTML={{ __html: item.deskripsi }} />
|
<Text fz="sm" lh={1.45} truncate="end" lineClamp={1} dangerouslySetInnerHTML={{ __html: item.deskripsi }} />
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd style={{ maxWidth: 250 }}>
|
||||||
<Button
|
<Button
|
||||||
variant="light"
|
variant="light"
|
||||||
color="blue"
|
color="blue"
|
||||||
@@ -146,6 +147,7 @@ function ListVideo({ search }: { search: string }) {
|
|||||||
</TableTbody>
|
</TableTbody>
|
||||||
</Table>
|
</Table>
|
||||||
</Box>
|
</Box>
|
||||||
|
</Box>
|
||||||
|
|
||||||
{/* Mobile Cards */}
|
{/* Mobile Cards */}
|
||||||
<Stack hiddenFrom="md" gap="xs" mt="sm">
|
<Stack hiddenFrom="md" gap="xs" mt="sm">
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ import {
|
|||||||
Button,
|
Button,
|
||||||
Center,
|
Center,
|
||||||
Divider,
|
Divider,
|
||||||
Grid,
|
Group,
|
||||||
GridCol,
|
|
||||||
Paper,
|
Paper,
|
||||||
Skeleton,
|
Skeleton,
|
||||||
Stack,
|
Stack,
|
||||||
@@ -43,8 +42,8 @@ function PelayananPendudukNonPermanent() {
|
|||||||
<Paper bg={colors['white-1']} p="lg" radius="md" shadow="sm">
|
<Paper bg={colors['white-1']} p="lg" radius="md" shadow="sm">
|
||||||
<Stack gap="md">
|
<Stack gap="md">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<Grid align="center">
|
<Group justify='space-between' align="center">
|
||||||
<GridCol span={{ base: 12, md: 11 }}>
|
|
||||||
<Title
|
<Title
|
||||||
order={3}
|
order={3}
|
||||||
lh={1.2}
|
lh={1.2}
|
||||||
@@ -52,8 +51,6 @@ function PelayananPendudukNonPermanent() {
|
|||||||
>
|
>
|
||||||
Preview Pelayanan Penduduk Non Permanen
|
Preview Pelayanan Penduduk Non Permanen
|
||||||
</Title>
|
</Title>
|
||||||
</GridCol>
|
|
||||||
<GridCol span={{ base: 12, md: 1 }}>
|
|
||||||
<Button
|
<Button
|
||||||
c="green"
|
c="green"
|
||||||
variant="light"
|
variant="light"
|
||||||
@@ -67,8 +64,7 @@ function PelayananPendudukNonPermanent() {
|
|||||||
>
|
>
|
||||||
Edit
|
Edit
|
||||||
</Button>
|
</Button>
|
||||||
</GridCol>
|
</Group>
|
||||||
</Grid>
|
|
||||||
|
|
||||||
{/* Content */}
|
{/* Content */}
|
||||||
<Paper p="xl" bg={'white'} withBorder radius="md" shadow="xs">
|
<Paper p="xl" bg={'white'} withBorder radius="md" shadow="xs">
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ import {
|
|||||||
Button,
|
Button,
|
||||||
Center,
|
Center,
|
||||||
Divider,
|
Divider,
|
||||||
Grid,
|
|
||||||
GridCol,
|
|
||||||
Group,
|
Group,
|
||||||
Paper,
|
Paper,
|
||||||
Skeleton,
|
Skeleton,
|
||||||
@@ -76,13 +74,10 @@ function PerizinanBerusaha() {
|
|||||||
<Paper bg={colors['white-1']} p="lg" radius="md" shadow="sm">
|
<Paper bg={colors['white-1']} p="lg" radius="md" shadow="sm">
|
||||||
<Stack gap="md">
|
<Stack gap="md">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<Grid align="center">
|
<Group justify='space-between' align="center">
|
||||||
<GridCol span={{ base: 12, md: 11 }}>
|
|
||||||
<Title order={3} c={colors['blue-button']} lh={1.2}>
|
<Title order={3} c={colors['blue-button']} lh={1.2}>
|
||||||
Preview Pelayanan Perizinan Berusaha
|
Preview Pelayanan Perizinan Berusaha
|
||||||
</Title>
|
</Title>
|
||||||
</GridCol>
|
|
||||||
<GridCol span={{ base: 12, md: 1 }}>
|
|
||||||
<Button
|
<Button
|
||||||
c="green"
|
c="green"
|
||||||
variant="light"
|
variant="light"
|
||||||
@@ -96,8 +91,7 @@ function PerizinanBerusaha() {
|
|||||||
>
|
>
|
||||||
Edit
|
Edit
|
||||||
</Button>
|
</Button>
|
||||||
</GridCol>
|
</Group>
|
||||||
</Grid>
|
|
||||||
|
|
||||||
{/* Content */}
|
{/* Content */}
|
||||||
<Paper p="xl" bg={'white'} withBorder radius="md" shadow="xs">
|
<Paper p="xl" bg={'white'} withBorder radius="md" shadow="xs">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import colors from '@/con/colors';
|
import colors from '@/con/colors';
|
||||||
import { Box, Button, Center, Divider, Grid, GridCol, Image, Paper, Skeleton, Stack, Text, Title } from '@mantine/core';
|
import { Box, Button, Center, Divider, Grid, GridCol, Group, Image, Paper, Skeleton, Stack, Text, Title } from '@mantine/core';
|
||||||
import { IconEdit } from '@tabler/icons-react';
|
import { IconEdit } from '@tabler/icons-react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
@@ -31,11 +31,8 @@ function Page() {
|
|||||||
<Paper bg={colors['white-1']} p="lg" radius="md" shadow="sm">
|
<Paper bg={colors['white-1']} p="lg" radius="md" shadow="sm">
|
||||||
<Stack gap="md">
|
<Stack gap="md">
|
||||||
{/* Header + tombol edit */}
|
{/* Header + tombol edit */}
|
||||||
<Grid align="center">
|
<Group justify="space-between">
|
||||||
<GridCol span={{ base: 12, md: 11 }}>
|
<Title order={2} c={colors['blue-button']} lh={1.2}>Profil Perbekel</Title>
|
||||||
<Title order={2} c={colors['blue-button']} lh={1.2} />
|
|
||||||
</GridCol>
|
|
||||||
<GridCol span={{ base: 12, md: 1 }}>
|
|
||||||
<Button
|
<Button
|
||||||
c="green"
|
c="green"
|
||||||
variant="light"
|
variant="light"
|
||||||
@@ -45,8 +42,7 @@ function Page() {
|
|||||||
>
|
>
|
||||||
Edit
|
Edit
|
||||||
</Button>
|
</Button>
|
||||||
</GridCol>
|
</Group>
|
||||||
</Grid>
|
|
||||||
|
|
||||||
{/* Card Profil */}
|
{/* Card Profil */}
|
||||||
<Paper p="xl" bg={colors['white-1']} withBorder radius="md" shadow="xs">
|
<Paper p="xl" bg={colors['white-1']} withBorder radius="md" shadow="xs">
|
||||||
@@ -60,7 +56,7 @@ function Page() {
|
|||||||
<GridCol span={12}>
|
<GridCol span={12}>
|
||||||
<Text
|
<Text
|
||||||
ta="center"
|
ta="center"
|
||||||
fz={{ base: 'sm', md: 'md' }}
|
fz={{ base: 'sm', md: 'xl' }}
|
||||||
fw="bold"
|
fw="bold"
|
||||||
c={colors['blue-button']}
|
c={colors['blue-button']}
|
||||||
lh={{ base: 1.45, md: 1.45 }}
|
lh={{ base: 1.45, md: 1.45 }}
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ function ListAPBDesa({ search }: { search: string }) {
|
|||||||
<TableTd>
|
<TableTd>
|
||||||
<Button
|
<Button
|
||||||
variant="light"
|
variant="light"
|
||||||
color="green"
|
color="blue"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
router.push(
|
router.push(
|
||||||
`/admin/ekonomi/PADesa-pendapatan-asli-desa/apbdesa/${item.id}`
|
`/admin/ekonomi/PADesa-pendapatan-asli-desa/apbdesa/${item.id}`
|
||||||
@@ -243,7 +243,7 @@ function ListAPBDesa({ search }: { search: string }) {
|
|||||||
</Box>
|
</Box>
|
||||||
<Button
|
<Button
|
||||||
variant="light"
|
variant="light"
|
||||||
color="green"
|
color="blue"
|
||||||
fullWidth
|
fullWidth
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
router.push(
|
router.push(
|
||||||
|
|||||||
@@ -128,10 +128,18 @@ function ListBelanja({ search }: { search: string }) {
|
|||||||
>
|
>
|
||||||
<TableThead>
|
<TableThead>
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTh style={{ width: '35%' }}>Nama</TableTh>
|
<TableTh style={{ width: '40%' }}>
|
||||||
<TableTh style={{ width: '25%' }}>Nilai</TableTh>
|
<Text fz="sm" fw={600} lh={1.4}>Nama</Text>
|
||||||
<TableTh style={{ width: '20%' }}>Persentase</TableTh>
|
</TableTh>
|
||||||
<TableTh style={{ width: '20%' }}>Aksi</TableTh>
|
<TableTh style={{ width: '25%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>Nilai</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '15%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>Edit</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '20%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>Delete</Text>
|
||||||
|
</TableTh>
|
||||||
</TableTr>
|
</TableTr>
|
||||||
</TableThead>
|
</TableThead>
|
||||||
<TableTbody>
|
<TableTbody>
|
||||||
|
|||||||
@@ -122,10 +122,18 @@ function ListPembiayaan({ search }: { search: string }) {
|
|||||||
>
|
>
|
||||||
<TableThead>
|
<TableThead>
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTh style={{ width: '35%' }}>Nama</TableTh>
|
<TableTh style={{ width: '40%' }}>
|
||||||
<TableTh style={{ width: '25%' }}>Nilai</TableTh>
|
<Text fz="sm" fw={600} lh={1.4}>Nama</Text>
|
||||||
<TableTh style={{ width: '20%' }}>Persentase</TableTh>
|
</TableTh>
|
||||||
<TableTh style={{ width: '20%' }}>Aksi</TableTh>
|
<TableTh style={{ width: '25%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>Nilai</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '15%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>Edit</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '20%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>Delete</Text>
|
||||||
|
</TableTh>
|
||||||
</TableTr>
|
</TableTr>
|
||||||
</TableThead>
|
</TableThead>
|
||||||
<TableTbody>
|
<TableTbody>
|
||||||
|
|||||||
@@ -160,7 +160,6 @@ function ListPendapatan({ search }: { search: string }) {
|
|||||||
px="xs"
|
px="xs"
|
||||||
>
|
>
|
||||||
<IconEdit size={16} />
|
<IconEdit size={16} />
|
||||||
<Text ml={5}>Edit</Text>
|
|
||||||
</Button>
|
</Button>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
@@ -176,7 +175,6 @@ function ListPendapatan({ search }: { search: string }) {
|
|||||||
px="xs"
|
px="xs"
|
||||||
>
|
>
|
||||||
<IconTrash size={16} />
|
<IconTrash size={16} />
|
||||||
<Text ml={5}>Hapus</Text>
|
|
||||||
</Button>
|
</Button>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
</TableTr>
|
</TableTr>
|
||||||
|
|||||||
@@ -153,9 +153,14 @@ function ListPosisiOrganisasiBumDes({ search }: { search: string }) {
|
|||||||
</Text>
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
<Text fz="sm" fw={500} lh={1.45} c="dimmed" lineClamp={2}>
|
<Text
|
||||||
{item.deskripsi || '-'}
|
fz="sm"
|
||||||
</Text>
|
fw={500}
|
||||||
|
lh={1.45}
|
||||||
|
c="dimmed"
|
||||||
|
lineClamp={2}
|
||||||
|
dangerouslySetInnerHTML={{ __html: item.deskripsi || '-' }}
|
||||||
|
/>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
<Text fz="md" fw={500} lh={1.45}>{item.hierarki || '-'}</Text>
|
<Text fz="md" fw={500} lh={1.45}>{item.hierarki || '-'}</Text>
|
||||||
@@ -223,9 +228,14 @@ function ListPosisiOrganisasiBumDes({ search }: { search: string }) {
|
|||||||
<Text fz="sm" fw={600} lh={1.4}>
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
Deskripsi
|
Deskripsi
|
||||||
</Text>
|
</Text>
|
||||||
<Text fz="sm" fw={500} lh={1.4}>
|
<Text
|
||||||
{item.deskripsi || '-'}
|
fz="sm"
|
||||||
</Text>
|
fw={500}
|
||||||
|
lh={1.45}
|
||||||
|
c="dimmed"
|
||||||
|
lineClamp={2}
|
||||||
|
dangerouslySetInnerHTML={{ __html: item.deskripsi || '-' }}
|
||||||
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
<Box>
|
<Box>
|
||||||
<Text fz="sm" fw={600} lh={1.4}>
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
Title
|
Title
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useDebouncedValue, useShallowEffect } from '@mantine/hooks';
|
||||||
import { IconEdit, IconPlus, IconSearch, IconTrash } from '@tabler/icons-react';
|
import { IconEdit, IconPlus, IconSearch, IconTrash } from '@tabler/icons-react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
@@ -59,6 +59,8 @@ function ListDemografiPekerjaan({ search }: { search: string }) {
|
|||||||
const [chartData, setChartData] = useState<DemografiPekerjaan[]>([]);
|
const [chartData, setChartData] = useState<DemografiPekerjaan[]>([]);
|
||||||
const [mounted, setMounted] = useState(false);
|
const [mounted, setMounted] = useState(false);
|
||||||
const [modalHapus, setModalHapus] = useState(false);
|
const [modalHapus, setModalHapus] = useState(false);
|
||||||
|
const [debouncedSearch] = useDebouncedValue(search, 1000); // 500ms delay
|
||||||
|
|
||||||
const [selectedId, setSelectedId] = useState<string | null>(null);
|
const [selectedId, setSelectedId] = useState<string | null>(null);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -79,8 +81,8 @@ function ListDemografiPekerjaan({ search }: { search: string }) {
|
|||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
setMounted(true);
|
setMounted(true);
|
||||||
load(page, 10, search);
|
load(page, 10, debouncedSearch);
|
||||||
}, [page, search]);
|
}, [page, debouncedSearch]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (data) {
|
if (data) {
|
||||||
|
|||||||
@@ -28,27 +28,27 @@ import { ModalKonfirmasiHapus } from '../../../_com/modalKonfirmasiHapus';
|
|||||||
import pasarDesaState from '../../../_state/ekonomi/pasar-desa/pasar-desa';
|
import pasarDesaState from '../../../_state/ekonomi/pasar-desa/pasar-desa';
|
||||||
|
|
||||||
function KategoriProduk() {
|
function KategoriProduk() {
|
||||||
const [search2, setSearch2] = useState('');
|
const [search, setSearch] = useState('');
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<HeaderSearch
|
<HeaderSearch
|
||||||
title='Kategori Produk'
|
title='Kategori Produk'
|
||||||
placeholder='Cari nama kategori produk...'
|
placeholder='Cari nama kategori produk...'
|
||||||
searchIcon={<IconSearch size={20} />}
|
searchIcon={<IconSearch size={20} />}
|
||||||
value={search2}
|
value={search}
|
||||||
onChange={(e) => setSearch2(e.currentTarget.value)}
|
onChange={(e) => setSearch(e.currentTarget.value)}
|
||||||
/>
|
/>
|
||||||
<ListKategoriProduk search2={search2} />
|
<ListKategoriProduk search={search} />
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ListKategoriProduk({ search2 }: { search2: string }) {
|
function ListKategoriProduk({ search }: { search: string }) {
|
||||||
const statePasar = useProxy(pasarDesaState.kategoriProduk);
|
const statePasar = useProxy(pasarDesaState.kategoriProduk);
|
||||||
const [modalHapus, setModalHapus] = useState(false);
|
const [modalHapus, setModalHapus] = useState(false);
|
||||||
const [selectedId, setSelectedId] = useState<string | null>(null);
|
const [selectedId, setSelectedId] = useState<string | null>(null);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [debouncedSearch] = useDebouncedValue(search2, 1000);
|
const [debouncedSearch] = useDebouncedValue(search, 1000);
|
||||||
|
|
||||||
const { data, page, totalPages, loading, load } = statePasar.findMany;
|
const { data, page, totalPages, loading, load } = statePasar.findMany;
|
||||||
|
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ function ListProgramKemiskinan({ search }: { search: string }) {
|
|||||||
{filteredData.length > 0 ? (
|
{filteredData.length > 0 ? (
|
||||||
filteredData.map((item) => (
|
filteredData.map((item) => (
|
||||||
<Paper key={item.id} withBorder p="md" radius="sm">
|
<Paper key={item.id} withBorder p="md" radius="sm">
|
||||||
<Stack gap={4}>
|
<Stack gap={"xs"}>
|
||||||
<Box>
|
<Box>
|
||||||
<Text fz="sm" fw={600} lh={1.4}>
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
Judul Program
|
Judul Program
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ function DetailAjukanIdeInofativDesa() {
|
|||||||
const data = state.findUnique.data;
|
const data = state.findUnique.data;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Tombol Kembali */}
|
{/* Tombol Kembali */}
|
||||||
<Button
|
<Button
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
@@ -54,7 +54,7 @@ function DetailAjukanIdeInofativDesa() {
|
|||||||
{/* Card Utama */}
|
{/* Card Utama */}
|
||||||
<Paper
|
<Paper
|
||||||
withBorder
|
withBorder
|
||||||
w={{ base: "100%", md: "80%", lg: "60%" }}
|
w={{ base: "100%", md: "70%" }}
|
||||||
bg={colors['white-1']}
|
bg={colors['white-1']}
|
||||||
p="lg"
|
p="lg"
|
||||||
radius="md"
|
radius="md"
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
Title
|
Title
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useDebouncedValue, useShallowEffect } from '@mantine/hooks';
|
||||||
import { IconDeviceImac, IconSearch } from '@tabler/icons-react';
|
import { IconDeviceImac, IconSearch } from '@tabler/icons-react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
@@ -44,6 +44,7 @@ function AjukanIdeInovatif() {
|
|||||||
function ListAjukanIdeInovatif({ search }: { search: string }) {
|
function ListAjukanIdeInovatif({ search }: { search: string }) {
|
||||||
const state = useProxy(ajukanIdeInovatifState)
|
const state = useProxy(ajukanIdeInovatifState)
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const [debouncedSearch] = useDebouncedValue(search, 1000); // 500ms delay
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data,
|
data,
|
||||||
@@ -54,8 +55,8 @@ function ListAjukanIdeInovatif({ search }: { search: string }) {
|
|||||||
} = state.findMany;
|
} = state.findMany;
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
load(page, 10, search)
|
load(page, 10, debouncedSearch)
|
||||||
}, [page, search])
|
}, [page, debouncedSearch])
|
||||||
|
|
||||||
const filteredData = data || []
|
const filteredData = data || []
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ function EditDigitalSmartVillage() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ function DetailDesaDigital() {
|
|||||||
const data = stateDesaDigital.findUnique.data;
|
const data = stateDesaDigital.findUnique.data;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Tombol Kembali */}
|
{/* Tombol Kembali */}
|
||||||
<Button
|
<Button
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
@@ -63,7 +63,7 @@ function DetailDesaDigital() {
|
|||||||
{/* Card Utama */}
|
{/* Card Utama */}
|
||||||
<Paper
|
<Paper
|
||||||
withBorder
|
withBorder
|
||||||
w={{ base: "100%", md: "60%" }}
|
w={{ base: "100%", md: "70%" }}
|
||||||
bg={colors['white-1']}
|
bg={colors['white-1']}
|
||||||
p="lg"
|
p="lg"
|
||||||
radius="md"
|
radius="md"
|
||||||
@@ -77,12 +77,12 @@ function DetailDesaDigital() {
|
|||||||
{/* Sub Card Detail */}
|
{/* Sub Card Detail */}
|
||||||
<Paper bg="#ECEEF8" p="md" radius="md" shadow="xs">
|
<Paper bg="#ECEEF8" p="md" radius="md" shadow="xs">
|
||||||
<Stack gap="sm">
|
<Stack gap="sm">
|
||||||
<Box>
|
<Box pl={5}>
|
||||||
<Text fz="lg" fw="bold">Judul</Text>
|
<Text fz="lg" fw="bold">Judul</Text>
|
||||||
<Text fz="md" c="dimmed">{data?.name || '-'}</Text>
|
<Text fz="md" c="dimmed">{data?.name || '-'}</Text>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Box>
|
<Box pl={5}>
|
||||||
<Text fz="lg" fw="bold">Deskripsi</Text>
|
<Text fz="lg" fw="bold">Deskripsi</Text>
|
||||||
<Text
|
<Text
|
||||||
fz="md"
|
fz="md"
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ export default function CreateDesaDigital() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Header dengan tombol kembali */}
|
{/* Header dengan tombol kembali */}
|
||||||
<Group mb="md" align="center">
|
<Group mb="md" align="center">
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
Title
|
Title
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useDebouncedValue, useShallowEffect } from '@mantine/hooks';
|
||||||
import { IconDeviceImac, IconPlus, IconSearch } from '@tabler/icons-react';
|
import { IconDeviceImac, IconPlus, IconSearch } from '@tabler/icons-react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
@@ -45,28 +45,31 @@ function DesaDigitalSmartVillage() {
|
|||||||
function ListDesaDigitalSmartVillage({ search }: { search: string }) {
|
function ListDesaDigitalSmartVillage({ search }: { search: string }) {
|
||||||
const state = useProxy(desaDigitalState);
|
const state = useProxy(desaDigitalState);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const [debouncedSearch] = useDebouncedValue(search, 1000);
|
||||||
|
|
||||||
const { data, page, totalPages, loading, load } = state.findMany;
|
const { data, page, totalPages, loading, load } = state.findMany;
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
load(page, 10, search);
|
load(page, 10, debouncedSearch);
|
||||||
}, [page, search]);
|
}, [page, debouncedSearch]);
|
||||||
|
|
||||||
const filteredData = data || [];
|
const filteredData = data || [];
|
||||||
|
|
||||||
if (loading || !data) {
|
if (loading || !data) {
|
||||||
return (
|
return (
|
||||||
<Stack py={10}>
|
<Stack py="lg">
|
||||||
<Skeleton height={600} radius="md" />
|
<Skeleton height={600} radius="md" />
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Box py="lg">
|
||||||
<Paper withBorder bg={colors['white-1']} p="lg" shadow="md" radius="md">
|
<Paper withBorder bg={colors['white-1']} p="lg" shadow="md" radius="md">
|
||||||
<Group justify="space-between" mb="md">
|
<Group justify="space-between" mb="md">
|
||||||
<Title order={4}>List Desa Digital Smart Village</Title>
|
<Title order={4} lh={1.2}>
|
||||||
|
List Desa Digital Smart Village
|
||||||
|
</Title>
|
||||||
<Button
|
<Button
|
||||||
leftSection={<IconPlus size={18} />}
|
leftSection={<IconPlus size={18} />}
|
||||||
color="blue"
|
color="blue"
|
||||||
@@ -78,15 +81,34 @@ function ListDesaDigitalSmartVillage({ search }: { search: string }) {
|
|||||||
Tambah Baru
|
Tambah Baru
|
||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
<Box style={{ overflowX: 'auto' }}>
|
|
||||||
<Table highlightOnHover>
|
{/* Desktop Table */}
|
||||||
|
<Box visibleFrom="sm">
|
||||||
|
<Table
|
||||||
|
highlightOnHover
|
||||||
|
miw={0}
|
||||||
|
style={{
|
||||||
|
tableLayout: 'fixed',
|
||||||
|
width: '100%',
|
||||||
|
}}
|
||||||
|
>
|
||||||
<TableThead>
|
<TableThead>
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTh style={{ width: '30%' }}>Nama Inovasi</TableTh>
|
<TableTh style={{ width: '30%' }}>
|
||||||
<TableTh style={{ width: '50%' }}>
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
Deskripsi Singkat Inovasi
|
Nama Inovasi
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '50%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
Deskripsi Singkat Inovasi
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '20%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
Aksi
|
||||||
|
</Text>
|
||||||
</TableTh>
|
</TableTh>
|
||||||
<TableTh style={{ width: '20%' }}>Aksi</TableTh>
|
|
||||||
</TableTr>
|
</TableTr>
|
||||||
</TableThead>
|
</TableThead>
|
||||||
<TableTbody>
|
<TableTbody>
|
||||||
@@ -94,21 +116,18 @@ function ListDesaDigitalSmartVillage({ search }: { search: string }) {
|
|||||||
filteredData.map((item) => (
|
filteredData.map((item) => (
|
||||||
<TableTr key={item.id}>
|
<TableTr key={item.id}>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
<Box w={200}>
|
<Text fz="md" fw={500} lh={1.5} truncate="end">
|
||||||
<Text fw={500} truncate="end" lineClamp={1}>
|
|
||||||
{item.name}
|
{item.name}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
<Box w={200}>
|
|
||||||
<Text
|
<Text
|
||||||
fz="sm"
|
fz="sm"
|
||||||
c="dimmed"
|
c="dimmed"
|
||||||
|
lh={1.5}
|
||||||
lineClamp={1}
|
lineClamp={1}
|
||||||
dangerouslySetInnerHTML={{ __html: item.deskripsi }}
|
dangerouslySetInnerHTML={{ __html: item.deskripsi }}
|
||||||
/>
|
/>
|
||||||
</Box>
|
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
<Button
|
<Button
|
||||||
@@ -121,7 +140,9 @@ function ListDesaDigitalSmartVillage({ search }: { search: string }) {
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<IconDeviceImac size={20} />
|
<IconDeviceImac size={20} />
|
||||||
<Text ml={5}>Detail</Text>
|
<Text ml={5} fz="sm" fw={500} lh={1.4}>
|
||||||
|
Detail
|
||||||
|
</Text>
|
||||||
</Button>
|
</Button>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
</TableTr>
|
</TableTr>
|
||||||
@@ -129,8 +150,8 @@ function ListDesaDigitalSmartVillage({ search }: { search: string }) {
|
|||||||
) : (
|
) : (
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTd colSpan={3}>
|
<TableTd colSpan={3}>
|
||||||
<Center py={20}>
|
<Center py="xl">
|
||||||
<Text color="dimmed">
|
<Text c="dimmed" fz="sm" lh={1.4}>
|
||||||
Tidak ada data inovasi digital yang cocok
|
Tidak ada data inovasi digital yang cocok
|
||||||
</Text>
|
</Text>
|
||||||
</Center>
|
</Center>
|
||||||
@@ -140,6 +161,64 @@ function ListDesaDigitalSmartVillage({ search }: { search: string }) {
|
|||||||
</TableTbody>
|
</TableTbody>
|
||||||
</Table>
|
</Table>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
{/* Mobile Cards */}
|
||||||
|
<Box hiddenFrom="sm">
|
||||||
|
<Stack gap="md">
|
||||||
|
{filteredData.length > 0 ? (
|
||||||
|
filteredData.map((item) => (
|
||||||
|
<Paper key={item.id} withBorder p="md" radius="md">
|
||||||
|
<Stack gap={4}>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
Nama Inovasi
|
||||||
|
</Text>
|
||||||
|
<Text fz="sm" fw={500} lh={1.5}>
|
||||||
|
{item.name}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
Deskripsi Singkat Inovasi
|
||||||
|
</Text>
|
||||||
|
<Box pl={5}>
|
||||||
|
<Text
|
||||||
|
fz="sm"
|
||||||
|
fw={500}
|
||||||
|
lh={1.5}
|
||||||
|
dangerouslySetInnerHTML={{ __html: item.deskripsi }}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Button
|
||||||
|
variant="light"
|
||||||
|
color="blue"
|
||||||
|
fullWidth
|
||||||
|
onClick={() =>
|
||||||
|
router.push(
|
||||||
|
`/admin/inovasi/desa-digital-smart-village/${item.id}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<IconDeviceImac size={20} />
|
||||||
|
<Text ml={5} fz="sm" fw={500} lh={1.4}>
|
||||||
|
Detail
|
||||||
|
</Text>
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<Center py="xl">
|
||||||
|
<Text c="dimmed" fz="sm" lh={1.4}>
|
||||||
|
Tidak ada data inovasi digital yang cocok
|
||||||
|
</Text>
|
||||||
|
</Center>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
</Box>
|
||||||
</Paper>
|
</Paper>
|
||||||
<Center>
|
<Center>
|
||||||
<Pagination
|
<Pagination
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ function EditInfoTeknologiTepatGuna() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Tombol back + title */}
|
{/* Tombol back + title */}
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ function DetailInfoTeknologiTepatGuna() {
|
|||||||
const data = stateInfoTekno.findUnique.data
|
const data = stateInfoTekno.findUnique.data
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Tombol Kembali */}
|
{/* Tombol Kembali */}
|
||||||
<Button
|
<Button
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
@@ -54,7 +54,7 @@ function DetailInfoTeknologiTepatGuna() {
|
|||||||
{/* Card Utama */}
|
{/* Card Utama */}
|
||||||
<Paper
|
<Paper
|
||||||
withBorder
|
withBorder
|
||||||
w={{ base: "100%", md: "50%" }}
|
w={{ base: "100%", md: "70%" }}
|
||||||
bg={colors['white-1']}
|
bg={colors['white-1']}
|
||||||
p="lg"
|
p="lg"
|
||||||
radius="md"
|
radius="md"
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ function CreateInfoTeknologiTepatGuna() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ import {
|
|||||||
TableThead,
|
TableThead,
|
||||||
TableTr,
|
TableTr,
|
||||||
Text,
|
Text,
|
||||||
Title
|
Title,
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useDebouncedValue, useShallowEffect } from '@mantine/hooks';
|
||||||
import { IconDeviceImac, IconPlus, IconSearch } from '@tabler/icons-react';
|
import { IconDeviceImac, IconPlus, IconSearch } from '@tabler/icons-react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
@@ -45,28 +45,31 @@ function InfoTeknologiTepatGuna() {
|
|||||||
function ListInfoTeknologiTepatGuna({ search }: { search: string }) {
|
function ListInfoTeknologiTepatGuna({ search }: { search: string }) {
|
||||||
const state = useProxy(infoTeknoState);
|
const state = useProxy(infoTeknoState);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const [debouncedSearch] = useDebouncedValue(search, 1000);
|
||||||
|
|
||||||
const { data, page, totalPages, loading, load } = state.findMany;
|
const { data, page, totalPages, loading, load } = state.findMany;
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
load(page, 10, search);
|
load(page, 10, debouncedSearch);
|
||||||
}, [page, search]);
|
}, [page, debouncedSearch]);
|
||||||
|
|
||||||
const filteredData = data || [];
|
const filteredData = data || [];
|
||||||
|
|
||||||
if (loading || !data) {
|
if (loading || !data) {
|
||||||
return (
|
return (
|
||||||
<Stack py={10}>
|
<Stack py={{ base: 'sm', md: 'lg' }}>
|
||||||
<Skeleton height={600} radius="md" />
|
<Skeleton height={600} radius="md" />
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Box py={{ base: 'sm', md: 'lg' }}>
|
||||||
<Paper withBorder bg={colors['white-1']} p="lg" shadow="md" radius="md">
|
<Paper withBorder bg={colors['white-1']} p={{ base: 'sm', md: 'lg' }} shadow="md" radius="md">
|
||||||
<Group justify="space-between" mb="md">
|
<Group justify="space-between" mb="md">
|
||||||
<Title order={4}>Daftar Info Teknologi Tepat Guna</Title>
|
<Title order={4} lh={1.2}>
|
||||||
|
Daftar Info Teknologi Tepat Guna
|
||||||
|
</Title>
|
||||||
<Button
|
<Button
|
||||||
leftSection={<IconPlus size={18} />}
|
leftSection={<IconPlus size={18} />}
|
||||||
color="blue"
|
color="blue"
|
||||||
@@ -79,40 +82,57 @@ function ListInfoTeknologiTepatGuna({ search }: { search: string }) {
|
|||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
<Box style={{ overflowX: 'auto' }}>
|
{/* Desktop Table */}
|
||||||
<Table highlightOnHover>
|
<Box visibleFrom="md">
|
||||||
|
<Table
|
||||||
|
highlightOnHover
|
||||||
|
miw={0}
|
||||||
|
style={{
|
||||||
|
tableLayout: 'fixed',
|
||||||
|
width: '100%',
|
||||||
|
}}
|
||||||
|
>
|
||||||
<TableThead>
|
<TableThead>
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTh style={{ width: '30%' }}>
|
<TableTh style={{ width: '30%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
Nama Info Teknologi
|
Nama Info Teknologi
|
||||||
|
</Text>
|
||||||
</TableTh>
|
</TableTh>
|
||||||
<TableTh style={{ width: '50%' }}>
|
<TableTh style={{ width: '50%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
Deskripsi Singkat
|
Deskripsi Singkat
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '20%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
Aksi
|
||||||
|
</Text>
|
||||||
</TableTh>
|
</TableTh>
|
||||||
<TableTh style={{ width: '20%' }}>Aksi</TableTh>
|
|
||||||
</TableTr>
|
</TableTr>
|
||||||
</TableThead>
|
</TableThead>
|
||||||
<TableTbody>
|
<TableTbody>
|
||||||
{filteredData.length > 0 ? (
|
{filteredData.length > 0 ? (
|
||||||
filteredData.map((item) => (
|
filteredData.map((item) => (
|
||||||
<TableTr key={item.id}>
|
<TableTr key={item.id}>
|
||||||
<TableTd style={{ width: '30%' }}>
|
<TableTd>
|
||||||
<Text fw={500} truncate="end" lineClamp={1}>
|
<Text fz="md" fw={500} lh={1.5} truncate="end" lineClamp={1}>
|
||||||
{item.name}
|
{item.name}
|
||||||
</Text>
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd style={{ width: '50%' }}>
|
<TableTd>
|
||||||
<Text
|
<Text
|
||||||
|
fz="sm"
|
||||||
|
lh={1.5}
|
||||||
|
c="dimmed"
|
||||||
lineClamp={1}
|
lineClamp={1}
|
||||||
truncate
|
truncate
|
||||||
fz="sm"
|
|
||||||
c="dimmed"
|
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html: item.deskripsi || '-',
|
__html: item.deskripsi || '-',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd style={{ width: '20%' }}>
|
<TableTd>
|
||||||
<Button
|
<Button
|
||||||
size="xs"
|
size="xs"
|
||||||
radius="md"
|
radius="md"
|
||||||
@@ -134,7 +154,7 @@ function ListInfoTeknologiTepatGuna({ search }: { search: string }) {
|
|||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTd colSpan={3}>
|
<TableTd colSpan={3}>
|
||||||
<Center py={20}>
|
<Center py={20}>
|
||||||
<Text color="dimmed">
|
<Text fz="sm" c="dimmed" ta="center">
|
||||||
Tidak ada data Info Teknologi yang cocok
|
Tidak ada data Info Teknologi yang cocok
|
||||||
</Text>
|
</Text>
|
||||||
</Center>
|
</Center>
|
||||||
@@ -144,6 +164,63 @@ function ListInfoTeknologiTepatGuna({ search }: { search: string }) {
|
|||||||
</TableTbody>
|
</TableTbody>
|
||||||
</Table>
|
</Table>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
{/* Mobile Cards */}
|
||||||
|
<Stack hiddenFrom="md" gap="xs">
|
||||||
|
{filteredData.length > 0 ? (
|
||||||
|
filteredData.map((item) => (
|
||||||
|
<Paper key={item.id} withBorder p="sm" radius="md">
|
||||||
|
<Stack gap={"xs"}>
|
||||||
|
<Box>
|
||||||
|
<Text fz={"sm"} fw={600} lh={1.4}>
|
||||||
|
Nama Info Teknologi
|
||||||
|
</Text>
|
||||||
|
<Text fz="sm" fw={500} lh={1.4}>
|
||||||
|
{item.name}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text fz={"sm"} fw={600} lh={1.4}>
|
||||||
|
Deskripsi Singkat
|
||||||
|
</Text>
|
||||||
|
<Box pl={5}>
|
||||||
|
<Text
|
||||||
|
fz="sm"
|
||||||
|
fw={500}
|
||||||
|
lh={1.4}
|
||||||
|
dangerouslySetInnerHTML={{
|
||||||
|
__html: item.deskripsi || '-',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
<Group justify="flex-end">
|
||||||
|
<Button
|
||||||
|
size="xs"
|
||||||
|
radius="md"
|
||||||
|
variant="light"
|
||||||
|
color="blue"
|
||||||
|
leftSection={<IconDeviceImac size={16} />}
|
||||||
|
onClick={() =>
|
||||||
|
router.push(
|
||||||
|
`/admin/inovasi/info-teknologi-tepat-guna/${item.id}`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
Detail
|
||||||
|
</Button>
|
||||||
|
</Group>
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<Center py={20}>
|
||||||
|
<Text fz="sm" c="dimmed" ta="center">
|
||||||
|
Tidak ada data Info Teknologi yang cocok
|
||||||
|
</Text>
|
||||||
|
</Center>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
|
||||||
<Center>
|
<Center>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* eslint-disable react-hooks/exhaustive-deps */
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
'use client'
|
'use client'
|
||||||
import colors from '@/con/colors';
|
import colors from '@/con/colors';
|
||||||
import { ScrollArea, Stack, Tabs, TabsList, TabsPanel, TabsTab, Title } from '@mantine/core';
|
import { Box, ScrollArea, Stack, Tabs, TabsList, TabsPanel, TabsTab, Title } from '@mantine/core';
|
||||||
import { IconListDetails, IconUsers } from '@tabler/icons-react';
|
import { IconListDetails, IconUsers } from '@tabler/icons-react';
|
||||||
import { usePathname, useRouter } from 'next/navigation';
|
import { usePathname, useRouter } from 'next/navigation';
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
@@ -57,6 +57,7 @@ function LayoutTabsKolaborasi({ children }: { children: React.ReactNode }) {
|
|||||||
keepMounted={false}
|
keepMounted={false}
|
||||||
>
|
>
|
||||||
{/* ✅ Scroll horizontal wrapper biar rapi */}
|
{/* ✅ Scroll horizontal wrapper biar rapi */}
|
||||||
|
<Box visibleFrom='md' pb={10}>
|
||||||
<ScrollArea type="auto" offsetScrollbars>
|
<ScrollArea type="auto" offsetScrollbars>
|
||||||
<TabsList
|
<TabsList
|
||||||
p="sm"
|
p="sm"
|
||||||
@@ -67,7 +68,7 @@ function LayoutTabsKolaborasi({ children }: { children: React.ReactNode }) {
|
|||||||
display: "flex",
|
display: "flex",
|
||||||
flexWrap: "nowrap",
|
flexWrap: "nowrap",
|
||||||
gap: "0.5rem",
|
gap: "0.5rem",
|
||||||
paddingInline: "0.5rem",
|
paddingInline: "0.5rem", // ✅ biar nggak nempel ke tepi
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{tabs.map((tab, i) => (
|
{tabs.map((tab, i) => (
|
||||||
@@ -79,6 +80,7 @@ function LayoutTabsKolaborasi({ children }: { children: React.ReactNode }) {
|
|||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
fontSize: "0.9rem",
|
fontSize: "0.9rem",
|
||||||
transition: "all 0.2s ease",
|
transition: "all 0.2s ease",
|
||||||
|
flexShrink: 0, // ✅ jangan mengecil aneh-aneh
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{tab.label}
|
{tab.label}
|
||||||
@@ -86,7 +88,45 @@ function LayoutTabsKolaborasi({ children }: { children: React.ReactNode }) {
|
|||||||
))}
|
))}
|
||||||
</TabsList>
|
</TabsList>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
<Box hiddenFrom='md' pb={10}>
|
||||||
|
<ScrollArea
|
||||||
|
type="auto"
|
||||||
|
offsetScrollbars={false}
|
||||||
|
w="100%"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TabsList
|
||||||
|
p="xs" // lebih kecil
|
||||||
|
style={{
|
||||||
|
background: "linear-gradient(135deg, #e7ebf7, #f9faff)",
|
||||||
|
borderRadius: "1rem",
|
||||||
|
display: "flex",
|
||||||
|
flexWrap: "nowrap",
|
||||||
|
gap: "0.5rem",
|
||||||
|
width: "max-content", // ⬅️ kunci
|
||||||
|
maxWidth: "100%", // ⬅️ penting
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{tabs.map((tab, i) => (
|
||||||
|
<TabsTab
|
||||||
|
key={i}
|
||||||
|
value={tab.value}
|
||||||
|
leftSection={tab.icon}
|
||||||
|
style={{
|
||||||
|
fontWeight: 600,
|
||||||
|
fontSize: "0.9rem",
|
||||||
|
paddingInline: "0.75rem", // ⬅️ lebih ramping
|
||||||
|
flexShrink: 0, // ✅ jangan mengecil aneh-aneh
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{tab.label}
|
||||||
|
</TabsTab>
|
||||||
|
))}
|
||||||
|
</TabsList>
|
||||||
|
</ScrollArea>
|
||||||
|
</Box>
|
||||||
{tabs.map((tab, i) => (
|
{tabs.map((tab, i) => (
|
||||||
<TabsPanel
|
<TabsPanel
|
||||||
key={i}
|
key={i}
|
||||||
|
|||||||
@@ -1,7 +1,29 @@
|
|||||||
|
'use client'
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import LayoutTabsKolaborasi from './_lib/layoutTabs';
|
import LayoutTabsKolaborasi from './_lib/layoutTabs';
|
||||||
|
import { usePathname } from 'next/navigation';
|
||||||
|
import { Box } from '@mantine/core';
|
||||||
|
|
||||||
function Layout({ children }: { children: React.ReactNode }) {
|
function Layout({ children }: { children: React.ReactNode }) {
|
||||||
|
const pathname = usePathname();
|
||||||
|
|
||||||
|
// Contoh path:
|
||||||
|
// - /darmasaba/desa/berita/semua → panjang 5 → list
|
||||||
|
// - /darmasaba/desa/berita/Pemerintahan → panjang 5 → list
|
||||||
|
// - /darmasaba/desa/berita/Pemerintahan/123 → panjang 6 → detail
|
||||||
|
|
||||||
|
const segments = pathname.split('/').filter(Boolean);
|
||||||
|
const isDetailPage = segments.length >= 5;
|
||||||
|
|
||||||
|
if (isDetailPage) {
|
||||||
|
// Tampilkan tanpa tab menu
|
||||||
|
return (
|
||||||
|
<Box>
|
||||||
|
{children}
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LayoutTabsKolaborasi>
|
<LayoutTabsKolaborasi>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ function EditKolaborasiInovasi() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: "sm", md: "lg" }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
||||||
<IconArrowBack color={colors["blue-button"]} size={24} />
|
<IconArrowBack color={colors["blue-button"]} size={24} />
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ function DetailKolaborasiInovasi() {
|
|||||||
const data = kolaborasiState.findUnique.data;
|
const data = kolaborasiState.findUnique.data;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Tombol kembali */}
|
{/* Tombol kembali */}
|
||||||
<Button
|
<Button
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ function CreateProgramKreatifDesa() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Back Button */}
|
{/* Back Button */}
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
Title
|
Title
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
|
import { useDebouncedValue } from '@mantine/hooks';
|
||||||
import { IconDeviceImac, IconPlus, IconSearch } from '@tabler/icons-react';
|
import { IconDeviceImac, IconPlus, IconSearch } from '@tabler/icons-react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
@@ -45,69 +46,105 @@ function KolaborasiInovasi() {
|
|||||||
function ListKolaborasiInovasi({ search }: { search: string }) {
|
function ListKolaborasiInovasi({ search }: { search: string }) {
|
||||||
const listState = useProxy(kolaborasiInovasiState);
|
const listState = useProxy(kolaborasiInovasiState);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const [debouncedSearch] = useDebouncedValue(search, 1000);
|
||||||
const { data, loading, page, totalPages, load } = listState.findMany;
|
const { data, loading, page, totalPages, load } = listState.findMany;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
load(page, 10, search);
|
load(page, 10, debouncedSearch);
|
||||||
}, [page, search]);
|
}, [page, debouncedSearch]);
|
||||||
|
|
||||||
const filteredData = data || [];
|
const filteredData = data || [];
|
||||||
|
|
||||||
if (loading || !data) {
|
if (loading || !data) {
|
||||||
return (
|
return (
|
||||||
<Stack py={10}>
|
<Stack py={{ base: 'xs', md: 'md' }}>
|
||||||
<Skeleton height={600} radius="md" />
|
<Skeleton height={600} radius="md" />
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Box py={{ base: 'xs', md: 'md' }}>
|
||||||
<Paper withBorder bg={colors['white-1']} p="lg" shadow="md" radius="md">
|
<Paper withBorder bg={colors['white-1']} p={{ base: 'sm', md: 'lg' }} shadow="md" radius="md">
|
||||||
<Group justify="space-between" mb="md">
|
<Group justify="space-between" mb={{ base: 'sm', md: 'md' }}>
|
||||||
<Title order={4}>Daftar Kolaborasi Inovasi</Title>
|
<Title order={4} lh={1.2}>
|
||||||
|
Daftar Kolaborasi Inovasi
|
||||||
|
</Title>
|
||||||
<Button
|
<Button
|
||||||
leftSection={<IconPlus size={18} />}
|
leftSection={<IconPlus size={18} />}
|
||||||
color="blue"
|
color="blue"
|
||||||
variant="light"
|
variant="light"
|
||||||
onClick={() => router.push('/admin/inovasi/kolaborasi-inovasi/list-kolaborasi-inovasi/create')}
|
onClick={() =>
|
||||||
|
router.push('/admin/inovasi/kolaborasi-inovasi/list-kolaborasi-inovasi/create')
|
||||||
|
}
|
||||||
>
|
>
|
||||||
Tambah Baru
|
Tambah Baru
|
||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
<Box style={{ overflowX: 'auto' }}>
|
|
||||||
<Table highlightOnHover>
|
{/* Desktop Table */}
|
||||||
|
<Box visibleFrom="md">
|
||||||
|
<Table
|
||||||
|
highlightOnHover
|
||||||
|
miw={0}
|
||||||
|
style={{
|
||||||
|
tableLayout: 'fixed',
|
||||||
|
width: '100%',
|
||||||
|
}}
|
||||||
|
>
|
||||||
<TableThead>
|
<TableThead>
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTh style={{ width: '5%' }}>No</TableTh>
|
<TableTh style={{ width: '5%' }}>
|
||||||
<TableTh style={{ width: '25%' }}>Nama Kolaborasi Inovasi</TableTh>
|
<Text fz="xs" fw={600} lh={1.4} ta="center">
|
||||||
<TableTh style={{ width: '15%' }}>Tahun</TableTh>
|
No
|
||||||
<TableTh style={{ width: '35%' }}>Deskripsi Singkat</TableTh>
|
</Text>
|
||||||
<TableTh style={{ width: '10%' }}>Aksi</TableTh>
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '25%' }}>
|
||||||
|
<Text fz="xs" fw={600} lh={1.4}>
|
||||||
|
Nama Kolaborasi Inovasi
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '15%' }}>
|
||||||
|
<Text fz="xs" fw={600} lh={1.4} ta="center">
|
||||||
|
Tahun
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '35%' }}>
|
||||||
|
<Text fz="xs" fw={600} lh={1.4}>
|
||||||
|
Deskripsi Singkat
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '10%' }}>
|
||||||
|
<Text fz="xs" fw={600} lh={1.4} ta="center">
|
||||||
|
Aksi
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
</TableTr>
|
</TableTr>
|
||||||
</TableThead>
|
</TableThead>
|
||||||
<TableTbody>
|
<TableTbody>
|
||||||
{filteredData.length > 0 ? (
|
{filteredData.length > 0 ? (
|
||||||
filteredData.map((item, index) => (
|
filteredData.map((item, index) => (
|
||||||
<TableTr key={item.id}>
|
<TableTr key={item.id}>
|
||||||
<TableTd>{index + 1}</TableTd>
|
<TableTd ta="center">
|
||||||
<TableTd>
|
<Text fz="sm" fw={500} lh={1.45}>
|
||||||
<Text fw={500} truncate="end" lineClamp={1}>
|
{index + 1}
|
||||||
{item.name}
|
|
||||||
</Text>
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
<Text fz="sm" c="dimmed">
|
<Text fz="sm" fw={500} lh={1.45} truncate="end" lineClamp={1}>
|
||||||
|
{item.name}
|
||||||
|
</Text>
|
||||||
|
</TableTd>
|
||||||
|
<TableTd ta="center">
|
||||||
|
<Text fz="sm" fw={500} lh={1.45}>
|
||||||
{item.tahun}
|
{item.tahun}
|
||||||
</Text>
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
<Text fz="sm" truncate="end" lineClamp={1} c="dimmed">
|
<Text dangerouslySetInnerHTML={{ __html: item.slug }} fz="sm" fw={500} lh={1.45} truncate="end" lineClamp={1} />
|
||||||
{item.slug}
|
|
||||||
</Text>
|
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd ta="center">
|
||||||
<Button
|
<Button
|
||||||
size="xs"
|
size="xs"
|
||||||
radius="md"
|
radius="md"
|
||||||
@@ -115,7 +152,9 @@ function ListKolaborasiInovasi({ search }: { search: string }) {
|
|||||||
color="blue"
|
color="blue"
|
||||||
leftSection={<IconDeviceImac size={16} />}
|
leftSection={<IconDeviceImac size={16} />}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
router.push(`/admin/inovasi/kolaborasi-inovasi/list-kolaborasi-inovasi/${item.id}`)
|
router.push(
|
||||||
|
`/admin/inovasi/kolaborasi-inovasi/list-kolaborasi-inovasi/${item.id}`
|
||||||
|
)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
Detail
|
Detail
|
||||||
@@ -127,7 +166,9 @@ function ListKolaborasiInovasi({ search }: { search: string }) {
|
|||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTd colSpan={5}>
|
<TableTd colSpan={5}>
|
||||||
<Center py={20}>
|
<Center py={20}>
|
||||||
<Text color="dimmed">Tidak ada data kolaborasi inovasi yang tersedia</Text>
|
<Text c="dimmed" fz="sm" lh={1.4}>
|
||||||
|
Tidak ada data kolaborasi inovasi yang tersedia
|
||||||
|
</Text>
|
||||||
</Center>
|
</Center>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
</TableTr>
|
</TableTr>
|
||||||
@@ -135,7 +176,76 @@ function ListKolaborasiInovasi({ search }: { search: string }) {
|
|||||||
</TableTbody>
|
</TableTbody>
|
||||||
</Table>
|
</Table>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
{/* Mobile Card View */}
|
||||||
|
<Box hiddenFrom="md">
|
||||||
|
<Stack gap="sm">
|
||||||
|
{filteredData.length > 0 ? (
|
||||||
|
filteredData.map((item, index) => (
|
||||||
|
<Paper key={item.id} withBorder radius="md" p="sm">
|
||||||
|
<Stack gap={"xs"}>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
No
|
||||||
|
</Text>
|
||||||
|
<Text fz="sm" fw={500} lh={1.4}>
|
||||||
|
{index + 1}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
Nama Kolaborasi Inovasi
|
||||||
|
</Text>
|
||||||
|
<Text fz="sm" fw={500} lh={1.4}>
|
||||||
|
{item.name}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
Tahun
|
||||||
|
</Text>
|
||||||
|
<Text fz="sm" fw={500} lh={1.4}>
|
||||||
|
{item.tahun}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
Deskripsi Singkat
|
||||||
|
</Text>
|
||||||
|
<Text dangerouslySetInnerHTML={{ __html: item.slug }} fz="sm" fw={500} lh={1.45} truncate="end" lineClamp={1} />
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Button
|
||||||
|
fullWidth
|
||||||
|
size="xs"
|
||||||
|
radius="md"
|
||||||
|
variant="light"
|
||||||
|
color="blue"
|
||||||
|
leftSection={<IconDeviceImac size={16} />}
|
||||||
|
onClick={() =>
|
||||||
|
router.push(
|
||||||
|
`/admin/inovasi/kolaborasi-inovasi/list-kolaborasi-inovasi/${item.id}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
Detail
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
</Stack>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<Center py={20}>
|
||||||
|
<Text c="dimmed" fz="sm" lh={1.4}>
|
||||||
|
Tidak ada data kolaborasi inovasi yang tersedia
|
||||||
|
</Text>
|
||||||
|
</Center>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
</Box>
|
||||||
|
</Paper>
|
||||||
|
|
||||||
|
{totalPages > 1 && (
|
||||||
<Center>
|
<Center>
|
||||||
<Pagination
|
<Pagination
|
||||||
value={page}
|
value={page}
|
||||||
@@ -144,12 +254,13 @@ function ListKolaborasiInovasi({ search }: { search: string }) {
|
|||||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||||
}}
|
}}
|
||||||
total={totalPages}
|
total={totalPages}
|
||||||
mt="md"
|
mt={{ base: 'sm', md: 'md' }}
|
||||||
mb="md"
|
mb={{ base: 'sm', md: 'md' }}
|
||||||
color="blue"
|
color="blue"
|
||||||
radius="md"
|
radius="md"
|
||||||
/>
|
/>
|
||||||
</Center>
|
</Center>
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ function EditMitraKolaborasi() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ function CreateMitraKolaborasi() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Back Button + Title */}
|
{/* Back Button + Title */}
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
TableThead,
|
TableThead,
|
||||||
TableTr,
|
TableTr,
|
||||||
Text,
|
Text,
|
||||||
Title
|
Title,
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import { IconEdit, IconPlus, IconSearch, IconX } from '@tabler/icons-react';
|
import { IconEdit, IconPlus, IconSearch, IconX } from '@tabler/icons-react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
@@ -27,6 +27,7 @@ import { useProxy } from 'valtio/utils';
|
|||||||
import HeaderSearch from '../../../_com/header';
|
import HeaderSearch from '../../../_com/header';
|
||||||
import { ModalKonfirmasiHapus } from '../../../_com/modalKonfirmasiHapus';
|
import { ModalKonfirmasiHapus } from '../../../_com/modalKonfirmasiHapus';
|
||||||
import mitraKolaborasi from '../../../_state/inovasi/mitra-kolaborasi';
|
import mitraKolaborasi from '../../../_state/inovasi/mitra-kolaborasi';
|
||||||
|
import { useDebouncedValue } from '@mantine/hooks';
|
||||||
|
|
||||||
function MitraKolaborasi() {
|
function MitraKolaborasi() {
|
||||||
const [search, setSearch] = useState('');
|
const [search, setSearch] = useState('');
|
||||||
@@ -59,27 +60,34 @@ function ListMitraKolaborasi({ search }: { search: string }) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const [debouncedSearch] = useDebouncedValue(search, 1000);
|
||||||
|
|
||||||
const { data, loading, page, totalPages, load } = listState.findMany;
|
const { data, loading, page, totalPages, load } = listState.findMany;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
load(page, 10, search);
|
load(page, 10, debouncedSearch);
|
||||||
}, [page, search]);
|
}, [page, debouncedSearch]);
|
||||||
|
|
||||||
const filteredData = data || [];
|
const filteredData = data || [];
|
||||||
|
|
||||||
if (loading || !data) {
|
if (loading || !data) {
|
||||||
return (
|
return (
|
||||||
<Stack py={10}>
|
<Stack py="lg">
|
||||||
<Skeleton height={600} radius="md" />
|
<Skeleton height={600} radius="md" />
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Box py="lg">
|
||||||
<Paper withBorder bg={colors['white-1']} p="lg" shadow="md" radius="md">
|
<Paper withBorder bg={colors['white-1']} p="lg" shadow="md" radius="md">
|
||||||
<Group justify="space-between" mb="md">
|
<Group justify="space-between" mb="lg">
|
||||||
<Title order={4}>Daftar Mitra Kolaborasi</Title>
|
<Title
|
||||||
|
order={4}
|
||||||
|
lh={{ base: 1.2, md: 1.15 }}
|
||||||
|
>
|
||||||
|
Daftar Mitra Kolaborasi
|
||||||
|
</Title>
|
||||||
<Button
|
<Button
|
||||||
leftSection={<IconPlus size={18} />}
|
leftSection={<IconPlus size={18} />}
|
||||||
color="blue"
|
color="blue"
|
||||||
@@ -93,41 +101,82 @@ function ListMitraKolaborasi({ search }: { search: string }) {
|
|||||||
Tambah Baru
|
Tambah Baru
|
||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
<Box style={{ overflowX: 'auto' }}>
|
|
||||||
<Table highlightOnHover>
|
{/* Desktop Table */}
|
||||||
|
<Box visibleFrom="md">
|
||||||
|
<Table
|
||||||
|
highlightOnHover
|
||||||
|
miw={0}
|
||||||
|
style={{
|
||||||
|
tableLayout: 'fixed',
|
||||||
|
width: '100%',
|
||||||
|
}}
|
||||||
|
>
|
||||||
<TableThead>
|
<TableThead>
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTh style={{ width: '10%' }}>No</TableTh>
|
<TableTh style={{ width: '10%' }}>
|
||||||
<TableTh style={{ width: '30%' }}>Nama Mitra</TableTh>
|
<Text fz={{ base: 'sm', md: 'md' }} fw={600} lh={1.4}>
|
||||||
<TableTh style={{ width: '25%' }}>Image</TableTh>
|
No
|
||||||
<TableTh style={{ width: '15%' }}>Delete</TableTh>
|
</Text>
|
||||||
<TableTh style={{ width: '15%' }}>Edit</TableTh>
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '30%' }}>
|
||||||
|
<Text fz={{ base: 'sm', md: 'md' }} fw={600} lh={1.4}>
|
||||||
|
Nama Mitra
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '25%' }}>
|
||||||
|
<Text fz={{ base: 'sm', md: 'md' }} fw={600} lh={1.4}>
|
||||||
|
Image
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '15%' }}>
|
||||||
|
<Text fz={{ base: 'sm', md: 'md' }} fw={600} lh={1.4}>
|
||||||
|
Delete
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '15%' }}>
|
||||||
|
<Text fz={{ base: 'sm', md: 'md' }} fw={600} lh={1.4}>
|
||||||
|
Edit
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
</TableTr>
|
</TableTr>
|
||||||
</TableThead>
|
</TableThead>
|
||||||
<TableTbody>
|
<TableTbody>
|
||||||
{filteredData.length > 0 ? (
|
{filteredData.length > 0 ? (
|
||||||
filteredData.map((item, index) => (
|
filteredData.map((item, index) => (
|
||||||
<TableTr key={item.id}>
|
<TableTr key={item.id}>
|
||||||
<TableTd>{index + 1}</TableTd>
|
|
||||||
<TableTd>
|
<TableTd>
|
||||||
<Text fw={500} truncate="end" lineClamp={1}>
|
<Text fz={{ base: 'xs', md: 'sm' }} fw={500} lh={1.5}>
|
||||||
|
{index + 1}
|
||||||
|
</Text>
|
||||||
|
</TableTd>
|
||||||
|
<TableTd>
|
||||||
|
<Text
|
||||||
|
fz={{ base: 'sm', md: 'md' }}
|
||||||
|
fw={500}
|
||||||
|
lh={1.5}
|
||||||
|
truncate="end"
|
||||||
|
lineClamp={1}
|
||||||
|
>
|
||||||
{item.name}
|
{item.name}
|
||||||
</Text>
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
<Box
|
<Box w={70} h={70}>
|
||||||
w={70}
|
|
||||||
h={70}
|
|
||||||
>
|
|
||||||
{item.image?.link ? (
|
{item.image?.link ? (
|
||||||
<Image
|
<Image
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
src={item.image.link}
|
src={item.image.link}
|
||||||
alt={item.name}
|
alt={item.name}
|
||||||
fit="cover"
|
fit="cover"
|
||||||
|
radius="sm"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<Box bg={colors['blue-button']} w="100%" h="100%" />
|
<Box
|
||||||
|
bg={colors['blue-button']}
|
||||||
|
w="100%"
|
||||||
|
h="100%"
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
@@ -167,8 +216,8 @@ function ListMitraKolaborasi({ search }: { search: string }) {
|
|||||||
) : (
|
) : (
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTd colSpan={5}>
|
<TableTd colSpan={5}>
|
||||||
<Center py={20}>
|
<Center py="xl">
|
||||||
<Text color="dimmed">
|
<Text c="dimmed" fz="sm" ta="center">
|
||||||
Tidak ada data mitra kolaborasi yang tersedia
|
Tidak ada data mitra kolaborasi yang tersedia
|
||||||
</Text>
|
</Text>
|
||||||
</Center>
|
</Center>
|
||||||
@@ -178,7 +227,96 @@ function ListMitraKolaborasi({ search }: { search: string }) {
|
|||||||
</TableTbody>
|
</TableTbody>
|
||||||
</Table>
|
</Table>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
{/* Mobile Card View */}
|
||||||
|
<Box hiddenFrom="md">
|
||||||
|
<Stack gap="xs">
|
||||||
|
{filteredData.length > 0 ? (
|
||||||
|
filteredData.map((item, index) => (
|
||||||
|
<Paper key={item.id} withBorder p="md" radius="md">
|
||||||
|
<Stack gap={"xs"}>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
No
|
||||||
|
</Text>
|
||||||
|
<Text fz="sm" fw={500} lh={1.4}>
|
||||||
|
{index + 1}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
Nama Mitra
|
||||||
|
</Text>
|
||||||
|
<Text fz="sm" fw={500} lh={1.4}>
|
||||||
|
{item.name}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
Image
|
||||||
|
</Text>
|
||||||
|
<Box w="100%" h={60} mt="xs">
|
||||||
|
{item.image?.link ? (
|
||||||
|
<Image
|
||||||
|
loading="lazy"
|
||||||
|
src={item.image.link}
|
||||||
|
alt={item.name}
|
||||||
|
fit="cover"
|
||||||
|
radius="sm"
|
||||||
|
h="100%"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<Box
|
||||||
|
bg={colors['blue-button']}
|
||||||
|
w="100%"
|
||||||
|
h="100%"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
<Group justify="flex-end" mt="md" gap="xs">
|
||||||
|
<Button
|
||||||
|
size="xs"
|
||||||
|
radius="md"
|
||||||
|
variant="light"
|
||||||
|
color="red"
|
||||||
|
disabled={mitraKolaborasi.delete.loading || !item}
|
||||||
|
onClick={() => {
|
||||||
|
setSelectedId(item.id);
|
||||||
|
setModalHapus(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<IconX size={16} />
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
size="xs"
|
||||||
|
radius="md"
|
||||||
|
variant="light"
|
||||||
|
color="green"
|
||||||
|
disabled={!item}
|
||||||
|
onClick={() =>
|
||||||
|
router.push(
|
||||||
|
`/admin/inovasi/kolaborasi-inovasi/mitra-kolaborasi/${item.id}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<IconEdit size={16} />
|
||||||
|
</Button>
|
||||||
|
</Group>
|
||||||
|
</Stack>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<Center py="xl">
|
||||||
|
<Text c="dimmed" fz="sm" ta="center">
|
||||||
|
Tidak ada data mitra kolaborasi yang tersedia
|
||||||
|
</Text>
|
||||||
|
</Center>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
</Box>
|
||||||
|
</Paper>
|
||||||
|
|
||||||
<Center>
|
<Center>
|
||||||
<Pagination
|
<Pagination
|
||||||
value={page}
|
value={page}
|
||||||
@@ -187,14 +325,13 @@ function ListMitraKolaborasi({ search }: { search: string }) {
|
|||||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||||
}}
|
}}
|
||||||
total={totalPages}
|
total={totalPages}
|
||||||
mt="md"
|
mt="lg"
|
||||||
mb="md"
|
mb="lg"
|
||||||
color="blue"
|
color="blue"
|
||||||
radius="md"
|
radius="md"
|
||||||
/>
|
/>
|
||||||
</Center>
|
</Center>
|
||||||
|
|
||||||
{/* Modal Konfirmasi Hapus */}
|
|
||||||
<ModalKonfirmasiHapus
|
<ModalKonfirmasiHapus
|
||||||
opened={modalHapus}
|
opened={modalHapus}
|
||||||
onClose={() => setModalHapus(false)}
|
onClose={() => setModalHapus(false)}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import colors from '@/con/colors';
|
import colors from '@/con/colors';
|
||||||
import {
|
import {
|
||||||
|
Box,
|
||||||
ScrollArea,
|
ScrollArea,
|
||||||
Stack,
|
Stack,
|
||||||
Tabs,
|
Tabs,
|
||||||
@@ -84,6 +85,7 @@ function LayoutTabsLayananOnlineDesa({ children }: { children: React.ReactNode }
|
|||||||
keepMounted={false}
|
keepMounted={false}
|
||||||
>
|
>
|
||||||
{/* ✅ Scroll horizontal biar gak overflow */}
|
{/* ✅ Scroll horizontal biar gak overflow */}
|
||||||
|
<Box visibleFrom='md' pb={10}>
|
||||||
<ScrollArea type="auto" offsetScrollbars>
|
<ScrollArea type="auto" offsetScrollbars>
|
||||||
<TabsList
|
<TabsList
|
||||||
p="sm"
|
p="sm"
|
||||||
@@ -94,7 +96,7 @@ function LayoutTabsLayananOnlineDesa({ children }: { children: React.ReactNode }
|
|||||||
display: "flex",
|
display: "flex",
|
||||||
flexWrap: "nowrap",
|
flexWrap: "nowrap",
|
||||||
gap: "0.5rem",
|
gap: "0.5rem",
|
||||||
paddingInline: "0.5rem",
|
paddingInline: "0.5rem", // ✅ biar nggak nempel ke tepi
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{tabs.map((tab, i) => (
|
{tabs.map((tab, i) => (
|
||||||
@@ -106,6 +108,7 @@ function LayoutTabsLayananOnlineDesa({ children }: { children: React.ReactNode }
|
|||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
fontSize: "0.9rem",
|
fontSize: "0.9rem",
|
||||||
transition: "all 0.2s ease",
|
transition: "all 0.2s ease",
|
||||||
|
flexShrink: 0, // ✅ jangan mengecil aneh-aneh
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{tab.label}
|
{tab.label}
|
||||||
@@ -113,7 +116,45 @@ function LayoutTabsLayananOnlineDesa({ children }: { children: React.ReactNode }
|
|||||||
))}
|
))}
|
||||||
</TabsList>
|
</TabsList>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
<Box hiddenFrom='md' pb={10}>
|
||||||
|
<ScrollArea
|
||||||
|
type="auto"
|
||||||
|
offsetScrollbars={false}
|
||||||
|
w="100%"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TabsList
|
||||||
|
p="xs" // lebih kecil
|
||||||
|
style={{
|
||||||
|
background: "linear-gradient(135deg, #e7ebf7, #f9faff)",
|
||||||
|
borderRadius: "1rem",
|
||||||
|
display: "flex",
|
||||||
|
flexWrap: "nowrap",
|
||||||
|
gap: "0.5rem",
|
||||||
|
width: "max-content", // ⬅️ kunci
|
||||||
|
maxWidth: "100%", // ⬅️ penting
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{tabs.map((tab, i) => (
|
||||||
|
<TabsTab
|
||||||
|
key={i}
|
||||||
|
value={tab.value}
|
||||||
|
leftSection={tab.icon}
|
||||||
|
style={{
|
||||||
|
fontWeight: 600,
|
||||||
|
fontSize: "0.9rem",
|
||||||
|
paddingInline: "0.75rem", // ⬅️ lebih ramping
|
||||||
|
flexShrink: 0, // ✅ jangan mengecil aneh-aneh
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{tab.label}
|
||||||
|
</TabsTab>
|
||||||
|
))}
|
||||||
|
</TabsList>
|
||||||
|
</ScrollArea>
|
||||||
|
</Box>
|
||||||
{tabs.map((tab, i) => (
|
{tabs.map((tab, i) => (
|
||||||
<TabsPanel
|
<TabsPanel
|
||||||
key={i}
|
key={i}
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ function DetailAdministrasiOnline() {
|
|||||||
const data = stateAdminOnline.findUnique.data;
|
const data = stateAdminOnline.findUnique.data;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
<Group justify='space-between' align='center' w={{ base: "100%", md: "50%" }} mb={10}>
|
<Group justify='space-between' align='center' w={{ base: "100%", md: "70%" }} mb={10}>
|
||||||
{/* Tombol Kembali */}
|
{/* Tombol Kembali */}
|
||||||
<Button
|
<Button
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
Title
|
Title
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useDebouncedValue, useShallowEffect } from '@mantine/hooks';
|
||||||
import { IconDeviceImac, IconSearch } from '@tabler/icons-react';
|
import { IconDeviceImac, IconSearch } from '@tabler/icons-react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
@@ -44,36 +44,55 @@ function AdministrasiOnline() {
|
|||||||
function ListAdministrasiOnline({ search }: { search: string }) {
|
function ListAdministrasiOnline({ search }: { search: string }) {
|
||||||
const state = useProxy(layananonlineDesa.administrasiOnline);
|
const state = useProxy(layananonlineDesa.administrasiOnline);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const [debouncedSearch] = useDebouncedValue(search, 1000);
|
||||||
|
|
||||||
const { data, page, totalPages, loading, load } = state.findMany;
|
const { data, page, totalPages, loading, load } = state.findMany;
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
load(page, 10, search);
|
load(page, 10, debouncedSearch);
|
||||||
}, [page, search]);
|
}, [page, debouncedSearch]);
|
||||||
|
|
||||||
const filteredData = data || [];
|
const filteredData = data || [];
|
||||||
|
|
||||||
if (loading || !data) {
|
if (loading || !data) {
|
||||||
return (
|
return (
|
||||||
<Stack py={10}>
|
<Stack py={{ base: 'sm', md: 'md' }}>
|
||||||
<Skeleton height={600} radius="md" />
|
<Skeleton height={600} radius="md" />
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Box py={{ base: 'sm', md: 'md' }}>
|
||||||
<Paper withBorder bg={colors['white-1']} p="lg" shadow="md" radius="md">
|
<Paper withBorder bg={colors['white-1']} p={{ base: 'md', md: 'lg' }} shadow="md" radius="md">
|
||||||
<Title order={4}>Daftar Administrasi Online</Title>
|
<Title order={4} lh={1.2} mb={{ base: 'md', md: 'lg' }}>
|
||||||
|
Daftar Administrasi Online
|
||||||
|
</Title>
|
||||||
|
|
||||||
<Box style={{ overflowX: 'auto' }}>
|
{/* Desktop Table */}
|
||||||
<Table highlightOnHover>
|
<Box visibleFrom="md">
|
||||||
|
<Table
|
||||||
|
highlightOnHover
|
||||||
|
miw={0}
|
||||||
|
style={{
|
||||||
|
tableLayout: 'fixed',
|
||||||
|
width: '100%',
|
||||||
|
}}
|
||||||
|
>
|
||||||
<TableThead>
|
<TableThead>
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTh style={{ width: '25%' }}>Nama</TableTh>
|
<TableTh style={{ width: '25%' }}>
|
||||||
<TableTh style={{ width: '25%' }}>Alamat</TableTh>
|
<Text fz="sm" fw={600} lh={1.4}>Nama</Text>
|
||||||
<TableTh style={{ width: '20%' }}>Nomor Telepon</TableTh>
|
</TableTh>
|
||||||
<TableTh style={{ width: '15%' }}>Aksi</TableTh>
|
<TableTh style={{ width: '25%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>Alamat</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '20%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>Nomor Telepon</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '15%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>Aksi</Text>
|
||||||
|
</TableTh>
|
||||||
</TableTr>
|
</TableTr>
|
||||||
</TableThead>
|
</TableThead>
|
||||||
<TableTbody>
|
<TableTbody>
|
||||||
@@ -81,17 +100,17 @@ function ListAdministrasiOnline({ search }: { search: string }) {
|
|||||||
filteredData.map((item) => (
|
filteredData.map((item) => (
|
||||||
<TableTr key={item.id}>
|
<TableTr key={item.id}>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
<Text fw={500} truncate="end" lineClamp={1}>
|
<Text fz="md" fw={500} lh={1.5} truncate="end" lineClamp={1}>
|
||||||
{item.name}
|
{item.name}
|
||||||
</Text>
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
<Text fz="sm" c="dimmed" lineClamp={1}>
|
<Text fz="sm" c="gray.7" lh={1.5} lineClamp={1}>
|
||||||
{item.alamat}
|
{item.alamat}
|
||||||
</Text>
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
<Text fz="sm" c="dimmed" lineClamp={1}>
|
<Text fz="sm" c="gray.7" lh={1.5} lineClamp={1}>
|
||||||
{item.nomorTelepon || '-'}
|
{item.nomorTelepon || '-'}
|
||||||
</Text>
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
@@ -116,8 +135,10 @@ function ListAdministrasiOnline({ search }: { search: string }) {
|
|||||||
) : (
|
) : (
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTd colSpan={4}>
|
<TableTd colSpan={4}>
|
||||||
<Center py={20}>
|
<Center py={24}>
|
||||||
<Text color="dimmed">Tidak ada data administrasi online yang cocok</Text>
|
<Text c="gray.6" fz="sm" lh={1.4}>
|
||||||
|
Tidak ada data administrasi online yang cocok
|
||||||
|
</Text>
|
||||||
</Center>
|
</Center>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
</TableTr>
|
</TableTr>
|
||||||
@@ -125,6 +146,55 @@ function ListAdministrasiOnline({ search }: { search: string }) {
|
|||||||
</TableTbody>
|
</TableTbody>
|
||||||
</Table>
|
</Table>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
{/* Mobile Cards */}
|
||||||
|
<Box hiddenFrom="md">
|
||||||
|
<Stack gap="md">
|
||||||
|
{filteredData.length > 0 ? (
|
||||||
|
filteredData.map((item) => (
|
||||||
|
<Paper key={item.id} p="md" withBorder>
|
||||||
|
<Stack gap={"xs"}>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>Nama</Text>
|
||||||
|
<Text fz="sm" fw={500} lh={1.5}>{item.name}</Text>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>Alamat</Text>
|
||||||
|
<Text fz="sm" fw={500} c="gray.7" lh={1.5}>{item.alamat}</Text>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>Nomor Telepon</Text>
|
||||||
|
<Text fz="sm" fw={500} c="gray.7" lh={1.5}>{item.nomorTelepon || '-'}</Text>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Button
|
||||||
|
size="xs"
|
||||||
|
radius="md"
|
||||||
|
variant="light"
|
||||||
|
color="blue"
|
||||||
|
leftSection={<IconDeviceImac size={16} />}
|
||||||
|
onClick={() =>
|
||||||
|
router.push(
|
||||||
|
`/admin/inovasi/layanan-online-desa/administrasi-online/${item.id}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
|
Detail
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<Center py={24}>
|
||||||
|
<Text c="gray.6" fz="sm" lh={1.4}>
|
||||||
|
Tidak ada data administrasi online yang cocok
|
||||||
|
</Text>
|
||||||
|
</Center>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
</Box>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
|
||||||
<Center>
|
<Center>
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ function EditJenisLayanan() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ function DetailJenisLayanan() {
|
|||||||
const data = state.findUnique.data
|
const data = state.findUnique.data
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Tombol kembali */}
|
{/* Tombol kembali */}
|
||||||
<Button
|
<Button
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
@@ -54,7 +54,7 @@ function DetailJenisLayanan() {
|
|||||||
{/* Card utama */}
|
{/* Card utama */}
|
||||||
<Paper
|
<Paper
|
||||||
withBorder
|
withBorder
|
||||||
w={{ base: "100%", md: "60%" }}
|
w={{ base: "100%", md: "70%" }}
|
||||||
bg={colors['white-1']}
|
bg={colors['white-1']}
|
||||||
p="lg"
|
p="lg"
|
||||||
radius="md"
|
radius="md"
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ function CreateJenisLayanan() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Header dengan tombol back */}
|
{/* Header dengan tombol back */}
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -16,9 +16,10 @@ import {
|
|||||||
TableThead,
|
TableThead,
|
||||||
TableTr,
|
TableTr,
|
||||||
Text,
|
Text,
|
||||||
Title
|
Title,
|
||||||
|
useMantineTheme
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useDebouncedValue, useShallowEffect } from '@mantine/hooks';
|
||||||
import { IconDeviceImac, IconPlus, IconSearch } from '@tabler/icons-react';
|
import { IconDeviceImac, IconPlus, IconSearch } from '@tabler/icons-react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
@@ -45,28 +46,35 @@ function JenisLayanan() {
|
|||||||
function ListJenisLayanan({ search }: { search: string }) {
|
function ListJenisLayanan({ search }: { search: string }) {
|
||||||
const stateList = useProxy(layananonlineDesa.jenisLayanan);
|
const stateList = useProxy(layananonlineDesa.jenisLayanan);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const [debouncedSearch] = useDebouncedValue(search, 1000);
|
||||||
|
|
||||||
const { data, page, totalPages, loading, load } = stateList.findMany;
|
const { data, page, totalPages, loading, load } = stateList.findMany;
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
load(page, 10, search);
|
load(page, 10, debouncedSearch);
|
||||||
}, [page, search]);
|
}, [page, debouncedSearch]);
|
||||||
|
|
||||||
const filteredData = data || [];
|
const filteredData = data || [];
|
||||||
|
const theme = useMantineTheme();
|
||||||
|
|
||||||
if (loading || !data) {
|
if (loading || !data) {
|
||||||
return (
|
return (
|
||||||
<Stack py={10}>
|
<Stack py="lg">
|
||||||
<Skeleton height={600} radius="md" />
|
<Skeleton height={600} radius="md" />
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Stack py="lg" gap="xl">
|
||||||
<Paper withBorder bg={colors['white-1']} p="lg" shadow="md" radius="md">
|
<Paper withBorder bg={colors['white-1']} p="lg" shadow="md" radius="md">
|
||||||
<Group justify="space-between" mb="md">
|
<Group justify="space-between" mb="md">
|
||||||
<Title order={4}>Daftar Jenis Layanan</Title>
|
<Title
|
||||||
|
order={4}
|
||||||
|
lh={{ base: 1.2, md: 1.15 }}
|
||||||
|
>
|
||||||
|
Daftar Jenis Layanan
|
||||||
|
</Title>
|
||||||
<Button
|
<Button
|
||||||
leftSection={<IconPlus size={18} />}
|
leftSection={<IconPlus size={18} />}
|
||||||
color="blue"
|
color="blue"
|
||||||
@@ -80,13 +88,34 @@ function ListJenisLayanan({ search }: { search: string }) {
|
|||||||
Tambah Baru
|
Tambah Baru
|
||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
<Box style={{ overflowX: 'auto' }}>
|
|
||||||
<Table highlightOnHover>
|
{/* Desktop Table */}
|
||||||
|
<Box visibleFrom="md">
|
||||||
|
<Table
|
||||||
|
highlightOnHover
|
||||||
|
miw={0}
|
||||||
|
style={{
|
||||||
|
tableLayout: 'fixed',
|
||||||
|
width: '100%',
|
||||||
|
}}
|
||||||
|
>
|
||||||
<TableThead>
|
<TableThead>
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTh style={{ width: '30%' }}>Nama Jenis Layanan</TableTh>
|
<TableTh style={{ width: '30%' }}>
|
||||||
<TableTh style={{ width: '40%' }}>Deskripsi</TableTh>
|
<Text fz="sm" fw={600} lh={1.4} c={theme.black}>
|
||||||
<TableTh style={{ width: '15%' }}>Aksi</TableTh>
|
Nama Jenis Layanan
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '55%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4} c={theme.black}>
|
||||||
|
Deskripsi
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '15%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4} ta="center" c={theme.black}>
|
||||||
|
Aksi
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
</TableTr>
|
</TableTr>
|
||||||
</TableThead>
|
</TableThead>
|
||||||
<TableTbody>
|
<TableTbody>
|
||||||
@@ -94,16 +123,28 @@ function ListJenisLayanan({ search }: { search: string }) {
|
|||||||
filteredData.map((item) => (
|
filteredData.map((item) => (
|
||||||
<TableTr key={item.id}>
|
<TableTr key={item.id}>
|
||||||
<TableTd style={{ width: '30%' }}>
|
<TableTd style={{ width: '30%' }}>
|
||||||
<Text fw={500} truncate="end" lineClamp={1}>
|
<Text
|
||||||
|
fz="md"
|
||||||
|
fw={500}
|
||||||
|
lh={1.5}
|
||||||
|
c={theme.black}
|
||||||
|
truncate="end"
|
||||||
|
lineClamp={1}
|
||||||
|
>
|
||||||
{item.nama}
|
{item.nama}
|
||||||
</Text>
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd style={{ width: '40%' }}>
|
<TableTd style={{ width: '55%' }}>
|
||||||
<Text fz="sm" c="dimmed" lineClamp={2}>
|
<Text
|
||||||
{item.deskripsi || '-'}
|
fz="sm"
|
||||||
</Text>
|
fw={500}
|
||||||
|
lh={1.5}
|
||||||
|
c={theme.black}
|
||||||
|
lineClamp={2}
|
||||||
|
dangerouslySetInnerHTML={{ __html: item.deskripsi || '-' }}
|
||||||
|
/>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd style={{ width: '15%' }}>
|
<TableTd style={{ width: '15%' }} ta="center">
|
||||||
<Button
|
<Button
|
||||||
size="xs"
|
size="xs"
|
||||||
radius="md"
|
radius="md"
|
||||||
@@ -124,8 +165,8 @@ function ListJenisLayanan({ search }: { search: string }) {
|
|||||||
) : (
|
) : (
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTd colSpan={3}>
|
<TableTd colSpan={3}>
|
||||||
<Center py={20}>
|
<Center py="xl">
|
||||||
<Text color="dimmed">
|
<Text c="dimmed" fz="sm" lh={1.4}>
|
||||||
Tidak ada jenis layanan yang cocok
|
Tidak ada jenis layanan yang cocok
|
||||||
</Text>
|
</Text>
|
||||||
</Center>
|
</Center>
|
||||||
@@ -135,7 +176,65 @@ function ListJenisLayanan({ search }: { search: string }) {
|
|||||||
</TableTbody>
|
</TableTbody>
|
||||||
</Table>
|
</Table>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
{/* Mobile Cards */}
|
||||||
|
<Box hiddenFrom="md">
|
||||||
|
<Stack gap="sm">
|
||||||
|
{filteredData.length > 0 ? (
|
||||||
|
filteredData.map((item) => (
|
||||||
|
<Paper key={item.id} withBorder radius="md" p="md">
|
||||||
|
<Stack gap="xs">
|
||||||
|
<Box pl={5}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4} c={theme.black}>
|
||||||
|
Nama Jenis Layanan
|
||||||
|
</Text>
|
||||||
|
<Text fz="sm" fw={500} lh={1.5} c={theme.black}>
|
||||||
|
{item.nama}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
<Box pl={5}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4} c={theme.black}>
|
||||||
|
Deskripsi
|
||||||
|
</Text>
|
||||||
|
<Text
|
||||||
|
fz="sm"
|
||||||
|
fw={500}
|
||||||
|
lh={1.5}
|
||||||
|
c={theme.black}
|
||||||
|
dangerouslySetInnerHTML={{ __html: item.deskripsi || '-' }}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
<Group justify="flex-end" mt="xs">
|
||||||
|
<Button
|
||||||
|
size="xs"
|
||||||
|
radius="md"
|
||||||
|
variant="light"
|
||||||
|
color="blue"
|
||||||
|
leftSection={<IconDeviceImac size={16} />}
|
||||||
|
onClick={() =>
|
||||||
|
router.push(
|
||||||
|
`/admin/inovasi/layanan-online-desa/jenis-layanan/${item.id}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
Detail
|
||||||
|
</Button>
|
||||||
|
</Group>
|
||||||
|
</Stack>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<Center py="xl">
|
||||||
|
<Text c="dimmed" fz="sm" lh={1.4}>
|
||||||
|
Tidak ada jenis layanan yang cocok
|
||||||
|
</Text>
|
||||||
|
</Center>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
</Box>
|
||||||
|
</Paper>
|
||||||
|
|
||||||
|
{totalPages > 1 && (
|
||||||
<Center>
|
<Center>
|
||||||
<Pagination
|
<Pagination
|
||||||
value={page}
|
value={page}
|
||||||
@@ -145,12 +244,12 @@ function ListJenisLayanan({ search }: { search: string }) {
|
|||||||
}}
|
}}
|
||||||
total={totalPages}
|
total={totalPages}
|
||||||
mt="md"
|
mt="md"
|
||||||
mb="md"
|
|
||||||
color="blue"
|
color="blue"
|
||||||
radius="md"
|
radius="md"
|
||||||
/>
|
/>
|
||||||
</Center>
|
</Center>
|
||||||
</Box>
|
)}
|
||||||
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ function EditJenisPengaduan() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ function CreateJenisPengaduan() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
Title
|
Title
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useDebouncedValue, useShallowEffect } from '@mantine/hooks';
|
||||||
import { IconEdit, IconPlus, IconSearch, IconTrash } from '@tabler/icons-react';
|
import { IconEdit, IconPlus, IconSearch, IconTrash } from '@tabler/icons-react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
@@ -48,12 +48,13 @@ function ListJenisPengaduan({ search }: { search: string }) {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [modalHapus, setModalHapus] = useState(false);
|
const [modalHapus, setModalHapus] = useState(false);
|
||||||
const [selectedId, setSelectedId] = useState<string | null>(null);
|
const [selectedId, setSelectedId] = useState<string | null>(null);
|
||||||
|
const [debouncedSearch] = useDebouncedValue(search, 1000);
|
||||||
|
|
||||||
const { data, page, totalPages, loading, load, } = state.findMany;
|
const { data, page, totalPages, loading, load } = state.findMany;
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
load(page, 10, search);
|
load(page, 10, debouncedSearch);
|
||||||
}, [page, search]);
|
}, [page, debouncedSearch]);
|
||||||
|
|
||||||
const handleHapus = async () => {
|
const handleHapus = async () => {
|
||||||
if (selectedId) {
|
if (selectedId) {
|
||||||
@@ -63,21 +64,23 @@ function ListJenisPengaduan({ search }: { search: string }) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const filteredData = data || []
|
const filteredData = data || [];
|
||||||
|
|
||||||
if (loading || !data) {
|
if (loading || !data) {
|
||||||
return (
|
return (
|
||||||
<Stack py={10}>
|
<Stack py={{ base: 'md', md: 'lg' }}>
|
||||||
<Skeleton height={500} radius="md" />
|
<Skeleton height={500} radius="md" />
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Box py={{ base: 'md', md: 'lg' }}>
|
||||||
<Paper withBorder bg={colors['white-1']} p="lg" shadow="md" radius="md">
|
<Paper withBorder bg={colors['white-1']} p={{ base: 'md', md: 'lg' }} shadow="md" radius="md">
|
||||||
<Group justify="space-between" mb="md">
|
<Group justify="space-between" mb={{ base: 'sm', md: 'md' }}>
|
||||||
<Title order={4}>Daftar Jenis Pengaduan</Title>
|
<Title order={4} lh={1.2}>
|
||||||
|
Daftar Jenis Pengaduan
|
||||||
|
</Title>
|
||||||
<Button
|
<Button
|
||||||
leftSection={<IconPlus size={18} />}
|
leftSection={<IconPlus size={18} />}
|
||||||
color="blue"
|
color="blue"
|
||||||
@@ -92,13 +95,33 @@ function ListJenisPengaduan({ search }: { search: string }) {
|
|||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
<Box style={{ overflowX: 'auto' }}>
|
{/* Desktop Table */}
|
||||||
<Table highlightOnHover>
|
<Box visibleFrom="md">
|
||||||
|
<Table
|
||||||
|
highlightOnHover
|
||||||
|
miw={0}
|
||||||
|
style={{
|
||||||
|
tableLayout: 'fixed',
|
||||||
|
width: '100%',
|
||||||
|
}}
|
||||||
|
>
|
||||||
<TableThead>
|
<TableThead>
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTh style={{ width: '60%' }}>Nama Jenis Pengaduan</TableTh>
|
<TableTh style={{ width: '60%' }}>
|
||||||
<TableTh style={{ width: '20%' }}>Edit</TableTh>
|
<Text fz="sm" fw={600} lh={1.4} c="dimmed">
|
||||||
<TableTh style={{ width: '20%' }}>Hapus</TableTh>
|
Nama Jenis Pengaduan
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '20%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4} c="dimmed">
|
||||||
|
Edit
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '20%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4} c="dimmed">
|
||||||
|
Hapus
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
</TableTr>
|
</TableTr>
|
||||||
</TableThead>
|
</TableThead>
|
||||||
<TableTbody>
|
<TableTbody>
|
||||||
@@ -106,7 +129,7 @@ function ListJenisPengaduan({ search }: { search: string }) {
|
|||||||
filteredData.map((item) => (
|
filteredData.map((item) => (
|
||||||
<TableTr key={item.id}>
|
<TableTr key={item.id}>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
<Text fw={500} truncate="end" lineClamp={1}>
|
<Text fz="md" fw={500} lh={1.5} truncate="end">
|
||||||
{item.nama}
|
{item.nama}
|
||||||
</Text>
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
@@ -147,7 +170,7 @@ function ListJenisPengaduan({ search }: { search: string }) {
|
|||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTd colSpan={3}>
|
<TableTd colSpan={3}>
|
||||||
<Center py={20}>
|
<Center py={20}>
|
||||||
<Text color="dimmed">
|
<Text c="dimmed" fz="sm" lh={1.4}>
|
||||||
Tidak ada jenis pengaduan yang cocok
|
Tidak ada jenis pengaduan yang cocok
|
||||||
</Text>
|
</Text>
|
||||||
</Center>
|
</Center>
|
||||||
@@ -157,6 +180,63 @@ function ListJenisPengaduan({ search }: { search: string }) {
|
|||||||
</TableTbody>
|
</TableTbody>
|
||||||
</Table>
|
</Table>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
{/* Mobile Card View */}
|
||||||
|
<Box hiddenFrom="md">
|
||||||
|
<Stack gap="md">
|
||||||
|
{filteredData.length > 0 ? (
|
||||||
|
filteredData.map((item) => (
|
||||||
|
<Paper key={item.id} withBorder p="md" radius="md">
|
||||||
|
<Stack gap={"xs"}>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
Nama Jenis Pengaduan
|
||||||
|
</Text>
|
||||||
|
<Text fz="sm" fw={500} lh={1.45}>
|
||||||
|
{item.nama}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
<Group justify="flex-end" mt="xs">
|
||||||
|
<Button
|
||||||
|
size="xs"
|
||||||
|
radius="md"
|
||||||
|
variant="light"
|
||||||
|
color="green"
|
||||||
|
leftSection={<IconEdit size={16} />}
|
||||||
|
onClick={() =>
|
||||||
|
router.push(
|
||||||
|
`/admin/inovasi/layanan-online-desa/jenis-pengaduan/${item.id}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
Edit
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
size="xs"
|
||||||
|
radius="md"
|
||||||
|
variant="light"
|
||||||
|
color="red"
|
||||||
|
leftSection={<IconTrash size={16} />}
|
||||||
|
onClick={() => {
|
||||||
|
setSelectedId(item.id);
|
||||||
|
setModalHapus(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Hapus
|
||||||
|
</Button>
|
||||||
|
</Group>
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<Center py={20}>
|
||||||
|
<Text c="dimmed" fz="sm" lh={1.4}>
|
||||||
|
Tidak ada jenis pengaduan yang cocok
|
||||||
|
</Text>
|
||||||
|
</Center>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
</Box>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
|
||||||
<Center>
|
<Center>
|
||||||
@@ -167,14 +247,13 @@ function ListJenisPengaduan({ search }: { search: string }) {
|
|||||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||||
}}
|
}}
|
||||||
total={totalPages}
|
total={totalPages}
|
||||||
mt="md"
|
mt={{ base: 'sm', md: 'md' }}
|
||||||
mb="md"
|
mb={{ base: 'sm', md: 'md' }}
|
||||||
color="blue"
|
color="blue"
|
||||||
radius="md"
|
radius="md"
|
||||||
/>
|
/>
|
||||||
</Center>
|
</Center>
|
||||||
|
|
||||||
{/* Modal Hapus */}
|
|
||||||
<ModalKonfirmasiHapus
|
<ModalKonfirmasiHapus
|
||||||
opened={modalHapus}
|
opened={modalHapus}
|
||||||
onClose={() => setModalHapus(false)}
|
onClose={() => setModalHapus(false)}
|
||||||
|
|||||||
@@ -1,7 +1,28 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
import { Box } from "@mantine/core";
|
||||||
import LayoutTabsLayananOnlineDesa from "./_lib/layoutTabs";
|
import LayoutTabsLayananOnlineDesa from "./_lib/layoutTabs";
|
||||||
|
import { usePathname } from "next/navigation";
|
||||||
|
|
||||||
function Layout({ children }: { children: React.ReactNode }) {
|
function Layout({ children }: { children: React.ReactNode }) {
|
||||||
|
const pathname = usePathname();
|
||||||
|
|
||||||
|
// Contoh path:
|
||||||
|
// - /darmasaba/desa/berita/semua → panjang 5 → list
|
||||||
|
// - /darmasaba/desa/berita/Pemerintahan → panjang 5 → list
|
||||||
|
// - /darmasaba/desa/berita/Pemerintahan/123 → panjang 6 → detail
|
||||||
|
|
||||||
|
const segments = pathname.split('/').filter(Boolean);
|
||||||
|
const isDetailPage = segments.length >= 5;
|
||||||
|
|
||||||
|
if (isDetailPage) {
|
||||||
|
// Tampilkan tanpa tab menu
|
||||||
|
return (
|
||||||
|
<Box>
|
||||||
|
{children}
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LayoutTabsLayananOnlineDesa>
|
<LayoutTabsLayananOnlineDesa>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ function DetailPengaduanMasyarakat() {
|
|||||||
const data = pengaduanState.pengaduanMasyarakat.findUnique.data;
|
const data = pengaduanState.pengaduanMasyarakat.findUnique.data;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Tombol Kembali */}
|
{/* Tombol Kembali */}
|
||||||
<Button
|
<Button
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
@@ -55,7 +55,7 @@ function DetailPengaduanMasyarakat() {
|
|||||||
{/* Card Detail */}
|
{/* Card Detail */}
|
||||||
<Paper
|
<Paper
|
||||||
withBorder
|
withBorder
|
||||||
w={{ base: "100%", md: "60%" }}
|
w={{ base: "100%", md: "70%" }}
|
||||||
bg={colors['white-1']}
|
bg={colors['white-1']}
|
||||||
p="lg"
|
p="lg"
|
||||||
radius="md"
|
radius="md"
|
||||||
|
|||||||
@@ -19,8 +19,7 @@ import {
|
|||||||
Title
|
Title
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import { IconDeviceImac, IconSearch } from '@tabler/icons-react';
|
import { IconDeviceImac, IconSearch } from '@tabler/icons-react';
|
||||||
|
import { useDebouncedValue, useShallowEffect } from '@mantine/hooks';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useProxy } from 'valtio/utils';
|
import { useProxy } from 'valtio/utils';
|
||||||
@@ -46,6 +45,7 @@ function PengaduanMasyarakat() {
|
|||||||
function ListPengaduanMasyarakat({ search }: { search: string }) {
|
function ListPengaduanMasyarakat({ search }: { search: string }) {
|
||||||
const listState = useProxy(layananonlineDesa.pengaduanMasyarakat);
|
const listState = useProxy(layananonlineDesa.pengaduanMasyarakat);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const [debouncedSearch] = useDebouncedValue(search, 1000);
|
||||||
const {
|
const {
|
||||||
data,
|
data,
|
||||||
page,
|
page,
|
||||||
@@ -55,56 +55,84 @@ function ListPengaduanMasyarakat({ search }: { search: string }) {
|
|||||||
} = listState.findMany;
|
} = listState.findMany;
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
load(page, 10, search);
|
load(page, 10, debouncedSearch);
|
||||||
}, [page, search]);
|
}, [page, debouncedSearch]);
|
||||||
|
|
||||||
const filteredData = data || []
|
const filteredData = data || [];
|
||||||
|
|
||||||
if (loading || !data) {
|
if (loading || !data) {
|
||||||
return (
|
return (
|
||||||
<Stack py={10}>
|
<Stack py={{ base: 'sm', md: 'md' }}>
|
||||||
<Skeleton height={600} radius="md" />
|
<Skeleton height={600} radius="md" />
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Box py={{ base: 'sm', md: 'md' }}>
|
||||||
<Paper withBorder bg={colors['white-1']} p="lg" shadow="md" radius="md">
|
<Paper withBorder bg={colors['white-1']} p={{ base: 'md', md: 'lg' }} shadow="md" radius="md">
|
||||||
<Group justify="space-between" mb="md">
|
{/* Section Header */}
|
||||||
<Title order={4}>Daftar Pengaduan Masyarakat</Title>
|
<Group justify="space-between" mb={{ base: 'sm', md: 'md' }}>
|
||||||
|
<Title order={4} lh={1.2}>
|
||||||
|
Daftar Pengaduan Masyarakat
|
||||||
|
</Title>
|
||||||
</Group>
|
</Group>
|
||||||
<Box style={{ overflowX: "auto" }}>
|
|
||||||
<Table highlightOnHover>
|
{/* Desktop Table */}
|
||||||
|
<Box visibleFrom="md">
|
||||||
|
<Table
|
||||||
|
highlightOnHover
|
||||||
|
miw={0}
|
||||||
|
style={{
|
||||||
|
tableLayout: 'fixed',
|
||||||
|
width: '100%',
|
||||||
|
}}
|
||||||
|
>
|
||||||
<TableThead>
|
<TableThead>
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTh style={{ width: '25%' }}>Nama</TableTh>
|
<TableTh style={{ width: '25%' }}>
|
||||||
<TableTh style={{ width: '25%' }}>Email</TableTh>
|
<Text fz="sm" fw={600} lh={1.4}>Nama</Text>
|
||||||
<TableTh style={{ width: '20%' }}>Nomor Telepon</TableTh>
|
</TableTh>
|
||||||
<TableTh style={{ width: '15%' }}>Aksi</TableTh>
|
<TableTh style={{ width: '25%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>Email</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '20%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>Nomor Telepon</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '15%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>Aksi</Text>
|
||||||
|
</TableTh>
|
||||||
</TableTr>
|
</TableTr>
|
||||||
</TableThead>
|
</TableThead>
|
||||||
<TableTbody>
|
<TableTbody>
|
||||||
{filteredData.length > 0 ? (
|
{filteredData.length > 0 ? (
|
||||||
filteredData.map((item) => (
|
filteredData.map((item) => (
|
||||||
<TableTr key={item.id}>
|
<TableTr key={item.id}>
|
||||||
<TableTd style={{ width: '25%' }}>
|
<TableTd>
|
||||||
<Text fw={500} truncate="end" lineClamp={1}>{item.name}</Text>
|
<Text fz="md" fw={500} lh={1.5} truncate="end" lineClamp={1}>
|
||||||
|
{item.name}
|
||||||
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd style={{ width: '25%' }}>
|
<TableTd>
|
||||||
<Text fz="sm" c="dimmed" truncate lineClamp={1}>{item.email}</Text>
|
<Text fz="sm" c="dimmed" lh={1.5} truncate lineClamp={1}>
|
||||||
|
{item.email}
|
||||||
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd style={{ width: '20%' }}>
|
<TableTd>
|
||||||
<Text fz="sm" c="dimmed" truncate lineClamp={1}>{item.nomorTelepon}</Text>
|
<Text fz="sm" c="dimmed" lh={1.5} truncate lineClamp={1}>
|
||||||
|
{item.nomorTelepon}
|
||||||
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd style={{ width: '15%' }}>
|
<TableTd>
|
||||||
<Button
|
<Button
|
||||||
size="xs"
|
size="xs"
|
||||||
radius="md"
|
radius="md"
|
||||||
variant="light"
|
variant="light"
|
||||||
color="blue"
|
color="blue"
|
||||||
leftSection={<IconDeviceImac size={16} />}
|
leftSection={<IconDeviceImac size={16} />}
|
||||||
onClick={() => router.push(`/admin/inovasi/layanan-online-desa/pengaduan-masyarakat/${item.id}`)}
|
onClick={() =>
|
||||||
|
router.push(`/admin/inovasi/layanan-online-desa/pengaduan-masyarakat/${item.id}`)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
Detail
|
Detail
|
||||||
</Button>
|
</Button>
|
||||||
@@ -114,8 +142,10 @@ function ListPengaduanMasyarakat({ search }: { search: string }) {
|
|||||||
) : (
|
) : (
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTd colSpan={4}>
|
<TableTd colSpan={4}>
|
||||||
<Center py={20}>
|
<Center py={{ base: 'sm', md: 'lg' }}>
|
||||||
<Text color="dimmed">Tidak ada data pengaduan yang cocok</Text>
|
<Text c="dimmed" fz="sm" lh={1.4}>
|
||||||
|
Tidak ada data pengaduan yang cocok
|
||||||
|
</Text>
|
||||||
</Center>
|
</Center>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
</TableTr>
|
</TableTr>
|
||||||
@@ -123,7 +153,56 @@ function ListPengaduanMasyarakat({ search }: { search: string }) {
|
|||||||
</TableTbody>
|
</TableTbody>
|
||||||
</Table>
|
</Table>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
{/* Mobile Cards */}
|
||||||
|
<Box hiddenFrom="md">
|
||||||
|
<Stack gap="xs">
|
||||||
|
{filteredData.length > 0 ? (
|
||||||
|
filteredData.map((item) => (
|
||||||
|
<Paper key={item.id} withBorder p="sm" radius="md">
|
||||||
|
<Stack gap={'xs'}>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>Nama</Text>
|
||||||
|
<Text fz="sm" fw={500} lh={1.45}>{item.name}</Text>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>Email</Text>
|
||||||
|
<Text fz="sm" c="dimmed" fw={500} lh={1.45}>{item.email}</Text>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>Nomor Telepon</Text>
|
||||||
|
<Text fz="sm" c="dimmed" fw={500} lh={1.45}>{item.nomorTelepon}</Text>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Button
|
||||||
|
size="xs"
|
||||||
|
radius="md"
|
||||||
|
variant="light"
|
||||||
|
color="blue"
|
||||||
|
leftSection={<IconDeviceImac size={16} />}
|
||||||
|
onClick={() =>
|
||||||
|
router.push(`/admin/inovasi/layanan-online-desa/pengaduan-masyarakat/${item.id}`)
|
||||||
|
}
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
|
Detail
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
</Stack>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<Center py="lg">
|
||||||
|
<Text c="dimmed" fz="sm" lh={1.4}>
|
||||||
|
Tidak ada data pengaduan yang cocok
|
||||||
|
</Text>
|
||||||
|
</Center>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
</Box>
|
||||||
|
</Paper>
|
||||||
|
|
||||||
|
{/* Pagination */}
|
||||||
<Center>
|
<Center>
|
||||||
<Pagination
|
<Pagination
|
||||||
value={page}
|
value={page}
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ function EditProgramKreatifDesa() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button
|
<Button
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ function DetailProgramKreatifDesa() {
|
|||||||
const data = stateProgramKreatif.findUnique.data
|
const data = stateProgramKreatif.findUnique.data
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
<Button
|
<Button
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
onClick={() => router.back()}
|
onClick={() => router.back()}
|
||||||
@@ -53,7 +53,7 @@ function DetailProgramKreatifDesa() {
|
|||||||
|
|
||||||
<Paper
|
<Paper
|
||||||
withBorder
|
withBorder
|
||||||
w={{ base: "100%", md: "50%" }}
|
w={{ base: "100%", md: "70%" }}
|
||||||
bg={colors['white-1']}
|
bg={colors['white-1']}
|
||||||
p="lg"
|
p="lg"
|
||||||
radius="md"
|
radius="md"
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ function CreateProgramKreatifDesa() {
|
|||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Tombol kembali */}
|
{/* Tombol kembali */}
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
TableThead,
|
TableThead,
|
||||||
TableTr,
|
TableTr,
|
||||||
Text,
|
Text,
|
||||||
Title
|
Title,
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import {
|
import {
|
||||||
IconCash,
|
IconCash,
|
||||||
@@ -50,9 +50,10 @@ import React, { useEffect, useState } from 'react';
|
|||||||
import { useProxy } from 'valtio/utils';
|
import { useProxy } from 'valtio/utils';
|
||||||
import HeaderSearch from '../../_com/header';
|
import HeaderSearch from '../../_com/header';
|
||||||
import programKreatifState from '../../_state/inovasi/program-kreatif';
|
import programKreatifState from '../../_state/inovasi/program-kreatif';
|
||||||
|
import { useDebouncedValue } from '@mantine/hooks';
|
||||||
|
|
||||||
function ProgramKreatifDesa() {
|
function ProgramKreatifDesa() {
|
||||||
const [search, setSearch] = useState("");
|
const [search, setSearch] = useState('');
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<HeaderSearch
|
<HeaderSearch
|
||||||
@@ -71,12 +72,13 @@ function ListProgramKreatifDesa({ search }: { search: string }) {
|
|||||||
const listState = useProxy(programKreatifState);
|
const listState = useProxy(programKreatifState);
|
||||||
const { data, loading, page, totalPages, load } = listState.findMany;
|
const { data, loading, page, totalPages, load } = listState.findMany;
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const [debouncedSearch] = useDebouncedValue(search, 1000);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
load(page, 10, search);
|
load(page, 10, debouncedSearch);
|
||||||
}, [page, search]);
|
}, [page, debouncedSearch]);
|
||||||
|
|
||||||
const filteredData = data || []
|
const filteredData = data || [];
|
||||||
|
|
||||||
const iconMap: Record<string, React.FC<any>> = {
|
const iconMap: Record<string, React.FC<any>> = {
|
||||||
ekowisata: IconLeaf,
|
ekowisata: IconLeaf,
|
||||||
@@ -103,7 +105,7 @@ function ListProgramKreatifDesa({ search }: { search: string }) {
|
|||||||
|
|
||||||
if (loading || !data) {
|
if (loading || !data) {
|
||||||
return (
|
return (
|
||||||
<Stack py={10}>
|
<Stack py={{ base: 'sm', md: 'xl' }}>
|
||||||
<Skeleton height={650} radius="md" />
|
<Skeleton height={650} radius="md" />
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
@@ -111,35 +113,44 @@ function ListProgramKreatifDesa({ search }: { search: string }) {
|
|||||||
|
|
||||||
if (data.length === 0) {
|
if (data.length === 0) {
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Box py={{ base: 'sm', md: 'xl' }}>
|
||||||
<Paper p="md" radius="md" shadow="sm" withBorder>
|
<Paper p="lg" radius="md" shadow="sm" withBorder>
|
||||||
<Stack>
|
<Stack gap="xl">
|
||||||
<Group justify="space-between" mb="md">
|
<Group justify="space-between" wrap="nowrap">
|
||||||
<Title order={4}>Daftar Program Kreatif Desa</Title>
|
<Title order={4} lh={1.15}>
|
||||||
|
Daftar Program Kreatif Desa
|
||||||
|
</Title>
|
||||||
<Button
|
<Button
|
||||||
leftSection={<IconPlus size={18} />}
|
leftSection={<IconPlus size={18} />}
|
||||||
color="blue"
|
color="blue"
|
||||||
variant="light"
|
variant="light"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
router.push(
|
router.push('/admin/inovasi/program-kreatif-desa/create')
|
||||||
'/admin/inovasi/program-kreatif-desa/create'
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
Tambah Baru
|
Tambah Baru
|
||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
<Table highlightOnHover striped>
|
|
||||||
|
<Box visibleFrom="md">
|
||||||
|
<Table
|
||||||
|
highlightOnHover
|
||||||
|
miw={0}
|
||||||
|
striped
|
||||||
|
style={{ tableLayout: 'fixed', width: '100%' }}
|
||||||
|
>
|
||||||
<TableThead>
|
<TableThead>
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTh>No</TableTh>
|
<TableTh style={{ width: '5%', textAlign: 'center' }}>No</TableTh>
|
||||||
<TableTh>Nama Program Kreatif Desa</TableTh>
|
<TableTh style={{ width: '20%' }}>Nama Program Kreatif Desa</TableTh>
|
||||||
<TableTh>Deskripsi Singkat</TableTh>
|
<TableTh style={{ width: '35%' }}>Deskripsi Singkat</TableTh>
|
||||||
<TableTh>Ikon</TableTh>
|
<TableTh style={{ width: '10%', textAlign: 'center' }}>Ikon</TableTh>
|
||||||
<TableTh>Detail</TableTh>
|
<TableTh style={{ width: '15%', textAlign: 'center' }}>Detail</TableTh>
|
||||||
</TableTr>
|
</TableTr>
|
||||||
</TableThead>
|
</TableThead>
|
||||||
</Table>
|
</Table>
|
||||||
|
</Box>
|
||||||
|
|
||||||
<Text ta="center" c="dimmed" py="lg">
|
<Text ta="center" c="dimmed" py="lg">
|
||||||
Tidak ada data program kreatif desa yang tersedia
|
Tidak ada data program kreatif desa yang tersedia
|
||||||
</Text>
|
</Text>
|
||||||
@@ -150,7 +161,7 @@ function ListProgramKreatifDesa({ search }: { search: string }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Box py={{ base: 'sm', md: 'xl' }}>
|
||||||
<Paper
|
<Paper
|
||||||
withBorder
|
withBorder
|
||||||
bg={colors['white-1']}
|
bg={colors['white-1']}
|
||||||
@@ -159,58 +170,83 @@ function ListProgramKreatifDesa({ search }: { search: string }) {
|
|||||||
radius="md"
|
radius="md"
|
||||||
h={{ base: 'auto', md: 650 }}
|
h={{ base: 'auto', md: 650 }}
|
||||||
>
|
>
|
||||||
<Group justify="space-between" mb="md">
|
<Group justify="space-between" mb="xl" wrap="nowrap">
|
||||||
<Title order={4}>Daftar Program Kreatif Desa</Title>
|
<Title order={4} lh={1.15}>
|
||||||
|
Daftar Program Kreatif Desa
|
||||||
|
</Title>
|
||||||
<Button
|
<Button
|
||||||
leftSection={<IconPlus size={18} />}
|
leftSection={<IconPlus size={18} />}
|
||||||
color="blue"
|
color="blue"
|
||||||
variant="light"
|
variant="light"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
router.push(
|
router.push('/admin/inovasi/program-kreatif-desa/create')
|
||||||
'/admin/inovasi/program-kreatif-desa/create'
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
Tambah Baru
|
Tambah Baru
|
||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
<Box style={{ overflowY: 'auto' }}>
|
|
||||||
<Table highlightOnHover striped >
|
{/* Desktop Table */}
|
||||||
|
<Box visibleFrom="md" style={{ height: '100%', overflowY: 'auto' }}>
|
||||||
|
<Table
|
||||||
|
highlightOnHover
|
||||||
|
miw={0}
|
||||||
|
striped
|
||||||
|
style={{ tableLayout: 'fixed', width: '100%' }}
|
||||||
|
>
|
||||||
<TableThead>
|
<TableThead>
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTh style={{ width: '5%', textAlign: 'center' }}>No</TableTh>
|
<TableTh style={{ width: '5%', textAlign: 'center' }}>
|
||||||
<TableTh style={{ width: '20%' }}>
|
<Text fz="xs" fw={600} lh={1.2}>
|
||||||
<Text lineClamp={1} fw={"bold"} fz="sm">Nama Program Kreatif Desa</Text>
|
No
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '20%' }}>
|
||||||
|
<Text fz="xs" fw={600} lh={1.2}>
|
||||||
|
Nama Program Kreatif Desa
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '35%' }}>
|
||||||
|
<Text fz="xs" fw={600} lh={1.2}>
|
||||||
|
Deskripsi Singkat
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '10%', textAlign: 'center' }}>
|
||||||
|
<Text fz="xs" fw={600} lh={1.2}>
|
||||||
|
Ikon
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '15%', textAlign: 'center' }}>
|
||||||
|
<Text fz="xs" fw={600} lh={1.2}>
|
||||||
|
Detail
|
||||||
|
</Text>
|
||||||
</TableTh>
|
</TableTh>
|
||||||
<TableTh style={{ width: '35%' }}>Deskripsi Singkat</TableTh>
|
|
||||||
<TableTh style={{ width: '10%', textAlign: 'center' }}>Ikon</TableTh>
|
|
||||||
<TableTh style={{ width: '15%', textAlign: 'center' }}>Detail</TableTh>
|
|
||||||
</TableTr>
|
</TableTr>
|
||||||
</TableThead>
|
</TableThead>
|
||||||
<TableTbody>
|
<TableTbody>
|
||||||
{filteredData.map((item, index) => (
|
{filteredData.map((item, index) => (
|
||||||
<TableTr key={item.id}>
|
<TableTr key={item.id}>
|
||||||
<TableTd style={{ width: '5%', textAlign: 'center' }}>{index + 1}</TableTd>
|
<TableTd ta="center" fz="sm" fw={500} lh={1.45}>
|
||||||
<TableTd style={{ width: '20%', wordWrap: 'break-word' }}>
|
{index + 1}
|
||||||
<Box w={200}>
|
|
||||||
<Text fw={500} lineClamp={1}>{item.name}</Text>
|
|
||||||
</Box>
|
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd style={{ width: '35%', wordWrap: 'break-word' }}>
|
<TableTd>
|
||||||
<Box w={150}>
|
<Text fz="sm" fw={500} lh={1.45} lineClamp={1}>
|
||||||
<Text fz="sm" c="dimmed" lineClamp={1}>
|
{item.name}
|
||||||
|
</Text>
|
||||||
|
</TableTd>
|
||||||
|
<TableTd>
|
||||||
|
<Text fz="sm" c="dimmed" lh={1.45} lineClamp={1}>
|
||||||
{item.slug}
|
{item.slug}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd style={{ width: '10%', textAlign: 'center' }}>
|
<TableTd ta="center">
|
||||||
{iconMap[item.icon] && (
|
{iconMap[item.icon] && (
|
||||||
<Box title={item.icon}>
|
<Box title={item.icon}>
|
||||||
{React.createElement(iconMap[item.icon], { size: 24 })}
|
{React.createElement(iconMap[item.icon], { size: 24 })}
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd style={{ width: '15%', textAlign: 'center' }}>
|
<TableTd ta="center">
|
||||||
<Button
|
<Button
|
||||||
size="xs"
|
size="xs"
|
||||||
radius="md"
|
radius="md"
|
||||||
@@ -221,7 +257,9 @@ function ListProgramKreatifDesa({ search }: { search: string }) {
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<IconDeviceImac size={18} />
|
<IconDeviceImac size={18} />
|
||||||
<Text ml={6}>Detail</Text>
|
<Text ml={6} fz="sm" fw={500}>
|
||||||
|
Detail
|
||||||
|
</Text>
|
||||||
</Button>
|
</Button>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
</TableTr>
|
</TableTr>
|
||||||
@@ -229,7 +267,72 @@ function ListProgramKreatifDesa({ search }: { search: string }) {
|
|||||||
</TableTbody>
|
</TableTbody>
|
||||||
</Table>
|
</Table>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
{/* Mobile Cards */}
|
||||||
|
<Box hiddenFrom="md">
|
||||||
|
<Stack gap="md">
|
||||||
|
{filteredData.map((item, index) => (
|
||||||
|
<Paper key={item.id} p="md" withBorder radius="md">
|
||||||
|
<Stack gap={4}>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
No
|
||||||
|
</Text>
|
||||||
|
<Text fz="sm" fw={500} lh={1.4}>
|
||||||
|
{index + 1}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
Nama Program Kreatif Desa
|
||||||
|
</Text>
|
||||||
|
<Text fz="sm" fw={500} lh={1.4} lineClamp={2}>
|
||||||
|
{item.name}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
Deskripsi Singkat
|
||||||
|
</Text>
|
||||||
|
<Text fz="sm" fw={500} c="dimmed" lh={1.4} lineClamp={2}>
|
||||||
|
{item.slug}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
Ikon
|
||||||
|
</Text>
|
||||||
|
<Box mt={4} ta="center">
|
||||||
|
{iconMap[item.icon] && (
|
||||||
|
<Box title={item.icon}>
|
||||||
|
{React.createElement(iconMap[item.icon], { size: 24 })}
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
<Box ta="center" mt="sm">
|
||||||
|
<Button
|
||||||
|
size="xs"
|
||||||
|
radius="md"
|
||||||
|
variant="light"
|
||||||
|
color="blue"
|
||||||
|
onClick={() =>
|
||||||
|
router.push(`/admin/inovasi/program-kreatif-desa/${item.id}`)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<IconDeviceImac size={18} />
|
||||||
|
<Text ml={6} fz="sm" fw={500}>
|
||||||
|
Detail
|
||||||
|
</Text>
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
</Stack>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
))}
|
||||||
|
</Stack>
|
||||||
|
</Box>
|
||||||
|
</Paper>
|
||||||
|
|
||||||
<Center>
|
<Center>
|
||||||
<Pagination
|
<Pagination
|
||||||
value={page}
|
value={page}
|
||||||
@@ -238,8 +341,8 @@ function ListProgramKreatifDesa({ search }: { search: string }) {
|
|||||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||||
}}
|
}}
|
||||||
total={totalPages}
|
total={totalPages}
|
||||||
mt="md"
|
mt="xl"
|
||||||
mb="md"
|
mb="xl"
|
||||||
color="blue"
|
color="blue"
|
||||||
radius="md"
|
radius="md"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ function ListTarifLayanan({ search }: { search: string }) {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [modalHapus, setModalHapus] = useState(false);
|
const [modalHapus, setModalHapus] = useState(false);
|
||||||
const [selectedId, setSelectedId] = useState<string | null>(null);
|
const [selectedId, setSelectedId] = useState<string | null>(null);
|
||||||
const [debouncedSearch] = useDebouncedValue(search, 10000);
|
const [debouncedSearch] = useDebouncedValue(search, 1000);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data,
|
data,
|
||||||
|
|||||||
@@ -96,15 +96,15 @@ function ListKontakDarurat({ search }: { search: string }) {
|
|||||||
{filteredData.length > 0 ? (
|
{filteredData.length > 0 ? (
|
||||||
filteredData.map((item) => (
|
filteredData.map((item) => (
|
||||||
<TableTr key={item.id}>
|
<TableTr key={item.id}>
|
||||||
<TableTd>
|
<TableTd w={335}>
|
||||||
<Text fw={500} fz="md" lh={1.45} truncate="end" lineClamp={1}>
|
<Text fw={500} fz="md" lh={1.45} truncate="end" lineClamp={1}>
|
||||||
{item.name}
|
{item.name}
|
||||||
</Text>
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd w={335}>
|
||||||
<Text fz="sm" lh={1.45} c="dimmed" lineClamp={1} dangerouslySetInnerHTML={{ __html: item.deskripsi }} />
|
<Text fz="sm" lh={1.45} c="dimmed" lineClamp={1} dangerouslySetInnerHTML={{ __html: item.deskripsi }} />
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd w={335}>
|
||||||
<Button
|
<Button
|
||||||
variant="light"
|
variant="light"
|
||||||
color="blue"
|
color="blue"
|
||||||
|
|||||||
@@ -110,10 +110,10 @@ function ListProgramKesehatan({ search }: { search: string }) {
|
|||||||
{item.name}
|
{item.name}
|
||||||
</Text>
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd w={200}>
|
<TableTd>
|
||||||
<Text fz="sm" lh={1.5} truncate="end" lineClamp={1} dangerouslySetInnerHTML={{ __html: item.deskripsiSingkat }} />
|
<Text fz="sm" lh={1.5} truncate="end" lineClamp={1} dangerouslySetInnerHTML={{ __html: item.deskripsiSingkat }} />
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd w={200}>
|
<TableTd>
|
||||||
<Text fz="sm" lh={1.5} truncate="end" lineClamp={1} dangerouslySetInnerHTML={{ __html: item.deskripsi }} />
|
<Text fz="sm" lh={1.5} truncate="end" lineClamp={1} dangerouslySetInnerHTML={{ __html: item.deskripsi }} />
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
Title,
|
Title,
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useDebouncedValue, useShallowEffect } from '@mantine/hooks';
|
||||||
import { IconEdit, IconPlus, IconSearch, IconTrash } from '@tabler/icons-react';
|
import { IconEdit, IconPlus, IconSearch, IconTrash } from '@tabler/icons-react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
@@ -50,6 +50,7 @@ function ListKategoriKegiatan({ search }: { search: string }) {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const { data, page, totalPages, loading, load } = stateKategori.findMany;
|
const { data, page, totalPages, loading, load } = stateKategori.findMany;
|
||||||
|
const [debouncedSearch] = useDebouncedValue(search, 1000); // 500ms delay
|
||||||
|
|
||||||
const handleHapus = () => {
|
const handleHapus = () => {
|
||||||
if (selectedId) {
|
if (selectedId) {
|
||||||
@@ -60,8 +61,8 @@ function ListKategoriKegiatan({ search }: { search: string }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
load(page, 10, search);
|
load(page, 10, debouncedSearch);
|
||||||
}, [page, search]);
|
}, [page, debouncedSearch]);
|
||||||
|
|
||||||
const filteredData = data || [];
|
const filteredData = data || [];
|
||||||
|
|
||||||
@@ -211,7 +212,7 @@ function ListKategoriKegiatan({ search }: { search: string }) {
|
|||||||
<Box hiddenFrom="md">{renderMobileCards()}</Box>
|
<Box hiddenFrom="md">{renderMobileCards()}</Box>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
|
||||||
{totalPages > 1 && (
|
|
||||||
<Center mt="xl">
|
<Center mt="xl">
|
||||||
<Pagination
|
<Pagination
|
||||||
value={page}
|
value={page}
|
||||||
@@ -224,7 +225,6 @@ function ListKategoriKegiatan({ search }: { search: string }) {
|
|||||||
radius="md"
|
radius="md"
|
||||||
/>
|
/>
|
||||||
</Center>
|
</Center>
|
||||||
)}
|
|
||||||
|
|
||||||
<ModalKonfirmasiHapus
|
<ModalKonfirmasiHapus
|
||||||
opened={modalHapus}
|
opened={modalHapus}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { Box, Button, Center, Group, Pagination, Paper, Skeleton, Stack, Table, TableTbody, TableTd, TableTh, TableThead, TableTr, Text, Title } from '@mantine/core';
|
import { Box, Button, Center, Group, Pagination, Paper, Skeleton, Stack, Table, TableTbody, TableTd, TableTh, TableThead, TableTr, Text, Title } from '@mantine/core';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useDebouncedValue, useShallowEffect } from '@mantine/hooks';
|
||||||
import { IconDeviceImacCog, IconPlus, IconSearch } from '@tabler/icons-react';
|
import { IconDeviceImacCog, IconPlus, IconSearch } from '@tabler/icons-react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
@@ -29,10 +29,11 @@ function ListDesaAntiKorupsi({ search }: { search: string }) {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const listState = useProxy(korupsiState.desaAntikorupsi);
|
const listState = useProxy(korupsiState.desaAntikorupsi);
|
||||||
const { data, page, totalPages, loading, load } = listState.findMany;
|
const { data, page, totalPages, loading, load } = listState.findMany;
|
||||||
|
const [debouncedSearch] = useDebouncedValue(search, 1000); // 500ms delay
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
load(page, 10, search);
|
load(page, 10, debouncedSearch);
|
||||||
}, [page, search]);
|
}, [page, debouncedSearch]);
|
||||||
|
|
||||||
const filteredData = data || [];
|
const filteredData = data || [];
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import { useProxy } from 'valtio/utils';
|
import { useProxy } from 'valtio/utils';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useDebouncedValue, useShallowEffect } from '@mantine/hooks';
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
@@ -47,16 +47,14 @@ interface ListRespondenProps {
|
|||||||
function ListResponden({ search }: ListRespondenProps) {
|
function ListResponden({ search }: ListRespondenProps) {
|
||||||
const state = useProxy(indeksKepuasanState.responden);
|
const state = useProxy(indeksKepuasanState.responden);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const [debouncedSearch] = useDebouncedValue(search, 1000); // 500ms delay
|
||||||
const { data, page, totalPages, loading, load } = state.findMany;
|
const { data, page, totalPages, loading, load } = state.findMany;
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
load(page, 10);
|
load(page, 10, debouncedSearch);
|
||||||
}, [page]);
|
}, [page, debouncedSearch]);
|
||||||
|
|
||||||
const filteredData = (data || []).filter((item) => {
|
const filteredData = data || [];
|
||||||
const keyword = search.toLowerCase();
|
|
||||||
return item.name.toLowerCase().includes(keyword);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (loading || !data) {
|
if (loading || !data) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -196,6 +196,7 @@ function ListMediaSosial({ search }: { search: string }) {
|
|||||||
{filteredData.length > 0 ? (
|
{filteredData.length > 0 ? (
|
||||||
filteredData.map((item) => (
|
filteredData.map((item) => (
|
||||||
<Paper key={item.id} withBorder p="sm" radius="md">
|
<Paper key={item.id} withBorder p="sm" radius="md">
|
||||||
|
<Stack gap={"xs"}>
|
||||||
<Box>
|
<Box>
|
||||||
<Text fz="sm" fw={600} lh={1.4}>Nama Media Sosial / Kontak</Text>
|
<Text fz="sm" fw={600} lh={1.4}>Nama Media Sosial / Kontak</Text>
|
||||||
<Text fw={500} fz="sm" lh={1.45}>
|
<Text fw={500} fz="sm" lh={1.45}>
|
||||||
@@ -252,6 +253,7 @@ function ListMediaSosial({ search }: { search: string }) {
|
|||||||
Detail
|
Detail
|
||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
|
</Stack>
|
||||||
</Paper>
|
</Paper>
|
||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import profileLandingPageState from '@/app/admin/(dashboard)/_state/landing-page/profile';
|
import profileLandingPageState from '@/app/admin/(dashboard)/_state/landing-page/profile';
|
||||||
import colors from '@/con/colors';
|
import colors from '@/con/colors';
|
||||||
import { Box, Button, Center, Divider, Grid, GridCol, Image, Paper, Skeleton, Stack, Text, Title } from '@mantine/core';
|
import { Box, Button, Center, Divider, Grid, GridCol, Group, Image, Paper, Skeleton, Stack, Text, Title } from '@mantine/core';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useShallowEffect } from '@mantine/hooks';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import { useProxy } from 'valtio/utils';
|
import { useProxy } from 'valtio/utils';
|
||||||
@@ -29,13 +29,10 @@ function Page() {
|
|||||||
return (
|
return (
|
||||||
<Paper bg={colors['white-1']} p="lg" radius="md" shadow="sm">
|
<Paper bg={colors['white-1']} p="lg" radius="md" shadow="sm">
|
||||||
<Stack gap="md">
|
<Stack gap="md">
|
||||||
<Grid align="center">
|
<Group justify="space-between">
|
||||||
<GridCol span={{ base: 12, md: 11 }}>
|
|
||||||
<Title order={3} c={colors['blue-button']}>Preview Pejabat Desa</Title>
|
<Title order={3} c={colors['blue-button']}>Preview Pejabat Desa</Title>
|
||||||
</GridCol>
|
|
||||||
<GridCol span={{ base: 12, md: 1 }}>
|
|
||||||
<Button
|
<Button
|
||||||
style={{fontSize: 15, fontWeight: "bold"}}
|
style={{ fontSize: 15, fontWeight: "bold" }}
|
||||||
c="green"
|
c="green"
|
||||||
variant="light"
|
variant="light"
|
||||||
radius="md"
|
radius="md"
|
||||||
@@ -43,8 +40,7 @@ function Page() {
|
|||||||
>
|
>
|
||||||
Edit
|
Edit
|
||||||
</Button>
|
</Button>
|
||||||
</GridCol>
|
</Group>
|
||||||
</Grid>
|
|
||||||
{dataArray.map((item) => (
|
{dataArray.map((item) => (
|
||||||
<Paper key={item.id} p="xl" bg={'white'} withBorder radius="md" shadow="xs">
|
<Paper key={item.id} p="xl" bg={'white'} withBorder radius="md" shadow="xs">
|
||||||
<Box px={{ base: "sm", md: 100 }}>
|
<Box px={{ base: "sm", md: 100 }}>
|
||||||
|
|||||||
@@ -84,8 +84,10 @@ function DetailProgramInovasi() {
|
|||||||
|
|
||||||
<Box>
|
<Box>
|
||||||
<Text fz="lg" fw="bold">Deskripsi</Text>
|
<Text fz="lg" fw="bold">Deskripsi</Text>
|
||||||
|
<Box pl={5}>
|
||||||
<Text fz="md" c="dimmed" style={{ wordBreak: "break-word", whiteSpace: "normal" }} dangerouslySetInnerHTML={{ __html: data.description || '-' }}></Text>
|
<Text fz="md" c="dimmed" style={{ wordBreak: "break-word", whiteSpace: "normal" }} dangerouslySetInnerHTML={{ __html: data.description || '-' }}></Text>
|
||||||
</Box>
|
</Box>
|
||||||
|
</Box>
|
||||||
|
|
||||||
<Box>
|
<Box>
|
||||||
<Text fz="lg" fw="bold">Link</Text>
|
<Text fz="lg" fw="bold">Link</Text>
|
||||||
|
|||||||
@@ -144,9 +144,7 @@ function ListProgramInovasi({ search }: { search: string }) {
|
|||||||
{/* Description */}
|
{/* Description */}
|
||||||
<Box>
|
<Box>
|
||||||
<Text fz="sm" fw={600} lh={1.4}>Deskripsi</Text>
|
<Text fz="sm" fw={600} lh={1.4}>Deskripsi</Text>
|
||||||
<Text fz="sm" c="gray.7" lineClamp={2}>
|
<Text dangerouslySetInnerHTML={{ __html: item.description || '-' }} fz="sm" c="gray.7" lineClamp={2} />
|
||||||
{item.description || '-'}
|
|
||||||
</Text>
|
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
{/* Link */}
|
{/* Link */}
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ export default function EditDataLingkunganDesa() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
||||||
<IconArrowBack color={colors['blue-button']} size={24} />
|
<IconArrowBack color={colors['blue-button']} size={24} />
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ function DetailDataLingkunganDesa() {
|
|||||||
const data = stateDataLingkungan.findUnique.data;
|
const data = stateDataLingkungan.findUnique.data;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Back Button */}
|
{/* Back Button */}
|
||||||
<Button
|
<Button
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
@@ -93,7 +93,7 @@ function DetailDataLingkunganDesa() {
|
|||||||
{/* Main Card */}
|
{/* Main Card */}
|
||||||
<Paper
|
<Paper
|
||||||
withBorder
|
withBorder
|
||||||
w={{ base: '100%', md: '60%' }}
|
w={{ base: '100%', md: '70%' }}
|
||||||
bg={colors['white-1']}
|
bg={colors['white-1']}
|
||||||
p="lg"
|
p="lg"
|
||||||
radius="md"
|
radius="md"
|
||||||
@@ -131,8 +131,10 @@ function DetailDataLingkunganDesa() {
|
|||||||
|
|
||||||
<Box>
|
<Box>
|
||||||
<Text fz="lg" fw="bold">Deskripsi</Text>
|
<Text fz="lg" fw="bold">Deskripsi</Text>
|
||||||
|
<Box pl={5}>
|
||||||
<Text fz="md" c="dimmed" style={{ wordBreak: "break-word", whiteSpace: "normal" }} dangerouslySetInnerHTML={{ __html: data?.deskripsi || '-' }} />
|
<Text fz="md" c="dimmed" style={{ wordBreak: "break-word", whiteSpace: "normal" }} dangerouslySetInnerHTML={{ __html: data?.deskripsi || '-' }} />
|
||||||
</Box>
|
</Box>
|
||||||
|
</Box>
|
||||||
|
|
||||||
{/* Action Buttons */}
|
{/* Action Buttons */}
|
||||||
<Group gap="sm" mt="sm">
|
<Group gap="sm" mt="sm">
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ function CreateDataLingkunganDesa() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -1,30 +1,65 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
/* eslint-disable react-hooks/exhaustive-deps */
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
'use client'
|
'use client';
|
||||||
import colors from '@/con/colors';
|
import colors from '@/con/colors';
|
||||||
import {
|
import {
|
||||||
Box, Button, Center, Group, Pagination, Paper, Skeleton, Stack,
|
Box,
|
||||||
Table, TableTbody, TableTd, TableTh, TableThead, TableTr, Text,
|
Button,
|
||||||
Title
|
Center,
|
||||||
|
Group,
|
||||||
|
Pagination,
|
||||||
|
Paper,
|
||||||
|
Skeleton,
|
||||||
|
Stack,
|
||||||
|
Table,
|
||||||
|
TableTbody,
|
||||||
|
TableTd,
|
||||||
|
TableTh,
|
||||||
|
TableThead,
|
||||||
|
TableTr,
|
||||||
|
Text,
|
||||||
|
Title,
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import {
|
import {
|
||||||
IconChartLine, IconChristmasTreeFilled, IconClipboardTextFilled,
|
IconAlertTriangle,
|
||||||
IconDeviceImacCog, IconDroplet, IconHome, IconHomeEco, IconLeaf,
|
IconAmbulance,
|
||||||
|
IconBuilding,
|
||||||
|
IconCash,
|
||||||
|
IconChartLine,
|
||||||
|
IconChristmasTreeFilled,
|
||||||
|
IconClipboardTextFilled,
|
||||||
|
IconDeviceImacCog,
|
||||||
|
IconDroplet,
|
||||||
|
IconFiretruck,
|
||||||
|
IconHome,
|
||||||
|
IconHomeEco,
|
||||||
|
IconHospital,
|
||||||
|
IconLeaf,
|
||||||
IconPlus,
|
IconPlus,
|
||||||
IconRecycle, IconScale, IconSearch, IconShieldFilled, IconTent,
|
IconRecycle,
|
||||||
IconTrashFilled, IconTree, IconTrendingUp, IconTrophy, IconTruckFilled
|
IconScale,
|
||||||
|
IconSchool,
|
||||||
|
IconSearch,
|
||||||
|
IconShieldFilled,
|
||||||
|
IconShoppingCart,
|
||||||
|
IconTent,
|
||||||
|
IconTrashFilled,
|
||||||
|
IconTree,
|
||||||
|
IconTrendingUp,
|
||||||
|
IconTrophy,
|
||||||
|
IconTruckFilled,
|
||||||
} from '@tabler/icons-react';
|
} from '@tabler/icons-react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { useProxy } from 'valtio/utils';
|
import { useProxy } from 'valtio/utils';
|
||||||
import HeaderSearch from '../../_com/header';
|
import HeaderSearch from '../../_com/header';
|
||||||
import dataLingkunganDesaState from '../../_state/lingkungan/data-lingkungan-desa';
|
import dataLingkunganDesaState from '../../_state/lingkungan/data-lingkungan-desa';
|
||||||
|
import { useDebouncedValue } from '@mantine/hooks';
|
||||||
|
|
||||||
function DataLingkunganDesa() {
|
function DataLingkunganDesa() {
|
||||||
const [search, setSearch] = useState("");
|
const [search, setSearch] = useState('');
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box py={{ base: 'md', md: 'lg' }} px={{ base: 'sm', md: 0 }}>
|
||||||
<HeaderSearch
|
<HeaderSearch
|
||||||
title='Data Lingkungan Desa'
|
title='Data Lingkungan Desa'
|
||||||
placeholder='Cari data lingkungan...'
|
placeholder='Cari data lingkungan...'
|
||||||
@@ -38,15 +73,16 @@ function DataLingkunganDesa() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ListDataLingkunganDesa({ search }: { search: string }) {
|
function ListDataLingkunganDesa({ search }: { search: string }) {
|
||||||
const listState = useProxy(dataLingkunganDesaState)
|
const listState = useProxy(dataLingkunganDesaState);
|
||||||
const { data, loading, page, totalPages, load } = listState.findMany
|
const { data, loading, page, totalPages, load } = listState.findMany;
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const [debouncedSearch] = useDebouncedValue(search, 1000);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
load(page, 10, search)
|
load(page, 10, debouncedSearch);
|
||||||
}, [page, search])
|
}, [page, debouncedSearch]);
|
||||||
|
|
||||||
const filteredData = data || []
|
const filteredData = data || [];
|
||||||
|
|
||||||
const iconMap: Record<string, React.FC<any>> = {
|
const iconMap: Record<string, React.FC<any>> = {
|
||||||
ekowisata: IconLeaf,
|
ekowisata: IconLeaf,
|
||||||
@@ -64,12 +100,22 @@ function ListDataLingkunganDesa({ search }: { search: string }) {
|
|||||||
mencegahBencana: IconShieldFilled,
|
mencegahBencana: IconShieldFilled,
|
||||||
rumah: IconHome,
|
rumah: IconHome,
|
||||||
pohon: IconTree,
|
pohon: IconTree,
|
||||||
air: IconDroplet
|
air: IconDroplet,
|
||||||
|
bantuan: IconCash,
|
||||||
|
pelatihan: IconSchool,
|
||||||
|
subsidi: IconShoppingCart,
|
||||||
|
layananKesehatan: IconHospital,
|
||||||
|
polisi: IconShieldFilled,
|
||||||
|
ambulans: IconAmbulance,
|
||||||
|
pemadam: IconFiretruck,
|
||||||
|
rumahSakit: IconHospital,
|
||||||
|
bangunan: IconBuilding,
|
||||||
|
darurat: IconAlertTriangle
|
||||||
};
|
};
|
||||||
|
|
||||||
if (loading || !data) {
|
if (loading || !data) {
|
||||||
return (
|
return (
|
||||||
<Stack py={10}>
|
<Stack py="md">
|
||||||
<Skeleton height={600} radius="md" />
|
<Skeleton height={600} radius="md" />
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
@@ -77,46 +123,66 @@ function ListDataLingkunganDesa({ search }: { search: string }) {
|
|||||||
|
|
||||||
if (data.length === 0) {
|
if (data.length === 0) {
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Box py="md">
|
||||||
<Paper withBorder shadow="md" radius="md" p="lg" bg={colors['white-1']}>
|
<Paper withBorder shadow="md" radius="md" p={{ base: 'md', md: 'lg' }} bg={colors['white-1']}>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Group justify="space-between" mb="md">
|
<Group justify="space-between" mb="md">
|
||||||
<Title order={4}>Daftar Data Lingkungan Desa</Title>
|
<Title order={4} lh={1.2}>
|
||||||
<Button leftSection={<IconPlus size={18} />} color="blue" variant="light" onClick={() => router.push('/admin/lingkungan/data-lingkungan-desa/create')}>
|
Daftar Data Lingkungan Desa
|
||||||
|
</Title>
|
||||||
|
<Button
|
||||||
|
leftSection={<IconPlus size={18} />}
|
||||||
|
color="blue"
|
||||||
|
variant="light"
|
||||||
|
onClick={() => router.push('/admin/lingkungan/data-lingkungan-desa/create')}
|
||||||
|
>
|
||||||
Tambah Baru
|
Tambah Baru
|
||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
<Table highlightOnHover>
|
<Box visibleFrom="md">
|
||||||
|
<Table highlightOnHover miw={0} style={{ tableLayout: 'fixed', width: '100%' }}>
|
||||||
<TableThead>
|
<TableThead>
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTh>No</TableTh>
|
<TableTh style={{ width: '5%', textAlign: 'center' }}>No</TableTh>
|
||||||
<TableTh>Nama Data Lingkungan Desa</TableTh>
|
<TableTh style={{ width: '25%' }}>Nama Data Lingkungan Desa</TableTh>
|
||||||
<TableTh>Jumlah</TableTh>
|
<TableTh style={{ width: '35%' }}>Jumlah</TableTh>
|
||||||
<TableTh>Ikon</TableTh>
|
<TableTh style={{ width: '15%' }}>Ikon</TableTh>
|
||||||
<TableTh>Detail</TableTh>
|
<TableTh style={{ width: '20%', textAlign: 'center' }}>Detail</TableTh>
|
||||||
</TableTr>
|
</TableTr>
|
||||||
</TableThead>
|
</TableThead>
|
||||||
</Table>
|
</Table>
|
||||||
<Center py={20}>
|
</Box>
|
||||||
<Text c="dimmed">Tidak ada data lingkungan desa yang tersedia</Text>
|
<Center py="xl">
|
||||||
|
<Text c="dimmed" fz={{ base: 'sm', md: 'md' }} lh={1.4}>
|
||||||
|
Tidak ada data lingkungan desa yang tersedia
|
||||||
|
</Text>
|
||||||
</Center>
|
</Center>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Paper>
|
</Paper>
|
||||||
</Box >
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Box py="md">
|
||||||
<Paper withBorder shadow="md" radius="md" bg={colors['white-1']} p="lg">
|
<Paper withBorder shadow="md" radius="md" p={{ base: 'md', md: 'lg' }} bg={colors['white-1']}>
|
||||||
<Group justify="space-between" mb="md">
|
<Group justify="space-between" mb="md">
|
||||||
<Title order={4}>Daftar Data Lingkungan Desa</Title>
|
<Title order={4} lh={1.2}>
|
||||||
<Button leftSection={<IconPlus size={18} />} color="blue" variant="light" onClick={() => router.push('/admin/lingkungan/data-lingkungan-desa/create')}>
|
Daftar Data Lingkungan Desa
|
||||||
|
</Title>
|
||||||
|
<Button
|
||||||
|
leftSection={<IconPlus size={18} />}
|
||||||
|
color="blue"
|
||||||
|
variant="light"
|
||||||
|
onClick={() => router.push('/admin/lingkungan/data-lingkungan-desa/create')}
|
||||||
|
>
|
||||||
Tambah Baru
|
Tambah Baru
|
||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
<Box style={{ overflowX: 'auto' }}>
|
|
||||||
<Table highlightOnHover>
|
{/* Desktop Table */}
|
||||||
|
<Box visibleFrom="md">
|
||||||
|
<Table highlightOnHover miw={0} style={{ tableLayout: 'fixed', width: '100%' }}>
|
||||||
<TableThead>
|
<TableThead>
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTh style={{ width: '5%', textAlign: 'center' }}>No</TableTh>
|
<TableTh style={{ width: '5%', textAlign: 'center' }}>No</TableTh>
|
||||||
@@ -129,21 +195,21 @@ function ListDataLingkunganDesa({ search }: { search: string }) {
|
|||||||
<TableTbody>
|
<TableTbody>
|
||||||
{filteredData.map((item, index) => (
|
{filteredData.map((item, index) => (
|
||||||
<TableTr key={item.id}>
|
<TableTr key={item.id}>
|
||||||
<TableTd style={{ textAlign: 'center' }}>{index + 1}</TableTd>
|
<TableTd ta="center">{index + 1}</TableTd>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
<Text fw={500} truncate="end" lineClamp={1}>{item.name}</Text>
|
<Text fz="md" fw={500} lh={1.5} truncate="end" lineClamp={1}>
|
||||||
|
{item.name}
|
||||||
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
<Text fz="sm" c="dimmed">± {item.jumlah}</Text>
|
<Text fz="sm" c="dimmed" lh={1.5}>
|
||||||
|
± {item.jumlah}
|
||||||
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
{iconMap[item.icon] && (
|
{iconMap[item.icon] && <Box title={item.icon}>{React.createElement(iconMap[item.icon], { size: 22 })}</Box>}
|
||||||
<Box title={item.icon}>
|
|
||||||
{React.createElement(iconMap[item.icon], { size: 22 })}
|
|
||||||
</Box>
|
|
||||||
)}
|
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd style={{ textAlign: 'center' }}>
|
<TableTd ta="center">
|
||||||
<Button
|
<Button
|
||||||
size="xs"
|
size="xs"
|
||||||
radius="md"
|
radius="md"
|
||||||
@@ -160,7 +226,62 @@ function ListDataLingkunganDesa({ search }: { search: string }) {
|
|||||||
</TableTbody>
|
</TableTbody>
|
||||||
</Table>
|
</Table>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
{/* Mobile Cards */}
|
||||||
|
<Box hiddenFrom="md">
|
||||||
|
<Stack gap="sm">
|
||||||
|
{filteredData.map((item, index) => (
|
||||||
|
<Paper key={item.id} withBorder radius="md" p="sm" bg={colors['white-1']}>
|
||||||
|
<Stack gap={"xs"}>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
No
|
||||||
|
</Text>
|
||||||
|
<Text fz="sm" fw={500} lh={1.4}>
|
||||||
|
{index + 1}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
Nama Data
|
||||||
|
</Text>
|
||||||
|
<Text fz="sm" fw={500} lh={1.4} truncate="end">
|
||||||
|
{item.name}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
Jumlah
|
||||||
|
</Text>
|
||||||
|
<Text fz="sm" fw={500} lh={1.4}>
|
||||||
|
± {item.jumlah}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
Ikon
|
||||||
|
</Text>
|
||||||
|
{iconMap[item.icon] && <Box title={item.icon}>{React.createElement(iconMap[item.icon], { size: 22 })}</Box>}
|
||||||
|
</Box>
|
||||||
|
<Center>
|
||||||
|
<Button
|
||||||
|
size="xs"
|
||||||
|
radius="md"
|
||||||
|
variant="light"
|
||||||
|
color="blue"
|
||||||
|
leftSection={<IconDeviceImacCog size={16} />}
|
||||||
|
onClick={() => router.push(`/admin/lingkungan/data-lingkungan-desa/${item.id}`)}
|
||||||
|
>
|
||||||
|
Detail
|
||||||
|
</Button>
|
||||||
|
</Center>
|
||||||
|
</Stack>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
))}
|
||||||
|
</Stack>
|
||||||
|
</Box>
|
||||||
|
</Paper>
|
||||||
|
|
||||||
<Center>
|
<Center>
|
||||||
<Pagination
|
<Pagination
|
||||||
value={page}
|
value={page}
|
||||||
@@ -178,4 +299,5 @@ function ListDataLingkunganDesa({ search }: { search: string }) {
|
|||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default DataLingkunganDesa;
|
export default DataLingkunganDesa;
|
||||||
@@ -59,6 +59,7 @@ function LayoutTabs({ children }: { children: React.ReactNode }) {
|
|||||||
radius="lg"
|
radius="lg"
|
||||||
keepMounted={false}
|
keepMounted={false}
|
||||||
>
|
>
|
||||||
|
<Box visibleFrom='md' pb={10}>
|
||||||
<ScrollArea type="auto" offsetScrollbars>
|
<ScrollArea type="auto" offsetScrollbars>
|
||||||
<TabsList
|
<TabsList
|
||||||
p="sm"
|
p="sm"
|
||||||
@@ -69,7 +70,7 @@ function LayoutTabs({ children }: { children: React.ReactNode }) {
|
|||||||
display: "flex",
|
display: "flex",
|
||||||
flexWrap: "nowrap",
|
flexWrap: "nowrap",
|
||||||
gap: "0.5rem",
|
gap: "0.5rem",
|
||||||
paddingInline: "0.5rem",
|
paddingInline: "0.5rem", // ✅ biar nggak nempel ke tepi
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{tabs.map((tab, i) => (
|
{tabs.map((tab, i) => (
|
||||||
@@ -80,22 +81,54 @@ function LayoutTabs({ children }: { children: React.ReactNode }) {
|
|||||||
style={{
|
style={{
|
||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
fontSize: "0.9rem",
|
fontSize: "0.9rem",
|
||||||
whiteSpace: "nowrap",
|
|
||||||
transition: "all 0.2s ease",
|
transition: "all 0.2s ease",
|
||||||
|
flexShrink: 0, // ✅ jangan mengecil aneh-aneh
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span style={{
|
|
||||||
display: "inline-block",
|
|
||||||
maxWidth: "200px",
|
|
||||||
overflow: "hidden",
|
|
||||||
textOverflow: "ellipsis"
|
|
||||||
}}>
|
|
||||||
{tab.label}
|
{tab.label}
|
||||||
</span>
|
|
||||||
</TabsTab>
|
</TabsTab>
|
||||||
))}
|
))}
|
||||||
</TabsList>
|
</TabsList>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
<Box hiddenFrom='md' pb={10}>
|
||||||
|
<ScrollArea
|
||||||
|
type="auto"
|
||||||
|
offsetScrollbars={false}
|
||||||
|
w="100%"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TabsList
|
||||||
|
p="xs" // lebih kecil
|
||||||
|
style={{
|
||||||
|
background: "linear-gradient(135deg, #e7ebf7, #f9faff)",
|
||||||
|
borderRadius: "1rem",
|
||||||
|
display: "flex",
|
||||||
|
flexWrap: "nowrap",
|
||||||
|
gap: "0.5rem",
|
||||||
|
width: "max-content", // ⬅️ kunci
|
||||||
|
maxWidth: "100%", // ⬅️ penting
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{tabs.map((tab, i) => (
|
||||||
|
<TabsTab
|
||||||
|
key={i}
|
||||||
|
value={tab.value}
|
||||||
|
leftSection={tab.icon}
|
||||||
|
style={{
|
||||||
|
fontWeight: 600,
|
||||||
|
fontSize: "0.9rem",
|
||||||
|
paddingInline: "0.75rem", // ⬅️ lebih ramping
|
||||||
|
flexShrink: 0, // ✅ jangan mengecil aneh-aneh
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{tab.label}
|
||||||
|
</TabsTab>
|
||||||
|
))}
|
||||||
|
</TabsList>
|
||||||
|
</ScrollArea>
|
||||||
|
</Box>
|
||||||
|
|
||||||
{tabs.map((tab, i) => (
|
{tabs.map((tab, i) => (
|
||||||
<TabsPanel key={i} value={tab.value}>
|
<TabsPanel key={i} value={tab.value}>
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ export default function EditContohKegiatanDesaDarmasaba() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import { Box, Button, Grid, GridCol, Paper, Skeleton, Stack, Text, Title } from '@mantine/core';
|
import { Box, Button, Group, Paper, Skeleton, Stack, Text, Title } from '@mantine/core';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useShallowEffect } from '@mantine/hooks';
|
||||||
import { IconEdit } from '@tabler/icons-react';
|
import { IconEdit } from '@tabler/icons-react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
@@ -25,13 +25,10 @@ function Page() {
|
|||||||
return (
|
return (
|
||||||
<Box p="md">
|
<Box p="md">
|
||||||
<Paper withBorder p={{ base: 'md', md: 'lg' }} radius="md">
|
<Paper withBorder p={{ base: 'md', md: 'lg' }} radius="md">
|
||||||
<Grid align="center" mb={{ base: 'md', md: 'lg' }}>
|
<Group justify="space-between" align="center" mb={{ base: 'md', md: 'lg' }}>
|
||||||
<GridCol span={{ base: 12, md: 11 }}>
|
|
||||||
<Title order={3} fw={600}>
|
<Title order={3} fw={600}>
|
||||||
Preview Contoh Kegiatan Di Desa Darmasaba
|
Preview Contoh Kegiatan Di Desa Darmasaba
|
||||||
</Title>
|
</Title>
|
||||||
</GridCol>
|
|
||||||
<GridCol span={{ base: 12, md: 1 }} style={{ textAlign: 'right' }}>
|
|
||||||
<Button
|
<Button
|
||||||
size="sm"
|
size="sm"
|
||||||
variant="light"
|
variant="light"
|
||||||
@@ -46,8 +43,7 @@ function Page() {
|
|||||||
>
|
>
|
||||||
Edit
|
Edit
|
||||||
</Button>
|
</Button>
|
||||||
</GridCol>
|
</Group>
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Stack gap="md">
|
<Stack gap="md">
|
||||||
<Paper p={{ base: 'md', md: 'xl' }} bg="#ECEEF8" radius="md">
|
<Paper p={{ base: 'md', md: 'xl' }} bg="#ECEEF8" radius="md">
|
||||||
|
|||||||
@@ -1,7 +1,28 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
import { usePathname } from "next/navigation";
|
||||||
import LayoutTabs from "./_lib/layouTabs";
|
import LayoutTabs from "./_lib/layouTabs";
|
||||||
|
import { Box } from "@mantine/core";
|
||||||
|
|
||||||
export default function Layout({ children }: { children: React.ReactNode }) {
|
export default function Layout({ children }: { children: React.ReactNode }) {
|
||||||
|
const pathname = usePathname();
|
||||||
|
|
||||||
|
// Contoh path:
|
||||||
|
// - /darmasaba/desa/berita/semua → panjang 5 → list
|
||||||
|
// - /darmasaba/desa/berita/Pemerintahan → panjang 5 → list
|
||||||
|
// - /darmasaba/desa/berita/Pemerintahan/123 → panjang 6 → detail
|
||||||
|
|
||||||
|
const segments = pathname.split('/').filter(Boolean);
|
||||||
|
const isDetailPage = segments.length >= 5;
|
||||||
|
|
||||||
|
if (isDetailPage) {
|
||||||
|
// Tampilkan tanpa tab menu
|
||||||
|
return (
|
||||||
|
<Box>
|
||||||
|
{children}
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LayoutTabs>
|
<LayoutTabs>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ export default function EditMateriEdukasiYangDiberikan() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
||||||
<IconArrowBack color={colors['blue-button']} size={24} />
|
<IconArrowBack color={colors['blue-button']} size={24} />
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import { Box, Button, Grid, GridCol, Paper, Skeleton, Stack, Text, Title } from '@mantine/core';
|
import { Box, Button, Group, Paper, Skeleton, Stack, Text, Title } from '@mantine/core';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useShallowEffect } from '@mantine/hooks';
|
||||||
import { IconEdit } from '@tabler/icons-react';
|
import { IconEdit } from '@tabler/icons-react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
@@ -25,11 +25,8 @@ function Page() {
|
|||||||
return (
|
return (
|
||||||
<Box p="md">
|
<Box p="md">
|
||||||
<Paper withBorder p={{ base: 'md', md: 'lg' }} radius="md">
|
<Paper withBorder p={{ base: 'md', md: 'lg' }} radius="md">
|
||||||
<Grid align="center" mb={{ base: 'md', md: 'lg' }}>
|
<Group align="center" justify='space-between' mb={{ base: 'md', md: 'lg' }}>
|
||||||
<GridCol span={{ base: 12, md: 11 }}>
|
|
||||||
<Title order={3} fw={600}>Preview Materi Edukasi Yang Diberikan</Title>
|
<Title order={3} fw={600}>Preview Materi Edukasi Yang Diberikan</Title>
|
||||||
</GridCol>
|
|
||||||
<GridCol span={{ base: 12, md: 1 }} style={{ textAlign: 'right' }}>
|
|
||||||
<Button
|
<Button
|
||||||
size="sm"
|
size="sm"
|
||||||
variant="light"
|
variant="light"
|
||||||
@@ -42,8 +39,7 @@ function Page() {
|
|||||||
>
|
>
|
||||||
Edit
|
Edit
|
||||||
</Button>
|
</Button>
|
||||||
</GridCol>
|
</Group>
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Stack gap="md">
|
<Stack gap="md">
|
||||||
<Paper p={{ base: 'md', md: 'xl' }} bg="#ECEEF8" radius="md">
|
<Paper p={{ base: 'md', md: 'xl' }} bg="#ECEEF8" radius="md">
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ export default function EditTujuanEdukasiLingkungan() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button
|
<Button
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import { Box, Button, Grid, GridCol, Paper, Skeleton, Stack, Text, Title } from '@mantine/core';
|
import { Box, Button, Group, Paper, Skeleton, Stack, Text, Title } from '@mantine/core';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useShallowEffect } from '@mantine/hooks';
|
||||||
import { IconEdit } from '@tabler/icons-react';
|
import { IconEdit } from '@tabler/icons-react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
@@ -25,11 +25,8 @@ function Page() {
|
|||||||
return (
|
return (
|
||||||
<Box p="md">
|
<Box p="md">
|
||||||
<Paper withBorder p={{ base: 'md', md: 'lg' }} radius="md">
|
<Paper withBorder p={{ base: 'md', md: 'lg' }} radius="md">
|
||||||
<Grid align="center" mb={{ base: 'md', md: 'lg' }}>
|
<Group align="center" justify='space-between' mb={{ base: 'md', md: 'lg' }}>
|
||||||
<GridCol span={{ base: 12, md: 11 }}>
|
|
||||||
<Title order={3} fw={600}>Preview Tujuan Edukasi Lingkungan</Title>
|
<Title order={3} fw={600}>Preview Tujuan Edukasi Lingkungan</Title>
|
||||||
</GridCol>
|
|
||||||
<GridCol span={{ base: 12, md: 1 }} style={{ textAlign: 'right' }}>
|
|
||||||
<Button
|
<Button
|
||||||
size="sm"
|
size="sm"
|
||||||
variant="light"
|
variant="light"
|
||||||
@@ -42,8 +39,7 @@ function Page() {
|
|||||||
>
|
>
|
||||||
Edit
|
Edit
|
||||||
</Button>
|
</Button>
|
||||||
</GridCol>
|
</Group>
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Stack gap="md">
|
<Stack gap="md">
|
||||||
<Paper p={{ base: 'md', md: 'xl' }} bg="#ECEEF8" radius="md">
|
<Paper p={{ base: 'md', md: 'xl' }} bg="#ECEEF8" radius="md">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* eslint-disable react-hooks/exhaustive-deps */
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
'use client'
|
'use client'
|
||||||
import colors from '@/con/colors';
|
import colors from '@/con/colors';
|
||||||
import { ScrollArea, Stack, Tabs, TabsList, TabsPanel, TabsTab, Title } from '@mantine/core';
|
import { Box, ScrollArea, Stack, Tabs, TabsList, TabsPanel, TabsTab, Title } from '@mantine/core';
|
||||||
import { IconClipboardList, IconTags } from '@tabler/icons-react';
|
import { IconClipboardList, IconTags } from '@tabler/icons-react';
|
||||||
import { usePathname, useRouter } from 'next/navigation';
|
import { usePathname, useRouter } from 'next/navigation';
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
@@ -59,6 +59,7 @@ function LayoutTabs({ children }: { children: React.ReactNode }) {
|
|||||||
keepMounted={false}
|
keepMounted={false}
|
||||||
>
|
>
|
||||||
{/* ✅ Scroll horizontal */}
|
{/* ✅ Scroll horizontal */}
|
||||||
|
<Box visibleFrom='md' pb={10}>
|
||||||
<ScrollArea type="auto" offsetScrollbars>
|
<ScrollArea type="auto" offsetScrollbars>
|
||||||
<TabsList
|
<TabsList
|
||||||
p="sm"
|
p="sm"
|
||||||
@@ -69,7 +70,7 @@ function LayoutTabs({ children }: { children: React.ReactNode }) {
|
|||||||
display: "flex",
|
display: "flex",
|
||||||
flexWrap: "nowrap",
|
flexWrap: "nowrap",
|
||||||
gap: "0.5rem",
|
gap: "0.5rem",
|
||||||
paddingInline: "0.5rem",
|
paddingInline: "0.5rem", // ✅ biar nggak nempel ke tepi
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{tabs.map((tab, i) => (
|
{tabs.map((tab, i) => (
|
||||||
@@ -81,6 +82,7 @@ function LayoutTabs({ children }: { children: React.ReactNode }) {
|
|||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
fontSize: "0.9rem",
|
fontSize: "0.9rem",
|
||||||
transition: "all 0.2s ease",
|
transition: "all 0.2s ease",
|
||||||
|
flexShrink: 0, // ✅ jangan mengecil aneh-aneh
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{tab.label}
|
{tab.label}
|
||||||
@@ -88,6 +90,45 @@ function LayoutTabs({ children }: { children: React.ReactNode }) {
|
|||||||
))}
|
))}
|
||||||
</TabsList>
|
</TabsList>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
<Box hiddenFrom='md' pb={10}>
|
||||||
|
<ScrollArea
|
||||||
|
type="auto"
|
||||||
|
offsetScrollbars={false}
|
||||||
|
w="100%"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TabsList
|
||||||
|
p="xs" // lebih kecil
|
||||||
|
style={{
|
||||||
|
background: "linear-gradient(135deg, #e7ebf7, #f9faff)",
|
||||||
|
borderRadius: "1rem",
|
||||||
|
display: "flex",
|
||||||
|
flexWrap: "nowrap",
|
||||||
|
gap: "0.5rem",
|
||||||
|
width: "max-content", // ⬅️ kunci
|
||||||
|
maxWidth: "100%", // ⬅️ penting
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{tabs.map((tab, i) => (
|
||||||
|
<TabsTab
|
||||||
|
key={i}
|
||||||
|
value={tab.value}
|
||||||
|
leftSection={tab.icon}
|
||||||
|
style={{
|
||||||
|
fontWeight: 600,
|
||||||
|
fontSize: "0.9rem",
|
||||||
|
paddingInline: "0.75rem", // ⬅️ lebih ramping
|
||||||
|
flexShrink: 0, // ✅ jangan mengecil aneh-aneh
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{tab.label}
|
||||||
|
</TabsTab>
|
||||||
|
))}
|
||||||
|
</TabsList>
|
||||||
|
</ScrollArea>
|
||||||
|
</Box>
|
||||||
|
|
||||||
{/* ✅ Panel dengan gaya kartu */}
|
{/* ✅ Panel dengan gaya kartu */}
|
||||||
{tabs.map((tab, i) => (
|
{tabs.map((tab, i) => (
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ function EditKategoriKegiatan() {
|
|||||||
if (loading) return <Text>Loading...</Text>;
|
if (loading) return <Text>Loading...</Text>;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
<Group mb="md" align="center">
|
<Group mb="md" align="center">
|
||||||
<Button variant="subtle" p="xs" radius="md" onClick={() => router.back()}>
|
<Button variant="subtle" p="xs" radius="md" onClick={() => router.back()}>
|
||||||
<IconArrowBack color={colors['blue-button']} size={24} />
|
<IconArrowBack color={colors['blue-button']} size={24} />
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ function CreateKategoriKegiatan() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<Group mb="md" align="center">
|
<Group mb="md" align="center">
|
||||||
<Button variant="subtle" p="xs" radius="md" onClick={() => router.back()}>
|
<Button variant="subtle" p="xs" radius="md" onClick={() => router.back()}>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
Title
|
Title
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useDebouncedValue, useShallowEffect } from '@mantine/hooks';
|
||||||
import { IconEdit, IconPlus, IconSearch, IconTrash } from '@tabler/icons-react';
|
import { IconEdit, IconPlus, IconSearch, IconTrash } from '@tabler/icons-react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
@@ -28,7 +28,7 @@ import { ModalKonfirmasiHapus } from '../../../_com/modalKonfirmasiHapus';
|
|||||||
import gotongRoyongState from '../../../_state/lingkungan/gotong-royong';
|
import gotongRoyongState from '../../../_state/lingkungan/gotong-royong';
|
||||||
|
|
||||||
function KategoriKegiatan() {
|
function KategoriKegiatan() {
|
||||||
const [search, setSearch] = useState("")
|
const [search, setSearch] = useState("");
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<HeaderSearch
|
<HeaderSearch
|
||||||
@@ -44,10 +44,11 @@ function KategoriKegiatan() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ListKategoriKegiatan({ search }: { search: string }) {
|
function ListKategoriKegiatan({ search }: { search: string }) {
|
||||||
const stateKategori = useProxy(gotongRoyongState.kategoriKegiatan)
|
const stateKategori = useProxy(gotongRoyongState.kategoriKegiatan);
|
||||||
const [modalHapus, setModalHapus] = useState(false)
|
const [modalHapus, setModalHapus] = useState(false);
|
||||||
const [selectedId, setSelectedId] = useState<string | null>(null)
|
const [selectedId, setSelectedId] = useState<string | null>(null);
|
||||||
const router = useRouter()
|
const router = useRouter();
|
||||||
|
const [debouncedSearch] = useDebouncedValue(search, 1000);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data,
|
data,
|
||||||
@@ -55,52 +56,76 @@ function ListKategoriKegiatan({ search }: { search: string }) {
|
|||||||
totalPages,
|
totalPages,
|
||||||
loading,
|
loading,
|
||||||
load,
|
load,
|
||||||
} = stateKategori.findMany
|
} = stateKategori.findMany;
|
||||||
|
|
||||||
const handleHapus = () => {
|
const handleHapus = () => {
|
||||||
if (selectedId) {
|
if (selectedId) {
|
||||||
stateKategori.delete.byId(selectedId)
|
stateKategori.delete.byId(selectedId);
|
||||||
setModalHapus(false)
|
setModalHapus(false);
|
||||||
setSelectedId(null)
|
setSelectedId(null);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
load(page, 10, search)
|
load(page, 10, debouncedSearch);
|
||||||
}, [page, search])
|
}, [page, debouncedSearch]);
|
||||||
|
|
||||||
const filteredData = data || []
|
const filteredData = data || [];
|
||||||
|
|
||||||
if (loading || !data) {
|
if (loading || !data) {
|
||||||
return (
|
return (
|
||||||
<Stack py={10}>
|
<Stack py={{ base: 'md', md: 'lg' }}>
|
||||||
<Skeleton height={500} radius="md" />
|
<Skeleton height={500} radius="md" />
|
||||||
</Stack>
|
</Stack>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Box py={{ base: 'md', md: 'lg' }}>
|
||||||
<Paper withBorder bg={colors['white-1']} p="lg" shadow="md" radius="md">
|
<Paper withBorder bg={colors['white-1']} p={{ base: 'md', md: 'lg' }} shadow="md" radius="md">
|
||||||
<Group justify="space-between" mb="md">
|
<Group justify="space-between" mb="md">
|
||||||
<Title order={4}>Daftar Kategori Kegiatan</Title>
|
<Title order={4} lh={1.2}>
|
||||||
|
Daftar Kategori Kegiatan
|
||||||
|
</Title>
|
||||||
<Button
|
<Button
|
||||||
leftSection={<IconPlus size={18} />}
|
leftSection={<IconPlus size={18} />}
|
||||||
color="blue"
|
color="blue"
|
||||||
variant="light"
|
variant="light"
|
||||||
onClick={() => router.push('/admin/lingkungan/gotong-royong/kategori-kegiatan/create')}
|
onClick={() =>
|
||||||
|
router.push('/admin/lingkungan/gotong-royong/kategori-kegiatan/create')
|
||||||
|
}
|
||||||
>
|
>
|
||||||
Tambah Baru
|
Tambah Baru
|
||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
<Box style={{ overflowX: 'auto' }}>
|
{/* Desktop Table */}
|
||||||
<Table highlightOnHover>
|
<Box visibleFrom="md">
|
||||||
|
<Table
|
||||||
|
highlightOnHover
|
||||||
|
miw={0}
|
||||||
|
style={{
|
||||||
|
tableLayout: 'fixed',
|
||||||
|
width: '100%',
|
||||||
|
}}
|
||||||
|
>
|
||||||
<TableThead>
|
<TableThead>
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTh style={{ width: '60%' }}>Nama Kategori</TableTh>
|
<TableTh style={{ width: '60%' }}>
|
||||||
<TableTh style={{ width: '20%' }}>Edit</TableTh>
|
<Text fz="sm" fw={600} lh={1.2} ta="left">
|
||||||
<TableTh style={{ width: '20%' }}>Delete</TableTh>
|
Nama Kategori
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '20%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.2} ta="center">
|
||||||
|
Edit
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '20%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.2} ta="center">
|
||||||
|
Delete
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
</TableTr>
|
</TableTr>
|
||||||
</TableThead>
|
</TableThead>
|
||||||
<TableTbody>
|
<TableTbody>
|
||||||
@@ -108,21 +133,27 @@ function ListKategoriKegiatan({ search }: { search: string }) {
|
|||||||
filteredData.map((item) => (
|
filteredData.map((item) => (
|
||||||
<TableTr key={item.id}>
|
<TableTr key={item.id}>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
<Text fw={500} truncate="end" lineClamp={1}>{item.nama}</Text>
|
<Text fz="md" fw={500} lh={1.5} truncate="end">
|
||||||
|
{item.nama}
|
||||||
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd ta="center">
|
||||||
<Button
|
<Button
|
||||||
size="xs"
|
size="xs"
|
||||||
radius="md"
|
radius="md"
|
||||||
variant="light"
|
variant="light"
|
||||||
color="green"
|
color="green"
|
||||||
leftSection={<IconEdit size={16} />}
|
leftSection={<IconEdit size={16} />}
|
||||||
onClick={() => router.push(`/admin/lingkungan/gotong-royong/kategori-kegiatan/${item.id}`)}
|
onClick={() =>
|
||||||
|
router.push(
|
||||||
|
`/admin/lingkungan/gotong-royong/kategori-kegiatan/${item.id}`
|
||||||
|
)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
Edit
|
Edit
|
||||||
</Button>
|
</Button>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd ta="center">
|
||||||
<Button
|
<Button
|
||||||
size="xs"
|
size="xs"
|
||||||
radius="md"
|
radius="md"
|
||||||
@@ -130,8 +161,8 @@ function ListKategoriKegiatan({ search }: { search: string }) {
|
|||||||
color="red"
|
color="red"
|
||||||
leftSection={<IconTrash size={16} />}
|
leftSection={<IconTrash size={16} />}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setSelectedId(item.id)
|
setSelectedId(item.id);
|
||||||
setModalHapus(true)
|
setModalHapus(true);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Hapus
|
Hapus
|
||||||
@@ -142,8 +173,10 @@ function ListKategoriKegiatan({ search }: { search: string }) {
|
|||||||
) : (
|
) : (
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTd colSpan={3}>
|
<TableTd colSpan={3}>
|
||||||
<Center py={20}>
|
<Center py="xl">
|
||||||
<Text c="dimmed">Tidak ada kategori kegiatan yang cocok</Text>
|
<Text c="dimmed" fz="sm" lh={1.4}>
|
||||||
|
Tidak ada kategori kegiatan yang cocok
|
||||||
|
</Text>
|
||||||
</Center>
|
</Center>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
</TableTr>
|
</TableTr>
|
||||||
@@ -151,6 +184,63 @@ function ListKategoriKegiatan({ search }: { search: string }) {
|
|||||||
</TableTbody>
|
</TableTbody>
|
||||||
</Table>
|
</Table>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
{/* Mobile Cards */}
|
||||||
|
<Box hiddenFrom="md">
|
||||||
|
<Stack gap="sm">
|
||||||
|
{filteredData.length > 0 ? (
|
||||||
|
filteredData.map((item) => (
|
||||||
|
<Paper key={item.id} withBorder p="md" radius="md">
|
||||||
|
<Stack gap={"xs"}>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
Nama Kategori
|
||||||
|
</Text>
|
||||||
|
<Text fz="sm" fw={500} lh={1.45}>
|
||||||
|
{item.nama}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
<Group justify="flex-end" mt="xs">
|
||||||
|
<Button
|
||||||
|
size="xs"
|
||||||
|
radius="md"
|
||||||
|
variant="light"
|
||||||
|
color="green"
|
||||||
|
leftSection={<IconEdit size={16} />}
|
||||||
|
onClick={() =>
|
||||||
|
router.push(
|
||||||
|
`/admin/lingkungan/gotong-royong/kategori-kegiatan/${item.id}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
Edit
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
size="xs"
|
||||||
|
radius="md"
|
||||||
|
variant="light"
|
||||||
|
color="red"
|
||||||
|
leftSection={<IconTrash size={16} />}
|
||||||
|
onClick={() => {
|
||||||
|
setSelectedId(item.id);
|
||||||
|
setModalHapus(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Hapus
|
||||||
|
</Button>
|
||||||
|
</Group>
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<Center py="xl">
|
||||||
|
<Text c="dimmed" fz="sm" lh={1.4}>
|
||||||
|
Tidak ada kategori kegiatan yang cocok
|
||||||
|
</Text>
|
||||||
|
</Center>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
</Box>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
|
||||||
<Center>
|
<Center>
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ export default function EditKegiatanDesa() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
||||||
<IconArrowBack color={colors['blue-button']} size={24} />
|
<IconArrowBack color={colors['blue-button']} size={24} />
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ function DetailKegiatanDesa() {
|
|||||||
const data = kegiatanDesaState.findUnique.data;
|
const data = kegiatanDesaState.findUnique.data;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Tombol Kembali */}
|
{/* Tombol Kembali */}
|
||||||
<Button
|
<Button
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
@@ -55,7 +55,7 @@ function DetailKegiatanDesa() {
|
|||||||
{/* Container Detail */}
|
{/* Container Detail */}
|
||||||
<Paper
|
<Paper
|
||||||
withBorder
|
withBorder
|
||||||
w={{ base: "100%", md: "60%" }}
|
w={{ base: "100%", md: "70%" }}
|
||||||
bg={colors['white-1']}
|
bg={colors['white-1']}
|
||||||
p="lg"
|
p="lg"
|
||||||
radius="md"
|
radius="md"
|
||||||
@@ -85,14 +85,18 @@ function DetailKegiatanDesa() {
|
|||||||
{/* Deskripsi Singkat */}
|
{/* Deskripsi Singkat */}
|
||||||
<Box>
|
<Box>
|
||||||
<Text fz="lg" fw="bold">Deskripsi Singkat</Text>
|
<Text fz="lg" fw="bold">Deskripsi Singkat</Text>
|
||||||
|
<Box pl={5}>
|
||||||
<Text fz="md" c="dimmed" style={{ wordBreak: "break-word", whiteSpace: "normal" }} dangerouslySetInnerHTML={{ __html: data.deskripsiSingkat || '-' }} />
|
<Text fz="md" c="dimmed" style={{ wordBreak: "break-word", whiteSpace: "normal" }} dangerouslySetInnerHTML={{ __html: data.deskripsiSingkat || '-' }} />
|
||||||
</Box>
|
</Box>
|
||||||
|
</Box>
|
||||||
|
|
||||||
{/* Deskripsi Lengkap */}
|
{/* Deskripsi Lengkap */}
|
||||||
<Box>
|
<Box>
|
||||||
<Text fz="lg" fw="bold">Deskripsi</Text>
|
<Text fz="lg" fw="bold">Deskripsi</Text>
|
||||||
|
<Box pl={5}>
|
||||||
<Text fz="md" c="dimmed" style={{ wordBreak: "break-word", whiteSpace: "normal" }} dangerouslySetInnerHTML={{ __html: data.deskripsiLengkap || '-' }} />
|
<Text fz="md" c="dimmed" style={{ wordBreak: "break-word", whiteSpace: "normal" }} dangerouslySetInnerHTML={{ __html: data.deskripsiLengkap || '-' }} />
|
||||||
</Box>
|
</Box>
|
||||||
|
</Box>
|
||||||
|
|
||||||
{/* Kategori */}
|
{/* Kategori */}
|
||||||
<Box>
|
<Box>
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ function CreateKegiatanDesa() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
Title,
|
Title,
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useDebouncedValue, useShallowEffect } from '@mantine/hooks';
|
||||||
import { IconDeviceImacCog, IconPlus, IconSearch } from '@tabler/icons-react';
|
import { IconDeviceImacCog, IconPlus, IconSearch } from '@tabler/icons-react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
@@ -45,6 +45,7 @@ function KegiatanDesa() {
|
|||||||
function ListKegiatanDesa({ search }: { search: string }) {
|
function ListKegiatanDesa({ search }: { search: string }) {
|
||||||
const listState = useProxy(gotongRoyongState.kegiatanDesa);
|
const listState = useProxy(gotongRoyongState.kegiatanDesa);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const [debouncedSearch] = useDebouncedValue(search, 1000);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data,
|
data,
|
||||||
@@ -55,24 +56,26 @@ function ListKegiatanDesa({ search }: { search: string }) {
|
|||||||
} = listState.findMany;
|
} = listState.findMany;
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
load(page, 10, search)
|
load(page, 10, debouncedSearch);
|
||||||
}, [page, search])
|
}, [page, debouncedSearch]);
|
||||||
|
|
||||||
const filteredData = data || []
|
const filteredData = data || [];
|
||||||
|
|
||||||
if (loading || !data) {
|
if (loading || !data) {
|
||||||
return (
|
return (
|
||||||
<Stack py={10}>
|
<Stack py={{ base: 'sm', md: 'md' }}>
|
||||||
<Skeleton height={600} radius="md" />
|
<Skeleton height={600} radius="md" />
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Box py={{ base: 'sm', md: 'md' }}>
|
||||||
<Paper withBorder bg={colors['white-1']} p="lg" shadow="md" radius="md">
|
<Paper withBorder bg={colors['white-1']} p={{ base: 'sm', md: 'lg' }} shadow="md" radius="md">
|
||||||
<Group justify="space-between" mb="md">
|
<Group justify="space-between" mb={{ base: 'sm', md: 'md' }}>
|
||||||
<Title order={4}>Daftar Kegiatan Desa</Title>
|
<Title order={4} lh={1.2}>
|
||||||
|
Daftar Kegiatan Desa
|
||||||
|
</Title>
|
||||||
<Button
|
<Button
|
||||||
leftSection={<IconPlus size={18} />}
|
leftSection={<IconPlus size={18} />}
|
||||||
color="blue"
|
color="blue"
|
||||||
@@ -84,14 +87,39 @@ function ListKegiatanDesa({ search }: { search: string }) {
|
|||||||
Tambah Baru
|
Tambah Baru
|
||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
<Box style={{ overflowX: 'auto' }}>
|
|
||||||
<Table highlightOnHover>
|
{/* Desktop: Table */}
|
||||||
|
<Box visibleFrom="md">
|
||||||
|
<Table
|
||||||
|
highlightOnHover
|
||||||
|
miw={0}
|
||||||
|
style={{
|
||||||
|
tableLayout: 'fixed',
|
||||||
|
width: '100%',
|
||||||
|
}}
|
||||||
|
>
|
||||||
<TableThead>
|
<TableThead>
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTh style={{ width: '30%' }}>Judul</TableTh>
|
<TableTh style={{ width: '30%' }}>
|
||||||
<TableTh style={{ width: '25%' }}>Kategori</TableTh>
|
<Text fz="sm" fw={600} lh={1.4} c="dark">
|
||||||
<TableTh style={{ width: '25%' }}>Lokasi</TableTh>
|
Judul
|
||||||
<TableTh style={{ width: '15%' }}>Aksi</TableTh>
|
</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '25%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4} c="dark">
|
||||||
|
Kategori
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '25%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4} c="dark">
|
||||||
|
Lokasi
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
|
<TableTh style={{ width: '20%' }}>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4} c="dark">
|
||||||
|
Aksi
|
||||||
|
</Text>
|
||||||
|
</TableTh>
|
||||||
</TableTr>
|
</TableTr>
|
||||||
</TableThead>
|
</TableThead>
|
||||||
<TableTbody>
|
<TableTbody>
|
||||||
@@ -99,17 +127,36 @@ function ListKegiatanDesa({ search }: { search: string }) {
|
|||||||
filteredData.map((item) => (
|
filteredData.map((item) => (
|
||||||
<TableTr key={item.id}>
|
<TableTr key={item.id}>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
<Text fw={500} truncate="end" lineClamp={1}>
|
<Text
|
||||||
|
fz="md"
|
||||||
|
fw={500}
|
||||||
|
lh={1.5}
|
||||||
|
truncate="end"
|
||||||
|
lineClamp={1}
|
||||||
|
c="dark"
|
||||||
|
>
|
||||||
{item.judul}
|
{item.judul}
|
||||||
</Text>
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
<Text fz="sm" c="dimmed">
|
<Text
|
||||||
|
fz="sm"
|
||||||
|
fw={500}
|
||||||
|
lh={1.5}
|
||||||
|
c="dark"
|
||||||
|
>
|
||||||
{item.kategoriKegiatan?.nama || '-'}
|
{item.kategoriKegiatan?.nama || '-'}
|
||||||
</Text>
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
<Text fz="sm">{item.lokasi}</Text>
|
<Text
|
||||||
|
fz="sm"
|
||||||
|
fw={500}
|
||||||
|
lh={1.5}
|
||||||
|
c="dark"
|
||||||
|
>
|
||||||
|
{item.lokasi}
|
||||||
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
<Button
|
<Button
|
||||||
@@ -133,7 +180,7 @@ function ListKegiatanDesa({ search }: { search: string }) {
|
|||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTd colSpan={4}>
|
<TableTd colSpan={4}>
|
||||||
<Center py={20}>
|
<Center py={20}>
|
||||||
<Text c="dimmed">
|
<Text fz="sm" c="dimmed" lh={1.4}>
|
||||||
Tidak ada kegiatan desa yang cocok dengan pencarian
|
Tidak ada kegiatan desa yang cocok dengan pencarian
|
||||||
</Text>
|
</Text>
|
||||||
</Center>
|
</Center>
|
||||||
@@ -143,6 +190,64 @@ function ListKegiatanDesa({ search }: { search: string }) {
|
|||||||
</TableTbody>
|
</TableTbody>
|
||||||
</Table>
|
</Table>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
{/* Mobile: Card List */}
|
||||||
|
<Stack hiddenFrom="md" gap="xs">
|
||||||
|
{filteredData.length > 0 ? (
|
||||||
|
filteredData.map((item) => (
|
||||||
|
<Paper key={item.id} withBorder radius="md" p="sm">
|
||||||
|
<Stack gap={"xs"}>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4} c="dark">
|
||||||
|
Judul
|
||||||
|
</Text>
|
||||||
|
<Text fz="sm" fw={500} lh={1.4} c="dark" truncate="end">
|
||||||
|
{item.judul}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4} c="dark">
|
||||||
|
Kategori
|
||||||
|
</Text>
|
||||||
|
<Text fz="sm" fw={500} lh={1.4} c="dark">
|
||||||
|
{item.kategoriKegiatan?.nama || '-'}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4} c="dark">
|
||||||
|
Lokasi
|
||||||
|
</Text>
|
||||||
|
<Text fz="sm" fw={500} lh={1.4} c="dark">
|
||||||
|
{item.lokasi}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Button
|
||||||
|
size="xs"
|
||||||
|
radius="md"
|
||||||
|
variant="light"
|
||||||
|
color="blue"
|
||||||
|
leftSection={<IconDeviceImacCog size={16} />}
|
||||||
|
onClick={() =>
|
||||||
|
router.push(
|
||||||
|
`/admin/lingkungan/gotong-royong/kegiatan-desa/${item.id}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
Detail
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<Center py={20}>
|
||||||
|
<Text fz="sm" c="dimmed" lh={1.4}>
|
||||||
|
Tidak ada kegiatan desa yang cocok dengan pencarian
|
||||||
|
</Text>
|
||||||
|
</Center>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
</Paper>
|
</Paper>
|
||||||
<Center>
|
<Center>
|
||||||
<Pagination
|
<Pagination
|
||||||
|
|||||||
@@ -1,6 +1,28 @@
|
|||||||
|
'use client'
|
||||||
|
import { usePathname } from "next/navigation";
|
||||||
import LayoutTabs from "./_lib/layoutTabs";
|
import LayoutTabs from "./_lib/layoutTabs";
|
||||||
|
import { Box } from "@mantine/core";
|
||||||
|
|
||||||
export default function Layout({ children }: { children: React.ReactNode }) {
|
export default function Layout({ children }: { children: React.ReactNode }) {
|
||||||
|
const pathname = usePathname();
|
||||||
|
|
||||||
|
// Contoh path:
|
||||||
|
// - /darmasaba/desa/berita/semua → panjang 5 → list
|
||||||
|
// - /darmasaba/desa/berita/Pemerintahan → panjang 5 → list
|
||||||
|
// - /darmasaba/desa/berita/Pemerintahan/123 → panjang 6 → detail
|
||||||
|
|
||||||
|
const segments = pathname.split('/').filter(Boolean);
|
||||||
|
const isDetailPage = segments.length >= 5;
|
||||||
|
|
||||||
|
if (isDetailPage) {
|
||||||
|
// Tampilkan tanpa tab menu
|
||||||
|
return (
|
||||||
|
<Box>
|
||||||
|
{children}
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LayoutTabs>
|
<LayoutTabs>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ function LayoutTabs({ children }: { children: React.ReactNode }) {
|
|||||||
radius="lg"
|
radius="lg"
|
||||||
keepMounted={false}
|
keepMounted={false}
|
||||||
>
|
>
|
||||||
|
<Box visibleFrom='md' pb={10}>
|
||||||
<ScrollArea type="auto" offsetScrollbars>
|
<ScrollArea type="auto" offsetScrollbars>
|
||||||
<TabsList
|
<TabsList
|
||||||
p="sm"
|
p="sm"
|
||||||
@@ -69,7 +70,7 @@ function LayoutTabs({ children }: { children: React.ReactNode }) {
|
|||||||
display: "flex",
|
display: "flex",
|
||||||
flexWrap: "nowrap",
|
flexWrap: "nowrap",
|
||||||
gap: "0.5rem",
|
gap: "0.5rem",
|
||||||
paddingInline: "0.5rem",
|
paddingInline: "0.5rem", // ✅ biar nggak nempel ke tepi
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{tabs.map((tab, i) => (
|
{tabs.map((tab, i) => (
|
||||||
@@ -80,22 +81,54 @@ function LayoutTabs({ children }: { children: React.ReactNode }) {
|
|||||||
style={{
|
style={{
|
||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
fontSize: "0.9rem",
|
fontSize: "0.9rem",
|
||||||
whiteSpace: "nowrap",
|
|
||||||
transition: "all 0.2s ease",
|
transition: "all 0.2s ease",
|
||||||
|
flexShrink: 0, // ✅ jangan mengecil aneh-aneh
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span style={{
|
|
||||||
display: "inline-block",
|
|
||||||
maxWidth: "200px",
|
|
||||||
overflow: "hidden",
|
|
||||||
textOverflow: "ellipsis"
|
|
||||||
}}>
|
|
||||||
{tab.label}
|
{tab.label}
|
||||||
</span>
|
|
||||||
</TabsTab>
|
</TabsTab>
|
||||||
))}
|
))}
|
||||||
</TabsList>
|
</TabsList>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
<Box hiddenFrom='md' pb={10}>
|
||||||
|
<ScrollArea
|
||||||
|
type="auto"
|
||||||
|
offsetScrollbars={false}
|
||||||
|
w="100%"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TabsList
|
||||||
|
p="xs" // lebih kecil
|
||||||
|
style={{
|
||||||
|
background: "linear-gradient(135deg, #e7ebf7, #f9faff)",
|
||||||
|
borderRadius: "1rem",
|
||||||
|
display: "flex",
|
||||||
|
flexWrap: "nowrap",
|
||||||
|
gap: "0.5rem",
|
||||||
|
width: "max-content", // ⬅️ kunci
|
||||||
|
maxWidth: "100%", // ⬅️ penting
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{tabs.map((tab, i) => (
|
||||||
|
<TabsTab
|
||||||
|
key={i}
|
||||||
|
value={tab.value}
|
||||||
|
leftSection={tab.icon}
|
||||||
|
style={{
|
||||||
|
fontWeight: 600,
|
||||||
|
fontSize: "0.9rem",
|
||||||
|
paddingInline: "0.75rem", // ⬅️ lebih ramping
|
||||||
|
flexShrink: 0, // ✅ jangan mengecil aneh-aneh
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{tab.label}
|
||||||
|
</TabsTab>
|
||||||
|
))}
|
||||||
|
</TabsList>
|
||||||
|
</ScrollArea>
|
||||||
|
</Box>
|
||||||
|
|
||||||
{tabs.map((tab, i) => (
|
{tabs.map((tab, i) => (
|
||||||
<TabsPanel key={i} value={tab.value}>
|
<TabsPanel key={i} value={tab.value}>
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ function EditBentukKonservasiBerdasarkanAdat() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import { Box, Button, Grid, GridCol, Paper, Skeleton, Stack, Text, Title } from '@mantine/core';
|
import { Box, Button, Group, Paper, Skeleton, Stack, Text, Title } from '@mantine/core';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useShallowEffect } from '@mantine/hooks';
|
||||||
import { IconEdit } from '@tabler/icons-react';
|
import { IconEdit } from '@tabler/icons-react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
@@ -28,13 +28,10 @@ function Page() {
|
|||||||
<Box p="md">
|
<Box p="md">
|
||||||
<Paper withBorder p={{ base: 'md', md: 'lg' }} radius="md">
|
<Paper withBorder p={{ base: 'md', md: 'lg' }} radius="md">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<Grid align="center" mb={{ base: 'md', md: 'lg' }}>
|
<Group justify='space-between' align="center" mb={{ base: 'md', md: 'lg' }}>
|
||||||
<GridCol span={{ base: 12, md: 11 }}>
|
|
||||||
<Title order={3} fw={600} c="dark">
|
<Title order={3} fw={600} c="dark">
|
||||||
Preview Bentuk Konservasi Berdasarkan Adat
|
Preview Bentuk Konservasi Berdasarkan Adat
|
||||||
</Title>
|
</Title>
|
||||||
</GridCol>
|
|
||||||
<GridCol span={{ base: 12, md: 1 }} style={{ textAlign: 'right' }}>
|
|
||||||
<Button
|
<Button
|
||||||
size="sm"
|
size="sm"
|
||||||
variant="light"
|
variant="light"
|
||||||
@@ -49,8 +46,7 @@ function Page() {
|
|||||||
>
|
>
|
||||||
Edit
|
Edit
|
||||||
</Button>
|
</Button>
|
||||||
</GridCol>
|
</Group>
|
||||||
</Grid>
|
|
||||||
|
|
||||||
{/* Konten */}
|
{/* Konten */}
|
||||||
<Stack gap="md">
|
<Stack gap="md">
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ function EditFilosofiTriHitaKarana() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import { Box, Button, Grid, GridCol, Paper, Skeleton, Stack, Text, Title } from '@mantine/core';
|
import { Box, Button, Group, Paper, Skeleton, Stack, Text, Title } from '@mantine/core';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useShallowEffect } from '@mantine/hooks';
|
||||||
import { IconEdit } from '@tabler/icons-react';
|
import { IconEdit } from '@tabler/icons-react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
@@ -25,13 +25,10 @@ function Page() {
|
|||||||
return (
|
return (
|
||||||
<Box p="md">
|
<Box p="md">
|
||||||
<Paper withBorder p={{ base: 'md', md: 'lg' }} radius="md">
|
<Paper withBorder p={{ base: 'md', md: 'lg' }} radius="md">
|
||||||
<Grid align="center" mb={{ base: 'md', md: 'lg' }}>
|
<Group justify="space-between" align="center" mb={{ base: 'md', md: 'lg' }}>
|
||||||
<GridCol span={{ base: 12, md: 11 }}>
|
|
||||||
<Title order={3} fw={600}>
|
<Title order={3} fw={600}>
|
||||||
Preview Filosofi Tri Hita Karana
|
Preview Filosofi Tri Hita Karana
|
||||||
</Title>
|
</Title>
|
||||||
</GridCol>
|
|
||||||
<GridCol span={{ base: 12, md: 1 }} style={{ textAlign: 'right' }}>
|
|
||||||
<Button
|
<Button
|
||||||
size="sm"
|
size="sm"
|
||||||
variant="light"
|
variant="light"
|
||||||
@@ -46,8 +43,7 @@ function Page() {
|
|||||||
>
|
>
|
||||||
Edit
|
Edit
|
||||||
</Button>
|
</Button>
|
||||||
</GridCol>
|
</Group>
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Stack gap="md">
|
<Stack gap="md">
|
||||||
<Paper p={{ base: 'md', md: 'xl' }} bg="#ECEEF8" radius="md">
|
<Paper p={{ base: 'md', md: 'xl' }} bg="#ECEEF8" radius="md">
|
||||||
|
|||||||
@@ -1,8 +1,29 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
import { usePathname } from "next/navigation";
|
||||||
import LayoutTabs from "./_lib/layoutTabs"
|
import LayoutTabs from "./_lib/layoutTabs"
|
||||||
|
import { Box } from "@mantine/core";
|
||||||
|
|
||||||
|
|
||||||
export default function Layout({ children }: { children: React.ReactNode }) {
|
export default function Layout({ children }: { children: React.ReactNode }) {
|
||||||
|
const pathname = usePathname();
|
||||||
|
|
||||||
|
// Contoh path:
|
||||||
|
// - /darmasaba/desa/berita/semua → panjang 5 → list
|
||||||
|
// - /darmasaba/desa/berita/Pemerintahan → panjang 5 → list
|
||||||
|
// - /darmasaba/desa/berita/Pemerintahan/123 → panjang 6 → detail
|
||||||
|
|
||||||
|
const segments = pathname.split('/').filter(Boolean);
|
||||||
|
const isDetailPage = segments.length >= 5;
|
||||||
|
|
||||||
|
if (isDetailPage) {
|
||||||
|
// Tampilkan tanpa tab menu
|
||||||
|
return (
|
||||||
|
<Box>
|
||||||
|
{children}
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LayoutTabs>
|
<LayoutTabs>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ function EditNilaiKonservasiAdat() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import { Box, Button, Grid, GridCol, Paper, Skeleton, Stack, Text, Title } from '@mantine/core';
|
import { Box, Button, Group, Paper, Skeleton, Stack, Text, Title } from '@mantine/core';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useShallowEffect } from '@mantine/hooks';
|
||||||
import { IconEdit } from '@tabler/icons-react';
|
import { IconEdit } from '@tabler/icons-react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
@@ -25,13 +25,10 @@ function Page() {
|
|||||||
return (
|
return (
|
||||||
<Box p="md">
|
<Box p="md">
|
||||||
<Paper withBorder p={{ base: 'md', md: 'lg' }} radius="md">
|
<Paper withBorder p={{ base: 'md', md: 'lg' }} radius="md">
|
||||||
<Grid align="center" mb={{ base: 'md', md: 'lg' }}>
|
<Group align="center" justify='space-between' mb={{ base: 'md', md: 'lg' }}>
|
||||||
<GridCol span={{ base: 12, md: 11 }}>
|
|
||||||
<Title order={3} fw={600}>
|
<Title order={3} fw={600}>
|
||||||
Preview Nilai Konservasi Adat
|
Preview Nilai Konservasi Adat
|
||||||
</Title>
|
</Title>
|
||||||
</GridCol>
|
|
||||||
<GridCol span={{ base: 12, md: 1 }} style={{ textAlign: 'right' }}>
|
|
||||||
<Button
|
<Button
|
||||||
size="sm"
|
size="sm"
|
||||||
variant="light"
|
variant="light"
|
||||||
@@ -44,8 +41,7 @@ function Page() {
|
|||||||
>
|
>
|
||||||
Edit
|
Edit
|
||||||
</Button>
|
</Button>
|
||||||
</GridCol>
|
</Group>
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Stack gap="md">
|
<Stack gap="md">
|
||||||
<Paper p={{ base: 'md', md: 'xl' }} bg="#ECEEF8" radius="md">
|
<Paper p={{ base: 'md', md: 'xl' }} bg="#ECEEF8" radius="md">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* eslint-disable react-hooks/exhaustive-deps */
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
'use client'
|
'use client'
|
||||||
import colors from '@/con/colors';
|
import colors from '@/con/colors';
|
||||||
import { ScrollArea, Stack, Tabs, TabsList, TabsPanel, TabsTab, Title } from '@mantine/core';
|
import { Box, ScrollArea, Stack, Tabs, TabsList, TabsPanel, TabsTab, Title } from '@mantine/core';
|
||||||
import { IconRecycle, IconTrash } from '@tabler/icons-react';
|
import { IconRecycle, IconTrash } from '@tabler/icons-react';
|
||||||
import { usePathname, useRouter } from 'next/navigation';
|
import { usePathname, useRouter } from 'next/navigation';
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
@@ -58,6 +58,7 @@ function LayoutTabsPengelolaanSampahBankSampah({ children }: { children: React.R
|
|||||||
keepMounted={false}
|
keepMounted={false}
|
||||||
>
|
>
|
||||||
{/* ✅ Scroll horizontal wrapper */}
|
{/* ✅ Scroll horizontal wrapper */}
|
||||||
|
<Box visibleFrom='md' pb={10}>
|
||||||
<ScrollArea type="auto" offsetScrollbars>
|
<ScrollArea type="auto" offsetScrollbars>
|
||||||
<TabsList
|
<TabsList
|
||||||
p="sm"
|
p="sm"
|
||||||
@@ -68,7 +69,7 @@ function LayoutTabsPengelolaanSampahBankSampah({ children }: { children: React.R
|
|||||||
display: "flex",
|
display: "flex",
|
||||||
flexWrap: "nowrap",
|
flexWrap: "nowrap",
|
||||||
gap: "0.5rem",
|
gap: "0.5rem",
|
||||||
paddingInline: "0.5rem",
|
paddingInline: "0.5rem", // ✅ biar nggak nempel ke tepi
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{tabs.map((tab, i) => (
|
{tabs.map((tab, i) => (
|
||||||
@@ -80,6 +81,7 @@ function LayoutTabsPengelolaanSampahBankSampah({ children }: { children: React.R
|
|||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
fontSize: "0.9rem",
|
fontSize: "0.9rem",
|
||||||
transition: "all 0.2s ease",
|
transition: "all 0.2s ease",
|
||||||
|
flexShrink: 0, // ✅ jangan mengecil aneh-aneh
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{tab.label}
|
{tab.label}
|
||||||
@@ -87,6 +89,45 @@ function LayoutTabsPengelolaanSampahBankSampah({ children }: { children: React.R
|
|||||||
))}
|
))}
|
||||||
</TabsList>
|
</TabsList>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
<Box hiddenFrom='md' pb={10}>
|
||||||
|
<ScrollArea
|
||||||
|
type="auto"
|
||||||
|
offsetScrollbars={false}
|
||||||
|
w="100%"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TabsList
|
||||||
|
p="xs" // lebih kecil
|
||||||
|
style={{
|
||||||
|
background: "linear-gradient(135deg, #e7ebf7, #f9faff)",
|
||||||
|
borderRadius: "1rem",
|
||||||
|
display: "flex",
|
||||||
|
flexWrap: "nowrap",
|
||||||
|
gap: "0.5rem",
|
||||||
|
width: "max-content", // ⬅️ kunci
|
||||||
|
maxWidth: "100%", // ⬅️ penting
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{tabs.map((tab, i) => (
|
||||||
|
<TabsTab
|
||||||
|
key={i}
|
||||||
|
value={tab.value}
|
||||||
|
leftSection={tab.icon}
|
||||||
|
style={{
|
||||||
|
fontWeight: 600,
|
||||||
|
fontSize: "0.9rem",
|
||||||
|
paddingInline: "0.75rem", // ⬅️ lebih ramping
|
||||||
|
flexShrink: 0, // ✅ jangan mengecil aneh-aneh
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{tab.label}
|
||||||
|
</TabsTab>
|
||||||
|
))}
|
||||||
|
</TabsList>
|
||||||
|
</ScrollArea>
|
||||||
|
</Box>
|
||||||
|
|
||||||
{tabs.map((tab, i) => (
|
{tabs.map((tab, i) => (
|
||||||
<TabsPanel
|
<TabsPanel
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ function EditKeteranganBankSampahTerdekat() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
||||||
<IconArrowBack color={colors['blue-button']} size={24} />
|
<IconArrowBack color={colors['blue-button']} size={24} />
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ function DetailKeteranganBankSampahTerdekat() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
<Box mb="md">
|
<Box mb="md">
|
||||||
<Button
|
<Button
|
||||||
variant="light"
|
variant="light"
|
||||||
@@ -57,7 +57,7 @@ function DetailKeteranganBankSampahTerdekat() {
|
|||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Paper
|
<Paper
|
||||||
w={{ base: "100%", md: "60%" }}
|
w={{ base: "100%", md: "70%" }}
|
||||||
p="xl"
|
p="xl"
|
||||||
radius="lg"
|
radius="lg"
|
||||||
withBorder
|
withBorder
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ function CreateKeteranganBankSampahTerdekat() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box px={{ base: 'sm', md: 'lg' }} py="md">
|
<Box px={{ base: 0, md: 'lg' }} py="xs">
|
||||||
<Group mb="md">
|
<Group mb="md">
|
||||||
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
<Button variant="subtle" onClick={() => router.back()} p="xs" radius="md">
|
||||||
<IconArrowBack color={colors['blue-button']} size={24} />
|
<IconArrowBack color={colors['blue-button']} size={24} />
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import colors from '@/con/colors';
|
import colors from '@/con/colors';
|
||||||
import { Box, Button, Center, Group, Pagination, Paper, Skeleton, Stack, Table, TableTbody, TableTd, TableTh, TableThead, TableTr, Text, Title } from '@mantine/core';
|
import { Box, Button, Center, Group, Pagination, Paper, Skeleton, Stack, Table, TableTbody, TableTd, TableTh, TableThead, TableTr, Text, Title } from '@mantine/core';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useDebouncedValue, useShallowEffect } from '@mantine/hooks';
|
||||||
import { IconDeviceImac, IconPlus, IconSearch } from '@tabler/icons-react';
|
import { IconDeviceImac, IconPlus, IconSearch } from '@tabler/icons-react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
@@ -28,6 +28,7 @@ function KeteranganBankSampahTerdekat() {
|
|||||||
function ListKeteranganBankSampahTerdekat({ search }: { search: string }) {
|
function ListKeteranganBankSampahTerdekat({ search }: { search: string }) {
|
||||||
const keteranganState = useProxy(pengelolaanSampahState.keteranganSampah);
|
const keteranganState = useProxy(pengelolaanSampahState.keteranganSampah);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const [debouncedSearch] = useDebouncedValue(search, 1000);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data,
|
data,
|
||||||
@@ -38,24 +39,26 @@ function ListKeteranganBankSampahTerdekat({ search }: { search: string }) {
|
|||||||
} = keteranganState.findMany;
|
} = keteranganState.findMany;
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
load(page, 10, search);
|
load(page, 10, debouncedSearch);
|
||||||
}, [page, search]);
|
}, [page, debouncedSearch]);
|
||||||
|
|
||||||
const filteredData = data || [];
|
const filteredData = data || [];
|
||||||
|
|
||||||
if (loading || !data) {
|
if (loading || !data) {
|
||||||
return (
|
return (
|
||||||
<Stack py={10}>
|
<Stack py={{ base: 'sm', md: 'md' }}>
|
||||||
<Skeleton height={600} radius="md" />
|
<Skeleton height={600} radius="md" />
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box py={10}>
|
<Box py={{ base: 'sm', md: 'md' }}>
|
||||||
<Paper bg={colors['white-1']} p="lg" shadow="md" radius="md">
|
<Paper bg={colors['white-1']} p={{ base: 'md', md: 'lg' }} shadow="md" radius="md">
|
||||||
<Group justify="space-between" mb="md">
|
<Group justify="space-between" mb={{ base: 'sm', md: 'md' }}>
|
||||||
<Title order={4}>Daftar Bank Sampah Terdekat</Title>
|
<Title order={4} lh={1.2}>
|
||||||
|
Daftar Bank Sampah Terdekat
|
||||||
|
</Title>
|
||||||
<Button
|
<Button
|
||||||
leftSection={<IconPlus size={18} />}
|
leftSection={<IconPlus size={18} />}
|
||||||
color="blue"
|
color="blue"
|
||||||
@@ -66,14 +69,22 @@ function ListKeteranganBankSampahTerdekat({ search }: { search: string }) {
|
|||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
<Box style={{ overflowX: 'auto' }}>
|
{/* Desktop Table */}
|
||||||
<Table highlightOnHover>
|
<Box visibleFrom="md">
|
||||||
|
<Table
|
||||||
|
highlightOnHover
|
||||||
|
miw={0}
|
||||||
|
style={{
|
||||||
|
tableLayout: 'fixed',
|
||||||
|
width: '100%',
|
||||||
|
}}
|
||||||
|
>
|
||||||
<TableThead>
|
<TableThead>
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTh>Nama Bank Sampah</TableTh>
|
<TableTh style={{ width: '30%' }}>Nama Bank Sampah</TableTh>
|
||||||
<TableTh>Alamat</TableTh>
|
<TableTh style={{ width: '35%' }}>Alamat</TableTh>
|
||||||
<TableTh>Nama Tempat di Maps</TableTh>
|
<TableTh style={{ width: '25%' }}>Nama Tempat di Maps</TableTh>
|
||||||
<TableTh>Aksi</TableTh>
|
<TableTh style={{ width: '10%' }}>Aksi</TableTh>
|
||||||
</TableTr>
|
</TableTr>
|
||||||
</TableThead>
|
</TableThead>
|
||||||
<TableTbody>
|
<TableTbody>
|
||||||
@@ -81,17 +92,17 @@ function ListKeteranganBankSampahTerdekat({ search }: { search: string }) {
|
|||||||
filteredData.map((item) => (
|
filteredData.map((item) => (
|
||||||
<TableTr key={item.id}>
|
<TableTr key={item.id}>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
<Text fw={500}>{item.name}</Text>
|
<Text fz="md" fw={500} lh={1.5}>
|
||||||
|
{item.name}
|
||||||
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
<Box w={200}>
|
<Text fz="sm" lh={1.5} lineClamp={2}>
|
||||||
<Text lineClamp={2} truncate="end" fz="sm">
|
|
||||||
{item.alamat || '-'}
|
{item.alamat || '-'}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
|
||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd>
|
<TableTd>
|
||||||
<Text fz="sm">
|
<Text fz="sm" lh={1.5}>
|
||||||
{item.namaTempatMaps || '-'}
|
{item.namaTempatMaps || '-'}
|
||||||
</Text>
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
@@ -100,6 +111,7 @@ function ListKeteranganBankSampahTerdekat({ search }: { search: string }) {
|
|||||||
variant="light"
|
variant="light"
|
||||||
color="blue"
|
color="blue"
|
||||||
onClick={() => router.push(`/admin/lingkungan/pengelolaan-sampah-bank-sampah/keterangan-bank-sampah-terdekat/${item.id}`)}
|
onClick={() => router.push(`/admin/lingkungan/pengelolaan-sampah-bank-sampah/keterangan-bank-sampah-terdekat/${item.id}`)}
|
||||||
|
p="xs"
|
||||||
>
|
>
|
||||||
<IconDeviceImac size={20} />
|
<IconDeviceImac size={20} />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -108,8 +120,10 @@ function ListKeteranganBankSampahTerdekat({ search }: { search: string }) {
|
|||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
<TableTr>
|
<TableTr>
|
||||||
<TableTd colSpan={4} align="center" py="xl">
|
<TableTd colSpan={4} ta="center" py="xl">
|
||||||
<Text c="dimmed">Tidak ada data bank sampah terdekat</Text>
|
<Text c="dimmed" fz="sm" lh={1.4}>
|
||||||
|
Tidak ada data bank sampah terdekat
|
||||||
|
</Text>
|
||||||
</TableTd>
|
</TableTd>
|
||||||
</TableTr>
|
</TableTr>
|
||||||
)}
|
)}
|
||||||
@@ -117,8 +131,60 @@ function ListKeteranganBankSampahTerdekat({ search }: { search: string }) {
|
|||||||
</Table>
|
</Table>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
{totalPages > 1 && (
|
{/* Mobile Card */}
|
||||||
<Center mt="xl">
|
<Box hiddenFrom="md">
|
||||||
|
<Stack gap="xs">
|
||||||
|
{filteredData.length > 0 ? (
|
||||||
|
filteredData.map((item) => (
|
||||||
|
<Paper key={item.id} p="sm" radius="sm" withBorder>
|
||||||
|
<Stack gap={"xs"}>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
Nama Bank Sampah
|
||||||
|
</Text>
|
||||||
|
<Text fz="sm" fw={500} lh={1.4}>
|
||||||
|
{item.name}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
Alamat
|
||||||
|
</Text>
|
||||||
|
<Text fz="sm" fw={500} lh={1.4}>
|
||||||
|
{item.alamat || '-'}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text fz="sm" fw={600} lh={1.4}>
|
||||||
|
Nama Tempat di Maps
|
||||||
|
</Text>
|
||||||
|
<Text fz="sm" fw={500} lh={1.4}>
|
||||||
|
{item.namaTempatMaps || '-'}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
<Group justify="flex-end" mt="xs">
|
||||||
|
<Button
|
||||||
|
variant="light"
|
||||||
|
color="blue"
|
||||||
|
onClick={() => router.push(`/admin/lingkungan/pengelolaan-sampah-bank-sampah/keterangan-bank-sampah-terdekat/${item.id}`)}
|
||||||
|
p="xs"
|
||||||
|
>
|
||||||
|
<IconDeviceImac size={20} />
|
||||||
|
</Button>
|
||||||
|
</Group>
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<Center py="xl">
|
||||||
|
<Text c="dimmed" fz="sm" lh={1.4}>
|
||||||
|
Tidak ada data bank sampah terdekat
|
||||||
|
</Text>
|
||||||
|
</Center>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
</Box>
|
||||||
|
<Center mt={{ base: 'lg', md: 'xl' }}>
|
||||||
<Pagination
|
<Pagination
|
||||||
value={page}
|
value={page}
|
||||||
onChange={(newPage) => load(newPage)}
|
onChange={(newPage) => load(newPage)}
|
||||||
@@ -128,7 +194,6 @@ function ListKeteranganBankSampahTerdekat({ search }: { search: string }) {
|
|||||||
withEdges
|
withEdges
|
||||||
/>
|
/>
|
||||||
</Center>
|
</Center>
|
||||||
)}
|
|
||||||
</Paper>
|
</Paper>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user