eleven-solutions-common-website-unique-web 21.0.26 → 21.0.28

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.
@@ -14,7 +14,6 @@ import { addTaxonomyApi, fetchTaxonomyByIdApi, updateTaxonomyApi, fetchTaxonomie
14
14
  import { FaPlus } from "react-icons/fa";
15
15
  const TaxonomyForm = ({ url }) => {
16
16
  const [type, setType] = useState("");
17
- // const [inputType] = useState<string>("");
18
17
  const [code, setCode] = useState("");
19
18
  const [value, setValue] = useState("");
20
19
  const [isEditMode, setIsEditMode] = useState(false);
@@ -168,42 +167,78 @@ const TaxonomyForm = ({ url }) => {
168
167
  setIsModalOpen(true);
169
168
  setIsAddingSubType(true);
170
169
  };
171
- const handleSubTypeAddClick = () => __awaiter(void 0, void 0, void 0, function* () {
170
+ const handleSubTypeSubmitClick = () => __awaiter(void 0, void 0, void 0, function* () {
172
171
  if (!subCode || !subValue) {
173
- alert("Please fill out both Code and Value fields before adding.");
172
+ alert("Please fill out both Code and Value fields before proceeding.");
174
173
  return;
175
174
  }
176
175
  try {
177
- yield addSubTypeApi(url, selectedTaxonomyId, type, Number(subCode), subValue);
178
- alert("SubType added successfully");
179
- const fetchedTaxonomies = yield fetchTaxonomiessApi(url);
180
- if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
181
- setAllTaxonomies(fetchedTaxonomies);
176
+ if (editTaxonomyItem) {
177
+ yield updateTaxonomyApi(url, selectedTaxonomyId, type, Number(subCode), subValue);
178
+ alert("SubType edited successfully");
179
+ }
180
+ else {
181
+ yield addSubTypeApi(url, selectedTaxonomyId, type, Number(subCode), subValue);
182
+ alert("SubType added successfully");
182
183
  }
183
- }
184
- catch (error) {
185
- console.error("Error adding SubType:", error);
186
- }
187
- setIsModalOpen(false);
188
- setSubCode("");
189
- setSubValue("");
190
- });
191
- const handleSubTypeEditClick = () => __awaiter(void 0, void 0, void 0, function* () {
192
- try {
193
- yield updateTaxonomyApi(url, selectedTaxonomyId, type, Number(subCode), subValue);
194
- alert("SubType edited successfully");
195
184
  const fetchedTaxonomies = yield fetchTaxonomiessApi(url);
196
185
  if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
197
186
  setAllTaxonomies(fetchedTaxonomies);
198
187
  }
199
188
  }
200
189
  catch (error) {
201
- console.error("Error editing SubType:", error);
190
+ console.error(`Error ${editTaxonomyItem ? "editing" : "adding"} SubType:`, error);
202
191
  }
203
192
  setIsModalOpen(false);
204
193
  setSubCode("");
205
194
  setSubValue("");
206
195
  });
196
+ // const handleSubTypeAddClick = async () => {
197
+ // if (!subCode || !subValue) {
198
+ // alert("Please fill out both Code and Value fields before adding.");
199
+ // return;
200
+ // }
201
+ // try {
202
+ // await addSubTypeApi(
203
+ // url,
204
+ // selectedTaxonomyId,
205
+ // type,
206
+ // Number(subCode),
207
+ // subValue
208
+ // );
209
+ // alert("SubType added successfully");
210
+ // const fetchedTaxonomies = await fetchTaxonomiessApi(url);
211
+ // if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
212
+ // setAllTaxonomies(fetchedTaxonomies);
213
+ // }
214
+ // } catch (error) {
215
+ // console.error("Error adding SubType:", error);
216
+ // }
217
+ // setIsModalOpen(false);
218
+ // setSubCode("");
219
+ // setSubValue("");
220
+ // };
221
+ // const handleSubTypeEditClick = async () => {
222
+ // try {
223
+ // await updateTaxonomyApi(
224
+ // url,
225
+ // selectedTaxonomyId,
226
+ // type,
227
+ // Number(subCode),
228
+ // subValue
229
+ // );
230
+ // alert("SubType edited successfully");
231
+ // const fetchedTaxonomies = await fetchTaxonomiessApi(url);
232
+ // if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
233
+ // setAllTaxonomies(fetchedTaxonomies);
234
+ // }
235
+ // } catch (error) {
236
+ // console.error("Error editing SubType:", error);
237
+ // }
238
+ // setIsModalOpen(false);
239
+ // setSubCode("");
240
+ // setSubValue("");
241
+ // };
207
242
  const handleSubEdit = (child) => {
208
243
  setSelectedTaxonomyId(child.id);
209
244
  setEditTaxonomyItem(child);
@@ -263,14 +298,18 @@ const TaxonomyForm = ({ url }) => {
263
298
  -1 ? (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 15.75l-7.5-7.5-7.5 7.5" }) })) : (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) })) }))] })) }), _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: _jsx("div", { className: "flex justify-between items-center", children: _jsx("span", { children: taxonomy.value }) }) })] }, index), expandedRows.indexOf(taxonomy.id) !== -1 && (_jsx("tr", { children: _jsx("td", { colSpan: 3, children: _jsxs("table", { className: "min-w-full divide-y ", children: [_jsx("thead", { className: "bg-gray-50 dark:bg-gray-800", children: _jsxs("tr", { children: [similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (_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", style: { width: "200px" }, children: "Actions" })), _jsx("th", { scope: "col", style: { width: "350px" }, className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400 w-[23%]", 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", { children: allTaxonomies
264
299
  .filter((item) => item.parentId === taxonomy.id)
265
300
  .map((child, key) => (_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: () => handleDeleteSubTypeClick(child.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", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "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", { onClick: () => handleSubEdit(child), 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", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "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-2 text-sm text-gray-500 dark:text-gray-400", children: child.code }), _jsx("td", { className: "px-4 py-4 text-sm font-medium text-gray-900 dark:text-white", children: child.value })] }, key))) })] }) }) }))] }, taxonomy.id));
266
- }) })] }) }), similarTaxonomies.some((taxonomy) => taxonomy.isEdit && taxonomy.isMultiple) && (_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"] }) }))] })), _jsx("div", { className: "flex space-x-4 mt-6 justify-start", children: _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" }) })] }), _jsx("div", { className: `fixed inset-y-0 right-0 z-50 w-1/3 bg-white dark:bg-gray-800 p-6 shadow-lg transform ${isModalOpen ? "translate-x-0" : "translate-x-full"} transition-transform duration-300`, children: _jsxs("div", { className: "p-6", children: [_jsxs("div", { className: "flex justify-between", children: [_jsx("h2", { className: "text-xl font-bold text-blue-600 mb-4 ", children: isAddingSubType
301
+ }) })] }) }), _jsxs("div", { className: "flex space-x-4 mt-6 justify-start", children: [similarTaxonomies.some((taxonomy) => taxonomy.isEdit && taxonomy.isMultiple) && (_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"] })), _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" })] })] }))] }), _jsx("div", { className: `fixed inset-y-0 right-0 z-50 w-1/3 bg-white dark:bg-gray-800 p-6 shadow-lg transform ${isModalOpen ? "translate-x-0" : "translate-x-full"} transition-transform duration-300`, children: _jsxs("div", { className: "p-6", children: [_jsxs("div", { className: "flex justify-between", children: [_jsx("h2", { className: "text-xl font-bold text-blue-600 mb-4 ", children: isAddingSubType
267
302
  ? editTaxonomyItem
268
303
  ? "Edit SubType"
269
304
  : "Add SubType"
270
305
  : editTaxonomyItem
271
306
  ? "Edit Values"
272
- : "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: editTaxonomyItem
273
- ? handleSubTypeEditClick
274
- : handleSubTypeAddClick, 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: editTaxonomyItem ? handleEditTaxClick : addTaxonomyClick, 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 || editTempTaxonomyItem ? "Edit" : "Add" }), _jsx("button", { onClick: handleCloseModal, className: "px-8 py-2.5 leading-5 bg-gray-300 rounded-md", children: "Cancel" })] })] }))] }) })] }));
307
+ : "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", {
308
+ // onClick={
309
+ // editTaxonomyItem
310
+ // ? handleSubTypeEditClick
311
+ // : handleSubTypeAddClick
312
+ // }
313
+ 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: editTaxonomyItem ? handleEditTaxClick : addTaxonomyClick, 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 || editTempTaxonomyItem ? "Edit" : "Add" }), _jsx("button", { onClick: handleCloseModal, className: "px-8 py-2.5 leading-5 bg-gray-300 rounded-md", children: "Cancel" })] })] }))] }) })] }));
275
314
  };
276
315
  export default TaxonomyForm;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleven-solutions-common-website-unique-web",
3
- "version": "21.0.26",
3
+ "version": "21.0.28",
4
4
  "main": "./dist/index.js",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -5,7 +5,6 @@ import {
5
5
  fetchTaxonomyByIdApi,
6
6
  updateTaxonomyApi,
7
7
  fetchTaxonomiessApi,
8
- addMultipleTaxonomiesApi,
9
8
  deleteTaxonomyApi,
10
9
  addSubTypeApi,
11
10
  } from "../api/taxonomy";
@@ -17,7 +16,6 @@ interface TaxionomyFormProps {
17
16
 
18
17
  const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
19
18
  const [type, setType] = useState<string>("");
20
- // const [inputType] = useState<string>("");
21
19
  const [code, setCode] = useState<number | string>("");
22
20
  const [value, setValue] = useState<string>("");
23
21
 
@@ -219,55 +217,98 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
219
217
  setIsAddingSubType(true);
220
218
  };
221
219
 
222
- const handleSubTypeAddClick = async () => {
220
+ const handleSubTypeSubmitClick = async () => {
223
221
  if (!subCode || !subValue) {
224
- alert("Please fill out both Code and Value fields before adding.");
222
+ alert("Please fill out both Code and Value fields before proceeding.");
225
223
  return;
226
224
  }
227
- try {
228
- await addSubTypeApi(
229
- url,
230
- selectedTaxonomyId,
231
- type,
232
- Number(subCode),
233
- subValue
234
- );
235
- alert("SubType added successfully");
236
- const fetchedTaxonomies = await fetchTaxonomiessApi(url);
237
- if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
238
- setAllTaxonomies(fetchedTaxonomies);
239
- }
240
- } catch (error) {
241
- console.error("Error adding SubType:", error);
242
- }
243
- setIsModalOpen(false);
244
- setSubCode("");
245
- setSubValue("");
246
- };
247
225
 
248
- const handleSubTypeEditClick = async () => {
249
226
  try {
250
- await updateTaxonomyApi(
251
- url,
252
- selectedTaxonomyId,
253
- type,
254
- Number(subCode),
255
- subValue
256
- );
227
+ if (editTaxonomyItem) {
228
+ await updateTaxonomyApi(
229
+ url,
230
+ selectedTaxonomyId,
231
+ type,
232
+ Number(subCode),
233
+ subValue
234
+ );
235
+ alert("SubType edited successfully");
236
+ } else {
237
+ await addSubTypeApi(
238
+ url,
239
+ selectedTaxonomyId,
240
+ type,
241
+ Number(subCode),
242
+ subValue
243
+ );
244
+ alert("SubType added successfully");
245
+ }
257
246
 
258
- alert("SubType edited successfully");
259
247
  const fetchedTaxonomies = await fetchTaxonomiessApi(url);
260
248
  if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
261
249
  setAllTaxonomies(fetchedTaxonomies);
262
250
  }
263
251
  } catch (error) {
264
- console.error("Error editing SubType:", error);
252
+ console.error(
253
+ `Error ${editTaxonomyItem ? "editing" : "adding"} SubType:`,
254
+ error
255
+ );
265
256
  }
257
+
266
258
  setIsModalOpen(false);
267
259
  setSubCode("");
268
260
  setSubValue("");
269
261
  };
270
262
 
263
+ // const handleSubTypeAddClick = async () => {
264
+ // if (!subCode || !subValue) {
265
+ // alert("Please fill out both Code and Value fields before adding.");
266
+ // return;
267
+ // }
268
+ // try {
269
+ // await addSubTypeApi(
270
+ // url,
271
+ // selectedTaxonomyId,
272
+ // type,
273
+ // Number(subCode),
274
+ // subValue
275
+ // );
276
+ // alert("SubType added successfully");
277
+ // const fetchedTaxonomies = await fetchTaxonomiessApi(url);
278
+ // if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
279
+ // setAllTaxonomies(fetchedTaxonomies);
280
+ // }
281
+ // } catch (error) {
282
+ // console.error("Error adding SubType:", error);
283
+ // }
284
+ // setIsModalOpen(false);
285
+ // setSubCode("");
286
+ // setSubValue("");
287
+ // };
288
+
289
+ // const handleSubTypeEditClick = async () => {
290
+ // try {
291
+ // await updateTaxonomyApi(
292
+ // url,
293
+ // selectedTaxonomyId,
294
+ // type,
295
+ // Number(subCode),
296
+ // subValue
297
+ // );
298
+
299
+ // alert("SubType edited successfully");
300
+ // const fetchedTaxonomies = await fetchTaxonomiessApi(url);
301
+ // if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
302
+ // setAllTaxonomies(fetchedTaxonomies);
303
+ // }
304
+ // } catch (error) {
305
+ // console.error("Error editing SubType:", error);
306
+ // }
307
+ // setIsModalOpen(false);
308
+ // setSubCode("");
309
+ // setSubValue("");
310
+ // };
311
+
271
312
  const handleSubEdit = (child: {
272
313
  id: string;
273
314
  type: string;
@@ -629,10 +670,11 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
629
670
  </tbody>
630
671
  </table>
631
672
  </div>
632
- {similarTaxonomies.some(
633
- (taxonomy) => taxonomy.isEdit && taxonomy.isMultiple
634
- ) && (
635
- <div className="flex space-x-4 mt-6 justify-start">
673
+
674
+ <div className="flex space-x-4 mt-6 justify-start">
675
+ {similarTaxonomies.some(
676
+ (taxonomy) => taxonomy.isEdit && taxonomy.isMultiple
677
+ ) && (
636
678
  <button
637
679
  type="button"
638
680
  onClick={handleOpenModal}
@@ -641,29 +683,17 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
641
683
  <FaPlus className="mr-2 font-medium" />
642
684
  Add Multiple Values
643
685
  </button>
644
- </div>
645
- )}
686
+ )}
687
+ <button
688
+ onClick={handleCancelClick}
689
+ type="button"
690
+ 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"
691
+ >
692
+ Cancel
693
+ </button>
694
+ </div>
646
695
  </div>
647
696
  )}
648
-
649
- <div className="flex space-x-4 mt-6 justify-start">
650
- {/* {similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (
651
- <button
652
- type="submit"
653
- onClick={handleSubmit}
654
- 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"
655
- >
656
- {isEditMode ? "Save " : "Add "}
657
- </button>
658
- )} */}
659
- <button
660
- onClick={handleCancelClick}
661
- type="button"
662
- 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"
663
- >
664
- Cancel
665
- </button>
666
- </div>
667
697
  </div>
668
698
 
669
699
  {/* Drawer */}
@@ -715,11 +745,12 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
715
745
  />
716
746
  <div className="flex space-x-4 justify-end">
717
747
  <button
718
- onClick={
719
- editTaxonomyItem
720
- ? handleSubTypeEditClick
721
- : handleSubTypeAddClick
722
- }
748
+ // onClick={
749
+ // editTaxonomyItem
750
+ // ? handleSubTypeEditClick
751
+ // : handleSubTypeAddClick
752
+ // }
753
+ onClick={handleSubTypeSubmitClick}
723
754
  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"
724
755
  >
725
756
  {editTaxonomyItem ? "Edit" : "Add"}