fixing
This commit is contained in:
parent
a11257ef4e
commit
affe1bce94
|
|
@ -163,7 +163,7 @@ export default function FormCollaboration() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const save = async (data: TaskSchema) => {
|
const save = async (data: TaskSchema) => {
|
||||||
setIsSubmitting(true);
|
setIsSubmitting(true);
|
||||||
|
|
||||||
MySwal.fire({
|
MySwal.fire({
|
||||||
title: "Menyimpan...",
|
title: "Menyimpan...",
|
||||||
|
|
@ -192,7 +192,7 @@ export default function FormCollaboration() {
|
||||||
console.log("Form Data Submitted:", requestData);
|
console.log("Form Data Submitted:", requestData);
|
||||||
console.log("response", response);
|
console.log("response", response);
|
||||||
|
|
||||||
Swal.close();
|
Swal.close();
|
||||||
|
|
||||||
MySwal.fire({
|
MySwal.fire({
|
||||||
title: "Sukses",
|
title: "Sukses",
|
||||||
|
|
@ -255,6 +255,78 @@ export default function FormCollaboration() {
|
||||||
Priority<span className="text-red-500">*</span>
|
Priority<span className="text-red-500">*</span>
|
||||||
</Label>
|
</Label>
|
||||||
<Select
|
<Select
|
||||||
|
id="target-select"
|
||||||
|
options={ticketPriority}
|
||||||
|
onChange={(selectedOption) =>
|
||||||
|
setSelectedTarget(Number(selectedOption?.value))
|
||||||
|
}
|
||||||
|
placeholder="Pilih"
|
||||||
|
styles={{
|
||||||
|
control: (base, state) => ({
|
||||||
|
...base,
|
||||||
|
minHeight: "40px",
|
||||||
|
backgroundColor:
|
||||||
|
document.documentElement.classList.contains("dark")
|
||||||
|
? "#1f2937" // gray-800
|
||||||
|
: "#ffffff",
|
||||||
|
color: document.documentElement.classList.contains("dark")
|
||||||
|
? "#f9fafb" // gray-100
|
||||||
|
: "#111827", // gray-900
|
||||||
|
borderColor: state.isFocused
|
||||||
|
? "#2563eb"
|
||||||
|
: base.borderColor, // biru-600
|
||||||
|
boxShadow: state.isFocused
|
||||||
|
? "0 0 0 1px #2563eb"
|
||||||
|
: base.boxShadow,
|
||||||
|
"&:hover": {
|
||||||
|
borderColor: "#2563eb",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
menu: (base) => ({
|
||||||
|
...base,
|
||||||
|
backgroundColor:
|
||||||
|
document.documentElement.classList.contains("dark")
|
||||||
|
? "#1f2937"
|
||||||
|
: "#ffffff",
|
||||||
|
}),
|
||||||
|
option: (base, state) => ({
|
||||||
|
...base,
|
||||||
|
backgroundColor: state.isSelected
|
||||||
|
? "#2563eb" // biru solid kalau dipilih
|
||||||
|
: state.isFocused
|
||||||
|
? "#2563eb33" // biru transparan kalau hover
|
||||||
|
: document.documentElement.classList.contains("dark")
|
||||||
|
? "#1f2937"
|
||||||
|
: "#ffffff",
|
||||||
|
color: state.isSelected
|
||||||
|
? "#ffffff"
|
||||||
|
: document.documentElement.classList.contains("dark")
|
||||||
|
? "#f9fafb"
|
||||||
|
: "#111827",
|
||||||
|
cursor: "pointer",
|
||||||
|
}),
|
||||||
|
singleValue: (base) => ({
|
||||||
|
...base,
|
||||||
|
color: document.documentElement.classList.contains("dark")
|
||||||
|
? "#f9fafb"
|
||||||
|
: "#111827",
|
||||||
|
}),
|
||||||
|
placeholder: (base) => ({
|
||||||
|
...base,
|
||||||
|
color: document.documentElement.classList.contains("dark")
|
||||||
|
? "#9ca3af"
|
||||||
|
: "#6b7280",
|
||||||
|
}),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* <div className="mt-5">
|
||||||
|
<Label>
|
||||||
|
Priority<span className="text-red-500">*</span>
|
||||||
|
</Label>
|
||||||
|
<Select
|
||||||
|
className="bg-white dark:bg-black"
|
||||||
id="target-select"
|
id="target-select"
|
||||||
options={ticketPriority}
|
options={ticketPriority}
|
||||||
onChange={(selectedOption) =>
|
onChange={(selectedOption) =>
|
||||||
|
|
@ -268,7 +340,7 @@ export default function FormCollaboration() {
|
||||||
}),
|
}),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div> */}
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="mt-5">
|
<div className="mt-5">
|
||||||
|
|
@ -283,8 +355,82 @@ export default function FormCollaboration() {
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
formatOptionLabel={formatOptionLabel}
|
formatOptionLabel={formatOptionLabel}
|
||||||
isMulti={false}
|
isMulti={false}
|
||||||
|
styles={{
|
||||||
|
control: (base, state) => ({
|
||||||
|
...base,
|
||||||
|
backgroundColor:
|
||||||
|
document.documentElement.classList.contains("dark")
|
||||||
|
? "#1f2937" // bg-gray-800
|
||||||
|
: "#ffffff", // bg-white
|
||||||
|
color: document.documentElement.classList.contains("dark")
|
||||||
|
? "#f9fafb" // text-gray-100
|
||||||
|
: "#111827", // text-gray-900
|
||||||
|
borderColor: state.isFocused
|
||||||
|
? "#2563eb"
|
||||||
|
: base.borderColor,
|
||||||
|
boxShadow: state.isFocused
|
||||||
|
? "0 0 0 1px #2563eb"
|
||||||
|
: base.boxShadow,
|
||||||
|
"&:hover": {
|
||||||
|
borderColor: "#2563eb",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
menu: (base) => ({
|
||||||
|
...base,
|
||||||
|
backgroundColor:
|
||||||
|
document.documentElement.classList.contains("dark")
|
||||||
|
? "#1f2937"
|
||||||
|
: "#ffffff",
|
||||||
|
color: document.documentElement.classList.contains("dark")
|
||||||
|
? "#f9fafb"
|
||||||
|
: "#111827",
|
||||||
|
}),
|
||||||
|
option: (base, state) => ({
|
||||||
|
...base,
|
||||||
|
backgroundColor: state.isSelected
|
||||||
|
? "#2563eb"
|
||||||
|
: state.isFocused
|
||||||
|
? "#2563eb33"
|
||||||
|
: document.documentElement.classList.contains("dark")
|
||||||
|
? "#1f2937"
|
||||||
|
: "#ffffff",
|
||||||
|
color: state.isSelected
|
||||||
|
? "#ffffff"
|
||||||
|
: document.documentElement.classList.contains("dark")
|
||||||
|
? "#f9fafb"
|
||||||
|
: "#111827",
|
||||||
|
cursor: "pointer",
|
||||||
|
}),
|
||||||
|
singleValue: (base) => ({
|
||||||
|
...base,
|
||||||
|
color: document.documentElement.classList.contains("dark")
|
||||||
|
? "#f9fafb"
|
||||||
|
: "#111827",
|
||||||
|
}),
|
||||||
|
placeholder: (base) => ({
|
||||||
|
...base,
|
||||||
|
color: document.documentElement.classList.contains("dark")
|
||||||
|
? "#9ca3af"
|
||||||
|
: "#6b7280",
|
||||||
|
}),
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* <div className="mt-5">
|
||||||
|
<Label>
|
||||||
|
Eskalasi Untuk <span className="text-red-500">*</span>
|
||||||
|
</Label>
|
||||||
|
<Select
|
||||||
|
options={options}
|
||||||
|
className="w-100"
|
||||||
|
closeMenuOnSelect={false}
|
||||||
|
components={animatedComponent}
|
||||||
|
onChange={handleChange}
|
||||||
|
formatOptionLabel={formatOptionLabel}
|
||||||
|
isMulti={false}
|
||||||
|
/>
|
||||||
|
</div> */}
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-5">
|
<div className="mt-5">
|
||||||
<Label>Narasi Penugasan</Label>
|
<Label>Narasi Penugasan</Label>
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,6 @@ export type replyDetail = {
|
||||||
export default function FormDetailEscalation() {
|
export default function FormDetailEscalation() {
|
||||||
const MySwal = withReactContent(Swal);
|
const MySwal = withReactContent(Swal);
|
||||||
const { id } = useParams() as { id: string };
|
const { id } = useParams() as { id: string };
|
||||||
|
|
||||||
const [detail, setDetail] = useState<any>();
|
const [detail, setDetail] = useState<any>();
|
||||||
const [ticketReply, setTicketReply] = useState<replyDetail[]>([]);
|
const [ticketReply, setTicketReply] = useState<replyDetail[]>([]);
|
||||||
const [replyVisible, setReplyVisible] = useState(false);
|
const [replyVisible, setReplyVisible] = useState(false);
|
||||||
|
|
@ -173,11 +172,11 @@ export default function FormDetailEscalation() {
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
<div className="flex flex-col mt-6 w-full mb-3">
|
<div className="flex flex-col mt-6 w-full mb-3">
|
||||||
{detail !== undefined && (
|
{detail !== undefined && (
|
||||||
<div key={detail?.id} className="bg-slate-300 rounded-md">
|
<div key={detail?.id} className="bg-slate-300 dark:bg-black rounded-md">
|
||||||
<p className="p-5 bg-slate-300 rounded-md text-lg font-semibold">
|
<p className="p-5 bg-slate-300 dark:bg-black rounded-md text-lg font-semibold">
|
||||||
Ticket #{detail.id}
|
Ticket #{detail.id}
|
||||||
</p>
|
</p>
|
||||||
<div className="flex flex-row gap-3 bg-sky-100 p-5 items-center">
|
<div className="flex flex-row gap-3 bg-sky-100 dark:bg-sky-900 p-5 items-center">
|
||||||
<Icon icon="qlementine-icons:user-16" width={36} />
|
<Icon icon="qlementine-icons:user-16" width={36} />
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
@ -210,8 +209,8 @@ export default function FormDetailEscalation() {
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p className="p-5 bg-white">{detail.message}</p>
|
<p className="p-5 bg-white dark:bg-black">{detail.message}</p>
|
||||||
<div className="px-4 py-1 bg-white text-sm">
|
<div className="px-4 py-1 bg-white dark:bg-black text-sm">
|
||||||
{detail?.typeId === 6 && detail?.emergencyIssue ? (
|
{detail?.typeId === 6 && detail?.emergencyIssue ? (
|
||||||
<div className="row mx-0 mb-3 emergency-attachments">
|
<div className="row mx-0 mb-3 emergency-attachments">
|
||||||
<div className=" mr-4">
|
<div className=" mr-4">
|
||||||
|
|
@ -239,7 +238,7 @@ export default function FormDetailEscalation() {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{detail !== undefined && (
|
{detail !== undefined && (
|
||||||
<div className="gap-5 mb-5 w-full border mt-3 rounded-md bg-white">
|
<div className="gap-5 mb-5 w-full border mt-3 rounded-md bg-white dark:bg-black">
|
||||||
<div className="space-y-2 px-3 mt-3">
|
<div className="space-y-2 px-3 mt-3">
|
||||||
<Label>Judul</Label>
|
<Label>Judul</Label>
|
||||||
<Controller
|
<Controller
|
||||||
|
|
@ -297,16 +296,16 @@ export default function FormDetailEscalation() {
|
||||||
)} */}
|
)} */}
|
||||||
</div>
|
</div>
|
||||||
<div className="mx-3 my-3">
|
<div className="mx-3 my-3">
|
||||||
<h3 className="text-gray-700 font-medium">Tanggapan</h3>
|
<h3 className="text-gray-700 dark:text-white font-medium">Tanggapan</h3>
|
||||||
<div className="space-y-4 ml-5 mt-5">
|
<div className="space-y-4 ml-5 mt-5">
|
||||||
{listDiscussion.map((parent: any) => (
|
{listDiscussion.map((parent: any) => (
|
||||||
<div key={parent.id} className="border-b pb-4">
|
<div key={parent.id} className="border-b pb-4">
|
||||||
<div className="flex justify-between items-start">
|
<div className="flex justify-between items-start">
|
||||||
<div>
|
<div>
|
||||||
<p className="font-semibold text-gray-800">
|
<p className="font-semibold text-gray-800 dark:text-white">
|
||||||
{parent.messageFrom?.fullname}
|
{parent.messageFrom?.fullname}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-gray-600">{parent.message}</p>
|
<p className="text-gray-600 dark:text-white">{parent.message}</p>
|
||||||
<p className="text-sm text-gray-400">
|
<p className="text-sm text-gray-400">
|
||||||
{parent.createdAt}
|
{parent.createdAt}
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -338,7 +337,7 @@ export default function FormDetailEscalation() {
|
||||||
<div className="flex justify-end gap-2 mt-2">
|
<div className="flex justify-end gap-2 mt-2">
|
||||||
<button
|
<button
|
||||||
onClick={() => setActiveReplyId(null)}
|
onClick={() => setActiveReplyId(null)}
|
||||||
className="px-4 py-1 text-sm bg-gray-200 text-gray-800 rounded-md"
|
className="px-4 py-1 text-sm bg-gray-200 dark:bg-gray-600 text-gray-800 dark:text-white rounded-md"
|
||||||
>
|
>
|
||||||
Batal
|
Batal
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -363,10 +362,10 @@ export default function FormDetailEscalation() {
|
||||||
className="flex justify-between items-start"
|
className="flex justify-between items-start"
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<p className="font-semibold text-gray-800">
|
<p className="font-semibold text-gray-800 dark:text-white">
|
||||||
{child.messageFrom?.fullname}
|
{child.messageFrom?.fullname}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-gray-600">{child.message}</p>
|
<p className="text-gray-600 dark:text-white">{child.message}</p>
|
||||||
<p className="text-sm text-gray-400">
|
<p className="text-sm text-gray-400">
|
||||||
{child.createdAt}
|
{child.createdAt}
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -386,7 +385,7 @@ export default function FormDetailEscalation() {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="mt-6">
|
<div className="mt-6">
|
||||||
<label className="block text-gray-700 font-medium mb-2">
|
<label className="block text-gray-700 dark:text-white font-medium mb-2">
|
||||||
Tulis Tanggapan Anda
|
Tulis Tanggapan Anda
|
||||||
</label>
|
</label>
|
||||||
<textarea
|
<textarea
|
||||||
|
|
|
||||||
|
|
@ -201,10 +201,80 @@ export default function FormInternal() {
|
||||||
setSelectedTarget(selectedOption?.value ?? null)
|
setSelectedTarget(selectedOption?.value ?? null)
|
||||||
}
|
}
|
||||||
placeholder="Pilih"
|
placeholder="Pilih"
|
||||||
styles={{ control: (base) => ({ ...base, minHeight: "40px" }) }}
|
styles={{
|
||||||
|
control: (base, state) => ({
|
||||||
|
...base,
|
||||||
|
minHeight: "40px",
|
||||||
|
backgroundColor:
|
||||||
|
document.documentElement.classList.contains("dark")
|
||||||
|
? "#1f2937" // bg-gray-800
|
||||||
|
: "#ffffff", // bg-white
|
||||||
|
color: document.documentElement.classList.contains("dark")
|
||||||
|
? "#f9fafb" // text-gray-100
|
||||||
|
: "#111827", // text-gray-900
|
||||||
|
borderColor: state.isFocused ? "#2563eb" : base.borderColor,
|
||||||
|
boxShadow: state.isFocused
|
||||||
|
? "0 0 0 1px #2563eb"
|
||||||
|
: base.boxShadow,
|
||||||
|
"&:hover": { borderColor: "#2563eb" },
|
||||||
|
}),
|
||||||
|
menu: (base) => ({
|
||||||
|
...base,
|
||||||
|
backgroundColor:
|
||||||
|
document.documentElement.classList.contains("dark")
|
||||||
|
? "#1f2937"
|
||||||
|
: "#ffffff",
|
||||||
|
color: document.documentElement.classList.contains("dark")
|
||||||
|
? "#f9fafb"
|
||||||
|
: "#111827",
|
||||||
|
}),
|
||||||
|
option: (base, state) => ({
|
||||||
|
...base,
|
||||||
|
backgroundColor: state.isSelected
|
||||||
|
? "#2563eb"
|
||||||
|
: state.isFocused
|
||||||
|
? "#2563eb33"
|
||||||
|
: document.documentElement.classList.contains("dark")
|
||||||
|
? "#1f2937"
|
||||||
|
: "#ffffff",
|
||||||
|
color: state.isSelected
|
||||||
|
? "#ffffff"
|
||||||
|
: document.documentElement.classList.contains("dark")
|
||||||
|
? "#f9fafb"
|
||||||
|
: "#111827",
|
||||||
|
cursor: "pointer",
|
||||||
|
}),
|
||||||
|
singleValue: (base) => ({
|
||||||
|
...base,
|
||||||
|
color: document.documentElement.classList.contains("dark")
|
||||||
|
? "#f9fafb"
|
||||||
|
: "#111827",
|
||||||
|
}),
|
||||||
|
placeholder: (base) => ({
|
||||||
|
...base,
|
||||||
|
color: document.documentElement.classList.contains("dark")
|
||||||
|
? "#9ca3af"
|
||||||
|
: "#6b7280",
|
||||||
|
}),
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* <div className="w-6/12">
|
||||||
|
<Label>
|
||||||
|
Priority <span className="text-red-500">*</span>
|
||||||
|
</Label>
|
||||||
|
<Select
|
||||||
|
id="target-select"
|
||||||
|
options={priority}
|
||||||
|
onChange={(selectedOption) =>
|
||||||
|
setSelectedTarget(selectedOption?.value ?? null)
|
||||||
|
}
|
||||||
|
placeholder="Pilih"
|
||||||
|
styles={{ control: (base) => ({ ...base, minHeight: "40px" }) }}
|
||||||
|
/>
|
||||||
|
</div> */}
|
||||||
|
|
||||||
<div className="w-6/12">
|
<div className="w-6/12">
|
||||||
<Label>Ditunjukan Untuk</Label>
|
<Label>Ditunjukan Untuk</Label>
|
||||||
<Select
|
<Select
|
||||||
|
|
@ -214,9 +284,77 @@ export default function FormInternal() {
|
||||||
components={animatedComponent}
|
components={animatedComponent}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
isMulti={false}
|
isMulti={false}
|
||||||
|
styles={{
|
||||||
|
control: (base, state) => ({
|
||||||
|
...base,
|
||||||
|
minHeight: "40px",
|
||||||
|
backgroundColor:
|
||||||
|
document.documentElement.classList.contains("dark")
|
||||||
|
? "#1f2937"
|
||||||
|
: "#ffffff",
|
||||||
|
color: document.documentElement.classList.contains("dark")
|
||||||
|
? "#f9fafb"
|
||||||
|
: "#111827",
|
||||||
|
borderColor: state.isFocused ? "#2563eb" : base.borderColor,
|
||||||
|
boxShadow: state.isFocused
|
||||||
|
? "0 0 0 1px #2563eb"
|
||||||
|
: base.boxShadow,
|
||||||
|
"&:hover": { borderColor: "#2563eb" },
|
||||||
|
}),
|
||||||
|
menu: (base) => ({
|
||||||
|
...base,
|
||||||
|
backgroundColor:
|
||||||
|
document.documentElement.classList.contains("dark")
|
||||||
|
? "#1f2937"
|
||||||
|
: "#ffffff",
|
||||||
|
color: document.documentElement.classList.contains("dark")
|
||||||
|
? "#f9fafb"
|
||||||
|
: "#111827",
|
||||||
|
}),
|
||||||
|
option: (base, state) => ({
|
||||||
|
...base,
|
||||||
|
backgroundColor: state.isSelected
|
||||||
|
? "#2563eb"
|
||||||
|
: state.isFocused
|
||||||
|
? "#2563eb33"
|
||||||
|
: document.documentElement.classList.contains("dark")
|
||||||
|
? "#1f2937"
|
||||||
|
: "#ffffff",
|
||||||
|
color: state.isSelected
|
||||||
|
? "#ffffff"
|
||||||
|
: document.documentElement.classList.contains("dark")
|
||||||
|
? "#f9fafb"
|
||||||
|
: "#111827",
|
||||||
|
cursor: "pointer",
|
||||||
|
}),
|
||||||
|
singleValue: (base) => ({
|
||||||
|
...base,
|
||||||
|
color: document.documentElement.classList.contains("dark")
|
||||||
|
? "#f9fafb"
|
||||||
|
: "#111827",
|
||||||
|
}),
|
||||||
|
placeholder: (base) => ({
|
||||||
|
...base,
|
||||||
|
color: document.documentElement.classList.contains("dark")
|
||||||
|
? "#9ca3af"
|
||||||
|
: "#6b7280",
|
||||||
|
}),
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* <div className="w-6/12">
|
||||||
|
<Label>Ditunjukan Untuk</Label>
|
||||||
|
<Select
|
||||||
|
options={options}
|
||||||
|
className="w-100"
|
||||||
|
closeMenuOnSelect={false}
|
||||||
|
components={animatedComponent}
|
||||||
|
onChange={handleChange}
|
||||||
|
isMulti={false}
|
||||||
|
/>
|
||||||
|
</div> */}
|
||||||
|
|
||||||
<div className="w-6/12 mt-5">
|
<div className="w-6/12 mt-5">
|
||||||
<Label>Narasi Penugasan</Label>
|
<Label>Narasi Penugasan</Label>
|
||||||
<Controller
|
<Controller
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,9 @@ export default function FormAudioDetail() {
|
||||||
// Update fileCheckedLevels untuk sinkronisasi dengan modal
|
// Update fileCheckedLevels untuk sinkronisasi dengan modal
|
||||||
setFileCheckedLevels((prevLevels) => {
|
setFileCheckedLevels((prevLevels) => {
|
||||||
const newArray = [...prevLevels];
|
const newArray = [...prevLevels];
|
||||||
const currentFileLevels = new Set<number>(newArray[fileIndex] || new Set());
|
const currentFileLevels = new Set<number>(
|
||||||
|
newArray[fileIndex] || new Set()
|
||||||
|
);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
// Checklist semua item di modal
|
// Checklist semua item di modal
|
||||||
|
|
@ -712,11 +714,13 @@ export default function FormAudioDetail() {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
if (placement === "all") {
|
if (placement === "all") {
|
||||||
temp[index] = ["all", "mabes", "polda", "international"];
|
temp[index] = ["all", "mabes", "polda", "international"];
|
||||||
|
|
||||||
// Update fileCheckedLevels untuk sinkronisasi dengan modal ketika "all" diklik
|
// Update fileCheckedLevels untuk sinkronisasi dengan modal ketika "all" diklik
|
||||||
setFileCheckedLevels((prevLevels) => {
|
setFileCheckedLevels((prevLevels) => {
|
||||||
const newArray = [...prevLevels];
|
const newArray = [...prevLevels];
|
||||||
const currentFileLevels = new Set<number>(newArray[index] || new Set());
|
const currentFileLevels = new Set<number>(
|
||||||
|
newArray[index] || new Set()
|
||||||
|
);
|
||||||
|
|
||||||
// Checklist semua item di modal
|
// Checklist semua item di modal
|
||||||
listDest.forEach((item: any) => {
|
listDest.forEach((item: any) => {
|
||||||
|
|
@ -736,7 +740,7 @@ export default function FormAudioDetail() {
|
||||||
setFileUnitSelections((prevSelections) => {
|
setFileUnitSelections((prevSelections) => {
|
||||||
const newSelections = [...prevSelections];
|
const newSelections = [...prevSelections];
|
||||||
const currentSelection = { ...newSelections[index] };
|
const currentSelection = { ...newSelections[index] };
|
||||||
|
|
||||||
// Set semua checkbox tingkat utama ke true
|
// Set semua checkbox tingkat utama ke true
|
||||||
currentSelection.nasional = true;
|
currentSelection.nasional = true;
|
||||||
currentSelection.wilayah = true;
|
currentSelection.wilayah = true;
|
||||||
|
|
@ -745,7 +749,7 @@ export default function FormAudioDetail() {
|
||||||
currentSelection.polres = true;
|
currentSelection.polres = true;
|
||||||
currentSelection.satker = true;
|
currentSelection.satker = true;
|
||||||
currentSelection.semua = true;
|
currentSelection.semua = true;
|
||||||
|
|
||||||
newSelections[index] = currentSelection;
|
newSelections[index] = currentSelection;
|
||||||
return newSelections;
|
return newSelections;
|
||||||
});
|
});
|
||||||
|
|
@ -775,11 +779,13 @@ export default function FormAudioDetail() {
|
||||||
} else {
|
} else {
|
||||||
if (placement === "all") {
|
if (placement === "all") {
|
||||||
temp[index] = [];
|
temp[index] = [];
|
||||||
|
|
||||||
// Update fileCheckedLevels untuk sinkronisasi dengan modal ketika "all" di-unchecklist
|
// Update fileCheckedLevels untuk sinkronisasi dengan modal ketika "all" di-unchecklist
|
||||||
setFileCheckedLevels((prevLevels) => {
|
setFileCheckedLevels((prevLevels) => {
|
||||||
const newArray = [...prevLevels];
|
const newArray = [...prevLevels];
|
||||||
const currentFileLevels = new Set<number>(newArray[index] || new Set());
|
const currentFileLevels = new Set<number>(
|
||||||
|
newArray[index] || new Set()
|
||||||
|
);
|
||||||
|
|
||||||
// Unchecklist semua item di modal
|
// Unchecklist semua item di modal
|
||||||
currentFileLevels.clear();
|
currentFileLevels.clear();
|
||||||
|
|
@ -792,7 +798,7 @@ export default function FormAudioDetail() {
|
||||||
setFileUnitSelections((prevSelections) => {
|
setFileUnitSelections((prevSelections) => {
|
||||||
const newSelections = [...prevSelections];
|
const newSelections = [...prevSelections];
|
||||||
const currentSelection = { ...newSelections[index] };
|
const currentSelection = { ...newSelections[index] };
|
||||||
|
|
||||||
// Set semua checkbox tingkat utama ke false
|
// Set semua checkbox tingkat utama ke false
|
||||||
currentSelection.nasional = false;
|
currentSelection.nasional = false;
|
||||||
currentSelection.wilayah = false;
|
currentSelection.wilayah = false;
|
||||||
|
|
@ -801,7 +807,7 @@ export default function FormAudioDetail() {
|
||||||
currentSelection.polres = false;
|
currentSelection.polres = false;
|
||||||
currentSelection.satker = false;
|
currentSelection.satker = false;
|
||||||
currentSelection.semua = false;
|
currentSelection.semua = false;
|
||||||
|
|
||||||
newSelections[index] = currentSelection;
|
newSelections[index] = currentSelection;
|
||||||
return newSelections;
|
return newSelections;
|
||||||
});
|
});
|
||||||
|
|
@ -863,8 +869,6 @@ export default function FormAudioDetail() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const updateModalChecklistLevels = (
|
const updateModalChecklistLevels = (
|
||||||
fileIndex: number,
|
fileIndex: number,
|
||||||
placement: string,
|
placement: string,
|
||||||
|
|
@ -1095,7 +1099,7 @@ export default function FormAudioDetail() {
|
||||||
currentSelection.satker = Boolean(isSatkerChecked);
|
currentSelection.satker = Boolean(isSatkerChecked);
|
||||||
|
|
||||||
// Update checkbox "semua" berdasarkan semua checkbox yang aktif
|
// Update checkbox "semua" berdasarkan semua checkbox yang aktif
|
||||||
currentSelection.semua =
|
currentSelection.semua =
|
||||||
currentSelection.nasional &&
|
currentSelection.nasional &&
|
||||||
currentSelection.wilayah &&
|
currentSelection.wilayah &&
|
||||||
currentSelection.international &&
|
currentSelection.international &&
|
||||||
|
|
@ -1188,7 +1192,10 @@ export default function FormAudioDetail() {
|
||||||
// setSelectedTarget(id);
|
// setSelectedTarget(id);
|
||||||
// }}
|
// }}
|
||||||
>
|
>
|
||||||
<SelectTrigger size="md">
|
<SelectTrigger
|
||||||
|
size="md"
|
||||||
|
className="border border-gray-300 dark:border-gray-600"
|
||||||
|
>
|
||||||
<SelectValue placeholder="Pilih" />
|
<SelectValue placeholder="Pilih" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
|
|
|
||||||
|
|
@ -136,10 +136,8 @@ export default function FormImageDetail() {
|
||||||
const userLevelName = Cookies.get("state");
|
const userLevelName = Cookies.get("state");
|
||||||
const roleId = getCookiesDecrypt("urie");
|
const roleId = getCookiesDecrypt("urie");
|
||||||
const [listDest, setListDest] = useState<Destination[]>([]);
|
const [listDest, setListDest] = useState<Destination[]>([]);
|
||||||
console.log("LALALALA", userLevelName);
|
|
||||||
const [modalOpen, setModalOpen] = useState(false);
|
const [modalOpen, setModalOpen] = useState(false);
|
||||||
const { id } = useParams() as { id: string };
|
const { id } = useParams() as { id: string };
|
||||||
console.log(id);
|
|
||||||
const editor = useRef(null);
|
const editor = useRef(null);
|
||||||
type ImageSchema = z.infer<typeof imageSchema>;
|
type ImageSchema = z.infer<typeof imageSchema>;
|
||||||
const t = useTranslations("Form");
|
const t = useTranslations("Form");
|
||||||
|
|
@ -486,7 +484,9 @@ export default function FormImageDetail() {
|
||||||
// Update fileCheckedLevels untuk sinkronisasi dengan modal
|
// Update fileCheckedLevels untuk sinkronisasi dengan modal
|
||||||
setFileCheckedLevels((prevLevels) => {
|
setFileCheckedLevels((prevLevels) => {
|
||||||
const newArray = [...prevLevels];
|
const newArray = [...prevLevels];
|
||||||
const currentFileLevels = new Set<number>(newArray[fileIndex] || new Set());
|
const currentFileLevels = new Set<number>(
|
||||||
|
newArray[fileIndex] || new Set()
|
||||||
|
);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
// Checklist semua item di modal
|
// Checklist semua item di modal
|
||||||
|
|
@ -808,7 +808,7 @@ export default function FormImageDetail() {
|
||||||
currentSelection.satker = Boolean(isSatkerChecked);
|
currentSelection.satker = Boolean(isSatkerChecked);
|
||||||
|
|
||||||
// Update checkbox "semua" berdasarkan semua checkbox yang aktif
|
// Update checkbox "semua" berdasarkan semua checkbox yang aktif
|
||||||
currentSelection.semua =
|
currentSelection.semua =
|
||||||
currentSelection.nasional &&
|
currentSelection.nasional &&
|
||||||
currentSelection.wilayah &&
|
currentSelection.wilayah &&
|
||||||
currentSelection.international &&
|
currentSelection.international &&
|
||||||
|
|
@ -1014,18 +1014,20 @@ export default function FormImageDetail() {
|
||||||
const temp = [];
|
const temp = [];
|
||||||
for (let i = 0; i < filePlacements?.length; i++) {
|
for (let i = 0; i < filePlacements?.length; i++) {
|
||||||
if (filePlacements[i]?.length !== 0) {
|
if (filePlacements[i]?.length !== 0) {
|
||||||
const now = filePlacements[i]
|
const now = filePlacements[i];
|
||||||
let nowArr = now?.join(",")?.replaceAll("wilayah", "polda");
|
let nowArr = now?.join(",")?.replaceAll("wilayah", "polda");
|
||||||
nowArr = nowArr?.replaceAll("nasional", "mabes");
|
nowArr = nowArr?.replaceAll("nasional", "mabes");
|
||||||
nowArr = nowArr?.replaceAll("semua", "all");
|
nowArr = nowArr?.replaceAll("semua", "all");
|
||||||
|
|
||||||
// Dapatkan checked levels untuk file ini
|
// Dapatkan checked levels untuk file ini
|
||||||
const currentFileCheckedLevels = fileCheckedLevels[i] ? Array.from(fileCheckedLevels[i]) : [];
|
const currentFileCheckedLevels = fileCheckedLevels[i]
|
||||||
|
? Array.from(fileCheckedLevels[i])
|
||||||
const data = {
|
: [];
|
||||||
mediaFileId: files[i]?.id,
|
|
||||||
|
const data = {
|
||||||
|
mediaFileId: files[i]?.id,
|
||||||
placements: nowArr,
|
placements: nowArr,
|
||||||
customLocationPlacements: currentFileCheckedLevels.join(",")
|
customLocationPlacements: currentFileCheckedLevels.join(","),
|
||||||
};
|
};
|
||||||
temp.push(data);
|
temp.push(data);
|
||||||
}
|
}
|
||||||
|
|
@ -1084,11 +1086,13 @@ export default function FormImageDetail() {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
if (placement === "all") {
|
if (placement === "all") {
|
||||||
temp[index] = ["all", "mabes", "polda", "international"];
|
temp[index] = ["all", "mabes", "polda", "international"];
|
||||||
|
|
||||||
// Update fileCheckedLevels untuk sinkronisasi dengan modal ketika "all" diklik
|
// Update fileCheckedLevels untuk sinkronisasi dengan modal ketika "all" diklik
|
||||||
setFileCheckedLevels((prevLevels) => {
|
setFileCheckedLevels((prevLevels) => {
|
||||||
const newArray = [...prevLevels];
|
const newArray = [...prevLevels];
|
||||||
const currentFileLevels = new Set<number>(newArray[index] || new Set());
|
const currentFileLevels = new Set<number>(
|
||||||
|
newArray[index] || new Set()
|
||||||
|
);
|
||||||
|
|
||||||
// Checklist semua item di modal
|
// Checklist semua item di modal
|
||||||
listDest.forEach((item: any) => {
|
listDest.forEach((item: any) => {
|
||||||
|
|
@ -1108,7 +1112,7 @@ export default function FormImageDetail() {
|
||||||
setFileUnitSelections((prevSelections) => {
|
setFileUnitSelections((prevSelections) => {
|
||||||
const newSelections = [...prevSelections];
|
const newSelections = [...prevSelections];
|
||||||
const currentSelection = { ...newSelections[index] };
|
const currentSelection = { ...newSelections[index] };
|
||||||
|
|
||||||
// Set semua checkbox tingkat utama ke true
|
// Set semua checkbox tingkat utama ke true
|
||||||
currentSelection.nasional = true;
|
currentSelection.nasional = true;
|
||||||
currentSelection.wilayah = true;
|
currentSelection.wilayah = true;
|
||||||
|
|
@ -1117,7 +1121,7 @@ export default function FormImageDetail() {
|
||||||
currentSelection.polres = true;
|
currentSelection.polres = true;
|
||||||
currentSelection.satker = true;
|
currentSelection.satker = true;
|
||||||
currentSelection.semua = true;
|
currentSelection.semua = true;
|
||||||
|
|
||||||
newSelections[index] = currentSelection;
|
newSelections[index] = currentSelection;
|
||||||
return newSelections;
|
return newSelections;
|
||||||
});
|
});
|
||||||
|
|
@ -1147,11 +1151,13 @@ export default function FormImageDetail() {
|
||||||
} else {
|
} else {
|
||||||
if (placement === "all") {
|
if (placement === "all") {
|
||||||
temp[index] = [];
|
temp[index] = [];
|
||||||
|
|
||||||
// Update fileCheckedLevels untuk sinkronisasi dengan modal ketika "all" di-unchecklist
|
// Update fileCheckedLevels untuk sinkronisasi dengan modal ketika "all" di-unchecklist
|
||||||
setFileCheckedLevels((prevLevels) => {
|
setFileCheckedLevels((prevLevels) => {
|
||||||
const newArray = [...prevLevels];
|
const newArray = [...prevLevels];
|
||||||
const currentFileLevels = new Set<number>(newArray[index] || new Set());
|
const currentFileLevels = new Set<number>(
|
||||||
|
newArray[index] || new Set()
|
||||||
|
);
|
||||||
|
|
||||||
// Unchecklist semua item di modal
|
// Unchecklist semua item di modal
|
||||||
currentFileLevels.clear();
|
currentFileLevels.clear();
|
||||||
|
|
@ -1164,7 +1170,7 @@ export default function FormImageDetail() {
|
||||||
setFileUnitSelections((prevSelections) => {
|
setFileUnitSelections((prevSelections) => {
|
||||||
const newSelections = [...prevSelections];
|
const newSelections = [...prevSelections];
|
||||||
const currentSelection = { ...newSelections[index] };
|
const currentSelection = { ...newSelections[index] };
|
||||||
|
|
||||||
// Set semua checkbox tingkat utama ke false
|
// Set semua checkbox tingkat utama ke false
|
||||||
currentSelection.nasional = false;
|
currentSelection.nasional = false;
|
||||||
currentSelection.wilayah = false;
|
currentSelection.wilayah = false;
|
||||||
|
|
@ -1173,7 +1179,7 @@ export default function FormImageDetail() {
|
||||||
currentSelection.polres = false;
|
currentSelection.polres = false;
|
||||||
currentSelection.satker = false;
|
currentSelection.satker = false;
|
||||||
currentSelection.semua = false;
|
currentSelection.semua = false;
|
||||||
|
|
||||||
newSelections[index] = currentSelection;
|
newSelections[index] = currentSelection;
|
||||||
return newSelections;
|
return newSelections;
|
||||||
});
|
});
|
||||||
|
|
@ -1384,7 +1390,6 @@ export default function FormImageDetail() {
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
<div className="py-3 w-full space-y-2">
|
<div className="py-3 w-full space-y-2">
|
||||||
<Label>{t("category", { defaultValue: "Category" })}</Label>
|
<Label>{t("category", { defaultValue: "Category" })}</Label>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
disabled
|
disabled
|
||||||
value={String(detail?.category?.id)}
|
value={String(detail?.category?.id)}
|
||||||
|
|
@ -1393,11 +1398,13 @@ export default function FormImageDetail() {
|
||||||
// setSelectedTarget(id);
|
// setSelectedTarget(id);
|
||||||
// }}
|
// }}
|
||||||
>
|
>
|
||||||
<SelectTrigger size="md">
|
<SelectTrigger
|
||||||
|
size="md"
|
||||||
|
className="border border-gray-300 dark:border-gray-600"
|
||||||
|
>
|
||||||
<SelectValue placeholder="Pilih" />
|
<SelectValue placeholder="Pilih" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{/* Show the category from details if it doesn't exist in categories list */}
|
|
||||||
{detail &&
|
{detail &&
|
||||||
!categories.find(
|
!categories.find(
|
||||||
(cat) =>
|
(cat) =>
|
||||||
|
|
@ -1998,9 +2005,7 @@ export default function FormImageDetail() {
|
||||||
</Button>
|
</Button>
|
||||||
</DialogClose>
|
</DialogClose>
|
||||||
<DialogClose asChild>
|
<DialogClose asChild>
|
||||||
<Button>
|
<Button>Simpan</Button>
|
||||||
Simpan
|
|
||||||
</Button>
|
|
||||||
</DialogClose>
|
</DialogClose>
|
||||||
</div>
|
</div>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,9 @@ export default function FormTeksDetail() {
|
||||||
// Update fileCheckedLevels untuk sinkronisasi dengan modal
|
// Update fileCheckedLevels untuk sinkronisasi dengan modal
|
||||||
setFileCheckedLevels((prevLevels) => {
|
setFileCheckedLevels((prevLevels) => {
|
||||||
const newArray = [...prevLevels];
|
const newArray = [...prevLevels];
|
||||||
const currentFileLevels = new Set<number>(newArray[fileIndex] || new Set());
|
const currentFileLevels = new Set<number>(
|
||||||
|
newArray[fileIndex] || new Set()
|
||||||
|
);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
// Checklist semua item di modal
|
// Checklist semua item di modal
|
||||||
|
|
@ -591,7 +593,7 @@ export default function FormTeksDetail() {
|
||||||
nowArr = nowArr?.replaceAll("nasional", "mabes");
|
nowArr = nowArr?.replaceAll("nasional", "mabes");
|
||||||
nowArr = nowArr?.replaceAll("semua", "all");
|
nowArr = nowArr?.replaceAll("semua", "all");
|
||||||
|
|
||||||
// Dapatkan checked levels untuk file ini
|
// Dapatkan checked levels untuk file ini
|
||||||
const currentFileCheckedLevels = fileCheckedLevels[i]
|
const currentFileCheckedLevels = fileCheckedLevels[i]
|
||||||
? Array.from(fileCheckedLevels[i])
|
? Array.from(fileCheckedLevels[i])
|
||||||
: [];
|
: [];
|
||||||
|
|
@ -601,7 +603,7 @@ export default function FormTeksDetail() {
|
||||||
placements: nowArr,
|
placements: nowArr,
|
||||||
customLocationPlacements: currentFileCheckedLevels.join(","),
|
customLocationPlacements: currentFileCheckedLevels.join(","),
|
||||||
};
|
};
|
||||||
|
|
||||||
temp.push(data);
|
temp.push(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -726,11 +728,13 @@ export default function FormTeksDetail() {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
if (placement === "all") {
|
if (placement === "all") {
|
||||||
temp[index] = ["all", "mabes", "polda", "international"];
|
temp[index] = ["all", "mabes", "polda", "international"];
|
||||||
|
|
||||||
// Update fileCheckedLevels untuk sinkronisasi dengan modal ketika "all" diklik
|
// Update fileCheckedLevels untuk sinkronisasi dengan modal ketika "all" diklik
|
||||||
setFileCheckedLevels((prevLevels) => {
|
setFileCheckedLevels((prevLevels) => {
|
||||||
const newArray = [...prevLevels];
|
const newArray = [...prevLevels];
|
||||||
const currentFileLevels = new Set<number>(newArray[index] || new Set());
|
const currentFileLevels = new Set<number>(
|
||||||
|
newArray[index] || new Set()
|
||||||
|
);
|
||||||
|
|
||||||
// Checklist semua item di modal
|
// Checklist semua item di modal
|
||||||
listDest.forEach((item: any) => {
|
listDest.forEach((item: any) => {
|
||||||
|
|
@ -750,7 +754,7 @@ export default function FormTeksDetail() {
|
||||||
setFileUnitSelections((prevSelections) => {
|
setFileUnitSelections((prevSelections) => {
|
||||||
const newSelections = [...prevSelections];
|
const newSelections = [...prevSelections];
|
||||||
const currentSelection = { ...newSelections[index] };
|
const currentSelection = { ...newSelections[index] };
|
||||||
|
|
||||||
// Set semua checkbox tingkat utama ke true
|
// Set semua checkbox tingkat utama ke true
|
||||||
currentSelection.nasional = true;
|
currentSelection.nasional = true;
|
||||||
currentSelection.wilayah = true;
|
currentSelection.wilayah = true;
|
||||||
|
|
@ -759,7 +763,7 @@ export default function FormTeksDetail() {
|
||||||
currentSelection.polres = true;
|
currentSelection.polres = true;
|
||||||
currentSelection.satker = true;
|
currentSelection.satker = true;
|
||||||
currentSelection.semua = true;
|
currentSelection.semua = true;
|
||||||
|
|
||||||
newSelections[index] = currentSelection;
|
newSelections[index] = currentSelection;
|
||||||
return newSelections;
|
return newSelections;
|
||||||
});
|
});
|
||||||
|
|
@ -789,11 +793,13 @@ export default function FormTeksDetail() {
|
||||||
} else {
|
} else {
|
||||||
if (placement === "all") {
|
if (placement === "all") {
|
||||||
temp[index] = [];
|
temp[index] = [];
|
||||||
|
|
||||||
// Update fileCheckedLevels untuk sinkronisasi dengan modal ketika "all" di-unchecklist
|
// Update fileCheckedLevels untuk sinkronisasi dengan modal ketika "all" di-unchecklist
|
||||||
setFileCheckedLevels((prevLevels) => {
|
setFileCheckedLevels((prevLevels) => {
|
||||||
const newArray = [...prevLevels];
|
const newArray = [...prevLevels];
|
||||||
const currentFileLevels = new Set<number>(newArray[index] || new Set());
|
const currentFileLevels = new Set<number>(
|
||||||
|
newArray[index] || new Set()
|
||||||
|
);
|
||||||
|
|
||||||
// Unchecklist semua item di modal
|
// Unchecklist semua item di modal
|
||||||
currentFileLevels.clear();
|
currentFileLevels.clear();
|
||||||
|
|
@ -806,7 +812,7 @@ export default function FormTeksDetail() {
|
||||||
setFileUnitSelections((prevSelections) => {
|
setFileUnitSelections((prevSelections) => {
|
||||||
const newSelections = [...prevSelections];
|
const newSelections = [...prevSelections];
|
||||||
const currentSelection = { ...newSelections[index] };
|
const currentSelection = { ...newSelections[index] };
|
||||||
|
|
||||||
// Set semua checkbox tingkat utama ke false
|
// Set semua checkbox tingkat utama ke false
|
||||||
currentSelection.nasional = false;
|
currentSelection.nasional = false;
|
||||||
currentSelection.wilayah = false;
|
currentSelection.wilayah = false;
|
||||||
|
|
@ -815,7 +821,7 @@ export default function FormTeksDetail() {
|
||||||
currentSelection.polres = false;
|
currentSelection.polres = false;
|
||||||
currentSelection.satker = false;
|
currentSelection.satker = false;
|
||||||
currentSelection.semua = false;
|
currentSelection.semua = false;
|
||||||
|
|
||||||
newSelections[index] = currentSelection;
|
newSelections[index] = currentSelection;
|
||||||
return newSelections;
|
return newSelections;
|
||||||
});
|
});
|
||||||
|
|
@ -1071,7 +1077,7 @@ export default function FormTeksDetail() {
|
||||||
currentSelection.satker = Boolean(isSatkerChecked);
|
currentSelection.satker = Boolean(isSatkerChecked);
|
||||||
|
|
||||||
// Update checkbox "semua" berdasarkan semua checkbox yang aktif
|
// Update checkbox "semua" berdasarkan semua checkbox yang aktif
|
||||||
currentSelection.semua =
|
currentSelection.semua =
|
||||||
currentSelection.nasional &&
|
currentSelection.nasional &&
|
||||||
currentSelection.wilayah &&
|
currentSelection.wilayah &&
|
||||||
currentSelection.international &&
|
currentSelection.international &&
|
||||||
|
|
@ -1164,7 +1170,10 @@ export default function FormTeksDetail() {
|
||||||
// setSelectedTarget(id);
|
// setSelectedTarget(id);
|
||||||
// }}
|
// }}
|
||||||
>
|
>
|
||||||
<SelectTrigger size="md">
|
<SelectTrigger
|
||||||
|
size="md"
|
||||||
|
className="border border-gray-300 dark:border-gray-600"
|
||||||
|
>
|
||||||
<SelectValue placeholder="Pilih" />
|
<SelectValue placeholder="Pilih" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
|
|
|
||||||
|
|
@ -219,7 +219,9 @@ export default function FormVideoDetail() {
|
||||||
// Update fileCheckedLevels untuk sinkronisasi dengan modal
|
// Update fileCheckedLevels untuk sinkronisasi dengan modal
|
||||||
setFileCheckedLevels((prevLevels) => {
|
setFileCheckedLevels((prevLevels) => {
|
||||||
const newArray = [...prevLevels];
|
const newArray = [...prevLevels];
|
||||||
const currentFileLevels = new Set<number>(newArray[fileIndex] || new Set());
|
const currentFileLevels = new Set<number>(
|
||||||
|
newArray[fileIndex] || new Set()
|
||||||
|
);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
// Checklist semua item di modal
|
// Checklist semua item di modal
|
||||||
|
|
@ -687,11 +689,13 @@ export default function FormVideoDetail() {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
if (placement === "all") {
|
if (placement === "all") {
|
||||||
temp[index] = ["all", "mabes", "polda", "international"];
|
temp[index] = ["all", "mabes", "polda", "international"];
|
||||||
|
|
||||||
// Update fileCheckedLevels untuk sinkronisasi dengan modal ketika "all" diklik
|
// Update fileCheckedLevels untuk sinkronisasi dengan modal ketika "all" diklik
|
||||||
setFileCheckedLevels((prevLevels) => {
|
setFileCheckedLevels((prevLevels) => {
|
||||||
const newArray = [...prevLevels];
|
const newArray = [...prevLevels];
|
||||||
const currentFileLevels = new Set<number>(newArray[index] || new Set());
|
const currentFileLevels = new Set<number>(
|
||||||
|
newArray[index] || new Set()
|
||||||
|
);
|
||||||
|
|
||||||
// Checklist semua item di modal
|
// Checklist semua item di modal
|
||||||
listDest.forEach((item: any) => {
|
listDest.forEach((item: any) => {
|
||||||
|
|
@ -711,7 +715,7 @@ export default function FormVideoDetail() {
|
||||||
setFileUnitSelections((prevSelections) => {
|
setFileUnitSelections((prevSelections) => {
|
||||||
const newSelections = [...prevSelections];
|
const newSelections = [...prevSelections];
|
||||||
const currentSelection = { ...newSelections[index] };
|
const currentSelection = { ...newSelections[index] };
|
||||||
|
|
||||||
// Set semua checkbox tingkat utama ke true
|
// Set semua checkbox tingkat utama ke true
|
||||||
currentSelection.nasional = true;
|
currentSelection.nasional = true;
|
||||||
currentSelection.wilayah = true;
|
currentSelection.wilayah = true;
|
||||||
|
|
@ -720,7 +724,7 @@ export default function FormVideoDetail() {
|
||||||
currentSelection.polres = true;
|
currentSelection.polres = true;
|
||||||
currentSelection.satker = true;
|
currentSelection.satker = true;
|
||||||
currentSelection.semua = true;
|
currentSelection.semua = true;
|
||||||
|
|
||||||
newSelections[index] = currentSelection;
|
newSelections[index] = currentSelection;
|
||||||
return newSelections;
|
return newSelections;
|
||||||
});
|
});
|
||||||
|
|
@ -750,11 +754,13 @@ export default function FormVideoDetail() {
|
||||||
} else {
|
} else {
|
||||||
if (placement === "all") {
|
if (placement === "all") {
|
||||||
temp[index] = [];
|
temp[index] = [];
|
||||||
|
|
||||||
// Update fileCheckedLevels untuk sinkronisasi dengan modal ketika "all" di-unchecklist
|
// Update fileCheckedLevels untuk sinkronisasi dengan modal ketika "all" di-unchecklist
|
||||||
setFileCheckedLevels((prevLevels) => {
|
setFileCheckedLevels((prevLevels) => {
|
||||||
const newArray = [...prevLevels];
|
const newArray = [...prevLevels];
|
||||||
const currentFileLevels = new Set<number>(newArray[index] || new Set());
|
const currentFileLevels = new Set<number>(
|
||||||
|
newArray[index] || new Set()
|
||||||
|
);
|
||||||
|
|
||||||
// Unchecklist semua item di modal
|
// Unchecklist semua item di modal
|
||||||
currentFileLevels.clear();
|
currentFileLevels.clear();
|
||||||
|
|
@ -767,7 +773,7 @@ export default function FormVideoDetail() {
|
||||||
setFileUnitSelections((prevSelections) => {
|
setFileUnitSelections((prevSelections) => {
|
||||||
const newSelections = [...prevSelections];
|
const newSelections = [...prevSelections];
|
||||||
const currentSelection = { ...newSelections[index] };
|
const currentSelection = { ...newSelections[index] };
|
||||||
|
|
||||||
// Set semua checkbox tingkat utama ke false
|
// Set semua checkbox tingkat utama ke false
|
||||||
currentSelection.nasional = false;
|
currentSelection.nasional = false;
|
||||||
currentSelection.wilayah = false;
|
currentSelection.wilayah = false;
|
||||||
|
|
@ -776,7 +782,7 @@ export default function FormVideoDetail() {
|
||||||
currentSelection.polres = false;
|
currentSelection.polres = false;
|
||||||
currentSelection.satker = false;
|
currentSelection.satker = false;
|
||||||
currentSelection.semua = false;
|
currentSelection.semua = false;
|
||||||
|
|
||||||
newSelections[index] = currentSelection;
|
newSelections[index] = currentSelection;
|
||||||
return newSelections;
|
return newSelections;
|
||||||
});
|
});
|
||||||
|
|
@ -1069,7 +1075,7 @@ export default function FormVideoDetail() {
|
||||||
currentSelection.satker = Boolean(isSatkerChecked);
|
currentSelection.satker = Boolean(isSatkerChecked);
|
||||||
|
|
||||||
// Update checkbox "semua" berdasarkan semua checkbox yang aktif
|
// Update checkbox "semua" berdasarkan semua checkbox yang aktif
|
||||||
currentSelection.semua =
|
currentSelection.semua =
|
||||||
currentSelection.nasional &&
|
currentSelection.nasional &&
|
||||||
currentSelection.wilayah &&
|
currentSelection.wilayah &&
|
||||||
currentSelection.international &&
|
currentSelection.international &&
|
||||||
|
|
@ -1162,7 +1168,10 @@ export default function FormVideoDetail() {
|
||||||
// setSelectedTarget(id);
|
// setSelectedTarget(id);
|
||||||
// }}
|
// }}
|
||||||
>
|
>
|
||||||
<SelectTrigger size="md">
|
<SelectTrigger
|
||||||
|
size="md"
|
||||||
|
className="border border-gray-300 dark:border-gray-600"
|
||||||
|
>
|
||||||
<SelectValue placeholder="Pilih" />
|
<SelectValue placeholder="Pilih" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue