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 { paginationBlog } from "@/service/blog/blog";
|
||||||
import { ticketingPagination } from "@/service/ticketing/ticketing";
|
import { ticketingPagination } from "@/service/ticketing/ticketing";
|
||||||
import { Badge } from "@/components/ui/badge";
|
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 TablePagination from "@/components/table/table-pagination";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|
@ -73,6 +73,9 @@ import useTableColumns from "./columns";
|
||||||
const TableImage = () => {
|
const TableImage = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
|
|
||||||
|
const params = useParams();
|
||||||
|
const locale = params?.locale;
|
||||||
const MySwal = withReactContent(Swal);
|
const MySwal = withReactContent(Swal);
|
||||||
const [dataTable, setDataTable] = React.useState<any[]>([]);
|
const [dataTable, setDataTable] = React.useState<any[]>([]);
|
||||||
const [totalData, setTotalData] = React.useState<number>(1);
|
const [totalData, setTotalData] = React.useState<number>(1);
|
||||||
|
|
@ -199,7 +202,8 @@ const TableImage = () => {
|
||||||
formattedStartDate, // Pastikan format sesuai
|
formattedStartDate, // Pastikan format sesuai
|
||||||
formattedEndDate, // Pastikan format sesuai
|
formattedEndDate, // Pastikan format sesuai
|
||||||
search,
|
search,
|
||||||
filterByCreatorGroup
|
filterByCreatorGroup,
|
||||||
|
locale == "en"
|
||||||
);
|
);
|
||||||
|
|
||||||
const data = res?.data?.data;
|
const data = res?.data?.data;
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
import { Reveal } from "@/components/landing-page/Reveal";
|
import { Reveal } from "@/components/landing-page/Reveal";
|
||||||
import { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
import { getHeroData, listData } from "@/service/landing/landing";
|
import { listData } from "@/service/landing/landing";
|
||||||
import { formatDateToIndonesian } from "@/utils/globals";
|
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { useParams } from "next/navigation";
|
import { useParams } from "next/navigation";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"use client";
|
"use client";
|
||||||
import { Link } from "@/i18n/routing";
|
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 { formatDateToIndonesian, textEllipsis } from "@/utils/globals";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ const PopularNews = () => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
const response = await getHeroData();
|
const response = await getHeroData(locale == "en");
|
||||||
console.log(response);
|
console.log(response);
|
||||||
setHeroData(response?.data?.data?.content);
|
setHeroData(response?.data?.data?.content);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
import { Reveal } from "@/components/landing-page/Reveal";
|
import { Reveal } from "@/components/landing-page/Reveal";
|
||||||
import { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
import { getHeroData, listData } from "@/service/landing/landing";
|
import { listData } from "@/service/landing/landing";
|
||||||
import { formatDateToIndonesian } from "@/utils/globals";
|
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { useParams } from "next/navigation";
|
import { useParams } from "next/navigation";
|
||||||
import React, { useEffect, useState } from "react";
|
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">
|
<div className="flex flex-col gap-2 p-3">
|
||||||
<Button
|
<Button
|
||||||
onClick={() => publishToMabes()}
|
onClick={() => publishToMabes()}
|
||||||
|
|
@ -952,7 +952,7 @@ export default function FormImageDetail() {
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</Card>
|
</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) ? (
|
Number(detail?.uploadedById) == Number(userId) ? (
|
||||||
""
|
""
|
||||||
) : (
|
) : (
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ const regions = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Polda Kalimantan Utara",
|
name: "Polda Kalimantan Utara",
|
||||||
slug: "kaltara",
|
slug: "kalimantan-utara",
|
||||||
logo: "/logo/polda/polda-kalimantan-utara.png",
|
logo: "/logo/polda/polda-kalimantan-utara.png",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { getCalendarPagination } from "@/service/schedule/schedule";
|
import { getCalendarPagination } from "@/service/schedule/schedule";
|
||||||
|
import { ChevronLeft, ChevronRight } from "lucide-react";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
|
|
||||||
interface CalendarItem {
|
interface CalendarItem {
|
||||||
|
|
@ -18,7 +19,6 @@ interface CalendarItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
const EventCalender = () => {
|
const EventCalender = () => {
|
||||||
// Get current date
|
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
const currentMonth = today.getMonth();
|
const currentMonth = today.getMonth();
|
||||||
const currentYear = today.getFullYear();
|
const currentYear = today.getFullYear();
|
||||||
|
|
@ -26,11 +26,22 @@ const EventCalender = () => {
|
||||||
|
|
||||||
const [events, setEvents] = useState<CalendarItem[]>([]);
|
const [events, setEvents] = useState<CalendarItem[]>([]);
|
||||||
const [selectedEvent, setSelectedEvent] = useState<CalendarItem | null>(null);
|
const [selectedEvent, setSelectedEvent] = useState<CalendarItem | null>(null);
|
||||||
|
const [month, setMonth] = useState(currentMonth);
|
||||||
|
const [year, setYear] = useState(currentYear);
|
||||||
|
|
||||||
// Month names in Indonesian
|
|
||||||
const monthNames = [
|
const monthNames = [
|
||||||
"Januari", "Februari", "Maret", "April", "Mei", "Juni",
|
"Januari",
|
||||||
"Juli", "Agustus", "September", "Oktober", "November", "Desember"
|
"Februari",
|
||||||
|
"Maret",
|
||||||
|
"April",
|
||||||
|
"Mei",
|
||||||
|
"Juni",
|
||||||
|
"Juli",
|
||||||
|
"Agustus",
|
||||||
|
"September",
|
||||||
|
"Oktober",
|
||||||
|
"November",
|
||||||
|
"Desember",
|
||||||
];
|
];
|
||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
|
|
@ -39,8 +50,6 @@ const EventCalender = () => {
|
||||||
const data = res?.data?.data;
|
const data = res?.data?.data;
|
||||||
const contentData = data?.content;
|
const contentData = data?.content;
|
||||||
setEvents(contentData || []);
|
setEvents(contentData || []);
|
||||||
|
|
||||||
// Set first event as selected by default
|
|
||||||
if (contentData && contentData.length > 0) {
|
if (contentData && contentData.length > 0) {
|
||||||
setSelectedEvent(contentData[0]);
|
setSelectedEvent(contentData[0]);
|
||||||
}
|
}
|
||||||
|
|
@ -53,44 +62,32 @@ const EventCalender = () => {
|
||||||
fetchData();
|
fetchData();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// Get first day of the month and number of days
|
const firstDayOfMonth = new Date(year, month, 1);
|
||||||
const firstDayOfMonth = new Date(currentYear, currentMonth, 1);
|
const lastDayOfMonth = new Date(year, month + 1, 0);
|
||||||
const lastDayOfMonth = new Date(currentYear, currentMonth + 1, 0);
|
|
||||||
const daysInMonth = lastDayOfMonth.getDate();
|
const daysInMonth = lastDayOfMonth.getDate();
|
||||||
const startingDayOfWeek = firstDayOfMonth.getDay();
|
const startingDayOfWeek = firstDayOfMonth.getDay();
|
||||||
|
|
||||||
// Convert Sunday (0) to 7 for Monday-first week
|
|
||||||
const adjustedStartingDay = startingDayOfWeek === 0 ? 6 : startingDayOfWeek - 1;
|
const adjustedStartingDay = startingDayOfWeek === 0 ? 6 : startingDayOfWeek - 1;
|
||||||
|
|
||||||
// Generate calendar days
|
|
||||||
const generateCalendarDays = () => {
|
const generateCalendarDays = () => {
|
||||||
const days = [];
|
const days = [];
|
||||||
|
|
||||||
// Empty cells for days before the first day of month
|
|
||||||
for (let i = 0; i < adjustedStartingDay; i++) {
|
for (let i = 0; i < adjustedStartingDay; i++) {
|
||||||
days.push(null);
|
days.push(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Days of the month
|
|
||||||
for (let day = 1; day <= daysInMonth; day++) {
|
for (let day = 1; day <= daysInMonth; day++) {
|
||||||
days.push(day);
|
days.push(day);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill remaining cells to complete the grid (6 rows × 7 days = 42 cells)
|
|
||||||
while (days.length < 42) {
|
while (days.length < 42) {
|
||||||
days.push(null);
|
days.push(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return days;
|
return days;
|
||||||
};
|
};
|
||||||
|
|
||||||
const calendarDays = generateCalendarDays();
|
const calendarDays = generateCalendarDays();
|
||||||
|
|
||||||
// Helper function to extract day from date string
|
|
||||||
const getDateFromString = (dateString: string) => {
|
const getDateFromString = (dateString: string) => {
|
||||||
try {
|
try {
|
||||||
const date = new Date(dateString);
|
const date = new Date(dateString);
|
||||||
if (date.getMonth() === currentMonth && date.getFullYear() === currentYear) {
|
if (date.getMonth() === month && date.getFullYear() === year) {
|
||||||
return date.getDate();
|
return date.getDate();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -99,7 +96,6 @@ const EventCalender = () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Helper function to format date range
|
|
||||||
const formatDateRange = (startDate: string, endDate: string) => {
|
const formatDateRange = (startDate: string, endDate: string) => {
|
||||||
try {
|
try {
|
||||||
const start = new Date(startDate);
|
const start = new Date(startDate);
|
||||||
|
|
@ -120,21 +116,20 @@ const EventCalender = () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Helper function to format time range
|
|
||||||
const formatTimeRange = (startDate: string, endDate: string) => {
|
const formatTimeRange = (startDate: string, endDate: string) => {
|
||||||
try {
|
try {
|
||||||
const start = new Date(startDate);
|
const start = new Date(startDate);
|
||||||
const end = new Date(endDate);
|
const end = new Date(endDate);
|
||||||
|
|
||||||
const startTime = start.toLocaleTimeString('id-ID', {
|
const startTime = start.toLocaleTimeString("id-ID", {
|
||||||
hour: '2-digit',
|
hour: "2-digit",
|
||||||
minute: '2-digit',
|
minute: "2-digit",
|
||||||
timeZone: 'Asia/Jakarta'
|
timeZone: "Asia/Jakarta",
|
||||||
});
|
});
|
||||||
const endTime = end.toLocaleTimeString('id-ID', {
|
const endTime = end.toLocaleTimeString("id-ID", {
|
||||||
hour: '2-digit',
|
hour: "2-digit",
|
||||||
minute: '2-digit',
|
minute: "2-digit",
|
||||||
timeZone: 'Asia/Jakarta'
|
timeZone: "Asia/Jakarta",
|
||||||
});
|
});
|
||||||
|
|
||||||
return `${startTime} - ${endTime} WIB`;
|
return `${startTime} - ${endTime} WIB`;
|
||||||
|
|
@ -143,10 +138,27 @@ const EventCalender = () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get event dates for highlighting calendar
|
|
||||||
const eventDates = events
|
const eventDates = events
|
||||||
.map(event => getDateFromString(event.startDate))
|
.map((event) => getDateFromString(event.startDate))
|
||||||
.filter(date => date !== null);
|
.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 (
|
return (
|
||||||
<div className="mt-8 rounded-lg bg-white dark:bg-zinc-900 p-4 shadow">
|
<div className="mt-8 rounded-lg bg-white dark:bg-zinc-900 p-4 shadow">
|
||||||
|
|
@ -154,12 +166,18 @@ const EventCalender = () => {
|
||||||
KALENDER ACARA
|
KALENDER ACARA
|
||||||
</h2>
|
</h2>
|
||||||
<div className="flex flex-col lg:flex-row gap-6">
|
<div className="flex flex-col lg:flex-row gap-6">
|
||||||
{/* Left Side - Calendar and Event List */}
|
|
||||||
<div className="w-full lg:w-1/2">
|
<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="bg-gray-100 dark:bg-zinc-800 p-4 rounded-md mb-4">
|
||||||
<div className="text-center font-semibold mb-2">
|
<div className="flex items-center justify-between mb-2">
|
||||||
{monthNames[currentMonth]} {currentYear}
|
<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>
|
||||||
<div className="grid grid-cols-7 gap-1 text-sm text-center">
|
<div className="grid grid-cols-7 gap-1 text-sm text-center">
|
||||||
{["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"].map((d) => (
|
{["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"].map((d) => (
|
||||||
|
|
@ -167,26 +185,32 @@ const EventCalender = () => {
|
||||||
{d}
|
{d}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
{calendarDays?.map((day, index) => (
|
{calendarDays.map((day, index) => {
|
||||||
<div
|
const isToday =
|
||||||
key={index}
|
day === currentDate &&
|
||||||
className={`p-1 rounded min-h-[24px] flex items-center justify-center text-xs ${
|
month === currentMonth &&
|
||||||
day === null
|
year === currentYear;
|
||||||
? ""
|
|
||||||
: eventDates.includes(day)
|
return (
|
||||||
? "bg-red-600 text-white font-semibold"
|
<div
|
||||||
: day === currentDate
|
key={index}
|
||||||
? "bg-blue-500 text-white font-semibold"
|
className={`p-1 rounded min-h-[24px] flex items-center justify-center text-xs ${
|
||||||
: "hover:bg-gray-200 dark:hover:bg-zinc-700"
|
day === null
|
||||||
}`}
|
? ""
|
||||||
>
|
: eventDates.includes(day)
|
||||||
{day}
|
? "bg-red-600 text-white font-semibold"
|
||||||
</div>
|
: isToday
|
||||||
))}
|
? "bg-blue-500 text-white font-semibold"
|
||||||
|
: "hover:bg-gray-200 dark:hover:bg-zinc-700"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{day}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Event List */}
|
|
||||||
<div className="space-y-3 max-h-[230px] overflow-y-auto pr-5" data-lenis-prevent>
|
<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">
|
<h3 className="text-lg font-semibold text-gray-800 dark:text-gray-200 mb-3">
|
||||||
Daftar Acara
|
Daftar Acara
|
||||||
|
|
@ -224,7 +248,11 @@ const EventCalender = () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="ml-2 flex-shrink-0">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
))
|
))
|
||||||
|
|
@ -232,7 +260,6 @@ const EventCalender = () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Right Side - Event Detail */}
|
|
||||||
<div className="w-full lg:w-1/2">
|
<div className="w-full lg:w-1/2">
|
||||||
<div className="bg-gray-100 dark:bg-zinc-800 rounded-lg p-4 sticky top-4">
|
<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">
|
<h3 className="text-lg font-semibold text-gray-800 dark:text-gray-200 mb-4">
|
||||||
|
|
@ -258,8 +285,15 @@ const EventCalender = () => {
|
||||||
|
|
||||||
<div className="grid grid-cols-1 gap-3 mb-4">
|
<div className="grid grid-cols-1 gap-3 mb-4">
|
||||||
<div className="flex items-start text-sm text-gray-600 dark:text-gray-400">
|
<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 className="w-20 font-semibold flex-shrink-0">
|
||||||
<span>{formatDateRange(selectedEvent.startDate, selectedEvent.endDate)}</span>
|
Tanggal:
|
||||||
|
</span>
|
||||||
|
<span>
|
||||||
|
{formatDateRange(
|
||||||
|
selectedEvent.startDate,
|
||||||
|
selectedEvent.endDate
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-4">
|
<div className="mb-4">
|
||||||
<p className="text-sm text-gray-600 dark:text-gray-400 leading-relaxed">
|
<p className="text-sm text-gray-600 dark:text-gray-400 leading-relaxed">
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import Image from "next/image";
|
||||||
const HeaderBannerSatker = () => {
|
const HeaderBannerSatker = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
|
const locale = params?.locale;
|
||||||
const satkerName: any = params?.satker_name;
|
const satkerName: any = params?.satker_name;
|
||||||
const asPath: any = usePathname();
|
const asPath: any = usePathname();
|
||||||
const [content, setContent] = useState([]);
|
const [content, setContent] = useState([]);
|
||||||
|
|
@ -50,7 +51,7 @@ const HeaderBannerSatker = () => {
|
||||||
);
|
);
|
||||||
var data = res?.data?.data?.content;
|
var data = res?.data?.data?.content;
|
||||||
if (data) {
|
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++) {
|
for (let i = 0; i < resStatic?.data?.data?.length; i++) {
|
||||||
const media = resStatic?.data.data[i]?.mediaUpload;
|
const media = resStatic?.data.data[i]?.mediaUpload;
|
||||||
media.fileTypeId = media.fileType?.id;
|
media.fileTypeId = media.fileType?.id;
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import { useRouter } from "@/i18n/routing";
|
||||||
const HeaderBanner = () => {
|
const HeaderBanner = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
|
const locale = params?.locale;
|
||||||
const poldaName: any = params?.polda_name;
|
const poldaName: any = params?.polda_name;
|
||||||
const [content, setContent] = useState([]);
|
const [content, setContent] = useState([]);
|
||||||
const [isBannerLoading, setIsBannerLoading] = useState(true);
|
const [isBannerLoading, setIsBannerLoading] = useState(true);
|
||||||
|
|
@ -31,7 +32,7 @@ const HeaderBanner = () => {
|
||||||
const res = await listData("1", "", "", 5, 0, "createdAt", "", "", poldaName);
|
const res = await listData("1", "", "", 5, 0, "createdAt", "", "", poldaName);
|
||||||
var data = res?.data?.data?.content;
|
var data = res?.data?.data?.content;
|
||||||
if (data) {
|
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++) {
|
for (let i = 0; i < resStatic?.data?.data?.length; i++) {
|
||||||
const media = resStatic?.data.data[i]?.mediaUpload;
|
const media = resStatic?.data.data[i]?.mediaUpload;
|
||||||
media.fileTypeId = media.fileType?.id;
|
media.fileTypeId = media.fileType?.id;
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ const HeroModal = ({ onClose, group, poldaName, satkerName }: HeroModalProps) =>
|
||||||
|
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
if (group === "polda" && poldaName && String(poldaName).length > 1) {
|
if (group === "polda" && poldaName && String(poldaName).length > 1) {
|
||||||
const response = await listStaticBanner(poldaName);
|
const response = await listStaticBanner(poldaName, locale == "en");
|
||||||
|
|
||||||
const banners =
|
const banners =
|
||||||
response?.data?.data?.map((item: any) => {
|
response?.data?.data?.map((item: any) => {
|
||||||
|
|
@ -245,13 +245,13 @@ const HeroNewPolda = (props: { group?: string }) => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
const response = await getHeroData();
|
const response = await getHeroData(locale == "en");
|
||||||
console.log(response);
|
console.log(response);
|
||||||
let data = response?.data?.data?.content;
|
let data = response?.data?.data?.content;
|
||||||
setHeroData(data);
|
setHeroData(data);
|
||||||
|
|
||||||
if (data && props.group === "polda" && poldaName && String(poldaName)?.length > 1) {
|
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++) {
|
for (let i = 0; i < resStatic?.data?.data?.length; i++) {
|
||||||
const media = resStatic?.data.data[i]?.mediaUpload;
|
const media = resStatic?.data.data[i]?.mediaUpload;
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ const HeroModal = ({ onClose, group, poldaName, satkerName }: HeroModalProps) =>
|
||||||
|
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
if (group === "satker" && satkerName && String(satkerName).length > 1) {
|
if (group === "satker" && satkerName && String(satkerName).length > 1) {
|
||||||
const response = await listStaticBanner(satkerName);
|
const response = await listStaticBanner(satkerName, locale == "en");
|
||||||
|
|
||||||
const banners =
|
const banners =
|
||||||
response?.data?.data?.map((item: any) => {
|
response?.data?.data?.map((item: any) => {
|
||||||
|
|
@ -245,13 +245,13 @@ const HeroNewSatker = (props: { group?: string }) => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
const response = await getHeroData();
|
const response = await getHeroData(locale == "en");
|
||||||
console.log(response);
|
console.log(response);
|
||||||
let data = response?.data?.data?.content;
|
let data = response?.data?.data?.content;
|
||||||
setHeroData(data);
|
setHeroData(data);
|
||||||
|
|
||||||
if (data && props.group === "satker" && satkerName && String(satkerName)?.length > 1) {
|
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++) {
|
for (let i = 0; i < resStatic?.data?.data?.length; i++) {
|
||||||
const media = resStatic?.data.data[i]?.mediaUpload;
|
const media = resStatic?.data.data[i]?.mediaUpload;
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,8 @@ const HeroModal = ({
|
||||||
? poldaName
|
? poldaName
|
||||||
: group === "satker" && satkerName && String(satkerName)?.length > 1
|
: group === "satker" && satkerName && String(satkerName)?.length > 1
|
||||||
? "satker-" + satkerName
|
? "satker-" + satkerName
|
||||||
: ""
|
: "",
|
||||||
|
locale == "en"
|
||||||
);
|
);
|
||||||
|
|
||||||
const banners =
|
const banners =
|
||||||
|
|
@ -295,7 +296,7 @@ const HeroNew = (props: { group?: string }) => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
const response = await getHeroData();
|
const response = await getHeroData(locale == "en");
|
||||||
console.log(response);
|
console.log(response);
|
||||||
let data = response?.data?.data?.content;
|
let data = response?.data?.data?.content;
|
||||||
setHeroData(response?.data?.data?.content);
|
setHeroData(response?.data?.data?.content);
|
||||||
|
|
@ -309,7 +310,8 @@ const HeroNew = (props: { group?: string }) => {
|
||||||
satkerName &&
|
satkerName &&
|
||||||
String(satkerName)?.length > 1
|
String(satkerName)?.length > 1
|
||||||
? "satker-" + satkerName
|
? "satker-" + satkerName
|
||||||
: ""
|
: "",
|
||||||
|
locale == "en"
|
||||||
);
|
);
|
||||||
for (let i = 0; i < resStatic?.data?.data?.length; i++) {
|
for (let i = 0; i < resStatic?.data?.data?.length; i++) {
|
||||||
const media = resStatic?.data.data[i]?.mediaUpload;
|
const media = resStatic?.data.data[i]?.mediaUpload;
|
||||||
|
|
|
||||||
|
|
@ -79,11 +79,11 @@ const HeroModal = ({ onClose }: { onClose: () => void }) => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
const response = await getHeroData();
|
const response = await getHeroData(locale == "en");
|
||||||
console.log(response);
|
console.log(response);
|
||||||
let data = response?.data?.data?.content;
|
let data = response?.data?.data?.content;
|
||||||
if (data) {
|
if (data) {
|
||||||
const resStatic = await listStaticBanner();
|
const resStatic = await listStaticBanner("", locale == "en");
|
||||||
for (let i = 0; i < resStatic?.data?.data?.length; i++) {
|
for (let i = 0; i < resStatic?.data?.data?.length; i++) {
|
||||||
const media = resStatic?.data.data[i]?.mediaUpload;
|
const media = resStatic?.data.data[i]?.mediaUpload;
|
||||||
media.fileTypeId = media.fileType?.id;
|
media.fileTypeId = media.fileType?.id;
|
||||||
|
|
@ -287,7 +287,7 @@ const Hero = (props: { group?: string }) => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
const response = await getHeroData();
|
const response = await getHeroData(locale == "en");
|
||||||
console.log(response);
|
console.log(response);
|
||||||
let data = response?.data?.data?.content;
|
let data = response?.data?.data?.content;
|
||||||
setHeroData(response?.data?.data?.content);
|
setHeroData(response?.data?.data?.content);
|
||||||
|
|
@ -301,7 +301,8 @@ const Hero = (props: { group?: string }) => {
|
||||||
satkerName &&
|
satkerName &&
|
||||||
String(satkerName)?.length > 1
|
String(satkerName)?.length > 1
|
||||||
? "satker-" + satkerName
|
? "satker-" + satkerName
|
||||||
: ""
|
: "",
|
||||||
|
locale == "en"
|
||||||
);
|
);
|
||||||
for (let i = 0; i < resStatic?.data?.data?.length; i++) {
|
for (let i = 0; i < resStatic?.data?.data?.length; i++) {
|
||||||
const media = resStatic?.data.data[i]?.mediaUpload;
|
const media = resStatic?.data.data[i]?.mediaUpload;
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,19 @@ import { formatDateToIndonesian, textEllipsis } from "@/utils/globals";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Icon } from "../ui/icon";
|
import { Icon } from "../ui/icon";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
import { useParams } from "next/navigation";
|
||||||
|
|
||||||
export default function NewsTicker() {
|
export default function NewsTicker() {
|
||||||
const [article, setArticle] = useState<any>([]);
|
const [article, setArticle] = useState<any>([]);
|
||||||
const [currentNewsIndex, setCurrentNewsIndex] = useState<any>(0);
|
const [currentNewsIndex, setCurrentNewsIndex] = useState<any>(0);
|
||||||
const [animate, setAnimate] = useState(false);
|
const [animate, setAnimate] = useState(false);
|
||||||
|
const params = useParams();
|
||||||
|
const locale = params?.locale;
|
||||||
const t = useTranslations("LandingPage");
|
const t = useTranslations("LandingPage");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function getArticle() {
|
async function getArticle() {
|
||||||
const response = await getHeroData();
|
const response = await getHeroData(locale == "en");
|
||||||
setArticle(response?.data?.data?.content);
|
setArticle(response?.data?.data?.content);
|
||||||
}
|
}
|
||||||
getArticle();
|
getArticle();
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ const ScrollableContentPolda = () => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
const response = await getHeroData();
|
const response = await getHeroData(locale == "en");
|
||||||
console.log(response);
|
console.log(response);
|
||||||
let data = response?.data?.data?.content;
|
let data = response?.data?.data?.content;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ const ScrollableContentSatker = () => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
const response = await getHeroData();
|
const response = await getHeroData(locale == "en");
|
||||||
console.log(response);
|
console.log(response);
|
||||||
let data = response?.data?.data?.content;
|
let data = response?.data?.data?.content;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ const ScrollableContent = () => {
|
||||||
const locale = params?.locale;
|
const locale = params?.locale;
|
||||||
const t = useTranslations("LandingPage");
|
const t = useTranslations("LandingPage");
|
||||||
const [content, setContent] = useState<any>();
|
const [content, setContent] = useState<any>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function fetchCategories() {
|
async function fetchCategories() {
|
||||||
const url = "https://netidhub.com/api/csrf";
|
const url = "https://netidhub.com/api/csrf";
|
||||||
|
|
@ -45,12 +46,13 @@ const ScrollableContent = () => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
const response = await getHeroData();
|
const response = await getHeroData(locale == "en");
|
||||||
console.log(response);
|
console.log(response);
|
||||||
let data = response?.data?.data?.content;
|
let data = response?.data?.data?.content;
|
||||||
|
|
||||||
setContent(data);
|
setContent(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="">
|
<div className="">
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ const SearchSectionPolda = () => {
|
||||||
<NewContent group="polda" type="latest" />
|
<NewContent group="polda" type="latest" />
|
||||||
<NewContent group="polda" type="popular" />
|
<NewContent group="polda" type="popular" />
|
||||||
<ContentCategory group="polda" type="popular" />
|
<ContentCategory group="polda" type="popular" />
|
||||||
<AreaCoverageWorkUnits />
|
{/* <AreaCoverageWorkUnits /> */}
|
||||||
<EventCalender />
|
<EventCalender />
|
||||||
<UserSurveyBox />
|
<UserSurveyBox />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ const SearchSectionSatker = () => {
|
||||||
<NewContent group="satker" type="latest" />
|
<NewContent group="satker" type="latest" />
|
||||||
<NewContent group="satker" type="popular" />
|
<NewContent group="satker" type="popular" />
|
||||||
<ContentCategory group="satker" type="popular" />
|
<ContentCategory group="satker" type="popular" />
|
||||||
<AreaCoverageWorkUnits />
|
{/* <AreaCoverageWorkUnits /> */}
|
||||||
<EventCalender />
|
<EventCalender />
|
||||||
<UserSurveyBox />
|
<UserSurveyBox />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,6 @@ const LoginForm = () => {
|
||||||
console.log("PROFILE : ", profile?.data?.data);
|
console.log("PROFILE : ", profile?.data?.data);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
profile?.data?.data?.isInternational == true ||
|
|
||||||
profile?.data?.data?.isActive == false ||
|
profile?.data?.data?.isActive == false ||
|
||||||
profile?.data?.data?.isDelete == true
|
profile?.data?.data?.isDelete == true
|
||||||
) {
|
) {
|
||||||
|
|
@ -225,6 +224,8 @@ const LoginForm = () => {
|
||||||
Number(profile?.data?.data?.roleId) == 10 ||
|
Number(profile?.data?.data?.roleId) == 10 ||
|
||||||
Number(profile?.data?.data?.roleId) == 11 ||
|
Number(profile?.data?.data?.roleId) == 11 ||
|
||||||
Number(profile?.data?.data?.roleId) == 12 ||
|
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) == 18 ||
|
||||||
Number(profile?.data?.data?.roleId) == 19
|
Number(profile?.data?.data?.roleId) == 19
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ export function getMenuList(pathname: string, t: any): Group[] {
|
||||||
|
|
||||||
let menusSelected = <any>[];
|
let menusSelected = <any>[];
|
||||||
|
|
||||||
if (Number(roleId) == 3 && Number(levelNumber) == 1) {
|
if ((Number(roleId) == 3 || Number(roleId) == 14) && Number(levelNumber) == 1) {
|
||||||
menusSelected = [
|
menusSelected = [
|
||||||
{
|
{
|
||||||
groupLabel: t("apps"),
|
groupLabel: t("apps"),
|
||||||
|
|
@ -1700,7 +1700,7 @@ export function getMenuList(pathname: string, t: any): Group[] {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
} else if (
|
} else if (
|
||||||
(Number(roleId) == 3 || Number(roleId) == 4) &&
|
(Number(roleId) == 3 || Number(roleId) == 4 || Number(roleId) == 14 || Number(roleId) == 15) &&
|
||||||
Number(levelNumber) == 2
|
Number(levelNumber) == 2
|
||||||
) {
|
) {
|
||||||
if (Number(userLevelId) != 761) {
|
if (Number(userLevelId) != 761) {
|
||||||
|
|
@ -2158,7 +2158,7 @@ export function getMenuList(pathname: string, t: any): Group[] {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
(Number(roleId) == 3 || Number(roleId) == 4) &&
|
(Number(roleId) == 3 || Number(roleId) == 4 || Number(roleId) == 14 || Number(roleId) == 15) &&
|
||||||
Number(levelNumber) == 3
|
Number(levelNumber) == 3
|
||||||
) {
|
) {
|
||||||
if (Number(userParentLevelId) != 761) {
|
if (Number(userParentLevelId) != 761) {
|
||||||
|
|
|
||||||
|
|
@ -47,22 +47,23 @@ export async function listDataAll(
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function listDataImage(
|
export async function listDataImage(
|
||||||
size: any,
|
size: any = "",
|
||||||
page: any,
|
page: any = "",
|
||||||
isForSelf: any,
|
isForSelf: any = "",
|
||||||
isApproval: any,
|
isApproval: any = "",
|
||||||
categoryFilter: any,
|
categoryFilter: any = "",
|
||||||
statusFilter: any,
|
statusFilter: any = "",
|
||||||
needApprovalFromLevel: any,
|
needApprovalFromLevel: any = "",
|
||||||
creator: any,
|
creator: any = "",
|
||||||
source: any,
|
source: any = "",
|
||||||
startDate: any,
|
startDate: any = "",
|
||||||
endDate: any,
|
endDate: any = "",
|
||||||
title: string = "",
|
title: string = "",
|
||||||
creatorGroup: string = ""
|
creatorGroup: string = "",
|
||||||
|
isInt: boolean = false
|
||||||
) {
|
) {
|
||||||
return await httpGetInterceptor(
|
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(
|
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