upd: dashboard admin

Deskripsi:
- pagination list pengajuan surat

NO Issues
This commit is contained in:
2025-12-02 11:32:16 +08:00
parent cc7c8eb704
commit 2b94684570
3 changed files with 67 additions and 28 deletions

View File

@@ -581,6 +581,14 @@ const PelayananRoute = new Elysia({
mode: "insensitive"
},
},
},
{
Warga: {
name: {
contains: search ?? "",
mode: "insensitive"
},
},
}
]
}
@@ -592,6 +600,11 @@ const PelayananRoute = new Elysia({
}
}
const totalData = await prisma.pelayananAjuan.count({
where
});
const data = await prisma.pelayananAjuan.findMany({
skip,
take: !take ? 10 : Number(take),
@@ -625,12 +638,20 @@ const PelayananRoute = new Elysia({
category: item.CategoryPelayanan.name,
warga: item.Warga.name,
status: item.status,
createdAt: item.createdAt.toLocaleDateString("id-ID", { day: "numeric", month: "long", year: "numeric" }),
createdAt: item.createdAt,
updatedAt: 'terakhir diperbarui ' + getLastUpdated(item.updatedAt),
}
})
return dataFix
const dataReturn = {
data: dataFix,
total: totalData,
page: Number(page) || 1,
pageSize: !take ? 10 : Number(take),
totalPages: Math.ceil(totalData / (!take ? 10 : Number(take)))
}
return dataReturn
}, {
query: t.Object({
take: t.String({ optional: true }),