diff --git a/app/[locale]/(protected)/admin/add-experts/create/page.tsx b/app/[locale]/(protected)/admin/add-experts/create/page.tsx index 00b8be71..ab33ac6e 100644 --- a/app/[locale]/(protected)/admin/add-experts/create/page.tsx +++ b/app/[locale]/(protected)/admin/add-experts/create/page.tsx @@ -130,6 +130,7 @@ export default function AddExpertForm() { userCompetencyId: data.skills, userExperienceId: data.experiences, companyName: data.company, + isAdmin: true, }; loading(); diff --git a/app/[locale]/(protected)/admin/media-tracking/results/component/column.tsx b/app/[locale]/(protected)/admin/media-tracking/results/component/column.tsx index b6bfa497..69d40134 100644 --- a/app/[locale]/(protected)/admin/media-tracking/results/component/column.tsx +++ b/app/[locale]/(protected)/admin/media-tracking/results/component/column.tsx @@ -49,11 +49,11 @@ const columns: ColumnDef[] = [ header: "Jumlah Amplifikasi", cell: ({ row }) => {row.getValue("link")}, }, - { - accessorKey: "status", - header: "Status", - cell: ({ row }) => {row.getValue("status")}, - }, + // { + // accessorKey: "status", + // header: "Status", + // cell: ({ row }) => {row.getValue("status")}, + // }, { accessorKey: "date", header: "Tanggal Penarikan", @@ -77,10 +77,17 @@ const columns: ColumnDef[] = [ - + - View + View{" "} + {row.original.mediaUpload.fileType.secondaryName && + row.original.mediaUpload.fileType.secondaryName.toLowerCase()} diff --git a/app/[locale]/(protected)/admin/media-tracking/tracking-berita/component/table.tsx b/app/[locale]/(protected)/admin/media-tracking/tracking-berita/component/table.tsx index e60c0b89..33d03582 100644 --- a/app/[locale]/(protected)/admin/media-tracking/tracking-berita/component/table.tsx +++ b/app/[locale]/(protected)/admin/media-tracking/tracking-berita/component/table.tsx @@ -9,7 +9,7 @@ import { listDataTracking, mediaTrackingSave, } from "@/service/media-tracking/media-tracking"; -import { error, loading } from "@/lib/swal"; +import { error } from "@/lib/swal"; import { toast } from "sonner"; import { DropdownMenu, @@ -20,31 +20,32 @@ import { } from "@/components/ui/dropdown-menu"; import { PaginationState } from "@tanstack/react-table"; import page from "../page"; +import CustomPagination from "@/components/table/custom-pagination"; +import { close, loading } from "@/config/swal"; export default function TrackingBeritaCard() { const [search, setSearch] = useState(""); const [content, setContent] = useState([]); const [selectedItems, setSelectedItems] = useState([]); - const [currentPage, setCurrentPage] = useState(1); - const [page, setPage] = React.useState(1); - const [showData, setShowData] = React.useState("10"); - const [pagination, setPagination] = React.useState({ - pageIndex: 0, - pageSize: Number(showData), - }); + const [page, setPage] = useState(1); + const [totalPage, setTotalPage] = useState(1); + const [showData, setShowData] = useState("6"); useEffect(() => { initFecth(); - }, [showData]); + }, [showData, page]); const initFecth = async () => { + loading(); const response = await listDataTracking(showData, page - 1); const data = response?.data?.data; const newData = data?.content; + setTotalPage(data?.totalPages || 1); newData.forEach((item: any, index: number) => { item.no = (page - 1) * Number(showData) + index + 1; }); setContent(response?.data?.data?.content || []); + close(); }; const fecthAll = async (keyword: string) => { @@ -117,17 +118,17 @@ export default function TrackingBeritaCard() { value={showData} onValueChange={setShowData} > - - 1 - 10 Data + + 1 - 6 Data - - 1 - 50 Data + + 1 - 12 Data - - 1 - 100 Data + + 1 - 60 Data - - 1 - 250 Data + + 1 - 120 Data @@ -150,48 +151,40 @@ export default function TrackingBeritaCard() { )}
- {content.map((item: any) => ( - handleSelect(item.id)} - > - {item.title} -
-
- {selectedItems.includes(item.id) && ( -
- )} + {content?.length > 1 && + content.map((item: any) => ( + handleSelect(item.id)} + > + {item.title} +
+
+ {selectedItems.includes(item.id) && ( +
+ )} +
-
-

- {item.title} -

-
- ))} +

+ {item.title} +

+ + ))}
- -
- -
{currentPage}
- +
+ {content && content?.length > 0 ? ( + setPage(data)} + /> + ) : ( +

No Data

+ )}
diff --git a/app/[locale]/(protected)/admin/settings/banner/component/table.tsx b/app/[locale]/(protected)/admin/settings/banner/component/table.tsx index 5b57778c..44d98ec7 100644 --- a/app/[locale]/(protected)/admin/settings/banner/component/table.tsx +++ b/app/[locale]/(protected)/admin/settings/banner/component/table.tsx @@ -69,6 +69,7 @@ import { data } from "jquery"; import { useToast } from "@/components/ui/use-toast"; import { setBanner } from "@/service/settings/settings"; import { id } from "date-fns/locale"; +import CustomPagination from "@/components/table/custom-pagination"; const ContentListBanner = () => { const router = useRouter(); @@ -120,10 +121,10 @@ const ContentListBanner = () => { React.useEffect(() => { fetchData(); - setPagination({ - pageIndex: 0, - pageSize: Number(showData), - }); + // setPagination({ + // pageIndex: 0, + // pageSize: Number(showData), + // }); }, [page, showData]); async function fetchData() { @@ -398,10 +399,15 @@ const ContentListBanner = () => {
))}
-
-
- 1 -
+
+ {data && data?.length > 0 ? ( + setPage(data)} + /> + ) : ( +

No Data

+ )}
diff --git a/app/[locale]/(protected)/contributor/schedule/live-report/component/live-report-table.tsx b/app/[locale]/(protected)/contributor/schedule/live-report/component/live-report-table.tsx index 73e5c839..f9e0d13a 100644 --- a/app/[locale]/(protected)/contributor/schedule/live-report/component/live-report-table.tsx +++ b/app/[locale]/(protected)/contributor/schedule/live-report/component/live-report-table.tsx @@ -129,7 +129,7 @@ const LiveReportTable = () => { const res = await paginationSchedule( showData, page - 1, - selectedType, + "", search, statusFilter ); diff --git a/app/[locale]/(public)/(satker)/satker/[satker_name]/image/filter/page.tsx b/app/[locale]/(public)/(satker)/satker/[satker_name]/image/filter/page.tsx index fc163f11..454fb32b 100644 --- a/app/[locale]/(public)/(satker)/satker/[satker_name]/image/filter/page.tsx +++ b/app/[locale]/(public)/(satker)/satker/[satker_name]/image/filter/page.tsx @@ -3,10 +3,30 @@ import React, { useEffect, useState } from "react"; import { Card, CardContent } from "@/components/ui/card"; import { Checkbox } from "@/components/ui/checkbox"; import { Icon } from "@iconify/react/dist/iconify.js"; -import { formatDateToIndonesian, getOnlyDate, getOnlyMonthAndYear } from "@/utils/globals"; +import { + formatDateToIndonesian, + getOnlyDate, + getOnlyMonthAndYear, +} from "@/utils/globals"; import { useParams, usePathname, useSearchParams } from "next/navigation"; -import { getUserLevelListByParent, listCategory, listData, listDataRegional } from "@/service/landing/landing"; -import { ColumnDef, ColumnFiltersState, PaginationState, SortingState, VisibilityState, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table"; +import { + getUserLevelListByParent, + listCategory, + listData, + listDataRegional, +} from "@/service/landing/landing"; +import { + ColumnDef, + ColumnFiltersState, + PaginationState, + SortingState, + VisibilityState, + getCoreRowModel, + getFilteredRowModel, + getPaginationRowModel, + getSortedRowModel, + useReactTable, +} from "@tanstack/react-table"; import LandingPagination from "@/components/landing-page/pagination"; import { Reveal } from "@/components/landing-page/Reveal"; import { Link, useRouter } from "@/i18n/routing"; @@ -34,9 +54,14 @@ const FilterPage = () => { const [totalData, setTotalData] = React.useState(1); const [totalPage, setTotalPage] = React.useState(1); const [sorting, setSorting] = React.useState([]); - const [columnFilters, setColumnFilters] = React.useState([]); - const [columnVisibility, setColumnVisibility] = React.useState({}); + const [columnFilters, setColumnFilters] = React.useState( + [] + ); + const [columnVisibility, setColumnVisibility] = + React.useState({}); const [rowSelection, setRowSelection] = React.useState({}); + const [isFilterOpen, setIsFilterOpen] = useState(true); + const [pagination, setPagination] = React.useState({ pageIndex: 0, pageSize: 10, @@ -56,7 +81,9 @@ const FilterPage = () => { const [categoryFilter, setCategoryFilter] = useState([]); const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); - const [sortByOpt, setSortByOpt] = useState(sortBy === "popular" ? "clickCount" : "createdAt"); + const [sortByOpt, setSortByOpt] = useState( + sortBy === "popular" ? "clickCount" : "createdAt" + ); const isRegional = asPath?.includes("regional"); const isSatker = asPath?.includes("satker"); const [formatFilter, setFormatFilter] = useState([]); @@ -70,7 +97,7 @@ const FilterPage = () => { const [userLevels, setUserLevels] = useState([]); const satkerName = params?.satker_name; let prefixPath = satkerName ? `/satker/${satkerName}` : "/"; - + const t = useTranslations("FilterPage"); // const [startDate, endDate] = dateRange; @@ -96,8 +123,14 @@ const FilterPage = () => { useEffect(() => { if (categorie) { - setCategoryFilter(categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]); - console.log("Kategori", categorie, categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]); + setCategoryFilter( + categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie] + ); + console.log( + "Kategori", + categorie, + categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie] + ); } }, [categorie]); @@ -115,7 +148,19 @@ const FilterPage = () => { } console.log(monthYearFilter, "monthFilter"); initState(); - }, [change, asPath, monthYearFilter, page, sortBy, sortByOpt, title, startDateString, endDateString, categorie, formatFilter]); + }, [ + change, + asPath, + monthYearFilter, + page, + sortBy, + sortByOpt, + title, + startDateString, + endDateString, + categorie, + formatFilter, + ]); async function getCategories() { const category = await listCategory("1"); @@ -137,7 +182,10 @@ const FilterPage = () => { async function getDataAll() { if (satkerName && String(satkerName)?.length > 1) { - const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : categorie || ""; + const filter = + categoryFilter?.length > 0 + ? categoryFilter?.sort().join(",") + : categorie || ""; const name = title == undefined ? "" : title; const format = formatFilter == undefined ? "" : formatFilter?.join(","); @@ -155,8 +203,12 @@ const FilterPage = () => { filterGroup, startDateString, endDateString, - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") : "", - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : "" + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") + : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] + : "" ); close(); const data = response?.data?.data; @@ -166,7 +218,10 @@ const FilterPage = () => { setTotalPage(data?.totalPages); setTotalContent(response?.data?.data?.totalElements); } else { - const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : categorie || ""; + const filter = + categoryFilter?.length > 0 + ? categoryFilter?.sort().join(",") + : categorie || ""; const name = title == undefined ? "" : title; const format = formatFilter == undefined ? "" : formatFilter?.join(","); @@ -183,8 +238,12 @@ const FilterPage = () => { "", startDateString, endDateString, - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") : "", - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : "" + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") + : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] + : "" ); close(); const data = response?.data?.data; @@ -231,7 +290,10 @@ const FilterPage = () => { }; async function getDataRegional() { - const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : categorie || ""; + const filter = + categoryFilter?.length > 0 + ? categoryFilter?.sort().join(",") + : categorie || ""; const name = title == undefined ? "" : title; const format = formatFilter == undefined ? "" : formatFilter?.join(","); @@ -244,8 +306,12 @@ const FilterPage = () => { "", startDateString, endDateString, - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") : "", - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") + : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] + : "", 12, pages, sortByOpt @@ -362,114 +428,193 @@ const FilterPage = () => {
{/* Left */} -
-
-

- - Filter -

-
-
-
- - setSearchTitle(e.target.value)} - onKeyUp={handleKeyUp} - onKeyDown={handleKeyDown} - type="text" - id="search" - placeholder={t("searchTitle")} - className="mt-1 w-full border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500" - /> -
- -
- - setMonthYearFilter(date)} - dateFormat="MM | yyyy" - placeholderText={t("selectYear")} - showMonthYearPicker - /> -
- -
- -
- { - setDateRange(update); - }} - placeholderText={t("selectDate")} - onCalendarClose={() => setCalenderState(!calenderState)} +
+
+ +
+ {isFilterOpen && ( +
+

+ + Filter +

+
+
+
+ + setSearchTitle(e.target.value)} + onKeyUp={handleKeyUp} + onKeyDown={handleKeyDown} + type="text" + id="search" + placeholder={t("searchTitle")} + className="mt-1 w-full border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500" /> -
{handleClose ? : ""}
-
-
-

{t("categories")}

-
    - {categories.map((category: any) => ( -
  • -
  • + +
  • +
  • + +
  • +
+
+
+
-
+ )} {/* Konten Kanan */}

{t("sortBy")}

- handleSorting(e)} + className="border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500" + > @@ -478,21 +623,36 @@ const FilterPage = () => { {imageData?.length > 0 ? (
{imageData?.map((image: any) => ( - + - +
- {formatDateToIndonesian(new Date(image?.createdAt))} {image?.timezone ? image?.timezone : "WIB"}| + {formatDateToIndonesian(new Date(image?.createdAt))}{" "} + {image?.timezone ? image?.timezone : "WIB"}|{" "} + {image?.clickCount}{" "} - + {" "}
-
{image?.title}
+
+ {image?.title} +
@@ -500,11 +660,19 @@ const FilterPage = () => {
) : (

- empty + empty

)} - +
diff --git a/app/[locale]/(public)/audio/filter/page.tsx b/app/[locale]/(public)/audio/filter/page.tsx index eb5b1b81..6dc82194 100644 --- a/app/[locale]/(public)/audio/filter/page.tsx +++ b/app/[locale]/(public)/audio/filter/page.tsx @@ -2,10 +2,31 @@ import React, { useEffect, useState } from "react"; import { Checkbox } from "@/components/ui/checkbox"; import { Icon } from "@iconify/react/dist/iconify.js"; -import { formatDateToIndonesian, getOnlyDate, getOnlyMonthAndYear, secondToTimes } from "@/utils/globals"; +import { + formatDateToIndonesian, + getOnlyDate, + getOnlyMonthAndYear, + secondToTimes, +} from "@/utils/globals"; import { useParams, usePathname, useSearchParams } from "next/navigation"; -import { getUserLevelListByParent, listCategory, listData, listDataRegional } from "@/service/landing/landing"; -import { ColumnDef, ColumnFiltersState, PaginationState, SortingState, VisibilityState, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table"; +import { + getUserLevelListByParent, + listCategory, + listData, + listDataRegional, +} from "@/service/landing/landing"; +import { + ColumnDef, + ColumnFiltersState, + PaginationState, + SortingState, + VisibilityState, + getCoreRowModel, + getFilteredRowModel, + getPaginationRowModel, + getSortedRowModel, + useReactTable, +} from "@tanstack/react-table"; import LandingPagination from "@/components/landing-page/pagination"; import { Link, useRouter } from "@/i18n/routing"; import { Input } from "@/components/ui/input"; @@ -34,8 +55,11 @@ const FilterPage = () => { const [totalData, setTotalData] = React.useState(1); const [totalPage, setTotalPage] = React.useState(1); const [sorting, setSorting] = React.useState([]); - const [columnFilters, setColumnFilters] = React.useState([]); - const [columnVisibility, setColumnVisibility] = React.useState({}); + const [columnFilters, setColumnFilters] = React.useState( + [] + ); + const [columnVisibility, setColumnVisibility] = + React.useState({}); const [rowSelection, setRowSelection] = React.useState({}); const [pagination, setPagination] = React.useState({ pageIndex: 0, @@ -56,7 +80,9 @@ const FilterPage = () => { const [categoryFilter, setCategoryFilter] = useState([]); const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); - const [sortByOpt, setSortByOpt] = useState(sortBy === "popular" ? "clickCount" : "createdAt"); + const [sortByOpt, setSortByOpt] = useState( + sortBy === "popular" ? "clickCount" : "createdAt" + ); const isRegional = asPath?.includes("regional"); const isSatker = asPath?.includes("satker"); const [formatFilter, setFormatFilter] = useState([]); @@ -102,8 +128,14 @@ const FilterPage = () => { useEffect(() => { if (categorie) { - setCategoryFilter(categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]); - console.log("Kategori", categorie, categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]); + setCategoryFilter( + categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie] + ); + console.log( + "Kategori", + categorie, + categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie] + ); } }, [categorie]); @@ -121,7 +153,19 @@ const FilterPage = () => { } console.log(monthYearFilter, "monthFilter"); initState(); - }, [change, asPath, monthYearFilter, page, sortBy, sortByOpt, title, startDateString, endDateString, categorie, formatFilter]); + }, [ + change, + asPath, + monthYearFilter, + page, + sortBy, + sortByOpt, + title, + startDateString, + endDateString, + categorie, + formatFilter, + ]); async function getCategories() { const category = await listCategory("4"); @@ -144,7 +188,10 @@ const FilterPage = () => { async function getDataAll() { if (asPath?.includes("/polda/") == true) { if (asPath?.split("/")[2] !== "[polda_name]") { - const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : categorie || ""; + const filter = + categoryFilter?.length > 0 + ? categoryFilter?.sort().join(",") + : categorie || ""; const name = title == undefined ? "" : title; const format = formatFilter == undefined ? "" : formatFilter?.join(","); @@ -162,8 +209,14 @@ const FilterPage = () => { filterGroup, startDateString, endDateString, - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") : "", - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter) + ?.split("/")[0] + ?.replace("", "") + : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] + : "", locale == "en" ? true : false ); close(); @@ -178,7 +231,10 @@ const FilterPage = () => { setTotalContent(response?.data?.data?.totalElements); } } else { - const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : categorie || ""; + const filter = + categoryFilter?.length > 0 + ? categoryFilter?.sort().join(",") + : categorie || ""; const name = title == undefined ? "" : title; const format = formatFilter == undefined ? "" : formatFilter?.join(","); @@ -195,8 +251,12 @@ const FilterPage = () => { "", startDateString, endDateString, - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") : "", - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") + : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] + : "", locale == "en" ? true : false ); close(); @@ -247,7 +307,10 @@ const FilterPage = () => { }; async function getDataRegional() { - const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : categorie || ""; + const filter = + categoryFilter?.length > 0 + ? categoryFilter?.sort().join(",") + : categorie || ""; const name = title == undefined ? "" : title; const format = formatFilter == undefined ? "" : formatFilter?.join(","); @@ -260,8 +323,12 @@ const FilterPage = () => { "", startDateString, endDateString, - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") : "", - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") + : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] + : "", 12, pages, sortByOpt @@ -379,7 +446,7 @@ const FilterPage = () => { {/* Left */}
-
+

Filter @@ -387,7 +454,10 @@ const FilterPage = () => {
-
- + {
- +
{ placeholderText={t("searchDate")} onCalendarClose={() => setCalenderState(!calenderState)} /> -
{handleClose ? : ""}
+
+ {handleClose ? ( + + ) : ( + "" + )} +
-

{t("categories")}

+

+ {t("categories")} +

    {categories?.map((category: any) => (
  • -
  • ))} @@ -449,25 +549,48 @@ const FilterPage = () => {
    {/* Garis */}
    -

    Format

    +

    + Format +

    @@ -479,7 +602,11 @@ const FilterPage = () => {

    {t("sortBy")}

    - handleSorting(e)} + className="border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500" + > @@ -502,11 +629,20 @@ const FilterPage = () => {
    {audioData?.map((audio: any) => (
    - +
    - + {
    - {formatDateToIndonesian(new Date(audio?.createdAt))} {audio?.timezone ? audio?.timezone : "WIB"} + {formatDateToIndonesian( + new Date(audio?.createdAt) + )}{" "} + {audio?.timezone ? audio?.timezone : "WIB"}
    |  - +  {audio?.clickCount}{" "}
    -
    {audio?.title}
    +
    + {audio?.title} +
    - wave - + wave + -

    {audio?.duration ? secondToTimes(Number(audio?.duration)) : "00:00:00"}

    - +

    + {" "} + {audio?.duration + ? secondToTimes(Number(audio?.duration)) + : "00:00:00"} +

    +
    @@ -547,13 +711,21 @@ const FilterPage = () => {
    ) : (

    - empty + empty

    )} )} - +
    diff --git a/app/[locale]/(public)/content-management/download/page.tsx b/app/[locale]/(public)/content-management/download/page.tsx index a99cf83d..978b9d73 100644 --- a/app/[locale]/(public)/content-management/download/page.tsx +++ b/app/[locale]/(public)/content-management/download/page.tsx @@ -435,7 +435,7 @@ const Galery = (props: any) => { className="flex cursor-pointer" asChild > - + { - {/* - -

    Content Rewrite

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

    + {t("save")}{" "} +

    +
    + + +

    + Content Rewrite +

    +
    @@ -457,14 +481,14 @@ const Galery = (props: any) => { fontSize={20} />

    - {t("share")} + {t("share")}{" "}

    - {t("shareTo")} + {t("shareTo")}{" "}

    @@ -479,9 +503,7 @@ const Galery = (props: any) => { } onKeyPress={handleEmailList} type="email" - placeholder={t( - "pressEnter" - )} + placeholder={t("shareTo")} />

    -
    - handleDelete(video?.id) - } - className="cursor-pointer flex flex-row gap-2 hover:text-red-800" - > - -

    - {t("delete")} -

    -

    @@ -702,7 +710,7 @@ const Galery = (props: any) => { className="flex cursor-pointer" asChild > - + { - {/* - -

    Content Rewrite

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

    + {t("save")}{" "} +

    +
    + + +

    + Content Rewrite +

    +
    @@ -724,14 +756,14 @@ const Galery = (props: any) => { fontSize={20} />

    - {t("share")} + {t("share")}{" "}

    - {t("shareTo")} + {t("shareTo")}{" "}

    @@ -746,9 +778,7 @@ const Galery = (props: any) => { } onKeyPress={handleEmailList} type="email" - placeholder={t( - "pressEnter" - )} + placeholder={t("shareTo")} />

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

    - {t("delete")} -

    -

    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 c74aa695..20576035 100644 --- a/app/[locale]/(public)/content-management/rewrite/create/[id]/page.tsx +++ b/app/[locale]/(public)/content-management/rewrite/create/[id]/page.tsx @@ -77,11 +77,12 @@ const page = (props: any) => { const [selectedArticleId, setSelectedArticleId] = useState(null); const [articleBody, setArticleBody] = useState(""); const [selectedAdvConfig, setSelectedAdvConfig] = useState(""); - const [selectedWritingStyle, setSelectedWritingStyle] = useState(""); - const [selectedContextType, setSelectedContextType] = useState(""); - const [selectedLanguage, setSelectedLanguage] = useState(""); + const [selectedWritingStyle, setSelectedWritingStyle] = + useState("profesional"); + const [selectedContextType, setSelectedContextType] = useState("article"); + const [selectedLanguage, setSelectedLanguage] = useState("id"); const [selectedTitle, setSelectedTitle] = useState(""); - const [selectedSize, setSelectedSize] = useState(""); + const [selectedSize, setSelectedSize] = useState("news"); const [detailArticle, setDetailArticle] = useState(null); const [isLoadingData, setIsLoadingData] = useState(false); const [detailData, setDetailData] = useState(null); @@ -262,11 +263,11 @@ const page = (props: any) => { setIsGeneratedArticle(true); setArticleIds((prevIds: any) => { - if (prevIds.length < 5) { + if (prevIds.length < 3) { return [...prevIds, newArticleId]; } else { const updatedIds = [...prevIds]; - updatedIds[4] = newArticleId; + updatedIds[2] = newArticleId; return updatedIds; } }); @@ -488,11 +489,11 @@ const page = (props: any) => { Generate Artikel {isGeneratedArticle && ( -
    +
    {articleIds.map((id: any, index: any) => (

    {

    -
    +
    diff --git a/app/[locale]/(public)/document/filter/page.tsx b/app/[locale]/(public)/document/filter/page.tsx index 24df27dd..77a9bd0e 100644 --- a/app/[locale]/(public)/document/filter/page.tsx +++ b/app/[locale]/(public)/document/filter/page.tsx @@ -3,10 +3,31 @@ import React, { useEffect, useState } from "react"; import { Card, CardContent } from "@/components/ui/card"; import { Checkbox } from "@/components/ui/checkbox"; import { Icon } from "@iconify/react/dist/iconify.js"; -import { formatDateToIndonesian, getOnlyDate, getOnlyMonthAndYear } from "@/utils/globals"; +import { + formatDateToIndonesian, + getOnlyDate, + getOnlyMonthAndYear, +} from "@/utils/globals"; import { useParams, usePathname, useSearchParams } from "next/navigation"; -import { getListContent, getUserLevelListByParent, listCategory, listData, listDataRegional } from "@/service/landing/landing"; -import { ColumnDef, ColumnFiltersState, PaginationState, SortingState, VisibilityState, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table"; +import { + getListContent, + getUserLevelListByParent, + listCategory, + listData, + listDataRegional, +} from "@/service/landing/landing"; +import { + ColumnDef, + ColumnFiltersState, + PaginationState, + SortingState, + VisibilityState, + getCoreRowModel, + getFilteredRowModel, + getPaginationRowModel, + getSortedRowModel, + useReactTable, +} from "@tanstack/react-table"; import LandingPagination from "@/components/landing-page/pagination"; import { Reveal } from "@/components/landing-page/Reveal"; import { Link, useRouter } from "@/i18n/routing"; @@ -35,8 +56,11 @@ const FilterPage = () => { const [totalData, setTotalData] = React.useState(1); const [totalPage, setTotalPage] = React.useState(1); const [sorting, setSorting] = React.useState([]); - const [columnFilters, setColumnFilters] = React.useState([]); - const [columnVisibility, setColumnVisibility] = React.useState({}); + const [columnFilters, setColumnFilters] = React.useState( + [] + ); + const [columnVisibility, setColumnVisibility] = + React.useState({}); const [rowSelection, setRowSelection] = React.useState({}); const [pagination, setPagination] = React.useState({ pageIndex: 0, @@ -57,7 +81,9 @@ const FilterPage = () => { const [categoryFilter, setCategoryFilter] = useState([]); const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); - const [sortByOpt, setSortByOpt] = useState(sortBy === "popular" ? "clickCount" : "createdAt"); + const [sortByOpt, setSortByOpt] = useState( + sortBy === "popular" ? "clickCount" : "createdAt" + ); const isRegional = asPath?.includes("regional"); const isSatker = asPath?.includes("satker"); const [formatFilter, setFormatFilter] = useState([]); @@ -102,8 +128,14 @@ const FilterPage = () => { useEffect(() => { if (categorie) { - setCategoryFilter(categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]); - console.log("Kategori", categorie, categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]); + setCategoryFilter( + categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie] + ); + console.log( + "Kategori", + categorie, + categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie] + ); } }, [categorie]); @@ -121,7 +153,19 @@ const FilterPage = () => { } console.log(monthYearFilter, "monthFilter"); initState(); - }, [change, asPath, monthYearFilter, page, sortBy, sortByOpt, title, startDateString, endDateString, categorie, formatFilter]); + }, [ + change, + asPath, + monthYearFilter, + page, + sortBy, + sortByOpt, + title, + startDateString, + endDateString, + categorie, + formatFilter, + ]); async function getCategories() { const category = await listCategory("3"); @@ -144,7 +188,10 @@ const FilterPage = () => { async function getDataAll() { if (asPath?.includes("/polda/") == true) { if (asPath?.split("/")[2] !== "[polda_name]") { - const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : categorie || ""; + const filter = + categoryFilter?.length > 0 + ? categoryFilter?.sort().join(",") + : categorie || ""; const name = title == undefined ? "" : title; const format = formatFilter == undefined ? "" : formatFilter?.join(","); @@ -162,8 +209,14 @@ const FilterPage = () => { filterGroup, startDateString, endDateString, - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") : "", - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter) + ?.split("/")[0] + ?.replace("", "") + : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] + : "", locale == "en" ? true : false ); close(); @@ -178,7 +231,10 @@ const FilterPage = () => { setTotalContent(response?.data?.data?.totalElements); } } else { - const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : categorie || ""; + const filter = + categoryFilter?.length > 0 + ? categoryFilter?.sort().join(",") + : categorie || ""; const name = title == undefined ? "" : title; const format = formatFilter == undefined ? "" : formatFilter?.join(","); @@ -195,8 +251,12 @@ const FilterPage = () => { "", startDateString, endDateString, - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") : "", - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") + : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] + : "", locale == "en" ? true : false ); close(); @@ -247,7 +307,10 @@ const FilterPage = () => { }; async function getDataRegional() { - const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : categorie || ""; + const filter = + categoryFilter?.length > 0 + ? categoryFilter?.sort().join(",") + : categorie || ""; const name = title == undefined ? "" : title; const format = formatFilter == undefined ? "" : formatFilter?.join(","); @@ -260,8 +323,12 @@ const FilterPage = () => { "", startDateString, endDateString, - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") : "", - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") + : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] + : "", 12, pages, sortByOpt @@ -394,7 +461,7 @@ const FilterPage = () => { {/* Left */}
    -
    +

    Filter @@ -402,7 +469,10 @@ const FilterPage = () => {
    -
    - + {
    - +
    { placeholderText={t("selectDate")} onCalendarClose={() => setCalenderState(!calenderState)} /> -
    {handleClose ? : ""}
    +
    + {handleClose ? ( + + ) : ( + "" + )} +
    -

    {t("categories")}

    +

    + {t("categories")} +

      {categories.map((category: any) => (
    • -
    • ))} @@ -464,43 +564,93 @@ const FilterPage = () => {
      {/* Garis */}
      -

      Format

      +

      + Format +

      @@ -513,7 +663,11 @@ const FilterPage = () => {

      {t("sortBy")}

      - handleSorting(e)} + className="border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500" + > @@ -539,9 +693,19 @@ const FilterPage = () => { {documentData?.length > 0 ? (
      {documentData?.map((document: any) => ( - +
      - + {
      - {formatDateToIndonesian(new Date(document?.createdAt))} {document?.timezone ? document?.timezone : "WIB"} | {document?.clickCount} + {formatDateToIndonesian( + new Date(document?.createdAt) + )}{" "} + {document?.timezone ? document?.timezone : "WIB"}{" "} + |{" "} + {" "} + {document?.clickCount} +
      +
      + {document?.title}
      -
      {document?.title}
      - - + + Download Dokumen
      @@ -565,13 +745,21 @@ const FilterPage = () => {
      ) : (

      - empty + empty

      )} )} - +
      diff --git a/app/[locale]/(public)/image/filter/page.tsx b/app/[locale]/(public)/image/filter/page.tsx index 9d1b3667..c43d8601 100644 --- a/app/[locale]/(public)/image/filter/page.tsx +++ b/app/[locale]/(public)/image/filter/page.tsx @@ -3,10 +3,30 @@ import React, { useEffect, useState } from "react"; import { Card, CardContent } from "@/components/ui/card"; import { Checkbox } from "@/components/ui/checkbox"; import { Icon } from "@iconify/react/dist/iconify.js"; -import { formatDateToIndonesian, getOnlyDate, getOnlyMonthAndYear } from "@/utils/globals"; +import { + formatDateToIndonesian, + getOnlyDate, + getOnlyMonthAndYear, +} from "@/utils/globals"; import { useParams, usePathname, useSearchParams } from "next/navigation"; -import { getUserLevelListByParent, listCategory, listData, listDataRegional } from "@/service/landing/landing"; -import { ColumnDef, ColumnFiltersState, PaginationState, SortingState, VisibilityState, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table"; +import { + getUserLevelListByParent, + listCategory, + listData, + listDataRegional, +} from "@/service/landing/landing"; +import { + ColumnDef, + ColumnFiltersState, + PaginationState, + SortingState, + VisibilityState, + getCoreRowModel, + getFilteredRowModel, + getPaginationRowModel, + getSortedRowModel, + useReactTable, +} from "@tanstack/react-table"; import LandingPagination from "@/components/landing-page/pagination"; import { Reveal } from "@/components/landing-page/Reveal"; import { Link, useRouter } from "@/i18n/routing"; @@ -38,8 +58,11 @@ const FilterPage = () => { const [totalData, setTotalData] = React.useState(1); const [totalPage, setTotalPage] = React.useState(1); const [sorting, setSorting] = React.useState([]); - const [columnFilters, setColumnFilters] = React.useState([]); - const [columnVisibility, setColumnVisibility] = React.useState({}); + const [columnFilters, setColumnFilters] = React.useState( + [] + ); + const [columnVisibility, setColumnVisibility] = + React.useState({}); const [rowSelection, setRowSelection] = React.useState({}); const [pagination, setPagination] = React.useState({ pageIndex: 0, @@ -60,7 +83,9 @@ const FilterPage = () => { const [categoryFilter, setCategoryFilter] = useState([]); const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); - const [sortByOpt, setSortByOpt] = useState(sortBy === "popular" ? "clickCount" : "createdAt"); + const [sortByOpt, setSortByOpt] = useState( + sortBy === "popular" ? "clickCount" : "createdAt" + ); const isRegional = asPath?.includes("regional"); const isSatker = asPath?.includes("satker"); const [formatFilter, setFormatFilter] = useState([]); @@ -106,8 +131,14 @@ const FilterPage = () => { useEffect(() => { if (categorie) { - setCategoryFilter(categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]); - console.log("Kategori", categorie, categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]); + setCategoryFilter( + categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie] + ); + console.log( + "Kategori", + categorie, + categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie] + ); } }, [categorie]); @@ -125,7 +156,19 @@ const FilterPage = () => { } console.log(monthYearFilter, "monthFilter"); initState(); - }, [change, asPath, monthYearFilter, page, sortBy, sortByOpt, title, startDateString, endDateString, categorie, formatFilter]); + }, [ + change, + asPath, + monthYearFilter, + page, + sortBy, + sortByOpt, + title, + startDateString, + endDateString, + categorie, + formatFilter, + ]); async function getCategories() { const category = await listCategory("1"); @@ -148,7 +191,10 @@ const FilterPage = () => { async function getDataAll() { if (asPath?.includes("/polda/") == true) { if (asPath?.split("/")[2] !== "[polda_name]") { - const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : categorie || ""; + const filter = + categoryFilter?.length > 0 + ? categoryFilter?.sort().join(",") + : categorie || ""; const name = title == undefined ? "" : title; const format = formatFilter == undefined ? "" : formatFilter?.join(","); @@ -166,8 +212,14 @@ const FilterPage = () => { filterGroup, startDateString, endDateString, - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") : "", - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter) + ?.split("/")[0] + ?.replace("", "") + : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] + : "", locale == "en" ? true : false ); close(); @@ -182,7 +234,10 @@ const FilterPage = () => { setTotalContent(response?.data?.data?.totalElements); } } else { - const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : categorie || ""; + const filter = + categoryFilter?.length > 0 + ? categoryFilter?.sort().join(",") + : categorie || ""; const name = title == undefined ? "" : title; const format = formatFilter == undefined ? "" : formatFilter?.join(","); @@ -199,8 +254,12 @@ const FilterPage = () => { "", startDateString, endDateString, - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") : "", - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") + : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] + : "", locale == "en" ? true : false ); close(); @@ -251,7 +310,10 @@ const FilterPage = () => { }; async function getDataRegional() { - const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : categorie || ""; + const filter = + categoryFilter?.length > 0 + ? categoryFilter?.sort().join(",") + : categorie || ""; const name = title == undefined ? "" : title; const format = formatFilter == undefined ? "" : formatFilter?.join(","); @@ -264,8 +326,12 @@ const FilterPage = () => { "", startDateString, endDateString, - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") : "", - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") + : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] + : "", 12, pages, sortByOpt @@ -382,7 +448,10 @@ const FilterPage = () => { `; - const toBase64 = (str: string) => (typeof window === "undefined" ? Buffer.from(str).toString("base64") : window.btoa(str)); + const toBase64 = (str: string) => + typeof window === "undefined" + ? Buffer.from(str).toString("base64") + : window.btoa(str); return (
      @@ -401,13 +470,16 @@ const FilterPage = () => { {/* Left */}
      -
      {isFilterOpen && ( -
      +

      Filter @@ -415,7 +487,10 @@ const FilterPage = () => {
      -
      - + {
      - +
      { placeholderText={t("selectDate")} onCalendarClose={() => setCalenderState(!calenderState)} /> -
      {handleClose ? : ""}
      +
      + {handleClose ? ( + + ) : ( + "" + )} +
      -

      {t("categories")}

      +

      + {t("categories")} +

        {categories.map((category: any) => (
      • -
      • ))} @@ -477,31 +582,63 @@ const FilterPage = () => {
        {/* Garis */}
        -

        Format

        +

        + Format +

        @@ -515,7 +652,11 @@ const FilterPage = () => {

        {t("sortBy")}

        - handleSorting(e)} + className="border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500" + > @@ -539,13 +680,19 @@ const FilterPage = () => { {imageData?.length > 0 ? (
        {imageData?.map((image: any) => ( - + {/* */}
        { />
        - {formatDateToIndonesian(new Date(image?.createdAt))} {image?.timezone ? image?.timezone : "WIB"} + {formatDateToIndonesian( + new Date(image?.createdAt) + )}{" "} + {image?.timezone ? image?.timezone : "WIB"}   | - + {image?.clickCount}{" "}
        -
        {image?.title}
        +
        + {image?.title} +
        @@ -568,12 +724,24 @@ const FilterPage = () => {
        ) : (

        - empty + empty

        )} )} - {totalData > 1 && } + {totalData > 1 && ( + + )}
        diff --git a/app/[locale]/(public)/video/filter/page.tsx b/app/[locale]/(public)/video/filter/page.tsx index 7828ab0c..bd0ea4bd 100644 --- a/app/[locale]/(public)/video/filter/page.tsx +++ b/app/[locale]/(public)/video/filter/page.tsx @@ -3,10 +3,31 @@ import React, { useEffect, useState } from "react"; import { Card, CardContent } from "@/components/ui/card"; import { Checkbox } from "@/components/ui/checkbox"; import { Icon } from "@iconify/react/dist/iconify.js"; -import { formatDateToIndonesian, getOnlyDate, getOnlyMonthAndYear } from "@/utils/globals"; +import { + formatDateToIndonesian, + getOnlyDate, + getOnlyMonthAndYear, +} from "@/utils/globals"; import { useParams, usePathname, useSearchParams } from "next/navigation"; -import { getListContent, getUserLevelListByParent, listCategory, listData, listDataRegional } from "@/service/landing/landing"; -import { ColumnDef, ColumnFiltersState, PaginationState, SortingState, VisibilityState, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table"; +import { + getListContent, + getUserLevelListByParent, + listCategory, + listData, + listDataRegional, +} from "@/service/landing/landing"; +import { + ColumnDef, + ColumnFiltersState, + PaginationState, + SortingState, + VisibilityState, + getCoreRowModel, + getFilteredRowModel, + getPaginationRowModel, + getSortedRowModel, + useReactTable, +} from "@tanstack/react-table"; import LandingPagination from "@/components/landing-page/pagination"; import { Reveal } from "@/components/landing-page/Reveal"; import { Link, useRouter } from "@/i18n/routing"; @@ -37,8 +58,11 @@ const FilterPage = () => { const [totalData, setTotalData] = React.useState(1); const [totalPage, setTotalPage] = React.useState(1); const [sorting, setSorting] = React.useState([]); - const [columnFilters, setColumnFilters] = React.useState([]); - const [columnVisibility, setColumnVisibility] = React.useState({}); + const [columnFilters, setColumnFilters] = React.useState( + [] + ); + const [columnVisibility, setColumnVisibility] = + React.useState({}); const [rowSelection, setRowSelection] = React.useState({}); const [pagination, setPagination] = React.useState({ pageIndex: 0, @@ -56,7 +80,9 @@ const FilterPage = () => { const [categoryFilter, setCategoryFilter] = useState([]); const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); - const [sortByOpt, setSortByOpt] = useState(sortBy === "popular" ? "clickCount" : "createdAt"); + const [sortByOpt, setSortByOpt] = useState( + sortBy === "popular" ? "clickCount" : "createdAt" + ); const isRegional = asPath?.includes("regional"); const isSatker = asPath?.includes("satker"); const [formatFilter, setFormatFilter] = useState([]); @@ -102,8 +128,14 @@ const FilterPage = () => { useEffect(() => { if (categorie) { - setCategoryFilter(categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]); - console.log("Kategori", categorie, categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]); + setCategoryFilter( + categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie] + ); + console.log( + "Kategori", + categorie, + categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie] + ); } }, [categorie]); @@ -116,7 +148,19 @@ const FilterPage = () => { } } initState(); - }, [change, asPath, monthYearFilter, page, sortBy, sortByOpt, title, startDateString, endDateString, categorie, formatFilter]); + }, [ + change, + asPath, + monthYearFilter, + page, + sortBy, + sortByOpt, + title, + startDateString, + endDateString, + categorie, + formatFilter, + ]); async function getCategories() { const category = await listCategory("2"); @@ -139,7 +183,10 @@ const FilterPage = () => { async function getDataAll() { if (asPath?.includes("/polda/") == true) { if (asPath?.split("/")[2] !== "[polda_name]") { - const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : categorie || ""; + const filter = + categoryFilter?.length > 0 + ? categoryFilter?.sort().join(",") + : categorie || ""; const name = title == undefined ? "" : title; const format = formatFilter == undefined ? "" : formatFilter?.join(","); @@ -157,8 +204,14 @@ const FilterPage = () => { filterGroup, startDateString, endDateString, - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") : "", - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter) + ?.split("/")[0] + ?.replace("", "") + : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] + : "", locale == "en" ? true : false ); close(); @@ -173,7 +226,10 @@ const FilterPage = () => { setTotalContent(response?.data?.data?.totalElements); } } else { - const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : categorie || ""; + const filter = + categoryFilter?.length > 0 + ? categoryFilter?.sort().join(",") + : categorie || ""; const name = title == undefined ? "" : title; const format = formatFilter == undefined ? "" : formatFilter?.join(","); loading(); @@ -189,8 +245,12 @@ const FilterPage = () => { "", startDateString, endDateString, - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") : "", - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") + : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] + : "", locale == "en" ? true : false ); close(); @@ -241,7 +301,10 @@ const FilterPage = () => { }; async function getDataRegional() { - const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : categorie || ""; + const filter = + categoryFilter?.length > 0 + ? categoryFilter?.sort().join(",") + : categorie || ""; const name = title == undefined ? "" : title; const format = formatFilter == undefined ? "" : formatFilter?.join(","); @@ -254,8 +317,12 @@ const FilterPage = () => { "", startDateString, endDateString, - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") : "", - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") + : "", + monthYearFilter + ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] + : "", 12, pages, sortByOpt @@ -396,7 +463,7 @@ const FilterPage = () => { {/* Left */}
        -
        +

        Filter @@ -404,7 +471,10 @@ const FilterPage = () => {
        -
        - + {
        - +
        { placeholderText={t("selectDate")} onCalendarClose={() => setCalenderState(!calenderState)} /> -
        {handleClose ? : ""}
        +
        + {handleClose ? ( + + ) : ( + "" + )} +
        -

        {t("categories")}

        +

        + {t("categories")} +

          {categories.map((category: any) => (
        • -
        • ))} @@ -466,43 +566,93 @@ const FilterPage = () => {
          {/* Garis */}
          -

          Format

          +

          + Format +

          @@ -515,7 +665,11 @@ const FilterPage = () => {

          {t("sortBy")}

          - handleSorting(e)} + className="border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500" + > @@ -539,18 +693,39 @@ const FilterPage = () => { {videoData?.length > 0 ? (
          {videoData?.map((video: any) => ( - + {/* */}
          - +
          - {formatDateToIndonesian(new Date(video?.createdAt))} {video?.timezone ? video?.timezone : "WIB"} | + {formatDateToIndonesian( + new Date(video?.createdAt) + )}{" "} + {video?.timezone ? video?.timezone : "WIB"} |{" "} + {video?.clickCount}{" "}
          -
          {video?.title}
          +
          + {video?.title} +
          @@ -558,13 +733,23 @@ const FilterPage = () => {
          ) : (

          - empty + empty

          )} )} - +
          diff --git a/components/form/content/image-detail-form.tsx b/components/form/content/image-detail-form.tsx index 3cd600ca..9ff0264a 100644 --- a/components/form/content/image-detail-form.tsx +++ b/components/form/content/image-detail-form.tsx @@ -66,6 +66,7 @@ import { UnitMapping } from "@/app/[locale]/(protected)/contributor/agenda-setti import SuggestionModal from "@/components/modal/suggestions-modal"; import { formatDateToIndonesian } from "@/utils/globals"; import ApprovalHistoryModal from "@/components/modal/approval-history-modal"; +import Image from "next/image"; const imageSchema = z.object({ title: z.string().min(1, { message: "Judul diperlukan" }), @@ -437,6 +438,22 @@ export default function FormImageDetail() { successCallback(); }; + const [portraitMap, setPortraitMap] = useState({}); + + const handleImageLoad = (e: any, index: number) => { + const { naturalWidth, naturalHeight } = e.target; + const isPortrait = naturalHeight > naturalWidth; + + setPortraitMap((prev: any) => ({ + ...prev, + [index]: isPortrait, + })); + }; + + useEffect(() => { + console.log("portrai", portraitMap); + }, [portraitMap]); + return (
          {detail !== undefined ? ( @@ -513,19 +530,19 @@ export default function FormImageDetail() { thumbs={{ swiper: thumbsSwiper }} modules={[FreeMode, Navigation, Thumbs]} navigation={false} - className="w-full" + className="h-[480px] object-cover w-full" > {detailThumb?.map((data: any) => ( {` ))} -
          +
          ( {` @@ -579,11 +596,11 @@ export default function FormImageDetail() {
          - + Thumbnail Gambar Utama
          @@ -699,119 +716,139 @@ export default function FormImageDetail() { )} */} - + {t("leave-comment")} - {status == "2" - ? files?.map((file, index) => ( -
          - -
          -
          - {file.fileName} - - handleDeleteFileApproval(file.id) - } - > - - +
          + {status == "2" + ? files?.map((file, index) => ( +
          +
          + {`files-${index handleImageLoad(e, index)} + className={`h-[100px] object-cover ${ + portraitMap[index] ? "w-auto" : "!w-[200px]" + }`} + />
          - {isUserMabesApprover && ( -
          -
          - - setupPlacement(index, "all", Boolean(e)) - } - /> - -
          -
          - - setupPlacement(index, "mabes", Boolean(e)) - } - /> - -
          -
          - - setupPlacement(index, "polda", Boolean(e)) - } - /> - - {wilayahPublish.polda && ( - - setSelectedPolda(data) +
          + + {isUserMabesApprover && ( +
          +
          + + setupPlacement(index, "all", Boolean(e)) } /> - )} -
          - -
          - + {t("all")} + +
          +
          + + setupPlacement( + index, + "mabes", + Boolean(e) + ) + } + /> + +
          +
          + + setupPlacement( + index, + "polda", + Boolean(e) + ) + } + /> + + {wilayahPublish.polda && ( + + setSelectedPolda(data) + } + /> )} - onCheckedChange={(e) => - setupPlacement( - index, - "international", - Boolean(e) - ) - } - /> - +
          + +
          + + setupPlacement( + index, + "international", + Boolean(e) + ) + } + /> + +
          -
          - )} + )} +
          -
          - )) - : ""} + )) + : ""} +