pull main
This commit is contained in:
commit
87aa6c3e34
|
|
@ -230,11 +230,13 @@ export default function AddExpertForm() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAddRow = () => {
|
const handleAddRow = () => {
|
||||||
setPlacementRows((prevRows: any) => [
|
if (placementRows.length < 2) {
|
||||||
|
setPlacementRows((prevRows) => [
|
||||||
...prevRows,
|
...prevRows,
|
||||||
{ index: incrementId, roleId: "", userLevelId: 0 },
|
{ index: incrementId, roleId: "", userLevelId: 0 },
|
||||||
]);
|
]);
|
||||||
setIncrementId((prevId) => prevId + 1);
|
setIncrementId((prevId) => prevId + 1);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -424,7 +426,7 @@ export default function AddExpertForm() {
|
||||||
))}
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
<Select
|
{/* <Select
|
||||||
onValueChange={(e) =>
|
onValueChange={(e) =>
|
||||||
handleSelectionChange(row.index, "userLevelId", e)
|
handleSelectionChange(row.index, "userLevelId", e)
|
||||||
}
|
}
|
||||||
|
|
@ -441,6 +443,20 @@ export default function AddExpertForm() {
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
|
</Select> */}
|
||||||
|
<Select
|
||||||
|
onValueChange={(e) =>
|
||||||
|
handleSelectionChange(row.index, "userLevelId", e)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<FormControl>
|
||||||
|
<SelectTrigger>
|
||||||
|
<SelectValue placeholder="Pilih User Level" />
|
||||||
|
</SelectTrigger>
|
||||||
|
</FormControl>
|
||||||
|
<SelectContent>
|
||||||
|
<SelectItem value="216">MABES POLRI</SelectItem>
|
||||||
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
{placementRows.length > 1 && (
|
{placementRows.length > 1 && (
|
||||||
<Button
|
<Button
|
||||||
|
|
@ -454,7 +470,12 @@ export default function AddExpertForm() {
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
<Button type="button" size="md" onClick={() => handleAddRow()}>
|
<Button
|
||||||
|
type="button"
|
||||||
|
size="md"
|
||||||
|
onClick={handleAddRow}
|
||||||
|
disabled={placementRows.length >= 2} // optional: disable button if already 1 row added
|
||||||
|
>
|
||||||
Tambah
|
Tambah
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -154,8 +154,6 @@ const AdvertisementsList = () => {
|
||||||
page - 1,
|
page - 1,
|
||||||
showData,
|
showData,
|
||||||
"",
|
"",
|
||||||
categoryFilter?.sort().join(","),
|
|
||||||
statusFilter?.sort().join(",")
|
|
||||||
);
|
);
|
||||||
const data = res?.data?.data;
|
const data = res?.data?.data;
|
||||||
const contentData = data?.content;
|
const contentData = data?.content;
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ import { useRouter, useSearchParams } from "next/navigation";
|
||||||
import TablePagination from "@/components/table/table-pagination";
|
import TablePagination from "@/components/table/table-pagination";
|
||||||
import columns from "./columns";
|
import columns from "./columns";
|
||||||
import {
|
import {
|
||||||
paginationCalendar,
|
getCalendarPagination,
|
||||||
paginationSchedule,
|
paginationSchedule,
|
||||||
} from "@/service/schedule/schedule";
|
} from "@/service/schedule/schedule";
|
||||||
import { CardHeader, CardTitle } from "@/components/ui/card";
|
import { CardHeader, CardTitle } from "@/components/ui/card";
|
||||||
|
|
@ -120,10 +120,9 @@ const CalendarPolriTable = () => {
|
||||||
|
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
try {
|
try {
|
||||||
const res = await paginationCalendar(
|
const res = await getCalendarPagination(
|
||||||
showData,
|
showData,
|
||||||
page - 1,
|
page - 1,
|
||||||
1,
|
|
||||||
search,
|
search,
|
||||||
statusFilter
|
statusFilter
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ const useTableColumns = () => {
|
||||||
</Button>
|
</Button>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent className="p-0" align="end">
|
<DropdownMenuContent className="p-0" align="end">
|
||||||
{roleId == 11 && (
|
{(roleId == 11 || roleId == 12) && (
|
||||||
<Link href={`/contributor/task-ta/detail/${row.original.id}`}>
|
<Link href={`/contributor/task-ta/detail/${row.original.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" />
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ const TaskTaTable = () => {
|
||||||
const [columnVisibility, setColumnVisibility] =
|
const [columnVisibility, setColumnVisibility] =
|
||||||
React.useState<VisibilityState>({});
|
React.useState<VisibilityState>({});
|
||||||
const [rowSelection, setRowSelection] = React.useState({});
|
const [rowSelection, setRowSelection] = React.useState({});
|
||||||
const [showData, setShowData] = React.useState("50");
|
const [showData, setShowData] = React.useState("10");
|
||||||
const [pagination, setPagination] = React.useState<PaginationState>({
|
const [pagination, setPagination] = React.useState<PaginationState>({
|
||||||
pageIndex: 0,
|
pageIndex: 0,
|
||||||
pageSize: Number(showData),
|
pageSize: Number(showData),
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ import dynamic from "next/dynamic";
|
||||||
import { error } from "@/lib/swal";
|
import { error } from "@/lib/swal";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import { contextType } from "cleave.js/react";
|
import { contextType } from "cleave.js/react";
|
||||||
|
import { Form } from "@/components/ui/form";
|
||||||
|
|
||||||
const imageSchema = z.object({
|
const imageSchema = z.object({
|
||||||
contentTitle: z.string().min(1, { message: "Judul diperlukan" }),
|
contentTitle: z.string().min(1, { message: "Judul diperlukan" }),
|
||||||
|
|
@ -182,13 +183,31 @@ export default function FormConvertSPIT() {
|
||||||
|
|
||||||
let fileTypeId = "1";
|
let fileTypeId = "1";
|
||||||
|
|
||||||
const {
|
// const {
|
||||||
control,
|
// control,
|
||||||
handleSubmit,
|
// handleSubmit,
|
||||||
setValue,
|
// setValue,
|
||||||
formState: { errors },
|
// formState: { errors },
|
||||||
} = useForm<ImageSchema>({
|
// } = useForm<ImageSchema>({
|
||||||
|
// resolver: zodResolver(imageSchema),
|
||||||
|
// defaultValues: {
|
||||||
|
// contentTitle: detail?.contentTitle || "",
|
||||||
|
// contentDescription: detail?.contentDescription || "",
|
||||||
|
// contentCreator: detail?.contentCreator || "",
|
||||||
|
// contentRewriteDescription: detail?.contentRewriteDescription || "",
|
||||||
|
// // dll
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
|
||||||
|
const form = useForm<z.infer<typeof imageSchema>>({
|
||||||
resolver: zodResolver(imageSchema),
|
resolver: zodResolver(imageSchema),
|
||||||
|
defaultValues: {
|
||||||
|
contentTitle: detail?.contentTitle || "",
|
||||||
|
contentDescription: detail?.contentDescription || "",
|
||||||
|
contentCreator: detail?.contentCreator || "",
|
||||||
|
contentRewriteDescription: detail?.contentRewriteDescription || "",
|
||||||
|
// dll
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleRemoveTag = (index: any) => {
|
const handleRemoveTag = (index: any) => {
|
||||||
|
|
@ -207,11 +226,10 @@ export default function FormConvertSPIT() {
|
||||||
setSelectedFiles((prevImages) => prevImages.filter((_, i) => i !== index));
|
setSelectedFiles((prevImages) => prevImages.filter((_, i) => i !== index));
|
||||||
};
|
};
|
||||||
|
|
||||||
// const handleCheckboxChange = (id: number) => {
|
const handleDirectSave = () => {
|
||||||
// setSelectedPublishers((prev) =>
|
const values = form.getValues(); // ambil semua nilai tanpa validasi
|
||||||
// prev.includes(id) ? prev.filter((item) => item !== id) : [...prev, id]
|
onSubmit(values); // langsung submit
|
||||||
// );
|
};
|
||||||
// };
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function initState() {
|
async function initState() {
|
||||||
|
|
@ -318,6 +336,13 @@ export default function FormConvertSPIT() {
|
||||||
setDetail(details);
|
setDetail(details);
|
||||||
setFiles(details?.contentList);
|
setFiles(details?.contentList);
|
||||||
setupPlacementCheck(details?.contentList?.length);
|
setupPlacementCheck(details?.contentList?.length);
|
||||||
|
form.setValue("contentTitle", details?.contentTitle || "");
|
||||||
|
form.setValue("contentDescription", details?.contentDescription || "");
|
||||||
|
form.setValue("contentCreator", details?.contentCreator || "");
|
||||||
|
form.setValue(
|
||||||
|
"contentRewriteDescription",
|
||||||
|
details?.contentRewriteDescription || ""
|
||||||
|
);
|
||||||
|
|
||||||
const filesData = details.contentList || [];
|
const filesData = details.contentList || [];
|
||||||
const fileUrls = filesData.map((file: { contentFile: string }) =>
|
const fileUrls = filesData.map((file: { contentFile: string }) =>
|
||||||
|
|
@ -337,7 +362,7 @@ export default function FormConvertSPIT() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
initState();
|
initState();
|
||||||
}, [refresh, setValue]);
|
}, [refresh]);
|
||||||
|
|
||||||
const [tempFile, setTempFile] = useState(
|
const [tempFile, setTempFile] = useState(
|
||||||
detailThumb.map((data: any) => ({
|
detailThumb.map((data: any) => ({
|
||||||
|
|
@ -472,7 +497,13 @@ export default function FormConvertSPIT() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = (data: ImageSchema) => {
|
const onSubmit = async (data: z.infer<typeof imageSchema>) => {
|
||||||
|
if (form.getValues("contentTitle") == "") {
|
||||||
|
form.setError("contentTitle", {
|
||||||
|
type: "manual",
|
||||||
|
message: "Required",
|
||||||
|
});
|
||||||
|
} else {
|
||||||
MySwal.fire({
|
MySwal.fire({
|
||||||
title: "Simpan Data",
|
title: "Simpan Data",
|
||||||
text: "Apakah Anda yakin ingin menyimpan data ini?",
|
text: "Apakah Anda yakin ingin menyimpan data ini?",
|
||||||
|
|
@ -486,6 +517,7 @@ export default function FormConvertSPIT() {
|
||||||
save(data);
|
save(data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const [showRewriteEditor, setShowRewriteEditor] = useState(false);
|
const [showRewriteEditor, setShowRewriteEditor] = useState(false);
|
||||||
|
|
@ -561,6 +593,7 @@ export default function FormConvertSPIT() {
|
||||||
setArticleBody(cleanArticleBody || "");
|
setArticleBody(cleanArticleBody || "");
|
||||||
setDetailData(articleData);
|
setDetailData(articleData);
|
||||||
setSelectedArticleId(id);
|
setSelectedArticleId(id);
|
||||||
|
|
||||||
// setArticleImages(articleImagesData || []);
|
// setArticleImages(articleImagesData || []);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error fetching article details:", error);
|
console.error("Error fetching article details:", error);
|
||||||
|
|
@ -613,7 +646,9 @@ export default function FormConvertSPIT() {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form onSubmit={handleSubmit(onSubmit)}>
|
<>
|
||||||
|
<Form {...form}>
|
||||||
|
<form onSubmit={form.handleSubmit(onSubmit)}>
|
||||||
{detail !== undefined ? (
|
{detail !== undefined ? (
|
||||||
<div className="flex flex-col lg:flex-row gap-10">
|
<div className="flex flex-col lg:flex-row gap-10">
|
||||||
<Card className="w-full lg:w-8/12">
|
<Card className="w-full lg:w-8/12">
|
||||||
|
|
@ -624,23 +659,18 @@ export default function FormConvertSPIT() {
|
||||||
<div className="space-y-2 py-3">
|
<div className="space-y-2 py-3">
|
||||||
<Label>{t("title")}</Label>
|
<Label>{t("title")}</Label>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={form.control}
|
||||||
name="contentTitle"
|
name="contentTitle"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<Input
|
<Input
|
||||||
size="md"
|
size="md"
|
||||||
type="text"
|
type="text"
|
||||||
defaultValue={detail?.contentTitle}
|
value={field.value}
|
||||||
onChange={field.onChange}
|
onChange={field.onChange}
|
||||||
placeholder="Enter contentTitle"
|
placeholder="Enter contentTitle"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
{errors.contentTitle?.message && (
|
|
||||||
<p className="text-red-400 text-sm">
|
|
||||||
{errors.contentTitle.message}
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
<div className="py-3 w-full space-y-2">
|
<div className="py-3 w-full space-y-2">
|
||||||
|
|
@ -683,7 +713,7 @@ export default function FormConvertSPIT() {
|
||||||
<div className="py-3 space-y-2">
|
<div className="py-3 space-y-2">
|
||||||
<Label>{t("description")}</Label>
|
<Label>{t("description")}</Label>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={form.control}
|
||||||
name="contentDescription"
|
name="contentDescription"
|
||||||
render={({ field: { onChange, value } }) => (
|
render={({ field: { onChange, value } }) => (
|
||||||
// <JoditEditor
|
// <JoditEditor
|
||||||
|
|
@ -698,13 +728,9 @@ export default function FormConvertSPIT() {
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
{errors.contentDescription?.message && (
|
|
||||||
<p className="text-red-400 text-sm">
|
|
||||||
{errors.contentDescription.message}
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-2 py-3 w-4/12">
|
<p className="text-sm font-semibold">Content Rewrite</p>
|
||||||
|
<div className="space-y-2 pb-3 w-4/12">
|
||||||
<Label>{t("writing-style")}</Label>
|
<Label>{t("writing-style")}</Label>
|
||||||
<Select
|
<Select
|
||||||
value={selectedWritingStyle}
|
value={selectedWritingStyle}
|
||||||
|
|
@ -729,6 +755,7 @@ export default function FormConvertSPIT() {
|
||||||
<div className="my-2">
|
<div className="my-2">
|
||||||
<Button
|
<Button
|
||||||
size="sm"
|
size="sm"
|
||||||
|
type="button"
|
||||||
onClick={handleRewriteClick}
|
onClick={handleRewriteClick}
|
||||||
className="bg-blue-500 text-white py-2 px-4 rounded"
|
className="bg-blue-500 text-white py-2 px-4 rounded"
|
||||||
>
|
>
|
||||||
|
|
@ -740,22 +767,26 @@ export default function FormConvertSPIT() {
|
||||||
{isGeneratedArticle && (
|
{isGeneratedArticle && (
|
||||||
<div className="mt-3 pb-0 flex flex-row ">
|
<div className="mt-3 pb-0 flex flex-row ">
|
||||||
{articleIds.map((id: string, index: number) => (
|
{articleIds.map((id: string, index: number) => (
|
||||||
<button
|
<Button
|
||||||
|
type="button"
|
||||||
key={index}
|
key={index}
|
||||||
className={`mr-3 px-3 py-2 rounded-md ${
|
className={`mr-3 px-3 py-2 rounded-md ${
|
||||||
selectedArticleId === id
|
selectedArticleId === id
|
||||||
? "bg-green-500 text-white"
|
? "bg-green-500 text-white"
|
||||||
: "border-2 border-green-500 text-green-500"
|
: "border-2 border-green-500 bg-white text-green-500 hover:bg-green-500 hover:text-white hover:border-green-500"
|
||||||
}`}
|
}`}
|
||||||
onClick={() => handleArticleIdClick(id)}
|
onClick={() => handleArticleIdClick(id)}
|
||||||
>
|
>
|
||||||
{"Narasi " + (index + 1)}
|
{"Narasi " + (index + 1)}
|
||||||
</button>
|
</Button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="flex items-center space-x-2 mt-3">
|
<div className="flex items-center space-x-2 mt-3">
|
||||||
<RadioGroupItem value="rewrite" id="rewrite-file" />
|
<RadioGroupItem
|
||||||
|
value="rewrite"
|
||||||
|
id="rewrite-file"
|
||||||
|
/>
|
||||||
<Label htmlFor="rewrite-file">
|
<Label htmlFor="rewrite-file">
|
||||||
Select File Rewrite
|
Select File Rewrite
|
||||||
</Label>
|
</Label>
|
||||||
|
|
@ -763,7 +794,7 @@ export default function FormConvertSPIT() {
|
||||||
<div className="py-3 space-y-2">
|
<div className="py-3 space-y-2">
|
||||||
<Label>{t("file-rewrite")}</Label>
|
<Label>{t("file-rewrite")}</Label>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={form.control}
|
||||||
name="contentRewriteDescription"
|
name="contentRewriteDescription"
|
||||||
render={({ field: { onChange, value } }) =>
|
render={({ field: { onChange, value } }) =>
|
||||||
isLoadingData ? (
|
isLoadingData ? (
|
||||||
|
|
@ -780,11 +811,6 @@ export default function FormConvertSPIT() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
{errors.contentRewriteDescription?.message && (
|
|
||||||
<p className="text-red-400 text-sm">
|
|
||||||
{errors.contentRewriteDescription.message}
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
@ -929,7 +955,9 @@ export default function FormConvertSPIT() {
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
id="terms"
|
id="terms"
|
||||||
checked={filePlacements[index]?.includes("mabes")}
|
checked={filePlacements[index]?.includes(
|
||||||
|
"mabes"
|
||||||
|
)}
|
||||||
onCheckedChange={(e) =>
|
onCheckedChange={(e) =>
|
||||||
setupPlacement(index, "mabes", Boolean(e))
|
setupPlacement(index, "mabes", Boolean(e))
|
||||||
}
|
}
|
||||||
|
|
@ -944,7 +972,9 @@ export default function FormConvertSPIT() {
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
id="terms"
|
id="terms"
|
||||||
checked={filePlacements[index]?.includes("polda")}
|
checked={filePlacements[index]?.includes(
|
||||||
|
"polda"
|
||||||
|
)}
|
||||||
onCheckedChange={(e) =>
|
onCheckedChange={(e) =>
|
||||||
setupPlacement(index, "polda", Boolean(e))
|
setupPlacement(index, "polda", Boolean(e))
|
||||||
}
|
}
|
||||||
|
|
@ -964,7 +994,11 @@ export default function FormConvertSPIT() {
|
||||||
"international"
|
"international"
|
||||||
)}
|
)}
|
||||||
onCheckedChange={(e) =>
|
onCheckedChange={(e) =>
|
||||||
setupPlacement(index, "international", Boolean(e))
|
setupPlacement(
|
||||||
|
index,
|
||||||
|
"international",
|
||||||
|
Boolean(e)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<label
|
<label
|
||||||
|
|
@ -987,7 +1021,7 @@ export default function FormConvertSPIT() {
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label>{t("creator")}</Label>
|
<Label>{t("creator")}</Label>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={form.control}
|
||||||
name="contentCreator"
|
name="contentCreator"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<Input
|
<Input
|
||||||
|
|
@ -999,11 +1033,6 @@ export default function FormConvertSPIT() {
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
{errors.contentCreator?.message && (
|
|
||||||
<p className="text-red-400 text-sm">
|
|
||||||
{errors.contentCreator.message}
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-3 px-3">
|
<div className="mt-3 px-3">
|
||||||
|
|
@ -1037,7 +1066,10 @@ export default function FormConvertSPIT() {
|
||||||
<div className="flex flex-col gap-3 space-y-2">
|
<div className="flex flex-col gap-3 space-y-2">
|
||||||
<Label>{t("publish-target")}</Label>
|
<Label>{t("publish-target")}</Label>
|
||||||
{options.map((option) => (
|
{options.map((option) => (
|
||||||
<div key={option.id} className="flex gap-2 items-center">
|
<div
|
||||||
|
key={option.id}
|
||||||
|
className="flex gap-2 items-center"
|
||||||
|
>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
id={option.id}
|
id={option.id}
|
||||||
checked={
|
checked={
|
||||||
|
|
@ -1047,21 +1079,15 @@ export default function FormConvertSPIT() {
|
||||||
.length
|
.length
|
||||||
: publishedFor.includes(option.id)
|
: publishedFor.includes(option.id)
|
||||||
}
|
}
|
||||||
onCheckedChange={() => handleCheckboxChange(option.id)}
|
onCheckedChange={() =>
|
||||||
|
handleCheckboxChange(option.id)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<Label htmlFor={option.id}>{option.label}</Label>
|
<Label htmlFor={option.id}>{option.label}</Label>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="px-3 py-3 flex flex-row items-center text-blue-500 gap-2 text-sm">
|
|
||||||
<MailIcon />
|
|
||||||
<p className="">{t("suggestion-box")} (0)</p>
|
|
||||||
</div>
|
|
||||||
<div className="px-3 py-3">
|
|
||||||
<p>{t("information")}:</p>
|
|
||||||
{/* <p>{detail?.status}</p> */}
|
|
||||||
</div>
|
|
||||||
</Card>
|
</Card>
|
||||||
<div className="flex flex-row justify-end gap-3">
|
<div className="flex flex-row justify-end gap-3">
|
||||||
<div className="mt-4">
|
<div className="mt-4">
|
||||||
|
|
@ -1085,5 +1111,7 @@ export default function FormConvertSPIT() {
|
||||||
""
|
""
|
||||||
)}
|
)}
|
||||||
</form>
|
</form>
|
||||||
|
</Form>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ import DatePicker from "react-datepicker";
|
||||||
import { id } from "date-fns/locale";
|
import { id } from "date-fns/locale";
|
||||||
import "react-datepicker/dist/react-datepicker.css";
|
import "react-datepicker/dist/react-datepicker.css";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import router from "next/router";
|
|
||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import { date, z } from "zod";
|
import { date, z } from "zod";
|
||||||
import { error, loading } from "@/lib/swal";
|
import { error, loading } from "@/lib/swal";
|
||||||
|
|
@ -51,6 +50,7 @@ import Image from "next/image";
|
||||||
import FileUploader from "../shared/file-uploader";
|
import FileUploader from "../shared/file-uploader";
|
||||||
import { getCsrfToken } from "@/service/auth";
|
import { getCsrfToken } from "@/service/auth";
|
||||||
import { Upload } from "tus-js-client";
|
import { Upload } from "tus-js-client";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
const calendarSchema = z.object({
|
const calendarSchema = z.object({
|
||||||
title: z.string().min(1, { message: "Judul diperlukan" }),
|
title: z.string().min(1, { message: "Judul diperlukan" }),
|
||||||
|
|
@ -68,6 +68,7 @@ interface FileUploaded {
|
||||||
|
|
||||||
export function CalendarPolriAdd() {
|
export function CalendarPolriAdd() {
|
||||||
const MySwal = withReactContent(Swal);
|
const MySwal = withReactContent(Swal);
|
||||||
|
const router = useRouter();
|
||||||
const [open, setOpen] = React.useState(false);
|
const [open, setOpen] = React.useState(false);
|
||||||
const t = useTranslations("Schedule");
|
const t = useTranslations("Schedule");
|
||||||
type CalendarSchema = z.infer<typeof calendarSchema>;
|
type CalendarSchema = z.infer<typeof calendarSchema>;
|
||||||
|
|
@ -212,9 +213,7 @@ export function CalendarPolriAdd() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cookies.set("scheduleId", response?.data?.data.id, {
|
const id = response?.data?.data?.id;
|
||||||
expires: 1,
|
|
||||||
});
|
|
||||||
|
|
||||||
loading();
|
loading();
|
||||||
if (imageFiles?.length === 0) {
|
if (imageFiles?.length === 0) {
|
||||||
|
|
@ -242,7 +241,7 @@ export function CalendarPolriAdd() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const upload = new Upload(file, {
|
const upload = new Upload(file, {
|
||||||
endpoint: `${process.env.NEXT_PUBLIC_API}/agenda-settings/file/upload`,
|
endpoint: `${process.env.NEXT_PUBLIC_API}/calendars/file/upload`,
|
||||||
headers: headers,
|
headers: headers,
|
||||||
retryDelays: [0, 3000, 6000, 12_000, 24_000],
|
retryDelays: [0, 3000, 6000, 12_000, 24_000],
|
||||||
chunkSize: 20_000,
|
chunkSize: 20_000,
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ export function TambahIklanModal() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePoldaPolresChange = () => {
|
const handlePoldaPolresChange = () => {
|
||||||
return Array.from(checkedLevels).join(","); // Mengonversi Set ke string
|
return Array.from(checkedLevels).join(",");
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleUnitChange = (
|
const handleUnitChange = (
|
||||||
|
|
@ -185,34 +185,30 @@ export function TambahIklanModal() {
|
||||||
.filter((key) => unitSelection[key as keyof typeof unitSelection])
|
.filter((key) => unitSelection[key as keyof typeof unitSelection])
|
||||||
.map((key) => unitMapping[key as keyof typeof unitMapping])
|
.map((key) => unitMapping[key as keyof typeof unitMapping])
|
||||||
.join(",");
|
.join(",");
|
||||||
const requestData = {
|
|
||||||
title: data.title,
|
|
||||||
placements: selectedPlacement,
|
|
||||||
description: data.description,
|
|
||||||
redirectLink: "https://new.netidhub.com",
|
|
||||||
createdBy: assignmentToString,
|
|
||||||
assignedToLevel: handlePoldaPolresChange(),
|
|
||||||
};
|
|
||||||
|
|
||||||
console.log("Form Data Submitted:", requestData);
|
|
||||||
|
|
||||||
const response = await postAdvertisements(requestData);
|
const formMedia = new FormData();
|
||||||
|
formMedia.append("title", data.title);
|
||||||
|
formMedia.append("placements", selectedPlacement);
|
||||||
|
formMedia.append("description", data.description);
|
||||||
|
formMedia.append("redirectLink", "https://new.netidhub.com");
|
||||||
|
formMedia.append("assignedToLevel", handlePoldaPolresChange());
|
||||||
|
formMedia.append("file", imageFiles[0]);
|
||||||
|
|
||||||
|
console.log("Form Data Submitted:", formMedia);
|
||||||
|
|
||||||
|
loading();
|
||||||
|
const response = await postAdvertisements(formMedia);
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
error(response?.message);
|
error(response?.message);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
close();
|
||||||
|
|
||||||
Cookies.set("scheduleId", response?.data?.data.id, {
|
Cookies.set("scheduleId", response?.data?.data.id, {
|
||||||
expires: 1,
|
expires: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
loading();
|
|
||||||
if (imageFiles?.length === 0) {
|
|
||||||
setIsImageUploadFinish(true);
|
|
||||||
}
|
|
||||||
imageFiles?.map(async (item: any, index: number) => {
|
|
||||||
await uploadResumableFile(index, String(id), item, "1", "0");
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
async function uploadResumableFile(
|
async function uploadResumableFile(
|
||||||
|
|
@ -232,7 +228,7 @@ export function TambahIklanModal() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const upload = new Upload(file, {
|
const upload = new Upload(file, {
|
||||||
endpoint: `${process.env.NEXT_PUBLIC_API}/advertisment/file/upload`,
|
endpoint: `${process.env.NEXT_PUBLIC_API}/advertisements/file/upload`,
|
||||||
headers: headers,
|
headers: headers,
|
||||||
retryDelays: [0, 3000, 6000, 12_000, 24_000],
|
retryDelays: [0, 3000, 6000, 12_000, 24_000],
|
||||||
chunkSize: 20_000,
|
chunkSize: 20_000,
|
||||||
|
|
|
||||||
|
|
@ -907,7 +907,7 @@ export default function FormTaskTaDetail() {
|
||||||
<div className="px-6 py-6">
|
<div className="px-6 py-6">
|
||||||
<div className="flex flex-col sm:flex-row lg:flex-row justify-between">
|
<div className="flex flex-col sm:flex-row lg:flex-row justify-between">
|
||||||
<p className="text-lg font-semibold mb-3">{t("detail-task")}</p>
|
<p className="text-lg font-semibold mb-3">{t("detail-task")}</p>
|
||||||
<div
|
{/* <div
|
||||||
className="flex gap-3"
|
className="flex gap-3"
|
||||||
style={
|
style={
|
||||||
detail?.createdBy?.id === Number(userId)
|
detail?.createdBy?.id === Number(userId)
|
||||||
|
|
@ -950,7 +950,7 @@ export default function FormTaskTaDetail() {
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> */}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form>
|
<form>
|
||||||
|
|
@ -1320,7 +1320,7 @@ export default function FormTaskTaDetail() {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-wrap lg:flex-row justify-between gap-3 my-3">
|
<div className="flex flex-wrap lg:flex-row justify-between gap-3 my-3">
|
||||||
<div className="lg:px-1">
|
{/* <div className="lg:px-1">
|
||||||
{detail?.isDone !== true &&
|
{detail?.isDone !== true &&
|
||||||
(Number(userLevelNumber) !== 3 ||
|
(Number(userLevelNumber) !== 3 ||
|
||||||
Number(userLevelNumber) == 2) ? (
|
Number(userLevelNumber) == 2) ? (
|
||||||
|
|
@ -1336,9 +1336,9 @@ export default function FormTaskTaDetail() {
|
||||||
) : (
|
) : (
|
||||||
""
|
""
|
||||||
)}
|
)}
|
||||||
</div>
|
</div> */}
|
||||||
<div className="flex flex-wrap gap-2">
|
<div className="flex flex-wrap gap-2">
|
||||||
<div className="">
|
{/* <div className="">
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
color="primary"
|
color="primary"
|
||||||
|
|
@ -1347,8 +1347,8 @@ export default function FormTaskTaDetail() {
|
||||||
>
|
>
|
||||||
Beri Tanggapan
|
Beri Tanggapan
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div> */}
|
||||||
<div className="">
|
{/* <div className="">
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
className="btn btn-primary lg:mx-3"
|
className="btn btn-primary lg:mx-3"
|
||||||
|
|
@ -1364,7 +1364,7 @@ export default function FormTaskTaDetail() {
|
||||||
>
|
>
|
||||||
Terima Tugas
|
Terima Tugas
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div> */}
|
||||||
<div
|
<div
|
||||||
className="task-response w-100 lg:px-3"
|
className="task-response w-100 lg:px-3"
|
||||||
// style={
|
// style={
|
||||||
|
|
@ -1384,7 +1384,7 @@ export default function FormTaskTaDetail() {
|
||||||
if (!isTableResult) fetchAllData(); // Panggil API saat tombol diklik
|
if (!isTableResult) fetchAllData(); // Panggil API saat tombol diklik
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Hasil Upload {Number(userId)}
|
Hasil Upload
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -1406,7 +1406,7 @@ export default function FormTaskTaDetail() {
|
||||||
/>
|
/>
|
||||||
</InputGroup>
|
</InputGroup>
|
||||||
</div>
|
</div>
|
||||||
<Dialog>
|
{/* <Dialog>
|
||||||
<DialogTrigger asChild>
|
<DialogTrigger asChild>
|
||||||
<Button variant="outline" size="md" color="primary">
|
<Button variant="outline" size="md" color="primary">
|
||||||
Filter Polda/Polres
|
Filter Polda/Polres
|
||||||
|
|
@ -1486,7 +1486,7 @@ export default function FormTaskTaDetail() {
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog> */}
|
||||||
</div>
|
</div>
|
||||||
<div className="overflow-x-auto">
|
<div className="overflow-x-auto">
|
||||||
<table className="min-w-full border-collapse border border-gray-300">
|
<table className="min-w-full border-collapse border border-gray-300">
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ export default function FormTaskTa() {
|
||||||
const [isAudioUploadFinish, setIsAudioUploadFinish] = useState(false);
|
const [isAudioUploadFinish, setIsAudioUploadFinish] = useState(false);
|
||||||
const [voiceNoteLink, setVoiceNoteLink] = useState("");
|
const [voiceNoteLink, setVoiceNoteLink] = useState("");
|
||||||
const [date, setDate] = React.useState<DateRange | undefined>({
|
const [date, setDate] = React.useState<DateRange | undefined>({
|
||||||
from: new Date(2024, 0, 1),
|
from: new Date(),
|
||||||
});
|
});
|
||||||
|
|
||||||
const [platformTypeVisible, setPlatformTypeVisible] = useState(false);
|
const [platformTypeVisible, setPlatformTypeVisible] = useState(false);
|
||||||
|
|
@ -400,7 +400,7 @@ export default function FormTaskTa() {
|
||||||
fileTypeId: string,
|
fileTypeId: string,
|
||||||
duration: string
|
duration: string
|
||||||
) {
|
) {
|
||||||
console.log(idx, id, file, fileTypeId, duration);
|
console.log("Tus Upload : ", idx, id, file, fileTypeId, duration);
|
||||||
|
|
||||||
const resCsrf = await getCsrfToken();
|
const resCsrf = await getCsrfToken();
|
||||||
const csrfToken = resCsrf?.data?.token;
|
const csrfToken = resCsrf?.data?.token;
|
||||||
|
|
@ -631,7 +631,10 @@ export default function FormTaskTa() {
|
||||||
}
|
}
|
||||||
className="mr-3"
|
className="mr-3"
|
||||||
/>
|
/>
|
||||||
{expert.fullname}
|
<div className="flex flex-col gap-2">
|
||||||
|
<div className="font-bold">{expert.fullname}</div>
|
||||||
|
<div className="italic">({expert.username})</div>
|
||||||
|
</div>
|
||||||
</Label>
|
</Label>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|
@ -639,6 +642,36 @@ export default function FormTaskTa() {
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</div>
|
</div>
|
||||||
|
{checkedLevels.size > 0 && (
|
||||||
|
<div className="mt-3">
|
||||||
|
<Label className="text-sm text-gray-600 mb-2 block">
|
||||||
|
Tenaga Ahli Terpilih ({checkedLevels.size})
|
||||||
|
</Label>
|
||||||
|
<div className="flex flex-wrap gap-2">
|
||||||
|
{Array.from(checkedLevels).map((expertId) => {
|
||||||
|
const expert = listExpert?.find((exp: any) => exp.id === expertId);
|
||||||
|
return expert ? (
|
||||||
|
<div
|
||||||
|
key={expert.id}
|
||||||
|
className="inline-flex items-center gap-2 bg-blue-100 text-blue-800 text-sm font-medium px-3 py-1.5 rounded-full border border-blue-200"
|
||||||
|
>
|
||||||
|
<span>{expert.fullname}</span>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => handleCheckboxChange(expert.id)}
|
||||||
|
className="ml-1 text-blue-600 hover:text-blue-800 hover:bg-blue-200 rounded-full p-0.5 transition-colors"
|
||||||
|
title="Remove expert"
|
||||||
|
>
|
||||||
|
<svg className="w-3 h-3" fill="currentColor" viewBox="0 0 20 20">
|
||||||
|
<path fillRule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clipRule="evenodd" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
) : null;
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-5 space-y-2">
|
<div className="mt-5 space-y-2">
|
||||||
<Label>{t("description")}</Label>
|
<Label>{t("description")}</Label>
|
||||||
|
|
|
||||||
|
|
@ -31,34 +31,25 @@ interface Advertisement {
|
||||||
// };
|
// };
|
||||||
// }
|
// }
|
||||||
|
|
||||||
const LeftBanner = () => {
|
const AdvertisementPlacements = (props: { placement?: string }) => {
|
||||||
const [ads, setAds] = useState<Advertisement[]>([]);
|
const [ads, setAds] = useState<Advertisement[]>([]);
|
||||||
const [loading, setLoading] = useState<boolean>(false);
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
const [showData, setShowData] = React.useState("10");
|
|
||||||
const [categories, setCategories] = React.useState<any>();
|
|
||||||
const [dataTable, setDataTable] = React.useState<any[]>([]);
|
|
||||||
const [totalData, setTotalData] = React.useState<number>(1);
|
|
||||||
const [categoryFilter, setCategoryFilter] = React.useState<number[]>([]);
|
|
||||||
const [statusFilter, setStatusFilter] = React.useState<number[]>([]);
|
|
||||||
const [page, setPage] = React.useState(1);
|
|
||||||
|
|
||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const res = await listDataAdvertisements( page - 1,
|
const res = await listDataAdvertisements(
|
||||||
showData,
|
0,
|
||||||
"",
|
"4",
|
||||||
categoryFilter?.sort().join(","),
|
""
|
||||||
statusFilter?.sort().join(","));
|
);
|
||||||
const data = res?.data?.data;
|
const data = res?.data?.data;
|
||||||
const contentData = data?.content;
|
const contentData = data?.content;
|
||||||
|
if (props.placement == "left") {
|
||||||
contentData.forEach((item: Advertisement, index: number) => {
|
setAds(contentData.slice(0,2));
|
||||||
item.no = index + 1;
|
} else {
|
||||||
});
|
setAds(contentData.slice(2));
|
||||||
|
}
|
||||||
setAds(contentData);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error fetching advertisements:", error);
|
console.error("Error fetching advertisements:", error);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
@ -71,13 +62,13 @@ const LeftBanner = () => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="sticky top-0 space-y-4 ml-14">
|
<div className={`sticky top-0 space-y-4 ${props.placement == "left" ? "ml-14" : "mr-14"}`}>
|
||||||
{loading && <p className="text-sm text-gray-500">Loading...</p>}
|
{loading && <p className="text-sm text-gray-500">Loading...</p>}
|
||||||
{ads.map((ad) => (
|
{ads?.map((ad) => (
|
||||||
<img key={ad.id} src={ad.imageUrl} alt={`Banner ${ad.id}`} width={180} />
|
<img key={ad.id} src={ad.contentFileUrl} alt={`Banner ${ad.id}`} className="w-full" />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default LeftBanner;
|
export default AdvertisementPlacements;
|
||||||
|
|
@ -1,86 +1,285 @@
|
||||||
import React from "react";
|
import { getCalendarPagination } from "@/service/schedule/schedule";
|
||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
|
||||||
|
interface CalendarItem {
|
||||||
|
id: number;
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
assignedTo: string;
|
||||||
|
assignedToLevel: string;
|
||||||
|
startDate: string;
|
||||||
|
endDate: string;
|
||||||
|
isActive: boolean;
|
||||||
|
createdById: number;
|
||||||
|
createdByName: string;
|
||||||
|
thumbnailUrl: string;
|
||||||
|
createdAt: string;
|
||||||
|
updatedAt: string;
|
||||||
|
}
|
||||||
|
|
||||||
const EventCalender = () => {
|
const EventCalender = () => {
|
||||||
|
// Get current date
|
||||||
|
const today = new Date();
|
||||||
|
const currentMonth = today.getMonth();
|
||||||
|
const currentYear = today.getFullYear();
|
||||||
|
const currentDate = today.getDate();
|
||||||
|
|
||||||
|
const [events, setEvents] = useState<CalendarItem[]>([]);
|
||||||
|
const [selectedEvent, setSelectedEvent] = useState<CalendarItem | null>(null);
|
||||||
|
|
||||||
|
// Month names in Indonesian
|
||||||
|
const monthNames = [
|
||||||
|
"Januari", "Februari", "Maret", "April", "Mei", "Juni",
|
||||||
|
"Juli", "Agustus", "September", "Oktober", "November", "Desember"
|
||||||
|
];
|
||||||
|
|
||||||
|
const fetchData = async () => {
|
||||||
|
try {
|
||||||
|
const res = await getCalendarPagination(100, 0);
|
||||||
|
const data = res?.data?.data;
|
||||||
|
const contentData = data?.content;
|
||||||
|
setEvents(contentData || []);
|
||||||
|
|
||||||
|
// Set first event as selected by default
|
||||||
|
if (contentData && contentData.length > 0) {
|
||||||
|
setSelectedEvent(contentData[0]);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error fetching calendar events:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
fetchData();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// Get first day of the month and number of days
|
||||||
|
const firstDayOfMonth = new Date(currentYear, currentMonth, 1);
|
||||||
|
const lastDayOfMonth = new Date(currentYear, currentMonth + 1, 0);
|
||||||
|
const daysInMonth = lastDayOfMonth.getDate();
|
||||||
|
const startingDayOfWeek = firstDayOfMonth.getDay();
|
||||||
|
|
||||||
|
// Convert Sunday (0) to 7 for Monday-first week
|
||||||
|
const adjustedStartingDay = startingDayOfWeek === 0 ? 6 : startingDayOfWeek - 1;
|
||||||
|
|
||||||
|
// Generate calendar days
|
||||||
|
const generateCalendarDays = () => {
|
||||||
|
const days = [];
|
||||||
|
|
||||||
|
// Empty cells for days before the first day of month
|
||||||
|
for (let i = 0; i < adjustedStartingDay; i++) {
|
||||||
|
days.push(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Days of the month
|
||||||
|
for (let day = 1; day <= daysInMonth; day++) {
|
||||||
|
days.push(day);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fill remaining cells to complete the grid (6 rows × 7 days = 42 cells)
|
||||||
|
while (days.length < 42) {
|
||||||
|
days.push(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return days;
|
||||||
|
};
|
||||||
|
|
||||||
|
const calendarDays = generateCalendarDays();
|
||||||
|
|
||||||
|
// Helper function to extract day from date string
|
||||||
|
const getDateFromString = (dateString: string) => {
|
||||||
|
try {
|
||||||
|
const date = new Date(dateString);
|
||||||
|
if (date.getMonth() === currentMonth && date.getFullYear() === currentYear) {
|
||||||
|
return date.getDate();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Helper function to format date range
|
||||||
|
const formatDateRange = (startDate: string, endDate: string) => {
|
||||||
|
try {
|
||||||
|
const start = new Date(startDate);
|
||||||
|
const end = new Date(endDate);
|
||||||
|
|
||||||
|
const startDay = start.getDate();
|
||||||
|
const endDay = end.getDate();
|
||||||
|
const startMonth = monthNames[start.getMonth()];
|
||||||
|
const endMonth = monthNames[end.getMonth()];
|
||||||
|
|
||||||
|
if (startDay === endDay && startMonth === endMonth) {
|
||||||
|
return `${startDay} ${startMonth}`;
|
||||||
|
} else {
|
||||||
|
return `${startDay} ${startMonth} - ${endDay} ${endMonth}`;
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
return "Tanggal tidak valid";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Helper function to format time range
|
||||||
|
const formatTimeRange = (startDate: string, endDate: string) => {
|
||||||
|
try {
|
||||||
|
const start = new Date(startDate);
|
||||||
|
const end = new Date(endDate);
|
||||||
|
|
||||||
|
const startTime = start.toLocaleTimeString('id-ID', {
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit',
|
||||||
|
timeZone: 'Asia/Jakarta'
|
||||||
|
});
|
||||||
|
const endTime = end.toLocaleTimeString('id-ID', {
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit',
|
||||||
|
timeZone: 'Asia/Jakarta'
|
||||||
|
});
|
||||||
|
|
||||||
|
return `${startTime} - ${endTime} WIB`;
|
||||||
|
} catch {
|
||||||
|
return "Waktu tidak tersedia";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Get event dates for highlighting calendar
|
||||||
|
const eventDates = events
|
||||||
|
.map(event => getDateFromString(event.startDate))
|
||||||
|
.filter(date => date !== null);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mt-8 rounded-lg bg-white dark:bg-zinc-900 p-4 shadow">
|
<div className="mt-8 rounded-lg bg-white dark:bg-zinc-900 p-4 shadow">
|
||||||
<h2 className="text-lg font-bold text-red-600 border-b border-red-600 mb-4 pb-2">
|
<h2 className="text-lg font-bold text-red-600 border-b border-red-600 mb-4 pb-2">
|
||||||
KALENDER ACARA
|
KALENDER ACARA
|
||||||
</h2>
|
</h2>
|
||||||
<div className="flex flex-col md:flex-row gap-4">
|
<div className="flex flex-col lg:flex-row gap-6">
|
||||||
<div className="w-full md:w-1/2">
|
{/* Left Side - Calendar and Event List */}
|
||||||
<div className="bg-gray-100 dark:bg-zinc-800 p-4 rounded-md ">
|
<div className="w-full lg:w-1/2">
|
||||||
<div className="text-center font-semibold mb-2">Mei 2025</div>
|
{/* Mini Calendar */}
|
||||||
|
<div className="bg-gray-100 dark:bg-zinc-800 p-4 rounded-md mb-4">
|
||||||
|
<div className="text-center font-semibold mb-2">
|
||||||
|
{monthNames[currentMonth]} {currentYear}
|
||||||
|
</div>
|
||||||
<div className="grid grid-cols-7 gap-1 text-sm text-center">
|
<div className="grid grid-cols-7 gap-1 text-sm text-center">
|
||||||
{["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"].map((d) => (
|
{["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"].map((d) => (
|
||||||
<div key={d} className="font-medium">
|
<div key={d} className="font-medium p-1">
|
||||||
{d}
|
{d}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
{[...Array(35)].map((_, i) => (
|
{calendarDays?.map((day, index) => (
|
||||||
<div
|
<div
|
||||||
key={i}
|
key={index}
|
||||||
className={`p-1 rounded ${
|
className={`p-1 rounded min-h-[24px] flex items-center justify-center text-xs ${
|
||||||
[6, 7, 15].includes(i) ? "bg-red-600 text-white" : ""
|
day === null
|
||||||
|
? ""
|
||||||
|
: eventDates.includes(day)
|
||||||
|
? "bg-red-600 text-white font-semibold"
|
||||||
|
: day === currentDate
|
||||||
|
? "bg-blue-500 text-white font-semibold"
|
||||||
|
: "hover:bg-gray-200 dark:hover:bg-zinc-700"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{i >= 2 && i - 1}
|
{day}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-4 mt-3">
|
|
||||||
<div className="flex items-center bg-gray-200 rounded-xl shadow-sm p-2">
|
{/* Event List */}
|
||||||
|
<div className="space-y-3 max-h-[230px] overflow-y-auto pr-5">
|
||||||
|
<h3 className="text-lg font-semibold text-gray-800 dark:text-gray-200 mb-3">
|
||||||
|
Daftar Acara
|
||||||
|
</h3>
|
||||||
|
{events?.length === 0 ? (
|
||||||
|
<div className="text-center text-gray-500 dark:text-gray-400 py-8">
|
||||||
|
Tidak ada acara yang tersedia
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
events.map((event) => (
|
||||||
|
<div
|
||||||
|
key={event.id}
|
||||||
|
onClick={() => setSelectedEvent(event)}
|
||||||
|
className={`flex items-center rounded-xl shadow-sm p-3 cursor-pointer transition-all duration-200 hover:shadow-md ${
|
||||||
|
selectedEvent?.id === event.id
|
||||||
|
? "bg-red-100 dark:bg-red-900/20 border-2 border-red-500"
|
||||||
|
: "bg-gray-200 dark:bg-zinc-800 hover:bg-gray-300 dark:hover:bg-zinc-700"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
<img
|
<img
|
||||||
src="/images/all-img/calendar1.png"
|
src={event.thumbnailUrl || "/images/default-event.png"}
|
||||||
alt="HUT Polwan"
|
alt={event.title}
|
||||||
className="w-24 h-20 object-cover rounded"
|
className="w-16 h-12 object-cover rounded flex-shrink-0"
|
||||||
|
onError={(e) => {
|
||||||
|
const target = e.target as HTMLImageElement;
|
||||||
|
target.src = "/images/default-event.png";
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
<div className="flex justify-between items-center w-full ml-3">
|
<div className="ml-3 flex-1 min-w-0">
|
||||||
<div className="text-sm font-semibold line-clamp-2">
|
<div className="text-sm font-semibold text-gray-800 dark:text-gray-200 line-clamp-2">
|
||||||
HUT Polwan ke-76, Kapolri...
|
{event.title}
|
||||||
</div>
|
</div>
|
||||||
<div className="text-sm font-semibold whitespace-nowrap ml-3">
|
<div className="text-xs text-gray-600 dark:text-gray-400 mt-1">
|
||||||
16 Mei - 16 Mei
|
{formatDateRange(event.startDate, event.endDate)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="ml-2 flex-shrink-0">
|
||||||
|
<div className={`w-2 h-2 rounded-full ${event.isActive ? 'bg-green-500' : 'bg-red-500'}`}></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center bg-gray-200 rounded-xl shadow-sm p-2">
|
{/* Right Side - Event Detail */}
|
||||||
|
<div className="w-full lg:w-1/2">
|
||||||
|
<div className="bg-gray-100 dark:bg-zinc-800 rounded-lg p-4 sticky top-4">
|
||||||
|
<h3 className="text-lg font-semibold text-gray-800 dark:text-gray-200 mb-4">
|
||||||
|
Detail Acara
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
{selectedEvent ? (
|
||||||
|
<div className="space-y-4">
|
||||||
<img
|
<img
|
||||||
src="/images/all-img/calendar2.png"
|
src={selectedEvent.thumbnailUrl || "/images/default-event.png"}
|
||||||
alt="Olahraga"
|
alt={selectedEvent.title}
|
||||||
className="w-24 h-20 object-cover rounded"
|
className="w-full h-48 object-cover rounded-lg"
|
||||||
|
onError={(e) => {
|
||||||
|
const target = e.target as HTMLImageElement;
|
||||||
|
target.src = "/images/default-event.png";
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
<div className="flex justify-between items-center w-full ml-3">
|
|
||||||
<div className="text-sm font-semibold line-clamp-2 uppercase">
|
<div>
|
||||||
Olahraga Bersama Pad...
|
<h4 className="text-lg font-bold text-gray-800 dark:text-gray-200 mb-2">
|
||||||
</div>
|
{selectedEvent.title}
|
||||||
<div className="text-sm font-semibold whitespace-nowrap ml-3">
|
</h4>
|
||||||
22 Mei - 22 Mei
|
|
||||||
</div>
|
<div className="grid grid-cols-1 gap-3 mb-4">
|
||||||
</div>
|
<div className="flex items-start text-sm text-gray-600 dark:text-gray-400">
|
||||||
|
<span className="w-20 font-semibold flex-shrink-0">Tanggal:</span>
|
||||||
|
<span>{formatDateRange(selectedEvent.startDate, selectedEvent.endDate)}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="mb-4">
|
||||||
|
<p className="text-sm text-gray-600 dark:text-gray-400 leading-relaxed">
|
||||||
|
{selectedEvent.description || "Tidak ada deskripsi tersedia."}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Detail Acara */}
|
<div className="flex gap-2">
|
||||||
<div className="w-full md:w-1/2 space-y-4">
|
<button className="px-4 py-2 bg-gray-300 dark:bg-zinc-700 text-gray-700 dark:text-gray-300 text-sm font-medium rounded-lg hover:bg-gray-400 dark:hover:bg-zinc-600 transition-colors">
|
||||||
<div className="bg-gray-100 dark:bg-zinc-800 rounded-md p-2 mt-4">
|
Bagikan
|
||||||
<img
|
</button>
|
||||||
src="/images/all-img/calendar1.png"
|
</div>
|
||||||
alt="Detail Event"
|
</div>
|
||||||
className="rounded mb-2"
|
</div>
|
||||||
/>
|
) : (
|
||||||
<p className="text-sm font-semibold mb-1">
|
<div className="text-center text-gray-500 dark:text-gray-400 py-8">
|
||||||
HUT Polwan ke-76, Kapolri Apresiasi Prestasi yang Diberikan
|
Pilih acara untuk melihat detail
|
||||||
</p>
|
</div>
|
||||||
<p className="text-xs text-gray-500 mb-1">
|
)}
|
||||||
Kapolri Jenderal Pol. Listyo Sigit Prabowo memberikan apresiasi
|
|
||||||
kepada polisi wanita yang berprestasi...
|
|
||||||
</p>
|
|
||||||
<a href="#" className="text-xs text-blue-500">
|
|
||||||
Lihat Selengkapnya
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -12,20 +12,7 @@ import AreaCoverageWorkUnits from "./area-coverage-and-work-units";
|
||||||
import EventCalender from "./event-calender";
|
import EventCalender from "./event-calender";
|
||||||
import UserSurveyBox from "./survey-box";
|
import UserSurveyBox from "./survey-box";
|
||||||
import ScrollableContentPolda from "./scrollable-content-polda";
|
import ScrollableContentPolda from "./scrollable-content-polda";
|
||||||
|
import AdvertisementPlacements from "./advertisement-placements";
|
||||||
const LeftBanner = () => (
|
|
||||||
<div className="sticky top-0 space-y-4">
|
|
||||||
<img src="/images/all-img/kiri1.png" alt="Banner Kiri 1" />
|
|
||||||
<img src="/images/all-img/kiri2.png" alt="Banner Kiri 2" />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
const RightBanner = () => (
|
|
||||||
<div className="sticky top-0 space-y-4">
|
|
||||||
<img src="/images/all-img/kanan2.png" alt="Banner Kanan 1" />
|
|
||||||
<img src="/images/all-img/kanan1.png" alt="Banner Kanan 2" />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
const SearchSectionPolda = () => {
|
const SearchSectionPolda = () => {
|
||||||
const [contentType, setContentType] = useState("all");
|
const [contentType, setContentType] = useState("all");
|
||||||
|
|
@ -35,7 +22,7 @@ const SearchSectionPolda = () => {
|
||||||
return (
|
return (
|
||||||
<div className="flex w-full min-h-screen bg-center bg-cover bg-no-repeat" style={{ backgroundImage: "url('/assets/background.png')" }}>
|
<div className="flex w-full min-h-screen bg-center bg-cover bg-no-repeat" style={{ backgroundImage: "url('/assets/background.png')" }}>
|
||||||
<div className="hidden xl:block w-[15%] pr-4 py-5 sticky top-[150px] space-y-4 self-start">
|
<div className="hidden xl:block w-[15%] pr-4 py-5 sticky top-[150px] space-y-4 self-start">
|
||||||
<LeftBanner />
|
<AdvertisementPlacements placement="left"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="w-full xl:w-[70%] px-4 py-8 bg-white">
|
<div className="w-full xl:w-[70%] px-4 py-8 bg-white">
|
||||||
|
|
@ -49,7 +36,7 @@ const SearchSectionPolda = () => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="hidden xl:block w-[15%] pl-4 py-5 sticky top-[150px] space-y-4 self-start">
|
<div className="hidden xl:block w-[15%] pl-4 py-5 sticky top-[150px] space-y-4 self-start">
|
||||||
<RightBanner />
|
<AdvertisementPlacements placement="right"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -13,20 +13,7 @@ import EventCalender from "./event-calender";
|
||||||
import UserSurveyBox from "./survey-box";
|
import UserSurveyBox from "./survey-box";
|
||||||
import ScrollableContentPolda from "./scrollable-content-polda";
|
import ScrollableContentPolda from "./scrollable-content-polda";
|
||||||
import ScrollableContentSatker from "./scrollable-content-satker";
|
import ScrollableContentSatker from "./scrollable-content-satker";
|
||||||
|
import AdvertisementPlacements from "./advertisement-placements";
|
||||||
const LeftBanner = () => (
|
|
||||||
<div className="sticky top-0 space-y-4">
|
|
||||||
<img src="/images/all-img/kiri1.png" alt="Banner Kiri 1" />
|
|
||||||
<img src="/images/all-img/kiri2.png" alt="Banner Kiri 2" />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
const RightBanner = () => (
|
|
||||||
<div className="sticky top-0 space-y-4">
|
|
||||||
<img src="/images/all-img/kanan2.png" alt="Banner Kanan 1" />
|
|
||||||
<img src="/images/all-img/kanan1.png" alt="Banner Kanan 2" />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
const SearchSectionSatker = () => {
|
const SearchSectionSatker = () => {
|
||||||
const [contentType, setContentType] = useState("all");
|
const [contentType, setContentType] = useState("all");
|
||||||
|
|
@ -36,7 +23,7 @@ const SearchSectionSatker = () => {
|
||||||
return (
|
return (
|
||||||
<div className="flex w-full min-h-screen bg-center bg-cover bg-no-repeat" style={{ backgroundImage: "url('/assets/background.png')" }}>
|
<div className="flex w-full min-h-screen bg-center bg-cover bg-no-repeat" style={{ backgroundImage: "url('/assets/background.png')" }}>
|
||||||
<div className="hidden xl:block w-[15%] pr-4 py-5 sticky top-[150px] space-y-4 self-start">
|
<div className="hidden xl:block w-[15%] pr-4 py-5 sticky top-[150px] space-y-4 self-start">
|
||||||
<LeftBanner />
|
<AdvertisementPlacements placement="left"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="w-full xl:w-[70%] px-4 py-8 bg-white">
|
<div className="w-full xl:w-[70%] px-4 py-8 bg-white">
|
||||||
|
|
@ -50,7 +37,7 @@ const SearchSectionSatker = () => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="hidden xl:block w-[15%] pl-4 py-5 sticky top-[150px] space-y-4 self-start">
|
<div className="hidden xl:block w-[15%] pl-4 py-5 sticky top-[150px] space-y-4 self-start">
|
||||||
<RightBanner />
|
<AdvertisementPlacements placement="right"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -18,20 +18,7 @@ import ContentCategory from "./content-category";
|
||||||
import AreaCoverageWorkUnits from "./area-coverage-and-work-units";
|
import AreaCoverageWorkUnits from "./area-coverage-and-work-units";
|
||||||
import EventCalender from "./event-calender";
|
import EventCalender from "./event-calender";
|
||||||
import UserSurveyBox from "./survey-box";
|
import UserSurveyBox from "./survey-box";
|
||||||
|
import AdvertisementPlacements from "./advertisement-placements";
|
||||||
const LeftBanner = () => (
|
|
||||||
<div className="sticky top-0 space-y-4 ml-14">
|
|
||||||
<img src="/images/all-img/kiri1.png" alt="Banner Kiri 1" width={180} />
|
|
||||||
<img src="/images/all-img/kiri2.png" alt="Banner Kiri 2" width={180} />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
const RightBanner = () => (
|
|
||||||
<div className="sticky top-0 space-y-4">
|
|
||||||
<img src="/images/all-img/kanan2.png" alt="Banner Kanan 1" width={180} />
|
|
||||||
<img src="/images/all-img/kanan1.png" alt="Banner Kanan 2" width={180} />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
const SearchSection = () => {
|
const SearchSection = () => {
|
||||||
const [contentType, setContentType] = useState("all");
|
const [contentType, setContentType] = useState("all");
|
||||||
|
|
@ -44,7 +31,7 @@ const SearchSection = () => {
|
||||||
style={{ backgroundImage: "url('/assets/background.png')" }}
|
style={{ backgroundImage: "url('/assets/background.png')" }}
|
||||||
>
|
>
|
||||||
<div className="hidden xl:block w-[15%] pr-4 py-5 sticky top-[130px] space-y-4 self-start">
|
<div className="hidden xl:block w-[15%] pr-4 py-5 sticky top-[130px] space-y-4 self-start">
|
||||||
<LeftBanner />
|
<AdvertisementPlacements placement="left"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="w-full xl:w-[70%] px-4 py-8 bg-white">
|
<div className="w-full xl:w-[70%] px-4 py-8 bg-white">
|
||||||
|
|
@ -58,7 +45,7 @@ const SearchSection = () => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="hidden xl:block w-[15%] pl-4 py-5 sticky top-[130px] space-y-4 self-start">
|
<div className="hidden xl:block w-[15%] pl-4 py-5 sticky top-[130px] space-y-4 self-start">
|
||||||
<RightBanner />
|
<AdvertisementPlacements placement="right" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -690,7 +690,7 @@
|
||||||
"type-task": "Tipe Penugasan",
|
"type-task": "Tipe Penugasan",
|
||||||
"category-task": "Kategori Penugasan",
|
"category-task": "Kategori Penugasan",
|
||||||
"areas-expertise": "Bidang Keahlian",
|
"areas-expertise": "Bidang Keahlian",
|
||||||
"choose-expert": "Pilih Tenaga Ahli",
|
"choose-expert": "Tenaga Ahli",
|
||||||
"code": "Kode",
|
"code": "Kode",
|
||||||
"start-date": "Tanggal Mulai",
|
"start-date": "Tanggal Mulai",
|
||||||
"end-date": "Tanggal Selesai",
|
"end-date": "Tanggal Selesai",
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,9 @@ export async function listDataAdvertisements(
|
||||||
page: number,
|
page: number,
|
||||||
limit: string,
|
limit: string,
|
||||||
search: string,
|
search: string,
|
||||||
categoryFilter: string,
|
|
||||||
statusFilter: string
|
|
||||||
) {
|
) {
|
||||||
const name = search || "";
|
const name = search || "";
|
||||||
const url = `advertisements/pagination?title=${name}&enablePage=1&sortBy=createdAt&sort=desc&size=${limit}&page=${page}&typeId=1&categoryId=${categoryFilter}&statusId=${statusFilter}`;
|
const url = `advertisements/pagination?title=${search}&enablePage=1&sortBy=createdAt&sort=desc&size=${limit}&page=${page}`;
|
||||||
return httpGetInterceptor(url);
|
return httpGetInterceptor(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,17 +20,16 @@ export async function paginationSchedule(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function paginationCalendar(
|
export async function getCalendarPagination(
|
||||||
size: any,
|
size: any,
|
||||||
page: number,
|
page: number,
|
||||||
type: any,
|
|
||||||
title: string = "",
|
title: string = "",
|
||||||
statusFilter: number[] = []
|
statusFilter: number[] = []
|
||||||
) {
|
) {
|
||||||
const statusQuery =
|
const statusQuery =
|
||||||
statusFilter.length > 0 ? `&statusId=${statusFilter.join(",")}` : "";
|
statusFilter.length > 0 ? `&statusId=${statusFilter.join(",")}` : "";
|
||||||
return await httpGetInterceptor(
|
return await httpGetInterceptor(
|
||||||
`calendars/pagination?enablePage=1&scheduleTypeId=${type}&page=${page}&size=${size}&title=${title}${statusQuery}`
|
`calendars/pagination?enablePage=1&page=${page}&size=${size}&title=${title}${statusQuery}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -132,5 +132,8 @@ export async function getTagsByParentId(parentId: string | number) {
|
||||||
|
|
||||||
export async function postAdvertisements(data: any) {
|
export async function postAdvertisements(data: any) {
|
||||||
const url = "advertisements";
|
const url = "advertisements";
|
||||||
return httpPostInterceptor(url, data);
|
const headers = {
|
||||||
|
"Content-Type": "multipart/form-data",
|
||||||
|
};
|
||||||
|
return httpPostInterceptor(url, data, headers);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ export async function listTaskTa(
|
||||||
}
|
}
|
||||||
|
|
||||||
return httpGetInterceptor(
|
return httpGetInterceptor(
|
||||||
`assignment-expert/pagination?enablePage=1&size=${size}&page=${page}&title=${title}&taskType=${taskType}&uniqueCode=${code}&createdAt=${createdAt}${statusQuery}`
|
`assignment-expert/pagination?enablePage=1&size=${size}&page=${page}&title=${title}&assignmentType=${taskType}&uniqueCode=${code}&createdAt=${createdAt}${statusQuery}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue