upd: update edit pengajuan surat #82
@@ -781,14 +781,39 @@ const PelayananRoute = new Elysia({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const category = await prisma.categoryPelayanan.findUnique({
|
||||||
|
where: {
|
||||||
|
id: pengajuan.idCategory,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
type SyaratDokumen = {
|
||||||
|
desc: string;
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const syarat = category?.syaratDokumen as SyaratDokumen[] | undefined
|
||||||
|
|
||||||
|
|
||||||
if (syaratDokumen && syaratDokumen.length > 0) {
|
if (syaratDokumen && syaratDokumen.length > 0) {
|
||||||
console.log("syaratDokumen")
|
console.log("syaratDokumen")
|
||||||
for (const item of syaratDokumen) {
|
for (const item of syaratDokumen) {
|
||||||
dataUpdate.push(item.jenis)
|
const pilih = syarat?.find((cat) => cat.desc == item.jenis)?.name;
|
||||||
|
console.log(syarat, pilih)
|
||||||
|
dataUpdate.push(pilih)
|
||||||
|
|
||||||
const hasil = await prisma.syaratDokumenPelayanan.findFirst({
|
const hasil = await prisma.syaratDokumenPelayanan.findFirst({
|
||||||
where: {
|
where: {
|
||||||
idPengajuanLayanan: pengajuan.id,
|
idPengajuanLayanan: pengajuan.id,
|
||||||
jenis: item.jenis,
|
OR: [
|
||||||
|
{
|
||||||
|
jenis: pilih,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
jenis: pilih,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
console.log(hasil, item)
|
console.log(hasil, item)
|
||||||
@@ -803,7 +828,7 @@ const PelayananRoute = new Elysia({
|
|||||||
},
|
},
|
||||||
create: {
|
create: {
|
||||||
value: item.value,
|
value: item.value,
|
||||||
jenis: item.jenis,
|
jenis: hasil.jenis,
|
||||||
idPengajuanLayanan: pengajuan.id,
|
idPengajuanLayanan: pengajuan.id,
|
||||||
idCategory: pengajuan.idCategory,
|
idCategory: pengajuan.idCategory,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user