eleven-solutions-common-website-unique-web 19.0.14 → 19.0.15
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.
@@ -258,10 +258,10 @@ const TaxonomyForm = ({ url }) => {
|
|
258
258
|
setSimilarTaxonomies(filteredTaxonomies);
|
259
259
|
});
|
260
260
|
const handleSaveClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
261
|
+
if (tempTaxonomy.length === 0) {
|
262
|
+
alert("No taxonomies to add.");
|
263
|
+
return;
|
264
|
+
}
|
265
265
|
try {
|
266
266
|
yield addMultipleTaxonomiesApi(url, tempTaxonomy);
|
267
267
|
setTempTaxonomy([]);
|
@@ -275,6 +275,22 @@ const TaxonomyForm = ({ url }) => {
|
|
275
275
|
alert("Failed to add multiple taxonomies");
|
276
276
|
}
|
277
277
|
});
|
278
|
+
const addTaxonomyClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
279
|
+
try {
|
280
|
+
yield addTaxonomyApi(url, type, Number(newCode), newValue);
|
281
|
+
alert("Value added successfully");
|
282
|
+
const fetchedTaxonomies = yield fetchTaxonomiessApi(url);
|
283
|
+
if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
|
284
|
+
setAllTaxonomies(fetchedTaxonomies);
|
285
|
+
}
|
286
|
+
}
|
287
|
+
catch (error) {
|
288
|
+
console.error("Error adding value:", error);
|
289
|
+
}
|
290
|
+
setIsModalOpen(false);
|
291
|
+
setNewCode("");
|
292
|
+
setNewValue("");
|
293
|
+
});
|
278
294
|
const handleDeleteClick = (id) => __awaiter(void 0, void 0, void 0, function* () {
|
279
295
|
try {
|
280
296
|
yield deleteTaxonomyApi(url, id);
|
@@ -301,6 +317,6 @@ const TaxonomyForm = ({ url }) => {
|
|
301
317
|
? handleSubTypeEditClick
|
302
318
|
: handleSubTypeAddClick, className: "px-8 py-2.5 leading-5 text-white transition-colors duration-300 transform bg-blue-600 rounded-md hover:bg-blue-500 focus:outline-none focus:bg-gray-600", children: editTaxonomyItem ? "Edit SubType" : "Add SubType" }), _jsx("button", { onClick: handleCloseModal, className: "px-8 py-2.5 leading-5 bg-gray-300 rounded-md", children: "Cancel" })] })] })) : (_jsxs(_Fragment, { children: [_jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Code" }), _jsx("input", { type: "number", value: newCode, onChange: (e) => setNewCode(e.target.value), placeholder: "Enter Code", className: "w-full px-4 py-2 mt-2 mb-4 border border-gray-300 rounded-md" }), _jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Value" }), _jsx("input", { type: "text", value: newValue, onChange: (e) => setNewValue(e.target.value), placeholder: "Enter Value", className: "w-full px-4 py-2 mt-2 mb-4 border border-gray-300 rounded-md" }), _jsxs("div", { className: "flex space-x-4 justify-end", children: [_jsx("button", { onClick:
|
303
319
|
// editTaxonomyItem ? handleEditTaxClick : handleAddClick
|
304
|
-
editTaxonomyItem ? handleEditTaxClick :
|
320
|
+
editTaxonomyItem ? handleEditTaxClick : addTaxonomyClick, className: "px-8 py-2.5 leading-5 text-white transition-colors duration-300 transform bg-blue-600 rounded-md hover:bg-blue-500 focus:outline-none focus:bg-gray-600", children: editTaxonomyItem || editTempTaxonomyItem ? "Edit" : "Add" }), _jsx("button", { onClick: handleCloseModal, className: "px-8 py-2.5 leading-5 bg-gray-300 rounded-md", children: "Cancel" })] })] }))] }) })] }));
|
305
321
|
};
|
306
322
|
export default TaxonomyForm;
|
package/package.json
CHANGED
@@ -341,10 +341,10 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
|
|
341
341
|
};
|
342
342
|
|
343
343
|
const handleSaveClick = async () => {
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
344
|
+
if (tempTaxonomy.length === 0) {
|
345
|
+
alert("No taxonomies to add.");
|
346
|
+
return;
|
347
|
+
}
|
348
348
|
try {
|
349
349
|
await addMultipleTaxonomiesApi(url, tempTaxonomy);
|
350
350
|
setTempTaxonomy([]);
|
@@ -360,6 +360,23 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
|
|
360
360
|
}
|
361
361
|
};
|
362
362
|
|
363
|
+
const addTaxonomyClick = async () => {
|
364
|
+
try {
|
365
|
+
await addTaxonomyApi(url, type, Number(newCode), newValue);
|
366
|
+
|
367
|
+
alert("Value added successfully");
|
368
|
+
const fetchedTaxonomies = await fetchTaxonomiessApi(url);
|
369
|
+
if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
|
370
|
+
setAllTaxonomies(fetchedTaxonomies);
|
371
|
+
}
|
372
|
+
} catch (error) {
|
373
|
+
console.error("Error adding value:", error);
|
374
|
+
}
|
375
|
+
setIsModalOpen(false);
|
376
|
+
setNewCode("");
|
377
|
+
setNewValue("");
|
378
|
+
};
|
379
|
+
|
363
380
|
const handleDeleteClick = async (id: string) => {
|
364
381
|
try {
|
365
382
|
await deleteTaxonomyApi(url, id);
|
@@ -898,7 +915,7 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
|
|
898
915
|
<button
|
899
916
|
onClick={
|
900
917
|
// editTaxonomyItem ? handleEditTaxClick : handleAddClick
|
901
|
-
editTaxonomyItem ? handleEditTaxClick :
|
918
|
+
editTaxonomyItem ? handleEditTaxClick : addTaxonomyClick
|
902
919
|
}
|
903
920
|
className="px-8 py-2.5 leading-5 text-white transition-colors duration-300 transform bg-blue-600 rounded-md hover:bg-blue-500 focus:outline-none focus:bg-gray-600"
|
904
921
|
>
|