eleven-solutions-common-website-unique-web 21.0.42 → 21.0.43
Sign up to get free protection for your applications and to get access to all the features.
@@ -63,7 +63,12 @@ const TaxonomyForm = ({ url }) => {
|
|
63
63
|
}
|
64
64
|
});
|
65
65
|
const [editTaxonomyItem, setEditTaxonomyItem] = useState(null);
|
66
|
-
const [editTempTaxonomyItem, setEditTempTaxonomyItem] = useState
|
66
|
+
// const [editTempTaxonomyItem, setEditTempTaxonomyItem] = useState<{
|
67
|
+
// id: string;
|
68
|
+
// type: string;
|
69
|
+
// code: string | number;
|
70
|
+
// value: string;
|
71
|
+
// } | null>(null);
|
67
72
|
const [selectedTaxonomyId, setSelectedTaxonomyId] = useState("");
|
68
73
|
const queryParams = new URLSearchParams(window.location.search);
|
69
74
|
const id = queryParams.get("id");
|
@@ -117,7 +122,7 @@ const TaxonomyForm = ({ url }) => {
|
|
117
122
|
};
|
118
123
|
const handleOpenModal = () => {
|
119
124
|
setEditTaxonomyItem(null);
|
120
|
-
setEditTempTaxonomyItem(null);
|
125
|
+
// setEditTempTaxonomyItem(null);
|
121
126
|
setIsModalOpen(true);
|
122
127
|
setIsAddingSubType(false);
|
123
128
|
};
|
@@ -194,7 +199,7 @@ const TaxonomyForm = ({ url }) => {
|
|
194
199
|
return;
|
195
200
|
}
|
196
201
|
try {
|
197
|
-
if (editTaxonomyItem
|
202
|
+
if (editTaxonomyItem) {
|
198
203
|
yield updateTaxonomyApi(url, selectedTaxonomyId, type, Number(newCode), newValue);
|
199
204
|
alert("Taxonomy updated successfully");
|
200
205
|
}
|
@@ -207,9 +212,7 @@ const TaxonomyForm = ({ url }) => {
|
|
207
212
|
setSimilarTaxonomies(filteredTaxonomies);
|
208
213
|
}
|
209
214
|
catch (error) {
|
210
|
-
console.error(editTaxonomyItem
|
211
|
-
? "Error updating Taxonomy:"
|
212
|
-
: "Error adding value:", error);
|
215
|
+
console.error(editTaxonomyItem ? "Error updating Taxonomy:" : "Error adding value:", error);
|
213
216
|
const errorMessage = ((_a = error.response) === null || _a === void 0 ? void 0 : _a.data) || ((_b = error.response) === null || _b === void 0 ? void 0 : _b.statusText) || error.message;
|
214
217
|
alert(`Error while ${editTaxonomyItem ? "editing" : "adding"} SubType: ${errorMessage}`);
|
215
218
|
}
|
@@ -240,6 +243,6 @@ const TaxonomyForm = ({ url }) => {
|
|
240
243
|
: "Add SubType"
|
241
244
|
: editTaxonomyItem
|
242
245
|
? "Edit Values"
|
243
|
-
: "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: "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: handleSubTypeSubmitClick, 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" : "Add" }), _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: handleSubmitClick, 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
|
246
|
+
: "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: "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: handleSubTypeSubmitClick, 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" : "Add" }), _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: handleSubmitClick, 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" : "Add" }), _jsx("button", { onClick: handleCloseModal, className: "px-8 py-2.5 leading-5 bg-gray-300 rounded-md", children: "Cancel" })] })] }))] }) })] }));
|
244
247
|
};
|
245
248
|
export default TaxonomyForm;
|
package/package.json
CHANGED
@@ -84,12 +84,12 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
|
|
84
84
|
value: string;
|
85
85
|
} | null>(null);
|
86
86
|
|
87
|
-
const [editTempTaxonomyItem, setEditTempTaxonomyItem] = useState<{
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
} | null>(null);
|
87
|
+
// const [editTempTaxonomyItem, setEditTempTaxonomyItem] = useState<{
|
88
|
+
// id: string;
|
89
|
+
// type: string;
|
90
|
+
// code: string | number;
|
91
|
+
// value: string;
|
92
|
+
// } | null>(null);
|
93
93
|
|
94
94
|
const [selectedTaxonomyId, setSelectedTaxonomyId] = useState<string>("");
|
95
95
|
|
@@ -155,7 +155,7 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
|
|
155
155
|
|
156
156
|
const handleOpenModal = () => {
|
157
157
|
setEditTaxonomyItem(null);
|
158
|
-
setEditTempTaxonomyItem(null);
|
158
|
+
// setEditTempTaxonomyItem(null);
|
159
159
|
setIsModalOpen(true);
|
160
160
|
|
161
161
|
setIsAddingSubType(false);
|
@@ -270,7 +270,7 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
|
|
270
270
|
}
|
271
271
|
|
272
272
|
try {
|
273
|
-
if (editTaxonomyItem
|
273
|
+
if (editTaxonomyItem) {
|
274
274
|
await updateTaxonomyApi(
|
275
275
|
url,
|
276
276
|
selectedTaxonomyId,
|
@@ -291,9 +291,7 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
|
|
291
291
|
setSimilarTaxonomies(filteredTaxonomies);
|
292
292
|
} catch (error) {
|
293
293
|
console.error(
|
294
|
-
editTaxonomyItem
|
295
|
-
? "Error updating Taxonomy:"
|
296
|
-
: "Error adding value:",
|
294
|
+
editTaxonomyItem ? "Error updating Taxonomy:" : "Error adding value:",
|
297
295
|
error
|
298
296
|
);
|
299
297
|
const errorMessage =
|
@@ -729,7 +727,7 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
|
|
729
727
|
onClick={handleSubmitClick}
|
730
728
|
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"
|
731
729
|
>
|
732
|
-
{editTaxonomyItem
|
730
|
+
{editTaxonomyItem ? "Edit" : "Add"}
|
733
731
|
</button>
|
734
732
|
<button
|
735
733
|
onClick={handleCloseModal}
|