diff --git a/app/(admin)/admin/article/page.tsx b/app/(admin)/admin/article/page.tsx
index 4fe0fad..f506b81 100644
--- a/app/(admin)/admin/article/page.tsx
+++ b/app/(admin)/admin/article/page.tsx
@@ -11,24 +11,16 @@ export default function BasicPage() {
- {/*
+
- */}
-
+
+
diff --git a/app/(admin)/admin/master-category/page.tsx b/app/(admin)/admin/master-category/page.tsx
index 4f71f99..47cee63 100644
--- a/app/(admin)/admin/master-category/page.tsx
+++ b/app/(admin)/admin/master-category/page.tsx
@@ -124,46 +124,51 @@ export default function MasterCategoryTable() {
};
const onSubmit = async (values: z.infer
) => {
- if (selectedParent) {
- loading();
- const formData = {
- title: values.title,
- statusId: 1,
- parentId: selectedParent ? selectedParent.id : 0,
- tags: values.tags.join(","),
- description: values.description,
- };
+ console.log("values,", values);
+ loading();
+ const formData = {
+ title: values.title,
+ statusId: 1,
+ parentId: selectedParent ? selectedParent.id : 0,
+ tags: values.tags.join(","),
+ description: values.description,
+ };
- const response = await createCategory(formData);
-
- if (response?.error) {
- error(response.message);
- return false;
+ const response = await createCategory(formData);
+ console.log(response);
+ if (response?.error) {
+ console.log();
+ if (
+ response.message?.messages[0]?.includes(
+ "article_categories_title_unique"
+ )
+ ) {
+ error("Judul sudah tersedia, silahkan buat dengan judul berbeda");
+ } else {
+ error(response.message?.messages);
}
- const categoryId = response?.data?.data?.id;
- const formFiles = new FormData();
-
- formFiles.append("files", files[0]);
- const resFile = await uploadCategoryThumbnail(categoryId, formFiles);
- if (resFile?.error) {
- error(resFile.message);
- return false;
- }
- close();
- setRefresh(!refresh);
- MySwal.fire({
- title: "Sukses",
- icon: "success",
- confirmButtonColor: "#3085d6",
- confirmButtonText: "OK",
- }).then((result) => {
- if (result.isConfirmed) {
- }
- });
return false;
}
+ const categoryId = response?.data?.data?.id;
+ const formFiles = new FormData();
- setSelectedParentValidation("Parent harus diisi");
+ formFiles.append("files", files[0]);
+ const resFile = await uploadCategoryThumbnail(categoryId, formFiles);
+ if (resFile?.error) {
+ error(resFile.message);
+ return false;
+ }
+ close();
+ setRefresh(!refresh);
+ MySwal.fire({
+ title: "Sukses",
+ icon: "success",
+ confirmButtonColor: "#3085d6",
+ confirmButtonText: "OK",
+ }).then((result) => {
+ if (result.isConfirmed) {
+ }
+ });
};
const handleRemoveFile = (file: File) => {
@@ -180,7 +185,6 @@ export default function MasterCategoryTable() {
size="md"
className="bg-[#F07C00] text-white w-full lg:w-fit"
onPress={onOpen}
- isDisabled
>
Tambah Kategori
@@ -263,7 +267,9 @@ export default function MasterCategoryTable() {
)}
-
Parent
+
+ Parent Kategori (Optional)
+
a.id).join(","),
+ // categoryIds: "879507",
+ categoryIds: values.category.map((a) => a.id).join(","),
tags: values.tags.join(","),
description: htmlToString(removeImgTags(values.description)),
htmlDescription: removeImgTags(values.description),
diff --git a/components/main/dashboard/dashboard-container.tsx b/components/main/dashboard/dashboard-container.tsx
index e1c6114..cf2c406 100644
--- a/components/main/dashboard/dashboard-container.tsx
+++ b/components/main/dashboard/dashboard-container.tsx
@@ -356,8 +356,7 @@ export default function DashboardContainer() {
Recent Article
-
- {/*
*/}
+
diff --git a/components/table/article-table.tsx b/components/table/article-table.tsx
index 6b7df31..b0829bc 100644
--- a/components/table/article-table.tsx
+++ b/components/table/article-table.tsx
@@ -328,7 +328,7 @@ export default function ArticleTable() {
-
+
copyUrlArticle(article.id, article.slug)}
diff --git a/components/table/master-categories/categories-table.tsx b/components/table/master-categories/categories-table.tsx
index 3c10406..06923fe 100644
--- a/components/table/master-categories/categories-table.tsx
+++ b/components/table/master-categories/categories-table.tsx
@@ -285,7 +285,7 @@ export default function CategoriesTable(props: { triggerRefresh: boolean }) {
-
+
openModal(category.id, true)}