pull main
This commit is contained in:
commit
a96912cbcf
|
|
@ -49,11 +49,11 @@ const columns: ColumnDef<any>[] = [
|
||||||
header: "Jumlah Amplifikasi",
|
header: "Jumlah Amplifikasi",
|
||||||
cell: ({ row }) => <span>{row.getValue("link")}</span>,
|
cell: ({ row }) => <span>{row.getValue("link")}</span>,
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
accessorKey: "status",
|
// accessorKey: "status",
|
||||||
header: "Status",
|
// header: "Status",
|
||||||
cell: ({ row }) => <span>{row.getValue("status")}</span>,
|
// cell: ({ row }) => <span>{row.getValue("status")}</span>,
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
accessorKey: "date",
|
accessorKey: "date",
|
||||||
header: "Tanggal Penarikan",
|
header: "Tanggal Penarikan",
|
||||||
|
|
@ -77,10 +77,17 @@ const columns: ColumnDef<any>[] = [
|
||||||
</Button>
|
</Button>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent className="p-0" align="end">
|
<DropdownMenuContent className="p-0" align="end">
|
||||||
<Link href={`/contributor/content/audio/detail/${row.original.id}`}>
|
<Link
|
||||||
|
href={`/contributor/content/${
|
||||||
|
row.original.mediaUpload.fileType.secondaryName &&
|
||||||
|
row.original.mediaUpload.fileType.secondaryName.toLowerCase()
|
||||||
|
}/detail/${row.original.mediaUpload.id}`}
|
||||||
|
>
|
||||||
<DropdownMenuItem className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
|
<DropdownMenuItem className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
|
||||||
<Eye className="w-4 h-4 me-1.5" />
|
<Eye className="w-4 h-4 me-1.5" />
|
||||||
View
|
View{" "}
|
||||||
|
{row.original.mediaUpload.fileType.secondaryName &&
|
||||||
|
row.original.mediaUpload.fileType.secondaryName.toLowerCase()}
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
</Link>
|
</Link>
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import {
|
||||||
listDataTracking,
|
listDataTracking,
|
||||||
mediaTrackingSave,
|
mediaTrackingSave,
|
||||||
} from "@/service/media-tracking/media-tracking";
|
} from "@/service/media-tracking/media-tracking";
|
||||||
import { error, loading } from "@/lib/swal";
|
import { error } from "@/lib/swal";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import {
|
import {
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
|
|
@ -20,31 +20,32 @@ import {
|
||||||
} from "@/components/ui/dropdown-menu";
|
} from "@/components/ui/dropdown-menu";
|
||||||
import { PaginationState } from "@tanstack/react-table";
|
import { PaginationState } from "@tanstack/react-table";
|
||||||
import page from "../page";
|
import page from "../page";
|
||||||
|
import CustomPagination from "@/components/table/custom-pagination";
|
||||||
|
import { close, loading } from "@/config/swal";
|
||||||
|
|
||||||
export default function TrackingBeritaCard() {
|
export default function TrackingBeritaCard() {
|
||||||
const [search, setSearch] = useState("");
|
const [search, setSearch] = useState("");
|
||||||
const [content, setContent] = useState<any[]>([]);
|
const [content, setContent] = useState<any[]>([]);
|
||||||
const [selectedItems, setSelectedItems] = useState<number[]>([]);
|
const [selectedItems, setSelectedItems] = useState<number[]>([]);
|
||||||
const [currentPage, setCurrentPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
const [page, setPage] = React.useState(1);
|
const [totalPage, setTotalPage] = useState(1);
|
||||||
const [showData, setShowData] = React.useState("10");
|
const [showData, setShowData] = useState("6");
|
||||||
const [pagination, setPagination] = React.useState<PaginationState>({
|
|
||||||
pageIndex: 0,
|
|
||||||
pageSize: Number(showData),
|
|
||||||
});
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
initFecth();
|
initFecth();
|
||||||
}, [showData]);
|
}, [showData, page]);
|
||||||
|
|
||||||
const initFecth = async () => {
|
const initFecth = async () => {
|
||||||
|
loading();
|
||||||
const response = await listDataTracking(showData, page - 1);
|
const response = await listDataTracking(showData, page - 1);
|
||||||
const data = response?.data?.data;
|
const data = response?.data?.data;
|
||||||
const newData = data?.content;
|
const newData = data?.content;
|
||||||
|
setTotalPage(data?.totalPages || 1);
|
||||||
newData.forEach((item: any, index: number) => {
|
newData.forEach((item: any, index: number) => {
|
||||||
item.no = (page - 1) * Number(showData) + index + 1;
|
item.no = (page - 1) * Number(showData) + index + 1;
|
||||||
});
|
});
|
||||||
setContent(response?.data?.data?.content || []);
|
setContent(response?.data?.data?.content || []);
|
||||||
|
close();
|
||||||
};
|
};
|
||||||
|
|
||||||
const fecthAll = async (keyword: string) => {
|
const fecthAll = async (keyword: string) => {
|
||||||
|
|
@ -117,17 +118,17 @@ export default function TrackingBeritaCard() {
|
||||||
value={showData}
|
value={showData}
|
||||||
onValueChange={setShowData}
|
onValueChange={setShowData}
|
||||||
>
|
>
|
||||||
<DropdownMenuRadioItem value="10">
|
<DropdownMenuRadioItem value="12">
|
||||||
1 - 10 Data
|
1 - 6 Data
|
||||||
</DropdownMenuRadioItem>
|
</DropdownMenuRadioItem>
|
||||||
<DropdownMenuRadioItem value="50">
|
<DropdownMenuRadioItem value="12">
|
||||||
1 - 50 Data
|
1 - 12 Data
|
||||||
</DropdownMenuRadioItem>
|
</DropdownMenuRadioItem>
|
||||||
<DropdownMenuRadioItem value="100">
|
<DropdownMenuRadioItem value="60">
|
||||||
1 - 100 Data
|
1 - 60 Data
|
||||||
</DropdownMenuRadioItem>
|
</DropdownMenuRadioItem>
|
||||||
<DropdownMenuRadioItem value="250">
|
<DropdownMenuRadioItem value="120">
|
||||||
1 - 250 Data
|
1 - 120 Data
|
||||||
</DropdownMenuRadioItem>
|
</DropdownMenuRadioItem>
|
||||||
</DropdownMenuRadioGroup>
|
</DropdownMenuRadioGroup>
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
|
|
@ -150,48 +151,40 @@ export default function TrackingBeritaCard() {
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4">
|
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4">
|
||||||
{content.map((item: any) => (
|
{content?.length > 1 &&
|
||||||
<Card
|
content.map((item: any) => (
|
||||||
key={item.id}
|
<Card
|
||||||
className="relative overflow-hidden shadow-sm border rounded-lg cursor-pointer"
|
key={item.id}
|
||||||
onClick={() => handleSelect(item.id)}
|
className="relative overflow-hidden shadow-sm border rounded-lg cursor-pointer"
|
||||||
>
|
onClick={() => handleSelect(item.id)}
|
||||||
<img
|
>
|
||||||
src={item.thumbnailLink}
|
<img
|
||||||
alt={item.title}
|
src={item.thumbnailLink}
|
||||||
className="w-full h-[300px] object-cover"
|
alt={item.title}
|
||||||
/>
|
className="w-full h-[300px] object-cover"
|
||||||
<div className="absolute top-2 left-2">
|
/>
|
||||||
<div className="w-5 h-5 border-2 border-white bg-white rounded-sm flex items-center justify-center">
|
<div className="absolute top-2 left-2">
|
||||||
{selectedItems.includes(item.id) && (
|
<div className="w-5 h-5 border-2 border-white bg-white rounded-sm flex items-center justify-center">
|
||||||
<div className="w-3 h-3 bg-blue-600 rounded-sm" />
|
{selectedItems.includes(item.id) && (
|
||||||
)}
|
<div className="w-3 h-3 bg-blue-600 rounded-sm" />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<p className="p-2 text-sm font-medium text-gray-800 truncate">
|
||||||
<p className="p-2 text-sm font-medium text-gray-800 truncate">
|
{item.title}
|
||||||
{item.title}
|
</p>
|
||||||
</p>
|
</Card>
|
||||||
</Card>
|
))}
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
|
<div className="mt-3">
|
||||||
<div className="flex justify-center items-center gap-2 mt-4">
|
{content && content?.length > 0 ? (
|
||||||
<Button
|
<CustomPagination
|
||||||
size="icon"
|
totalPage={totalPage}
|
||||||
variant="ghost"
|
onPageChange={(data) => setPage(data)}
|
||||||
disabled={currentPage === 1}
|
/>
|
||||||
onClick={() => setCurrentPage((p) => p - 1)}
|
) : (
|
||||||
>
|
<p>No Data</p>
|
||||||
<ChevronLeft className="w-4 h-4" />
|
)}
|
||||||
</Button>
|
|
||||||
<div className="px-3 py-1 rounded-full border">{currentPage}</div>
|
|
||||||
<Button
|
|
||||||
size="icon"
|
|
||||||
variant="ghost"
|
|
||||||
onClick={() => setCurrentPage((p) => p + 1)}
|
|
||||||
>
|
|
||||||
<ChevronRight className="w-4 h-4" />
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@ 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 } from "@/service/settings/settings";
|
||||||
import { id } from "date-fns/locale";
|
import { id } from "date-fns/locale";
|
||||||
|
import CustomPagination from "@/components/table/custom-pagination";
|
||||||
|
|
||||||
const ContentListBanner = () => {
|
const ContentListBanner = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
@ -120,10 +121,10 @@ const ContentListBanner = () => {
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
fetchData();
|
fetchData();
|
||||||
setPagination({
|
// setPagination({
|
||||||
pageIndex: 0,
|
// pageIndex: 0,
|
||||||
pageSize: Number(showData),
|
// pageSize: Number(showData),
|
||||||
});
|
// });
|
||||||
}, [page, showData]);
|
}, [page, showData]);
|
||||||
|
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
|
|
@ -398,10 +399,15 @@ const ContentListBanner = () => {
|
||||||
</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>
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
|
|
@ -122,10 +122,22 @@ const useTableColumns = () => {
|
||||||
</Button>
|
</Button>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent className="p-0" align="end">
|
<DropdownMenuContent className="p-0" align="end">
|
||||||
<DetailSettingTracking id={row.original.id} isDetail={true} />
|
<Link
|
||||||
|
href={`/admin/settings/setting-tracking/detail/${row.original.id}`}
|
||||||
<UpdateSettingTracking id={row.original.id} isUpdate={true} />
|
>
|
||||||
|
<DropdownMenuItem className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
|
||||||
|
<Eye className="w-4 h-4 me-1.5" />
|
||||||
|
View
|
||||||
|
</DropdownMenuItem>
|
||||||
|
</Link>
|
||||||
|
<Link
|
||||||
|
href={`/admin/settings/setting-tracking/update/${row.original.id}`}
|
||||||
|
>
|
||||||
|
<DropdownMenuItem className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
|
||||||
|
<SquarePen className="w-4 h-4 me-1.5" />
|
||||||
|
Edit
|
||||||
|
</DropdownMenuItem>
|
||||||
|
</Link>
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
onClick={() => handleDeleteMedia(row.original.id)}
|
onClick={() => handleDeleteMedia(row.original.id)}
|
||||||
className="p-2 border-b text-destructive bg-destructive/30 focus:bg-destructive focus:text-destructive-foreground rounded-none"
|
className="p-2 border-b text-destructive bg-destructive/30 focus:bg-destructive focus:text-destructive-foreground rounded-none"
|
||||||
|
|
|
||||||
|
|
@ -1,141 +1,141 @@
|
||||||
"use client";
|
// "use client";
|
||||||
|
|
||||||
import { Button } from "@/components/ui/button";
|
// import { Button } from "@/components/ui/button";
|
||||||
import {
|
// import {
|
||||||
Dialog,
|
// Dialog,
|
||||||
DialogContent,
|
// DialogContent,
|
||||||
DialogFooter,
|
// DialogFooter,
|
||||||
DialogHeader,
|
// DialogHeader,
|
||||||
DialogTitle,
|
// DialogTitle,
|
||||||
DialogTrigger,
|
// DialogTrigger,
|
||||||
} from "@/components/ui/dialog";
|
// } from "@/components/ui/dialog";
|
||||||
import { z } from "zod";
|
// import { z } from "zod";
|
||||||
import { useForm } from "react-hook-form";
|
// import { useForm } from "react-hook-form";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
// import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import {
|
// import {
|
||||||
Form,
|
// Form,
|
||||||
FormControl,
|
// FormControl,
|
||||||
FormDescription,
|
// FormDescription,
|
||||||
FormField,
|
// FormField,
|
||||||
FormItem,
|
// FormItem,
|
||||||
FormLabel,
|
// FormLabel,
|
||||||
FormMessage,
|
// FormMessage,
|
||||||
} from "@/components/ui/form";
|
// } from "@/components/ui/form";
|
||||||
import { useRouter } from "@/i18n/routing";
|
// import { useRouter } from "@/i18n/routing";
|
||||||
import { Input } from "@/components/ui/input";
|
// import { Input } from "@/components/ui/input";
|
||||||
import { Checkbox } from "@/components/ui/checkbox";
|
// import { Checkbox } from "@/components/ui/checkbox";
|
||||||
import { getUserRoles, postCategory } from "@/service/settings/settings";
|
// import { getUserRoles, postCategory } from "@/service/settings/settings";
|
||||||
import { Fragment, useEffect, useState } from "react";
|
// import { Fragment, useEffect, useState } from "react";
|
||||||
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
|
// import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
|
||||||
import { Icon } from "@iconify/react/dist/iconify.js";
|
// import { Icon } from "@iconify/react/dist/iconify.js";
|
||||||
import { Textarea } from "@/components/ui/textarea";
|
// import { Textarea } from "@/components/ui/textarea";
|
||||||
import { close, error, loading } from "@/config/swal";
|
// import { close, error, loading } from "@/config/swal";
|
||||||
import { useToast } from "@/components/ui/use-toast";
|
// import { useToast } from "@/components/ui/use-toast";
|
||||||
import { stringify } from "querystring";
|
// import { stringify } from "querystring";
|
||||||
import { useDropzone } from "react-dropzone";
|
// import { useDropzone } from "react-dropzone";
|
||||||
import { CloudUpload } from "lucide-react";
|
// import { CloudUpload } from "lucide-react";
|
||||||
import Image from "next/image";
|
// import Image from "next/image";
|
||||||
import { Upload } from "tus-js-client";
|
// import { Upload } from "tus-js-client";
|
||||||
import { getCookiesDecrypt } from "@/lib/utils";
|
// import { getCookiesDecrypt } from "@/lib/utils";
|
||||||
import Cookies from "js-cookie";
|
// import Cookies from "js-cookie";
|
||||||
import { useTranslations } from "next-intl";
|
// import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
const wilayahList = [
|
// const wilayahList = [
|
||||||
{ id: "mabes", label: "Mabes" },
|
// { id: "mabes", label: "Mabes" },
|
||||||
{ id: "polda", label: "Polda" },
|
// { id: "polda", label: "Polda" },
|
||||||
{ id: "satker", label: "Satker" },
|
// { id: "satker", label: "Satker" },
|
||||||
];
|
// ];
|
||||||
|
|
||||||
const jumlahList = [5, 10, 15, 20, 25, 30];
|
// const jumlahList = [5, 10, 15, 20, 25, 30];
|
||||||
|
|
||||||
export default function CreateSettingTracking() {
|
// export default function CreateSettingTracking() {
|
||||||
const t = useTranslations("Menu");
|
// const t = useTranslations("Menu");
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
// const [isOpen, setIsOpen] = useState(false);
|
||||||
|
|
||||||
const form = useForm({
|
// const form = useForm({
|
||||||
defaultValues: {
|
// defaultValues: {
|
||||||
wilayah: [] as string[],
|
// wilayah: [] as string[],
|
||||||
jumlah: [] as number[],
|
// jumlah: [] as number[],
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
|
|
||||||
const onSubmit = (values: any) => {
|
// const onSubmit = (values: any) => {
|
||||||
console.log("Submitted values:", values);
|
// console.log("Submitted values:", values);
|
||||||
setIsOpen(false);
|
// setIsOpen(false);
|
||||||
};
|
// };
|
||||||
|
|
||||||
return (
|
// return (
|
||||||
<Dialog open={isOpen} onOpenChange={setIsOpen}>
|
// <Dialog open={isOpen} onOpenChange={setIsOpen}>
|
||||||
<DialogTrigger asChild>
|
// <DialogTrigger asChild>
|
||||||
<Button onClick={() => setIsOpen(true)}>Tambah Setting Tracking</Button>
|
// <Button onClick={() => setIsOpen(true)}>Tambah Setting Tracking</Button>
|
||||||
</DialogTrigger>
|
// </DialogTrigger>
|
||||||
|
|
||||||
<DialogContent className="sm:max-w-md">
|
// <DialogContent className="sm:max-w-md">
|
||||||
<DialogHeader>
|
// <DialogHeader>
|
||||||
<DialogTitle>Add Setting Tracking Berita Harian</DialogTitle>
|
// <DialogTitle>Add Setting Tracking Berita Harian</DialogTitle>
|
||||||
</DialogHeader>
|
// </DialogHeader>
|
||||||
|
|
||||||
<Form {...form}>
|
// <Form {...form}>
|
||||||
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
|
// <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
|
||||||
{/* Wilayah */}
|
// {/* Wilayah */}
|
||||||
<FormField
|
// <FormField
|
||||||
control={form.control}
|
// control={form.control}
|
||||||
name="wilayah"
|
// name="wilayah"
|
||||||
render={({ field }) => (
|
// render={({ field }) => (
|
||||||
<FormItem>
|
// <FormItem>
|
||||||
<FormLabel>Wilayah</FormLabel>
|
// <FormLabel>Wilayah</FormLabel>
|
||||||
<div className="flex gap-4">
|
// <div className="flex gap-4">
|
||||||
{wilayahList.map((item) => (
|
// {wilayahList.map((item) => (
|
||||||
<div key={item.id} className="flex items-center gap-2">
|
// <div key={item.id} className="flex items-center gap-2">
|
||||||
<Checkbox
|
// <Checkbox
|
||||||
checked={field.value.includes(item.id)}
|
// checked={field.value.includes(item.id)}
|
||||||
onCheckedChange={(checked) => {
|
// onCheckedChange={(checked) => {
|
||||||
const updated = checked
|
// const updated = checked
|
||||||
? [...field.value, item.id]
|
// ? [...field.value, item.id]
|
||||||
: field.value.filter((val) => val !== item.id);
|
// : field.value.filter((val) => val !== item.id);
|
||||||
field.onChange(updated);
|
// field.onChange(updated);
|
||||||
}}
|
// }}
|
||||||
/>
|
// />
|
||||||
<label className="text-sm">{item.label}</label>
|
// <label className="text-sm">{item.label}</label>
|
||||||
</div>
|
// </div>
|
||||||
))}
|
// ))}
|
||||||
</div>
|
// </div>
|
||||||
</FormItem>
|
// </FormItem>
|
||||||
)}
|
// )}
|
||||||
/>
|
// />
|
||||||
|
|
||||||
<FormField
|
// <FormField
|
||||||
control={form.control}
|
// control={form.control}
|
||||||
name="jumlah"
|
// name="jumlah"
|
||||||
render={({ field }) => (
|
// render={({ field }) => (
|
||||||
<FormItem>
|
// <FormItem>
|
||||||
<FormLabel>Jumlah Tracking Berita Harian</FormLabel>
|
// <FormLabel>Jumlah Tracking Berita Harian</FormLabel>
|
||||||
<div className="flex gap-4 flex-wrap">
|
// <div className="flex gap-4 flex-wrap">
|
||||||
{jumlahList.map((num) => (
|
// {jumlahList.map((num) => (
|
||||||
<div key={num} className="flex items-center gap-2">
|
// <div key={num} className="flex items-center gap-2">
|
||||||
<Checkbox
|
// <Checkbox
|
||||||
checked={field.value.includes(num)}
|
// checked={field.value.includes(num)}
|
||||||
onCheckedChange={(checked) => {
|
// onCheckedChange={(checked) => {
|
||||||
const updated = checked
|
// const updated = checked
|
||||||
? [...field.value, num]
|
// ? [...field.value, num]
|
||||||
: field.value.filter((val) => val !== num);
|
// : field.value.filter((val) => val !== num);
|
||||||
field.onChange(updated);
|
// field.onChange(updated);
|
||||||
}}
|
// }}
|
||||||
/>
|
// />
|
||||||
<label className="text-sm">{num}</label>
|
// <label className="text-sm">{num}</label>
|
||||||
</div>
|
// </div>
|
||||||
))}
|
// ))}
|
||||||
</div>
|
// </div>
|
||||||
</FormItem>
|
// </FormItem>
|
||||||
)}
|
// )}
|
||||||
/>
|
// />
|
||||||
|
|
||||||
<DialogFooter>
|
// <DialogFooter>
|
||||||
<Button type="submit">Tambah Setting</Button>
|
// <Button type="submit">Tambah Setting</Button>
|
||||||
</DialogFooter>
|
// </DialogFooter>
|
||||||
</form>
|
// </form>
|
||||||
</Form>
|
// </Form>
|
||||||
</DialogContent>
|
// </DialogContent>
|
||||||
</Dialog>
|
// </Dialog>
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,8 @@ import {
|
||||||
PopoverContent,
|
PopoverContent,
|
||||||
PopoverTrigger,
|
PopoverTrigger,
|
||||||
} from "@/components/ui/popover";
|
} from "@/components/ui/popover";
|
||||||
import CreateSettingTracking from "./create";
|
|
||||||
import useTableColumns from "./column";
|
import useTableColumns from "./column";
|
||||||
|
import { UploadIcon } from "lucide-react";
|
||||||
|
|
||||||
const AdminSettingTrackingTable = () => {
|
const AdminSettingTrackingTable = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
@ -190,7 +190,15 @@ const AdminSettingTrackingTable = () => {
|
||||||
return (
|
return (
|
||||||
<div className="w-full overflow-x-auto bg-white p-4 rounded-sm space-y-3">
|
<div className="w-full overflow-x-auto bg-white p-4 rounded-sm space-y-3">
|
||||||
<div className="flex items-end justify-between">
|
<div className="flex items-end justify-between">
|
||||||
<CreateSettingTracking />
|
{/* <CreateSettingTracking /> */}
|
||||||
|
<div className="flex-none">
|
||||||
|
<Link href={"/admin/settings/setting-tracking/create"}>
|
||||||
|
<Button color="primary" className="text-white" size="md">
|
||||||
|
<UploadIcon size={18} className="mr-2" />
|
||||||
|
Tambah Setting Tracking
|
||||||
|
</Button>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
<Popover>
|
<Popover>
|
||||||
<PopoverTrigger asChild>
|
<PopoverTrigger asChild>
|
||||||
<Button size="md" variant="outline">
|
<Button size="md" variant="outline">
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
import CreateSettingTracking from "@/components/form/media-tracking/setting-tracking-form";
|
||||||
|
import SiteBreadcrumb from "@/components/site-breadcrumb";
|
||||||
|
|
||||||
|
const SettingTrackingCreatePage = () => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<SiteBreadcrumb />
|
||||||
|
<div className="space-y-4">
|
||||||
|
<CreateSettingTracking />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SettingTrackingCreatePage;
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
import DetailSettingTracking from "@/components/form/media-tracking/setting-tracking-detail-form";
|
||||||
|
import SiteBreadcrumb from "@/components/site-breadcrumb";
|
||||||
|
|
||||||
|
const SettingTrackingDetailPage = () => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<SiteBreadcrumb />
|
||||||
|
<div className="space-y-4">
|
||||||
|
<DetailSettingTracking />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SettingTrackingDetailPage;
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
import UpdateSettingTracking from "@/components/form/media-tracking/setting-tracking-update-form";
|
||||||
|
import SiteBreadcrumb from "@/components/site-breadcrumb";
|
||||||
|
|
||||||
|
const SettingTrackingUpdatePage = () => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<SiteBreadcrumb />
|
||||||
|
<div className="space-y-4">
|
||||||
|
<UpdateSettingTracking />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SettingTrackingUpdatePage;
|
||||||
|
|
@ -52,7 +52,7 @@ import { InputGroup, InputGroupText } from "@/components/ui/input-group";
|
||||||
import { paginationBlog } from "@/service/blog/blog";
|
import { paginationBlog } from "@/service/blog/blog";
|
||||||
import { ticketingPagination } from "@/service/ticketing/ticketing";
|
import { ticketingPagination } from "@/service/ticketing/ticketing";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { useRouter, useSearchParams } from "next/navigation";
|
import { useParams, useRouter, useSearchParams } from "next/navigation";
|
||||||
import TablePagination from "@/components/table/table-pagination";
|
import TablePagination from "@/components/table/table-pagination";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|
@ -73,6 +73,9 @@ import useTableColumns from "./columns";
|
||||||
const TableImage = () => {
|
const TableImage = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
|
|
||||||
|
const params = useParams();
|
||||||
|
const locale = params?.locale;
|
||||||
const MySwal = withReactContent(Swal);
|
const MySwal = withReactContent(Swal);
|
||||||
const [dataTable, setDataTable] = React.useState<any[]>([]);
|
const [dataTable, setDataTable] = React.useState<any[]>([]);
|
||||||
const [totalData, setTotalData] = React.useState<number>(1);
|
const [totalData, setTotalData] = React.useState<number>(1);
|
||||||
|
|
@ -199,7 +202,8 @@ const TableImage = () => {
|
||||||
formattedStartDate, // Pastikan format sesuai
|
formattedStartDate, // Pastikan format sesuai
|
||||||
formattedEndDate, // Pastikan format sesuai
|
formattedEndDate, // Pastikan format sesuai
|
||||||
search,
|
search,
|
||||||
filterByCreatorGroup
|
filterByCreatorGroup,
|
||||||
|
locale == "en"
|
||||||
);
|
);
|
||||||
|
|
||||||
const data = res?.data?.data;
|
const data = res?.data?.data;
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ export default function Questions() {
|
||||||
<Icon icon="ic:baseline-email" width={22} color="#2563eb" />
|
<Icon icon="ic:baseline-email" width={22} color="#2563eb" />
|
||||||
Email
|
Email
|
||||||
</Link>
|
</Link>
|
||||||
<Link
|
{/* <Link
|
||||||
href="/supervisor/communications/questions/facebook"
|
href="/supervisor/communications/questions/facebook"
|
||||||
className="flex items-center gap-3"
|
className="flex items-center gap-3"
|
||||||
>
|
>
|
||||||
|
|
@ -89,7 +89,7 @@ export default function Questions() {
|
||||||
color="#2563eb"
|
color="#2563eb"
|
||||||
/>
|
/>
|
||||||
Instagram
|
Instagram
|
||||||
</Link>
|
</Link> */}
|
||||||
<Link
|
<Link
|
||||||
href="/supervisor/communications/questions/whatsapp"
|
href="/supervisor/communications/questions/whatsapp"
|
||||||
className="flex items-center gap-3"
|
className="flex items-center gap-3"
|
||||||
|
|
@ -97,13 +97,13 @@ export default function Questions() {
|
||||||
<Icon icon="ri:whatsapp-fill" width={24} color="#2563eb" />
|
<Icon icon="ri:whatsapp-fill" width={24} color="#2563eb" />
|
||||||
Whatsapp
|
Whatsapp
|
||||||
</Link>
|
</Link>
|
||||||
<Link
|
{/* <Link
|
||||||
href="/supervisor/communications/questions/youtube"
|
href="/supervisor/communications/questions/youtube"
|
||||||
className="flex items-center gap-3"
|
className="flex items-center gap-3"
|
||||||
>
|
>
|
||||||
<Icon icon="mdi:youtube" width={24} color="#2563eb" />
|
<Icon icon="mdi:youtube" width={24} color="#2563eb" />
|
||||||
Youtube
|
Youtube
|
||||||
</Link>
|
</Link> */}
|
||||||
<Link
|
<Link
|
||||||
href="/supervisor/communications/questions/inbox"
|
href="/supervisor/communications/questions/inbox"
|
||||||
className="flex items-center gap-3"
|
className="flex items-center gap-3"
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
import { Reveal } from "@/components/landing-page/Reveal";
|
import { Reveal } from "@/components/landing-page/Reveal";
|
||||||
import { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
import { getHeroData, listData } from "@/service/landing/landing";
|
import { listData } from "@/service/landing/landing";
|
||||||
import { formatDateToIndonesian } from "@/utils/globals";
|
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { useParams } from "next/navigation";
|
import { useParams } from "next/navigation";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"use client";
|
"use client";
|
||||||
import { Link } from "@/i18n/routing";
|
import { Link } from "@/i18n/routing";
|
||||||
import { getHeroData, listCarousel, listData } from "@/service/landing/landing";
|
import { listData } from "@/service/landing/landing";
|
||||||
import { formatDateToIndonesian, textEllipsis } from "@/utils/globals";
|
import { formatDateToIndonesian, textEllipsis } from "@/utils/globals";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ const PopularNews = () => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
const response = await getHeroData();
|
const response = await getHeroData(locale == "en");
|
||||||
console.log(response);
|
console.log(response);
|
||||||
setHeroData(response?.data?.data?.content);
|
setHeroData(response?.data?.data?.content);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
import { Reveal } from "@/components/landing-page/Reveal";
|
import { Reveal } from "@/components/landing-page/Reveal";
|
||||||
import { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
import { getHeroData, listData } from "@/service/landing/landing";
|
import { listData } from "@/service/landing/landing";
|
||||||
import { formatDateToIndonesian } from "@/utils/globals";
|
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { useParams } from "next/navigation";
|
import { useParams } from "next/navigation";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,8 @@ import { Icon } from "@iconify/react/dist/iconify.js";
|
||||||
import { Link } from "@/i18n/routing";
|
import { Link } from "@/i18n/routing";
|
||||||
import { loading } from "@/lib/swal";
|
import { loading } from "@/lib/swal";
|
||||||
import { id } from "date-fns/locale";
|
import { id } from "date-fns/locale";
|
||||||
|
import { htmlToString } from "@/utils/globals";
|
||||||
|
import InfoLainnyaModal from "../ticketing/info-lainnya";
|
||||||
|
|
||||||
const taskSchema = z.object({
|
const taskSchema = z.object({
|
||||||
title: z.string().min(1, { message: "Judul diperlukan" }),
|
title: z.string().min(1, { message: "Judul diperlukan" }),
|
||||||
|
|
@ -63,6 +65,7 @@ export default function FormDetailEscalation() {
|
||||||
const [listDiscussion, setListDiscussion] = useState();
|
const [listDiscussion, setListDiscussion] = useState();
|
||||||
const [message, setMessage] = useState("");
|
const [message, setMessage] = useState("");
|
||||||
const [selectedPriority, setSelectedPriority] = useState("");
|
const [selectedPriority, setSelectedPriority] = useState("");
|
||||||
|
const [openEmergencyModal, setOpenEmergencyModal] = useState(false);
|
||||||
const [replyMessage, setReplyMessage] = useState("");
|
const [replyMessage, setReplyMessage] = useState("");
|
||||||
const [replies, setReplies] = useState([
|
const [replies, setReplies] = useState([
|
||||||
{
|
{
|
||||||
|
|
@ -136,6 +139,10 @@ export default function FormDetailEscalation() {
|
||||||
setReplyMessage("");
|
setReplyMessage("");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const openEmergencyIssueDetail = () => {
|
||||||
|
setOpenEmergencyModal(true);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
|
|
@ -179,6 +186,29 @@ export default function FormDetailEscalation() {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p className="p-5 bg-white">{detail.message}</p>
|
<p className="p-5 bg-white">{detail.message}</p>
|
||||||
|
<div className="px-4 py-1 bg-white text-sm">
|
||||||
|
{detail?.typeId === 6 && detail?.emergencyIssue ? (
|
||||||
|
<div className="row mx-0 mb-3 emergency-attachments">
|
||||||
|
<div className=" mr-4">
|
||||||
|
<Button
|
||||||
|
color="primary"
|
||||||
|
size="md"
|
||||||
|
onClick={openEmergencyIssueDetail}
|
||||||
|
>
|
||||||
|
Info Lainnya
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{detail?.emergencyIssue && (
|
||||||
|
<InfoLainnyaModal
|
||||||
|
open={openEmergencyModal}
|
||||||
|
onClose={() => setOpenEmergencyModal(false)}
|
||||||
|
data={detail.emergencyIssue}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,8 @@ import {
|
||||||
import { ChevronDownIcon } from "lucide-react";
|
import { ChevronDownIcon } from "lucide-react";
|
||||||
import { getOperatorUser } from "@/service/management-user/management-user";
|
import { getOperatorUser } from "@/service/management-user/management-user";
|
||||||
import { getCookiesDecrypt } from "@/lib/utils";
|
import { getCookiesDecrypt } from "@/lib/utils";
|
||||||
|
import { htmlToString } from "@/utils/globals";
|
||||||
|
import InfoLainnyaModal from "../ticketing/info-lainnya";
|
||||||
|
|
||||||
const taskSchema = z.object({
|
const taskSchema = z.object({
|
||||||
title: z.string().min(1, { message: "Judul diperlukan" }),
|
title: z.string().min(1, { message: "Judul diperlukan" }),
|
||||||
|
|
|
||||||
|
|
@ -51,10 +51,8 @@ import { ChevronDownIcon } from "lucide-react";
|
||||||
import { getOperatorUser } from "@/service/management-user/management-user";
|
import { getOperatorUser } from "@/service/management-user/management-user";
|
||||||
|
|
||||||
const taskSchema = z.object({
|
const taskSchema = z.object({
|
||||||
title: z.string().min(1, { message: "Judul diperlukan" }),
|
message: z.string().optional(),
|
||||||
description: z.string().min(2, {
|
description: z.string().optional(),
|
||||||
message: "Narasi Penugasan harus lebih dari 2 karakter.",
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export type taskDetail = {
|
export type taskDetail = {
|
||||||
|
|
@ -509,7 +507,7 @@ export default function FormQuestionsReply() {
|
||||||
<Label>Judul</Label>
|
<Label>Judul</Label>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="title"
|
name="message"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<Input
|
<Input
|
||||||
size="md"
|
size="md"
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ import { UnitMapping } from "@/app/[locale]/(protected)/contributor/agenda-setti
|
||||||
import SuggestionModal from "@/components/modal/suggestions-modal";
|
import SuggestionModal from "@/components/modal/suggestions-modal";
|
||||||
import { formatDateToIndonesian } from "@/utils/globals";
|
import { formatDateToIndonesian } from "@/utils/globals";
|
||||||
import ApprovalHistoryModal from "@/components/modal/approval-history-modal";
|
import ApprovalHistoryModal from "@/components/modal/approval-history-modal";
|
||||||
|
import Image from "next/image";
|
||||||
|
|
||||||
const imageSchema = z.object({
|
const imageSchema = z.object({
|
||||||
title: z.string().min(1, { message: "Judul diperlukan" }),
|
title: z.string().min(1, { message: "Judul diperlukan" }),
|
||||||
|
|
@ -437,6 +438,22 @@ export default function FormImageDetail() {
|
||||||
successCallback();
|
successCallback();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const [portraitMap, setPortraitMap] = useState<any>({});
|
||||||
|
|
||||||
|
const handleImageLoad = (e: any, index: number) => {
|
||||||
|
const { naturalWidth, naturalHeight } = e.target;
|
||||||
|
const isPortrait = naturalHeight > naturalWidth;
|
||||||
|
|
||||||
|
setPortraitMap((prev: any) => ({
|
||||||
|
...prev,
|
||||||
|
[index]: isPortrait,
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
console.log("portrai", portraitMap);
|
||||||
|
}, [portraitMap]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form>
|
<form>
|
||||||
{detail !== undefined ? (
|
{detail !== undefined ? (
|
||||||
|
|
@ -513,19 +530,19 @@ export default function FormImageDetail() {
|
||||||
thumbs={{ swiper: thumbsSwiper }}
|
thumbs={{ swiper: thumbsSwiper }}
|
||||||
modules={[FreeMode, Navigation, Thumbs]}
|
modules={[FreeMode, Navigation, Thumbs]}
|
||||||
navigation={false}
|
navigation={false}
|
||||||
className="w-full"
|
className="h-[480px] object-cover w-full"
|
||||||
>
|
>
|
||||||
{detailThumb?.map((data: any) => (
|
{detailThumb?.map((data: any) => (
|
||||||
<SwiperSlide key={data.id}>
|
<SwiperSlide key={data.id}>
|
||||||
<img
|
<img
|
||||||
className="object-fill h-full w-full rounded-md"
|
className="h-[480px] max-w-[600px] rounded-md object-cover mx-auto border-2"
|
||||||
src={data}
|
src={data}
|
||||||
alt={` ${data.id}`}
|
alt={` ${data.id}`}
|
||||||
/>
|
/>
|
||||||
</SwiperSlide>
|
</SwiperSlide>
|
||||||
))}
|
))}
|
||||||
</Swiper>
|
</Swiper>
|
||||||
<div className=" mt-2 ">
|
<div className="mt-2 mx-auto min-w-fit max-w-[600px]">
|
||||||
<Swiper
|
<Swiper
|
||||||
onSwiper={setThumbsSwiper}
|
onSwiper={setThumbsSwiper}
|
||||||
slidesPerView={6}
|
slidesPerView={6}
|
||||||
|
|
@ -539,7 +556,7 @@ export default function FormImageDetail() {
|
||||||
{detailThumb?.map((data: any) => (
|
{detailThumb?.map((data: any) => (
|
||||||
<SwiperSlide key={data.id}>
|
<SwiperSlide key={data.id}>
|
||||||
<img
|
<img
|
||||||
className="object-cover h-[60px] w-[80px]"
|
className="object-cover h-[60px] w-[80px] border-2 border-slate-100"
|
||||||
src={data}
|
src={data}
|
||||||
alt={` ${data.id}`}
|
alt={` ${data.id}`}
|
||||||
/>
|
/>
|
||||||
|
|
@ -579,11 +596,11 @@ export default function FormImageDetail() {
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-3 px-3 space-y-2">
|
<div className="mt-3 px-3 space-y-2">
|
||||||
<Label>{t("preview")}</Label>
|
<Label>{t("preview")}</Label>
|
||||||
<Card className="mt-2">
|
<Card className="mt-2 w-fit">
|
||||||
<img
|
<img
|
||||||
src={detail.thumbnailLink}
|
src={detail.thumbnailLink}
|
||||||
alt="Thumbnail Gambar Utama"
|
alt="Thumbnail Gambar Utama"
|
||||||
className="w-full h-auto rounded"
|
className="h-[200px] rounded"
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -666,7 +683,7 @@ export default function FormImageDetail() {
|
||||||
""
|
""
|
||||||
)} */}
|
)} */}
|
||||||
|
|
||||||
{detail?.isPublish == false && detail.isPublishOnPolda == true ? (
|
{(detail?.isPublish == false && detail.isPublishOnPolda == true) || (detail?.isPublish == false && detail?.isInternationalMedia == true && Number(detail?.statusId) == 2) ? (
|
||||||
<div className="flex flex-col gap-2 p-3">
|
<div className="flex flex-col gap-2 p-3">
|
||||||
<Button
|
<Button
|
||||||
onClick={() => publishToMabes()}
|
onClick={() => publishToMabes()}
|
||||||
|
|
@ -699,119 +716,139 @@ export default function FormImageDetail() {
|
||||||
)} */}
|
)} */}
|
||||||
|
|
||||||
<Dialog open={modalOpen} onOpenChange={setModalOpen}>
|
<Dialog open={modalOpen} onOpenChange={setModalOpen}>
|
||||||
<DialogContent className="min-w-max h-[600px] overflow-y-auto">
|
<DialogContent size="md" className="max-h-[600px]">
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>{t("leave-comment")}</DialogTitle>
|
<DialogTitle>{t("leave-comment")}</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
{status == "2"
|
<div className="flex flex-col gap-2 max-h-[208px] md:max-h-[312px] overflow-y-auto">
|
||||||
? files?.map((file, index) => (
|
{status == "2"
|
||||||
<div
|
? files?.map((file, index) => (
|
||||||
key={file.id}
|
<div
|
||||||
className="flex flex-row gap-2 items-center"
|
key={file.id}
|
||||||
>
|
className="flex flex-row gap-5 items-center w-full"
|
||||||
<img src={file.url} className="w-[200px]" />
|
>
|
||||||
<div className="flex flex-col gap-2 w-full">
|
<div className="w-[200px] h-[100px] flex justify-center items-center">
|
||||||
<div className="flex justify-between text-sm">
|
<img
|
||||||
{file.fileName}
|
key={index}
|
||||||
<a
|
alt={`files-${index + 1}`}
|
||||||
onClick={() =>
|
src={file.url}
|
||||||
handleDeleteFileApproval(file.id)
|
onLoad={(e) => handleImageLoad(e, index)}
|
||||||
}
|
className={`h-[100px] object-cover ${
|
||||||
>
|
portraitMap[index] ? "w-auto" : "!w-[200px]"
|
||||||
<Icon icon="humbleicons:times" color="red" />
|
}`}
|
||||||
</a>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{isUserMabesApprover && (
|
<div className="flex flex-col gap-2 w-full">
|
||||||
<div className="flex flex-row gap-2">
|
<div className="flex justify-between text-sm">
|
||||||
<div className="flex items-center space-x-2">
|
{file.fileName}
|
||||||
<Checkbox
|
<a
|
||||||
id="terms"
|
onClick={() =>
|
||||||
value="all"
|
handleDeleteFileApproval(file.id)
|
||||||
checked={filePlacements[index]?.includes(
|
}
|
||||||
"all"
|
>
|
||||||
)}
|
<Icon icon="humbleicons:times" color="red" />
|
||||||
onCheckedChange={(e) =>
|
</a>
|
||||||
setupPlacement(index, "all", Boolean(e))
|
</div>
|
||||||
}
|
{isUserMabesApprover && (
|
||||||
/>
|
<div className="flex flex-row gap-2">
|
||||||
<label
|
<div className="flex items-center space-x-2">
|
||||||
htmlFor="terms"
|
<Checkbox
|
||||||
className="text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
id="terms"
|
||||||
>
|
value="all"
|
||||||
{t("all")}
|
checked={filePlacements[index]?.includes(
|
||||||
</label>
|
"all"
|
||||||
</div>
|
)}
|
||||||
<div className="flex items-center space-x-2">
|
onCheckedChange={(e) =>
|
||||||
<Checkbox
|
setupPlacement(index, "all", Boolean(e))
|
||||||
id="terms"
|
|
||||||
checked={filePlacements[index]?.includes(
|
|
||||||
"mabes"
|
|
||||||
)}
|
|
||||||
onCheckedChange={(e) =>
|
|
||||||
setupPlacement(index, "mabes", Boolean(e))
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<label
|
|
||||||
htmlFor="terms"
|
|
||||||
className="text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
||||||
>
|
|
||||||
Nasional
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center space-x-2">
|
|
||||||
<Checkbox
|
|
||||||
id="terms"
|
|
||||||
checked={filePlacements[index]?.includes(
|
|
||||||
"polda"
|
|
||||||
)}
|
|
||||||
onCheckedChange={(e) =>
|
|
||||||
setupPlacement(index, "polda", Boolean(e))
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<label
|
|
||||||
htmlFor="terms"
|
|
||||||
className="text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
||||||
>
|
|
||||||
Wilayah
|
|
||||||
</label>
|
|
||||||
{wilayahPublish.polda && (
|
|
||||||
<UnitMapping
|
|
||||||
unit="Polda"
|
|
||||||
isDetail={false}
|
|
||||||
sendDataToParent={(data: any) =>
|
|
||||||
setSelectedPolda(data)
|
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
<label
|
||||||
</div>
|
htmlFor="terms"
|
||||||
|
className="text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||||
<div className="flex items-center space-x-2">
|
>
|
||||||
<Checkbox
|
{t("all")}
|
||||||
id="terms"
|
</label>
|
||||||
checked={filePlacements[index]?.includes(
|
</div>
|
||||||
"international"
|
<div className="flex items-center space-x-2">
|
||||||
|
<Checkbox
|
||||||
|
id="terms"
|
||||||
|
checked={filePlacements[index]?.includes(
|
||||||
|
"mabes"
|
||||||
|
)}
|
||||||
|
onCheckedChange={(e) =>
|
||||||
|
setupPlacement(
|
||||||
|
index,
|
||||||
|
"mabes",
|
||||||
|
Boolean(e)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<label
|
||||||
|
htmlFor="terms"
|
||||||
|
className="text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||||
|
>
|
||||||
|
Nasional
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center space-x-2">
|
||||||
|
<Checkbox
|
||||||
|
id="terms"
|
||||||
|
checked={filePlacements[index]?.includes(
|
||||||
|
"polda"
|
||||||
|
)}
|
||||||
|
onCheckedChange={(e) =>
|
||||||
|
setupPlacement(
|
||||||
|
index,
|
||||||
|
"polda",
|
||||||
|
Boolean(e)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<label
|
||||||
|
htmlFor="terms"
|
||||||
|
className="text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||||
|
>
|
||||||
|
Wilayah
|
||||||
|
</label>
|
||||||
|
{wilayahPublish.polda && (
|
||||||
|
<UnitMapping
|
||||||
|
unit="Polda"
|
||||||
|
isDetail={false}
|
||||||
|
sendDataToParent={(data: any) =>
|
||||||
|
setSelectedPolda(data)
|
||||||
|
}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
onCheckedChange={(e) =>
|
</div>
|
||||||
setupPlacement(
|
|
||||||
index,
|
<div className="flex items-center space-x-2">
|
||||||
"international",
|
<Checkbox
|
||||||
Boolean(e)
|
id="terms"
|
||||||
)
|
checked={filePlacements[index]?.includes(
|
||||||
}
|
"international"
|
||||||
/>
|
)}
|
||||||
<label
|
onCheckedChange={(e) =>
|
||||||
htmlFor="terms"
|
setupPlacement(
|
||||||
className="text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
index,
|
||||||
>
|
"international",
|
||||||
Internasional
|
Boolean(e)
|
||||||
</label>
|
)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<label
|
||||||
|
htmlFor="terms"
|
||||||
|
className="text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||||
|
>
|
||||||
|
Internasional
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
)}
|
||||||
)}
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
))
|
||||||
))
|
: ""}
|
||||||
: ""}
|
</div>
|
||||||
<div className="flex flex-col gap-4">
|
<div className="flex flex-col gap-4">
|
||||||
<Textarea
|
<Textarea
|
||||||
placeholder="Type your message here."
|
placeholder="Type your message here."
|
||||||
|
|
@ -821,7 +858,8 @@ export default function FormImageDetail() {
|
||||||
</div>
|
</div>
|
||||||
{status == "3" || status == "4" ? (
|
{status == "3" || status == "4" ? (
|
||||||
<div className="flex flex-row gap-2">
|
<div className="flex flex-row gap-2">
|
||||||
<Badge
|
<Button
|
||||||
|
size="sm"
|
||||||
color={
|
color={
|
||||||
description === "Kualitas media kurang baik"
|
description === "Kualitas media kurang baik"
|
||||||
? "primary"
|
? "primary"
|
||||||
|
|
@ -833,9 +871,10 @@ export default function FormImageDetail() {
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
Kualitas media kurang baik
|
Kualitas media kurang baik
|
||||||
</Badge>
|
</Button>
|
||||||
|
|
||||||
<Badge
|
<Button
|
||||||
|
size="sm"
|
||||||
color={
|
color={
|
||||||
description === "Deskripsi kurang lengkap"
|
description === "Deskripsi kurang lengkap"
|
||||||
? "primary"
|
? "primary"
|
||||||
|
|
@ -847,8 +886,9 @@ export default function FormImageDetail() {
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
Deskripsi kurang lengkap
|
Deskripsi kurang lengkap
|
||||||
</Badge>
|
</Button>
|
||||||
<Badge
|
<Button
|
||||||
|
size="sm"
|
||||||
color={
|
color={
|
||||||
description === "Judul kurang tepat"
|
description === "Judul kurang tepat"
|
||||||
? "primary"
|
? "primary"
|
||||||
|
|
@ -858,11 +898,12 @@ export default function FormImageDetail() {
|
||||||
onClick={() => setDescription("Judul kurang tepat")}
|
onClick={() => setDescription("Judul kurang tepat")}
|
||||||
>
|
>
|
||||||
Judul kurang tepat
|
Judul kurang tepat
|
||||||
</Badge>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex flex-row gap-2">
|
<div className="flex flex-row gap-2">
|
||||||
<Badge
|
<Button
|
||||||
|
size="sm"
|
||||||
color={
|
color={
|
||||||
description === "Konten sangat bagus"
|
description === "Konten sangat bagus"
|
||||||
? "primary"
|
? "primary"
|
||||||
|
|
@ -872,8 +913,9 @@ export default function FormImageDetail() {
|
||||||
onClick={() => setDescription("Konten sangat bagus")}
|
onClick={() => setDescription("Konten sangat bagus")}
|
||||||
>
|
>
|
||||||
Konten sangat bagus
|
Konten sangat bagus
|
||||||
</Badge>
|
</Button>
|
||||||
<Badge
|
<Button
|
||||||
|
size="sm"
|
||||||
color={
|
color={
|
||||||
description === "Konten menarik"
|
description === "Konten menarik"
|
||||||
? "primary"
|
? "primary"
|
||||||
|
|
@ -883,31 +925,34 @@ export default function FormImageDetail() {
|
||||||
onClick={() => setDescription("Konten menarik")}
|
onClick={() => setDescription("Konten menarik")}
|
||||||
>
|
>
|
||||||
Konten menarik
|
Konten menarik
|
||||||
</Badge>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<Button
|
<div className="flex flex-row gap-2 justify-end">
|
||||||
type="button"
|
{" "}
|
||||||
color="primary"
|
<Button
|
||||||
onClick={() => submit()}
|
type="button"
|
||||||
>
|
color="primary"
|
||||||
{t("submit")}
|
onClick={() => submit()}
|
||||||
</Button>
|
>
|
||||||
<Button
|
{t("submit")}
|
||||||
type="button"
|
</Button>
|
||||||
color="destructive"
|
<Button
|
||||||
onClick={() => {
|
type="button"
|
||||||
setModalOpen(false);
|
color="destructive"
|
||||||
}}
|
onClick={() => {
|
||||||
>
|
setModalOpen(false);
|
||||||
{t("cancel")}
|
}}
|
||||||
</Button>
|
>
|
||||||
|
{t("cancel")}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</Card>
|
</Card>
|
||||||
{Number(detail?.needApprovalFromLevel) == Number(userLevelId) ? (
|
{(Number(detail?.needApprovalFromLevel) == Number(userLevelId)) || (detail?.isInternationalMedia == true && detail?.isForwardFromNational == true && Number(detail?.statusId) == 1) ? (
|
||||||
Number(detail?.uploadedById) == Number(userId) ? (
|
Number(detail?.uploadedById) == Number(userId) ? (
|
||||||
""
|
""
|
||||||
) : (
|
) : (
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,110 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import {
|
||||||
|
Dialog,
|
||||||
|
DialogContent,
|
||||||
|
DialogFooter,
|
||||||
|
DialogHeader,
|
||||||
|
DialogTitle,
|
||||||
|
DialogTrigger,
|
||||||
|
} from "@/components/ui/dialog";
|
||||||
|
import { z } from "zod";
|
||||||
|
import { Controller, useForm } from "react-hook-form";
|
||||||
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
|
import {
|
||||||
|
Form,
|
||||||
|
FormControl,
|
||||||
|
FormDescription,
|
||||||
|
FormField,
|
||||||
|
FormItem,
|
||||||
|
FormLabel,
|
||||||
|
FormMessage,
|
||||||
|
} from "@/components/ui/form";
|
||||||
|
import { Input } from "@/components/ui/input";
|
||||||
|
import { Checkbox } from "@/components/ui/checkbox";
|
||||||
|
import { Fragment, useEffect, useState } from "react";
|
||||||
|
import { useTranslations } from "next-intl";
|
||||||
|
import { Card } from "@/components/ui/card";
|
||||||
|
|
||||||
|
const wilayahList = [
|
||||||
|
{ id: "mabes", label: "Mabes" },
|
||||||
|
{ id: "polda", label: "Polda" },
|
||||||
|
{ id: "satker", label: "Satker" },
|
||||||
|
];
|
||||||
|
|
||||||
|
const jumlahList = [5, 10, 15, 20, 25, 30];
|
||||||
|
|
||||||
|
export default function DetailSettingTracking() {
|
||||||
|
const t = useTranslations("Menu");
|
||||||
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
|
|
||||||
|
const form = useForm({
|
||||||
|
defaultValues: {
|
||||||
|
wilayah: [] as string[],
|
||||||
|
jumlah: [] as number[],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const onSubmit = (values: any) => {
|
||||||
|
console.log("Submitted values:", values);
|
||||||
|
setIsOpen(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Card className="px-3 py-3">
|
||||||
|
<Form {...form}>
|
||||||
|
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
|
||||||
|
{/* Wilayah */}
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="wilayah"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>Wilayah</FormLabel>
|
||||||
|
<div className="flex gap-4">
|
||||||
|
{wilayahList.map((item) => (
|
||||||
|
<div key={item.id} className="flex items-center gap-2">
|
||||||
|
<Checkbox
|
||||||
|
checked={field.value.includes(item.id)}
|
||||||
|
onCheckedChange={(checked) => {
|
||||||
|
const updated = checked
|
||||||
|
? [...field.value, item.id]
|
||||||
|
: field.value.filter((val) => val !== item.id);
|
||||||
|
field.onChange(updated);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<label className="text-sm">{item.label}</label>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="jumlah"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>Jumlah Tracking Berita Harian</FormLabel>
|
||||||
|
<div className="flex gap-4 flex-wrap">
|
||||||
|
<Input
|
||||||
|
size={"md"}
|
||||||
|
type="number"
|
||||||
|
placeholder="Masukan Nama Iklan"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<div className="flex items-end justify-end">
|
||||||
|
<Button type="submit">Tambah Setting</Button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</Form>
|
||||||
|
</Card>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,110 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import {
|
||||||
|
Dialog,
|
||||||
|
DialogContent,
|
||||||
|
DialogFooter,
|
||||||
|
DialogHeader,
|
||||||
|
DialogTitle,
|
||||||
|
DialogTrigger,
|
||||||
|
} from "@/components/ui/dialog";
|
||||||
|
import { z } from "zod";
|
||||||
|
import { Controller, useForm } from "react-hook-form";
|
||||||
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
|
import {
|
||||||
|
Form,
|
||||||
|
FormControl,
|
||||||
|
FormDescription,
|
||||||
|
FormField,
|
||||||
|
FormItem,
|
||||||
|
FormLabel,
|
||||||
|
FormMessage,
|
||||||
|
} from "@/components/ui/form";
|
||||||
|
import { Input } from "@/components/ui/input";
|
||||||
|
import { Checkbox } from "@/components/ui/checkbox";
|
||||||
|
import { Fragment, useEffect, useState } from "react";
|
||||||
|
import { useTranslations } from "next-intl";
|
||||||
|
import { Card } from "@/components/ui/card";
|
||||||
|
|
||||||
|
const wilayahList = [
|
||||||
|
{ id: "mabes", label: "Mabes" },
|
||||||
|
{ id: "polda", label: "Polda" },
|
||||||
|
{ id: "satker", label: "Satker" },
|
||||||
|
];
|
||||||
|
|
||||||
|
const jumlahList = [5, 10, 15, 20, 25, 30];
|
||||||
|
|
||||||
|
export default function CreateSettingTracking() {
|
||||||
|
const t = useTranslations("Menu");
|
||||||
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
|
|
||||||
|
const form = useForm({
|
||||||
|
defaultValues: {
|
||||||
|
wilayah: [] as string[],
|
||||||
|
jumlah: [] as number[],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const onSubmit = (values: any) => {
|
||||||
|
console.log("Submitted values:", values);
|
||||||
|
setIsOpen(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Card className="px-3 py-3">
|
||||||
|
<Form {...form}>
|
||||||
|
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
|
||||||
|
{/* Wilayah */}
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="wilayah"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>Wilayah</FormLabel>
|
||||||
|
<div className="flex gap-4">
|
||||||
|
{wilayahList.map((item) => (
|
||||||
|
<div key={item.id} className="flex items-center gap-2">
|
||||||
|
<Checkbox
|
||||||
|
checked={field.value.includes(item.id)}
|
||||||
|
onCheckedChange={(checked) => {
|
||||||
|
const updated = checked
|
||||||
|
? [...field.value, item.id]
|
||||||
|
: field.value.filter((val) => val !== item.id);
|
||||||
|
field.onChange(updated);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<label className="text-sm">{item.label}</label>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="jumlah"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>Jumlah Tracking Berita Harian</FormLabel>
|
||||||
|
<div className="flex gap-4 flex-wrap">
|
||||||
|
<Input
|
||||||
|
size={"md"}
|
||||||
|
type="number"
|
||||||
|
placeholder="Masukan Nama Iklan"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<div className="flex items-end justify-end">
|
||||||
|
<Button type="submit">Tambah Setting</Button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</Form>
|
||||||
|
</Card>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,110 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import {
|
||||||
|
Dialog,
|
||||||
|
DialogContent,
|
||||||
|
DialogFooter,
|
||||||
|
DialogHeader,
|
||||||
|
DialogTitle,
|
||||||
|
DialogTrigger,
|
||||||
|
} from "@/components/ui/dialog";
|
||||||
|
import { z } from "zod";
|
||||||
|
import { Controller, useForm } from "react-hook-form";
|
||||||
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
|
import {
|
||||||
|
Form,
|
||||||
|
FormControl,
|
||||||
|
FormDescription,
|
||||||
|
FormField,
|
||||||
|
FormItem,
|
||||||
|
FormLabel,
|
||||||
|
FormMessage,
|
||||||
|
} from "@/components/ui/form";
|
||||||
|
import { Input } from "@/components/ui/input";
|
||||||
|
import { Checkbox } from "@/components/ui/checkbox";
|
||||||
|
import { Fragment, useEffect, useState } from "react";
|
||||||
|
import { useTranslations } from "next-intl";
|
||||||
|
import { Card } from "@/components/ui/card";
|
||||||
|
|
||||||
|
const wilayahList = [
|
||||||
|
{ id: "mabes", label: "Mabes" },
|
||||||
|
{ id: "polda", label: "Polda" },
|
||||||
|
{ id: "satker", label: "Satker" },
|
||||||
|
];
|
||||||
|
|
||||||
|
const jumlahList = [5, 10, 15, 20, 25, 30];
|
||||||
|
|
||||||
|
export default function UpdateSettingTracking() {
|
||||||
|
const t = useTranslations("Menu");
|
||||||
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
|
|
||||||
|
const form = useForm({
|
||||||
|
defaultValues: {
|
||||||
|
wilayah: [] as string[],
|
||||||
|
jumlah: [] as number[],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const onSubmit = (values: any) => {
|
||||||
|
console.log("Submitted values:", values);
|
||||||
|
setIsOpen(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Card className="px-3 py-3">
|
||||||
|
<Form {...form}>
|
||||||
|
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
|
||||||
|
{/* Wilayah */}
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="wilayah"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>Wilayah</FormLabel>
|
||||||
|
<div className="flex gap-4">
|
||||||
|
{wilayahList.map((item) => (
|
||||||
|
<div key={item.id} className="flex items-center gap-2">
|
||||||
|
<Checkbox
|
||||||
|
checked={field.value.includes(item.id)}
|
||||||
|
onCheckedChange={(checked) => {
|
||||||
|
const updated = checked
|
||||||
|
? [...field.value, item.id]
|
||||||
|
: field.value.filter((val) => val !== item.id);
|
||||||
|
field.onChange(updated);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<label className="text-sm">{item.label}</label>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="jumlah"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>Jumlah Tracking Berita Harian</FormLabel>
|
||||||
|
<div className="flex gap-4 flex-wrap">
|
||||||
|
<Input
|
||||||
|
size={"md"}
|
||||||
|
type="number"
|
||||||
|
placeholder="Masukan Nama Iklan"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<div className="flex items-end justify-end">
|
||||||
|
<Button type="submit">Tambah Setting</Button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</Form>
|
||||||
|
</Card>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -1361,20 +1361,22 @@ export default function FormTaskDetail() {
|
||||||
<div className="mt-4">
|
<div className="mt-4">
|
||||||
<Label>Link Url</Label>
|
<Label>Link Url</Label>
|
||||||
{urlInputs.map((url: any, index: any) => (
|
{urlInputs.map((url: any, index: any) => (
|
||||||
<div
|
<Link
|
||||||
key={url.id}
|
key={url.id}
|
||||||
|
href={url}
|
||||||
|
target="_blank"
|
||||||
className="flex items-center gap-2 mt-2"
|
className="flex items-center gap-2 mt-2"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
type="url"
|
type="url"
|
||||||
className="border rounded p-2 w-full"
|
className="border rounded p-2 w-full cursor-pointer"
|
||||||
value={url}
|
value={url}
|
||||||
// onChange={(e) =>
|
// onChange={(e) =>
|
||||||
// handleLinkChange(index, e.target.value)
|
// handleLinkChange(index, e.target.value)
|
||||||
// }
|
// }
|
||||||
placeholder={`Masukkan link berita ${index + 1}`}
|
placeholder={`Masukkan link berita ${index + 1}`}
|
||||||
/>
|
/>
|
||||||
</div>
|
</Link>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ import { ChevronDown, ChevronUp, Trash2 } from "lucide-react";
|
||||||
import { AudioRecorder } from "react-audio-voice-recorder";
|
import { AudioRecorder } from "react-audio-voice-recorder";
|
||||||
import FileUploader from "@/components/form/shared/file-uploader";
|
import FileUploader from "@/components/form/shared/file-uploader";
|
||||||
import { Upload } from "tus-js-client";
|
import { Upload } from "tus-js-client";
|
||||||
import { error } from "@/config/swal";
|
import { close, error } from "@/config/swal";
|
||||||
import { getCsrfToken } from "@/service/auth";
|
import { getCsrfToken } from "@/service/auth";
|
||||||
import { loading } from "@/lib/swal";
|
import { loading } from "@/lib/swal";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
|
@ -320,37 +320,42 @@ export default function FormTask() {
|
||||||
loading();
|
loading();
|
||||||
if (imageFiles?.length == 0) {
|
if (imageFiles?.length == 0) {
|
||||||
setIsImageUploadFinish(true);
|
setIsImageUploadFinish(true);
|
||||||
|
} else {
|
||||||
|
imageFiles?.map(async (item: any, index: number) => {
|
||||||
|
await uploadResumableFile(index, String(id), item, "1", "0");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
imageFiles?.map(async (item: any, index: number) => {
|
|
||||||
await uploadResumableFile(index, String(id), item, "1", "0");
|
|
||||||
});
|
|
||||||
|
|
||||||
if (videoFiles?.length == 0) {
|
if (videoFiles?.length == 0) {
|
||||||
setIsVideoUploadFinish(true);
|
setIsVideoUploadFinish(true);
|
||||||
|
} else {
|
||||||
|
videoFiles?.map(async (item: any, index: number) => {
|
||||||
|
await uploadResumableFile(index, String(id), item, "2", "0");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
videoFiles?.map(async (item: any, index: number) => {
|
|
||||||
await uploadResumableFile(index, String(id), item, "2", "0");
|
|
||||||
});
|
|
||||||
|
|
||||||
if (textFiles?.length == 0) {
|
if (textFiles?.length == 0) {
|
||||||
setIsTextUploadFinish(true);
|
setIsTextUploadFinish(true);
|
||||||
|
} else {
|
||||||
|
textFiles?.map(async (item: any, index: number) => {
|
||||||
|
await uploadResumableFile(index, String(id), item, "3", "0");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
textFiles?.map(async (item: any, index: number) => {
|
|
||||||
await uploadResumableFile(index, String(id), item, "3", "0");
|
|
||||||
});
|
|
||||||
|
|
||||||
if (audioFiles?.length == 0) {
|
if (audioFiles?.length == 0) {
|
||||||
setIsAudioUploadFinish(true);
|
setIsAudioUploadFinish(true);
|
||||||
|
} else {
|
||||||
|
audioFiles.map(async (item: FileWithPreview, index: number) => {
|
||||||
|
await uploadResumableFile(
|
||||||
|
index,
|
||||||
|
String(id),
|
||||||
|
item, // Use .file to access the actual File object
|
||||||
|
"4",
|
||||||
|
"0" // Optional: Replace with actual duration if available
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
audioFiles.map(async (item: FileWithPreview, index: number) => {
|
close();
|
||||||
await uploadResumableFile(
|
|
||||||
index,
|
|
||||||
String(id),
|
|
||||||
item, // Use .file to access the actual File object
|
|
||||||
"4",
|
|
||||||
"0" // Optional: Replace with actual duration if available
|
|
||||||
);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = (data: TaskSchema) => {
|
const onSubmit = (data: TaskSchema) => {
|
||||||
|
|
@ -479,7 +484,8 @@ export default function FormTask() {
|
||||||
successTodo();
|
successTodo();
|
||||||
if (fileTypeId == "1") {
|
if (fileTypeId == "1") {
|
||||||
setIsImageUploadFinish(true);
|
setIsImageUploadFinish(true);
|
||||||
} else if (fileTypeId == "2") {
|
}
|
||||||
|
if (fileTypeId == "2") {
|
||||||
setIsVideoUploadFinish(true);
|
setIsVideoUploadFinish(true);
|
||||||
}
|
}
|
||||||
if (fileTypeId == "3") {
|
if (fileTypeId == "3") {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
export type DetailTicket = {
|
export type DetailTicket = {
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
commentFromUserId: string;
|
commentFromUserId: string;
|
||||||
assignedTeams: string;
|
assignedTeams: string;
|
||||||
message: string;
|
message: string;
|
||||||
|
|
@ -19,7 +21,10 @@ export type DetailTicket = {
|
||||||
feedUrl: string;
|
feedUrl: string;
|
||||||
recommendationName: string;
|
recommendationName: string;
|
||||||
link: string;
|
link: string;
|
||||||
uploadFiles?: string;
|
uploadFiles?: {
|
||||||
|
fileUrl: string;
|
||||||
|
fileName: string;
|
||||||
|
}[];
|
||||||
description: string;
|
description: string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
// InfoLainnyaModal.tsx
|
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
|
|
@ -6,6 +5,7 @@ import {
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
} from "@/components/ui/dialog";
|
} from "@/components/ui/dialog";
|
||||||
import { DetailTicket } from "./info-lainnya-types";
|
import { DetailTicket } from "./info-lainnya-types";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
interface InfoLainnyaModalProps {
|
interface InfoLainnyaModalProps {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
|
|
@ -18,6 +18,34 @@ export default function InfoLainnyaModal({
|
||||||
onClose,
|
onClose,
|
||||||
data,
|
data,
|
||||||
}: InfoLainnyaModalProps) {
|
}: InfoLainnyaModalProps) {
|
||||||
|
const files = data?.uploadFiles || [];
|
||||||
|
const [currentIndex, setCurrentIndex] = useState(0);
|
||||||
|
|
||||||
|
const handlePrev = () => {
|
||||||
|
setCurrentIndex((prev) => (prev > 0 ? prev - 1 : prev));
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleNext = () => {
|
||||||
|
setCurrentIndex((prev) => (prev < files.length - 1 ? prev + 1 : prev));
|
||||||
|
};
|
||||||
|
|
||||||
|
const currentFile = files[currentIndex];
|
||||||
|
const isImage = (fileUrl: string) =>
|
||||||
|
/\.(jpeg|jpg|png|gif|bmp|webp)$/i.test(fileUrl.toLowerCase());
|
||||||
|
|
||||||
|
const getIframeUrl = (fileUrl: string): string => {
|
||||||
|
const lower = fileUrl.toLowerCase();
|
||||||
|
|
||||||
|
// Dokumen ditampilkan melalui Google Docs Viewer
|
||||||
|
if (/\.(pdf|doc|docx|xls|xlsx|ppt|pptx)$/i.test(lower)) {
|
||||||
|
return `https://docs.google.com/viewer?url=${encodeURIComponent(
|
||||||
|
fileUrl
|
||||||
|
)}&embedded=true`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fileUrl;
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} onOpenChange={onClose}>
|
<Dialog open={open} onOpenChange={onClose}>
|
||||||
<DialogContent size="md">
|
<DialogContent size="md">
|
||||||
|
|
@ -41,11 +69,11 @@ export default function InfoLainnyaModal({
|
||||||
<div>:{data?.recommendationName}</div>
|
<div>:{data?.recommendationName}</div>
|
||||||
|
|
||||||
<div className="font-medium">Link Pendukung</div>
|
<div className="font-medium">Link Pendukung</div>
|
||||||
<div>
|
<div className="flex">
|
||||||
:
|
:
|
||||||
<a
|
<a
|
||||||
href={data?.link}
|
href={data?.link}
|
||||||
className="text-blue-600"
|
className="text-blue-600 flex w-[100px]"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
>
|
>
|
||||||
|
|
@ -53,15 +81,43 @@ export default function InfoLainnyaModal({
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{data?.uploadFiles && (
|
{files.length > 0 && (
|
||||||
<>
|
<>
|
||||||
<div className="font-medium">Lampiran</div>
|
<div className="font-medium col-span-2">Lampiran</div>
|
||||||
<div>
|
<div className="col-span-2 flex flex-col items-center space-y-2 w-full">
|
||||||
<img
|
{isImage(currentFile?.fileUrl || "") ? (
|
||||||
src={data?.uploadFiles}
|
<img
|
||||||
alt="Lampiran"
|
src={currentFile?.fileUrl}
|
||||||
className="max-w-xs"
|
alt={`Lampiran ${currentIndex + 1}`}
|
||||||
/>
|
className="max-h-[300px] w-auto object-contain border rounded"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<iframe
|
||||||
|
src={getIframeUrl(currentFile?.fileUrl || "")}
|
||||||
|
title={`Lampiran ${currentIndex + 1}`}
|
||||||
|
className="w-full max-w-2xl h-[300px] border rounded"
|
||||||
|
onError={(e) => {
|
||||||
|
(e.target as HTMLIFrameElement).style.display = "none";
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className="flex gap-2">
|
||||||
|
<button
|
||||||
|
onClick={handlePrev}
|
||||||
|
disabled={currentIndex === 0}
|
||||||
|
className="px-2 py-1 border rounded disabled:opacity-50"
|
||||||
|
>
|
||||||
|
<
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
onClick={handleNext}
|
||||||
|
disabled={currentIndex === files.length - 1}
|
||||||
|
className="px-2 py-1 border rounded disabled:opacity-50"
|
||||||
|
>
|
||||||
|
>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -588,6 +588,7 @@ export default function FormDetailTicketing() {
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={selectedOperator.includes(op.value)}
|
checked={selectedOperator.includes(op.value)}
|
||||||
|
disabled
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
if (e.target.checked) {
|
if (e.target.checked) {
|
||||||
setSelectedOperator((prev) => [
|
setSelectedOperator((prev) => [
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import Image from "next/image";
|
||||||
const HeaderBannerSatker = () => {
|
const HeaderBannerSatker = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
|
const locale = params?.locale;
|
||||||
const satkerName: any = params?.satker_name;
|
const satkerName: any = params?.satker_name;
|
||||||
const asPath: any = usePathname();
|
const asPath: any = usePathname();
|
||||||
const [content, setContent] = useState([]);
|
const [content, setContent] = useState([]);
|
||||||
|
|
@ -50,7 +51,7 @@ const HeaderBannerSatker = () => {
|
||||||
);
|
);
|
||||||
var data = res?.data?.data?.content;
|
var data = res?.data?.data?.content;
|
||||||
if (data) {
|
if (data) {
|
||||||
const resStatic = await listStaticBanner(satkerName, false);
|
const resStatic = await listStaticBanner(satkerName, locale == "en");
|
||||||
for (let i = 0; i < resStatic?.data?.data?.length; i++) {
|
for (let i = 0; i < resStatic?.data?.data?.length; i++) {
|
||||||
const media = resStatic?.data.data[i]?.mediaUpload;
|
const media = resStatic?.data.data[i]?.mediaUpload;
|
||||||
media.fileTypeId = media.fileType?.id;
|
media.fileTypeId = media.fileType?.id;
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import { useRouter } from "@/i18n/routing";
|
||||||
const HeaderBanner = () => {
|
const HeaderBanner = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
|
const locale = params?.locale;
|
||||||
const poldaName: any = params?.polda_name;
|
const poldaName: any = params?.polda_name;
|
||||||
const [content, setContent] = useState([]);
|
const [content, setContent] = useState([]);
|
||||||
const [isBannerLoading, setIsBannerLoading] = useState(true);
|
const [isBannerLoading, setIsBannerLoading] = useState(true);
|
||||||
|
|
@ -31,7 +32,7 @@ const HeaderBanner = () => {
|
||||||
const res = await listData("1", "", "", 5, 0, "createdAt", "", "", poldaName);
|
const res = await listData("1", "", "", 5, 0, "createdAt", "", "", poldaName);
|
||||||
var data = res?.data?.data?.content;
|
var data = res?.data?.data?.content;
|
||||||
if (data) {
|
if (data) {
|
||||||
const resStatic = await listStaticBanner(poldaName, false);
|
const resStatic = await listStaticBanner(poldaName, locale == "en");
|
||||||
for (let i = 0; i < resStatic?.data?.data?.length; i++) {
|
for (let i = 0; i < resStatic?.data?.data?.length; i++) {
|
||||||
const media = resStatic?.data.data[i]?.mediaUpload;
|
const media = resStatic?.data.data[i]?.mediaUpload;
|
||||||
media.fileTypeId = media.fileType?.id;
|
media.fileTypeId = media.fileType?.id;
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ const HeroModal = ({ onClose, group, poldaName, satkerName }: HeroModalProps) =>
|
||||||
|
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
if (group === "polda" && poldaName && String(poldaName).length > 1) {
|
if (group === "polda" && poldaName && String(poldaName).length > 1) {
|
||||||
const response = await listStaticBanner(poldaName);
|
const response = await listStaticBanner(poldaName, locale == "en");
|
||||||
|
|
||||||
const banners =
|
const banners =
|
||||||
response?.data?.data?.map((item: any) => {
|
response?.data?.data?.map((item: any) => {
|
||||||
|
|
@ -245,13 +245,13 @@ const HeroNewPolda = (props: { group?: string }) => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
const response = await getHeroData();
|
const response = await getHeroData(locale == "en");
|
||||||
console.log(response);
|
console.log(response);
|
||||||
let data = response?.data?.data?.content;
|
let data = response?.data?.data?.content;
|
||||||
setHeroData(data);
|
setHeroData(data);
|
||||||
|
|
||||||
if (data && props.group === "polda" && poldaName && String(poldaName)?.length > 1) {
|
if (data && props.group === "polda" && poldaName && String(poldaName)?.length > 1) {
|
||||||
const resStatic = await listStaticBanner(poldaName);
|
const resStatic = await listStaticBanner(poldaName, locale == "en");
|
||||||
|
|
||||||
for (let i = 0; i < resStatic?.data?.data?.length; i++) {
|
for (let i = 0; i < resStatic?.data?.data?.length; i++) {
|
||||||
const media = resStatic?.data.data[i]?.mediaUpload;
|
const media = resStatic?.data.data[i]?.mediaUpload;
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ const HeroModal = ({ onClose, group, poldaName, satkerName }: HeroModalProps) =>
|
||||||
|
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
if (group === "satker" && satkerName && String(satkerName).length > 1) {
|
if (group === "satker" && satkerName && String(satkerName).length > 1) {
|
||||||
const response = await listStaticBanner(satkerName);
|
const response = await listStaticBanner(satkerName, locale == "en");
|
||||||
|
|
||||||
const banners =
|
const banners =
|
||||||
response?.data?.data?.map((item: any) => {
|
response?.data?.data?.map((item: any) => {
|
||||||
|
|
@ -245,13 +245,13 @@ const HeroNewSatker = (props: { group?: string }) => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
const response = await getHeroData();
|
const response = await getHeroData(locale == "en");
|
||||||
console.log(response);
|
console.log(response);
|
||||||
let data = response?.data?.data?.content;
|
let data = response?.data?.data?.content;
|
||||||
setHeroData(data);
|
setHeroData(data);
|
||||||
|
|
||||||
if (data && props.group === "satker" && satkerName && String(satkerName)?.length > 1) {
|
if (data && props.group === "satker" && satkerName && String(satkerName)?.length > 1) {
|
||||||
const resStatic = await listStaticBanner(satkerName);
|
const resStatic = await listStaticBanner(satkerName, locale == "en");
|
||||||
|
|
||||||
for (let i = 0; i < resStatic?.data?.data?.length; i++) {
|
for (let i = 0; i < resStatic?.data?.data?.length; i++) {
|
||||||
const media = resStatic?.data.data[i]?.mediaUpload;
|
const media = resStatic?.data.data[i]?.mediaUpload;
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,8 @@ const HeroModal = ({
|
||||||
? poldaName
|
? poldaName
|
||||||
: group === "satker" && satkerName && String(satkerName)?.length > 1
|
: group === "satker" && satkerName && String(satkerName)?.length > 1
|
||||||
? "satker-" + satkerName
|
? "satker-" + satkerName
|
||||||
: ""
|
: "",
|
||||||
|
locale == "en"
|
||||||
);
|
);
|
||||||
|
|
||||||
const banners =
|
const banners =
|
||||||
|
|
@ -295,7 +296,7 @@ const HeroNew = (props: { group?: string }) => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
const response = await getHeroData();
|
const response = await getHeroData(locale == "en");
|
||||||
console.log(response);
|
console.log(response);
|
||||||
let data = response?.data?.data?.content;
|
let data = response?.data?.data?.content;
|
||||||
setHeroData(response?.data?.data?.content);
|
setHeroData(response?.data?.data?.content);
|
||||||
|
|
@ -309,7 +310,8 @@ const HeroNew = (props: { group?: string }) => {
|
||||||
satkerName &&
|
satkerName &&
|
||||||
String(satkerName)?.length > 1
|
String(satkerName)?.length > 1
|
||||||
? "satker-" + satkerName
|
? "satker-" + satkerName
|
||||||
: ""
|
: "",
|
||||||
|
locale == "en"
|
||||||
);
|
);
|
||||||
for (let i = 0; i < resStatic?.data?.data?.length; i++) {
|
for (let i = 0; i < resStatic?.data?.data?.length; i++) {
|
||||||
const media = resStatic?.data.data[i]?.mediaUpload;
|
const media = resStatic?.data.data[i]?.mediaUpload;
|
||||||
|
|
|
||||||
|
|
@ -79,11 +79,11 @@ const HeroModal = ({ onClose }: { onClose: () => void }) => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
const response = await getHeroData();
|
const response = await getHeroData(locale == "en");
|
||||||
console.log(response);
|
console.log(response);
|
||||||
let data = response?.data?.data?.content;
|
let data = response?.data?.data?.content;
|
||||||
if (data) {
|
if (data) {
|
||||||
const resStatic = await listStaticBanner();
|
const resStatic = await listStaticBanner("", locale == "en");
|
||||||
for (let i = 0; i < resStatic?.data?.data?.length; i++) {
|
for (let i = 0; i < resStatic?.data?.data?.length; i++) {
|
||||||
const media = resStatic?.data.data[i]?.mediaUpload;
|
const media = resStatic?.data.data[i]?.mediaUpload;
|
||||||
media.fileTypeId = media.fileType?.id;
|
media.fileTypeId = media.fileType?.id;
|
||||||
|
|
@ -287,7 +287,7 @@ const Hero = (props: { group?: string }) => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
const response = await getHeroData();
|
const response = await getHeroData(locale == "en");
|
||||||
console.log(response);
|
console.log(response);
|
||||||
let data = response?.data?.data?.content;
|
let data = response?.data?.data?.content;
|
||||||
setHeroData(response?.data?.data?.content);
|
setHeroData(response?.data?.data?.content);
|
||||||
|
|
@ -301,7 +301,8 @@ const Hero = (props: { group?: string }) => {
|
||||||
satkerName &&
|
satkerName &&
|
||||||
String(satkerName)?.length > 1
|
String(satkerName)?.length > 1
|
||||||
? "satker-" + satkerName
|
? "satker-" + satkerName
|
||||||
: ""
|
: "",
|
||||||
|
locale == "en"
|
||||||
);
|
);
|
||||||
for (let i = 0; i < resStatic?.data?.data?.length; i++) {
|
for (let i = 0; i < resStatic?.data?.data?.length; i++) {
|
||||||
const media = resStatic?.data.data[i]?.mediaUpload;
|
const media = resStatic?.data.data[i]?.mediaUpload;
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,19 @@ import { formatDateToIndonesian, textEllipsis } from "@/utils/globals";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Icon } from "../ui/icon";
|
import { Icon } from "../ui/icon";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
import { useParams } from "next/navigation";
|
||||||
|
|
||||||
export default function NewsTicker() {
|
export default function NewsTicker() {
|
||||||
const [article, setArticle] = useState<any>([]);
|
const [article, setArticle] = useState<any>([]);
|
||||||
const [currentNewsIndex, setCurrentNewsIndex] = useState<any>(0);
|
const [currentNewsIndex, setCurrentNewsIndex] = useState<any>(0);
|
||||||
const [animate, setAnimate] = useState(false);
|
const [animate, setAnimate] = useState(false);
|
||||||
|
const params = useParams();
|
||||||
|
const locale = params?.locale;
|
||||||
const t = useTranslations("LandingPage");
|
const t = useTranslations("LandingPage");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function getArticle() {
|
async function getArticle() {
|
||||||
const response = await getHeroData();
|
const response = await getHeroData(locale == "en");
|
||||||
setArticle(response?.data?.data?.content);
|
setArticle(response?.data?.data?.content);
|
||||||
}
|
}
|
||||||
getArticle();
|
getArticle();
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ const ScrollableContentPolda = () => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
const response = await getHeroData();
|
const response = await getHeroData(locale == "en");
|
||||||
console.log(response);
|
console.log(response);
|
||||||
let data = response?.data?.data?.content;
|
let data = response?.data?.data?.content;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ const ScrollableContentSatker = () => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
const response = await getHeroData();
|
const response = await getHeroData(locale == "en");
|
||||||
console.log(response);
|
console.log(response);
|
||||||
let data = response?.data?.data?.content;
|
let data = response?.data?.data?.content;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ const ScrollableContent = () => {
|
||||||
const locale = params?.locale;
|
const locale = params?.locale;
|
||||||
const t = useTranslations("LandingPage");
|
const t = useTranslations("LandingPage");
|
||||||
const [content, setContent] = useState<any>();
|
const [content, setContent] = useState<any>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function fetchCategories() {
|
async function fetchCategories() {
|
||||||
const url = "https://netidhub.com/api/csrf";
|
const url = "https://netidhub.com/api/csrf";
|
||||||
|
|
@ -45,12 +46,13 @@ const ScrollableContent = () => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
const response = await getHeroData();
|
const response = await getHeroData(locale == "en");
|
||||||
console.log(response);
|
console.log(response);
|
||||||
let data = response?.data?.data?.content;
|
let data = response?.data?.data?.content;
|
||||||
|
|
||||||
setContent(data);
|
setContent(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="">
|
<div className="">
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,6 @@ const LoginForm = () => {
|
||||||
console.log("PROFILE : ", profile?.data?.data);
|
console.log("PROFILE : ", profile?.data?.data);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
profile?.data?.data?.isInternational == true ||
|
|
||||||
profile?.data?.data?.isActive == false ||
|
profile?.data?.data?.isActive == false ||
|
||||||
profile?.data?.data?.isDelete == true
|
profile?.data?.data?.isDelete == true
|
||||||
) {
|
) {
|
||||||
|
|
@ -225,6 +224,8 @@ const LoginForm = () => {
|
||||||
Number(profile?.data?.data?.roleId) == 10 ||
|
Number(profile?.data?.data?.roleId) == 10 ||
|
||||||
Number(profile?.data?.data?.roleId) == 11 ||
|
Number(profile?.data?.data?.roleId) == 11 ||
|
||||||
Number(profile?.data?.data?.roleId) == 12 ||
|
Number(profile?.data?.data?.roleId) == 12 ||
|
||||||
|
Number(profile?.data?.data?.roleId) == 14 ||
|
||||||
|
Number(profile?.data?.data?.roleId) == 15 ||
|
||||||
Number(profile?.data?.data?.roleId) == 18 ||
|
Number(profile?.data?.data?.roleId) == 18 ||
|
||||||
Number(profile?.data?.data?.roleId) == 19
|
Number(profile?.data?.data?.roleId) == 19
|
||||||
) {
|
) {
|
||||||
|
|
@ -281,16 +282,17 @@ const LoginForm = () => {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const msg = response?.data?.message;
|
const msg = response?.data?.message;
|
||||||
|
onSubmit(data);
|
||||||
|
|
||||||
if (msg == "Continue to setup email") {
|
// if (msg == "Continue to setup email") {
|
||||||
setStep(2);
|
// setStep(2);
|
||||||
} else if (msg == "Email is valid and OTP has been sent") {
|
// } else if (msg == "Email is valid and OTP has been sent") {
|
||||||
setStep(3);
|
// setStep(3);
|
||||||
} else if (msg == "Username & password valid") {
|
// } else if (msg == "Username & password valid") {
|
||||||
onSubmit(data);
|
// onSubmit(data);
|
||||||
} else {
|
// } else {
|
||||||
error("Username / password incorrect");
|
// error("Username / password incorrect");
|
||||||
}
|
// }
|
||||||
// else {
|
// else {
|
||||||
// setStep(1);
|
// setStep(1);
|
||||||
// }
|
// }
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,143 @@
|
||||||
|
"use client";
|
||||||
|
import {
|
||||||
|
Pagination,
|
||||||
|
PaginationContent,
|
||||||
|
PaginationEllipsis,
|
||||||
|
PaginationItem,
|
||||||
|
PaginationLink,
|
||||||
|
PaginationNext,
|
||||||
|
PaginationPrevious,
|
||||||
|
} from "@/components/ui/pagination";
|
||||||
|
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
|
export default function CustomPagination(props: {
|
||||||
|
totalPage: number;
|
||||||
|
onPageChange: (data: number) => void;
|
||||||
|
}) {
|
||||||
|
const { totalPage, onPageChange } = props;
|
||||||
|
const [page, setPage] = useState(1);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
onPageChange(page);
|
||||||
|
}, [page]);
|
||||||
|
|
||||||
|
const renderPageNumbers = () => {
|
||||||
|
const pageNumbers = [];
|
||||||
|
const halfWindow = Math.floor(5 / 2);
|
||||||
|
let startPage = Math.max(2, page - halfWindow);
|
||||||
|
let endPage = Math.min(totalPage - 1, page + halfWindow);
|
||||||
|
|
||||||
|
if (endPage - startPage + 1 < 5) {
|
||||||
|
if (page <= halfWindow) {
|
||||||
|
endPage = Math.min(
|
||||||
|
totalPage,
|
||||||
|
endPage + (5 - (endPage - startPage + 1))
|
||||||
|
);
|
||||||
|
} else if (page + halfWindow >= totalPage) {
|
||||||
|
startPage = Math.max(1, startPage - (5 - (endPage - startPage + 1)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (startPage === endPage) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = startPage; i <= endPage; i++) {
|
||||||
|
pageNumbers.push(
|
||||||
|
<PaginationItem key={i} onClick={() => setPage(i)}>
|
||||||
|
<PaginationLink isActive={page === i}>{i}</PaginationLink>
|
||||||
|
</PaginationItem>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pageNumbers;
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<Pagination>
|
||||||
|
<PaginationContent>
|
||||||
|
{page - 10 >= 1 && (
|
||||||
|
<PaginationItem>
|
||||||
|
<PaginationLink
|
||||||
|
onClick={() => (page > 10 ? setPage(page - 10) : setPage(1))}
|
||||||
|
>
|
||||||
|
{/* <DoubleArrowLeftIcon /> */}
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="24"
|
||||||
|
height="24"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
fill="currentColor"
|
||||||
|
d="M18.41 7.41L17 6l-6 6l6 6l1.41-1.41L13.83 12zm-6 0L11 6l-6 6l6 6l1.41-1.41L7.83 12z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</PaginationLink>
|
||||||
|
</PaginationItem>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<PaginationItem className="hidden md:block">
|
||||||
|
<PaginationPrevious
|
||||||
|
onClick={() => (page > 1 ? setPage(page - 1) : "")}
|
||||||
|
/>
|
||||||
|
</PaginationItem>
|
||||||
|
<PaginationItem>
|
||||||
|
<PaginationLink onClick={() => setPage(1)} isActive={page === 1}>
|
||||||
|
{1}
|
||||||
|
</PaginationLink>
|
||||||
|
</PaginationItem>
|
||||||
|
{page > 4 && (
|
||||||
|
<PaginationItem>
|
||||||
|
<PaginationEllipsis onClick={() => setPage(page - 1)} />
|
||||||
|
</PaginationItem>
|
||||||
|
)}
|
||||||
|
{renderPageNumbers()}
|
||||||
|
{page < totalPage - 3 && (
|
||||||
|
<PaginationItem>
|
||||||
|
<PaginationEllipsis onClick={() => setPage(page + 1)} />
|
||||||
|
</PaginationItem>
|
||||||
|
)}
|
||||||
|
{totalPage > 1 && (
|
||||||
|
<PaginationItem>
|
||||||
|
<PaginationLink
|
||||||
|
onClick={() => setPage(totalPage)}
|
||||||
|
isActive={page === totalPage}
|
||||||
|
>
|
||||||
|
{totalPage}
|
||||||
|
</PaginationLink>
|
||||||
|
</PaginationItem>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<PaginationItem className="hidden md:block">
|
||||||
|
<PaginationNext
|
||||||
|
onClick={() => (page < totalPage ? setPage(page + 1) : "")}
|
||||||
|
/>
|
||||||
|
</PaginationItem>
|
||||||
|
|
||||||
|
{page + 10 <= totalPage && totalPage > 9 && (
|
||||||
|
<PaginationItem>
|
||||||
|
<PaginationLink
|
||||||
|
onClick={() =>
|
||||||
|
page < totalPage - 10 ? setPage(page + 10) : setPage(totalPage)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{/* <DoubleArrowRightIcon /> */}
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="24"
|
||||||
|
height="24"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
fill="currentColor"
|
||||||
|
d="M5.59 7.41L7 6l6 6l-6 6l-1.41-1.41L10.17 12zm6 0L13 6l6 6l-6 6l-1.41-1.41L16.17 12z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</PaginationLink>
|
||||||
|
</PaginationItem>
|
||||||
|
)}
|
||||||
|
</PaginationContent>
|
||||||
|
</Pagination>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -38,7 +38,7 @@ export function getMenuList(pathname: string, t: any): Group[] {
|
||||||
|
|
||||||
let menusSelected = <any>[];
|
let menusSelected = <any>[];
|
||||||
|
|
||||||
if (Number(roleId) == 3 && Number(levelNumber) == 1) {
|
if ((Number(roleId) == 3 || Number(roleId) == 14) && Number(levelNumber) == 1) {
|
||||||
menusSelected = [
|
menusSelected = [
|
||||||
{
|
{
|
||||||
groupLabel: t("apps"),
|
groupLabel: t("apps"),
|
||||||
|
|
@ -1700,7 +1700,7 @@ export function getMenuList(pathname: string, t: any): Group[] {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
} else if (
|
} else if (
|
||||||
(Number(roleId) == 3 || Number(roleId) == 4) &&
|
(Number(roleId) == 3 || Number(roleId) == 4 || Number(roleId) == 14 || Number(roleId) == 15) &&
|
||||||
Number(levelNumber) == 2
|
Number(levelNumber) == 2
|
||||||
) {
|
) {
|
||||||
if (Number(userLevelId) != 761) {
|
if (Number(userLevelId) != 761) {
|
||||||
|
|
@ -2158,7 +2158,7 @@ export function getMenuList(pathname: string, t: any): Group[] {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
(Number(roleId) == 3 || Number(roleId) == 4) &&
|
(Number(roleId) == 3 || Number(roleId) == 4 || Number(roleId) == 14 || Number(roleId) == 15) &&
|
||||||
Number(levelNumber) == 3
|
Number(levelNumber) == 3
|
||||||
) {
|
) {
|
||||||
if (Number(userParentLevelId) != 761) {
|
if (Number(userParentLevelId) != 761) {
|
||||||
|
|
|
||||||
|
|
@ -47,22 +47,23 @@ export async function listDataAll(
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function listDataImage(
|
export async function listDataImage(
|
||||||
size: any,
|
size: any = "",
|
||||||
page: any,
|
page: any = "",
|
||||||
isForSelf: any,
|
isForSelf: any = "",
|
||||||
isApproval: any,
|
isApproval: any = "",
|
||||||
categoryFilter: any,
|
categoryFilter: any = "",
|
||||||
statusFilter: any,
|
statusFilter: any = "",
|
||||||
needApprovalFromLevel: any,
|
needApprovalFromLevel: any = "",
|
||||||
creator: any,
|
creator: any = "",
|
||||||
source: any,
|
source: any = "",
|
||||||
startDate: any,
|
startDate: any = "",
|
||||||
endDate: any,
|
endDate: any = "",
|
||||||
title: string = "",
|
title: string = "",
|
||||||
creatorGroup: string = ""
|
creatorGroup: string = "",
|
||||||
|
isInt: boolean = false
|
||||||
) {
|
) {
|
||||||
return await httpGetInterceptor(
|
return await httpGetInterceptor(
|
||||||
`media/list?enablePage=1&size=${size}&sortBy=createdAt&sort=desc&page=${page}&typeId=1&isForSelf=${isForSelf}&isApproval=${isApproval}&categoryId=${categoryFilter}&statusId=${statusFilter}&needApprovalFromLevel=${needApprovalFromLevel}&creatorUserLevelName=${source}&creatorName=${creator}&startDate=${startDate}&endDate=${endDate}&title=${title}&creatorGroupLevelName=${creatorGroup}`
|
`media/list?enablePage=1&size=${size}&sortBy=createdAt&sort=desc&page=${page}&typeId=1&isForSelf=${isForSelf}&isApproval=${isApproval}&categoryId=${categoryFilter}&statusId=${statusFilter}&creatorUserLevelName=${source}&creatorName=${creator}&startDate=${startDate}&endDate=${endDate}&title=${title}&creatorGroupLevelName=${creatorGroup}&needApprovalFromLevel=${needApprovalFromLevel}&isInt=${isInt}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,9 @@ export async function getCsrfToken() {
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getHeroData() {
|
export async function getHeroData(isInt: Boolean = false) {
|
||||||
return await httpGetInterceptor(
|
return await httpGetInterceptor(
|
||||||
`media/public/list?enablePage=1&sort=desc&sortBy=createdAt&size=5&page=0&typeId=1&title=&categoryId=&fileFormats=&tags=&group=&startDate=&endDate=&month=&year=`
|
`media/public/list?enablePage=1&sort=desc&sortBy=createdAt&size=5&page=0&typeId=1&title=&categoryId=&fileFormats=&tags=&group=&startDate=&endDate=&month=&year=&isInt=${isInt}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue