eleven-solutions-common-website-unique-web 3.0.20 → 3.0.22

Sign up to get free protection for your applications and to get access to all the features.
@@ -225,7 +225,7 @@ const TaxonomyForm = () => {
225
225
  console.error("Error deleting Taxonomy:", error);
226
226
  }
227
227
  });
228
- 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}` : "" }), !isMultiple && (_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 && (
228
+ 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 && (
229
229
  // <div>
230
230
  // {similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (
231
231
  // <button
@@ -244,7 +244,7 @@ const TaxonomyForm = () => {
244
244
  handleDeleteClick(id);
245
245
  window.location.href = "/admin/taxinomies";
246
246
  }, 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) &&
247
- !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: () => {
247
+ !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: () => {
248
248
  handleEditClick(index, taxonomy.id);
249
249
  }, 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: () => {
250
250
  const newTempTaxonomy = [...tempTaxonomy];
@@ -16,7 +16,7 @@ const UserForm = () => {
16
16
  const [mobile, setMobile] = useState("");
17
17
  const [address, setAddress] = useState("");
18
18
  const [roleType, setRoleType] = useState("");
19
- const [, setUser] = useState(null);
19
+ // const [, setUser] = useState<any>(null);
20
20
  const [isEditMode, setIsEditMode] = useState(false);
21
21
  const validateForm = () => {
22
22
  if (!userName || !email || !roleType) {
@@ -35,7 +35,7 @@ const UserForm = () => {
35
35
  if (fetchedUser) {
36
36
  const user = fetchedUser;
37
37
  setIsEditMode(true);
38
- setUser(user);
38
+ // setUser(user);
39
39
  setUserName(user.name);
40
40
  setEmail(user.email);
41
41
  setMobile(user.mobile);
@@ -50,23 +50,6 @@ const UserForm = () => {
50
50
  fetchUserData();
51
51
  }
52
52
  }, [id]);
53
- // const handleSubmit = async (event: React.MouseEvent<HTMLButtonElement>) => {
54
- // event.preventDefault();
55
- // if (!validateForm()) return;
56
- // try {
57
- // if (isEditMode) {
58
- // await updateUserApi(id, userName, mobile, address, roleType);
59
- // alert("User updated successfully");
60
- // } else {
61
- // await addUserApi(userName, email, mobile, address, roleType);
62
- // alert("User added successfully");
63
- // }
64
- // navigate("/admin/user");
65
- // } catch (error) {
66
- // console.error("Error adding/updating User:", error);
67
- // alert("Failed to add/update User");
68
- // }
69
- // };
70
53
  const handleSubmit = (event) => __awaiter(void 0, void 0, void 0, function* () {
71
54
  event.preventDefault();
72
55
  if (!validateForm())
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleven-solutions-common-website-unique-web",
3
- "version": "3.0.20",
3
+ "version": "3.0.22",
4
4
  "main": "./dist/index.js",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -294,123 +294,123 @@ const TaxonomyForm = () => {
294
294
  {isEditMode ? `Taxonomy Type: ${type}` : ""}
295
295
  </h1>
296
296
 
297
- {!isMultiple && (
298
- <form>
299
- {!isEditMode && (
300
- <div className="mb-6 w-full">
301
- <label className="text-gray-900 dark:text-gray-200 font-semibold">
302
- Type <span className="text-red-500">*</span>
303
- </label>
304
- <input
305
- required
306
- value={type}
307
- onChange={(e) => setType(e.target.value)}
308
- type="text"
309
- 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"
310
- placeholder="Enter Type"
311
- />
312
- </div>
313
- )}
314
- <div className="mb-6 w-full">
315
- <label className="text-gray-900 dark:text-gray-200 font-semibold">
316
- Code <span className="text-red-500">*</span>
317
- </label>
318
- <input
319
- required
320
- value={code}
321
- onChange={(e) =>
322
- setCode(e.target.value === "" ? "" : Number(e.target.value))
323
- }
324
- type="number"
325
- 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"
326
- placeholder="Enter Code"
327
- disabled={similarTaxonomies.some(
328
- (taxonomy) => taxonomy.isEdit === false
329
- )}
330
- />
331
- </div>
297
+ {/* {!isMultiple && ( */}
298
+ <form>
299
+ {!isEditMode && (
332
300
  <div className="mb-6 w-full">
333
301
  <label className="text-gray-900 dark:text-gray-200 font-semibold">
334
- Value <span className="text-red-500">*</span>
302
+ Type <span className="text-red-500">*</span>
335
303
  </label>
336
304
  <input
337
305
  required
338
- value={value}
339
- onChange={(e) => setValue(e.target.value)}
306
+ value={type}
307
+ onChange={(e) => setType(e.target.value)}
340
308
  type="text"
341
309
  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"
342
- placeholder="Enter Value"
343
- disabled={similarTaxonomies.some(
344
- (taxonomy) => taxonomy.isEdit === false
345
- )}
310
+ placeholder="Enter Type"
346
311
  />
347
312
  </div>
313
+ )}
314
+ <div className="mb-6 w-full">
315
+ <label className="text-gray-900 dark:text-gray-200 font-semibold">
316
+ Code <span className="text-red-500">*</span>
317
+ </label>
318
+ <input
319
+ required
320
+ value={code}
321
+ onChange={(e) =>
322
+ setCode(e.target.value === "" ? "" : Number(e.target.value))
323
+ }
324
+ type="number"
325
+ 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"
326
+ placeholder="Enter Code"
327
+ disabled={similarTaxonomies.some(
328
+ (taxonomy) => taxonomy.isEdit === false
329
+ )}
330
+ />
331
+ </div>
332
+ <div className="mb-6 w-full">
333
+ <label className="text-gray-900 dark:text-gray-200 font-semibold">
334
+ Value <span className="text-red-500">*</span>
335
+ </label>
336
+ <input
337
+ required
338
+ value={value}
339
+ onChange={(e) => setValue(e.target.value)}
340
+ type="text"
341
+ 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"
342
+ placeholder="Enter Value"
343
+ disabled={similarTaxonomies.some(
344
+ (taxonomy) => taxonomy.isEdit === false
345
+ )}
346
+ />
347
+ </div>
348
348
 
349
- <div className="flex space-x-4 mt-6 justify-between">
350
- <div>
351
- {isEditMode && (
352
- // <div>
353
- // {similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (
354
- // <button
355
- // type="button"
356
- // onClick={() => {
357
- // handleDeleteClick(id);
358
- // navigate("/admin/taxonomy");
359
- // }}
360
- // 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"
361
- // >
362
- // Delete
363
- // </button>
364
- // )}
365
- // </div>
366
- <div>
367
- {similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (
368
- <button
369
- type="button"
370
- onClick={() => {
371
- handleDeleteClick(id);
372
- window.location.href = "/admin/taxinomies";
373
- }}
374
- 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"
375
- >
376
- Delete
377
- </button>
378
- )}
379
- </div>
380
- )}
381
- </div>
382
-
383
- <div className="flex space-x-4 justify-end">
384
- {similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (
385
- <button
386
- type="submit"
387
- onClick={handleSave}
388
- 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"
389
- >
390
- {isEditMode ? "Save" : "Add"}
391
- </button>
392
- )}
393
- {!similarTaxonomies.some((taxonomy) => taxonomy.isEdit) &&
394
- !isEditMode && (
349
+ <div className="flex space-x-4 mt-6 justify-between">
350
+ <div>
351
+ {isEditMode && (
352
+ // <div>
353
+ // {similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (
354
+ // <button
355
+ // type="button"
356
+ // onClick={() => {
357
+ // handleDeleteClick(id);
358
+ // navigate("/admin/taxonomy");
359
+ // }}
360
+ // 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"
361
+ // >
362
+ // Delete
363
+ // </button>
364
+ // )}
365
+ // </div>
366
+ <div>
367
+ {similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (
395
368
  <button
396
- type="submit"
397
- onClick={handleSave}
369
+ type="button"
370
+ onClick={() => {
371
+ handleDeleteClick(id);
372
+ window.location.href = "/admin/taxinomies";
373
+ }}
398
374
  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"
399
375
  >
400
- {isEditMode ? "Save" : "Add"}
376
+ Delete
401
377
  </button>
402
378
  )}
379
+ </div>
380
+ )}
381
+ </div>
382
+
383
+ <div className="flex space-x-4 justify-end">
384
+ {similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (
403
385
  <button
404
- onClick={handleCancelClick}
405
- type="button"
386
+ type="submit"
387
+ onClick={handleSave}
406
388
  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"
407
389
  >
408
- Cancel
390
+ {isEditMode ? "Save" : "Add"}
409
391
  </button>
410
- </div>
392
+ )}
393
+ {!similarTaxonomies.some((taxonomy) => taxonomy.isEdit) &&
394
+ !isEditMode && (
395
+ <button
396
+ type="submit"
397
+ onClick={handleSave}
398
+ 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"
399
+ >
400
+ {isEditMode ? "Save" : "Add"}
401
+ </button>
402
+ )}
403
+ <button
404
+ onClick={handleCancelClick}
405
+ type="button"
406
+ 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"
407
+ >
408
+ Cancel
409
+ </button>
411
410
  </div>
412
- </form>
413
- )}
411
+ </div>
412
+ </form>
413
+ {/* )} */}
414
414
 
415
415
  {/* Table for Displaying Similar Taxonomies */}
416
416
  {isSimilarTaxonomyOpen && isMultiple && isEditMode && (
@@ -10,7 +10,7 @@ const UserForm = () => {
10
10
  const [address, setAddress] = useState("");
11
11
  const [roleType, setRoleType] = useState("");
12
12
 
13
- const [, setUser] = useState<any>(null);
13
+ // const [, setUser] = useState<any>(null);
14
14
  const [isEditMode, setIsEditMode] = useState<boolean>(false);
15
15
 
16
16
  const validateForm = () => {
@@ -40,7 +40,7 @@ const UserForm = () => {
40
40
  roleType: string;
41
41
  };
42
42
  setIsEditMode(true);
43
- setUser(user);
43
+ // setUser(user);
44
44
  setUserName(user.name);
45
45
  setEmail(user.email);
46
46
  setMobile(user.mobile);
@@ -55,25 +55,6 @@ const UserForm = () => {
55
55
  }
56
56
  }, [id]);
57
57
 
58
- // const handleSubmit = async (event: React.MouseEvent<HTMLButtonElement>) => {
59
- // event.preventDefault();
60
- // if (!validateForm()) return;
61
-
62
- // try {
63
- // if (isEditMode) {
64
- // await updateUserApi(id, userName, mobile, address, roleType);
65
- // alert("User updated successfully");
66
- // } else {
67
- // await addUserApi(userName, email, mobile, address, roleType);
68
- // alert("User added successfully");
69
- // }
70
- // navigate("/admin/user");
71
- // } catch (error) {
72
- // console.error("Error adding/updating User:", error);
73
- // alert("Failed to add/update User");
74
- // }
75
- // };
76
-
77
58
  const handleSubmit = async (event: React.MouseEvent<HTMLButtonElement>) => {
78
59
  event.preventDefault();
79
60
  if (!validateForm()) return;
@@ -207,11 +188,3 @@ const UserForm = () => {
207
188
  };
208
189
 
209
190
  export default UserForm;
210
-
211
- // import React from "react";
212
-
213
- // function UserForm() {
214
- // return <div>UserForm</div>;
215
- // }
216
-
217
- // export default UserForm;