feat:merge
This commit is contained in:
commit
dbc5a396e5
|
|
@ -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<any[]>([]);
|
||||
const [totalData, setTotalData] = React.useState<number>(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;
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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) ? (
|
||||
<div className="flex flex-col gap-2 p-3">
|
||||
<Button
|
||||
onClick={() => publishToMabes()}
|
||||
|
|
@ -952,7 +952,7 @@ export default function FormImageDetail() {
|
|||
</DialogContent>
|
||||
</Dialog>
|
||||
</Card>
|
||||
{Number(detail?.needApprovalFromLevel) == Number(userLevelId) ? (
|
||||
{(Number(detail?.needApprovalFromLevel) == Number(userLevelId)) || (detail?.isInternationalMedia == true && detail?.isForwardFromNational == true && Number(detail?.statusId) == 1) ? (
|
||||
Number(detail?.uploadedById) == Number(userId) ? (
|
||||
""
|
||||
) : (
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ const regions = [
|
|||
},
|
||||
{
|
||||
name: "Polda Kalimantan Utara",
|
||||
slug: "kaltara",
|
||||
slug: "kalimantan-utara",
|
||||
logo: "/logo/polda/polda-kalimantan-utara.png",
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { getCalendarPagination } from "@/service/schedule/schedule";
|
||||
import { ChevronLeft, ChevronRight } from "lucide-react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
|
||||
interface CalendarItem {
|
||||
|
|
@ -7,7 +8,7 @@ interface CalendarItem {
|
|||
description: string;
|
||||
assignedTo: string;
|
||||
assignedToLevel: string;
|
||||
startDate: string;
|
||||
startDate: string;
|
||||
endDate: string;
|
||||
isActive: boolean;
|
||||
createdById: number;
|
||||
|
|
@ -18,7 +19,6 @@ interface CalendarItem {
|
|||
}
|
||||
|
||||
const EventCalender = () => {
|
||||
// Get current date
|
||||
const today = new Date();
|
||||
const currentMonth = today.getMonth();
|
||||
const currentYear = today.getFullYear();
|
||||
|
|
@ -26,11 +26,22 @@ const EventCalender = () => {
|
|||
|
||||
const [events, setEvents] = useState<CalendarItem[]>([]);
|
||||
const [selectedEvent, setSelectedEvent] = useState<CalendarItem | null>(null);
|
||||
const [month, setMonth] = useState(currentMonth);
|
||||
const [year, setYear] = useState(currentYear);
|
||||
|
||||
// Month names in Indonesian
|
||||
const monthNames = [
|
||||
"Januari", "Februari", "Maret", "April", "Mei", "Juni",
|
||||
"Juli", "Agustus", "September", "Oktober", "November", "Desember"
|
||||
"Januari",
|
||||
"Februari",
|
||||
"Maret",
|
||||
"April",
|
||||
"Mei",
|
||||
"Juni",
|
||||
"Juli",
|
||||
"Agustus",
|
||||
"September",
|
||||
"Oktober",
|
||||
"November",
|
||||
"Desember",
|
||||
];
|
||||
|
||||
const fetchData = async () => {
|
||||
|
|
@ -39,8 +50,6 @@ const EventCalender = () => {
|
|||
const data = res?.data?.data;
|
||||
const contentData = data?.content;
|
||||
setEvents(contentData || []);
|
||||
|
||||
// Set first event as selected by default
|
||||
if (contentData && contentData.length > 0) {
|
||||
setSelectedEvent(contentData[0]);
|
||||
}
|
||||
|
|
@ -48,49 +57,37 @@ const EventCalender = () => {
|
|||
console.error("Error fetching calendar events:", error);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
fetchData();
|
||||
}, []);
|
||||
|
||||
// Get first day of the month and number of days
|
||||
const firstDayOfMonth = new Date(currentYear, currentMonth, 1);
|
||||
const lastDayOfMonth = new Date(currentYear, currentMonth + 1, 0);
|
||||
const firstDayOfMonth = new Date(year, month, 1);
|
||||
const lastDayOfMonth = new Date(year, month + 1, 0);
|
||||
const daysInMonth = lastDayOfMonth.getDate();
|
||||
const startingDayOfWeek = firstDayOfMonth.getDay();
|
||||
|
||||
// Convert Sunday (0) to 7 for Monday-first week
|
||||
const adjustedStartingDay = startingDayOfWeek === 0 ? 6 : startingDayOfWeek - 1;
|
||||
|
||||
// Generate calendar days
|
||||
const generateCalendarDays = () => {
|
||||
const days = [];
|
||||
|
||||
// Empty cells for days before the first day of month
|
||||
for (let i = 0; i < adjustedStartingDay; i++) {
|
||||
days.push(null);
|
||||
}
|
||||
|
||||
// Days of the month
|
||||
for (let day = 1; day <= daysInMonth; day++) {
|
||||
days.push(day);
|
||||
}
|
||||
|
||||
// Fill remaining cells to complete the grid (6 rows × 7 days = 42 cells)
|
||||
while (days.length < 42) {
|
||||
days.push(null);
|
||||
}
|
||||
|
||||
return days;
|
||||
};
|
||||
|
||||
const calendarDays = generateCalendarDays();
|
||||
|
||||
// Helper function to extract day from date string
|
||||
const getDateFromString = (dateString: string) => {
|
||||
try {
|
||||
const date = new Date(dateString);
|
||||
if (date.getMonth() === currentMonth && date.getFullYear() === currentYear) {
|
||||
if (date.getMonth() === month && date.getFullYear() === year) {
|
||||
return date.getDate();
|
||||
}
|
||||
return null;
|
||||
|
|
@ -99,17 +96,16 @@ const EventCalender = () => {
|
|||
}
|
||||
};
|
||||
|
||||
// Helper function to format date range
|
||||
const formatDateRange = (startDate: string, endDate: string) => {
|
||||
try {
|
||||
const start = new Date(startDate);
|
||||
const end = new Date(endDate);
|
||||
|
||||
|
||||
const startDay = start.getDate();
|
||||
const endDay = end.getDate();
|
||||
const startMonth = monthNames[start.getMonth()];
|
||||
const endMonth = monthNames[end.getMonth()];
|
||||
|
||||
|
||||
if (startDay === endDay && startMonth === endMonth) {
|
||||
return `${startDay} ${startMonth}`;
|
||||
} else {
|
||||
|
|
@ -120,33 +116,49 @@ const EventCalender = () => {
|
|||
}
|
||||
};
|
||||
|
||||
// Helper function to format time range
|
||||
const formatTimeRange = (startDate: string, endDate: string) => {
|
||||
try {
|
||||
const start = new Date(startDate);
|
||||
const end = new Date(endDate);
|
||||
|
||||
const startTime = start.toLocaleTimeString('id-ID', {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
timeZone: 'Asia/Jakarta'
|
||||
|
||||
const startTime = start.toLocaleTimeString("id-ID", {
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
timeZone: "Asia/Jakarta",
|
||||
});
|
||||
const endTime = end.toLocaleTimeString('id-ID', {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
timeZone: 'Asia/Jakarta'
|
||||
const endTime = end.toLocaleTimeString("id-ID", {
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
timeZone: "Asia/Jakarta",
|
||||
});
|
||||
|
||||
|
||||
return `${startTime} - ${endTime} WIB`;
|
||||
} catch {
|
||||
return "Waktu tidak tersedia";
|
||||
}
|
||||
};
|
||||
|
||||
// Get event dates for highlighting calendar
|
||||
const eventDates = events
|
||||
.map(event => getDateFromString(event.startDate))
|
||||
.filter(date => date !== null);
|
||||
.map((event) => getDateFromString(event.startDate))
|
||||
.filter((date) => date !== null);
|
||||
|
||||
const handlePreviousMonth = () => {
|
||||
if (month === 0) {
|
||||
setMonth(11);
|
||||
setYear((y) => y - 1);
|
||||
} else {
|
||||
setMonth((m) => m - 1);
|
||||
}
|
||||
};
|
||||
|
||||
const handleNextMonth = () => {
|
||||
if (month === 11) {
|
||||
setMonth(0);
|
||||
setYear((y) => y + 1);
|
||||
} else {
|
||||
setMonth((m) => m + 1);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="mt-8 rounded-lg bg-white dark:bg-zinc-900 p-4 shadow">
|
||||
|
|
@ -154,12 +166,18 @@ const EventCalender = () => {
|
|||
KALENDER ACARA
|
||||
</h2>
|
||||
<div className="flex flex-col lg:flex-row gap-6">
|
||||
{/* Left Side - Calendar and Event List */}
|
||||
<div className="w-full lg:w-1/2">
|
||||
{/* Mini Calendar */}
|
||||
<div className="bg-gray-100 dark:bg-zinc-800 p-4 rounded-md mb-4">
|
||||
<div className="text-center font-semibold mb-2">
|
||||
{monthNames[currentMonth]} {currentYear}
|
||||
<div className="flex items-center justify-between mb-2">
|
||||
<button onClick={handlePreviousMonth}>
|
||||
<ChevronLeft className="w-4 h-4" />
|
||||
</button>
|
||||
<div className="text-center font-semibold">
|
||||
{monthNames[month]} {year}
|
||||
</div>
|
||||
<button onClick={handleNextMonth}>
|
||||
<ChevronRight className="w-4 h-4" />
|
||||
</button>
|
||||
</div>
|
||||
<div className="grid grid-cols-7 gap-1 text-sm text-center">
|
||||
{["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"].map((d) => (
|
||||
|
|
@ -167,26 +185,32 @@ const EventCalender = () => {
|
|||
{d}
|
||||
</div>
|
||||
))}
|
||||
{calendarDays?.map((day, index) => (
|
||||
<div
|
||||
key={index}
|
||||
className={`p-1 rounded min-h-[24px] flex items-center justify-center text-xs ${
|
||||
day === null
|
||||
? ""
|
||||
: eventDates.includes(day)
|
||||
? "bg-red-600 text-white font-semibold"
|
||||
: day === currentDate
|
||||
? "bg-blue-500 text-white font-semibold"
|
||||
: "hover:bg-gray-200 dark:hover:bg-zinc-700"
|
||||
}`}
|
||||
>
|
||||
{day}
|
||||
</div>
|
||||
))}
|
||||
{calendarDays.map((day, index) => {
|
||||
const isToday =
|
||||
day === currentDate &&
|
||||
month === currentMonth &&
|
||||
year === currentYear;
|
||||
|
||||
return (
|
||||
<div
|
||||
key={index}
|
||||
className={`p-1 rounded min-h-[24px] flex items-center justify-center text-xs ${
|
||||
day === null
|
||||
? ""
|
||||
: eventDates.includes(day)
|
||||
? "bg-red-600 text-white font-semibold"
|
||||
: isToday
|
||||
? "bg-blue-500 text-white font-semibold"
|
||||
: "hover:bg-gray-200 dark:hover:bg-zinc-700"
|
||||
}`}
|
||||
>
|
||||
{day}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Event List */}
|
||||
<div className="space-y-3 max-h-[230px] overflow-y-auto pr-5" data-lenis-prevent>
|
||||
<h3 className="text-lg font-semibold text-gray-800 dark:text-gray-200 mb-3">
|
||||
Daftar Acara
|
||||
|
|
@ -224,7 +248,11 @@ const EventCalender = () => {
|
|||
</div>
|
||||
</div>
|
||||
<div className="ml-2 flex-shrink-0">
|
||||
<div className={`w-2 h-2 rounded-full ${event.isActive ? 'bg-green-500' : 'bg-red-500'}`}></div>
|
||||
<div
|
||||
className={`w-2 h-2 rounded-full ${
|
||||
event.isActive ? "bg-green-500" : "bg-red-500"
|
||||
}`}
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
))
|
||||
|
|
@ -232,13 +260,12 @@ const EventCalender = () => {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{/* Right Side - Event Detail */}
|
||||
<div className="w-full lg:w-1/2">
|
||||
<div className="bg-gray-100 dark:bg-zinc-800 rounded-lg p-4 sticky top-4">
|
||||
<h3 className="text-lg font-semibold text-gray-800 dark:text-gray-200 mb-4">
|
||||
Detail Acara
|
||||
</h3>
|
||||
|
||||
|
||||
{selectedEvent ? (
|
||||
<div className="space-y-4">
|
||||
<img
|
||||
|
|
@ -250,16 +277,23 @@ const EventCalender = () => {
|
|||
target.src = "/images/default-event.png";
|
||||
}}
|
||||
/>
|
||||
|
||||
|
||||
<div>
|
||||
<h4 className="text-lg font-bold text-gray-800 dark:text-gray-200 mb-2">
|
||||
{selectedEvent.title}
|
||||
</h4>
|
||||
|
||||
|
||||
<div className="grid grid-cols-1 gap-3 mb-4">
|
||||
<div className="flex items-start text-sm text-gray-600 dark:text-gray-400">
|
||||
<span className="w-20 font-semibold flex-shrink-0">Tanggal:</span>
|
||||
<span>{formatDateRange(selectedEvent.startDate, selectedEvent.endDate)}</span>
|
||||
<span className="w-20 font-semibold flex-shrink-0">
|
||||
Tanggal:
|
||||
</span>
|
||||
<span>
|
||||
{formatDateRange(
|
||||
selectedEvent.startDate,
|
||||
selectedEvent.endDate
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="mb-4">
|
||||
<p className="text-sm text-gray-600 dark:text-gray-400 leading-relaxed">
|
||||
|
|
@ -267,7 +301,7 @@ const EventCalender = () => {
|
|||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="flex gap-2">
|
||||
<button className="px-4 py-2 bg-gray-300 dark:bg-zinc-700 text-gray-700 dark:text-gray-300 text-sm font-medium rounded-lg hover:bg-gray-400 dark:hover:bg-zinc-600 transition-colors">
|
||||
Bagikan
|
||||
|
|
@ -277,7 +311,7 @@ const EventCalender = () => {
|
|||
</div>
|
||||
) : (
|
||||
<div className="text-center text-gray-500 dark:text-gray-400 py-8">
|
||||
Pilih acara untuk melihat detail
|
||||
Pilih acara untuk melihat detail
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
|
@ -287,4 +321,4 @@ const EventCalender = () => {
|
|||
);
|
||||
};
|
||||
|
||||
export default EventCalender;
|
||||
export default EventCalender;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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<any>([]);
|
||||
const [currentNewsIndex, setCurrentNewsIndex] = useState<any>(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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ const ScrollableContent = () => {
|
|||
const locale = params?.locale;
|
||||
const t = useTranslations("LandingPage");
|
||||
const [content, setContent] = useState<any>();
|
||||
|
||||
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 (
|
||||
<>
|
||||
<div className="">
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ const SearchSectionPolda = () => {
|
|||
<NewContent group="polda" type="latest" />
|
||||
<NewContent group="polda" type="popular" />
|
||||
<ContentCategory group="polda" type="popular" />
|
||||
<AreaCoverageWorkUnits />
|
||||
{/* <AreaCoverageWorkUnits /> */}
|
||||
<EventCalender />
|
||||
<UserSurveyBox />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ const SearchSectionSatker = () => {
|
|||
<NewContent group="satker" type="latest" />
|
||||
<NewContent group="satker" type="popular" />
|
||||
<ContentCategory group="satker" type="popular" />
|
||||
<AreaCoverageWorkUnits />
|
||||
{/* <AreaCoverageWorkUnits /> */}
|
||||
<EventCalender />
|
||||
<UserSurveyBox />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ export function getMenuList(pathname: string, t: any): Group[] {
|
|||
|
||||
let menusSelected = <any>[];
|
||||
|
||||
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) {
|
||||
|
|
|
|||
|
|
@ -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}`
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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}`
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue