Fix Admin Menu SDGs Desa & APBdes Desa, Fix UI IMage Layanan Landing Page & Layanan Desa

This commit is contained in:
2025-09-09 17:14:28 +08:00
parent 75475dc62e
commit a9d98895bb
19 changed files with 153 additions and 141 deletions

2
.gitignore vendored
View File

@@ -48,3 +48,5 @@ next-env.d.ts
.env.* .env.*
*.tar.gz

View File

@@ -140,7 +140,7 @@ function EditSuratKeterangan() {
{/* Upload Gambar 1 */} {/* Upload Gambar 1 */}
<Box> <Box>
<Text fw="bold" fz="sm" mb={6}> <Text fw="bold" fz="sm" mb={6}>
Gambar 1 Gambar Konten Pelayanan
</Text> </Text>
<Dropzone <Dropzone
onDrop={(files) => { onDrop={(files) => {
@@ -196,7 +196,7 @@ function EditSuratKeterangan() {
{/* Upload Gambar 2 */} {/* Upload Gambar 2 */}
<Box> <Box>
<Text fw="bold" fz="sm" mb={6}> <Text fw="bold" fz="sm" mb={6}>
Gambar 2 Gambar Alur Pelayanan Surat
</Text> </Text>
<Dropzone <Dropzone
onDrop={(files) => { onDrop={(files) => {

View File

@@ -100,7 +100,7 @@ function DetailSuratKeterangan() {
<Box> <Box>
<Text fz="lg" fw="bold"> <Text fz="lg" fw="bold">
Gambar Gambar Konten Pelayanan
</Text> </Text>
{data?.image?.link ? ( {data?.image?.link ? (
<Image <Image
@@ -120,7 +120,7 @@ function DetailSuratKeterangan() {
<Box> <Box>
<Text fz="lg" fw="bold"> <Text fz="lg" fw="bold">
Gambar 2 Gambar Alur Pelayanan Surat
</Text> </Text>
{data?.image2?.link ? ( {data?.image2?.link ? (
<Image <Image

View File

@@ -126,10 +126,10 @@ function CreateSuratKeterangan() {
/> />
</Box> </Box>
{/* Gambar Utama */} {/* Gambar Konten Pelayanan */}
<Box> <Box>
<Text fw="bold" fz="sm" mb={6}> <Text fw="bold" fz="sm" mb={6}>
Gambar Utama Gambar Konten Pelayanan
</Text> </Text>
<Dropzone <Dropzone
onDrop={(files) => { onDrop={(files) => {
@@ -175,10 +175,10 @@ function CreateSuratKeterangan() {
)} )}
</Box> </Box>
{/* Gambar Tambahan */} {/* Gambar Alur Pelayanan Surat */}
<Box> <Box>
<Text fw="bold" fz="sm" mb={6}> <Text fw="bold" fz="sm" mb={6}>
Gambar Tambahan (Opsional) Gambar Alur Pelayanan Surat
</Text> </Text>
<Dropzone <Dropzone
onDrop={(files) => { onDrop={(files) => {

View File

@@ -107,7 +107,7 @@ function EditAPBDes() {
await apbdesState.edit.update(); await apbdesState.edit.update();
toast.success('APBDes berhasil diperbarui!'); toast.success('APBDes berhasil diperbarui!');
router.push('/admin/landing-page/APBDes'); router.push('/admin/landing-page/apbdes');
} catch (error) { } catch (error) {
console.error('Error updating APBDes:', error); console.error('Error updating APBDes:', error);
toast.error('Terjadi kesalahan saat memperbarui APBDes'); toast.error('Terjadi kesalahan saat memperbarui APBDes');

View File

@@ -28,7 +28,7 @@ function DetailAPBDes() {
apbdesState.delete.byId(selectedId) apbdesState.delete.byId(selectedId)
setModalHapus(false) setModalHapus(false)
setSelectedId(null) setSelectedId(null)
router.push("/admin/landing-page/APBDes") router.push("/admin/landing-page/apbdes")
} }
} }
@@ -135,7 +135,7 @@ function DetailAPBDes() {
<Tooltip label="Edit APBDes" withArrow position="top"> <Tooltip label="Edit APBDes" withArrow position="top">
<Button <Button
color="green" color="green"
onClick={() => router.push(`/admin/landing-page/APBDes/${data.id}/edit`)} onClick={() => router.push(`/admin/landing-page/apbdes/${data.id}/edit`)}
variant="light" variant="light"
radius="md" radius="md"
size="md" size="md"

View File

@@ -73,7 +73,7 @@ function CreateAPBDes() {
toast.success("Berhasil menambahkan APBDes"); toast.success("Berhasil menambahkan APBDes");
resetForm(); resetForm();
router.push("/admin/landing-page/APBDes"); router.push("/admin/landing-page/apbdes");
} catch (error) { } catch (error) {
console.error("Gagal submit:", error); console.error("Gagal submit:", error);
toast.error("Gagal menyimpan data"); toast.error("Gagal menyimpan data");

View File

@@ -62,7 +62,7 @@ function ListAPBDes({ search }: { search: string }) {
leftSection={<IconPlus size={18} />} leftSection={<IconPlus size={18} />}
color="blue" color="blue"
variant="light" variant="light"
onClick={() => router.push('/admin/landing-page/APBDes/create')} onClick={() => router.push('/admin/landing-page/apbdes/create')}
> >
Tambah Baru Tambah Baru
</Button> </Button>
@@ -110,7 +110,7 @@ function ListAPBDes({ search }: { search: string }) {
<Button <Button
variant="light" variant="light"
color="blue" color="blue"
onClick={() => router.push(`/admin/landing-page/APBDes/${item.id}`)} onClick={() => router.push(`/admin/landing-page/apbdes/${item.id}`)}
fullWidth fullWidth
> >
<IconDeviceImacCog size={20} /> <IconDeviceImacCog size={20} />

View File

@@ -12,6 +12,7 @@ import korupsiState from '@/app/admin/(dashboard)/_state/landing-page/desa-anti-
import ApiFetch from '@/lib/api-fetch'; import ApiFetch from '@/lib/api-fetch';
import { Dropzone } from '@mantine/dropzone'; import { Dropzone } from '@mantine/dropzone';
import EditEditor from '@/app/admin/(dashboard)/_com/editEditor'; import EditEditor from '@/app/admin/(dashboard)/_com/editEditor';
import { useShallowEffect } from '@mantine/hooks';
interface FormDesaAntiKorupsi { interface FormDesaAntiKorupsi {
name: string; name: string;
@@ -35,6 +36,10 @@ export default function EditDesaAntiKorupsi() {
fileId: '', fileId: '',
}); });
useShallowEffect(() => {
korupsiState.kategoriDesaAntiKorupsi.findMany.load();
}, []);
useEffect(() => { useEffect(() => {
const loadDesaAntiKorupsi = async () => { const loadDesaAntiKorupsi = async () => {
const id = params?.id as string; const id = params?.id as string;

View File

@@ -91,7 +91,7 @@ function EditKolaborasiInovasi() {
await sdgsState.edit.update(); await sdgsState.edit.update();
toast.success("sdgs desa berhasil diperbarui!"); toast.success("sdgs desa berhasil diperbarui!");
router.push("/admin/landing-page/SDGs-Desa"); router.push("/admin/landing-page/sdgs");
} catch (error) { } catch (error) {
console.error("Error updating sdgs desa:", error); console.error("Error updating sdgs desa:", error);
toast.error("Terjadi kesalahan saat memperbarui sdgs desa"); toast.error("Terjadi kesalahan saat memperbarui sdgs desa");

View File

@@ -27,7 +27,7 @@ function DetailSDGSDesa() {
sdgsState.delete.byId(selectedId) sdgsState.delete.byId(selectedId)
setModalHapus(false) setModalHapus(false)
setSelectedId(null) setSelectedId(null)
router.push("/admin/landing-page/SDGs-Desa") router.push("/admin/landing-page/sdgs")
} }
} }
@@ -113,7 +113,7 @@ function DetailSDGSDesa() {
<Tooltip label="Edit SDGs Desa" withArrow position="top"> <Tooltip label="Edit SDGs Desa" withArrow position="top">
<Button <Button
color="green" color="green"
onClick={() => router.push(`/admin/landing-page/SDGs-Desa/${data.id}/edit`)} onClick={() => router.push(`/admin/landing-page/sdgs/${data.id}/edit`)}
variant="light" variant="light"
radius="md" radius="md"
size="md" size="md"

View File

@@ -53,7 +53,7 @@ function CreateSDGsDesa() {
await stateSDGSDesa.create.create(); await stateSDGSDesa.create.create();
resetForm(); resetForm();
router.push("/admin/landing-page/SDGs-Desa") router.push("/admin/landing-page/sdgs")
} }
return ( return (
<Box px={{ base: 'sm', md: 'lg' }} py="md"> <Box px={{ base: 'sm', md: 'lg' }} py="md">

View File

@@ -64,7 +64,7 @@ function ListSdgsDesa({ search }: { search: string }) {
leftSection={<IconPlus size={18} />} leftSection={<IconPlus size={18} />}
color={colors['blue-button']} color={colors['blue-button']}
variant="light" variant="light"
onClick={() => router.push('/admin/landing-page/SDGs-Desa/create')} onClick={() => router.push('/admin/landing-page/sdgs/create')}
> >
Tambah Baru Tambah Baru
</Button> </Button>
@@ -103,7 +103,7 @@ function ListSdgsDesa({ search }: { search: string }) {
leftSection={<IconPlus size={18} />} leftSection={<IconPlus size={18} />}
color={colors['blue-button']} color={colors['blue-button']}
variant="light" variant="light"
onClick={() => router.push('/admin/landing-page/SDGs-Desa/create')} onClick={() => router.push('/admin/landing-page/sdgs/create')}
> >
Tambah Baru Tambah Baru
</Button> </Button>
@@ -137,7 +137,7 @@ function ListSdgsDesa({ search }: { search: string }) {
variant="light" variant="light"
color="blue" color="blue"
size="sm" size="sm"
onClick={() => router.push(`/admin/landing-page/SDGs-Desa/${item.id}`)} onClick={() => router.push(`/admin/landing-page/sdgs/${item.id}`)}
> >
<IconDeviceImacCog size={18} /> <IconDeviceImacCog size={18} />
</Button> </Button>

View File

@@ -22,12 +22,12 @@ export const navBar = [
{ {
id: "Landing_Page_4", id: "Landing_Page_4",
name: "SDGs Desa", name: "SDGs Desa",
path: "/admin/landing-page/SDGs-Desa" path: "/admin/landing-page/sdgs"
}, },
{ {
id: "Landing_Page_5", id: "Landing_Page_5",
name: "APBDes", name: "APBDes",
path: "/admin/landing-page/APBDes" path: "/admin/landing-page/apbdes"
}, },
{ {
id: "Landing_Page_6", id: "Landing_Page_6",

View File

@@ -26,6 +26,10 @@ export default async function pelayananSuratKeteranganFindMany(context: Context)
skip, skip,
take: limit, take: limit,
orderBy: { createdAt: 'desc' }, orderBy: { createdAt: 'desc' },
include: {
image: true,
image2: true,
},
}), }),
prisma.pelayananSuratKeterangan.count({ where }), prisma.pelayananSuratKeterangan.count({ where }),
]); ]);

View File

@@ -26,8 +26,6 @@ import Pendidikan from "./_lib/pendidikan";
import User from "./_lib/user"; import User from "./_lib/user";
import Role from "./_lib/user/role"; import Role from "./_lib/user/role";
const ROOT = process.cwd(); const ROOT = process.cwd();
if (!process.env.WIBU_UPLOAD_DIR) if (!process.env.WIBU_UPLOAD_DIR)
@@ -72,11 +70,14 @@ const Utils = new Elysia({
return { version }; return { version };
}); });
if (!process.env.WIBU_UPLOAD_DIR)
throw new Error("WIBU_UPLOAD_DIR is not defined");
const ApiServer = new Elysia() const ApiServer = new Elysia()
.use(swagger({ path: "/api/docs" })) .use(swagger({ path: "/api/docs" }))
.use( .use(
staticPlugin({ staticPlugin({
assets: process.env.WIBU_UPLOAD_DIR || "./uploads", assets: process.env.WIBU_UPLOAD_DIR,
prefix: "/uploads", prefix: "/uploads",
}) })
) )
@@ -105,116 +106,116 @@ const ApiServer = new Elysia()
}) })
.group("/api", (app) => .group("/api", (app) =>
app app
.get("/layanan", layanan) .get("/layanan", layanan)
.get("/potensi", getPotensi) .get("/potensi", getPotensi)
.get( .get(
"/img/:name", "/img/:name",
({ params, query }) => { ({ params, query }) => {
return img({ return img({
name: params.name, name: params.name,
UPLOAD_DIR_IMAGE, UPLOAD_DIR_IMAGE,
ROOT, ROOT,
size: query.size, size: query.size,
}); });
}, },
{ {
params: t.Object({ params: t.Object({
name: t.String(), name: t.String(),
}), }),
query: t.Optional( query: t.Optional(
t.Object({ t.Object({
size: t.Optional(t.Number()), size: t.Optional(t.Number()),
}) })
), ),
} }
) )
.delete( .delete(
"/img/:name", "/img/:name",
({ params }) => { ({ params }) => {
return imgDel({ return imgDel({
name: params.name, name: params.name,
UPLOAD_DIR_IMAGE, UPLOAD_DIR_IMAGE,
}); });
}, },
{ {
params: t.Object({ params: t.Object({
name: t.String(), name: t.String(),
}), }),
} }
) )
.get( .get(
"/imgs", "/imgs",
({ query }) => { ({ query }) => {
return imgs({ return imgs({
search: query.search, search: query.search,
page: query.page, page: query.page,
count: query.count, count: query.count,
UPLOAD_DIR_IMAGE, UPLOAD_DIR_IMAGE,
}); });
}, },
{ {
query: t.Optional( query: t.Optional(
t.Object({ t.Object({
page: t.Number({ default: 1 }), page: t.Number({ default: 1 }),
count: t.Number({ default: 10 }), count: t.Number({ default: 10 }),
search: t.String({ default: "" }), search: t.String({ default: "" }),
}) })
), ),
} }
) )
.post( .post(
"/upl-img", "/upl-img",
({ body }) => { ({ body }) => {
console.log(body.title); console.log(body.title);
return uplImg({ files: body.files, UPLOAD_DIR_IMAGE }); return uplImg({ files: body.files, UPLOAD_DIR_IMAGE });
}, },
{ {
body: t.Object({ body: t.Object({
title: t.String(), title: t.String(),
files: t.Files({ multiple: true }), files: t.Files({ multiple: true }),
}), }),
} }
) )
.post( .post(
"/upl-img-single", "/upl-img-single",
({ body }) => { ({ body }) => {
return uplImgSingle({ return uplImgSingle({
fileName: body.name, fileName: body.name,
file: body.file, file: body.file,
UPLOAD_DIR_IMAGE, UPLOAD_DIR_IMAGE,
}); });
}, },
{ {
body: t.Object({ body: t.Object({
name: t.String(), name: t.String(),
file: t.File(), file: t.File(),
}), }),
} }
) )
.post( .post(
"/upl-csv-single", "/upl-csv-single",
({ body }) => { ({ body }) => {
return uplCsvSingle({ fileName: body.name, file: body.file }); return uplCsvSingle({ fileName: body.name, file: body.file });
}, },
{ {
body: t.Object({ body: t.Object({
name: t.String(), name: t.String(),
file: t.File(), file: t.File(),
}), }),
} }
) )
.post( .post(
"/upl-csv", "/upl-csv",
({ body }) => { ({ body }) => {
return uplCsv({ files: body.files }); return uplCsv({ files: body.files });
}, },
{ {
body: t.Object({ body: t.Object({
files: t.Files(), files: t.Files(),
}), }),
} }
) )
); );
export const GET = ApiServer.handle; export const GET = ApiServer.handle;
export const POST = ApiServer.handle; export const POST = ApiServer.handle;

View File

@@ -91,7 +91,7 @@ function Lokal() {
</Text> </Text>
</Flex> </Flex>
) : ( ) : (
<SimpleGrid cols={{ base: 1, sm: 2, lg: 3 }} spacing="xl"> <SimpleGrid cols={{ base: 1, lg: 2 }} spacing="xl">
{filteredData.map(item => { {filteredData.map(item => {
const handleDownload = (e: React.MouseEvent) => { const handleDownload = (e: React.MouseEvent) => {
e.stopPropagation(); e.stopPropagation();
@@ -116,7 +116,7 @@ function Lokal() {
}} }}
> >
<Stack h="100%" justify="space-between"> <Stack h="100%" justify="space-between">
<Text fz="lg" fw={600} c={colors['blue-button']} lineClamp={2}> <Text fz="lg" fw={600} c={colors['blue-button']}>
{item.name} {item.name}
</Text> </Text>
{item?.file && ( {item?.file && (

View File

@@ -83,7 +83,7 @@ function Slider() {
const slides = data.map((item) => ( const slides = data.map((item) => (
<Carousel.Slide key={item.id} > <Carousel.Slide key={item.id} >
<Paper h={"100%"} pos={"relative"} style={{ <Paper h={height} pos={"relative"} style={{
backgroundImage: `url(${item.image?.link})`, backgroundImage: `url(${item.image?.link})`,
backgroundSize: "cover", backgroundSize: "cover",
backgroundPosition: "center", backgroundPosition: "center",