eleven-solutions-common-website-unique-web 21.0.19 → 21.0.21

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.
@@ -66,13 +66,6 @@ const TaxonomyForm = ({ url }) => {
66
66
  const [editTaxonomyItem, setEditTaxonomyItem] = useState(null);
67
67
  const [editTempTaxonomyItem, setEditTempTaxonomyItem] = useState(null);
68
68
  const [selectedTaxonomyId, setSelectedTaxonomyId] = useState("");
69
- const validateForm = () => {
70
- if (!inputType || !code || !value) {
71
- alert("Please fill in all required fields: Type, Code, and Value.");
72
- return false;
73
- }
74
- return true;
75
- };
76
69
  const queryParams = new URLSearchParams(window.location.search);
77
70
  const id = queryParams.get("id");
78
71
  useEffect(() => {
@@ -156,31 +149,6 @@ const TaxonomyForm = ({ url }) => {
156
149
  setSubCode("");
157
150
  setSubValue("");
158
151
  };
159
- const handleAddClick = () => {
160
- if (newCode === "" || newValue === "") {
161
- alert("Please fill in all required fields: Code, and Value.");
162
- return;
163
- }
164
- const newTaxonomyItem = { type: type, code: newCode, value: newValue };
165
- if (editTempTaxonomyItem) {
166
- const updatedTempTaxonomy = tempTaxonomy.map((item) => item === editTempTaxonomyItem ? newTaxonomyItem : item);
167
- setTempTaxonomy(updatedTempTaxonomy);
168
- setEditTempTaxonomyItem(null);
169
- }
170
- else {
171
- setTempTaxonomy([...tempTaxonomy, newTaxonomyItem]);
172
- }
173
- setNewCode("");
174
- setNewValue("");
175
- setIsModalOpen(false);
176
- };
177
- const handleTempEditClick = (index) => {
178
- const item = tempTaxonomy[index];
179
- setEditTempTaxonomyItem(item);
180
- setNewCode(item.code);
181
- setNewValue(item.value);
182
- setIsModalOpen(true);
183
- };
184
152
  const handleEditClick = (index, id) => {
185
153
  setIsAddingSubType(false);
186
154
  const item = similarTaxonomies.find((taxonomy) => taxonomy.id === id);
@@ -256,28 +224,12 @@ const TaxonomyForm = ({ url }) => {
256
224
  console.error("Error updating Taxonomy:", error);
257
225
  }
258
226
  setIsModalOpen(false);
227
+ setNewCode("");
228
+ setNewValue("");
259
229
  const response = yield fetchTaxonomiessApi(url);
260
230
  const filteredTaxonomies = response.filter((taxonomy) => taxonomy.type === type);
261
231
  setSimilarTaxonomies(filteredTaxonomies);
262
232
  });
263
- const handleSaveClick = () => __awaiter(void 0, void 0, void 0, function* () {
264
- if (tempTaxonomy.length === 0) {
265
- alert("No taxonomies to add.");
266
- return;
267
- }
268
- try {
269
- yield addMultipleTaxonomiesApi(url, tempTaxonomy);
270
- setTempTaxonomy([]);
271
- alert("Multiple taxonomies added successfully");
272
- const response = yield fetchTaxonomiessApi(url);
273
- const filteredTaxonomies = response.filter((taxonomy) => taxonomy.type === type);
274
- setSimilarTaxonomies(filteredTaxonomies);
275
- }
276
- catch (error) {
277
- console.error("Error adding multiple taxonomies:", error);
278
- alert("Failed to add multiple taxonomies");
279
- }
280
- });
281
233
  const addTaxonomyClick = () => __awaiter(void 0, void 0, void 0, function* () {
282
234
  if (!newCode || !newValue) {
283
235
  alert("Please fill out both Code and Value fields before adding.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleven-solutions-common-website-unique-web",
3
- "version": "21.0.19",
3
+ "version": "21.0.21",
4
4
  "main": "./dist/index.js",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -96,14 +96,6 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
96
96
 
97
97
  const [selectedTaxonomyId, setSelectedTaxonomyId] = useState<string>("");
98
98
 
99
- const validateForm = () => {
100
- if (!inputType || !code || !value) {
101
- alert("Please fill in all required fields: Type, Code, and Value.");
102
- return false;
103
- }
104
- return true;
105
- };
106
-
107
99
  const queryParams = new URLSearchParams(window.location.search);
108
100
  const id = queryParams.get("id");
109
101
 
@@ -200,37 +192,6 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
200
192
  setSubValue("");
201
193
  };
202
194
 
203
- const handleAddClick = () => {
204
- if (newCode === "" || newValue === "") {
205
- alert("Please fill in all required fields: Code, and Value.");
206
- return;
207
- }
208
-
209
- const newTaxonomyItem = { type: type, code: newCode, value: newValue };
210
-
211
- if (editTempTaxonomyItem) {
212
- const updatedTempTaxonomy = tempTaxonomy.map((item) =>
213
- item === editTempTaxonomyItem ? newTaxonomyItem : item
214
- );
215
- setTempTaxonomy(updatedTempTaxonomy);
216
- setEditTempTaxonomyItem(null);
217
- } else {
218
- setTempTaxonomy([...tempTaxonomy, newTaxonomyItem]);
219
- }
220
-
221
- setNewCode("");
222
- setNewValue("");
223
- setIsModalOpen(false);
224
- };
225
-
226
- const handleTempEditClick = (index: number) => {
227
- const item = tempTaxonomy[index];
228
- setEditTempTaxonomyItem(item);
229
- setNewCode(item.code);
230
- setNewValue(item.value);
231
- setIsModalOpen(true);
232
- };
233
-
234
195
  const handleEditClick = (index: number, id: string) => {
235
196
  setIsAddingSubType(false);
236
197
 
@@ -337,6 +298,8 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
337
298
  console.error("Error updating Taxonomy:", error);
338
299
  }
339
300
  setIsModalOpen(false);
301
+ setNewCode("");
302
+ setNewValue("");
340
303
  const response = await fetchTaxonomiessApi(url);
341
304
  const filteredTaxonomies = (response as { type: string }[]).filter(
342
305
  (taxonomy: { type: string }) => taxonomy.type === type
@@ -344,26 +307,6 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
344
307
  setSimilarTaxonomies(filteredTaxonomies);
345
308
  };
346
309
 
347
- const handleSaveClick = async () => {
348
- if (tempTaxonomy.length === 0) {
349
- alert("No taxonomies to add.");
350
- return;
351
- }
352
- try {
353
- await addMultipleTaxonomiesApi(url, tempTaxonomy);
354
- setTempTaxonomy([]);
355
- alert("Multiple taxonomies added successfully");
356
- const response = await fetchTaxonomiessApi(url);
357
- const filteredTaxonomies = (response as { type: string }[]).filter(
358
- (taxonomy: { type: string }) => taxonomy.type === type
359
- );
360
- setSimilarTaxonomies(filteredTaxonomies);
361
- } catch (error) {
362
- console.error("Error adding multiple taxonomies:", error);
363
- alert("Failed to add multiple taxonomies");
364
- }
365
- };
366
-
367
310
  const addTaxonomyClick = async () => {
368
311
  if (!newCode || !newValue) {
369
312
  alert("Please fill out both Code and Value fields before adding.");