eleven-solutions-common-website-unique-web 3.0.24 → 3.0.26
Sign up to get free protection for your applications and to get access to all the features.
@@ -72,10 +72,25 @@ const TaxonomyForm = () => {
|
|
72
72
|
handleFetchSimilarTaxonomies();
|
73
73
|
}
|
74
74
|
}, [type]);
|
75
|
+
// useEffect(() => {
|
76
|
+
// if (window.location.pathname === "/taxinomies/taxonomyform") {
|
77
|
+
// setIsSimilarTaxonomyOpen(true);
|
78
|
+
// }
|
79
|
+
// }, []);
|
75
80
|
useEffect(() => {
|
76
|
-
|
77
|
-
|
78
|
-
|
81
|
+
const handleLocationChange = () => {
|
82
|
+
if (window.location.pathname === "/taxonomy/taxonomyform") {
|
83
|
+
setIsSimilarTaxonomyOpen(true);
|
84
|
+
}
|
85
|
+
else {
|
86
|
+
setIsSimilarTaxonomyOpen(false);
|
87
|
+
}
|
88
|
+
};
|
89
|
+
handleLocationChange();
|
90
|
+
window.addEventListener("popstate", handleLocationChange);
|
91
|
+
return () => {
|
92
|
+
window.removeEventListener("popstate", handleLocationChange);
|
93
|
+
};
|
79
94
|
}, []);
|
80
95
|
const handleSubmit = (event) => __awaiter(void 0, void 0, void 0, function* () {
|
81
96
|
event.preventDefault();
|
@@ -141,8 +156,17 @@ const TaxonomyForm = () => {
|
|
141
156
|
console.error("Error checking if taxonomy is multiple:", error);
|
142
157
|
}
|
143
158
|
});
|
144
|
-
|
145
|
-
|
159
|
+
const handleLocationOrTypeChange = () => {
|
160
|
+
if (window.location.pathname === "/taxonomy/taxonomyform") {
|
161
|
+
fetchIsMultiple();
|
162
|
+
}
|
163
|
+
};
|
164
|
+
handleLocationOrTypeChange();
|
165
|
+
window.addEventListener("popstate", handleLocationOrTypeChange);
|
166
|
+
return () => {
|
167
|
+
window.removeEventListener("popstate", handleLocationOrTypeChange);
|
168
|
+
};
|
169
|
+
}, [type]);
|
146
170
|
const handleCancelClick = () => {
|
147
171
|
setType("");
|
148
172
|
setCode("");
|
@@ -236,7 +260,7 @@ const TaxonomyForm = () => {
|
|
236
260
|
console.error("Error deleting Taxonomy:", error);
|
237
261
|
}
|
238
262
|
});
|
239
|
-
return (_jsxs("div", { className: `${isEditMode && isMultiple ? "w-full" : "max-w-4xl"} p-6 mx-auto dark:bg-gray-800`, children: [_jsxs("div", { className: `transition duration-300 ${isModalOpen ? "filter blur-sm" : ""}`, children: [_jsx("h1", { className: "text-3xl font-bold text-center text-blue-600 capitalize dark:text-white mb-4", children: isEditMode ? "Edit Taxonomy" : "Add Taxonomy" }), _jsx("h1", { className: "text-2xl text-blue-600 capitalize dark:text-white mb-4", children: isEditMode ? `Taxonomy Type: ${type}` : "" }),
|
263
|
+
return (_jsxs("div", { className: `${isEditMode && isMultiple ? "w-full" : "max-w-4xl"} p-6 mx-auto dark:bg-gray-800`, children: [_jsxs("div", { className: `transition duration-300 ${isModalOpen ? "filter blur-sm" : ""}`, children: [_jsx("h1", { className: "text-3xl font-bold text-center text-blue-600 capitalize dark:text-white mb-4", children: isEditMode ? "Edit Taxonomy" : "Add Taxonomy" }), _jsx("h1", { className: "text-2xl text-blue-600 capitalize dark:text-white mb-4", children: isEditMode ? `Taxonomy Type: ${type}` : "" }), _jsxs("form", { children: [!isEditMode && (_jsxs("div", { className: "mb-6 w-full", children: [_jsxs("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: ["Type ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx("input", { required: true, value: type, onChange: (e) => setType(e.target.value), type: "text", className: "w-full px-4 py-2 mt-2 text-gray-800 bg-white border border-gray-400 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-800 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring", placeholder: "Enter Type" })] })), _jsxs("div", { className: "mb-6 w-full", children: [_jsxs("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: ["Code ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx("input", { required: true, value: code, onChange: (e) => setCode(e.target.value === "" ? "" : Number(e.target.value)), type: "number", className: "w-full px-4 py-2 mt-2 text-gray-800 bg-white border border-gray-400 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-800 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring", placeholder: "Enter Code", disabled: similarTaxonomies.some((taxonomy) => taxonomy.isEdit === false) })] }), _jsxs("div", { className: "mb-6 w-full", children: [_jsxs("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: ["Value ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx("input", { required: true, value: value, onChange: (e) => setValue(e.target.value), type: "text", className: "w-full px-4 py-2 mt-2 text-gray-800 bg-white border border-gray-400 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-800 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring", placeholder: "Enter Value", disabled: similarTaxonomies.some((taxonomy) => taxonomy.isEdit === false) })] }), _jsxs("div", { className: "flex space-x-4 mt-6 justify-between", children: [_jsx("div", { children: isEditMode && (
|
240
264
|
// <div>
|
241
265
|
// {similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (
|
242
266
|
// <button
|
@@ -255,7 +279,7 @@ const TaxonomyForm = () => {
|
|
255
279
|
handleDeleteClick(id);
|
256
280
|
window.location.href = "/admin/taxinomies";
|
257
281
|
}, 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: "Delete" })) })) }), _jsxs("div", { className: "flex space-x-4 justify-end", children: [similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (_jsx("button", { type: "submit", onClick: handleSave, 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: isEditMode ? "Save" : "Add" })), !similarTaxonomies.some((taxonomy) => taxonomy.isEdit) &&
|
258
|
-
!isEditMode && (_jsx("button", { type: "submit", onClick: handleSave, 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: isEditMode ? "Save" : "Add" })), _jsx("button", { onClick: handleCancelClick, type: "button", 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: "Cancel" })] })] })] })
|
282
|
+
!isEditMode && (_jsx("button", { type: "submit", onClick: handleSave, 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: isEditMode ? "Save" : "Add" })), _jsx("button", { onClick: handleCancelClick, type: "button", 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: "Cancel" })] })] })] }), isSimilarTaxonomyOpen && isMultiple && isEditMode && (_jsxs("div", { className: "flex-grow ml-0 mt-4 w-full", children: [_jsx("div", { className: "overflow-hidden border border-gray-200 dark:border-gray-700 md:rounded-lg mt-6", children: _jsxs("table", { className: "min-w-full divide-y divide-gray-200 dark:divide-gray-700", children: [_jsx("thead", { className: "bg-gray-50 dark:bg-gray-800", children: _jsxs("tr", { children: [similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (_jsx("th", { className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: "Actions" })), _jsx("th", { className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: "Code" }), _jsx("th", { className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: "Value" })] }) }), _jsx("tbody", { className: "divide-y divide-gray-200", children: similarTaxonomies.map((taxonomy, index) => (_jsxs("tr", { children: [similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (_jsx("td", { className: "px-4 py-4 text-sm whitespace-nowrap", children: _jsxs("div", { className: "flex items-center gap-x-6", children: [_jsx("button", { type: "button", onClick: () => handleDeleteClick(taxonomy.id), className: "text-gray-500 transition-colors duration-200 dark:hover:text-red-600 dark:text-gray-300 hover:text-red-500 focus:outline-none", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", 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" }) }) }), _jsx("button", { type: "button", onClick: () => {
|
259
283
|
handleEditClick(index, taxonomy.id);
|
260
284
|
}, className: "text-gray-500 transition-colors duration-200 dark:hover:text-yellow-500 dark:text-gray-300 hover:text-yellow-500 focus:outline-none", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", 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" }) }) })] }) })), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-400", children: taxonomy.code }), _jsx("td", { className: "px-4 py-4 text-sm font-medium text-gray-900 dark:text-white", children: taxonomy.value })] }, index))) })] }) }), similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (_jsx("div", { className: "flex space-x-4 mt-6 justify-start", children: _jsxs("button", { type: "button", onClick: handleOpenModal, 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", children: [_jsx(FaPlus, { className: "mr-2 font-medium" }), "Add Multiple Values"] }) }))] })), isEditMode && (_jsx(_Fragment, { children: tempTaxonomy.length > 0 && (_jsxs("div", { className: "flex-grow ml-0 mt-4 w-full", children: [_jsx("div", { className: "overflow-hidden border border-gray-200 dark:border-gray-700 md:rounded-lg mt-6", children: _jsxs("table", { className: "min-w-full divide-y divide-gray-200 dark:divide-gray-700", children: [_jsx("thead", { className: "bg-gray-50 dark:bg-gray-800", children: _jsxs("tr", { children: [_jsx("th", { scope: "col", className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: "Edit/Delete" }), _jsx("th", { scope: "col", className: "px-4 py-3.5 text-md font-normal text-left text-gray-500 dark:text-gray-400", children: "Code" }), _jsx("th", { scope: "col", className: "px-4 py-3.5 text-md font-normal text-left text-gray-500 dark:text-gray-400", children: "Value" })] }) }), _jsx("tbody", { className: "bg-white divide-y divide-gray-200 dark:bg-gray-800 dark:divide-gray-700", children: [...tempTaxonomy].map((item, index) => (_jsxs("tr", { children: [_jsx("td", { className: "px-4 py-4 text-sm whitespace-nowrap", children: _jsxs("div", { className: "flex items-center gap-x-6", children: [_jsx("button", { type: "button", onClick: () => {
|
261
285
|
const newTempTaxonomy = [...tempTaxonomy];
|
package/package.json
CHANGED
@@ -101,10 +101,28 @@ const TaxonomyForm = () => {
|
|
101
101
|
}
|
102
102
|
}, [type]);
|
103
103
|
|
104
|
+
// useEffect(() => {
|
105
|
+
// if (window.location.pathname === "/taxinomies/taxonomyform") {
|
106
|
+
// setIsSimilarTaxonomyOpen(true);
|
107
|
+
// }
|
108
|
+
// }, []);
|
109
|
+
|
104
110
|
useEffect(() => {
|
105
|
-
|
106
|
-
|
107
|
-
|
111
|
+
const handleLocationChange = () => {
|
112
|
+
if (window.location.pathname === "/taxonomy/taxonomyform") {
|
113
|
+
setIsSimilarTaxonomyOpen(true);
|
114
|
+
} else {
|
115
|
+
setIsSimilarTaxonomyOpen(false);
|
116
|
+
}
|
117
|
+
};
|
118
|
+
|
119
|
+
handleLocationChange();
|
120
|
+
|
121
|
+
window.addEventListener("popstate", handleLocationChange);
|
122
|
+
|
123
|
+
return () => {
|
124
|
+
window.removeEventListener("popstate", handleLocationChange);
|
125
|
+
};
|
108
126
|
}, []);
|
109
127
|
|
110
128
|
const handleSubmit = async (event: React.MouseEvent<HTMLButtonElement>) => {
|
@@ -171,8 +189,20 @@ const TaxonomyForm = () => {
|
|
171
189
|
}
|
172
190
|
};
|
173
191
|
|
174
|
-
|
175
|
-
|
192
|
+
const handleLocationOrTypeChange = () => {
|
193
|
+
if (window.location.pathname === "/taxonomy/taxonomyform") {
|
194
|
+
fetchIsMultiple();
|
195
|
+
}
|
196
|
+
};
|
197
|
+
|
198
|
+
handleLocationOrTypeChange();
|
199
|
+
|
200
|
+
window.addEventListener("popstate", handleLocationOrTypeChange);
|
201
|
+
|
202
|
+
return () => {
|
203
|
+
window.removeEventListener("popstate", handleLocationOrTypeChange);
|
204
|
+
};
|
205
|
+
}, [type]);
|
176
206
|
|
177
207
|
const handleCancelClick = () => {
|
178
208
|
setType("");
|
@@ -307,123 +337,123 @@ const TaxonomyForm = () => {
|
|
307
337
|
{isEditMode ? `Taxonomy Type: ${type}` : ""}
|
308
338
|
</h1>
|
309
339
|
|
310
|
-
{!isMultiple && (
|
311
|
-
|
312
|
-
|
313
|
-
<div className="mb-6 w-full">
|
314
|
-
<label className="text-gray-900 dark:text-gray-200 font-semibold">
|
315
|
-
Type <span className="text-red-500">*</span>
|
316
|
-
</label>
|
317
|
-
<input
|
318
|
-
required
|
319
|
-
value={type}
|
320
|
-
onChange={(e) => setType(e.target.value)}
|
321
|
-
type="text"
|
322
|
-
className="w-full px-4 py-2 mt-2 text-gray-800 bg-white border border-gray-400 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-800 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring"
|
323
|
-
placeholder="Enter Type"
|
324
|
-
/>
|
325
|
-
</div>
|
326
|
-
)}
|
327
|
-
<div className="mb-6 w-full">
|
328
|
-
<label className="text-gray-900 dark:text-gray-200 font-semibold">
|
329
|
-
Code <span className="text-red-500">*</span>
|
330
|
-
</label>
|
331
|
-
<input
|
332
|
-
required
|
333
|
-
value={code}
|
334
|
-
onChange={(e) =>
|
335
|
-
setCode(e.target.value === "" ? "" : Number(e.target.value))
|
336
|
-
}
|
337
|
-
type="number"
|
338
|
-
className="w-full px-4 py-2 mt-2 text-gray-800 bg-white border border-gray-400 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-800 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring"
|
339
|
-
placeholder="Enter Code"
|
340
|
-
disabled={similarTaxonomies.some(
|
341
|
-
(taxonomy) => taxonomy.isEdit === false
|
342
|
-
)}
|
343
|
-
/>
|
344
|
-
</div>
|
340
|
+
{/* {!isMultiple && ( */}
|
341
|
+
<form>
|
342
|
+
{!isEditMode && (
|
345
343
|
<div className="mb-6 w-full">
|
346
344
|
<label className="text-gray-900 dark:text-gray-200 font-semibold">
|
347
|
-
|
345
|
+
Type <span className="text-red-500">*</span>
|
348
346
|
</label>
|
349
347
|
<input
|
350
348
|
required
|
351
|
-
value={
|
352
|
-
onChange={(e) =>
|
349
|
+
value={type}
|
350
|
+
onChange={(e) => setType(e.target.value)}
|
353
351
|
type="text"
|
354
352
|
className="w-full px-4 py-2 mt-2 text-gray-800 bg-white border border-gray-400 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-800 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring"
|
355
|
-
placeholder="Enter
|
356
|
-
disabled={similarTaxonomies.some(
|
357
|
-
(taxonomy) => taxonomy.isEdit === false
|
358
|
-
)}
|
353
|
+
placeholder="Enter Type"
|
359
354
|
/>
|
360
355
|
</div>
|
356
|
+
)}
|
357
|
+
<div className="mb-6 w-full">
|
358
|
+
<label className="text-gray-900 dark:text-gray-200 font-semibold">
|
359
|
+
Code <span className="text-red-500">*</span>
|
360
|
+
</label>
|
361
|
+
<input
|
362
|
+
required
|
363
|
+
value={code}
|
364
|
+
onChange={(e) =>
|
365
|
+
setCode(e.target.value === "" ? "" : Number(e.target.value))
|
366
|
+
}
|
367
|
+
type="number"
|
368
|
+
className="w-full px-4 py-2 mt-2 text-gray-800 bg-white border border-gray-400 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-800 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring"
|
369
|
+
placeholder="Enter Code"
|
370
|
+
disabled={similarTaxonomies.some(
|
371
|
+
(taxonomy) => taxonomy.isEdit === false
|
372
|
+
)}
|
373
|
+
/>
|
374
|
+
</div>
|
375
|
+
<div className="mb-6 w-full">
|
376
|
+
<label className="text-gray-900 dark:text-gray-200 font-semibold">
|
377
|
+
Value <span className="text-red-500">*</span>
|
378
|
+
</label>
|
379
|
+
<input
|
380
|
+
required
|
381
|
+
value={value}
|
382
|
+
onChange={(e) => setValue(e.target.value)}
|
383
|
+
type="text"
|
384
|
+
className="w-full px-4 py-2 mt-2 text-gray-800 bg-white border border-gray-400 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-800 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring"
|
385
|
+
placeholder="Enter Value"
|
386
|
+
disabled={similarTaxonomies.some(
|
387
|
+
(taxonomy) => taxonomy.isEdit === false
|
388
|
+
)}
|
389
|
+
/>
|
390
|
+
</div>
|
361
391
|
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
<button
|
382
|
-
type="button"
|
383
|
-
onClick={() => {
|
384
|
-
handleDeleteClick(id);
|
385
|
-
window.location.href = "/admin/taxinomies";
|
386
|
-
}}
|
387
|
-
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"
|
388
|
-
>
|
389
|
-
Delete
|
390
|
-
</button>
|
391
|
-
)}
|
392
|
-
</div>
|
393
|
-
)}
|
394
|
-
</div>
|
395
|
-
|
396
|
-
<div className="flex space-x-4 justify-end">
|
397
|
-
{similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (
|
398
|
-
<button
|
399
|
-
type="submit"
|
400
|
-
onClick={handleSave}
|
401
|
-
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"
|
402
|
-
>
|
403
|
-
{isEditMode ? "Save" : "Add"}
|
404
|
-
</button>
|
405
|
-
)}
|
406
|
-
{!similarTaxonomies.some((taxonomy) => taxonomy.isEdit) &&
|
407
|
-
!isEditMode && (
|
392
|
+
<div className="flex space-x-4 mt-6 justify-between">
|
393
|
+
<div>
|
394
|
+
{isEditMode && (
|
395
|
+
// <div>
|
396
|
+
// {similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (
|
397
|
+
// <button
|
398
|
+
// type="button"
|
399
|
+
// onClick={() => {
|
400
|
+
// handleDeleteClick(id);
|
401
|
+
// navigate("/admin/taxonomy");
|
402
|
+
// }}
|
403
|
+
// 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"
|
404
|
+
// >
|
405
|
+
// Delete
|
406
|
+
// </button>
|
407
|
+
// )}
|
408
|
+
// </div>
|
409
|
+
<div>
|
410
|
+
{similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (
|
408
411
|
<button
|
409
|
-
type="
|
410
|
-
onClick={
|
412
|
+
type="button"
|
413
|
+
onClick={() => {
|
414
|
+
handleDeleteClick(id);
|
415
|
+
window.location.href = "/admin/taxinomies";
|
416
|
+
}}
|
411
417
|
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"
|
412
418
|
>
|
413
|
-
|
419
|
+
Delete
|
414
420
|
</button>
|
415
421
|
)}
|
422
|
+
</div>
|
423
|
+
)}
|
424
|
+
</div>
|
425
|
+
|
426
|
+
<div className="flex space-x-4 justify-end">
|
427
|
+
{similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (
|
416
428
|
<button
|
417
|
-
|
418
|
-
|
429
|
+
type="submit"
|
430
|
+
onClick={handleSave}
|
419
431
|
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"
|
420
432
|
>
|
421
|
-
|
433
|
+
{isEditMode ? "Save" : "Add"}
|
422
434
|
</button>
|
423
|
-
|
435
|
+
)}
|
436
|
+
{!similarTaxonomies.some((taxonomy) => taxonomy.isEdit) &&
|
437
|
+
!isEditMode && (
|
438
|
+
<button
|
439
|
+
type="submit"
|
440
|
+
onClick={handleSave}
|
441
|
+
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"
|
442
|
+
>
|
443
|
+
{isEditMode ? "Save" : "Add"}
|
444
|
+
</button>
|
445
|
+
)}
|
446
|
+
<button
|
447
|
+
onClick={handleCancelClick}
|
448
|
+
type="button"
|
449
|
+
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"
|
450
|
+
>
|
451
|
+
Cancel
|
452
|
+
</button>
|
424
453
|
</div>
|
425
|
-
</
|
426
|
-
|
454
|
+
</div>
|
455
|
+
</form>
|
456
|
+
{/* )} */}
|
427
457
|
|
428
458
|
{/* Table for Displaying Similar Taxonomies */}
|
429
459
|
{isSimilarTaxonomyOpen && isMultiple && isEditMode && (
|