diff --git a/app/[locale]/(public)/(polda)/polda/[polda_name]/audio/detail/[slug]/page.tsx b/app/[locale]/(public)/(polda)/polda/[polda_name]/audio/detail/[slug]/page.tsx index fffbae98..3f1e5ddf 100644 --- a/app/[locale]/(public)/(polda)/polda/[polda_name]/audio/detail/[slug]/page.tsx +++ b/app/[locale]/(public)/(polda)/polda/[polda_name]/audio/detail/[slug]/page.tsx @@ -8,13 +8,20 @@ import { Link, useRouter } from "@/i18n/routing"; import { Textarea } from "@/components/ui/textarea"; import { BarWave } from "react-cssfx-loading"; import { useToast } from "@/components/ui/use-toast"; -import { checkWishlistStatus, deleteWishlist, getDetail, saveWishlist } from "@/service/landing/landing"; +import { checkWishlistStatus, createPublicSuggestion, deletePublicSuggestion, deleteWishlist, getDetail, getPublicSuggestionList, saveWishlist } from "@/service/landing/landing"; import { getCookiesDecrypt } from "@/lib/utils"; -import { close, error, loading } from "@/config/swal"; +import { close, error, loading, warning } from "@/config/swal"; +import { useTranslations } from "next-intl"; +import { checkMaliciousText, getPublicLocaleTimestamp } from "@/utils/globals"; +import withReactContent from "sweetalert2-react-content"; +import Swal from "sweetalert2"; +import parse from "html-react-parser"; + const DetailAudio = () => { const [selectedSize, setSelectedSize] = useState("L"); const [selectedTab, setSelectedTab] = useState("video"); + const t = useTranslations("LandingPage"); const router = useRouter(); const pathname = usePathname(); const params = useParams(); @@ -29,6 +36,11 @@ const DetailAudio = () => { const [main, setMain] = useState(); const [resolutionSelected, setResolutionSelected] = useState("720"); const [imageSizeSelected, setImageSizeSelected] = useState("l"); + const [message, setMessage] = useState(""); + const userRoleId = getCookiesDecrypt("urie"); + const [listSuggestion, setListSuggestion] = useState(); + const [visibleInput, setVisibleInput] = useState(null); + const MySwal = withReactContent(Swal); const userId = getCookiesDecrypt("uie"); @@ -215,7 +227,120 @@ const DetailAudio = () => { { label: "S", value: "1066 x 599 px" }, { label: "XS", value: "800 x 450 px" }, ]; + async function sendSuggestionParent() { + if (message?.length > 3) { + loading(); + const data = { + mediaUploadId: slug?.split("-")?.[0], + message, + parentId: null, + }; + const response = await createPublicSuggestion(data); + + console.log(response); + setMessage(""); + + const responseGet = await getPublicSuggestionList(slug?.split("-")?.[0]); + console.log(responseGet?.data?.data); + setListSuggestion(responseGet?.data?.data); + + // Hapus nilai semua input secara manual jika perlu + const inputs = document.querySelectorAll("input"); + inputs.forEach((input) => { + input.value = ""; + }); + + close(); + } + } + const getInputValue = (e: any) => { + const message = e.target.value; + console.log(message); + setMessage(message); + }; + const postData = () => { + const checkMessage = checkMaliciousText(message); + if (checkMessage == "") { + if (Number(userRoleId) < 1 || userRoleId == undefined) { + router.push("/auth"); + } else { + sendSuggestionParent(); + } + } else { + warning(checkMessage); + } + }; + function addDefaultProfile(ev: any) { + ev.target.src = "/assets/avatar-profile.png"; + } + const showInput = (e: any) => { + console.log(document.querySelector(`#${e}`)?.classList); + document.querySelector(`#${e}`)?.classList.toggle("none"); + setVisibleInput(visibleInput === e ? null : e); + }; + async function sendSuggestionChild(parentId: any) { + const inputElement = document.querySelector(`#input-comment-${parentId}`) as HTMLInputElement; + + if (inputElement && inputElement.value.length > 3) { + loading(); + const data = { + mediaUploadId: slug?.split("-")?.[0], + message: inputElement.value, + parentId, + }; + + console.log(data); + const response = await createPublicSuggestion(data); + console.log(response); + const responseGet: any = await getPublicSuggestionList(slug?.split("-")?.[0]); + console.log(responseGet.data?.data); + setListSuggestion(responseGet.data?.data); + + // Reset input field + inputElement.value = ""; + + // document.querySelector("#comment-id-" + parentId)?.style.display = "none"; + + close(); + } + } + async function deleteDataSuggestion(dataId: any) { + loading(); + const response = await deletePublicSuggestion(dataId); + console.log(response); + const responseGet = await getPublicSuggestionList(slug.split("-")?.[0]); + console.log(responseGet.data?.data); + setListSuggestion(responseGet.data?.data); + close(); + } + const deleteData = (dataId: any) => { + MySwal.fire({ + title: "Delete Comment", + icon: "warning", + showCancelButton: true, + cancelButtonColor: "#3085d6", + confirmButtonColor: "#d33", + confirmButtonText: "Delete", + }).then((result: any) => { + if (result.isConfirmed) { + deleteDataSuggestion(dataId); + console.log(dataId); + } + }); + }; + const postDataChild = (id: any) => { + const checkMessage = checkMaliciousText(message); + if (checkMessage == "") { + if (Number(userRoleId) < 1 || userRoleId == undefined) { + router.push("/auth"); + } else { + sendSuggestionChild(id); + } + } else { + warning(checkMessage); + } + }; return ( <>
@@ -316,10 +441,188 @@ const DetailAudio = () => {
{/* Comment */} -
+ {/*

Berikan Komentar

+ +
-
+ ); }; diff --git a/app/[locale]/(public)/content-management/download/page.tsx b/app/[locale]/(public)/content-management/download/page.tsx index 7596e1fa..0d4876e4 100644 --- a/app/[locale]/(public)/content-management/download/page.tsx +++ b/app/[locale]/(public)/content-management/download/page.tsx @@ -5,7 +5,7 @@ import { checkWishlistStatus, deleteWishlist, getInfoProfile, mediaWishlist, sav import React, { useEffect, useState } from "react"; import { Link, useRouter } from "@/i18n/routing"; import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs"; -import { useSearchParams } from "next/navigation"; +import { usePathname, useSearchParams } from "next/navigation"; import { Card, CardContent } from "@/components/ui/card"; import HeaderManagement from "@/components/landing-page/header-management"; import SidebarManagement from "@/components/landing-page/sidebar-management"; @@ -19,6 +19,7 @@ import { Button } from "@/components/ui/button"; import { sendMediaUploadToEmail } from "@/service/media-tracking/media-tracking"; import ImageBlurry from "@/components/ui/image-blurry"; import Image from "next/image"; +import { useTranslations } from "next-intl"; const Galery = (props: any) => { const [profile, setProfile] = useState(); @@ -26,6 +27,7 @@ const Galery = (props: any) => { const router = useRouter(); const MySwal = withReactContent(Swal); const searchParams = useSearchParams(); + const pathname = usePathname(); const page: any = searchParams?.get("page"); const title = searchParams?.get("title"); const category = searchParams?.get("category"); @@ -50,6 +52,7 @@ const Galery = (props: any) => { const [emailShareInput, setEmailShareInput] = useState(); const [emailMessageInput, setEmailMessageInput] = useState(); const id = searchParams?.get("id"); + const t = useTranslations("LandingPage"); useEffect(() => { getDataVideo(); @@ -282,37 +285,49 @@ const Galery = (props: any) => {

- Galeri - Saya + {/* Galeri + Saya */} + {pathname?.split("/")[1] == "in" ? ( + <> + {t("gallery")}  + {t("my")} + + ) : ( + <> + {t("my")}  + {t("gallery")} + + )}

+ - Foto + {t("image")}
|
- Audio Visual + {t("video")}
|
- Teks + {t("text")}
|
- Audio + {t("audio")}
@@ -343,7 +358,7 @@ const Galery = (props: any) => {
handleSaveWishlist(video?.mediaUpload?.id)} className="cursor-pointer flex flex-row gap-2 hover:text-red-800"> -

Simpan

+

{t("save")}

@@ -354,18 +369,18 @@ const Galery = (props: any) => {
-

Share Ke Email

+

{t("shareTo")}

-

Email Tujuan :

- setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder="Tekan Enter untuk input Email" /> +

{t("destinationEmail")}

+ setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder={t("pressEnter")} />
@@ -421,12 +436,16 @@ const Galery = (props: any) => {
- + +
handleSaveWishlist(audio?.mediaUpload?.id)} className="cursor-pointer flex flex-row gap-2 hover:text-red-800"> + +

{t("save")}

+

Content Rewrite

@@ -434,29 +453,25 @@ const Galery = (props: any) => {
-
-

Share Ke Email

+

{t("shareTo")}

-

Email Tujuan :

- setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder="Tekan Enter untuk input Email" /> +

{t("destinationEmail")}

+ setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder={t("pressEnter")} />
- handleDelete(audio?.id)} className="flex items-center gap-3 hover:text-red-800 w-full rounded-lg"> - -

Hapus

-
@@ -491,7 +506,7 @@ const Galery = (props: any) => {
handleSaveWishlist(image?.mediaUpload?.id)} className="cursor-pointer flex flex-row gap-2 hover:text-red-800"> -

Simpan

+

{t("save")}

@@ -502,18 +517,18 @@ const Galery = (props: any) => {
-

Share Ke Email

+

{t("shareTo")}

-

Email Tujuan :

- setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder="Tekan Enter untuk input Email" /> +

{t("destinationEmail")}

+ setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder={t("pressEnter")} />
@@ -529,7 +544,7 @@ const Galery = (props: any) => { ))} -
+ ) : (

empty @@ -556,7 +571,7 @@ const Galery = (props: any) => { - Download Dokumen + Download {t("document")} @@ -566,6 +581,10 @@ const Galery = (props: any) => { +

handleSaveWishlist(document?.mediaUpload?.id)} className="cursor-pointer flex flex-row gap-2 hover:text-red-800"> + +

{t("save")}

+

Content Rewrite

@@ -573,29 +592,25 @@ const Galery = (props: any) => {
-
-

Share Ke Email

+

{t("shareTo")}

-

Email Tujuan :

- setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder="Tekan Enter untuk input Email" /> +

{t("destinationEmail")}

+ setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder={t("pressEnter")} />
- handleDelete(document?.id)} className="flex items-center gap-3 hover:text-red-800 w-full rounded-lg"> - -

Hapus

-
diff --git a/app/[locale]/(public)/content-management/galery/page.tsx b/app/[locale]/(public)/content-management/galery/page.tsx index 3b65bd3f..05b566ba 100644 --- a/app/[locale]/(public)/content-management/galery/page.tsx +++ b/app/[locale]/(public)/content-management/galery/page.tsx @@ -21,7 +21,7 @@ import { Button } from "@/components/ui/button"; import { sendMediaUploadToEmail } from "@/service/media-tracking/media-tracking"; import ImageBlurry from "@/components/ui/image-blurry"; import Image from "next/image"; -import { formatDateToIndonesian } from "@/utils/globals"; +import { useTranslations } from "next-intl"; const Galery = (props: any) => { const [profile, setProfile] = useState(); @@ -54,6 +54,7 @@ const Galery = (props: any) => { const [emailShareInput, setEmailShareInput] = useState(); const [emailMessageInput, setEmailMessageInput] = useState(); const id = searchParams?.get("id"); + const t = useTranslations("LandingPage"); useEffect(() => { getDataVideo(); @@ -289,7 +290,7 @@ const Galery = (props: any) => {

- Galeri + {t("gallery")} {profile?.institute?.name}

@@ -298,28 +299,28 @@ const Galery = (props: any) => { value="image" className="relative text-xs md:text-xl font-bold text-black dark:text-white dark:bg-transparent before:absolute before:top-full before:left-0 before:h-px before:w-full data-[state=active]:before:bg-primary" > - Foto + {t("image")}
|
- Audio Visual + {t("video")}
|
- Teks + {t("text")}
|
- Audio + {t("audio")}
@@ -350,7 +351,7 @@ const Galery = (props: any) => {
handleSaveWishlist(video?.mediaUpload?.id)} className="cursor-pointer flex flex-row gap-2 hover:text-red-800"> -

Simpan

+

{t("save")}

@@ -361,18 +362,18 @@ const Galery = (props: any) => {
-

Share Ke Email

+

{t("shareTo")}

-

Email Tujuan :

- setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder="Tekan Enter untuk input Email" /> +

{t("destinationEmail")}

+ setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder={t("shareTo")} />
@@ -434,7 +435,7 @@ const Galery = (props: any) => {
handleSaveWishlist(audio?.mediaUpload?.id)} className="cursor-pointer flex flex-row gap-2 hover:text-red-800"> -

Simpan

+

{t("save")}

@@ -445,18 +446,18 @@ const Galery = (props: any) => {
-

Share Ke Email

+

{t("shareTo")}

-

Email Tujuan :

- setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder="Tekan Enter untuk input Email" /> +

{t("destinationEmail")}

+ setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder={t("pressEnter")} />
@@ -496,7 +497,7 @@ const Galery = (props: any) => {
handleSaveWishlist(image?.mediaUpload?.id)} className="cursor-pointer flex flex-row gap-2 hover:text-red-800"> -

Simpan

+

{t("save")}

@@ -507,18 +508,18 @@ const Galery = (props: any) => {
-

Share Ke Email

+

{t("shareTo")}

-

Email Tujuan :

- setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder="Tekan Enter untuk input Email" /> +

{t("destinationEmail")}

+ setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder={t("pressEnter")} />
@@ -561,7 +562,7 @@ const Galery = (props: any) => { - Download Dokumen + Download {t("document")}
@@ -573,7 +574,7 @@ const Galery = (props: any) => {
handleSaveWishlist(document?.mediaUpload?.id)} className="cursor-pointer flex flex-row gap-2 hover:text-red-800"> -

Simpan

+

{t("save")}

@@ -584,18 +585,18 @@ const Galery = (props: any) => {
-

Share Ke Email

+

{t("shareTo")}

-

Email Tujuan :

- setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder="Tekan Enter untuk input Email" /> +

{t("destinationEmail")}

+ setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder={t("pressEnter")} />
diff --git a/app/[locale]/(public)/content-management/rewrite/create/[id]/page.tsx b/app/[locale]/(public)/content-management/rewrite/create/[id]/page.tsx index 1c1f8d15..a982672d 100644 --- a/app/[locale]/(public)/content-management/rewrite/create/[id]/page.tsx +++ b/app/[locale]/(public)/content-management/rewrite/create/[id]/page.tsx @@ -21,10 +21,10 @@ import { getPublicSuggestionList } from "@/service/landing/landing"; import { getDetail } from "@/service/detail/detail"; import { yupResolver } from "@hookform/resolvers/yup"; import * as Yup from "yup"; -import { htmlToString } from "@/utils/globals"; import Cookies from "js-cookie"; import { Input } from "@/components/ui/input"; import { Textarea } from "@/components/ui/textarea"; +import { useTranslations } from "next-intl"; const imageSchema = z.object({ title: z.string().min(1, { message: "Judul diperlukan" }), @@ -63,6 +63,7 @@ const page = (props: any) => { const [isLoadingData, setIsLoadingData] = useState(false); const [detailData, setDetailData] = useState(null); const [articleImages, setArticleImages] = useState([]); + const t = useTranslations("LandingPage"); const userLevelId = getCookiesDecrypt("ulie"); const roleId = getCookiesDecrypt("urie"); @@ -293,21 +294,21 @@ const page = (props: any) => {
-
Content Rewrite
+
{t("content")} Rewrite
{content && (
-

Bahasa

+

{t("language")}

-

Context Type

+

{t("contextType")}

-

Writing Style

+

{t("writingStyle")}

-

Article Size

+

{t("articleSize")}

setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder="Tekan Enter untuk input Email" /> +
+ +

{image?.title}

+ +

+ + + + + + + +

handleSaveWishlist(image?.mediaUpload?.id)} className="cursor-pointer flex flex-row gap-2 hover:text-red-800"> + +

{t("save")}

- -
- - + + +

Content Rewrite

+ +
+ + + + + +
+

{t("shareTo")}

+
+

{t("destinationEmail")}

+ setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder={t("pressEnter")} /> +
+ +
+
+
+
+ + +

- handleDelete(image?.id)} className="flex items-center gap-1 hover:text-red-800 w-full rounded-lg"> - -

Hapus

-
- - +
+
diff --git a/app/[locale]/(public)/content-management/users/page.tsx b/app/[locale]/(public)/content-management/users/page.tsx index 1315ac4f..6f047011 100644 --- a/app/[locale]/(public)/content-management/users/page.tsx +++ b/app/[locale]/(public)/content-management/users/page.tsx @@ -2,7 +2,7 @@ import HeaderManagement from "@/components/landing-page/header-management"; import SidebarManagement from "@/components/landing-page/sidebar-management"; -import { close, error, loading } from "@/config/swal"; +import { close, loading } from "@/config/swal"; import { getCookiesDecrypt } from "@/lib/utils"; import { getInfoProfile, getUsersTeams, saveUserReports } from "@/service/landing/landing"; import React, { useEffect, useState } from "react"; @@ -10,10 +10,9 @@ import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, Di import withReactContent from "sweetalert2-react-content"; import Swal from "sweetalert2"; import { Button } from "@/components/ui/button"; -import toast from "react-hot-toast"; import { useToast } from "@/components/ui/use-toast"; -import { ToastAction } from "@/components/ui/toast"; import Image from "next/image"; +import { useTranslations } from "next-intl"; const page = () => { const [user, setUser] = useState(); @@ -24,6 +23,7 @@ const page = () => { const MySwal = withReactContent(Swal); const { toast } = useToast(); const [reportMessageOpen, setReportMessageOpen] = useState(false); + const t = useTranslations("LandingPage"); // const launchModal = (user: any) => { // setUserSelected(user); @@ -120,11 +120,11 @@ const page = () => {

- Tim + {t("team")} {profile?.institute?.name}

- {user?.length} Anggota Tim {profile?.institute?.name} + {user?.length} {t("teamMembers")} {profile?.institute?.name}

@@ -164,7 +164,7 @@ const page = () => {
-

Alasan Report Akun

+

{t("reasonReport")}