This commit is contained in:
Rama Priyanto 2025-03-18 15:30:18 +07:00
parent a01825a40a
commit 8058f42f2f
26 changed files with 464 additions and 355 deletions

View File

@ -1,22 +1,10 @@
"use client";
import { HumasLayout } from "@/components/layout/humas-layout"; import { HumasLayout } from "@/components/layout/humas-layout";
import ListEnewsPolri from "@/components/table/tabel-emajalah-polri"; import ListEnewsPolri from "@/components/table/tabel-emajalah-polri";
import React, { Suspense, useEffect, useState } from "react";
export default function ListEnewsPage() { export default function ListEnewsPage() {
const [hasMounted, setHasMounted] = useState(false);
useEffect(() => {
setHasMounted(true);
}, []);
// Render
if (!hasMounted) return null;
return ( return (
<HumasLayout> <HumasLayout>
<Suspense>
<ListEnewsPolri /> <ListEnewsPolri />
</Suspense>
</HumasLayout> </HumasLayout>
); );
} }

View File

@ -16,7 +16,7 @@ export default function Home() {
<HeaderNews /> <HeaderNews />
<BodyLayout /> <BodyLayout />
<Suspense> <Suspense>
<FooterNew /> <FooterNew margin={true} />
</Suspense> </Suspense>
</section> </section>
</> </>

View File

@ -110,6 +110,7 @@ export default function EditArticleForm(props: { isDetail: boolean }) {
const params = useParams(); const params = useParams();
const id = params?.id; const id = params?.id;
const username = Cookies.get("username"); const username = Cookies.get("username");
const userId = Cookies.get("uie");
const animatedComponents = makeAnimated(); const animatedComponents = makeAnimated();
const MySwal = withReactContent(Swal); const MySwal = withReactContent(Swal);
const router = useRouter(); const router = useRouter();
@ -235,6 +236,44 @@ export default function EditArticleForm(props: { isDetail: boolean }) {
}); });
}; };
const doPublish = async () => {
MySwal.fire({
title: "Publish Artikel?",
text: "",
icon: "warning",
showCancelButton: true,
cancelButtonColor: "#d33",
confirmButtonColor: "#3085d6",
confirmButtonText: "Submit",
}).then((result) => {
if (result.isConfirmed) {
publish();
}
});
};
const publish = async () => {
const response = await updateArticle(String(id), {
id: Number(id),
isPublish: true,
title: detailData?.title,
typeId: 1,
slug: detailData?.slug,
categoryIds: getValues("category")
.map((val) => val.id)
.join(","),
tags: getValues("tags").join(","),
description: htmlToString(getValues("description")),
htmlDescription: getValues("description"),
});
if (response?.error) {
error(response.message);
return false;
}
successSubmit("/admin/article");
};
const save = async (values: z.infer<typeof createArticleSchema>) => { const save = async (values: z.infer<typeof createArticleSchema>) => {
loading(); loading();
const formData = { const formData = {
@ -889,6 +928,7 @@ export default function EditArticleForm(props: { isDetail: boolean }) {
</Button> </Button>
)} )}
{isDetail && {isDetail &&
username === "admin-mabes" &&
(detailData?.statusId === 1 || detailData?.statusId === null) && ( (detailData?.statusId === 1 || detailData?.statusId === null) && (
<Button <Button
color="danger" color="danger"
@ -906,6 +946,14 @@ export default function EditArticleForm(props: { isDetail: boolean }) {
Simpan Simpan
</Button> </Button>
)} )}
{isDetail &&
detailData?.isPublish === false &&
detailData?.statusId !== 1 &&
Number(userId) === detailData?.createdById && (
<Button color="primary" onPress={doPublish}>
Publish
</Button>
)}
{/* {!isDetail && ( {/* {!isDetail && (
<Button color="success" type="button"> <Button color="success" type="button">
<p className="text-white">Draft</p> <p className="text-white">Draft</p>

View File

@ -315,12 +315,14 @@ export default function HeaderNews() {
</div> </div>
))} ))}
</ScrollShadow> </ScrollShadow>
<Link href="/news/all">
<Button <Button
className="w-full bg-gradient-to-r from-red-700 to-[#bb3523] text-white font-bold rounded-md focus:outline-none" className="w-full bg-gradient-to-r from-red-700 to-[#bb3523] text-white font-bold rounded-md focus:outline-none"
radius="none" radius="none"
> >
Lihat Semua Lihat Semua
</Button> </Button>
</Link>
</div> </div>
) : ( ) : (
<div className="lg:!h-[50vh] p-2 dark:bg-stone-800 bg-[#f0f0f0] text-black dark:text-white rounded-lg"> <div className="lg:!h-[50vh] p-2 dark:bg-stone-800 bg-[#f0f0f0] text-black dark:text-white rounded-lg">

View File

@ -46,7 +46,7 @@ export default function NewsTicker() {
}, [article]); }, [article]);
return ( return (
<div className="fixed bottom-0 z-50 flex flex-row h-[60px] lg:h-[7vh] gap-3 w-full justify-between dark:bg-stone-800 bg-gray-50"> <div className="fixed bottom-0 z-50 flex flex-row h-[60px] gap-3 w-full justify-between dark:bg-stone-800 bg-gray-50">
<div className="relative px-4 py-2 font-semibold text-xs lg:text-sm flex items-center bg-[#bb3523] text-white w-[30%] lg:w-[10%]"> <div className="relative px-4 py-2 font-semibold text-xs lg:text-sm flex items-center bg-[#bb3523] text-white w-[30%] lg:w-[10%]">
<span className="mr-2"></span> BREAKING NEWS <span className="mr-2"></span> BREAKING NEWS
<div className="absolute right-0 top-0 h-full w-4 bg-[#bb3523] transform translate-x-full clipPath-triangle"></div> <div className="absolute right-0 top-0 h-full w-4 bg-[#bb3523] transform translate-x-full clipPath-triangle"></div>

View File

@ -15,12 +15,16 @@ import { useTranslations } from "next-intl";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import Image from "next/image"; import Image from "next/image";
export default function FooterNew() { export default function FooterNew(props: { margin?: boolean }) {
const t2 = useTranslations("Navbar"); const t2 = useTranslations("Navbar");
const t3 = useTranslations("LandingInformasiPublik"); const t3 = useTranslations("LandingInformasiPublik");
return ( return (
<div className="mb-[60px] relative text-xs leading-4 md:leading-loose lg:leading-8 font-semibold"> <div
className={`${
props?.margin ? "mb-[60px]" : ""
} relative text-xs leading-4 md:leading-loose lg:leading-8 font-semibold`}
>
<div className="py-10 w-full lg:w-[70%] flex flex-col gap-4 px-6 lg:px-0 lg:mx-auto"> <div className="py-10 w-full lg:w-[70%] flex flex-col gap-4 px-6 lg:px-0 lg:mx-auto">
<div className="flex justify-center text-xl lg:text-2xl"> <div className="flex justify-center text-xl lg:text-2xl">
Channel Humas Polri Channel Humas Polri

View File

@ -61,6 +61,9 @@ export default function SocialMediaNew() {
selectedKey={selectedTab} selectedKey={selectedTab}
onSelectionChange={setSelectedTab} onSelectionChange={setSelectedTab}
> >
<Tab key="fb" title="Facebook">
<FacebookWidgetNew />
</Tab>
<Tab key="x" title="X"> <Tab key="x" title="X">
<TwitterWidget /> <TwitterWidget />
</Tab> </Tab>
@ -70,9 +73,7 @@ export default function SocialMediaNew() {
<Tab key="yt" title="Youtube"> <Tab key="yt" title="Youtube">
<YoutubeWidget /> <YoutubeWidget />
</Tab> </Tab>
<Tab key="fb" title="Facebook">
<FacebookWidgetNew />
</Tab>
<Tab key="tiktok" title="Tiktok"> <Tab key="tiktok" title="Tiktok">
<TiktokWidget /> <TiktokWidget />
</Tab> </Tab>

View File

@ -20,14 +20,14 @@ export const HumasLayout = ({ children }: Props) => {
// Render // Render
if (!hasMounted) return null; if (!hasMounted) return null;
return ( return (
<section className="flex flex-col"> <section className="flex flex-col !min-h-screen">
<NavbarHumas size="sm" /> <NavbarHumas size="sm" />
<NavbarHumas size="lg" /> <NavbarHumas size="lg" />
<NewsTicker /> {/* <NewsTicker /> */}
{children} {children}
<Suspense> <Suspense>
<FooterNew /> <FooterNew margin={false} />
</Suspense> </Suspense>
</section> </section>
); );

View File

@ -58,9 +58,9 @@ export default function EMagazineDetail() {
} }
}; };
return ( return (
<div className="w-auto bg-[#E2E2E2] text-black"> <div className="bg-white dark:bg-stone-900">
<div className="p-1 md:p-5 lg:px-36"> <div className="px-5 lg:px-0 lg:w-[75vw] lg:mx-auto py-8">
<div className="flex flex-row gap-4 items-end text-black"> <div className="flex flex-row gap-4 items-end ">
<Link href="/" className=" font-semibold text-lg"> <Link href="/" className=" font-semibold text-lg">
Beranda Beranda
</Link> </Link>
@ -141,13 +141,15 @@ export default function EMagazineDetail() {
</div> </div>
</div> </div>
</div> </div>
<Link href={file?.fileUrl} target="_blank">
<Button <Button
className="w-full bg-[#DD8306] text-sm font-semibold text-white mt-2" className="w-full bg-[#DD8306] text-sm font-semibold text-white mt-2"
radius="sm" radius="sm"
onPress={() => doDownload(file?.fileName, file?.title)} // onPress={() => doDownload(file?.fileName, file?.title)}
> >
Download File
</Button> </Button>
</Link>
</AccordionItem> </AccordionItem>
</Accordion> </Accordion>
))} ))}

View File

@ -3,6 +3,7 @@ import {
BreadcrumbItem, BreadcrumbItem,
Breadcrumbs, Breadcrumbs,
Button, Button,
Image,
Input, Input,
Pagination, Pagination,
} from "@heroui/react"; } from "@heroui/react";
@ -19,7 +20,6 @@ import Link from "next/link";
import { useEffect, useRef, useState } from "react"; import { useEffect, useRef, useState } from "react";
import { getListArticle } from "@/service/article"; import { getListArticle } from "@/service/article";
import { formatMonthString, htmlToString, textEllipsis } from "@/utils/global"; import { formatMonthString, htmlToString, textEllipsis } from "@/utils/global";
import Image from "next/image";
import { import {
useParams, useParams,
usePathname, usePathname,
@ -52,8 +52,13 @@ export default function ListNews() {
page: page, page: page,
search: searchValue || "", search: searchValue || "",
limit: "9", limit: "9",
category: String(category), // isPublish: pathname.includes("polda") ? false : true,
isPublish: true, isPublish: true,
sort: "desc",
categorySlug:
pathname.includes("polda") || pathname.includes("satker")
? String(category)
: "",
}; };
const response = await getListArticle(req); const response = await getListArticle(req);
setArticle(response?.data?.data); setArticle(response?.data?.data);
@ -121,9 +126,8 @@ export default function ListNews() {
: news.thumbnailUrl : news.thumbnailUrl
} }
width={1920} width={1920}
height={1080}
alt="thumbnail" alt="thumbnail"
className="rounded-t-md h-[27vh] w-full object-cover" className="rounded-b-none h-[27vh] w-full object-cover"
/> />
</div> </div>
<div className="p-2 lg:p-5 bg-[#f0f0f0] rounded-b-md"> <div className="p-2 lg:p-5 bg-[#f0f0f0] rounded-b-md">

View File

@ -8,7 +8,7 @@ import {
EyeIconMdi, EyeIconMdi,
SearchIcon, SearchIcon,
} from "@/components/icons"; } from "@/components/icons";
import { error, success, successToast } from "@/config/swal"; import { close, error, loading, success, successToast } from "@/config/swal";
import { import {
deleteArticle, deleteArticle,
getArticleByCategory, getArticleByCategory,
@ -53,6 +53,15 @@ const columns = [
{ name: "Status", uid: "isPublish" }, { name: "Status", uid: "isPublish" },
{ name: "Aksi", uid: "actions" }, { name: "Aksi", uid: "actions" },
]; ];
const columnsOtherRole = [
{ name: "No", uid: "no" },
{ name: "Judul", uid: "title" },
{ name: "Kategori", uid: "category" },
{ name: "Tanggal Unggah", uid: "createdAt" },
{ name: "Kreator", uid: "createdByName" },
{ name: "Status", uid: "isPublish" },
{ name: "Aksi", uid: "actions" },
];
interface Category { interface Category {
id: number; id: number;
@ -68,13 +77,14 @@ type ArticleData = Article & {
export default function ArticleTable() { export default function ArticleTable() {
const MySwal = withReactContent(Swal); const MySwal = withReactContent(Swal);
const username = Cookies.get("username"); const username = Cookies.get("username");
const userId = Cookies.get("uie");
const [page, setPage] = useState(1); const [page, setPage] = useState(1);
const [totalPage, setTotalPage] = useState(1); const [totalPage, setTotalPage] = useState(1);
const [article, setArticle] = useState<any[]>([]); const [article, setArticle] = useState<any[]>([]);
const [showData, setShowData] = useState("10"); const [showData, setShowData] = useState("10");
const [search, setSearch] = useState(""); const [search, setSearch] = useState("");
const [categories, setCategoies] = useState<any>([]); const [categories, setCategories] = useState<any>([]);
const [selectedCategories, setSelectedCategories] = useState<any>([]); const [selectedCategories, setSelectedCategories] = useState<any>([]);
const [startDateValue, setStartDateValue] = useState({ const [startDateValue, setStartDateValue] = useState({
startDate: null, startDate: null,
@ -92,27 +102,29 @@ export default function ArticleTable() {
async function getCategories() { async function getCategories() {
const res = await getArticleByCategory(); const res = await getArticleByCategory();
const data = res?.data?.data; const data = res?.data?.data;
setCategoies(data); setCategories(data);
} }
async function initState() { async function initState() {
loading();
const req = { const req = {
limit: showData, limit: showData,
page: page, page: page,
search: search, search: search,
startDate: // startDate:
startDateValue.startDate === null ? "" : startDateValue.startDate, // startDateValue.startDate === null ? "" : startDateValue.startDate,
endDate: startDateValue.endDate === null ? "" : startDateValue.endDate, // endDate: startDateValue.endDate === null ? "" : startDateValue.endDate,
category: Array.from(selectedCategories).join(","), categorySlug: Array.from(selectedCategories).join(","),
sort: "desc", sort: "desc",
sortBy: "created_at", sortBy: "created_at",
}; };
const res = await getListArticle(req); const res = await getListArticle(req);
getTableNumber(parseInt(showData), res.data?.data); await getTableNumber(parseInt(showData), res.data?.data);
setTotalPage(res?.data?.meta?.totalPage); setTotalPage(res?.data?.meta?.totalPage);
close();
} }
const getTableNumber = (limit: number, data: Article[]) => { const getTableNumber = async (limit: number, data: Article[]) => {
if (data) { if (data) {
const startIndex = limit * (page - 1); const startIndex = limit * (page - 1);
let iterate = 0; let iterate = 0;
@ -227,11 +239,22 @@ export default function ArticleTable() {
Detail Detail
</Link> </Link>
</DropdownItem> </DropdownItem>
<DropdownItem key="edit"> <DropdownItem
key="edit"
className={
username === "admin-mabes" ||
Number(userId) === article.createdById
? ""
: "hidden"
}
>
{(username === "admin-mabes" ||
Number(userId) === article.createdById) && (
<Link href={`/admin/article/edit/${article.id}`}> <Link href={`/admin/article/edit/${article.id}`}>
<CreateIconIon className="inline mr-2 mb-1" /> <CreateIconIon className="inline mr-2 mb-1" />
Edit Edit
</Link> </Link>
)}
</DropdownItem> </DropdownItem>
<DropdownItem <DropdownItem
key="setBanner" key="setBanner"
@ -252,13 +275,25 @@ export default function ArticleTable() {
<DropdownItem <DropdownItem
key="delete" key="delete"
onPress={() => handleDelete(article.id)} onPress={() => handleDelete(article.id)}
className={
username === "admin-mabes" ||
Number(userId) === article.createdById
? ""
: "hidden"
}
> >
{(username === "admin-mabes" ||
Number(userId) === article.createdById) && (
<>
{" "}
<DeleteIcon <DeleteIcon
color="red" color="red"
size={18} size={18}
className="inline ml-1 mr-2 mb-1" className="inline ml-1 mr-2 mb-1"
/> />
Delete Delete
</>
)}
</DropdownItem> </DropdownItem>
</DropdownMenu> </DropdownMenu>
</Dropdown> </Dropdown>
@ -269,7 +304,7 @@ export default function ArticleTable() {
return cellValue; return cellValue;
} }
}, },
[article] [article, page]
); );
let typingTimer: NodeJS.Timeout; let typingTimer: NodeJS.Timeout;
@ -285,6 +320,7 @@ export default function ArticleTable() {
}; };
async function doneTyping() { async function doneTyping() {
setPage(1);
initState(); initState();
} }
@ -346,7 +382,7 @@ export default function ArticleTable() {
variant="bordered" variant="bordered"
labelPlacement="outside" labelPlacement="outside"
placeholder="Kategori" placeholder="Kategori"
selectionMode="multiple" selectionMode="single"
selectedKeys={selectedCategories} selectedKeys={selectedCategories}
className="w-full" className="w-full"
items={categories} items={categories}
@ -358,13 +394,13 @@ export default function ArticleTable() {
key={item.props?.value} key={item.props?.value}
className="text-black dark:text-white text-xs" className="text-black dark:text-white text-xs"
> >
{item.textValue}, {item.textValue}
</span> </span>
)); ));
}} }}
> >
{categories?.map((category: any) => ( {categories?.map((category: any) => (
<SelectItem key={category?.slug} value={category?.id}> <SelectItem key={category?.slug} value={category?.slug}>
{category?.title} {category?.title}
</SelectItem> </SelectItem>
))} ))}
@ -390,7 +426,9 @@ export default function ArticleTable() {
"min-h-[50px] bg-transpararent text-black dark:text-white ", "min-h-[50px] bg-transpararent text-black dark:text-white ",
}} }}
> >
<TableHeader columns={columns}> <TableHeader
columns={username === "admin-mabes" ? columns : columnsOtherRole}
>
{(column) => ( {(column) => (
<TableColumn key={column.uid}>{column.name}</TableColumn> <TableColumn key={column.uid}>{column.name}</TableColumn>
)} )}

View File

@ -66,6 +66,7 @@ import {
getFeedbacks, getFeedbacks,
getFeedbacksById, getFeedbacksById,
} from "@/service/feedbacks"; } from "@/service/feedbacks";
import * as XLSX from "xlsx";
const columns = [ const columns = [
{ name: "No", uid: "no" }, { name: "No", uid: "no" },
@ -301,6 +302,51 @@ export default function SuggestionsTable() {
); );
const [typeDate, setTypeDate] = useState("monthly"); const [typeDate, setTypeDate] = useState("monthly");
const doExport = async () => {
const res = await getFeedbacks({ limit: showData, search: search });
if (res?.data?.data) {
exportRecap(res?.data?.data);
}
};
const exportRecap = (data: any) => {
let temp: any = [];
let no = 0;
const worksheet = XLSX.utils.json_to_sheet([]);
data.map((list: any) => {
no += 1;
const now = [
no,
list.commentFromName,
list.commentFromEmail,
list.message,
];
temp.push(now);
});
XLSX.utils.sheet_add_aoa(
worksheet,
[["No", "Nama", "Email", "Kritik & Saran"]],
{
origin: "A1",
}
);
XLSX.utils.sheet_add_json(worksheet, temp, {
origin: "A2",
skipHeader: true,
});
worksheet["!cols"] = [{ wch: 7 }, { wch: 24 }, { wch: 24 }, { wch: 48 }];
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, "ethic");
XLSX.writeFile(workbook, `Kritik Saran.xlsx`);
};
return ( return (
<> <>
<div className="flex flex-row gap-2 items-center"> <div className="flex flex-row gap-2 items-center">
@ -399,7 +445,7 @@ export default function SuggestionsTable() {
</SelectItem> </SelectItem>
</Select> </Select>
</div> </div>
<Button color="primary" className="text-white"> <Button color="primary" className="text-white" onPress={doExport}>
Export Export
</Button> </Button>
</div> </div>

View File

@ -102,10 +102,9 @@ export default function ListEnewsPolri() {
} }
return ( return (
<div className="md:flex "> <div className="bg-white dark:bg-stone-900">
<div className="w-auto bg-[#E2E2E2] md:w-2/3 lg:w-[75%] text-black"> <div className="px-5 lg:px-0 lg:w-[75vw] lg:mx-auto py-8">
<div className="p-1 md:py-5 lg:px-36"> <div className="flex flex-row gap-4 items-end ">
<div className="flex flex-row gap-4 items-end text-black">
<Link href="/" className=" font-semibold text-lg"> <Link href="/" className=" font-semibold text-lg">
Beranda Beranda
</Link> </Link>
@ -113,19 +112,11 @@ export default function ListEnewsPolri() {
<p className=" font-semibold text-lg">E-Majalah Polri</p> <p className=" font-semibold text-lg">E-Majalah Polri</p>
</div> </div>
<div className="pt-4 space-y-5 "> <div className="pt-4 space-y-5 ">
{/* <div className="font-semibold text-lg border-b-4 border-red-700 leading-loose">
E-majalah Polri
</div> */}
<div className="flex items-end gap-3 flex-col md:flex-row"> <div className="flex items-end gap-3 flex-col md:flex-row">
<Input <Input
aria-label="Search" aria-label="Search"
classNames={{ classNames={{
input: [ input: ["w-full", "bg-transparent", "h-[20px]", "!text-black"],
"w-full",
"bg-transparent",
"h-[20px]",
"!text-black",
],
mainWrapper: ["w-full", "bg-transparent"], mainWrapper: ["w-full", "bg-transparent"],
innerWrapper: ["bg-transparent", "h-[20px]"], innerWrapper: ["bg-transparent", "h-[20px]"],
inputWrapper: [ inputWrapper: [
@ -157,51 +148,21 @@ export default function ListEnewsPolri() {
</Button> </Button>
} }
/> />
{/* <Select
label="Sort By"
size="sm"
className="w-1/5"
classNames={{
// base: "bg-red-500",
// mainWrapper: "border-2 border-red-500",
label: "text-black",
value: "!text-black",
trigger: "bg-white hover:!bg-gray-100",
// innerWrapper: "bg-red-500"
// selectorIcon: "bg-red-500"
// listboxWrapper: "bg-red-500"
// listbox: "bg-red-500"
popoverContent: "bg-white",
}}
listboxProps={{
itemClasses: {
base: "text-black",
wrapper: "!bg-white ",
},
}}
// onChange={onChangeFilterEnterprising}
>
<SelectSection>
{category.map((list: any) => (
<SelectItem key={list.id}>{list.label}</SelectItem>
))}
</SelectSection>
</Select> */}
<div className="flex flex-col gap-1 w-full md:w-[240px]"> <div className="flex flex-col gap-1 w-full md:w-[240px]">
<p className="font-semibold text-xs md:text-sm"> <p className="font-semibold text-xs md:text-sm">
Tanggal Publikasi Tanggal Publikasi
</p> </p>
<Datepicker {/* <Datepicker
value={startDateValue} value={startDateValue}
displayFormat="DD/MM/YYYY" displayFormat="DD/MM/YYYY"
useRange={false} useRange={false}
asSingle={true} asSingle={true}
onChange={(e: any) => setStartDateValue(e)} onChange={(e: any) => setStartDateValue(e)}
inputClassName="z-50 w-full text-sm bg-white border-1 border-gray-200 px-2 py-[6px] rounded-xl h-[40px] text-black" inputClassName="z-50 w-full text-sm bg-white border-1 border-gray-200 px-2 py-[6px] rounded-xl h-[40px] text-black"
/> /> */}
</div> </div>
</div> </div>
<div>
<div className="flex flex-col gap-3"> <div className="flex flex-col gap-3">
<Table <Table
color="warning" color="warning"
@ -209,7 +170,6 @@ export default function ListEnewsPolri() {
classNames={{ classNames={{
wrapper: "bg-white", wrapper: "bg-white",
base: "font-bold", base: "font-bold",
// th: " border-2 border-red-500 text-xs",
td: "font-medium", td: "font-medium",
}} }}
> >
@ -259,10 +219,5 @@ export default function ListEnewsPolri() {
</div> </div>
</div> </div>
</div> </div>
</div>
<div className="w-auto md:w-1/3 lg:w-[25%] px-2 md:px-4 py-2 text-black">
<SidebarNav />
</div>
</div>
); );
} }

View File

@ -16,14 +16,10 @@ const PolriTvWidget = () => {
}, []); }, []);
return ( return (
<div className="h-[310px]"> <div
<iframe className="embedsocial-hashtag rounded-md"
style={{ width: "100%", height: "100%" }} data-ref="90ea1c42f039ca15d1076e1bd873b215411dfcb3"
className="rounded-lg" ></div>
scrolling="no"
src="https://embedsocial.com/api/pro_hashtag/e025d6147bb208952ae5db84f99e54f2388cea0d"
></iframe>
</div>
); );
}; };

View File

@ -143,6 +143,10 @@ export const siteConfig = {
label: "UU & Peraturan", label: "UU & Peraturan",
href: "https://sisdivkum.id/library/peraturan-kepolisian", href: "https://sisdivkum.id/library/peraturan-kepolisian",
}, },
{
label: "E-Magazine",
href: "/e-majalah-polri/daftar-majalah",
},
], ],
}, },
// { // {

View File

@ -1,10 +1,5 @@
import { PaginationRequest } from "@/types/globals"; import { PaginationRequest } from "@/types/globals";
import { import { httpGet, httpPost, httpPut } from "./http-config/axios-base-service";
httpDeleteInterceptor,
httpGet,
httpPost,
httpPut,
} from "./http-config/axios-base-service";
export async function saveActivity(data: any, token?: string) { export async function saveActivity(data: any, token?: string) {
const headers = token const headers = token

View File

@ -1,9 +1,4 @@
import { import { httpGet, httpPost, httpPut } from "./http-config/axios-base-service";
httpDeleteInterceptor,
httpGet,
httpPost,
httpPut,
} from "./http-config/axios-base-service";
import Cookies from "js-cookie"; import Cookies from "js-cookie";
const token = Cookies.get("access_token"); const token = Cookies.get("access_token");

View File

@ -19,6 +19,7 @@ export async function getListArticle(props: PaginationRequest) {
category, category,
sortBy, sortBy,
sort, sort,
categorySlug,
} = props; } = props;
const headers = { const headers = {
"content-type": "application/json", "content-type": "application/json",
@ -30,7 +31,7 @@ export async function getListArticle(props: PaginationRequest) {
endDate || "" endDate || ""
}&categoryId=${category || ""}&sortBy=${sortBy || "created_at"}&sort=${ }&categoryId=${category || ""}&sortBy=${sortBy || "created_at"}&sort=${
sort || "asc" sort || "asc"
}`, }&category=${categorySlug || ""}`,
headers headers
); );
} }
@ -85,7 +86,10 @@ export async function getArticleById(id: any) {
} }
export async function deleteArticle(id: string) { export async function deleteArticle(id: string) {
return await httpDeleteInterceptor(`articles/${id}`); const headers = {
"content-type": "application/json",
};
return await httpDeleteInterceptor(`articles/${id}`, headers);
} }
export async function getArticleByCategory() { export async function getArticleByCategory() {
@ -121,7 +125,10 @@ export async function uploadArticleThumbnail(id: string, data: any) {
} }
export async function deleteArticleFiles(id: number) { export async function deleteArticleFiles(id: number) {
return await httpDeleteInterceptor(`article-files/${id}`); const headers = {
"content-type": "multipart/form-data",
};
return await httpDeleteInterceptor(`article-files/${id}`, headers);
} }
export async function getUserLevelDataStat(startDate: string, endDate: string) { export async function getUserLevelDataStat(startDate: string, endDate: string) {

View File

@ -19,7 +19,10 @@ export async function getComments(data: any) {
} }
export async function deleteComment(id: number) { export async function deleteComment(id: number) {
return await httpDeleteInterceptor(`/article-comments/${id}`); const headers = {
"content-type": "application/json",
};
return await httpDeleteInterceptor(`/article-comments/${id}`, headers);
} }
export async function getCommentById(id: number) { export async function getCommentById(id: number) {

View File

@ -34,5 +34,8 @@ export async function getFeedbacksById(id: number) {
return await httpGet(pathUrl, headers); return await httpGet(pathUrl, headers);
} }
export async function deleteFeedback(id: number) { export async function deleteFeedback(id: number) {
return await httpDeleteInterceptor(`/feedbacks/${id}`); const headers = {
"content-type": "application/json",
};
return await httpDeleteInterceptor(`/feedbacks/${id}`, headers);
} }

View File

@ -70,9 +70,9 @@ export async function httpPut(pathUrl: any, headers: any, data?: any) {
} }
} }
export async function httpDeleteInterceptor(pathUrl: any) { export async function httpDeleteInterceptor(pathUrl: any, headers: any) {
const response = await axiosBaseInstance const response = await axiosBaseInstance
.delete(pathUrl) .delete(pathUrl, headers)
.catch((error) => error.response); .catch((error) => error.response);
console.log("Response interceptor : ", response); console.log("Response interceptor : ", response);
if (response?.status == 200 || response?.status == 201) { if (response?.status == 200 || response?.status == 201) {
@ -90,7 +90,6 @@ export async function httpDeleteInterceptor(pathUrl: any) {
} }
} }
export async function mediahubGet(pathUrl: any, headers: any) { export async function mediahubGet(pathUrl: any, headers: any) {
const response = await mediahubBaseInstance const response = await mediahubBaseInstance
.get(pathUrl, { headers }) .get(pathUrl, { headers })

View File

@ -47,7 +47,10 @@ export async function getMagazineById(id: string) {
} }
export async function deleteMagazine(id: string) { export async function deleteMagazine(id: string) {
return await httpDeleteInterceptor(`magazines/${id}`); const headers = {
"content-type": "application/json",
};
return await httpDeleteInterceptor(`magazines/${id}`, headers);
} }
export async function uploadMagazineFile(id: string, data: any) { export async function uploadMagazineFile(id: string, data: any) {
@ -65,5 +68,8 @@ export async function uploadMagazineThumbnail(id: string, data: any) {
} }
export async function deleteMagazineFiles(id: number) { export async function deleteMagazineFiles(id: number) {
return await httpDeleteInterceptor(`magazine-files/${id}`); const headers = {
"content-type": "multipart/form-data",
};
return await httpDeleteInterceptor(`magazine-files/${id}`, headers);
} }

View File

@ -33,7 +33,10 @@ export async function getCategoryById(id: number) {
} }
export async function deleteCategory(id: number) { export async function deleteCategory(id: number) {
return await httpDeleteInterceptor(`article-categories/${id}`); const headers = {
"content-type": "application/json",
};
return await httpDeleteInterceptor(`article-categories/${id}`, headers);
} }
export async function uploadCategoryThumbnail(id: string, data: any) { export async function uploadCategoryThumbnail(id: string, data: any) {

View File

@ -35,5 +35,8 @@ export async function getMasterUserRoleById(id: any) {
} }
export async function deleteMasterUserRole(id: string) { export async function deleteMasterUserRole(id: string) {
return await httpDeleteInterceptor(`/user-roles/${id}`); const headers = {
"content-type": "application/json",
};
return await httpDeleteInterceptor(`/user-roles/${id}`, headers);
} }

View File

@ -39,7 +39,10 @@ export async function editMasterUsers(data: any, id: string) {
} }
export async function deleteMasterUser(id: string) { export async function deleteMasterUser(id: string) {
return await httpDeleteInterceptor(`/users/${id}`); const headers = {
"content-type": "application/json",
};
return await httpDeleteInterceptor(`/users/${id}`, headers);
} }
export async function postSignIn(data: any) { export async function postSignIn(data: any) {
@ -132,5 +135,8 @@ export async function getArticleComment(id: string) {
} }
export async function deleteArticleComment(id: number) { export async function deleteArticleComment(id: number) {
return await httpDeleteInterceptor(`/article-comments/${id}`); const headers = {
"content-type": "application/json",
};
return await httpDeleteInterceptor(`/article-comments/${id}`, headers);
} }

View File

@ -65,4 +65,5 @@ export type PaginationRequest = {
category?: string; category?: string;
sortBy?: string; sortBy?: string;
sort?: string; sort?: string;
categorySlug?: string;
}; };