pull main
This commit is contained in:
parent
9345345e02
commit
0f9c070af1
|
|
@ -255,15 +255,15 @@ export default function FormImageDetail() {
|
|||
setSelectedPublishers(publisherIds);
|
||||
}
|
||||
|
||||
const matchingCategory = categories.find(
|
||||
(category) => category.id === details.categoryId
|
||||
);
|
||||
// const matchingCategory = categories.find(
|
||||
// (category) => category.id === details.categoryId
|
||||
// );
|
||||
|
||||
if (matchingCategory) {
|
||||
setSelectedTarget(matchingCategory.name);
|
||||
}
|
||||
// if (matchingCategory) {
|
||||
// setSelectedTarget(matchingCategory.name);
|
||||
// }
|
||||
|
||||
setSelectedTarget(details.categoryId); // Untuk dropdown
|
||||
// setSelectedTarget(details.categoryId);
|
||||
|
||||
const filesData = details.files || [];
|
||||
const fileUrls = filesData.map((file: { thumbnailFileUrl: string }) =>
|
||||
|
|
@ -488,19 +488,21 @@ export default function FormImageDetail() {
|
|||
<div className="flex items-center">
|
||||
<div className="py-3 w-full space-y-2">
|
||||
<Label>{t("category")}</Label>
|
||||
|
||||
<Select
|
||||
value={detail?.category.name} // Nilai default berdasarkan detail
|
||||
onValueChange={(id) => {
|
||||
console.log("Selected Category:", id);
|
||||
setSelectedTarget(id);
|
||||
}}
|
||||
disabled
|
||||
defaultValue={String(detail?.category.id)}
|
||||
// onValueChange={(id) => {
|
||||
// console.log("Selected Category:", id);
|
||||
// setSelectedTarget(id);
|
||||
// }}
|
||||
>
|
||||
<SelectTrigger size="md">
|
||||
<SelectValue placeholder="Pilih" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{categories.map((category) => (
|
||||
<SelectItem key={category.id} value={category.name}>
|
||||
<SelectItem key={String(category.id)} value={String(category.id)}>
|
||||
{category.name}
|
||||
</SelectItem>
|
||||
))}
|
||||
|
|
|
|||
|
|
@ -390,16 +390,16 @@ export default function FormImage() {
|
|||
e.preventDefault();
|
||||
const newTag = e.currentTarget.value.trim();
|
||||
if (!tags.includes(newTag)) {
|
||||
setTags((prevTags) => [...prevTags, newTag]); // Add new tag
|
||||
setTags((prevTags) => [...prevTags, newTag]);
|
||||
if (inputRef.current) {
|
||||
inputRef.current.value = ""; // Clear input field
|
||||
inputRef.current.value = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const handleRemoveTag = (index: number) => {
|
||||
setTags((prevTags) => prevTags.filter((_, i) => i !== index)); // Remove tag
|
||||
setTags((prevTags) => prevTags.filter((_, i) => i !== index));
|
||||
};
|
||||
|
||||
const handleRemoveImage = (index: number) => {
|
||||
|
|
@ -431,7 +431,7 @@ export default function FormImage() {
|
|||
|
||||
if (findCategory) {
|
||||
// setValue("categoryId", findCategory.id);
|
||||
setSelectedCategory(findCategory.id); // Set the selected category
|
||||
setSelectedCategory(findCategory.id);
|
||||
const response = await getTagsBySubCategoryId(findCategory.id);
|
||||
setTags(response?.data?.data);
|
||||
}
|
||||
|
|
@ -444,10 +444,8 @@ export default function FormImage() {
|
|||
const handleCheckboxChange = (id: string): void => {
|
||||
if (id === "all") {
|
||||
if (publishedFor.includes("all")) {
|
||||
// Uncheck all checkboxes
|
||||
setPublishedFor([]);
|
||||
} else {
|
||||
// Select all checkboxes
|
||||
setPublishedFor(
|
||||
options
|
||||
.filter((opt: any) => opt.id !== "all")
|
||||
|
|
@ -458,8 +456,6 @@ export default function FormImage() {
|
|||
const updatedPublishedFor = publishedFor.includes(id)
|
||||
? publishedFor.filter((item) => item !== id)
|
||||
: [...publishedFor, id];
|
||||
|
||||
// Remove "all" if any checkbox is unchecked
|
||||
if (publishedFor.includes("all") && id !== "all") {
|
||||
setPublishedFor(updatedPublishedFor.filter((item) => item !== "all"));
|
||||
} else {
|
||||
|
|
@ -526,7 +522,7 @@ export default function FormImage() {
|
|||
let id = Cookies.get("idCreate");
|
||||
|
||||
if (scheduleId !== undefined) {
|
||||
requestData.attachFromScheduleId = Number(scheduleId); // ✅ Tambahkan nilai ini
|
||||
requestData.attachFromScheduleId = Number(scheduleId);
|
||||
}
|
||||
|
||||
if (id == undefined) {
|
||||
|
|
@ -535,8 +531,6 @@ export default function FormImage() {
|
|||
|
||||
Cookies.set("idCreate", response?.data?.data, { expires: 1 });
|
||||
id = response?.data?.data;
|
||||
|
||||
// Upload Thumbnail
|
||||
const formMedia = new FormData();
|
||||
const thumbnail = files[0];
|
||||
formMedia.append("file", thumbnail);
|
||||
|
|
@ -546,8 +540,6 @@ export default function FormImage() {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Upload File
|
||||
const progressInfoArr = files.map((item) => ({
|
||||
percentage: 0,
|
||||
fileName: item.name,
|
||||
|
|
@ -613,7 +605,7 @@ export default function FormImage() {
|
|||
filename: file.name,
|
||||
filetype: file.type,
|
||||
duration,
|
||||
isWatermark: "true", // hardcode
|
||||
isWatermark: "true",
|
||||
},
|
||||
onBeforeRequest: function (req) {
|
||||
var xhr = req.getUnderlyingObject();
|
||||
|
|
@ -744,7 +736,6 @@ export default function FormImage() {
|
|||
};
|
||||
|
||||
useEffect(() => {
|
||||
// Jika input title kosong, isi dengan hasil generate title
|
||||
if (!getValues("title") && title) {
|
||||
setValue("title", title);
|
||||
}
|
||||
|
|
@ -758,7 +749,7 @@ export default function FormImage() {
|
|||
lang: "id",
|
||||
contextType: "text",
|
||||
urlContext: null,
|
||||
context: editorContent, // Ambil isi editor original
|
||||
context: editorContent,
|
||||
createdBy: roleId,
|
||||
sentiment: "Humorous",
|
||||
clientId: "7QTW8cMojyayt6qnhqTOeJaBI70W4EaQ",
|
||||
|
|
@ -821,7 +812,7 @@ export default function FormImage() {
|
|||
<div className="py-3 space-y-2 w-full">
|
||||
<Label>{t("category")}</Label>
|
||||
<Select
|
||||
value={selectedCategory} // Ensure selectedTarget is updated correctly
|
||||
value={selectedCategory}
|
||||
onValueChange={(id) => {
|
||||
console.log("Selected Category ID:", id);
|
||||
setSelectedCategory(id);
|
||||
|
|
|
|||
|
|
@ -654,8 +654,6 @@ export default function FormImageUpdate() {
|
|||
error(response.message);
|
||||
return;
|
||||
}
|
||||
|
||||
// Jika berhasil, hapus file dari state lokal
|
||||
setFiles((prevFiles: any) =>
|
||||
prevFiles.filter((file: any) => file.id !== id)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -503,7 +503,7 @@ export default function FormVideoDetail() {
|
|||
className="object-fill h-full w-full"
|
||||
src={data.secondaryUrl}
|
||||
controls
|
||||
title={`Video ${data.id}`} // Mengganti alt dengan title
|
||||
title={`Video ${data.id}`}
|
||||
/>
|
||||
</SwiperSlide>
|
||||
))}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,22 @@
|
|||
import search from "@/app/[locale]/(protected)/app/chat/components/search";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
import { useParams } from "next/navigation";
|
||||
import router from "next/router";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Icon } from "@iconify/react/dist/iconify.js";
|
||||
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "../ui/select";
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectGroup,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "../ui/select";
|
||||
import Image from "next/image";
|
||||
import { getHeroData } from "@/service/landing/landing";
|
||||
import { title } from "process";
|
||||
import { htmlToString } from "@/utils/globals";
|
||||
import { Link } from "@/i18n/routing";
|
||||
import { Link, useRouter } from "@/i18n/routing";
|
||||
|
||||
const ScrollableContentPolda = () => {
|
||||
const [contentType, setContentType] = useState("all");
|
||||
|
|
@ -20,6 +27,14 @@ const ScrollableContentPolda = () => {
|
|||
const t = useTranslations("LandingPage");
|
||||
const poldaName: any = params?.polda_name;
|
||||
const [content, setContent] = useState<any>();
|
||||
const satkerName = params?.satker_name;
|
||||
|
||||
let prefixPath = poldaName
|
||||
? `/polda/${poldaName}`
|
||||
: satkerName
|
||||
? `/satker/${satkerName}`
|
||||
: "";
|
||||
|
||||
useEffect(() => {
|
||||
async function fetchCategories() {
|
||||
const url = "https://netidhub.com/api/csrf";
|
||||
|
|
@ -71,7 +86,14 @@ const ScrollableContentPolda = () => {
|
|||
<Select value={contentType} onValueChange={setContentType}>
|
||||
<SelectTrigger className="w-[180px] h-[55px]">
|
||||
<span className="text-black">
|
||||
<svg className="mx-2 dark:" width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg
|
||||
className="mx-2 dark:"
|
||||
width="25"
|
||||
height="24"
|
||||
viewBox="0 0 25 24"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M20 7.5H5C4.6023 7.5004 4.221 7.65856 3.93978 7.93978C3.65856 8.221 3.5004 8.6023 3.5 9V19.5C3.5004 19.8977 3.65856 20.279 3.93978 20.5602C4.221 20.8414 4.6023 20.9996 5 21H20C20.3977 20.9996 20.779 20.8414 21.0602 20.5602C21.3414 20.279 21.4996 19.8977 21.5 19.5V9C21.4996 8.6023 21.3414 8.221 21.0602 7.93978C20.779 7.65856 20.3977 7.5004 20 7.5ZM10.25 17.25V11.25L15.5 14.25L10.25 17.25ZM5 4.5H20V6H5V4.5ZM6.5 1.5H18.5V3H6.5V1.5Z"
|
||||
fill="currentColor"
|
||||
|
|
@ -92,17 +114,32 @@ const ScrollableContentPolda = () => {
|
|||
</Select>
|
||||
<div className="flex items-center flex-1 border border-gray-300 rounded-lg overflow-hidden">
|
||||
<span className="material-icons text-black dark:text-white px-4">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="1em"
|
||||
height="1em"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="m19.6 21l-6.3-6.3q-.75.6-1.725.95T9.5 16q-2.725 0-4.612-1.888T3 9.5t1.888-4.612T9.5 3t4.613 1.888T16 9.5q0 1.1-.35 2.075T14.7 13.3l6.3 6.3zM9.5 14q1.875 0 3.188-1.312T14 9.5t-1.312-3.187T9.5 5T6.313 6.313T5 9.5t1.313 3.188T9.5 14"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
<input type="text" placeholder={t("searchCoverageHere")} className="w-full py-4 px-2 text-sm text-gray-700 dark:text-gray-100 focus:outline-none" onChange={(e) => setSearch(e.target.value)} />
|
||||
<input
|
||||
type="text"
|
||||
placeholder={t("searchCoverageHere")}
|
||||
className="w-full py-4 px-2 text-sm text-gray-700 dark:text-gray-100 focus:outline-none"
|
||||
onChange={(e) => setSearch(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<button onClick={() => router.push(`/${contentType}/filter?title=${search}`)} className="flex justify-center items-center px-6 w-full lg:w-[20%] py-4 bg-[#bb3523] gap-2 text-white rounded-lg hover:bg-red-700">
|
||||
<button
|
||||
onClick={() =>
|
||||
router.push(prefixPath + `/${contentType}/filter?title=${search}`)
|
||||
}
|
||||
className="flex justify-center items-center px-6 w-full lg:w-[20%] py-4 bg-[#bb3523] gap-2 text-white rounded-lg hover:bg-red-700"
|
||||
>
|
||||
{t("searchCoverage")}
|
||||
<Icon icon="ri:arrow-right-s-line" fontSize={20} />
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import search from "@/app/[locale]/(protected)/app/chat/components/search";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
import { useParams } from "next/navigation";
|
||||
import router from "next/router";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Icon } from "@iconify/react/dist/iconify.js";
|
||||
|
|
@ -16,7 +16,7 @@ import Image from "next/image";
|
|||
import { getHeroData } from "@/service/landing/landing";
|
||||
import { title } from "process";
|
||||
import { htmlToString } from "@/utils/globals";
|
||||
import { Link } from "@/i18n/routing";
|
||||
import { Link, useRouter } from "@/i18n/routing";
|
||||
|
||||
const ScrollableContentSatker = () => {
|
||||
const [contentType, setContentType] = useState("all");
|
||||
|
|
@ -27,6 +27,13 @@ const ScrollableContentSatker = () => {
|
|||
const t = useTranslations("LandingPage");
|
||||
const satkerName: any = params?.satker_name;
|
||||
const [content, setContent] = useState<any>();
|
||||
const poldaName: any = params?.polda_name;
|
||||
|
||||
let prefixPath = poldaName
|
||||
? `/polda/${poldaName}`
|
||||
: satkerName
|
||||
? `/satker/${satkerName}`
|
||||
: "";
|
||||
useEffect(() => {
|
||||
async function fetchCategories() {
|
||||
const url = "https://netidhub.com/api/csrf";
|
||||
|
|
@ -128,7 +135,7 @@ const ScrollableContentSatker = () => {
|
|||
</div>
|
||||
<button
|
||||
onClick={() =>
|
||||
router.push(`/${contentType}/filter?title=${search}`)
|
||||
router.push(prefixPath + `/${contentType}/filter?title=${search}`)
|
||||
}
|
||||
className="flex justify-center items-center px-6 w-full lg:w-[20%] py-4 bg-[#bb3523] gap-2 text-white rounded-lg hover:bg-red-700"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import search from "@/app/[locale]/(protected)/app/chat/components/search";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
import { useParams } from "next/navigation";
|
||||
import router from "next/router";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Icon } from "@iconify/react/dist/iconify.js";
|
||||
|
|
@ -16,7 +16,7 @@ import Image from "next/image";
|
|||
import { getHeroData } from "@/service/landing/landing";
|
||||
import { title } from "process";
|
||||
import { htmlToString } from "@/utils/globals";
|
||||
import { Link } from "@/i18n/routing";
|
||||
import { Link, useRouter } from "@/i18n/routing";
|
||||
import { Button } from "../ui/button";
|
||||
|
||||
const ScrollableContent = () => {
|
||||
|
|
@ -150,7 +150,7 @@ const ScrollableContent = () => {
|
|||
</div>
|
||||
<button
|
||||
onClick={() =>
|
||||
router.push(`/${contentType}/filter?title=${search}`)
|
||||
router.push( prefixPath + `/${contentType}/filter?title=${search}`)
|
||||
}
|
||||
className="flex justify-center items-center px-6 w-full lg:w-[20%] py-4 bg-[#bb3523] gap-2 text-white rounded-lg hover:bg-red-700 text-[14px]"
|
||||
>
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue