diff --git a/app/[locale]/(protected)/contributor/content/image/components/table-image.tsx b/app/[locale]/(protected)/contributor/content/image/components/table-image.tsx index 1e319486..1399f44c 100644 --- a/app/[locale]/(protected)/contributor/content/image/components/table-image.tsx +++ b/app/[locale]/(protected)/contributor/content/image/components/table-image.tsx @@ -52,7 +52,7 @@ import { InputGroup, InputGroupText } from "@/components/ui/input-group"; import { paginationBlog } from "@/service/blog/blog"; import { ticketingPagination } from "@/service/ticketing/ticketing"; import { Badge } from "@/components/ui/badge"; -import { useRouter, useSearchParams } from "next/navigation"; +import { useParams, useRouter, useSearchParams } from "next/navigation"; import TablePagination from "@/components/table/table-pagination"; import { @@ -73,6 +73,9 @@ import useTableColumns from "./columns"; const TableImage = () => { const router = useRouter(); const searchParams = useSearchParams(); + + const params = useParams(); + const locale = params?.locale; const MySwal = withReactContent(Swal); const [dataTable, setDataTable] = React.useState([]); const [totalData, setTotalData] = React.useState(1); @@ -199,7 +202,8 @@ const TableImage = () => { formattedStartDate, // Pastikan format sesuai formattedEndDate, // Pastikan format sesuai search, - filterByCreatorGroup + filterByCreatorGroup, + locale == "en" ); const data = res?.data?.data; diff --git a/app/[locale]/(public)/(polda)/tbnews/[polda_name]/components/national-news.tsx b/app/[locale]/(public)/(polda)/tbnews/[polda_name]/components/national-news.tsx index 85a067be..c94dea4b 100644 --- a/app/[locale]/(public)/(polda)/tbnews/[polda_name]/components/national-news.tsx +++ b/app/[locale]/(public)/(polda)/tbnews/[polda_name]/components/national-news.tsx @@ -2,8 +2,7 @@ import { Reveal } from "@/components/landing-page/Reveal"; import { Skeleton } from "@/components/ui/skeleton"; -import { getHeroData, listData } from "@/service/landing/landing"; -import { formatDateToIndonesian } from "@/utils/globals"; +import { listData } from "@/service/landing/landing"; import Image from "next/image"; import { useParams } from "next/navigation"; import React, { useEffect, useState } from "react"; diff --git a/app/[locale]/(public)/(polda)/tbnews/[polda_name]/components/news-tickers-kaltara.tsx b/app/[locale]/(public)/(polda)/tbnews/[polda_name]/components/news-tickers-kaltara.tsx index 9cd499d7..18ea033a 100644 --- a/app/[locale]/(public)/(polda)/tbnews/[polda_name]/components/news-tickers-kaltara.tsx +++ b/app/[locale]/(public)/(polda)/tbnews/[polda_name]/components/news-tickers-kaltara.tsx @@ -1,6 +1,6 @@ "use client"; import { Link } from "@/i18n/routing"; -import { getHeroData, listCarousel, listData } from "@/service/landing/landing"; +import { listData } from "@/service/landing/landing"; import { formatDateToIndonesian, textEllipsis } from "@/utils/globals"; import { useEffect, useState } from "react"; import { useTranslations } from "next-intl"; diff --git a/app/[locale]/(public)/(polda)/tbnews/[polda_name]/components/popular-news.tsx b/app/[locale]/(public)/(polda)/tbnews/[polda_name]/components/popular-news.tsx index 4a4c7cd4..b2fc51ff 100644 --- a/app/[locale]/(public)/(polda)/tbnews/[polda_name]/components/popular-news.tsx +++ b/app/[locale]/(public)/(polda)/tbnews/[polda_name]/components/popular-news.tsx @@ -44,7 +44,7 @@ const PopularNews = () => { }, []); const initFetch = async () => { - const response = await getHeroData(); + const response = await getHeroData(locale == "en"); console.log(response); setHeroData(response?.data?.data?.content); }; diff --git a/app/[locale]/(public)/(polda)/tbnews/[polda_name]/components/regional-news.tsx b/app/[locale]/(public)/(polda)/tbnews/[polda_name]/components/regional-news.tsx index dd676e45..65b6ddd7 100644 --- a/app/[locale]/(public)/(polda)/tbnews/[polda_name]/components/regional-news.tsx +++ b/app/[locale]/(public)/(polda)/tbnews/[polda_name]/components/regional-news.tsx @@ -2,8 +2,7 @@ import { Reveal } from "@/components/landing-page/Reveal"; import { Skeleton } from "@/components/ui/skeleton"; -import { getHeroData, listData } from "@/service/landing/landing"; -import { formatDateToIndonesian } from "@/utils/globals"; +import { listData } from "@/service/landing/landing"; import Image from "next/image"; import { useParams } from "next/navigation"; import React, { useEffect, useState } from "react"; diff --git a/components/form/content/image-detail-form.tsx b/components/form/content/image-detail-form.tsx index 9ff0264a..f7eda88b 100644 --- a/components/form/content/image-detail-form.tsx +++ b/components/form/content/image-detail-form.tsx @@ -683,7 +683,7 @@ export default function FormImageDetail() { "" )} */} - {detail?.isPublish == false && detail.isPublishOnPolda == true ? ( + {(detail?.isPublish == false && detail.isPublishOnPolda == true) || (detail?.isPublish == false && detail?.isInternationalMedia == true && Number(detail?.statusId) == 2) ? (
+
+ {monthNames[month]} {year} +
+
{["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"].map((d) => ( @@ -167,26 +185,32 @@ const EventCalender = () => { {d}
))} - {calendarDays?.map((day, index) => ( -
- {day} -
- ))} + {calendarDays.map((day, index) => { + const isToday = + day === currentDate && + month === currentMonth && + year === currentYear; + + return ( +
+ {day} +
+ ); + })} - {/* Event List */}

Daftar Acara @@ -224,7 +248,11 @@ const EventCalender = () => {

-
+
)) @@ -232,13 +260,12 @@ const EventCalender = () => { - {/* Right Side - Event Detail */}

Detail Acara

- + {selectedEvent ? (
{ target.src = "/images/default-event.png"; }} /> - +

{selectedEvent.title}

- +
- Tanggal: - {formatDateRange(selectedEvent.startDate, selectedEvent.endDate)} + + Tanggal: + + + {formatDateRange( + selectedEvent.startDate, + selectedEvent.endDate + )} +

@@ -267,7 +301,7 @@ const EventCalender = () => {

- +
) : (
- Pilih acara untuk melihat detail + Pilih acara untuk melihat detail
)}
@@ -287,4 +321,4 @@ const EventCalender = () => { ); }; -export default EventCalender; \ No newline at end of file +export default EventCalender; diff --git a/components/landing-page/header-banner-satker.tsx b/components/landing-page/header-banner-satker.tsx index 76e3af14..17f8883e 100644 --- a/components/landing-page/header-banner-satker.tsx +++ b/components/landing-page/header-banner-satker.tsx @@ -22,6 +22,7 @@ import Image from "next/image"; const HeaderBannerSatker = () => { const router = useRouter(); const params = useParams(); + const locale = params?.locale; const satkerName: any = params?.satker_name; const asPath: any = usePathname(); const [content, setContent] = useState([]); @@ -50,7 +51,7 @@ const HeaderBannerSatker = () => { ); var data = res?.data?.data?.content; if (data) { - const resStatic = await listStaticBanner(satkerName, false); + const resStatic = await listStaticBanner(satkerName, locale == "en"); for (let i = 0; i < resStatic?.data?.data?.length; i++) { const media = resStatic?.data.data[i]?.mediaUpload; media.fileTypeId = media.fileType?.id; diff --git a/components/landing-page/header-banner.tsx b/components/landing-page/header-banner.tsx index c48c8bf4..9942b4b2 100644 --- a/components/landing-page/header-banner.tsx +++ b/components/landing-page/header-banner.tsx @@ -12,6 +12,7 @@ import { useRouter } from "@/i18n/routing"; const HeaderBanner = () => { const router = useRouter(); const params = useParams(); + const locale = params?.locale; const poldaName: any = params?.polda_name; const [content, setContent] = useState([]); const [isBannerLoading, setIsBannerLoading] = useState(true); @@ -31,7 +32,7 @@ const HeaderBanner = () => { const res = await listData("1", "", "", 5, 0, "createdAt", "", "", poldaName); var data = res?.data?.data?.content; if (data) { - const resStatic = await listStaticBanner(poldaName, false); + const resStatic = await listStaticBanner(poldaName, locale == "en"); for (let i = 0; i < resStatic?.data?.data?.length; i++) { const media = resStatic?.data.data[i]?.mediaUpload; media.fileTypeId = media.fileType?.id; diff --git a/components/landing-page/hero-new-polda.tsx b/components/landing-page/hero-new-polda.tsx index c54d57eb..fbb2f664 100644 --- a/components/landing-page/hero-new-polda.tsx +++ b/components/landing-page/hero-new-polda.tsx @@ -69,7 +69,7 @@ const HeroModal = ({ onClose, group, poldaName, satkerName }: HeroModalProps) => const initFetch = async () => { if (group === "polda" && poldaName && String(poldaName).length > 1) { - const response = await listStaticBanner(poldaName); + const response = await listStaticBanner(poldaName, locale == "en"); const banners = response?.data?.data?.map((item: any) => { @@ -245,13 +245,13 @@ const HeroNewPolda = (props: { group?: string }) => { }, []); const initFetch = async () => { - const response = await getHeroData(); + const response = await getHeroData(locale == "en"); console.log(response); let data = response?.data?.data?.content; setHeroData(data); if (data && props.group === "polda" && poldaName && String(poldaName)?.length > 1) { - const resStatic = await listStaticBanner(poldaName); + const resStatic = await listStaticBanner(poldaName, locale == "en"); for (let i = 0; i < resStatic?.data?.data?.length; i++) { const media = resStatic?.data.data[i]?.mediaUpload; diff --git a/components/landing-page/hero-new-satker.tsx b/components/landing-page/hero-new-satker.tsx index 8d39a52c..41c4730a 100644 --- a/components/landing-page/hero-new-satker.tsx +++ b/components/landing-page/hero-new-satker.tsx @@ -69,7 +69,7 @@ const HeroModal = ({ onClose, group, poldaName, satkerName }: HeroModalProps) => const initFetch = async () => { if (group === "satker" && satkerName && String(satkerName).length > 1) { - const response = await listStaticBanner(satkerName); + const response = await listStaticBanner(satkerName, locale == "en"); const banners = response?.data?.data?.map((item: any) => { @@ -245,13 +245,13 @@ const HeroNewSatker = (props: { group?: string }) => { }, []); const initFetch = async () => { - const response = await getHeroData(); + const response = await getHeroData(locale == "en"); console.log(response); let data = response?.data?.data?.content; setHeroData(data); if (data && props.group === "satker" && satkerName && String(satkerName)?.length > 1) { - const resStatic = await listStaticBanner(satkerName); + const resStatic = await listStaticBanner(satkerName, locale == "en"); for (let i = 0; i < resStatic?.data?.data?.length; i++) { const media = resStatic?.data.data[i]?.mediaUpload; diff --git a/components/landing-page/hero-new.tsx b/components/landing-page/hero-new.tsx index cf218958..0dc3aba5 100644 --- a/components/landing-page/hero-new.tsx +++ b/components/landing-page/hero-new.tsx @@ -100,7 +100,8 @@ const HeroModal = ({ ? poldaName : group === "satker" && satkerName && String(satkerName)?.length > 1 ? "satker-" + satkerName - : "" + : "", + locale == "en" ); const banners = @@ -295,7 +296,7 @@ const HeroNew = (props: { group?: string }) => { }, []); const initFetch = async () => { - const response = await getHeroData(); + const response = await getHeroData(locale == "en"); console.log(response); let data = response?.data?.data?.content; setHeroData(response?.data?.data?.content); @@ -309,7 +310,8 @@ const HeroNew = (props: { group?: string }) => { satkerName && String(satkerName)?.length > 1 ? "satker-" + satkerName - : "" + : "", + locale == "en" ); for (let i = 0; i < resStatic?.data?.data?.length; i++) { const media = resStatic?.data.data[i]?.mediaUpload; diff --git a/components/landing-page/hero.tsx b/components/landing-page/hero.tsx index ba8c8885..10d65d85 100644 --- a/components/landing-page/hero.tsx +++ b/components/landing-page/hero.tsx @@ -79,11 +79,11 @@ const HeroModal = ({ onClose }: { onClose: () => void }) => { }, []); const initFetch = async () => { - const response = await getHeroData(); + const response = await getHeroData(locale == "en"); console.log(response); let data = response?.data?.data?.content; if (data) { - const resStatic = await listStaticBanner(); + const resStatic = await listStaticBanner("", locale == "en"); for (let i = 0; i < resStatic?.data?.data?.length; i++) { const media = resStatic?.data.data[i]?.mediaUpload; media.fileTypeId = media.fileType?.id; @@ -287,7 +287,7 @@ const Hero = (props: { group?: string }) => { }, []); const initFetch = async () => { - const response = await getHeroData(); + const response = await getHeroData(locale == "en"); console.log(response); let data = response?.data?.data?.content; setHeroData(response?.data?.data?.content); @@ -301,7 +301,8 @@ const Hero = (props: { group?: string }) => { satkerName && String(satkerName)?.length > 1 ? "satker-" + satkerName - : "" + : "", + locale == "en" ); for (let i = 0; i < resStatic?.data?.data?.length; i++) { const media = resStatic?.data.data[i]?.mediaUpload; diff --git a/components/landing-page/news-tickers.tsx b/components/landing-page/news-tickers.tsx index c28be857..42ca2e41 100644 --- a/components/landing-page/news-tickers.tsx +++ b/components/landing-page/news-tickers.tsx @@ -5,14 +5,19 @@ import { formatDateToIndonesian, textEllipsis } from "@/utils/globals"; import { useEffect, useState } from "react"; import { Icon } from "../ui/icon"; import { useTranslations } from "next-intl"; +import { useParams } from "next/navigation"; + export default function NewsTicker() { const [article, setArticle] = useState([]); const [currentNewsIndex, setCurrentNewsIndex] = useState(0); const [animate, setAnimate] = useState(false); + const params = useParams(); + const locale = params?.locale; const t = useTranslations("LandingPage"); + useEffect(() => { async function getArticle() { - const response = await getHeroData(); + const response = await getHeroData(locale == "en"); setArticle(response?.data?.data?.content); } getArticle(); diff --git a/components/landing-page/scrollable-content-polda.tsx b/components/landing-page/scrollable-content-polda.tsx index 84ae6318..117c16c6 100644 --- a/components/landing-page/scrollable-content-polda.tsx +++ b/components/landing-page/scrollable-content-polda.tsx @@ -43,7 +43,7 @@ const ScrollableContentPolda = () => { }, []); const initFetch = async () => { - const response = await getHeroData(); + const response = await getHeroData(locale == "en"); console.log(response); let data = response?.data?.data?.content; diff --git a/components/landing-page/scrollable-content-satker.tsx b/components/landing-page/scrollable-content-satker.tsx index 7ba42f87..eda8f006 100644 --- a/components/landing-page/scrollable-content-satker.tsx +++ b/components/landing-page/scrollable-content-satker.tsx @@ -50,7 +50,7 @@ const ScrollableContentSatker = () => { }, []); const initFetch = async () => { - const response = await getHeroData(); + const response = await getHeroData(locale == "en"); console.log(response); let data = response?.data?.data?.content; diff --git a/components/landing-page/search-section-new.tsx b/components/landing-page/search-section-new.tsx index 4e5d12d0..b0244922 100644 --- a/components/landing-page/search-section-new.tsx +++ b/components/landing-page/search-section-new.tsx @@ -22,6 +22,7 @@ const ScrollableContent = () => { const locale = params?.locale; const t = useTranslations("LandingPage"); const [content, setContent] = useState(); + useEffect(() => { async function fetchCategories() { const url = "https://netidhub.com/api/csrf"; @@ -45,12 +46,13 @@ const ScrollableContent = () => { }, []); const initFetch = async () => { - const response = await getHeroData(); + const response = await getHeroData(locale == "en"); console.log(response); let data = response?.data?.data?.content; setContent(data); }; + return ( <>
diff --git a/components/landing-page/search-section-polda.tsx b/components/landing-page/search-section-polda.tsx index 1d6108b5..c52fc977 100644 --- a/components/landing-page/search-section-polda.tsx +++ b/components/landing-page/search-section-polda.tsx @@ -30,7 +30,7 @@ const SearchSectionPolda = () => { - + {/* */}
diff --git a/components/landing-page/search-section-satker.tsx b/components/landing-page/search-section-satker.tsx index e9aefa93..7595741e 100644 --- a/components/landing-page/search-section-satker.tsx +++ b/components/landing-page/search-section-satker.tsx @@ -31,7 +31,7 @@ const SearchSectionSatker = () => { - + {/* */}
diff --git a/components/partials/auth/login-form.tsx b/components/partials/auth/login-form.tsx index 212af74c..e48c2eeb 100644 --- a/components/partials/auth/login-form.tsx +++ b/components/partials/auth/login-form.tsx @@ -149,7 +149,6 @@ const LoginForm = () => { console.log("PROFILE : ", profile?.data?.data); if ( - profile?.data?.data?.isInternational == true || profile?.data?.data?.isActive == false || profile?.data?.data?.isDelete == true ) { @@ -225,6 +224,8 @@ const LoginForm = () => { Number(profile?.data?.data?.roleId) == 10 || Number(profile?.data?.data?.roleId) == 11 || Number(profile?.data?.data?.roleId) == 12 || + Number(profile?.data?.data?.roleId) == 14 || + Number(profile?.data?.data?.roleId) == 15 || Number(profile?.data?.data?.roleId) == 18 || Number(profile?.data?.data?.roleId) == 19 ) { diff --git a/lib/menus.ts b/lib/menus.ts index df3c15fa..cd079b56 100644 --- a/lib/menus.ts +++ b/lib/menus.ts @@ -38,7 +38,7 @@ export function getMenuList(pathname: string, t: any): Group[] { let menusSelected = []; - if (Number(roleId) == 3 && Number(levelNumber) == 1) { + if ((Number(roleId) == 3 || Number(roleId) == 14) && Number(levelNumber) == 1) { menusSelected = [ { groupLabel: t("apps"), @@ -1700,7 +1700,7 @@ export function getMenuList(pathname: string, t: any): Group[] { }, ]; } else if ( - (Number(roleId) == 3 || Number(roleId) == 4) && + (Number(roleId) == 3 || Number(roleId) == 4 || Number(roleId) == 14 || Number(roleId) == 15) && Number(levelNumber) == 2 ) { if (Number(userLevelId) != 761) { @@ -2158,7 +2158,7 @@ export function getMenuList(pathname: string, t: any): Group[] { ]; } } else if ( - (Number(roleId) == 3 || Number(roleId) == 4) && + (Number(roleId) == 3 || Number(roleId) == 4 || Number(roleId) == 14 || Number(roleId) == 15) && Number(levelNumber) == 3 ) { if (Number(userParentLevelId) != 761) { diff --git a/service/content/content.ts b/service/content/content.ts index 257c24f1..21d94937 100644 --- a/service/content/content.ts +++ b/service/content/content.ts @@ -47,22 +47,23 @@ export async function listDataAll( } export async function listDataImage( - size: any, - page: any, - isForSelf: any, - isApproval: any, - categoryFilter: any, - statusFilter: any, - needApprovalFromLevel: any, - creator: any, - source: any, - startDate: any, - endDate: any, + size: any = "", + page: any = "", + isForSelf: any = "", + isApproval: any = "", + categoryFilter: any = "", + statusFilter: any = "", + needApprovalFromLevel: any = "", + creator: any = "", + source: any = "", + startDate: any = "", + endDate: any = "", title: string = "", - creatorGroup: string = "" + creatorGroup: string = "", + isInt: boolean = false ) { return await httpGetInterceptor( - `media/list?enablePage=1&size=${size}&sortBy=createdAt&sort=desc&page=${page}&typeId=1&isForSelf=${isForSelf}&isApproval=${isApproval}&categoryId=${categoryFilter}&statusId=${statusFilter}&needApprovalFromLevel=${needApprovalFromLevel}&creatorUserLevelName=${source}&creatorName=${creator}&startDate=${startDate}&endDate=${endDate}&title=${title}&creatorGroupLevelName=${creatorGroup}` + `media/list?enablePage=1&size=${size}&sortBy=createdAt&sort=desc&page=${page}&typeId=1&isForSelf=${isForSelf}&isApproval=${isApproval}&categoryId=${categoryFilter}&statusId=${statusFilter}&creatorUserLevelName=${source}&creatorName=${creator}&startDate=${startDate}&endDate=${endDate}&title=${title}&creatorGroupLevelName=${creatorGroup}&needApprovalFromLevel=${needApprovalFromLevel}&isInt=${isInt}` ); } diff --git a/service/landing/landing.ts b/service/landing/landing.ts index 51876f78..b32ea0a3 100644 --- a/service/landing/landing.ts +++ b/service/landing/landing.ts @@ -31,9 +31,9 @@ export async function getCsrfToken() { // } } -export async function getHeroData() { +export async function getHeroData(isInt: Boolean = false) { return await httpGetInterceptor( - `media/public/list?enablePage=1&sort=desc&sortBy=createdAt&size=5&page=0&typeId=1&title=&categoryId=&fileFormats=&tags=&group=&startDate=&endDate=&month=&year=` + `media/public/list?enablePage=1&sort=desc&sortBy=createdAt&size=5&page=0&typeId=1&title=&categoryId=&fileFormats=&tags=&group=&startDate=&endDate=&month=&year=&isInt=${isInt}` ); }