eleven-solutions-common-website-unique-web 6.0.29 → 6.0.30
Sign up to get free protection for your applications and to get access to all the features.
@@ -47,9 +47,6 @@ const TaxonomyForm = () => {
|
|
47
47
|
fetchAllTaxonomies();
|
48
48
|
}, []);
|
49
49
|
// Fetch child taxonomies for a parentId
|
50
|
-
const getChildTaxonomies = (parentId) => {
|
51
|
-
return allTaxonomies.filter((taxonomy) => taxonomy.parentId === parentId);
|
52
|
-
};
|
53
50
|
const toggleRowExpansion = (taxonomyId) => {
|
54
51
|
setExpandedRows((prevExpandedRows) => prevExpandedRows.indexOf(taxonomyId) !== -1
|
55
52
|
? prevExpandedRows.filter((id) => id !== taxonomyId) // Collapse row
|
@@ -230,11 +227,18 @@ const TaxonomyForm = () => {
|
|
230
227
|
try {
|
231
228
|
yield addSubTypeApi(selectedTaxonomyId, subType, Number(subCode), subValue);
|
232
229
|
alert("SubType added successfully");
|
230
|
+
const fetchedTaxonomies = yield fetchTaxonomiessApi();
|
231
|
+
if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
|
232
|
+
setAllTaxonomies(fetchedTaxonomies);
|
233
|
+
}
|
233
234
|
}
|
234
235
|
catch (error) {
|
235
236
|
console.error("Error adding SubType:", error);
|
236
237
|
}
|
237
238
|
setIsModalOpen(false);
|
239
|
+
setSubType("");
|
240
|
+
setSubCode("");
|
241
|
+
setSubValue("");
|
238
242
|
});
|
239
243
|
const handleEditTaxClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
240
244
|
try {
|
package/package.json
CHANGED
@@ -57,9 +57,7 @@ const TaxonomyForm = () => {
|
|
57
57
|
}, []);
|
58
58
|
|
59
59
|
// Fetch child taxonomies for a parentId
|
60
|
-
|
61
|
-
return allTaxonomies.filter((taxonomy) => taxonomy.parentId === parentId);
|
62
|
-
};
|
60
|
+
|
63
61
|
const toggleRowExpansion = (taxonomyId: number) => {
|
64
62
|
setExpandedRows(
|
65
63
|
(prevExpandedRows) =>
|
@@ -286,10 +284,17 @@ const TaxonomyForm = () => {
|
|
286
284
|
subValue
|
287
285
|
);
|
288
286
|
alert("SubType added successfully");
|
287
|
+
const fetchedTaxonomies = await fetchTaxonomiessApi();
|
288
|
+
if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
|
289
|
+
setAllTaxonomies(fetchedTaxonomies);
|
290
|
+
}
|
289
291
|
} catch (error) {
|
290
292
|
console.error("Error adding SubType:", error);
|
291
293
|
}
|
292
294
|
setIsModalOpen(false);
|
295
|
+
setSubType("");
|
296
|
+
setSubCode("");
|
297
|
+
setSubValue("");
|
293
298
|
};
|
294
299
|
|
295
300
|
const handleEditTaxClick = async () => {
|
@@ -493,122 +498,7 @@ const TaxonomyForm = () => {
|
|
493
498
|
</th>
|
494
499
|
</tr>
|
495
500
|
</thead>
|
496
|
-
{/* <tbody className="divide-y divide-gray-200">
|
497
|
-
{similarTaxonomies.map((taxonomy, index) => {
|
498
|
-
return (
|
499
|
-
<tr key={index}>
|
500
|
-
{similarTaxonomies.some(
|
501
|
-
(taxonomy) => taxonomy.isEdit
|
502
|
-
) && (
|
503
|
-
<td className="px-4 py-4 text-sm whitespace-nowrap">
|
504
|
-
<div className="flex items-center gap-x-6">
|
505
|
-
<button
|
506
|
-
type="button"
|
507
|
-
onClick={() => handleDeleteClick(taxonomy.id)}
|
508
|
-
className="text-gray-500 transition-colors duration-200 dark:hover:text-red-600 dark:text-gray-300 hover:text-red-500 focus:outline-none"
|
509
|
-
>
|
510
|
-
<svg
|
511
|
-
xmlns="http://www.w3.org/2000/svg"
|
512
|
-
fill="none"
|
513
|
-
viewBox="0 0 24 24"
|
514
|
-
strokeWidth="1.5"
|
515
|
-
stroke="currentColor"
|
516
|
-
className="w-5 h-5"
|
517
|
-
>
|
518
|
-
<path
|
519
|
-
strokeLinecap="round"
|
520
|
-
strokeLinejoin="round"
|
521
|
-
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"
|
522
|
-
/>
|
523
|
-
</svg>
|
524
|
-
</button>
|
525
501
|
|
526
|
-
<button
|
527
|
-
type="button"
|
528
|
-
onClick={() =>
|
529
|
-
handleEditClick(index, taxonomy.id)
|
530
|
-
}
|
531
|
-
className="text-gray-500 transition-colors duration-200 dark:hover:text-yellow-500 dark:text-gray-300 hover:text-yellow-500 focus:outline-none"
|
532
|
-
>
|
533
|
-
<svg
|
534
|
-
xmlns="http://www.w3.org/2000/svg"
|
535
|
-
fill="none"
|
536
|
-
viewBox="0 0 24 24"
|
537
|
-
strokeWidth="1.5"
|
538
|
-
stroke="currentColor"
|
539
|
-
className="w-5 h-5"
|
540
|
-
>
|
541
|
-
<path
|
542
|
-
strokeLinecap="round"
|
543
|
-
strokeLinejoin="round"
|
544
|
-
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"
|
545
|
-
/>
|
546
|
-
</svg>
|
547
|
-
</button>
|
548
|
-
|
549
|
-
<button
|
550
|
-
type="button"
|
551
|
-
onClick={() =>
|
552
|
-
handleAddSubType(index, taxonomy.id)
|
553
|
-
}
|
554
|
-
className="text-gray-500 transition-colors duration-200 dark:hover:text-blue-500 dark:text-gray-300 hover:text-blue-500 focus:outline-none"
|
555
|
-
>
|
556
|
-
<svg
|
557
|
-
xmlns="http://www.w3.org/2000/svg"
|
558
|
-
fill="none"
|
559
|
-
viewBox="0 0 24 24"
|
560
|
-
strokeWidth="1.5"
|
561
|
-
stroke="currentColor"
|
562
|
-
className="w-5 h-5"
|
563
|
-
>
|
564
|
-
<path
|
565
|
-
strokeLinecap="round"
|
566
|
-
strokeLinejoin="round"
|
567
|
-
d="M12 4.5v15m7.5-7.5h-15"
|
568
|
-
/>
|
569
|
-
</svg>
|
570
|
-
</button>
|
571
|
-
</div>
|
572
|
-
</td>
|
573
|
-
)}
|
574
|
-
|
575
|
-
<td className="px-4 py-4 text-sm text-gray-500 dark:text-gray-400">
|
576
|
-
{taxonomy.code}
|
577
|
-
</td>
|
578
|
-
|
579
|
-
<td className="px-4 py-4 text-sm font-medium text-gray-900 dark:text-white">
|
580
|
-
<div className="flex justify-between items-center">
|
581
|
-
<span>{taxonomy.value}</span>
|
582
|
-
|
583
|
-
{allTaxonomies.some(
|
584
|
-
(item) => item.parentId === taxonomy.id
|
585
|
-
) && (
|
586
|
-
<button
|
587
|
-
type="button"
|
588
|
-
className="text-gray-500 transition-colors duration-200 dark:hover:text-blue-600 dark:text-gray-300 hover:text-blue-500 focus:outline-none"
|
589
|
-
>
|
590
|
-
<svg
|
591
|
-
xmlns="http://www.w3.org/2000/svg"
|
592
|
-
fill="none"
|
593
|
-
viewBox="0 0 24 24"
|
594
|
-
strokeWidth="1.5"
|
595
|
-
stroke="currentColor"
|
596
|
-
className="w-5 h-5"
|
597
|
-
>
|
598
|
-
<path
|
599
|
-
strokeLinecap="round"
|
600
|
-
strokeLinejoin="round"
|
601
|
-
d="M19.5 8.25l-7.5 7.5-7.5-7.5"
|
602
|
-
/>
|
603
|
-
</svg>
|
604
|
-
</button>
|
605
|
-
)}
|
606
|
-
</div>
|
607
|
-
</td>
|
608
|
-
</tr>
|
609
|
-
);
|
610
|
-
})}
|
611
|
-
</tbody> */}
|
612
502
|
<tbody className="divide-y divide-gray-200">
|
613
503
|
{similarTaxonomies.map((taxonomy, index) => {
|
614
504
|
const hasChildren = allTaxonomies.some(
|