feat:update form agenda

This commit is contained in:
Anang Yusman 2025-01-13 14:49:06 +08:00
commit 01b70c708f
16 changed files with 835 additions and 588 deletions

View File

@ -494,7 +494,7 @@ const CalendarView = ({ categories }: CalendarViewProps) => {
<Card className="col-span-12 lg:col-span-4 2xl:col-span-3 pb-5"> <Card className="col-span-12 lg:col-span-4 2xl:col-span-3 pb-5">
<CardContent className="p-0"> <CardContent className="p-0">
<CardHeader className="border-none mb-2 pt-5"> <CardHeader className="border-none mb-2 pt-5">
{roleId == 10 || roleId == 11 ? {roleId == 11 || roleId == 12 ?
<Button <Button
onClick={handleDateClick} onClick={handleDateClick}
className="dark:bg-background dark:text-foreground" className="dark:bg-background dark:text-foreground"

View File

@ -13,7 +13,7 @@ const page = () => {
<WelcomePolda /> <WelcomePolda />
<NewContent group="polda" type="latest" /> <NewContent group="polda" type="latest" />
<NewContent group="polda" type="popular" /> <NewContent group="polda" type="popular" />
<ContentCategory /> <ContentCategory group="polda" />
</div> </div>
); );
}; };

View File

@ -13,7 +13,7 @@ const page = () => {
<WelcomeSatker /> <WelcomeSatker />
<NewContent group="satker" type="latest" /> <NewContent group="satker" type="latest" />
<NewContent group="satker" type="popular" /> <NewContent group="satker" type="popular" />
<ContentCategory /> <ContentCategory group="satker" />
</div> </div>
); );
}; };

View File

@ -285,8 +285,9 @@ const FilterPage = () => {
useEffect(() => { useEffect(() => {
initFetch(); initFetch();
}, [page]); }, [page]);
const initFetch = async () => { const initFetch = async () => {
const response = await getListContent({ page: page - 1, size: 6, sortBy: "createdAt", contentTypeId: "3" }); const response = await getListContent({ page: page - 1, size: 6, sortBy: "createdAt", contentTypeId: "3", isInt: locale == "en" ? true : false });
console.log(response); console.log(response);
setDocumentData(response?.data?.data?.content); setDocumentData(response?.data?.data?.content);
const data = response?.data?.data; const data = response?.data?.data;

View File

@ -15,6 +15,7 @@ import ReactDatePicker from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css"; import "react-datepicker/dist/react-datepicker.css";
import { close, loading } from "@/config/swal"; import { close, loading } from "@/config/swal";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import ImageBlurry from "@/components/ui/image-blurry";
const columns: ColumnDef<any>[] = [ const columns: ColumnDef<any>[] = [
{ {
@ -154,7 +155,8 @@ const FilterPage = () => {
startDateString, startDateString,
endDateString, endDateString,
monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") : "", monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") : "",
monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : "" monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : "",
locale == "en" ? true : false,
); );
close(); close();
// setGetTotalPage(response?.data?.data?.totalPages); // setGetTotalPage(response?.data?.data?.totalPages);
@ -186,7 +188,8 @@ const FilterPage = () => {
startDateString, startDateString,
endDateString, endDateString,
monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") : "", monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") : "",
monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : "" monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : "",
locale == "en" ? true : false,
); );
close(); close();
// setGetTotalPage(response?.data?.data?.totalPages); // setGetTotalPage(response?.data?.data?.totalPages);
@ -368,7 +371,7 @@ const FilterPage = () => {
{/* Left */} {/* Left */}
<div className="flex flex-col lg:flex-row gap-6 p-4"> <div className="flex flex-col lg:flex-row gap-6 p-4">
<div className="lg:w-[25%] h-fit w-full bg-[#f7f7f7] dark:bg-black p-4 rounded-lg shadow-md"> <div className="lg:w-96 h-fit w-full bg-[#f7f7f7] dark:bg-black p-4 rounded-lg shadow-md">
<h2 className="text-lg font-semibold mb-4 flex items-center gap-1"> <h2 className="text-lg font-semibold mb-4 flex items-center gap-1">
<Icon icon="stash:filter-light" fontSize={30} /> <Icon icon="stash:filter-light" fontSize={30} />
Filter Filter
@ -470,48 +473,59 @@ const FilterPage = () => {
</div> </div>
{/* Konten Kanan */} {/* Konten Kanan */}
<Reveal> <div className="w-full">
<div className="flex-1"> <Reveal>
<div className="flex flex-col items-end mb-4"> <div className="w-full">
<h2 className="text-lg font-semibold">{t("sortBy")}</h2> <div className="flex flex-col items-end mb-4">
<select defaultValue={sortBy == "popular" ? "terpopuler" : "terbaru"} onChange={(e) => handleSorting(e)} className="border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500"> <h2 className="text-lg font-semibold">{t("sortBy")}</h2>
<option value="latest">{t("latest")}</option> <select defaultValue={sortBy == "popular" ? "terpopuler" : "terbaru"} onChange={(e) => handleSorting(e)} className="border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500">
<option value="popular">{t("mostPopular")}</option> <option value="latest">{t("latest")}</option>
</select> <option value="popular">{t("mostPopular")}</option>
</div> </select>
{imageData?.length > 0 ? (
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
{imageData?.map((image: any) => (
<Card key={image?.id} className="hover:scale-110 transition-transform duration-300">
<CardContent className="flex flex-col text-xs lg:text-sm w-full p-0">
<Link href={`/image/detail/${image?.slug}`}>
<img src={image?.thumbnailLink} className="h-60 object-cover items-center justify-center cursor-pointer rounded-lg" />
<div className="flex flex-row items-center gap-2 text-[10px] mx-2">
{formatDateToIndonesian(new Date(image?.createdAt))} {image?.timezone ? image?.timezone : "WIB"}| <Icon icon="formkit:eye" width="15" height="15" />
{image?.clickCount}{" "}
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 20 20">
<path
fill="#f00"
d="M7.707 10.293a1 1 0 1 0-1.414 1.414l3 3a1 1 0 0 0 1.414 0l3-3a1 1 0 0 0-1.414-1.414L11 11.586V6h5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h5v5.586zM9 4a1 1 0 0 1 2 0v2H9z"
/>
</svg>{" "}
</div>
<div className="font-semibold pr-3 pb-3 mx-2 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible w-full">{image?.title}</div>
</Link>
</CardContent>
</Card>
))}
</div> </div>
) : (
<p className="flex items-center justify-center text-black">
<img src="/assets/empty-data.png" alt="empty" className="h-60 w-60 my-4" />
</p>
)}
<LandingPagination table={table} totalData={totalData} totalPage={totalPage} /> {imageData?.length > 0 ? (
</div> <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
</Reveal> {imageData?.map((image: any) => (
<Card key={image?.id} className="hover:scale-105 transition-transform duration-300">
<CardContent className="flex flex-col text-xs lg:text-sm w-full p-0">
<Link href={`/image/detail/${image?.slug}`}>
{/* <img src={image?.thumbnailLink} className="h-60 object-cover items-center justify-center cursor-pointer rounded-lg" /> */}
<div
className="img-container h-60 bg-[#e9e9e9] cursor-pointer rounded-lg"
>
<ImageBlurry
src={image?.thumbnailLink}
alt={image?.title}
style={{ objectFit: "contain", width: "100%", height: "100%" }}
/>
</div>
<div className="flex flex-row items-center gap-2 text-[10px] mx-2 mt-2">
{formatDateToIndonesian(new Date(image?.createdAt))} {image?.timezone ? image?.timezone : "WIB"}| <Icon icon="formkit:eye" width="15" height="15" />
{image?.clickCount}{" "}
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 20 20">
<path
fill="#f00"
d="M7.707 10.293a1 1 0 1 0-1.414 1.414l3 3a1 1 0 0 0 1.414 0l3-3a1 1 0 0 0-1.414-1.414L11 11.586V6h5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h5v5.586zM9 4a1 1 0 0 1 2 0v2H9z"
/>
</svg>{" "}
</div>
<div className="font-semibold pr-3 pb-3 mx-2 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible w-full">{image?.title}</div>
</Link>
</CardContent>
</Card>
))}
</div>
) : (
<p className="flex items-center justify-center text-black">
<img src="/assets/empty-data.png" alt="empty" className="h-60 w-60 my-4" />
</p>
)}
{totalData > 1 && <LandingPagination table={table} totalData={totalData} totalPage={totalPage} />}
</div>
</Reveal>
</div>
</div> </div>
</div> </div>
); );

View File

@ -289,6 +289,7 @@ const FilterPage = () => {
size: 6, size: 6,
sortBy: "createdAt", sortBy: "createdAt",
contentTypeId: "2", contentTypeId: "2",
isInt: locale == "en" ? true : false,
}); });
console.log(response); console.log(response);
setVideoData(response?.data?.data?.content); setVideoData(response?.data?.data?.content);

View File

@ -582,4 +582,4 @@ html[dir="rtl"] .react-select .select__loading-indicator {
/* Hide FullCalendar grid elements */ /* Hide FullCalendar grid elements */
.fc-view-harness:has(.hide-calendar-grid) { .fc-view-harness:has(.hide-calendar-grid) {
display: none; display: none;
} }

View File

@ -22,7 +22,7 @@ const Home = ({ params: { locale } }: { params: { locale: string } }) => {
<NewContent group="mabes" type="latest" /> <NewContent group="mabes" type="latest" />
<NewContent group="mabes" type="popular" /> <NewContent group="mabes" type="popular" />
{/* <PopularContent /> */} {/* <PopularContent /> */}
<ContentCategory /> <ContentCategory group="mabes" />
<Coverage /> <Coverage />
<Division /> <Division />
<Footer /> <Footer />

View File

@ -1156,48 +1156,68 @@ export default function FormTaskDetail() {
</div> </div>
</div> </div>
</div> </div>
<div className="flex flex-row justify-end gap-3 my-3"> <div className="flex flex-row justify-between gap-3 my-3">
<div className=""> <div className="px-1">
<Button {detail?.isDone !== true &&
color="primary" (Number(userLevelNumber) !== 3 ||
variant={"outline"} Number(userLevelNumber) == 2) ? (
onClick={handleToggleInput} <Button
> color="primary"
Beri Tanggapan variant={"outline"}
</Button> type="button"
</div> className="btn btn-outline-primary ml-3"
<div className=""> onClick={() => handleForward()}
<Button >
className="btn btn-primary ml-3 mr-3" Forward
style={ </Button>
statusAcceptance || detail?.createdBy?.id == Number(userId) ) : (
? { ""
display: "none", )
}
: {}
}
onClick={() => handleAcceptAcceptance()}
>
Terima Tugas
</Button>
</div>
<div
className="task-response w-100 px-3 "
style={
isSentResult || detail?.createdBy?.id == Number(userId)
? {}
: {
display: "none",
}
} }
> </div>
<Button <div className="flex gap-2">
color="primary" <div className="">
variant={"default"} <Button
onClick={() => setIsTableResult(!isTableResult)} color="primary"
variant={"outline"}
onClick={handleToggleInput}
>
Beri Tanggapan
</Button>
</div>
<div className="">
<Button
className="btn btn-primary ml-3 mr-3"
style={
statusAcceptance || detail?.createdBy?.id !== Number(userId)
? {
display: "none",
}
: {}
}
onClick={() => handleAcceptAcceptance()}
>
Terima Tugas
</Button>
</div>
<div
className="task-response w-100 px-3 "
// style={
// Number(detail?.createdBy?.id) == Number(userId)
// ? {}
// : {
// display: "none",
// }
// }
> >
Hasil Upload <Button
</Button> color="primary"
variant={"default"}
onClick={() => setIsTableResult(!isTableResult)}
>
Hasil Upload {Number(userId)}
</Button>
</div>
</div> </div>
</div> </div>
{isTableResult && ( {isTableResult && (
@ -1223,184 +1243,186 @@ export default function FormTaskDetail() {
</table> </table>
)} )}
{showInput && ( {showInput && (
<div className="mt-4 border p-4 rounded bg-gray-50"> <>
<Textarea <div className="mt-4 border p-4 rounded bg-gray-50">
placeholder="Tulis tanggapan Anda di sini..." <Textarea
value={message} placeholder="Tulis tanggapan Anda di sini..."
onChange={handleInputChange} value={message}
/> onChange={handleInputChange}
<div className="flex justify-end mt-3"> />
<Button <div className="flex justify-end mt-3">
color="primary" <Button
onClick={() => postData()} color="primary"
type="button" onClick={() => postData()}
> type="button"
Kirim Tanggapan >
</Button> Kirim Tanggapan
</div> </Button>
</div>
)}
<div className="mt-6">
<h3 className="text-lg font-bold text-center">Tanggapan</h3>
{listData?.map((item: any) => (
<div key={item.id} className="flex flex-col gap-3 mt-2 ">
<div className="flex flex-row gap-3">
<Avatar className="mt-2">
<AvatarImage
src={"/assets/avatar-profile.png"}
alt={`@${item.username}`}
/>
</Avatar>
<div className="flex flex-col bg-slate-200 w-full px-2 py-2 rounded-md">
<div className="flex items-center justify-between">
<span className="text-gray-700 font-semibold">
{item.suggestionFrom.username}
</span>
<span className="text-gray-500 text-sm">
{formatDate(item.createdAt)}
</span>
</div>
<p className="text-gray-800 mt-1">{item.message}</p>
<div className="flex flex-row gap-2">
<div
className="flex items-center mt-1 text-blue-500 cursor-pointer"
onClick={() => handleReply(item.id)}
>
<DotSquare className="w-4 h-4" />
<span className="ml-1">Balas</span>
</div>
<div
className="flex items-center mt-1 text-red-500 cursor-pointer"
onClick={() => deleteData(item.id)}
>
<TrashIcon className="w-4 h-4" />
<span className="ml-1">Delete</span>
</div>
</div>
</div>
</div> </div>
{replyingTo === item.id && ( </div>
<div className="ml-10 mt-2"> <div className="mt-6">
<textarea <h3 className="text-lg font-bold text-center">Tanggapan</h3>
id={`input-comment-${item.id}`} {listData?.map((item: any) => (
className="w-full p-2 border rounded" <div key={item.id} className="flex flex-col gap-3 mt-2 ">
placeholder="Masukkan tanggapan anda" <div className="flex flex-row gap-3">
/> <Avatar className="mt-2">
<button <AvatarImage
className="mt-2 px-4 py-2 bg-blue-500 text-white rounded" src={"/assets/avatar-profile.png"}
onClick={() => sendReplyData(item.id)} alt={`@${item.username}`}
> />
Kirim </Avatar>
</button> <div className="flex flex-col bg-slate-200 w-full px-2 py-2 rounded-md">
</div> <div className="flex items-center justify-between">
)} <span className="text-gray-700 font-semibold">
{item.children?.length > 0 && ( {item.suggestionFrom.username}
<div className="ml-10 mt-2 flex flex-col"> </span>
{item.children.map((child: any) => ( <span className="text-gray-500 text-sm">
<div {formatDate(item.createdAt)}
key={child.id} </span>
className="flex flex-col gap-3 mt-2" </div>
> <p className="text-gray-800 mt-1">{item.message}</p>
<div className="flex flex-row gap-3"> <div className="flex flex-row gap-2">
<Avatar className="mt-2"> <div
<AvatarImage className="flex items-center mt-1 text-blue-500 cursor-pointer"
src={"/assets/avatar-profile.png"} onClick={() => handleReply(item.id)}
alt={`@${child.username}`} >
/> <DotSquare className="w-4 h-4" />
</Avatar> <span className="ml-1">Balas</span>
<div className="flex flex-col bg-slate-200 w-full px-2 py-2 rounded-md"> </div>
<div className="flex items-center justify-between"> <div
<span className="text-gray-700 font-semibold"> className="flex items-center mt-1 text-red-500 cursor-pointer"
{child.suggestionFrom.username} onClick={() => deleteData(item.id)}
</span> >
<span className="text-gray-500 text-sm"> <TrashIcon className="w-4 h-4" />
{formatDate(child.createdAt)} <span className="ml-1">Delete</span>
</span>
</div>
<p className="text-gray-800 mt-1">
{child.message}
</p>
<div className="flex flex-row gap-2">
<div
className="flex items-center mt-1 text-blue-500 cursor-pointer"
onClick={() => handleReply(child.id)}
>
<DotSquare className="w-4 h-4" />
<span className="ml-1">Balas</span>
</div>
<div
className="flex items-center mt-1 text-red-500 cursor-pointer"
onClick={() => deleteData(child.id)}
>
<TrashIcon className="w-4 h-4" />
<span className="ml-1">Delete</span>
</div>
</div>
</div> </div>
</div> </div>
{replyingTo === child.id && ( </div>
<div className="ml-10 mt-2"> </div>
<textarea {replyingTo === item.id && (
id={`input-comment-${child.id}`} <div className="ml-10 mt-2">
className="w-full p-2 border rounded" <textarea
placeholder="Masukkan tanggapan anda" id={`input-comment-${item.id}`}
/> className="w-full p-2 border rounded"
<button placeholder="Masukkan tanggapan anda"
className="mt-2 px-4 py-2 bg-blue-500 text-white rounded" />
onClick={() => sendReplyData(child.id)} <button
> className="mt-2 px-4 py-2 bg-blue-500 text-white rounded"
Kirim onClick={() => sendReplyData(item.id)}
</button> >
</div> Kirim
)} </button>
{child.children?.length > 0 && ( </div>
<div className="ml-10 mt-2 flex flex-col mb-3"> )}
{child.children.map((child2: any) => ( {item.children?.length > 0 && (
<div <div className="ml-10 mt-2 flex flex-col">
key={child2.id} {item.children.map((child: any) => (
className="flex flex-col gap-3 mt-2" <div
> key={child.id}
<div className="flex flex-row gap-3 "> className="flex flex-col gap-3 mt-2"
<Avatar className="mt-2"> >
<AvatarImage <div className="flex flex-row gap-3">
src={"/assets/avatar-profile.png"} <Avatar className="mt-2">
alt={`@${child2.username}`} <AvatarImage
/> src={"/assets/avatar-profile.png"}
</Avatar> alt={`@${child.username}`}
<div className="flex flex-col bg-slate-200 w-full px-2 py-2 rounded-md"> />
<div className="flex items-center justify-between"> </Avatar>
<span className="text-gray-700 font-semibold"> <div className="flex flex-col bg-slate-200 w-full px-2 py-2 rounded-md">
{child2.suggestionFrom.username} <div className="flex items-center justify-between">
</span> <span className="text-gray-700 font-semibold">
<span className="text-gray-500 text-sm"> {child.suggestionFrom.username}
{formatDate(child2.createdAt)} </span>
</span> <span className="text-gray-500 text-sm">
</div> {formatDate(child.createdAt)}
<p className="text-gray-800 mt-1"> </span>
{child2.message} </div>
</p> <p className="text-gray-800 mt-1">
<div className="flex flex-row gap-2"> {child.message}
<div </p>
className="flex items-center mt-1 text-red-500 cursor-pointer" <div className="flex flex-row gap-2">
onClick={() => deleteData(child2.id)} <div
> className="flex items-center mt-1 text-blue-500 cursor-pointer"
<TrashIcon className="w-4 h-4" /> onClick={() => handleReply(child.id)}
<span className="ml-1">Delete</span> >
</div> <DotSquare className="w-4 h-4" />
</div> <span className="ml-1">Balas</span>
</div>
<div
className="flex items-center mt-1 text-red-500 cursor-pointer"
onClick={() => deleteData(child.id)}
>
<TrashIcon className="w-4 h-4" />
<span className="ml-1">Delete</span>
</div> </div>
</div> </div>
</div> </div>
))} </div>
{replyingTo === child.id && (
<div className="ml-10 mt-2">
<textarea
id={`input-comment-${child.id}`}
className="w-full p-2 border rounded"
placeholder="Masukkan tanggapan anda"
/>
<button
className="mt-2 px-4 py-2 bg-blue-500 text-white rounded"
onClick={() => sendReplyData(child.id)}
>
Kirim
</button>
</div>
)}
{child.children?.length > 0 && (
<div className="ml-10 mt-2 flex flex-col mb-3">
{child.children.map((child2: any) => (
<div
key={child2.id}
className="flex flex-col gap-3 mt-2"
>
<div className="flex flex-row gap-3 ">
<Avatar className="mt-2">
<AvatarImage
src={"/assets/avatar-profile.png"}
alt={`@${child2.username}`}
/>
</Avatar>
<div className="flex flex-col bg-slate-200 w-full px-2 py-2 rounded-md">
<div className="flex items-center justify-between">
<span className="text-gray-700 font-semibold">
{child2.suggestionFrom.username}
</span>
<span className="text-gray-500 text-sm">
{formatDate(child2.createdAt)}
</span>
</div>
<p className="text-gray-800 mt-1">
{child2.message}
</p>
<div className="flex flex-row gap-2">
<div
className="flex items-center mt-1 text-red-500 cursor-pointer"
onClick={() => deleteData(child2.id)}
>
<TrashIcon className="w-4 h-4" />
<span className="ml-1">Delete</span>
</div>
</div>
</div>
</div>
</div>
))}
</div>
)}
</div> </div>
)} ))}
</div> </div>
))} )}
</div> </div>
)} ))}
</div> </div>
))} </>
</div> )}
<div className="flex justify-center mt-4"> <div className="flex justify-center mt-4">
{detail?.createdBy?.id == Number(userId) && {detail?.createdBy?.id == Number(userId) &&
detail?.isDone !== true ? ( detail?.isDone !== true ? (
@ -1427,21 +1449,6 @@ export default function FormTaskDetail() {
) : ( ) : (
"" ""
)} )}
{detail?.isDone !== true &&
(Number(userLevelNumber) !== 3 ||
Number(userLevelNumber) == 2) ? (
<Button
color="primary"
variant={"outline"}
type="button"
className="btn btn-outline-primary ml-3"
onClick={() => handleForward()}
>
Forward
</Button>
) : (
""
)}
</div> </div>
</form> </form>
</div> </div>

View File

@ -1,20 +1,31 @@
import { getCategoryData } from "@/service/landing/landing"; import { getCategoryData, getPublicCategoryData } from "@/service/landing/landing";
import Link from "next/link"; import Link from "next/link";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { Button } from "../ui/button"; import { Button } from "../ui/button";
import { Reveal } from "./Reveal"; import { Reveal } from "./Reveal";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import { usePathname } from "next/navigation"; import { usePathname } from "next/navigation";
import { useParams } from "next/navigation";
const ContentCategory = () => { const ContentCategory = (props: { group?: string }) => {
const [categories, setCategories] = useState<any>(); const [categories, setCategories] = useState<any>();
const t = useTranslations("LandingPage"); const t = useTranslations("LandingPage");
const params = useParams();
const locale = params?.locale;
const poldaName = params?.polda_name;
const satkerName = params?.satker_name;
useEffect(() => { useEffect(() => {
initFetch(); initFetch();
}, []); }, []);
const initFetch = async () => { const initFetch = async () => {
const response = await getCategoryData(); const response = await getPublicCategoryData(
props.group == "mabes" ? "" :
props.group == "polda" && poldaName && String(poldaName)?.length > 1 ? poldaName :
props.group == "satker" && satkerName && String(satkerName)?.length > 1 ? "satker-"+satkerName : "",
"",
locale == "en" ? true : false
);
console.log("category", response); console.log("category", response);
setCategories(response?.data?.data?.content); setCategories(response?.data?.data?.content);
}; };

View File

@ -36,6 +36,7 @@ const NewContent = (props: { group: string, type: string }) => {
group: props.group == "mabes" ? "" : group: props.group == "mabes" ? "" :
props.group == "polda" && poldaName && String(poldaName)?.length > 1 ? poldaName : props.group == "polda" && poldaName && String(poldaName)?.length > 1 ? poldaName :
props.group == "satker" && satkerName && String(satkerName)?.length > 1 ? "satker-"+satkerName : "", props.group == "satker" && satkerName && String(satkerName)?.length > 1 ? "satker-"+satkerName : "",
isInt: locale == "en" ? true : false
}; };
const response = await getListContent(request); const response = await getListContent(request);
console.log("category", response); console.log("category", response);

View File

@ -0,0 +1,61 @@
import React, { useEffect, useState } from 'react';
interface ImageBlurryProps {
src: string;
alt?: string;
classname?: string;
key?: string | number;
style?: React.CSSProperties;
}
const ImageBlurry: React.FC<ImageBlurryProps> = (props) => {
const { src, alt, classname, key, style } = props;
const [imgSrc, setImgSrc] = useState<string>(src);
const [isError, setIsError] = useState<boolean>(false);
useEffect(() => {
setImgSrc(src);
}, [src]);
const handleImage = () => {
const pics = document.querySelectorAll<HTMLImageElement>('img');
pics.forEach((pic) => {
if (pic.complete) {
checkImage(pic);
} else {
pic.addEventListener('load', function () {
checkImage(this);
});
}
});
};
const checkImage = (img: HTMLImageElement) => {
if (img.naturalHeight > img.naturalWidth) {
img.classList.add('portrait');
} else if (Math.abs(img.naturalHeight - img.naturalWidth) < 10) {
img.classList.add('square');
} else {
img.classList.add('landscape');
}
};
const onLoad = () => {
console.log('Image loaded:', src);
handleImage();
};
return (
// <div className="relative overflow-hidden bg-[#e9e9e9] blurry-wrapper">
// <div className="absolute -top-6 -bottom-6 left-0 -right-6 bg-[#e9e9e9] blur-[8px] scale-[1.8] bg-center bg-no-repeat bg-contain blur-bg" style={{ backgroundImage: `url(${imgSrc})` }}></div>
// <div className="absolute inset-0 bg-transparent bg-center bg-no-repeat bg-contain image-bg" style={{ backgroundImage: `url(${imgSrc})` }}></div>
// </div>
<div className="blurry-wrapper relative overflow-hidden bg-[#e9e9e9] rounded-lg" key={key} style={style}>
<div className="absolute -top-6 -bottom-6 -left-0 -right-6 bg-[#e9e9e9] blur-[8px] scale-[1.8] bg-center bg-no-repeat bg-contain blur-bg" style={{ backgroundImage: `url(${imgSrc})` }}></div>
<div className="absolute inset-0 bg-transparent bg-center bg-no-repeat bg-contain image-bg" style={{ backgroundImage: `url(${imgSrc})` }}></div>
</div>
);
};
export default ImageBlurry;

View File

@ -2403,314 +2403,461 @@ export function getMenuList(pathname: string, t: any): Group[] {
}, },
]; ];
} else if (Number(roleId) === 2) { } else if (Number(roleId) === 2) {
menusSelected = [ if (Number(levelNumber) == 1) {
{ menusSelected = [
groupLabel: t("apps"), {
id: "dashboard", groupLabel: t("apps"),
menus: [ id: "dashboard",
{ menus: [
id: "dashboard", {
href: "/dashboard", id: "dashboard",
label: t("dashboard"), href: "/dashboard",
active: pathname.includes("/dashboard"), label: t("dashboard"),
icon: "material-symbols:dashboard", active: pathname.includes("/dashboard"),
submenus: [ icon: "material-symbols:dashboard",
{ submenus: [
href: "/dashboard", {
label: "Breakdown", href: "/dashboard",
active: pathname === "/dashboard", label: "Breakdown",
icon: "heroicons:arrow-trending-up", active: pathname === "/dashboard",
children: [], icon: "heroicons:arrow-trending-up",
}, children: [],
{ },
href: "/dashboard/executive", {
label: "Executive", href: "/dashboard/executive",
active: pathname === "/dashboard/executive", label: "Executive",
icon: "heroicons:arrow-trending-up", active: pathname === "/dashboard/executive",
children: [], icon: "heroicons:arrow-trending-up",
}, children: [],
], },
}, ],
], },
}, ],
{ },
groupLabel: "", {
id: "agenda-setting", groupLabel: "",
menus: [ id: "agenda-setting",
{ menus: [
id: "agenda-setting", {
href: "/contributor/agenda-setting", id: "agenda-setting",
label: t("agenda-setting"), href: "/contributor/agenda-setting",
active: pathname.includes("/agenda-setting"), label: t("agenda-setting"),
icon: "iconoir:journal-page", active: pathname.includes("/agenda-setting"),
submenus: [], icon: "iconoir:journal-page",
}, submenus: [],
], },
}, ],
{ },
groupLabel: "", {
id: "management-user", groupLabel: "",
menus: [ id: "management-user",
{ menus: [
id: "management-user-menu", {
href: "/admin/management-user", id: "management-user-menu",
label: "Management User", href: "/admin/management-user",
active: pathname.includes("/management-user"), label: "Management User",
icon: "clarity:users-solid", active: pathname.includes("/management-user"),
submenus: [], icon: "clarity:users-solid",
}, submenus: [],
], },
}, ],
{ },
groupLabel: "", {
id: "content-production", groupLabel: "",
menus: [ id: "content-production",
{ menus: [
id: "content-production", {
href: "/curator/content-production", id: "content-production",
label: t("content-production"), href: "/curator/content-production",
active: pathname.includes("/content-production"), label: t("content-production"),
icon: "fluent:content-view-gallery-16-regular", active: pathname.includes("/content-production"),
submenus: [], icon: "fluent:content-view-gallery-16-regular",
}, submenus: [],
], },
}, ],
{ },
groupLabel: "", {
id: "pattern-relation", groupLabel: "",
menus: [ id: "pattern-relation",
{ menus: [
id: "pattern-relation", {
href: "/curator/pattern-relation", id: "pattern-relation",
label: t("pattern-relation"), href: "/curator/pattern-relation",
active: pathname.includes("/pattern-relation"), label: t("pattern-relation"),
icon: "oui:app-index-pattern", active: pathname.includes("/pattern-relation"),
submenus: [], icon: "oui:app-index-pattern",
}, submenus: [],
], },
}, ],
{ },
groupLabel: "", {
id: "performance-polda", groupLabel: "",
menus: [ id: "performance-polda",
{ menus: [
id: "performance-polda", {
href: "/admin/performance-polda", id: "performance-polda",
label: t("performance-polda"), href: "/admin/performance-polda",
active: pathname.includes("/admin/performance-polda"), label: t("performance-polda"),
icon: "ant-design:signal-filled", active: pathname.includes("/admin/performance-polda"),
submenus: [], icon: "ant-design:signal-filled",
}, submenus: [],
], },
}, ],
{ },
groupLabel: "", {
id: "analysis", groupLabel: "",
menus: [ id: "analysis",
{ menus: [
id: "analysis", {
href: "/admin/analysis", id: "analysis",
label: t("analysis"), href: "/admin/analysis",
active: pathname.includes("/task-plan"), label: t("analysis"),
icon: "mdi:chart-line", active: pathname.includes("/task-plan"),
submenus: [ icon: "mdi:chart-line",
{ submenus: [
href: "/admin/analysis/content-management", {
label: t("management-content"), href: "/admin/analysis/content-management",
active: pathname === "/admin/analysis/content-management", label: t("management-content"),
icon: "", active: pathname === "/admin/analysis/content-management",
children: [], icon: "",
}, children: [],
{ },
href: "/admin/analysis/schedule", {
label: t("schedule"), href: "/admin/analysis/schedule",
active: pathname === "/admin/analysis/schedule", label: t("schedule"),
icon: "heroicons:shopping-cart", active: pathname === "/admin/analysis/schedule",
children: [], icon: "heroicons:shopping-cart",
}, children: [],
{ },
href: "/admin/analysis/feedback-center", {
label: "Feedback Center", href: "/admin/analysis/feedback-center",
active: pathname === "/admin/analysis/feedback-center", label: "Feedback Center",
icon: "heroicons:shopping-cart", active: pathname === "/admin/analysis/feedback-center",
children: [], icon: "heroicons:shopping-cart",
}, children: [],
{ },
href: "/admin/analysis/emergency-issue", {
label: "Emergency Issue", href: "/admin/analysis/emergency-issue",
active: pathname === "/admin/analysis/emergency-issue", label: "Emergency Issue",
icon: "heroicons:shopping-cart", active: pathname === "/admin/analysis/emergency-issue",
children: [], icon: "heroicons:shopping-cart",
}, children: [],
], },
}, ],
], },
}, ],
},
{
groupLabel: "", {
id: "media-tracking", groupLabel: "",
menus: [ id: "media-tracking",
{ menus: [
id: "media-tracking", {
href: "/curator/media-tracking", id: "media-tracking",
label: t("media-tracking"), href: "/curator/media-tracking",
active: pathname.includes("/media-tracking"), label: t("media-tracking"),
icon: "material-symbols:map-search-outline", active: pathname.includes("/media-tracking"),
submenus: [ icon: "material-symbols:map-search-outline",
{ submenus: [
href: "/admin/media-tracking/media-online", {
label: "Media Online", href: "/admin/media-tracking/media-online",
active: pathname === "/media-tracking/media-online", label: "Media Online",
icon: "heroicons:arrow-trending-up", active: pathname === "/media-tracking/media-online",
children: [], icon: "heroicons:arrow-trending-up",
}, children: [],
{ },
href: "/admin/media-tracking/news", {
label: "Tracking Beritra Hari Ini", href: "/admin/media-tracking/news",
active: pathname === "/media-tracking/news", label: "Tracking Beritra Hari Ini",
icon: "heroicons:arrow-trending-up", active: pathname === "/media-tracking/news",
children: [], icon: "heroicons:arrow-trending-up",
}, children: [],
], },
}, ],
], },
}, ],
{ },
groupLabel: "", {
id: "contest", groupLabel: "",
menus: [ id: "contest",
{ menus: [
id: "contest", {
href: "/shared/contest", id: "contest",
label: t("contest"), href: "/shared/contest",
active: pathname.includes("/contest"), label: t("contest"),
icon: "ic:outline-emoji-events", active: pathname.includes("/contest"),
submenus: [], icon: "ic:outline-emoji-events",
}, submenus: [],
], },
}, ],
{ },
groupLabel: "", {
id: "communication", groupLabel: "",
menus: [ id: "communication",
{ menus: [
id: "communication", {
href: "/shared/communication", id: "communication",
label: t("communication"), href: "/shared/communication",
active: pathname.includes("/communication"), label: t("communication"),
icon: "token:chat", active: pathname.includes("/communication"),
submenus: [], icon: "token:chat",
}, submenus: [],
], },
}, ],
{ },
groupLabel: "", {
id: "feedback", groupLabel: "",
menus: [ id: "feedback",
{ menus: [
id: "feedback", {
href: "/curator/feedback", id: "feedback",
label: t("feedback"), href: "/curator/feedback",
active: pathname.includes("/curator/feedback"), label: t("feedback"),
icon: "mdi:feedback-outline", active: pathname.includes("/curator/feedback"),
submenus: [], icon: "mdi:feedback-outline",
}, submenus: [],
], },
}, ],
{ },
groupLabel: "", {
id: "broadcast", groupLabel: "",
menus: [ id: "broadcast",
{ menus: [
id: "broadcast", {
href: "/admin/broadcast", id: "broadcast",
label: "Broadcast", href: "/admin/broadcast",
active: pathname.includes("/broadcast"), label: "Broadcast",
icon: "mdi:broadcast", active: pathname.includes("/broadcast"),
submenus: [], icon: "mdi:broadcast",
}, submenus: [],
], },
}, ],
{ },
groupLabel: "", {
id: "experts", groupLabel: "",
menus: [ id: "experts",
{ menus: [
id: "experts", {
href: "/admin/add-experts", id: "experts",
label: t("add-experts"), href: "/admin/add-experts",
active: pathname.includes("/add-experts"), label: t("add-experts"),
icon: "majesticons:user", active: pathname.includes("/add-experts"),
submenus: [], icon: "majesticons:user",
}, submenus: [],
], },
}, ],
{ },
groupLabel: "", {
id: "settings", groupLabel: "",
menus: [ id: "settings",
{ menus: [
id: "settings", {
href: "/admin/settings", id: "settings",
label: t("settings"), href: "/admin/settings",
active: pathname.includes("/settinng"), label: t("settings"),
icon: "material-symbols:settings", active: pathname.includes("/settinng"),
submenus: [ icon: "material-symbols:settings",
{ submenus: [
href: "/admin/settings/category", {
label: t("category"), href: "/admin/settings/category",
active: pathname === "/admin/settings/category", label: t("category"),
icon: "heroicons:arrow-trending-up", active: pathname === "/admin/settings/category",
children: [], icon: "heroicons:arrow-trending-up",
}, children: [],
{ },
href: "/admin/settings/tag", {
label: "Tag", href: "/admin/settings/tag",
active: pathname === "/admin/settings/tag", label: "Tag",
icon: "heroicons:arrow-trending-up", active: pathname === "/admin/settings/tag",
children: [], icon: "heroicons:arrow-trending-up",
}, children: [],
{ },
href: "/admin/settings/banner", {
label: "Banner", href: "/admin/settings/banner",
active: pathname === "/admin/settings/banner", label: "Banner",
icon: "heroicons:arrow-trending-up", active: pathname === "/admin/settings/banner",
children: [], icon: "heroicons:arrow-trending-up",
}, children: [],
{ },
href: "/admin/settings/feedback", {
label: "Feedback", href: "/admin/settings/feedback",
active: pathname === "/admin/settings/feedback", label: "Feedback",
icon: "heroicons:arrow-trending-up", active: pathname === "/admin/settings/feedback",
children: [], icon: "heroicons:arrow-trending-up",
}, children: [],
{ },
href: "/admin/settings/faq", {
label: "FAQ", href: "/admin/settings/faq",
active: pathname === "/admin/settings/faq", label: "FAQ",
icon: "heroicons:arrow-trending-up", active: pathname === "/admin/settings/faq",
children: [], icon: "heroicons:arrow-trending-up",
}, children: [],
{ },
href: "https://nat-mediahub.polri.go.id/", {
label: "Mediahub 2022", href: "https://nat-mediahub.polri.go.id/",
active: pathname === "/admin/settings/mediahub-2022", label: "Mediahub 2022",
icon: "heroicons:arrow-trending-up", active: pathname === "/admin/settings/mediahub-2022",
children: [], icon: "heroicons:arrow-trending-up",
}, children: [],
{ },
href: "/admin/settings/privacy", {
label: t("privacy"), href: "/admin/settings/privacy",
active: pathname === "/admin/settings/privacy", label: t("privacy"),
icon: "heroicons:arrow-trending-up", active: pathname === "/admin/settings/privacy",
children: [], icon: "heroicons:arrow-trending-up",
}, children: [],
], },
}, ],
], },
}, ],
]; },
];
} else {
menusSelected = [
{
groupLabel: t("apps"),
id: "dashboard",
menus: [
{
id: "dashboard",
href: "/dashboard",
label: t("dashboard"),
active: pathname.includes("/dashboard"),
icon: "material-symbols:dashboard",
submenus: [
{
href: "/dashboard",
label: "Breakdown",
active: pathname === "/dashboard",
icon: "heroicons:arrow-trending-up",
children: [],
},
{
href: "/dashboard/executive",
label: "Executive",
active: pathname === "/dashboard/executive",
icon: "heroicons:arrow-trending-up",
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: "management-user",
menus: [
{
id: "management-user-menu",
href: "/admin/management-user",
label: "Management User",
active: pathname.includes("/management-user"),
icon: "clarity:users-solid",
submenus: [],
},
],
},
{
groupLabel: "",
id: "content-production",
menus: [
{
id: "content-production",
href: "/curator/content-production",
label: t("content-production"),
active: pathname.includes("/content-production"),
icon: "fluent:content-view-gallery-16-regular",
submenus: [],
},
],
},
{
groupLabel: "",
id: "pattern-relation",
menus: [
{
id: "pattern-relation",
href: "/curator/pattern-relation",
label: t("pattern-relation"),
active: pathname.includes("/pattern-relation"),
icon: "oui:app-index-pattern",
submenus: [],
},
],
},
{
groupLabel: "",
id: "performance-polda",
menus: [
{
id: "performance-polda",
href: "/admin/performance-polda",
label: t("performance-polda"),
active: pathname.includes("/admin/performance-polda"),
icon: "ant-design:signal-filled",
submenus: [],
},
],
},
{
groupLabel: "",
id: "communication",
menus: [
{
id: "communication",
href: "/shared/communication",
label: t("communication"),
active: pathname.includes("/communication"),
icon: "token:chat",
submenus: [],
},
],
},
{
groupLabel: "",
id: "settings",
menus: [
{
id: "settings",
href: "/admin/settings",
label: t("settings"),
active: pathname.includes("/settinng"),
icon: "material-symbols:settings",
submenus: [
{
href: "/admin/settings/category",
label: t("category"),
active: pathname === "/admin/settings/category",
icon: "heroicons:arrow-trending-up",
children: [],
},
{
href: "/admin/settings/tag",
label: "Tag",
active: pathname === "/admin/settings/tag",
icon: "heroicons:arrow-trending-up",
children: [],
}
],
},
],
},
];
}
} }
return menusSelected; return menusSelected;

View File

@ -168,7 +168,7 @@ export async function uploadThumbnail(id: any, data: any) {
const headers = { const headers = {
"Content-Type": "multipart/form-data", "Content-Type": "multipart/form-data",
}; };
return httpPostInterceptor(url, data, { headers }); return httpPostInterceptor(url, data, headers);
} }
export async function detailSPIT(id: any) { export async function detailSPIT(id: any) {

View File

@ -5,13 +5,17 @@ export async function getHeroData() {
return await httpGetInterceptor(`media/public/list?enablePage=1&sort=desc&sortBy=createdAt&size=5&page=0&typeId=1&title=&categoryId=&fileFormats=&tags=&group=&startDate=&endDate=&month=&year=`); return await httpGetInterceptor(`media/public/list?enablePage=1&sort=desc&sortBy=createdAt&size=5&page=0&typeId=1&title=&categoryId=&fileFormats=&tags=&group=&startDate=&endDate=&month=&year=`);
} }
export async function getPublicCategoryData(group: any = "", type: string = "", isInt: Boolean = false) {
return await httpGetInterceptor(`media/categories/list/publish?enablePage=0&group=${group}&type=${type}&isInt=${isInt}`);
}
export async function getCategoryData() { export async function getCategoryData() {
return await httpGetInterceptor(`media/categories/list/publish?enablePage=1&sort=desc&sortBy=updatedAt&size=12&type=`); return await httpGetInterceptor(`media/categories/list/publish?enablePage=1&sort=desc&sortBy=updatedAt&size=12&type=`);
} }
export async function getListContent(props: any) { export async function getListContent(props: any) {
return await httpGetInterceptor( return await httpGetInterceptor(
`media/public/list?enablePage=1&sort=desc&sortBy=${props.sortBy}&size=${props.size}&page=${props.page}&typeId=${props.contentTypeId}&title=${props.title}&group=${props.group}&categoryId=&fileFormats=&tags=&startDate=&endDate=&month=&year=` `media/public/list?enablePage=1&sort=desc&sortBy=${props.sortBy}&size=${props.size}&isInt=${props.isInt}&typeId=${props.contentTypeId}&title=${props.title}&group=${props.group}&categoryId=&fileFormats=&tags=&startDate=&endDate=&month=&year=`
); );
} }
@ -47,9 +51,9 @@ export async function publicDetailBlog(slug: any) {
return await httpGetInterceptor(`blog/public/read/${slug}`); return await httpGetInterceptor(`blog/public/read/${slug}`);
} }
export async function listData(type: string, search: string, category: string, size = 10, page = 0, sortBy = "createdAt", format = "", tag = "", group = "", startDate = "", endDate = "", month = "", year = "") { export async function listData(type: string, search: string, category: string, size = 10, page = 0, sortBy = "createdAt", format = "", tag = "", group = "", startDate = "", endDate = "", month = "", year = "", isInt = false) {
return await httpGetInterceptor( return await httpGetInterceptor(
`media/public/list?enablePage=1&sort=desc&sortBy=${sortBy}&size=${size}&page=${page}&typeId=${type}&title=${search}&categoryId=${category}&fileFormats=${format}&tags=${tag}&group=${group}&startDate=${startDate}&endDate=${endDate}&month=${month}&year=${year}` `media/public/list?enablePage=1&sort=desc&sortBy=${sortBy}&size=${size}&page=${page}&typeId=${type}&title=${search}&categoryId=${category}&fileFormats=${format}&tags=${tag}&group=${group}&startDate=${startDate}&endDate=${endDate}&month=${month}&year=${year}&isInt=${isInt}`
); );
} }

View File

@ -39,7 +39,7 @@ export async function postCategory(data: any) {
const headers = { const headers = {
"Content-Type": "multipart/form-data", "Content-Type": "multipart/form-data",
}; };
return httpPostInterceptor(url, data, { headers }); return httpPostInterceptor(url, data, headers);
} }
export async function getPrivacy(id: string) { export async function getPrivacy(id: string) {