fix conflict
This commit is contained in:
commit
b8827ba8a8
|
|
@ -108,7 +108,7 @@ const ReportTable = () => {
|
||||||
const [previewData, setPreviewData] = React.useState<any>(null);
|
const [previewData, setPreviewData] = React.useState<any>(null);
|
||||||
|
|
||||||
const handlePreview = (id: string) => {
|
const handlePreview = (id: string) => {
|
||||||
const url = `https://netidhub.com/api/media/report/view?id=${id}`;
|
const url = `https://new.netidhub.com/api/media/report/view?id=${id}`;
|
||||||
setPreviewData({ url });
|
setPreviewData({ url });
|
||||||
setOpenPreview(true);
|
setOpenPreview(true);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -290,15 +290,8 @@ export default function FormAudioDetail() {
|
||||||
setSelectedPublishers(publisherIds);
|
setSelectedPublishers(publisherIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
const matchingCategory = categories.find(
|
// Set the selected target to the category ID from details
|
||||||
(category) => category.id === details.categoryId
|
setSelectedTarget(String(details.category.id));
|
||||||
);
|
|
||||||
|
|
||||||
if (matchingCategory) {
|
|
||||||
setSelectedTarget(matchingCategory.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
setSelectedTarget(details?.categoryId);
|
|
||||||
|
|
||||||
const filesData = details?.files || [];
|
const filesData = details?.files || [];
|
||||||
const audioFiles = filesData.filter(
|
const audioFiles = filesData.filter(
|
||||||
|
|
@ -518,18 +511,28 @@ export default function FormAudioDetail() {
|
||||||
<div className="py-3 w-full space-y-2">
|
<div className="py-3 w-full space-y-2">
|
||||||
<Label>{t("category", { defaultValue: "Category" })}</Label>
|
<Label>{t("category", { defaultValue: "Category" })}</Label>
|
||||||
<Select
|
<Select
|
||||||
value={detail?.category.name}
|
disabled
|
||||||
onValueChange={(id) => {
|
value={String(detail?.category?.id)}
|
||||||
console.log("Selected Category:", id);
|
// onValueChange={(id) => {
|
||||||
setSelectedTarget(id);
|
// console.log("Selected Category:", id);
|
||||||
}}
|
// setSelectedTarget(id);
|
||||||
|
// }}
|
||||||
>
|
>
|
||||||
<SelectTrigger size="md">
|
<SelectTrigger size="md">
|
||||||
<SelectValue placeholder="Pilih" />
|
<SelectValue placeholder="Pilih" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
|
{/* Show the category from details if it doesn't exist in categories list */}
|
||||||
|
{detail && !categories.find(cat => String(cat.id) === String(detail.category.id)) && (
|
||||||
|
<SelectItem
|
||||||
|
key={String(detail.category.id)}
|
||||||
|
value={String(detail.category.id)}
|
||||||
|
>
|
||||||
|
{detail.category.name}
|
||||||
|
</SelectItem>
|
||||||
|
)}
|
||||||
{categories.map((category) => (
|
{categories.map((category) => (
|
||||||
<SelectItem key={category.id} value={category.name}>
|
<SelectItem key={String(category.id)} value={String(category.id)}>
|
||||||
{category.name}
|
{category.name}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,8 @@ type Detail = {
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
slug: string;
|
slug: string;
|
||||||
categoryId: {
|
categoryId: number;
|
||||||
|
category: {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
};
|
};
|
||||||
|
|
@ -704,6 +705,15 @@ export default function FormAudioUpdate() {
|
||||||
<SelectValue placeholder="Pilih" />
|
<SelectValue placeholder="Pilih" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
|
{/* Show the category from details if it doesn't exist in categories list */}
|
||||||
|
{detail && !categories.find(cat => String(cat.id) === String(detail.category.id)) && (
|
||||||
|
<SelectItem
|
||||||
|
key={String(detail.category.id)}
|
||||||
|
value={String(detail.category.id)}
|
||||||
|
>
|
||||||
|
{detail.category.name}
|
||||||
|
</SelectItem>
|
||||||
|
)}
|
||||||
{categories.map((category) => (
|
{categories.map((category) => (
|
||||||
<SelectItem
|
<SelectItem
|
||||||
key={String(category.id)}
|
key={String(category.id)}
|
||||||
|
|
|
||||||
|
|
@ -255,15 +255,8 @@ export default function FormImageDetail() {
|
||||||
setSelectedPublishers(publisherIds);
|
setSelectedPublishers(publisherIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
// const matchingCategory = categories.find(
|
// Set the selected target to the category ID from details
|
||||||
// (category) => category.id === details.categoryId
|
setSelectedTarget(String(details.category.id));
|
||||||
// );
|
|
||||||
|
|
||||||
// if (matchingCategory) {
|
|
||||||
// setSelectedTarget(matchingCategory.name);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// setSelectedTarget(details.categoryId);
|
|
||||||
|
|
||||||
const filesData = details.files || [];
|
const filesData = details.files || [];
|
||||||
const fileUrls = filesData.map((file: { thumbnailFileUrl: string }) =>
|
const fileUrls = filesData.map((file: { thumbnailFileUrl: string }) =>
|
||||||
|
|
@ -491,7 +484,7 @@ export default function FormImageDetail() {
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
disabled
|
disabled
|
||||||
defaultValue={String(detail?.category.id)}
|
value={String(detail?.category?.id)}
|
||||||
// onValueChange={(id) => {
|
// onValueChange={(id) => {
|
||||||
// console.log("Selected Category:", id);
|
// console.log("Selected Category:", id);
|
||||||
// setSelectedTarget(id);
|
// setSelectedTarget(id);
|
||||||
|
|
@ -501,6 +494,15 @@ export default function FormImageDetail() {
|
||||||
<SelectValue placeholder="Pilih" />
|
<SelectValue placeholder="Pilih" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
|
{/* Show the category from details if it doesn't exist in categories list */}
|
||||||
|
{detail && !categories.find(cat => String(cat.id) === String(detail.category.id)) && (
|
||||||
|
<SelectItem
|
||||||
|
key={String(detail.category.id)}
|
||||||
|
value={String(detail.category.id)}
|
||||||
|
>
|
||||||
|
{detail.category.name}
|
||||||
|
</SelectItem>
|
||||||
|
)}
|
||||||
{categories.map((category) => (
|
{categories.map((category) => (
|
||||||
<SelectItem key={String(category.id)} value={String(category.id)}>
|
<SelectItem key={String(category.id)} value={String(category.id)}>
|
||||||
{category.name}
|
{category.name}
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@ type Detail = {
|
||||||
description: string;
|
description: string;
|
||||||
htmldescription: string;
|
htmldescription: string;
|
||||||
slug: string;
|
slug: string;
|
||||||
|
categoryId: number;
|
||||||
category: {
|
category: {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
|
@ -267,6 +268,8 @@ export default function FormImageUpdate() {
|
||||||
const details = response?.data?.data;
|
const details = response?.data?.data;
|
||||||
|
|
||||||
setDetail(details);
|
setDetail(details);
|
||||||
|
|
||||||
|
// Set the selected target to the category ID from details
|
||||||
setSelectedTarget(String(details.category.id));
|
setSelectedTarget(String(details.category.id));
|
||||||
|
|
||||||
// Set form values immediately and then again after a delay to ensure editor is ready
|
// Set form values immediately and then again after a delay to ensure editor is ready
|
||||||
|
|
@ -301,16 +304,6 @@ export default function FormImageUpdate() {
|
||||||
if (details?.tags) {
|
if (details?.tags) {
|
||||||
setTags(details.tags.split(",").map((tag: string) => tag.trim()));
|
setTags(details.tags.split(",").map((tag: string) => tag.trim()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// const matchingCategory = categories.find(
|
|
||||||
// (category) => category.id === details.categoryId
|
|
||||||
// );
|
|
||||||
|
|
||||||
// if (matchingCategory) {
|
|
||||||
// setSelectedTarget(matchingCategory.name);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// setSelectedTarget(details.categoryId); // Untuk dropdown
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
initState();
|
initState();
|
||||||
|
|
@ -716,6 +709,15 @@ export default function FormImageUpdate() {
|
||||||
<SelectValue placeholder="Pilih" />
|
<SelectValue placeholder="Pilih" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
|
{/* Show the category from details if it doesn't exist in categories list */}
|
||||||
|
{detail && !categories.find(cat => String(cat.id) === String(detail.category.id)) && (
|
||||||
|
<SelectItem
|
||||||
|
key={String(detail.category.id)}
|
||||||
|
value={String(detail.category.id)}
|
||||||
|
>
|
||||||
|
{detail.category.name}
|
||||||
|
</SelectItem>
|
||||||
|
)}
|
||||||
{categories.map((category) => (
|
{categories.map((category) => (
|
||||||
<SelectItem
|
<SelectItem
|
||||||
key={String(category.id)}
|
key={String(category.id)}
|
||||||
|
|
|
||||||
|
|
@ -255,15 +255,8 @@ export default function FormTeksDetail() {
|
||||||
setSelectedPublishers(publisherIds);
|
setSelectedPublishers(publisherIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
const matchingCategory = categories.find(
|
// Set the selected target to the category ID from details
|
||||||
(category) => category.id === details.categoryId
|
setSelectedTarget(String(details.category.id));
|
||||||
);
|
|
||||||
|
|
||||||
if (matchingCategory) {
|
|
||||||
setSelectedTarget(matchingCategory.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
setSelectedTarget(details.categoryId); // Untuk dropdown
|
|
||||||
|
|
||||||
const filesData = details.files || [];
|
const filesData = details.files || [];
|
||||||
const fileUrls = filesData.map((file: any) => ({
|
const fileUrls = filesData.map((file: any) => ({
|
||||||
|
|
@ -467,18 +460,28 @@ export default function FormTeksDetail() {
|
||||||
<div className="py-3 w-full space-y-2">
|
<div className="py-3 w-full space-y-2">
|
||||||
<Label>{t("category", { defaultValue: "Category" })}</Label>
|
<Label>{t("category", { defaultValue: "Category" })}</Label>
|
||||||
<Select
|
<Select
|
||||||
value={detail?.category.name} // Nilai default berdasarkan detail
|
disabled
|
||||||
onValueChange={(id) => {
|
value={String(detail?.category?.id)}
|
||||||
console.log("Selected Category:", id);
|
// onValueChange={(id) => {
|
||||||
setSelectedTarget(id);
|
// console.log("Selected Category:", id);
|
||||||
}}
|
// setSelectedTarget(id);
|
||||||
|
// }}
|
||||||
>
|
>
|
||||||
<SelectTrigger size="md">
|
<SelectTrigger size="md">
|
||||||
<SelectValue placeholder="Pilih" />
|
<SelectValue placeholder="Pilih" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
|
{/* Show the category from details if it doesn't exist in categories list */}
|
||||||
|
{detail && !categories.find(cat => String(cat.id) === String(detail.category.id)) && (
|
||||||
|
<SelectItem
|
||||||
|
key={String(detail.category.id)}
|
||||||
|
value={String(detail.category.id)}
|
||||||
|
>
|
||||||
|
{detail.category.name}
|
||||||
|
</SelectItem>
|
||||||
|
)}
|
||||||
{categories.map((category) => (
|
{categories.map((category) => (
|
||||||
<SelectItem key={category.id} value={category.name}>
|
<SelectItem key={String(category.id)} value={String(category.id)}>
|
||||||
{category.name}
|
{category.name}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,8 @@ type Detail = {
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
slug: string;
|
slug: string;
|
||||||
categoryId: {
|
categoryId: number;
|
||||||
|
category: {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
};
|
};
|
||||||
|
|
@ -660,6 +661,15 @@ export default function FormTeksUpdate() {
|
||||||
<SelectValue placeholder="Pilih" />
|
<SelectValue placeholder="Pilih" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
|
{/* Show the category from details if it doesn't exist in categories list */}
|
||||||
|
{detail && !categories.find(cat => String(cat.id) === String(detail.category.id)) && (
|
||||||
|
<SelectItem
|
||||||
|
key={String(detail.category.id)}
|
||||||
|
value={String(detail.category.id)}
|
||||||
|
>
|
||||||
|
{detail.category.name}
|
||||||
|
</SelectItem>
|
||||||
|
)}
|
||||||
{categories.map((category) => (
|
{categories.map((category) => (
|
||||||
<SelectItem
|
<SelectItem
|
||||||
key={String(category.id)}
|
key={String(category.id)}
|
||||||
|
|
|
||||||
|
|
@ -244,15 +244,8 @@ export default function FormVideoDetail() {
|
||||||
setSelectedPublishers(publisherIds);
|
setSelectedPublishers(publisherIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
const matchingCategory = categories.find(
|
// Set the selected target to the category ID from details
|
||||||
(category) => category.id === details.categoryId
|
setSelectedTarget(String(details.category.id));
|
||||||
);
|
|
||||||
|
|
||||||
if (matchingCategory) {
|
|
||||||
setSelectedTarget(matchingCategory.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
setSelectedTarget(details?.categoryId);
|
|
||||||
|
|
||||||
const filesData = details?.files || [];
|
const filesData = details?.files || [];
|
||||||
const fileUrls = filesData.map((files: { url: string }) =>
|
const fileUrls = filesData.map((files: { url: string }) =>
|
||||||
|
|
@ -453,18 +446,28 @@ export default function FormVideoDetail() {
|
||||||
<div className="py-3 w-full space-y-2">
|
<div className="py-3 w-full space-y-2">
|
||||||
<Label>{t("category", { defaultValue: "Category" })}</Label>
|
<Label>{t("category", { defaultValue: "Category" })}</Label>
|
||||||
<Select
|
<Select
|
||||||
value={detail?.category.name}
|
disabled
|
||||||
onValueChange={(id) => {
|
value={String(detail?.category?.id)}
|
||||||
console.log("Selected Category:", id);
|
// onValueChange={(id) => {
|
||||||
setSelectedTarget(id);
|
// console.log("Selected Category:", id);
|
||||||
}}
|
// setSelectedTarget(id);
|
||||||
|
// }}
|
||||||
>
|
>
|
||||||
<SelectTrigger size="md">
|
<SelectTrigger size="md">
|
||||||
<SelectValue placeholder="Pilih" />
|
<SelectValue placeholder="Pilih" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
|
{/* Show the category from details if it doesn't exist in categories list */}
|
||||||
|
{detail && !categories.find(cat => String(cat.id) === String(detail.category.id)) && (
|
||||||
|
<SelectItem
|
||||||
|
key={String(detail.category.id)}
|
||||||
|
value={String(detail.category.id)}
|
||||||
|
>
|
||||||
|
{detail.category.name}
|
||||||
|
</SelectItem>
|
||||||
|
)}
|
||||||
{categories.map((category) => (
|
{categories.map((category) => (
|
||||||
<SelectItem key={category.id} value={category.name}>
|
<SelectItem key={String(category.id)} value={String(category.id)}>
|
||||||
{category.name}
|
{category.name}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,8 @@ type Detail = {
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
slug: string;
|
slug: string;
|
||||||
categoryId: {
|
categoryId: number;
|
||||||
|
category: {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
};
|
};
|
||||||
|
|
@ -765,6 +766,15 @@ export default function FormVideoUpdate() {
|
||||||
<SelectValue placeholder="Pilih" />
|
<SelectValue placeholder="Pilih" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
|
{/* Show the category from details if it doesn't exist in categories list */}
|
||||||
|
{detail && !categories.find(cat => String(cat.id) === String(detail.category.id)) && (
|
||||||
|
<SelectItem
|
||||||
|
key={String(detail.category.id)}
|
||||||
|
value={String(detail.category.id)}
|
||||||
|
>
|
||||||
|
{detail.category.name}
|
||||||
|
</SelectItem>
|
||||||
|
)}
|
||||||
{categories.map((category) => (
|
{categories.map((category) => (
|
||||||
<SelectItem
|
<SelectItem
|
||||||
key={String(category.id)}
|
key={String(category.id)}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue