feat:fix detail agenda setting
This commit is contained in:
parent
e643eda2c6
commit
a44b275f73
|
|
@ -59,7 +59,9 @@ import WaveSurfer from "wavesurfer.js";
|
||||||
|
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
title: z.string().min(3, { message: "Required" }),
|
title: z.string().min(3, { message: "Required" }),
|
||||||
description: z.string().min(3, { message: "Required" }),
|
description: z
|
||||||
|
.string()
|
||||||
|
.min(2, { message: "Narasi Penugasan harus lebih dari 2 karakter." }),
|
||||||
});
|
});
|
||||||
|
|
||||||
interface FileWithPreview extends File {
|
interface FileWithPreview extends File {
|
||||||
|
|
@ -164,8 +166,8 @@ const EventModal = ({
|
||||||
const detail = res?.data?.data;
|
const detail = res?.data?.data;
|
||||||
setDetailData(detail);
|
setDetailData(detail);
|
||||||
|
|
||||||
const description = detail?.description;
|
const description = res?.data?.data?.description;
|
||||||
console.log("description", res?.data?.description);
|
console.log("description", res?.data?.data?.description);
|
||||||
|
|
||||||
// Set nilai awal description ke form control
|
// Set nilai awal description ke form control
|
||||||
if (description) {
|
if (description) {
|
||||||
|
|
@ -185,6 +187,16 @@ const EventModal = ({
|
||||||
setAudioUploadedFiles(
|
setAudioUploadedFiles(
|
||||||
attachments?.filter((file: any) => file.fileTypeId == 4)
|
attachments?.filter((file: any) => file.fileTypeId == 4)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const agendaType = detail?.agendaType;
|
||||||
|
setWilayahPublish({
|
||||||
|
semua: agendaType === "all",
|
||||||
|
nasional: agendaType === "mabes",
|
||||||
|
polda: agendaType === "polda",
|
||||||
|
polres: agendaType === "polres",
|
||||||
|
satker: agendaType === "satker",
|
||||||
|
international: agendaType === "international",
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchDetailData();
|
fetchDetailData();
|
||||||
|
|
@ -621,6 +633,7 @@ const EventModal = ({
|
||||||
{event?.title}
|
{event?.title}
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|
||||||
<div className="mt-6 h-full ">
|
<div className="mt-6 h-full ">
|
||||||
<form className="h-full" onSubmit={handleSubmit(onSubmit)}>
|
<form className="h-full" onSubmit={handleSubmit(onSubmit)}>
|
||||||
<div className="space-y-4 pb-5 ">
|
<div className="space-y-4 pb-5 ">
|
||||||
|
|
@ -819,7 +832,7 @@ const EventModal = ({
|
||||||
name="description"
|
name="description"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<Textarea
|
<Textarea
|
||||||
defaultValue={field.value}
|
value={field.value}
|
||||||
onChange={field.onChange}
|
onChange={field.onChange}
|
||||||
placeholder="Enter Title"
|
placeholder="Enter Title"
|
||||||
/>
|
/>
|
||||||
|
|
@ -833,6 +846,7 @@ const EventModal = ({
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-1.5">
|
<div className="space-y-1.5">
|
||||||
<Label htmlFor="attachments">Lampiran</Label>
|
<Label htmlFor="attachments">Lampiran</Label>
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue