diff --git a/components/form/content/audio-update-form.tsx b/components/form/content/audio-update-form.tsx index dd237345..6715436a 100644 --- a/components/form/content/audio-update-form.tsx +++ b/components/form/content/audio-update-form.tsx @@ -214,7 +214,8 @@ export default function FormAudioUpdate() { const [tempFile, setTempFile] = useState([]); let fileTypeId = "4"; - const isDetailOfRegionShowed = false; + // const isDetailOfRegionShowed = false; + const [isDetailOfRegionShowed, setIsDetailOfRegionShowed] = useState(false); const { getRootProps, getInputProps } = useDropzone({ onDrop: (acceptedFiles) => { @@ -517,6 +518,7 @@ export default function FormAudioUpdate() { // Jika wilayah dicentang, auto centang POLDA, SATKER if (key === "wilayah") { currentSelection.wilayah = value; + setIsDetailOfRegionShowed(value); if (value) { // Ketika wilayah dicentang, auto centang POLDA, SATKER diff --git a/components/form/content/image-update-form.tsx b/components/form/content/image-update-form.tsx index a539e009..ff794793 100644 --- a/components/form/content/image-update-form.tsx +++ b/components/form/content/image-update-form.tsx @@ -148,7 +148,10 @@ export default function FormImageUpdate() { let counterUpdateProgress = 0; const [progressList, setProgressList] = useState([]); let uploadPersen = 0; - const isDetailOfRegionShowed = false; + + // const isDetailOfRegionShowed = false; + const [isDetailOfRegionShowed, setIsDetailOfRegionShowed] = useState(false); + const [isStartUpload, setIsStartUpload] = useState(false); const [counterProgress, setCounterProgress] = useState(0); const t = useTranslations("Form"); @@ -422,6 +425,8 @@ export default function FormImageUpdate() { // Jika wilayah dicentang, auto centang POLDA, SATKER if (key === "wilayah") { currentSelection.wilayah = value; + setIsDetailOfRegionShowed(value); + if (value) { // Ketika wilayah dicentang, auto centang POLDA, SATKER @@ -1729,7 +1734,7 @@ export default function FormImageUpdate() { sourceLang: "ID", targetLang: "EN", }); - console.log("PPP", res) + console.log("PPP", res); if (!res.error) { const resultText = diff --git a/components/form/content/teks-update-form.tsx b/components/form/content/teks-update-form.tsx index 4f871c75..b4f703d2 100644 --- a/components/form/content/teks-update-form.tsx +++ b/components/form/content/teks-update-form.tsx @@ -208,7 +208,8 @@ export default function FormTeksUpdate() { const [translatedTitle, setTranslatedTitle] = useState(""); let fileTypeId = "3"; - const isDetailOfRegionShowed = false; + // const isDetailOfRegionShowed = false; + const [isDetailOfRegionShowed, setIsDetailOfRegionShowed] = useState(false); const { getRootProps, getInputProps } = useDropzone({ onDrop: (acceptedFiles) => { @@ -543,6 +544,7 @@ export default function FormTeksUpdate() { // Jika wilayah dicentang, auto centang POLDA, SATKER if (key === "wilayah") { currentSelection.wilayah = value; + setIsDetailOfRegionShowed(value); if (value) { // Ketika wilayah dicentang, auto centang POLDA, SATKER diff --git a/components/form/content/video-update-form.tsx b/components/form/content/video-update-form.tsx index ddf18938..769fa1a3 100644 --- a/components/form/content/video-update-form.tsx +++ b/components/form/content/video-update-form.tsx @@ -165,7 +165,10 @@ export default function FormVideoUpdate() { type VideoSchema = z.infer; let progressInfo: any = []; let counterUpdateProgress = 0; - const isDetailOfRegionShowed = false; + + // const isDetailOfRegionShowed = false; + const [isDetailOfRegionShowed, setIsDetailOfRegionShowed] = useState(false); + const [progressList, setProgressList] = useState([]); let uploadPersen = 0; const [isStartUpload, setIsStartUpload] = useState(false); @@ -625,6 +628,7 @@ export default function FormVideoUpdate() { if (key === "wilayah" && value) { newSelection.polda = true; newSelection.satker = true; + setIsDetailOfRegionShowed(value); // Update fileCheckedLevels for wilayah setFileCheckedLevels((prevLevels) => { diff --git a/components/main/image-detail.tsx b/components/main/image-detail.tsx index 90dba4de..c27ebc6e 100644 --- a/components/main/image-detail.tsx +++ b/components/main/image-detail.tsx @@ -331,7 +331,7 @@ const DetailImage = (data: any) => { if (isDownloadAll) { const baseId = slug.split("-")?.[0]; - const url = `${process.env.NEXT_PUBLIC_API}/media/file/download-zip?id=${baseId}&resolution=${imageSizeSelected}`; + const url = `${process.env.NEXT_PUBLIC_API}/media/file/download-zip?id=${baseId}&resolution=${imageSizeSelected.toLowerCase()}`; downloadFile(url, "FileDownload.zip"); } else { const selectedFile = detailDataImage?.files?.[selectedImage]; @@ -351,7 +351,7 @@ const DetailImage = (data: any) => { main?.names || detailDataImage?.title || "image" ); } else { - const url = `${process.env.NEXT_PUBLIC_API}/media/view?id=${selectedFile.id}&operation=file&type=image&resolution=${imageSizeSelected}`; + const url = `${process.env.NEXT_PUBLIC_API}/media/view?id=${selectedFile.id}&operation=file&type=image&resolution=${imageSizeSelected.toLowerCase()}`; // ambil file sesuai yang dipilih, nama tetap dari judul (main.names) downloadFile(url, main?.names || detailDataImage?.title || "image"); }