Compare commits

...

1 Commits

19 changed files with 153 additions and 141 deletions

2
.gitignore vendored
View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -28,7 +28,7 @@ function DetailAPBDes() {
apbdesState.delete.byId(selectedId)
setModalHapus(false)
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">
<Button
color="green"
onClick={() => router.push(`/admin/landing-page/APBDes/${data.id}/edit`)}
onClick={() => router.push(`/admin/landing-page/apbdes/${data.id}/edit`)}
variant="light"
radius="md"
size="md"

View File

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

View File

@@ -62,7 +62,7 @@ function ListAPBDes({ search }: { search: string }) {
leftSection={<IconPlus size={18} />}
color="blue"
variant="light"
onClick={() => router.push('/admin/landing-page/APBDes/create')}
onClick={() => router.push('/admin/landing-page/apbdes/create')}
>
Tambah Baru
</Button>
@@ -110,7 +110,7 @@ function ListAPBDes({ search }: { search: string }) {
<Button
variant="light"
color="blue"
onClick={() => router.push(`/admin/landing-page/APBDes/${item.id}`)}
onClick={() => router.push(`/admin/landing-page/apbdes/${item.id}`)}
fullWidth
>
<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 { Dropzone } from '@mantine/dropzone';
import EditEditor from '@/app/admin/(dashboard)/_com/editEditor';
import { useShallowEffect } from '@mantine/hooks';
interface FormDesaAntiKorupsi {
name: string;
@@ -35,6 +36,10 @@ export default function EditDesaAntiKorupsi() {
fileId: '',
});
useShallowEffect(() => {
korupsiState.kategoriDesaAntiKorupsi.findMany.load();
}, []);
useEffect(() => {
const loadDesaAntiKorupsi = async () => {
const id = params?.id as string;

View File

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

View File

@@ -27,7 +27,7 @@ function DetailSDGSDesa() {
sdgsState.delete.byId(selectedId)
setModalHapus(false)
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">
<Button
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"
radius="md"
size="md"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -91,7 +91,7 @@ function Lokal() {
</Text>
</Flex>
) : (
<SimpleGrid cols={{ base: 1, sm: 2, lg: 3 }} spacing="xl">
<SimpleGrid cols={{ base: 1, lg: 2 }} spacing="xl">
{filteredData.map(item => {
const handleDownload = (e: React.MouseEvent) => {
e.stopPropagation();
@@ -116,7 +116,7 @@ function Lokal() {
}}
>
<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}
</Text>
{item?.file && (

View File

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

View File

@@ -24,4 +24,4 @@ const colors = {
}
export default colors
export type ColorsType = typeof colors
export type ColorsType = typeof colors