eleven-solutions-common-website-unique-web 16.0.7 → 16.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -257,65 +257,18 @@ const TaxonomyForm = ({ url }) => {
|
|
257
257
|
const filteredTaxonomies = response.filter((taxonomy) => taxonomy.type === type);
|
258
258
|
setSimilarTaxonomies(filteredTaxonomies);
|
259
259
|
});
|
260
|
-
// const handleSaveClick = async () => {
|
261
|
-
// if (tempTaxonomy.length === 0) {
|
262
|
-
// alert("No taxonomies to add.");
|
263
|
-
// return;
|
264
|
-
// }
|
265
|
-
// try {
|
266
|
-
// await addMultipleTaxonomiesApi(url, tempTaxonomy);
|
267
|
-
// setTempTaxonomy([]);
|
268
|
-
// alert("Multiple taxonomies added successfully");
|
269
|
-
// const response = await fetchTaxonomiessApi(url);
|
270
|
-
// const filteredTaxonomies = (response as { type: string }[]).filter(
|
271
|
-
// (taxonomy: { type: string }) => taxonomy.type === inputType
|
272
|
-
// );
|
273
|
-
// setSimilarTaxonomies(filteredTaxonomies);
|
274
|
-
// } catch (error) {
|
275
|
-
// console.error("Error adding multiple taxonomies:", error);
|
276
|
-
// alert("Failed to add multiple taxonomies");
|
277
|
-
// }
|
278
|
-
// };
|
279
|
-
// const handleSaveClick = async () => {
|
280
|
-
// if (tempTaxonomy.length === 0) {
|
281
|
-
// alert("No taxonomies to add.");
|
282
|
-
// return;
|
283
|
-
// }
|
284
|
-
// try {
|
285
|
-
// console.log("Adding taxonomies:", tempTaxonomy);
|
286
|
-
// await addMultipleTaxonomiesApi(url, tempTaxonomy);
|
287
|
-
// alert("Multiple taxonomies added successfully");
|
288
|
-
// // Fetch all taxonomies after saving
|
289
|
-
// const response = await fetchTaxonomiessApi(url);
|
290
|
-
// console.log("Fetched all taxonomies after save:", response);
|
291
|
-
// // Update state with all taxonomies
|
292
|
-
// setSimilarTaxonomies(response as { type: string }[]);
|
293
|
-
// // Clear tempTaxonomy after successful update
|
294
|
-
// setTempTaxonomy([]);
|
295
|
-
// } catch (error) {
|
296
|
-
// console.error("Error adding multiple taxonomies:", error);
|
297
|
-
// alert("Failed to add multiple taxonomies");
|
298
|
-
// }
|
299
|
-
// };
|
300
260
|
const handleSaveClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
301
261
|
if (tempTaxonomy.length === 0) {
|
302
262
|
alert("No taxonomies to add.");
|
303
263
|
return;
|
304
264
|
}
|
305
265
|
try {
|
306
|
-
console.log("Adding taxonomies:", tempTaxonomy);
|
307
|
-
// Add multiple taxonomies via the API
|
308
266
|
yield addMultipleTaxonomiesApi(url, tempTaxonomy);
|
267
|
+
setTempTaxonomy([]);
|
309
268
|
alert("Multiple taxonomies added successfully");
|
310
|
-
// Fetch only similar taxonomies (filter by type)
|
311
269
|
const response = yield fetchTaxonomiessApi(url);
|
312
|
-
|
313
|
-
const filteredTaxonomies = response.filter((taxonomy) => taxonomy.type === inputType // Filter by the required type
|
314
|
-
);
|
315
|
-
// Update state with similar taxonomies
|
270
|
+
const filteredTaxonomies = response.filter((taxonomy) => taxonomy.type === inputType);
|
316
271
|
setSimilarTaxonomies(filteredTaxonomies);
|
317
|
-
// Clear tempTaxonomy after successful update
|
318
|
-
setTempTaxonomy([]);
|
319
272
|
}
|
320
273
|
catch (error) {
|
321
274
|
console.error("Error adding multiple taxonomies:", error);
|
@@ -336,7 +289,7 @@ const TaxonomyForm = ({ url }) => {
|
|
336
289
|
// isEditMode && isMultiple ? "w-full" : "max-w-4xl"
|
337
290
|
isEditMode ? "w-full" : "max-w-4xl"} p-6 mx-auto dark:bg-gray-800`, children: [_jsxs("div", { className: `transition duration-300 ${isModalOpen ? "filter blur-sm" : ""}`, children: [_jsx("h1", { className: "text-3xl font-bold text-center text-blue-600 capitalize dark:text-white mb-4", children: isEditMode ? "Edit Taxonomy" : "Add Taxonomy" }), _jsx("h1", { className: "text-2xl text-blue-600 capitalize dark:text-white mb-4", children: isEditMode ? `Taxonomy Type: ${type}` : "" }), isSimilarTaxonomyOpen && isEditMode && (_jsxs("div", { className: "flex-grow ml-0 mt-4 w-full", children: [_jsx("div", { className: "overflow-hidden border border-gray-200 dark:border-gray-700 md:rounded-lg mt-6", children: _jsxs("table", { className: "min-w-full divide-y divide-gray-200 dark:divide-gray-700", children: [_jsx("thead", { className: "bg-gray-50 dark:bg-gray-800", children: _jsxs("tr", { children: [_jsx("th", { scope: "col", className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", style: { width: "200px" }, children: "Actions" }), _jsx("th", { className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: "Code" }), _jsx("th", { className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: "Value" })] }) }), _jsx("tbody", { className: "divide-y divide-gray-200", children: similarTaxonomies.map((taxonomy, index) => {
|
338
291
|
const hasChildren = allTaxonomies.some((item) => item.parentId === taxonomy.id);
|
339
|
-
return (_jsxs(React.Fragment, { children: [_jsxs("tr", { children: [_jsx("td", { className: "px-4 py-4 text-sm whitespace-nowrap", children: taxonomy.isEdit && (_jsxs("div", { className: "flex items-center gap-x-6", children: [_jsx("button", { type: "button", onClick: () => handleDeleteClick(taxonomy.id), className: "text-gray-500 transition-colors duration-200 dark:hover:text-red-600 dark:text-gray-300 hover:text-red-500 focus:outline-none", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" }) }) }), _jsx("button", { type: "button", onClick: () => handleEditClick(index, taxonomy.id), className: "text-gray-500 transition-colors duration-200 dark:hover:text-yellow-500 dark:text-gray-300 hover:text-yellow-500 focus:outline-none", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10" }) }) }), _jsx("button", { type: "button", onClick: () => handleAddSubType(index, taxonomy.id), className: "text-gray-500 transition-colors duration-200 dark:hover:text-blue-500 dark:text-gray-300 hover:text-blue-500 focus:outline-none", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4.5v15m7.5-7.5h-15" }) }) })] })) }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-400", children: taxonomy.code }), _jsx("td", { className: "px-4 py-4 text-sm font-medium text-gray-900 dark:text-white", children: _jsxs("div", { className: "flex justify-between items-center", children: [_jsx("span", { children: taxonomy.value }), hasChildren && (_jsx("button", { type: "button", onClick: () => toggleRowExpansion(taxonomy.id), className: "text-gray-500 transition-colors duration-200 dark:hover:text-blue-600 dark:text-gray-300 hover:text-blue-500 focus:outline-none", children: expandedRows.indexOf(taxonomy.id) !== -1 ? (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) })) : (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 15.75l-7.5-7.5-7.5 7.5" }) })) }))] }) })] }, index), expandedRows.indexOf(taxonomy.id) !== -1 && (_jsx("tr", { children: _jsx("td", { colSpan: 3, children: _jsxs("table", { className: "min-w-full divide-y ", children: [_jsx("thead", { className: "bg-gray-50 dark:bg-gray-800", children: _jsxs("tr", { children: [similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (_jsx("th", { scope: "col", className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", style: { width: "200px" }, children: "Actions" })), _jsx("th", { className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: "Code" }), _jsx("th", { className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: "Value" })] }) }), _jsx("tbody", { children: allTaxonomies
|
292
|
+
return (_jsxs(React.Fragment, { children: [_jsxs("tr", { children: [_jsx("td", { className: "px-4 py-4 text-sm whitespace-nowrap", children: taxonomy.isEdit && (_jsxs("div", { className: "flex items-center gap-x-6", children: [_jsx("button", { type: "button", onClick: () => handleDeleteClick(taxonomy.id), className: "text-gray-500 transition-colors duration-200 dark:hover:text-red-600 dark:text-gray-300 hover:text-red-500 focus:outline-none", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" }) }) }), _jsx("button", { type: "button", onClick: () => handleEditClick(index, taxonomy.id), className: "text-gray-500 transition-colors duration-200 dark:hover:text-yellow-500 dark:text-gray-300 hover:text-yellow-500 focus:outline-none", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10" }) }) }), _jsx("button", { type: "button", onClick: () => handleAddSubType(index, taxonomy.id), className: "text-gray-500 transition-colors duration-200 dark:hover:text-blue-500 dark:text-gray-300 hover:text-blue-500 focus:outline-none", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4.5v15m7.5-7.5h-15" }) }) })] })) }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-400", children: taxonomy.code }), _jsx("td", { className: "px-4 py-4 text-sm font-medium text-gray-900 dark:text-white", children: _jsxs("div", { className: "flex justify-between items-center", children: [_jsx("span", { children: taxonomy.value }), hasChildren && (_jsx("button", { type: "button", onClick: () => toggleRowExpansion(taxonomy.id), className: "text-gray-500 transition-colors duration-200 dark:hover:text-blue-600 dark:text-gray-300 hover:text-blue-500 focus:outline-none", children: expandedRows.indexOf(taxonomy.id) !== -1 ? (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) })) : (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 15.75l-7.5-7.5-7.5 7.5" }) })) }))] }) })] }, index), expandedRows.indexOf(taxonomy.id) !== -1 && (_jsx("tr", { children: _jsx("td", { colSpan: 3, children: _jsxs("table", { className: "min-w-full divide-y ", children: [_jsx("thead", { className: "bg-gray-50 dark:bg-gray-800", children: _jsxs("tr", { children: [similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (_jsx("th", { scope: "col", className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", style: { width: "200px" }, children: "Actions" })), _jsx("th", { className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400 w-23%", children: "Code" }), _jsx("th", { className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: "Value" })] }) }), _jsx("tbody", { children: allTaxonomies
|
340
293
|
.filter((item) => item.parentId === taxonomy.id)
|
341
294
|
.map((child, key) => (_jsxs("tr", { children: [similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (_jsx("td", { className: "px-4 py-4 text-sm whitespace-nowrap", children: _jsxs("div", { className: "flex items-center gap-x-6", children: [_jsx("button", { type: "button", onClick: () => handleDeleteSubTypeClick(child.id), className: "text-gray-500 transition-colors duration-200 dark:hover:text-red-600 dark:text-gray-300 hover:text-red-500 focus:outline-none", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" }) }) }), _jsx("button", { onClick: () => handleSubEdit(child), className: "text-gray-500 transition-colors duration-200 dark:hover:text-yellow-500 dark:text-gray-300 hover:text-yellow-500 focus:outline-none", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10" }) }) })] }) })), _jsx("td", { className: "px-4 py-2 text-sm text-gray-500 dark:text-gray-400", children: child.code }), _jsx("td", { className: "px-4 py-4 text-sm font-medium text-gray-900 dark:text-white", children: child.value })] }, key))) })] }) }) }))] }, taxonomy.id));
|
342
295
|
}) })] }) }), similarTaxonomies.some((taxonomy) => taxonomy.isEdit && taxonomy.isMultiple) && (_jsx("div", { className: "flex space-x-4 mt-6 justify-start", children: _jsxs("button", { type: "button", onClick: handleOpenModal, className: "flex items-center justify-center px-6 py-2 font-medium tracking-wide text-white capitalize transition-colors duration-300 transform bg-blue-600 rounded-lg hover:bg-blue-500 focus:outline-none focus:ring focus:ring-blue-300 focus:ring-opacity-80", children: [_jsx(FaPlus, { className: "mr-2 font-medium" }), "Add Multiple Values"] }) }))] })), isEditMode && (_jsx(_Fragment, { children: tempTaxonomy.length > 0 && (_jsxs("div", { className: "flex-grow ml-0 mt-4 w-full", children: [_jsx("div", { className: "overflow-hidden border border-gray-200 dark:border-gray-700 md:rounded-lg mt-6", children: _jsxs("table", { className: "min-w-full divide-y divide-gray-200 dark:divide-gray-700", children: [_jsx("thead", { className: "bg-gray-50 dark:bg-gray-800", children: _jsxs("tr", { children: [_jsx("th", { scope: "col", className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", style: { width: "200px" }, children: "Actions" }), _jsx("th", { scope: "col", className: "px-4 py-3.5 text-md font-normal text-left text-gray-500 dark:text-gray-400", children: "Code" }), _jsx("th", { scope: "col", className: "px-4 py-3.5 text-md font-normal text-left text-gray-500 dark:text-gray-400", children: "Value" })] }) }), _jsx("tbody", { className: "bg-white divide-y divide-gray-200 dark:bg-gray-800 dark:divide-gray-700", children: [...tempTaxonomy].map((item, index) => (_jsxs("tr", { children: [_jsx("td", { className: "px-4 py-4 text-sm whitespace-nowrap", children: _jsxs("div", { className: "flex items-center gap-x-6", children: [_jsx("button", { type: "button", onClick: () => {
|
package/package.json
CHANGED
@@ -340,80 +340,20 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
|
|
340
340
|
setSimilarTaxonomies(filteredTaxonomies);
|
341
341
|
};
|
342
342
|
|
343
|
-
// const handleSaveClick = async () => {
|
344
|
-
// if (tempTaxonomy.length === 0) {
|
345
|
-
// alert("No taxonomies to add.");
|
346
|
-
// return;
|
347
|
-
// }
|
348
|
-
// try {
|
349
|
-
// await addMultipleTaxonomiesApi(url, tempTaxonomy);
|
350
|
-
// setTempTaxonomy([]);
|
351
|
-
// alert("Multiple taxonomies added successfully");
|
352
|
-
// const response = await fetchTaxonomiessApi(url);
|
353
|
-
// const filteredTaxonomies = (response as { type: string }[]).filter(
|
354
|
-
// (taxonomy: { type: string }) => taxonomy.type === inputType
|
355
|
-
// );
|
356
|
-
// setSimilarTaxonomies(filteredTaxonomies);
|
357
|
-
// } catch (error) {
|
358
|
-
// console.error("Error adding multiple taxonomies:", error);
|
359
|
-
// alert("Failed to add multiple taxonomies");
|
360
|
-
// }
|
361
|
-
// };
|
362
|
-
|
363
|
-
// const handleSaveClick = async () => {
|
364
|
-
// if (tempTaxonomy.length === 0) {
|
365
|
-
// alert("No taxonomies to add.");
|
366
|
-
// return;
|
367
|
-
// }
|
368
|
-
|
369
|
-
// try {
|
370
|
-
// console.log("Adding taxonomies:", tempTaxonomy);
|
371
|
-
// await addMultipleTaxonomiesApi(url, tempTaxonomy);
|
372
|
-
|
373
|
-
// alert("Multiple taxonomies added successfully");
|
374
|
-
|
375
|
-
// // Fetch all taxonomies after saving
|
376
|
-
// const response = await fetchTaxonomiessApi(url);
|
377
|
-
// console.log("Fetched all taxonomies after save:", response);
|
378
|
-
|
379
|
-
// // Update state with all taxonomies
|
380
|
-
// setSimilarTaxonomies(response as { type: string }[]);
|
381
|
-
|
382
|
-
// // Clear tempTaxonomy after successful update
|
383
|
-
// setTempTaxonomy([]);
|
384
|
-
// } catch (error) {
|
385
|
-
// console.error("Error adding multiple taxonomies:", error);
|
386
|
-
// alert("Failed to add multiple taxonomies");
|
387
|
-
// }
|
388
|
-
// };
|
389
|
-
|
390
343
|
const handleSaveClick = async () => {
|
391
344
|
if (tempTaxonomy.length === 0) {
|
392
345
|
alert("No taxonomies to add.");
|
393
346
|
return;
|
394
347
|
}
|
395
|
-
|
396
348
|
try {
|
397
|
-
console.log("Adding taxonomies:", tempTaxonomy);
|
398
|
-
|
399
|
-
// Add multiple taxonomies via the API
|
400
349
|
await addMultipleTaxonomiesApi(url, tempTaxonomy);
|
401
|
-
|
350
|
+
setTempTaxonomy([]);
|
402
351
|
alert("Multiple taxonomies added successfully");
|
403
|
-
|
404
|
-
// Fetch only similar taxonomies (filter by type)
|
405
352
|
const response = await fetchTaxonomiessApi(url);
|
406
|
-
console.log("Fetched all taxonomies after save:", response);
|
407
|
-
|
408
353
|
const filteredTaxonomies = (response as { type: string }[]).filter(
|
409
|
-
(taxonomy: { type: string }) => taxonomy.type === inputType
|
354
|
+
(taxonomy: { type: string }) => taxonomy.type === inputType
|
410
355
|
);
|
411
|
-
|
412
|
-
// Update state with similar taxonomies
|
413
356
|
setSimilarTaxonomies(filteredTaxonomies);
|
414
|
-
|
415
|
-
// Clear tempTaxonomy after successful update
|
416
|
-
setTempTaxonomy([]);
|
417
357
|
} catch (error) {
|
418
358
|
console.error("Error adding multiple taxonomies:", error);
|
419
359
|
alert("Failed to add multiple taxonomies");
|
@@ -624,7 +564,7 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
|
|
624
564
|
Actions
|
625
565
|
</th>
|
626
566
|
)}
|
627
|
-
<th className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400">
|
567
|
+
<th className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400 w-23%">
|
628
568
|
Code
|
629
569
|
</th>
|
630
570
|
<th className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400">
|