eleven-solutions-common-website-unique-web 7.0.0 → 7.0.2
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.
@@ -234,7 +234,7 @@ const TaxonomyForm = () => {
|
|
234
234
|
setIsModalOpen(true);
|
235
235
|
setIsAddingSubType(true);
|
236
236
|
};
|
237
|
-
const
|
237
|
+
const handleSubTypeAddClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
238
238
|
try {
|
239
239
|
yield addSubTypeApi(selectedTaxonomyId, subType, Number(subCode), subValue);
|
240
240
|
alert("SubType added successfully");
|
@@ -246,6 +246,24 @@ const TaxonomyForm = () => {
|
|
246
246
|
catch (error) {
|
247
247
|
console.error("Error adding SubType:", error);
|
248
248
|
}
|
249
|
+
setEditTaxonomyItem(null);
|
250
|
+
setIsModalOpen(false);
|
251
|
+
setSubType("");
|
252
|
+
setSubCode("");
|
253
|
+
setSubValue("");
|
254
|
+
});
|
255
|
+
const handleSubTypeEditClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
256
|
+
try {
|
257
|
+
yield updateTaxonomyApi(selectedTaxonomyId, subType, Number(subCode), subValue);
|
258
|
+
alert("SubType edited successfully");
|
259
|
+
const fetchedTaxonomies = yield fetchTaxonomiessApi();
|
260
|
+
if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
|
261
|
+
setAllTaxonomies(fetchedTaxonomies);
|
262
|
+
}
|
263
|
+
}
|
264
|
+
catch (error) {
|
265
|
+
console.error("Error editing SubType:", error);
|
266
|
+
}
|
249
267
|
setIsModalOpen(false);
|
250
268
|
setSubType("");
|
251
269
|
setSubCode("");
|
@@ -327,6 +345,8 @@ const TaxonomyForm = () => {
|
|
327
345
|
: "Add SubType"
|
328
346
|
: editTaxonomyItem
|
329
347
|
? "Edit Values"
|
330
|
-
: "Add Values" }), _jsx("button", { onClick: handleCloseModal, className: "text-xl text-gray-600 dark:text-gray-400 h-6 w-6", children: "\u00D7" })] }), isAddingSubType ? (_jsxs(_Fragment, { children: [_jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Type" }), _jsx("input", { type: "text", value: subType, onChange: (e) => setSubType(e.target.value), placeholder: "Enter Type", 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: "Code" }), _jsx("input", { type: "number", value: subCode, onChange: (e) => setSubCode(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: subValue, onChange: (e) => setSubValue(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: handleCloseModal, className: "px-8 py-2.5 leading-5 bg-gray-300 rounded-md", children: "Cancel" }), _jsx("button", { onClick:
|
348
|
+
: "Add Values" }), _jsx("button", { onClick: handleCloseModal, className: "text-xl text-gray-600 dark:text-gray-400 h-6 w-6", children: "\u00D7" })] }), isAddingSubType ? (_jsxs(_Fragment, { children: [_jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Type" }), _jsx("input", { type: "text", value: subType, onChange: (e) => setSubType(e.target.value), placeholder: "Enter Type", 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: "Code" }), _jsx("input", { type: "number", value: subCode, onChange: (e) => setSubCode(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: subValue, onChange: (e) => setSubValue(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: handleCloseModal, className: "px-8 py-2.5 leading-5 bg-gray-300 rounded-md", children: "Cancel" }), _jsx("button", { onClick: editTaxonomyItem
|
349
|
+
? handleSubTypeEditClick
|
350
|
+
: 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" })] })] })) : (_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: handleCloseModal, className: "px-8 py-2.5 leading-5 bg-gray-300 rounded-md", children: "Cancel" }), _jsx("button", { onClick: editTaxonomyItem ? handleEditTaxClick : handleAddClick, 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" })] })] }))] }) })] }));
|
331
351
|
};
|
332
352
|
export default TaxonomyForm;
|
package/package.json
CHANGED
@@ -286,7 +286,7 @@ const TaxonomyForm = () => {
|
|
286
286
|
setIsAddingSubType(true);
|
287
287
|
};
|
288
288
|
|
289
|
-
const
|
289
|
+
const handleSubTypeAddClick = async () => {
|
290
290
|
try {
|
291
291
|
await addSubTypeApi(
|
292
292
|
selectedTaxonomyId,
|
@@ -302,6 +302,30 @@ const TaxonomyForm = () => {
|
|
302
302
|
} catch (error) {
|
303
303
|
console.error("Error adding SubType:", error);
|
304
304
|
}
|
305
|
+
setEditTaxonomyItem(null);
|
306
|
+
setIsModalOpen(false);
|
307
|
+
setSubType("");
|
308
|
+
setSubCode("");
|
309
|
+
setSubValue("");
|
310
|
+
};
|
311
|
+
|
312
|
+
const handleSubTypeEditClick = async () => {
|
313
|
+
try {
|
314
|
+
await updateTaxonomyApi(
|
315
|
+
selectedTaxonomyId,
|
316
|
+
subType,
|
317
|
+
Number(subCode),
|
318
|
+
subValue
|
319
|
+
);
|
320
|
+
|
321
|
+
alert("SubType edited successfully");
|
322
|
+
const fetchedTaxonomies = await fetchTaxonomiessApi();
|
323
|
+
if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
|
324
|
+
setAllTaxonomies(fetchedTaxonomies);
|
325
|
+
}
|
326
|
+
} catch (error) {
|
327
|
+
console.error("Error editing SubType:", error);
|
328
|
+
}
|
305
329
|
setIsModalOpen(false);
|
306
330
|
setSubType("");
|
307
331
|
setSubCode("");
|
@@ -906,11 +930,6 @@ const TaxonomyForm = () => {
|
|
906
930
|
<div className="p-6">
|
907
931
|
<div className="flex justify-between">
|
908
932
|
<h2 className="text-xl font-bold text-blue-600 mb-4 ">
|
909
|
-
{/* {isAddingSubType
|
910
|
-
? "Add SubType"
|
911
|
-
: editTaxonomyItem || editTempTaxonomyItem
|
912
|
-
? "Edit Values"
|
913
|
-
: "Add Values"} */}
|
914
933
|
{isAddingSubType
|
915
934
|
? editTaxonomyItem
|
916
935
|
? "Edit SubType"
|
@@ -967,7 +986,11 @@ const TaxonomyForm = () => {
|
|
967
986
|
Cancel
|
968
987
|
</button>
|
969
988
|
<button
|
970
|
-
onClick={
|
989
|
+
onClick={
|
990
|
+
editTaxonomyItem
|
991
|
+
? handleSubTypeEditClick
|
992
|
+
: handleSubTypeAddClick
|
993
|
+
}
|
971
994
|
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"
|
972
995
|
>
|
973
996
|
{editTaxonomyItem ? "Edit SubType" : "Add SubType"}
|