eleven-solutions-common-website-unique-web 21.0.56 → 22.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. package/dist/App.d.ts +0 -3
  2. package/dist/App.js +0 -2
  3. package/dist/components/admin/Sidebar.d.ts +0 -1
  4. package/dist/components/admin/Sidebar.js +2 -2
  5. package/dist/components/admin/UserForm.js +6 -5
  6. package/dist/components/admin/Users.js +4 -3
  7. package/dist/components/footer/Footer.d.ts +3 -2
  8. package/dist/components/footer/Footer.js +2 -3
  9. package/dist/components/index.d.ts +3 -2
  10. package/dist/components/index.js +3 -2
  11. package/dist/components/login/GoogleButton.js +4 -1
  12. package/dist/components/login/Header.d.ts +3 -1
  13. package/dist/components/login/Header.js +135 -31
  14. package/dist/components/login/Login.d.ts +2 -1
  15. package/dist/components/login/Login.js +15 -65
  16. package/dist/components/login/Setcookie.d.ts +2 -0
  17. package/dist/components/login/Setcookie.js +7 -0
  18. package/dist/components/redux/slices/types/types.d.ts +3 -0
  19. package/dist/components/redux/slices/types/types.js +1 -0
  20. package/dist/components/redux/slices/userSlice.d.ts +20 -0
  21. package/dist/components/redux/slices/userSlice.js +90 -0
  22. package/dist/components/useraccount/UpdateUserDetails.d.ts +1 -0
  23. package/dist/components/useraccount/UpdateUserDetails.js +15 -22
  24. package/package.json +9 -4
  25. package/.github/workflows/main.yml +0 -22
  26. package/azure-pipelines.yml +0 -20
  27. package/dist/components/Navbar.d.ts +0 -6
  28. package/dist/components/Navbar.js +0 -5
  29. package/dist/components/login/View.d.ts +0 -2
  30. package/dist/components/login/View.js +0 -10
  31. package/dist/components/useraccount/AddMissingDetails.d.ts +0 -9
  32. package/dist/components/useraccount/AddMissingDetails.js +0 -56
  33. package/dist/components/useraccount/AddUserDetails.d.ts +0 -9
  34. package/dist/components/useraccount/AddUserDetails.js +0 -21
  35. package/src/App.tsx +0 -21
  36. package/src/components/Navbar.tsx +0 -21
  37. package/src/components/admin/Dashboard.tsx +0 -7
  38. package/src/components/admin/Editor.tsx +0 -25
  39. package/src/components/admin/Sidebar.tsx +0 -102
  40. package/src/components/admin/Taxionomies.tsx +0 -314
  41. package/src/components/admin/TaxonomyForm.tsx +0 -744
  42. package/src/components/admin/Template.tsx +0 -304
  43. package/src/components/admin/TemplateForm.tsx +0 -141
  44. package/src/components/admin/UserForm.tsx +0 -231
  45. package/src/components/admin/Users.tsx +0 -479
  46. package/src/components/api/api.ts +0 -59
  47. package/src/components/api/taxonomy.ts +0 -201
  48. package/src/components/api/template.ts +0 -114
  49. package/src/components/api/updateuser.ts +0 -53
  50. package/src/components/api/user.ts +0 -133
  51. package/src/components/footer/Footer.tsx +0 -128
  52. package/src/components/footer/Privacy.tsx +0 -82
  53. package/src/components/footer/Terms.tsx +0 -156
  54. package/src/components/index.ts +0 -19
  55. package/src/components/login/GoogleButton.tsx +0 -85
  56. package/src/components/login/Header.tsx +0 -340
  57. package/src/components/login/Login.tsx +0 -277
  58. package/src/components/useraccount/AddUserDetails.tsx +0 -136
  59. package/src/components/useraccount/UpdateUserDetails.tsx +0 -214
  60. package/src/index.ts +0 -1
  61. package/tsconfig.json +0 -15
@@ -1,744 +0,0 @@
1
- import React from "react";
2
- import { useState, useEffect } from "react";
3
- import {
4
- addTaxonomyApi,
5
- fetchTaxonomyByIdApi,
6
- updateTaxonomyApi,
7
- fetchTaxonomiessApi,
8
- deleteTaxonomyApi,
9
- addSubTypeApi,
10
- } from "../api/taxonomy";
11
- import { FaPlus } from "react-icons/fa";
12
-
13
- interface TaxionomyFormProps {
14
- url: string;
15
- }
16
-
17
- const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
18
- const [type, setType] = useState<string>("");
19
- const [code, setCode] = useState<number | string>("");
20
- const [value, setValue] = useState<string>("");
21
-
22
- const [isEditMode, setIsEditMode] = useState<boolean>(false);
23
-
24
- const [isModalOpen, setIsModalOpen] = useState(false);
25
-
26
- const [newCode, setNewCode] = useState<number | string>("");
27
- const [newValue, setNewValue] = useState<string>("");
28
-
29
- const [subCode, setSubCode] = useState<number | string>("");
30
- const [subValue, setSubValue] = useState<string>("");
31
-
32
- const [isAddingSubType, setIsAddingSubType] = useState(false);
33
-
34
- const [similarTaxonomies, setSimilarTaxonomies] = useState<any[]>([]);
35
- const [isSimilarTaxonomyOpen, setIsSimilarTaxonomyOpen] = useState(true);
36
-
37
- //for child taxonomies
38
- // nested table
39
- const [allTaxonomies, setAllTaxonomies] = useState<any[]>([]);
40
- const [expandedRows, setExpandedRows] = useState<number[]>([]);
41
-
42
- useEffect(() => {
43
- const fetchAllTaxonomies = async () => {
44
- try {
45
- const fetchedTaxonomies = await fetchTaxonomiessApi(url);
46
- if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
47
- setAllTaxonomies(fetchedTaxonomies);
48
- }
49
- } catch (error) {
50
- console.error("Unable to fetch all taxonomies", error);
51
- }
52
- };
53
-
54
- fetchAllTaxonomies();
55
- }, []);
56
-
57
- const toggleRowExpansion = (taxonomyId: number) => {
58
- setExpandedRows((prevExpandedRows) =>
59
- prevExpandedRows.indexOf(taxonomyId) !== -1
60
- ? prevExpandedRows.filter((id) => id !== taxonomyId)
61
- : [...prevExpandedRows, taxonomyId]
62
- );
63
- };
64
-
65
- const handleDeleteSubTypeClick = async (id: string) => {
66
- try {
67
- await deleteTaxonomyApi(url, id);
68
- alert("Taxonomy deleted successfully");
69
- const fetchedTaxonomies = await fetchTaxonomiessApi(url);
70
-
71
- if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
72
- setAllTaxonomies(fetchedTaxonomies);
73
- }
74
- } catch (error) {
75
- console.error("Error deleting Taxonomy:", error);
76
- alert("Error deleting Taxonomy: " + error.message);
77
- }
78
- };
79
-
80
- const [editTaxonomyItem, setEditTaxonomyItem] = useState<{
81
- id: string;
82
- type: string;
83
- code: string | number;
84
- value: string;
85
- } | null>(null);
86
-
87
- const [selectedTaxonomyId, setSelectedTaxonomyId] = useState<string>("");
88
-
89
- const queryParams = new URLSearchParams(window.location.search);
90
- const id = queryParams.get("id");
91
-
92
- useEffect(() => {
93
- if (id) {
94
- const fetchTaxonomyData = async () => {
95
- try {
96
- const fetchedTaxonomy = await fetchTaxonomyByIdApi(url, id);
97
- if (fetchedTaxonomy) {
98
- const taxonomy = fetchedTaxonomy as {
99
- type: string;
100
- code: string | number;
101
- value: string;
102
- };
103
- setIsEditMode(true);
104
- setType(taxonomy.type);
105
- setCode(taxonomy.code);
106
- setValue(taxonomy.value);
107
- }
108
- } catch (error) {
109
- console.error("Unable to fetch taxonomy data", error);
110
- }
111
- };
112
- fetchTaxonomyData();
113
- }
114
- }, [id]);
115
-
116
- // Fetch similar taxonomies based on the type
117
- useEffect(() => {
118
- const handleFetchSimilarTaxonomies = async () => {
119
- try {
120
- const response = await fetchTaxonomiessApi(url);
121
- const filteredTaxonomies = (response as { type: string }[]).filter(
122
- (taxonomy: { type: string }) => taxonomy.type === type
123
- );
124
- setSimilarTaxonomies(filteredTaxonomies);
125
- } catch (error) {
126
- console.error("Error fetching similar taxonomies", error);
127
- }
128
- };
129
-
130
- if (type) {
131
- handleFetchSimilarTaxonomies();
132
- }
133
- }, [type]);
134
-
135
- useEffect(() => {
136
- if (window.location.pathname === "/taxinomies/taxonomyform") {
137
- setIsSimilarTaxonomyOpen(true);
138
- }
139
- }, []);
140
-
141
- const handleCancelClick = () => {
142
- setType("");
143
- setCode("");
144
- setValue("");
145
- window.history.pushState({}, "", "/admin/taxinomies");
146
- window.dispatchEvent(new PopStateEvent("popstate"));
147
- };
148
-
149
- const handleOpenModal = () => {
150
- setEditTaxonomyItem(null);
151
- // setEditTempTaxonomyItem(null);
152
- setIsModalOpen(true);
153
-
154
- setIsAddingSubType(false);
155
- };
156
-
157
- const handleCloseModal = () => {
158
- setIsModalOpen(false);
159
- setNewCode("");
160
- setNewValue("");
161
- setSubCode("");
162
- setSubValue("");
163
- };
164
-
165
- const handleEditClick = (index: number, id: string) => {
166
- setIsAddingSubType(false);
167
-
168
- const item = similarTaxonomies.find((taxonomy) => taxonomy.id === id);
169
-
170
- if (!item) {
171
- console.error("Taxonomy not found");
172
- return;
173
- }
174
-
175
- setSelectedTaxonomyId(id);
176
- setEditTaxonomyItem(item);
177
- setNewCode(item.code);
178
- setNewValue(item.value);
179
- setIsModalOpen(true);
180
- };
181
-
182
- const handleAddSubType = (index: number, id: string) => {
183
- const item = similarTaxonomies[index];
184
- setSelectedTaxonomyId(id);
185
-
186
- setEditTaxonomyItem(null);
187
-
188
- setNewCode(item.code);
189
- setNewValue(item.value);
190
- setIsModalOpen(true);
191
- setIsAddingSubType(true);
192
- };
193
-
194
- const handleSubTypeSubmitClick = async () => {
195
- if (!subCode || !subValue) {
196
- alert("Please fill out both Code and Value fields before proceeding.");
197
- return;
198
- }
199
-
200
- try {
201
- if (editTaxonomyItem) {
202
- await updateTaxonomyApi(
203
- url,
204
- selectedTaxonomyId,
205
- type,
206
- Number(subCode),
207
- subValue
208
- );
209
- alert("SubType edited successfully");
210
- } else {
211
- await addSubTypeApi(
212
- url,
213
- selectedTaxonomyId,
214
- type,
215
- Number(subCode),
216
- subValue
217
- );
218
- alert("SubType added successfully");
219
- }
220
-
221
- const fetchedTaxonomies = await fetchTaxonomiessApi(url);
222
- if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
223
- setAllTaxonomies(fetchedTaxonomies);
224
- }
225
- } catch (error) {
226
- console.error(
227
- `Error ${editTaxonomyItem ? "editing" : "adding"} SubType:`,
228
- error
229
- );
230
- const errorMessage =
231
- error.response?.data || error.response?.statusText || error.message;
232
-
233
- alert(
234
- `Error while ${
235
- editTaxonomyItem ? "editing" : "adding"
236
- } SubType: ${errorMessage}`
237
- );
238
- setNewCode("");
239
- setNewValue("");
240
- }
241
-
242
- setIsModalOpen(false);
243
- setSubCode("");
244
- setSubValue("");
245
- };
246
-
247
- const handleSubEdit = (child: {
248
- id: string;
249
- type: string;
250
- code: string;
251
- value: string;
252
- }) => {
253
- setSelectedTaxonomyId(child.id);
254
- setEditTaxonomyItem(child);
255
- setSubCode(child.code);
256
- setSubValue(child.value);
257
- setIsModalOpen(true);
258
- setIsAddingSubType(true);
259
- };
260
-
261
- const handleSubmitClick = async () => {
262
- if (!newCode || !newValue) {
263
- alert("Please fill out both Code and Value fields before submitting.");
264
- return;
265
- }
266
-
267
- try {
268
- if (editTaxonomyItem) {
269
- await updateTaxonomyApi(
270
- url,
271
- selectedTaxonomyId,
272
- type,
273
- Number(newCode),
274
- newValue
275
- );
276
- alert("Taxonomy updated successfully");
277
- } else {
278
- await addTaxonomyApi(url, type, Number(newCode), newValue);
279
- alert("Value added successfully");
280
- }
281
-
282
- const response = await fetchTaxonomiessApi(url);
283
- const filteredTaxonomies = (response as { type: string }[]).filter(
284
- (taxonomy: { type: string }) => taxonomy.type === type
285
- );
286
- setSimilarTaxonomies(filteredTaxonomies);
287
- } catch (error) {
288
- console.error(
289
- editTaxonomyItem ? "Error updating Taxonomy:" : "Error adding value:",
290
- error
291
- );
292
- const errorMessage =
293
- error.response?.data || error.response?.statusText || error.message;
294
-
295
- alert(
296
- `Error while ${
297
- editTaxonomyItem ? "editing" : "adding"
298
- } SubType: ${errorMessage}`
299
- );
300
- setNewCode("");
301
- setNewValue("");
302
- }
303
-
304
- setIsModalOpen(false);
305
- setNewCode("");
306
- setNewValue("");
307
- };
308
-
309
- const handleDeleteClick = async (id: string) => {
310
- try {
311
- await deleteTaxonomyApi(url, id);
312
- alert("Taxonomy deleted successfully");
313
- setSimilarTaxonomies((prevTaxonomies) =>
314
- prevTaxonomies.filter((taxonomy) => taxonomy.id !== id)
315
- );
316
- } catch (error) {
317
- console.error("Error deleting Taxonomy:", error);
318
- }
319
- };
320
-
321
- const parentTaxonomies = similarTaxonomies.filter(
322
- (taxonomy) => !taxonomy.parentId
323
- );
324
-
325
- return (
326
- <div
327
- className={`${
328
- isEditMode ? "w-full" : "max-w-4xl"
329
- } p-6 mx-auto dark:bg-gray-800`}
330
- >
331
- <div
332
- className={`transition duration-300 ${
333
- isModalOpen ? "filter blur-sm" : ""
334
- }`}
335
- >
336
- <h1 className="text-3xl font-bold text-center text-blue-600 capitalize dark:text-white mb-4">
337
- {isEditMode ? "Edit Taxonomy" : "Add Taxonomy"}
338
- </h1>
339
-
340
- <h4 className="text-gray-900 dark:text-gray-200 font-semibold">
341
- {isEditMode ? `Taxonomy Type: ${type}` : ""}
342
- </h4>
343
-
344
- {/* Table for Displaying Similar Taxonomies */}
345
- {isSimilarTaxonomyOpen && isEditMode && (
346
- <div className="flex-grow ml-0 mt-4 w-full">
347
- <div className="overflow-hidden border border-gray-200 dark:border-gray-700 md:rounded-lg mt-6">
348
- <table className="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
349
- <thead className="bg-gray-50 dark:bg-gray-800">
350
- <tr>
351
- <th
352
- scope="col"
353
- className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400"
354
- style={{ width: "200px" }}
355
- >
356
- Actions
357
- </th>
358
- <th className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400">
359
- Code
360
- </th>
361
- <th className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400">
362
- Value
363
- </th>
364
- </tr>
365
- </thead>
366
-
367
- <tbody className="divide-y divide-gray-200">
368
- {/* {similarTaxonomies.map((taxonomy, index) => { */}
369
- {parentTaxonomies.map((taxonomy, index) => {
370
- const hasChildren = allTaxonomies.some(
371
- (item) => item.parentId === taxonomy.id
372
- );
373
- return (
374
- <React.Fragment key={taxonomy.id}>
375
- <tr key={index}>
376
- <td className="px-4 py-4 text-sm whitespace-nowrap">
377
- {taxonomy.isEdit && (
378
- <div className="flex items-center gap-x-6">
379
- <button
380
- type="button"
381
- onClick={() => handleDeleteClick(taxonomy.id)}
382
- className="text-gray-500 transition-colors duration-200 dark:hover:text-red-600 dark:text-gray-300 hover:text-red-500 focus:outline-none"
383
- >
384
- <svg
385
- xmlns="http://www.w3.org/2000/svg"
386
- fill="none"
387
- viewBox="0 0 24 24"
388
- strokeWidth="1.5"
389
- stroke="currentColor"
390
- className="w-5 h-5"
391
- >
392
- <path
393
- strokeLinecap="round"
394
- strokeLinejoin="round"
395
- 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"
396
- />
397
- </svg>
398
- </button>
399
-
400
- <button
401
- type="button"
402
- onClick={() =>
403
- handleEditClick(index, taxonomy.id)
404
- }
405
- className="text-gray-500 transition-colors duration-200 dark:hover:text-yellow-500 dark:text-gray-300 hover:text-yellow-500 focus:outline-none"
406
- >
407
- <svg
408
- xmlns="http://www.w3.org/2000/svg"
409
- fill="none"
410
- viewBox="0 0 24 24"
411
- strokeWidth="1.5"
412
- stroke="currentColor"
413
- className="w-5 h-5"
414
- >
415
- <path
416
- strokeLinecap="round"
417
- strokeLinejoin="round"
418
- 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"
419
- />
420
- </svg>
421
- </button>
422
-
423
- <button
424
- type="button"
425
- onClick={() =>
426
- handleAddSubType(index, taxonomy.id)
427
- }
428
- className="text-gray-500 transition-colors duration-200 dark:hover:text-blue-500 dark:text-gray-300 hover:text-blue-500 focus:outline-none"
429
- >
430
- <svg
431
- xmlns="http://www.w3.org/2000/svg"
432
- fill="none"
433
- viewBox="0 0 24 24"
434
- strokeWidth="1.5"
435
- stroke="currentColor"
436
- className="w-5 h-5"
437
- >
438
- <path
439
- strokeLinecap="round"
440
- strokeLinejoin="round"
441
- d="M12 4.5v15m7.5-7.5h-15"
442
- />
443
- </svg>
444
- </button>
445
- {hasChildren && (
446
- <button
447
- type="button"
448
- onClick={() =>
449
- toggleRowExpansion(taxonomy.id)
450
- }
451
- className="text-gray-500 transition-colors duration-200 dark:hover:text-blue-600 dark:text-gray-300 hover:text-blue-500 focus:outline-none"
452
- >
453
- {expandedRows.indexOf(taxonomy.id) !==
454
- -1 ? (
455
- <svg
456
- xmlns="http://www.w3.org/2000/svg"
457
- fill="none"
458
- viewBox="0 0 24 24"
459
- strokeWidth="1.5"
460
- stroke="currentColor"
461
- className="w-5 h-5"
462
- >
463
- <path
464
- strokeLinecap="round"
465
- strokeLinejoin="round"
466
- d="M19.5 15.75l-7.5-7.5-7.5 7.5"
467
- />
468
- </svg>
469
- ) : (
470
- <svg
471
- xmlns="http://www.w3.org/2000/svg"
472
- fill="none"
473
- viewBox="0 0 24 24"
474
- strokeWidth="1.5"
475
- stroke="currentColor"
476
- className="w-5 h-5"
477
- >
478
- <path
479
- strokeLinecap="round"
480
- strokeLinejoin="round"
481
- d="M19.5 8.25l-7.5 7.5-7.5-7.5"
482
- />
483
- </svg>
484
- )}
485
- </button>
486
- )}
487
- </div>
488
- )}
489
- </td>
490
-
491
- <td className="px-4 py-4 text-sm text-gray-500 dark:text-gray-400">
492
- {taxonomy.code}
493
- </td>
494
- <td className="px-4 py-4 text-sm font-medium text-gray-900 dark:text-white">
495
- <div className="flex justify-between items-center">
496
- <span>{taxonomy.value}</span>
497
- </div>
498
- </td>
499
- </tr>
500
-
501
- {/* Nested Table */}
502
- {expandedRows.indexOf(taxonomy.id) !== -1 && (
503
- <tr>
504
- <td colSpan={3}>
505
- <table className="min-w-full divide-y ">
506
- <thead className="bg-gray-50 dark:bg-gray-800">
507
- <tr>
508
- {similarTaxonomies.some(
509
- (taxonomy) => taxonomy.isEdit
510
- ) && (
511
- <th
512
- scope="col"
513
- className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400"
514
- style={{ width: "200px" }}
515
- >
516
- Actions
517
- </th>
518
- )}
519
- <th
520
- scope="col"
521
- style={{ width: "350px" }}
522
- className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400 w-[23%]"
523
- >
524
- Code
525
- </th>
526
- <th className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400">
527
- Value
528
- </th>
529
- </tr>
530
- </thead>
531
- <tbody>
532
- {allTaxonomies
533
- .filter(
534
- (item) => item.parentId === taxonomy.id
535
- )
536
- .map((child, key) => (
537
- <tr key={key}>
538
- {similarTaxonomies.some(
539
- (taxonomy) => taxonomy.isEdit
540
- ) && (
541
- <td className="px-4 py-4 text-sm whitespace-nowrap">
542
- <div className="flex items-center gap-x-6">
543
- <button
544
- type="button"
545
- onClick={() =>
546
- handleDeleteSubTypeClick(
547
- child.id
548
- )
549
- }
550
- className="text-gray-500 transition-colors duration-200 dark:hover:text-red-600 dark:text-gray-300 hover:text-red-500 focus:outline-none"
551
- >
552
- <svg
553
- xmlns="http://www.w3.org/2000/svg"
554
- fill="none"
555
- viewBox="0 0 24 24"
556
- strokeWidth="1.5"
557
- stroke="currentColor"
558
- className="w-5 h-5"
559
- >
560
- <path
561
- strokeLinecap="round"
562
- strokeLinejoin="round"
563
- 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"
564
- />
565
- </svg>
566
- </button>
567
-
568
- <button
569
- onClick={() =>
570
- handleSubEdit(child)
571
- }
572
- className="text-gray-500 transition-colors duration-200 dark:hover:text-yellow-500 dark:text-gray-300 hover:text-yellow-500 focus:outline-none"
573
- >
574
- <svg
575
- xmlns="http://www.w3.org/2000/svg"
576
- fill="none"
577
- viewBox="0 0 24 24"
578
- strokeWidth="1.5"
579
- stroke="currentColor"
580
- className="w-5 h-5"
581
- >
582
- <path
583
- strokeLinecap="round"
584
- strokeLinejoin="round"
585
- 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"
586
- />
587
- </svg>
588
- </button>
589
- </div>
590
- </td>
591
- )}
592
- <td className="px-4 py-2 text-sm text-gray-500 dark:text-gray-400">
593
- {child.code}
594
- </td>
595
- <td className="px-4 py-4 text-sm font-medium text-gray-900 dark:text-white">
596
- {child.value}
597
- </td>
598
- </tr>
599
- ))}
600
- </tbody>
601
- </table>
602
- </td>
603
- </tr>
604
- )}
605
- </React.Fragment>
606
- );
607
- })}
608
- </tbody>
609
- </table>
610
- </div>
611
-
612
- <div className="flex space-x-4 mt-6 justify-start">
613
- {similarTaxonomies.some(
614
- (taxonomy) => taxonomy.isEdit && taxonomy.isMultiple
615
- ) && (
616
- <button
617
- type="button"
618
- onClick={handleOpenModal}
619
- className="flex items-center justify-center px-6 py-2 font-medium tracking-wide text-white capitalize transition-colors duration-300 transform bg-blue-600 rounded-lg hover:bg-blue-500 focus:outline-none focus:ring focus:ring-blue-300 focus:ring-opacity-80"
620
- >
621
- <FaPlus className="mr-2 font-medium" />
622
- Add Value
623
- </button>
624
- )}
625
- <button
626
- onClick={handleCancelClick}
627
- type="button"
628
- 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"
629
- >
630
- Cancel
631
- </button>
632
- </div>
633
- </div>
634
- )}
635
- </div>
636
-
637
- {/* Drawer */}
638
- <div
639
- className={`fixed inset-y-0 right-0 z-50 w-1/3 bg-white dark:bg-gray-800 p-6 shadow-lg transform ${
640
- isModalOpen ? "translate-x-0" : "translate-x-full"
641
- } transition-transform duration-300`}
642
- >
643
- <div className="p-6">
644
- <div className="flex justify-between">
645
- <h2 className="text-xl font-bold text-blue-600 mb-4 ">
646
- {isAddingSubType
647
- ? editTaxonomyItem
648
- ? "Edit SubType"
649
- : "Add SubType"
650
- : editTaxonomyItem
651
- ? "Edit Values"
652
- : "Add Values"}
653
- </h2>
654
- <button
655
- onClick={handleCloseModal}
656
- className="text-xl text-gray-600 dark:text-gray-400 h-6 w-6"
657
- >
658
- &times;
659
- </button>
660
- </div>
661
-
662
- {isAddingSubType ? (
663
- <>
664
- <label className="text-gray-900 dark:text-gray-200 font-semibold">
665
- Code
666
- </label>
667
- <input
668
- type="number"
669
- value={subCode}
670
- onChange={(e) => setSubCode(e.target.value)}
671
- placeholder="Enter Code"
672
- className="w-full px-4 py-2 mt-2 mb-4 border border-gray-300 rounded-md"
673
- />
674
- <label className="text-gray-900 dark:text-gray-200 font-semibold">
675
- Value
676
- </label>
677
- <input
678
- type="text"
679
- value={subValue}
680
- onChange={(e) => setSubValue(e.target.value)}
681
- placeholder="Enter Value"
682
- className="w-full px-4 py-2 mt-2 mb-4 border border-gray-300 rounded-md"
683
- />
684
- <div className="flex space-x-4 justify-end">
685
- <button
686
- onClick={handleSubTypeSubmitClick}
687
- 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"
688
- >
689
- {editTaxonomyItem ? "Edit" : "Add"}
690
- </button>
691
- <button
692
- onClick={handleCloseModal}
693
- className="px-8 py-2.5 leading-5 bg-gray-300 rounded-md"
694
- >
695
- Cancel
696
- </button>
697
- </div>
698
- </>
699
- ) : (
700
- <>
701
- <label className="text-gray-900 dark:text-gray-200 font-semibold">
702
- Code
703
- </label>
704
- <input
705
- type="number"
706
- value={newCode}
707
- onChange={(e) => setNewCode(e.target.value)}
708
- placeholder="Enter Code"
709
- className="w-full px-4 py-2 mt-2 mb-4 border border-gray-300 rounded-md"
710
- />
711
- <label className="text-gray-900 dark:text-gray-200 font-semibold">
712
- Value
713
- </label>
714
- <input
715
- type="text"
716
- value={newValue}
717
- onChange={(e) => setNewValue(e.target.value)}
718
- placeholder="Enter Value"
719
- className="w-full px-4 py-2 mt-2 mb-4 border border-gray-300 rounded-md"
720
- />
721
-
722
- <div className="flex space-x-4 justify-end">
723
- <button
724
- onClick={handleSubmitClick}
725
- 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"
726
- >
727
- {editTaxonomyItem ? "Edit" : "Add"}
728
- </button>
729
- <button
730
- onClick={handleCloseModal}
731
- className="px-8 py-2.5 leading-5 bg-gray-300 rounded-md"
732
- >
733
- Cancel
734
- </button>
735
- </div>
736
- </>
737
- )}
738
- </div>
739
- </div>
740
- </div>
741
- );
742
- };
743
-
744
- export default TaxonomyForm;