Merge branch 'dev-anang' of https://gitlab.com/hanifsalafi/mediahub_redesign
This commit is contained in:
commit
6aaa433379
|
|
@ -299,6 +299,18 @@ export default function AddExpertForm() {
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
name="usernamefake"
|
||||||
|
autoComplete="username"
|
||||||
|
hidden
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
type="password"
|
||||||
|
name="passwordfake"
|
||||||
|
autoComplete="new-password"
|
||||||
|
hidden
|
||||||
|
/>
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="email"
|
name="email"
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ import { close, loading } from "@/config/swal";
|
||||||
import { Link, useRouter } from "@/i18n/routing";
|
import { Link, useRouter } from "@/i18n/routing";
|
||||||
import columns from "./popup-column";
|
import columns from "./popup-column";
|
||||||
import { listBanner, listStaticBanner } from "@/service/settings/settings";
|
import { listBanner, listStaticBanner } from "@/service/settings/settings";
|
||||||
|
import { listDataPopUp } from "@/service/broadcast/broadcast";
|
||||||
|
|
||||||
const PopUpListTable = () => {
|
const PopUpListTable = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
@ -47,6 +48,8 @@ const PopUpListTable = () => {
|
||||||
pageSize: Number(showData),
|
pageSize: Number(showData),
|
||||||
});
|
});
|
||||||
const [getData, setGetData] = React.useState<any>([]);
|
const [getData, setGetData] = React.useState<any>([]);
|
||||||
|
const [categoryFilter, setCategoryFilter] = React.useState<number[]>([]);
|
||||||
|
const [statusFilter, setStatusFilter] = React.useState<number[]>([]);
|
||||||
const dataChange = searchParams?.get("dataChange");
|
const dataChange = searchParams?.get("dataChange");
|
||||||
|
|
||||||
const [page, setPage] = React.useState(1);
|
const [page, setPage] = React.useState(1);
|
||||||
|
|
@ -95,7 +98,13 @@ const PopUpListTable = () => {
|
||||||
loading();
|
loading();
|
||||||
let temp: any;
|
let temp: any;
|
||||||
|
|
||||||
const response = await listBanner();
|
const response = await listDataPopUp(
|
||||||
|
page - 1,
|
||||||
|
showData,
|
||||||
|
"",
|
||||||
|
categoryFilter?.sort().join(","),
|
||||||
|
statusFilter?.sort().join(",")
|
||||||
|
);
|
||||||
const data = response?.data?.data?.content;
|
const data = response?.data?.data?.content;
|
||||||
console.log("banner", data);
|
console.log("banner", data);
|
||||||
setGetData(data);
|
setGetData(data);
|
||||||
|
|
|
||||||
|
|
@ -60,15 +60,16 @@ import {
|
||||||
PopoverContent,
|
PopoverContent,
|
||||||
PopoverTrigger,
|
PopoverTrigger,
|
||||||
} from "@/components/ui/popover";
|
} from "@/components/ui/popover";
|
||||||
import { listDataMedia } from "@/service/broadcast/broadcast";
|
import { listDataMedia, listDataPopUp } from "@/service/broadcast/broadcast";
|
||||||
import { listEnableCategory } from "@/service/content/content";
|
import { listEnableCategory } from "@/service/content/content";
|
||||||
import { Checkbox } from "@/components/ui/checkbox";
|
import { Checkbox } from "@/components/ui/checkbox";
|
||||||
import { close, loading } from "@/config/swal";
|
import { close, loading } from "@/config/swal";
|
||||||
import { Link } from "@/i18n/routing";
|
import { Link } from "@/i18n/routing";
|
||||||
import { data } from "jquery";
|
import { data } from "jquery";
|
||||||
import { useToast } from "@/components/ui/use-toast";
|
import { useToast } from "@/components/ui/use-toast";
|
||||||
import { setBanner } from "@/service/settings/settings";
|
import { setBanner, setPopUp } from "@/service/settings/settings";
|
||||||
import { id } from "date-fns/locale";
|
import { id } from "date-fns/locale";
|
||||||
|
import CustomPagination from "@/components/table/custom-pagination";
|
||||||
|
|
||||||
const ContentListPopUp = () => {
|
const ContentListPopUp = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
@ -129,7 +130,7 @@ const ContentListPopUp = () => {
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
try {
|
try {
|
||||||
loading();
|
loading();
|
||||||
const res = await listDataMedia(
|
const res = await listDataPopUp(
|
||||||
page - 1,
|
page - 1,
|
||||||
showData,
|
showData,
|
||||||
"",
|
"",
|
||||||
|
|
@ -203,7 +204,7 @@ const ContentListPopUp = () => {
|
||||||
|
|
||||||
const handleBanner = async (ids: number[]) => {
|
const handleBanner = async (ids: number[]) => {
|
||||||
try {
|
try {
|
||||||
await Promise.all(ids.map((id) => setBanner(id, true)));
|
await Promise.all(ids.map((id) => setPopUp(id, true)));
|
||||||
toast({
|
toast({
|
||||||
title: "Sukses",
|
title: "Sukses",
|
||||||
description: `${ids.length} item berhasil dijadikan banner.`,
|
description: `${ids.length} item berhasil dijadikan banner.`,
|
||||||
|
|
@ -369,7 +370,7 @@ const ContentListPopUp = () => {
|
||||||
</div>
|
</div>
|
||||||
{selectedItems.length > 0 && (
|
{selectedItems.length > 0 && (
|
||||||
<Button color="primary" onClick={() => handleBanner(selectedItems)}>
|
<Button color="primary" onClick={() => handleBanner(selectedItems)}>
|
||||||
Jadikan Banner
|
Jadikan PopUp
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -398,10 +399,15 @@ const ContentListPopUp = () => {
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-center mt-6">
|
<div className="mt-3">
|
||||||
<div className="border rounded px-3 py-1 text-sm text-gray-600">
|
{data && data?.length > 0 ? (
|
||||||
1
|
<CustomPagination
|
||||||
</div>
|
totalPage={totalPage}
|
||||||
|
onPageChange={(data) => setPage(data)}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<p>No Data</p>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,11 @@ import { formatDateToIndonesian, shimmer, toBase64 } from "@/utils/globals";
|
||||||
import React, { useEffect, useRef, useState } from "react";
|
import React, { useEffect, useRef, useState } from "react";
|
||||||
import "swiper/css/bundle";
|
import "swiper/css/bundle";
|
||||||
import "swiper/css/navigation";
|
import "swiper/css/navigation";
|
||||||
import { getHeroData, listStaticBanner } from "@/service/landing/landing";
|
import {
|
||||||
|
getHeroData,
|
||||||
|
listPopUp,
|
||||||
|
listStaticBanner,
|
||||||
|
} from "@/service/landing/landing";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useParams, usePathname, useRouter } from "next/navigation";
|
import { useParams, usePathname, useRouter } from "next/navigation";
|
||||||
import {
|
import {
|
||||||
|
|
@ -93,7 +97,7 @@ const HeroModal = ({
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
const response = await listStaticBanner(
|
const response = await listPopUp(
|
||||||
group === "mabes"
|
group === "mabes"
|
||||||
? ""
|
? ""
|
||||||
: group === "polda" && poldaName && String(poldaName)?.length > 1
|
: group === "polda" && poldaName && String(poldaName)?.length > 1
|
||||||
|
|
@ -101,21 +105,15 @@ const HeroModal = ({
|
||||||
: group === "satker" && satkerName && String(satkerName)?.length > 1
|
: group === "satker" && satkerName && String(satkerName)?.length > 1
|
||||||
? "satker-" + satkerName
|
? "satker-" + satkerName
|
||||||
: "",
|
: "",
|
||||||
locale == "en"
|
locale == "en"
|
||||||
);
|
);
|
||||||
|
|
||||||
const banners =
|
const banners = response?.data?.data || [];
|
||||||
response?.data?.data?.map((item: any) => {
|
|
||||||
const media = item?.mediaUpload;
|
|
||||||
if (media?.fileType) {
|
|
||||||
media.fileTypeId = media.fileType.id;
|
|
||||||
}
|
|
||||||
return media;
|
|
||||||
}) || [];
|
|
||||||
|
|
||||||
console.log("banner Modal", banners);
|
console.log("banner Modal", banners);
|
||||||
setHeroData(banners);
|
setHeroData(banners);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="fixed inset-0 flex items-center justify-center backdrop-brightness-50 z-50 ">
|
<div className="fixed inset-0 flex items-center justify-center backdrop-brightness-50 z-50 ">
|
||||||
<div className="relative dark:bg-gray-900 rounded-lg w-[90%] md:w-[600px] p-4 shadow-none">
|
<div className="relative dark:bg-gray-900 rounded-lg w-[90%] md:w-[600px] p-4 shadow-none">
|
||||||
|
|
@ -311,7 +309,7 @@ const HeroNew = (props: { group?: string }) => {
|
||||||
String(satkerName)?.length > 1
|
String(satkerName)?.length > 1
|
||||||
? "satker-" + satkerName
|
? "satker-" + satkerName
|
||||||
: "",
|
: "",
|
||||||
locale == "en"
|
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;
|
||||||
|
|
|
||||||
|
|
@ -535,10 +535,10 @@ const LoginForm = () => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="button"
|
||||||
fullWidth
|
fullWidth
|
||||||
// onClick={handleEmailValidation}
|
onClick={handleEmailValidation}
|
||||||
// disabled={isPending}
|
disabled={isPending}
|
||||||
>
|
>
|
||||||
Selanjutnya
|
Selanjutnya
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
228
lib/menus.ts
228
lib/menus.ts
|
|
@ -2383,11 +2383,231 @@ export function getMenuList(pathname: string, t: any): Group[] {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
} else if (Number(roleId) == 4 && Number(levelNumber) == 3) {
|
||||||
|
menusSelected = [
|
||||||
|
{
|
||||||
|
groupLabel: t("apps"),
|
||||||
|
id: "dashboard",
|
||||||
|
menus: [
|
||||||
|
{
|
||||||
|
id: "dashboard",
|
||||||
|
href: "/dashboard",
|
||||||
|
label: t("dashboard"),
|
||||||
|
active: pathname.includes("/dashboard"),
|
||||||
|
icon: "material-symbols:dashboard",
|
||||||
|
submenus: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
groupLabel: "",
|
||||||
|
id: "content",
|
||||||
|
menus: [
|
||||||
|
{
|
||||||
|
id: "content",
|
||||||
|
href: "/contributor/content/image",
|
||||||
|
label: t("content"),
|
||||||
|
active: pathname.includes("/content"),
|
||||||
|
icon: "line-md:youtube",
|
||||||
|
submenus: [
|
||||||
|
{
|
||||||
|
href: "/contributor/content/image",
|
||||||
|
label: t("image"),
|
||||||
|
active: pathname.includes("/content/image"),
|
||||||
|
icon: "ic:outline-image",
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: "/contributor/content/video",
|
||||||
|
label: t("video"),
|
||||||
|
active: pathname.includes("/content/video"),
|
||||||
|
icon: "line-md:youtube",
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: "/contributor/content/teks",
|
||||||
|
label: t("text"),
|
||||||
|
active: pathname.includes("/content/teks"),
|
||||||
|
icon: "heroicons:document",
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: "/contributor/content/audio",
|
||||||
|
label: t("audio"),
|
||||||
|
active: pathname.includes("/content/audio"),
|
||||||
|
icon: "heroicons:share",
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// href: "/contributor/content/spit",
|
||||||
|
// label: "spit",
|
||||||
|
// active: pathname.includes("/content/spit"),
|
||||||
|
// icon: "heroicons:credit-card",
|
||||||
|
// children: [],
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// href: "/contributor/content/nulis-ai",
|
||||||
|
// label: "nulis ai",
|
||||||
|
// active: pathname.includes("/content/nulisai"),
|
||||||
|
// icon: "heroicons:credit-card",
|
||||||
|
// children: [],
|
||||||
|
// },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
groupLabel: "",
|
||||||
|
id: "agenda-setting",
|
||||||
|
menus: [
|
||||||
|
{
|
||||||
|
id: "agenda-setting",
|
||||||
|
href: "/contributor/agenda-setting",
|
||||||
|
label: t("agenda-setting"),
|
||||||
|
active: pathname.includes("/agenda-setting"),
|
||||||
|
icon: "iconoir:journal-page",
|
||||||
|
submenus: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
groupLabel: "",
|
||||||
|
id: "planning",
|
||||||
|
menus: [
|
||||||
|
{
|
||||||
|
id: "planning",
|
||||||
|
href: "/contributor/planning",
|
||||||
|
label: t("planning"),
|
||||||
|
active: pathname.includes("/planning"),
|
||||||
|
icon: "pajamas:planning",
|
||||||
|
submenus: [
|
||||||
|
{
|
||||||
|
href: "/contributor/planning/mediahub",
|
||||||
|
label: "mediaHub",
|
||||||
|
active: pathname.includes("/planning/mediahub"),
|
||||||
|
icon: "heroicons:arrow-trending-up",
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: "/contributor/planning/medsos-mediahub",
|
||||||
|
label: "medsos mediahub",
|
||||||
|
active: pathname.includes("/planning/medsos-mediahub"),
|
||||||
|
icon: "heroicons:shopping-cart",
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
groupLabel: "",
|
||||||
|
id: "task",
|
||||||
|
menus: [
|
||||||
|
{
|
||||||
|
id: "task",
|
||||||
|
href: "/contributor/task",
|
||||||
|
label: t("task"),
|
||||||
|
active: pathname.includes("/task"),
|
||||||
|
icon: "fluent:clipboard-task-add-24-regular",
|
||||||
|
submenus: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
groupLabel: "",
|
||||||
|
id: "schedule",
|
||||||
|
menus: [
|
||||||
|
{
|
||||||
|
id: "schedule",
|
||||||
|
href: "/contributor/schedule",
|
||||||
|
label: t("schedule"),
|
||||||
|
active: pathname.includes("/schedule"),
|
||||||
|
icon: "uil:schedule",
|
||||||
|
submenus: [
|
||||||
|
{
|
||||||
|
href: "/contributor/schedule/press-conference",
|
||||||
|
label: t("press-conference"),
|
||||||
|
active: pathname.includes("/schedule/press-conference"),
|
||||||
|
icon: "heroicons:arrow-trending-up",
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: "/contributor/schedule/event",
|
||||||
|
label: t("event"),
|
||||||
|
active: pathname.includes("/schedule/event"),
|
||||||
|
icon: "heroicons:shopping-cart",
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: "/contributor/schedule/press-release",
|
||||||
|
label: t("press-release"),
|
||||||
|
active: pathname.includes("/schedule/press-release"),
|
||||||
|
icon: "heroicons:shopping-cart",
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
groupLabel: "",
|
||||||
|
id: "blog",
|
||||||
|
menus: [
|
||||||
|
{
|
||||||
|
id: "blog",
|
||||||
|
href: "/contributor/blog",
|
||||||
|
label: t("blog"),
|
||||||
|
active: pathname.includes("/blog"),
|
||||||
|
icon: "fluent:clipboard-text-32-regular",
|
||||||
|
submenus: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
groupLabel: "",
|
||||||
|
id: "curatedcontent",
|
||||||
|
menus: [
|
||||||
|
{
|
||||||
|
id: "curatedcontent",
|
||||||
|
href: "/shared/curated-content",
|
||||||
|
label: t("curated-content"),
|
||||||
|
active: pathname.includes("/curated-content"),
|
||||||
|
icon: "pixelarticons:calendar-text",
|
||||||
|
submenus: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
groupLabel: "",
|
||||||
|
id: "communication",
|
||||||
|
menus: [
|
||||||
|
{
|
||||||
|
id: "communication",
|
||||||
|
href: "/shared/communication",
|
||||||
|
label: t("communication"),
|
||||||
|
active: pathname.includes("/communication"),
|
||||||
|
icon: "token:chat",
|
||||||
|
submenus: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
groupLabel: "",
|
||||||
|
id: "contest",
|
||||||
|
menus: [
|
||||||
|
{
|
||||||
|
id: "contest",
|
||||||
|
href: "/shared/contest",
|
||||||
|
label: t("contest"),
|
||||||
|
active: pathname.includes("/contest"),
|
||||||
|
icon: "ic:outline-emoji-events",
|
||||||
|
submenus: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
} else if (
|
} else if (
|
||||||
(Number(roleId) == 3 ||
|
(Number(roleId) == 3 || Number(roleId) == 14 || Number(roleId) == 15) &&
|
||||||
Number(roleId) == 4 ||
|
|
||||||
Number(roleId) == 14 ||
|
|
||||||
Number(roleId) == 15) &&
|
|
||||||
Number(levelNumber) == 3
|
Number(levelNumber) == 3
|
||||||
) {
|
) {
|
||||||
if (Number(userParentLevelId) != 761) {
|
if (Number(userParentLevelId) != 761) {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ export async function listDataMedia(
|
||||||
export async function listDataAdvertisements(
|
export async function listDataAdvertisements(
|
||||||
page: number,
|
page: number,
|
||||||
limit: string,
|
limit: string,
|
||||||
search: string,
|
search: string
|
||||||
) {
|
) {
|
||||||
const name = search || "";
|
const name = search || "";
|
||||||
const url = `advertisements/pagination?title=${search}&enablePage=1&sortBy=createdAt&sort=desc&size=${limit}&page=${page}`;
|
const url = `advertisements/pagination?title=${search}&enablePage=1&sortBy=createdAt&sort=desc&size=${limit}&page=${page}`;
|
||||||
|
|
@ -99,3 +99,15 @@ export async function saveMediaBlastBroadcast(data: any) {
|
||||||
const url = `media/blast/broadcast`;
|
const url = `media/blast/broadcast`;
|
||||||
return httpPostInterceptor(url, data);
|
return httpPostInterceptor(url, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function listDataPopUp(
|
||||||
|
page: number,
|
||||||
|
limit: string,
|
||||||
|
search: string,
|
||||||
|
categoryFilter: string,
|
||||||
|
statusFilter: string
|
||||||
|
) {
|
||||||
|
const name = search || "";
|
||||||
|
const url = `media/interstitial/pagination?isForAdmin=true&title=${name}&enablePage=1&sortBy=createdAt&sort=desc&size=${limit}&page=${page}&typeId=1&categoryId=${categoryFilter}&statusId=${statusFilter}`;
|
||||||
|
return httpGetInterceptor(url);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,11 @@ export async function listStaticBanner(
|
||||||
return httpGetInterceptor(url);
|
return httpGetInterceptor(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function listPopUp(group: any = "", isInt: Boolean = false) {
|
||||||
|
const url = `media/public/interstitial?group=${group}&isInt=${isInt}`;
|
||||||
|
return httpGetInterceptor(url);
|
||||||
|
}
|
||||||
|
|
||||||
export async function getPublicCategoryData(
|
export async function getPublicCategoryData(
|
||||||
group: any = "",
|
group: any = "",
|
||||||
type: string = "",
|
type: string = "",
|
||||||
|
|
|
||||||
|
|
@ -147,3 +147,8 @@ export async function deleteAdvertisements(id: string | number) {
|
||||||
const url = `advertisements?id=${id}`;
|
const url = `advertisements?id=${id}`;
|
||||||
return httpDeleteInterceptor(url);
|
return httpDeleteInterceptor(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function setPopUp(id: number, status: boolean) {
|
||||||
|
const url = `media/interstitial?id=${id}&status=${status}`;
|
||||||
|
return httpPostInterceptor(url);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue