eleven-solutions-common-website-unique-web 19.0.19 → 19.0.20
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/admin/TaxonomyForm.js +1 -12
- package/dist/components/admin/UserForm.js +6 -3
- package/dist/components/admin/Users.js +1 -1
- package/dist/components/api/user.d.ts +2 -2
- package/dist/components/api/user.js +4 -2
- package/dist/components/useraccount/AddMissingDetails.d.ts +9 -0
- package/dist/components/useraccount/AddMissingDetails.js +56 -0
- package/dist/components/useraccount/AddUserDetails.d.ts +9 -0
- package/dist/components/useraccount/AddUserDetails.js +21 -0
- package/package.json +1 -1
- package/src/components/admin/Taxionomies.tsx +0 -13
- package/src/components/admin/TaxonomyForm.tsx +0 -120
- package/src/components/admin/UserForm.tsx +38 -2
- package/src/components/admin/Users.tsx +10 -2
- package/src/components/api/user.ts +6 -2
- package/src/components/useraccount/AddMissingDetails.tsx +153 -0
- package/src/components/useraccount/AddUserDetails.tsx +136 -0
@@ -181,15 +181,6 @@ const TaxonomyForm = ({ url }) => {
|
|
181
181
|
setNewValue(item.value);
|
182
182
|
setIsModalOpen(true);
|
183
183
|
};
|
184
|
-
// const handleEditClick = (index: number, id: string) => {
|
185
|
-
// setIsAddingSubType(false);
|
186
|
-
// const item = similarTaxonomies[index];
|
187
|
-
// setSelectedTaxonomyId(id);
|
188
|
-
// setEditTaxonomyItem(item);
|
189
|
-
// setNewCode(item.code);
|
190
|
-
// setNewValue(item.value);
|
191
|
-
// setIsModalOpen(true);
|
192
|
-
// };
|
193
184
|
const handleEditClick = (index, id) => {
|
194
185
|
setIsAddingSubType(false);
|
195
186
|
const item = similarTaxonomies.find((taxonomy) => taxonomy.id === id);
|
@@ -330,8 +321,6 @@ const TaxonomyForm = ({ url }) => {
|
|
330
321
|
? "Edit Values"
|
331
322
|
: "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
|
332
323
|
? handleSubTypeEditClick
|
333
|
-
: 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" : "Save" }), _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:
|
334
|
-
// editTaxonomyItem ? handleEditTaxClick : handleAddClick
|
335
|
-
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" })] })] }))] }) })] }));
|
324
|
+
: 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" : "Save" }), _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" })] })] }))] }) })] }));
|
336
325
|
};
|
337
326
|
export default TaxonomyForm;
|
@@ -16,6 +16,7 @@ const UserForm = ({ url }) => {
|
|
16
16
|
const [mobile, setMobile] = useState("");
|
17
17
|
const [address, setAddress] = useState("");
|
18
18
|
const [roleType, setRoleType] = useState("");
|
19
|
+
const [gender, setGender] = useState("");
|
19
20
|
const [isEditMode, setIsEditMode] = useState(false);
|
20
21
|
const validateForm = () => {
|
21
22
|
if (!userName || !email || !roleType) {
|
@@ -39,6 +40,7 @@ const UserForm = ({ url }) => {
|
|
39
40
|
setMobile(user.mobile);
|
40
41
|
setAddress(user.address);
|
41
42
|
setRoleType(user.roleType);
|
43
|
+
setGender(user.gender);
|
42
44
|
}
|
43
45
|
}
|
44
46
|
catch (error) {
|
@@ -54,11 +56,11 @@ const UserForm = ({ url }) => {
|
|
54
56
|
return;
|
55
57
|
try {
|
56
58
|
if (isEditMode) {
|
57
|
-
yield updateUserApi(url, id, userName, mobile, address, roleType);
|
59
|
+
yield updateUserApi(url, id, userName, mobile, address, roleType, gender);
|
58
60
|
alert("User updated successfully");
|
59
61
|
}
|
60
62
|
else {
|
61
|
-
yield addUserApi(url, userName, email, mobile, address, roleType);
|
63
|
+
yield addUserApi(url, userName, email, mobile, address, roleType, gender);
|
62
64
|
alert("User added successfully");
|
63
65
|
}
|
64
66
|
// window.location.href = "/admin/users";
|
@@ -76,9 +78,10 @@ const UserForm = ({ url }) => {
|
|
76
78
|
setMobile("");
|
77
79
|
setAddress("");
|
78
80
|
setRoleType("");
|
81
|
+
setGender("");
|
79
82
|
window.history.pushState({}, "", "/admin/users");
|
80
83
|
window.dispatchEvent(new PopStateEvent("popstate"));
|
81
84
|
};
|
82
|
-
return (_jsx("div", { className: "max-w-4xl p-6 mx-auto dark:bg-gray-800", children: _jsx("div", { children: _jsxs("form", { children: [_jsx("h1", { className: "text-3xl font-bold text-center text-blue-600 capitalize dark:text-white mb-4", children: isEditMode ? "Edit User" : "Add User" }), _jsxs("div", { className: "mb-6 w-full", children: [_jsxs("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: ["User Name ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx("input", { required: true, value: userName, onChange: (e) => setUserName(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 User Name" })] }), _jsxs("div", { className: "mb-6 w-full", children: [_jsxs("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: ["Email ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx("input", { required: true, value: email, onChange: (e) => setEmail(e.target.value), type: "email", 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 Email", disabled: isEditMode })] }), _jsxs("div", { className: "mb-6 w-full", children: [_jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Mobile Number" }), _jsx("input", { required: true, value: mobile, onChange: (e) => setMobile(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 Mobile Number" })] }), _jsxs("div", { className: "mb-6 w-full", children: [_jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Address" }), _jsx("input", { required: true, value: address, onChange: (e) => setAddress(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: "Address" })] }), _jsxs("div", { className: "mb-6 w-full", children: [_jsxs("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: ["Role Type ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsxs("select", { required: true, value: roleType, onChange: (e) => setRoleType(e.target.value), 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", children: [_jsx("option", { value: "", children: "Select a Role Type" }), _jsx("option", { value: "1", children: "Guest" }), _jsx("option", { value: "2", children: "Admin" })] })] }), _jsxs("div", { className: "flex space-x-4 mt-6 justify-end", children: [_jsx("button", { type: "submit", onClick: handleSubmit, 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 ? "Edit" : "Add" }), _jsx("button", { type: "button", onClick: handleCancelClick, 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" })] })] }) }) }));
|
85
|
+
return (_jsx("div", { className: "max-w-4xl p-6 mx-auto dark:bg-gray-800", children: _jsx("div", { children: _jsxs("form", { children: [_jsx("h1", { className: "text-3xl font-bold text-center text-blue-600 capitalize dark:text-white mb-4", children: isEditMode ? "Edit User" : "Add User" }), _jsxs("div", { className: "mb-6 w-full", children: [_jsxs("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: ["User Name ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx("input", { required: true, value: userName, onChange: (e) => setUserName(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 User Name" })] }), _jsxs("div", { className: "mb-6 w-full", children: [_jsxs("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: ["Email ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx("input", { required: true, value: email, onChange: (e) => setEmail(e.target.value), type: "email", 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 Email", disabled: isEditMode })] }), _jsxs("div", { className: "mb-6 w-full", children: [_jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Mobile Number" }), _jsx("input", { required: true, value: mobile, onChange: (e) => setMobile(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 Mobile Number" })] }), _jsxs("div", { className: "mb-6 w-full", children: [_jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Address" }), _jsx("input", { required: true, value: address, onChange: (e) => setAddress(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: "Address" })] }), _jsxs("div", { className: "mb-6 w-full", children: [_jsxs("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: ["Gender ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsxs("select", { required: true, value: roleType, onChange: (e) => setGender(e.target.value), 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", children: [_jsx("option", { value: "", children: "Select a Role Type" }), _jsx("option", { value: "Male", children: "Male" }), _jsx("option", { value: "Female", children: "Female" })] })] }), _jsxs("div", { className: "mb-6 w-full", children: [_jsxs("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: ["Role Type ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsxs("select", { required: true, value: roleType, onChange: (e) => setRoleType(e.target.value), 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", children: [_jsx("option", { value: "", children: "Select a Role Type" }), _jsx("option", { value: "1", children: "Guest" }), _jsx("option", { value: "2", children: "Admin" })] })] }), _jsxs("div", { className: "flex space-x-4 mt-6 justify-end", children: [_jsx("button", { type: "submit", onClick: handleSubmit, 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 ? "Edit" : "Add" }), _jsx("button", { type: "button", onClick: handleCancelClick, 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" })] })] }) }) }));
|
83
86
|
};
|
84
87
|
export default UserForm;
|
@@ -62,7 +62,7 @@ const Users = ({ url }) => {
|
|
62
62
|
window.history.pushState({}, "", path + id);
|
63
63
|
window.dispatchEvent(new PopStateEvent("popstate"));
|
64
64
|
};
|
65
|
-
return (_jsxs("div", { className: "container px-4 mx-auto mt-6", children: [_jsx("div", { className: "w-3/4", children: _jsx("h1", { className: "text-3xl font-bold text-blue-600 mb-5", children: "Users" }) }), _jsx("div", { className: "flex-grow ml-0 w-full mt-10", children: _jsxs("form", { className: "w-full ", children: [_jsx("label", { htmlFor: "default-search", className: "mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white", children: "Search" }), _jsxs("div", { className: "relative w-full", children: [_jsx("div", { className: "absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none", children: _jsx("svg", { className: "w-4 h-4 text-gray-500 dark:text-gray-400", "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", children: _jsx("path", { stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z" }) }) }), _jsx("input", { type: "search", id: "default-search", className: "inline-block min-w-full p-3 ps-10 outline-none text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500", placeholder: "Search Users", required: true }), _jsx("button", { type: "submit", className: "text-white absolute end-1.5 bottom-1.5 bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800", children: "Search" })] })] }) }), _jsx("div", { className: "flex-grow ml-0 w-3/4", children: _jsx("form", { className: "w-auto" }) }), _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: "py-3.5 px-4 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: _jsx("div", { className: "flex items-center gap-x-3", children: _jsx("span", { children: "Name" }) }) }), _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: _jsx("button", { className: "flex items-center gap-x-2", children: _jsx("span", { children: "Email" }) }) }), _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: _jsx("button", { className: "flex items-center gap-x-2", children: _jsx("span", { children: "Mobile" }) }) }), _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: "Address" }), _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: "Role Type" })] }) }), _jsx("tbody", { className: "bg-white divide-y divide-gray-200 dark:divide-gray-700 dark:bg-gray-900", children: paginatedUsers.map((user, 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", { onClick: () => handleDeleteClick(user.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", { onClick: (event) => handleEditClick(event, "/admin/users/userform?id=", user.id), 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-4 text-sm font-medium text-gray-700 whitespace-nowrap", children: _jsx("div", { className: "inline-flex items-center gap-x-3", children: _jsx("div", { className: "flex items-center gap-x-2", children: _jsx("div", { children: _jsx("h2", { className: " text-sm font-medium text-gray-800 dark:text-white ", children: user.name }) }) }) }) }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap", children: user.email }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap", children: (user === null || user === void 0 ? void 0 : user.mobile) || "Not Provided" }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap", children: (user === null || user === void 0 ? void 0 : user.address) || "Not Provided" }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap", children: user.roleType ===
|
65
|
+
return (_jsxs("div", { className: "container px-4 mx-auto mt-6", children: [_jsx("div", { className: "w-3/4", children: _jsx("h1", { className: "text-3xl font-bold text-blue-600 mb-5", children: "Users" }) }), _jsx("div", { className: "flex-grow ml-0 w-full mt-10", children: _jsxs("form", { className: "w-full ", children: [_jsx("label", { htmlFor: "default-search", className: "mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white", children: "Search" }), _jsxs("div", { className: "relative w-full", children: [_jsx("div", { className: "absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none", children: _jsx("svg", { className: "w-4 h-4 text-gray-500 dark:text-gray-400", "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", children: _jsx("path", { stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z" }) }) }), _jsx("input", { type: "search", id: "default-search", className: "inline-block min-w-full p-3 ps-10 outline-none text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500", placeholder: "Search Users", required: true }), _jsx("button", { type: "submit", className: "text-white absolute end-1.5 bottom-1.5 bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800", children: "Search" })] })] }) }), _jsx("div", { className: "flex-grow ml-0 w-3/4", children: _jsx("form", { className: "w-auto" }) }), _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: "py-3.5 px-4 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: _jsx("div", { className: "flex items-center gap-x-3", children: _jsx("span", { children: "Name" }) }) }), _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: _jsx("button", { className: "flex items-center gap-x-2", children: _jsx("span", { children: "Email" }) }) }), _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: _jsx("button", { className: "flex items-center gap-x-2", children: _jsx("span", { children: "Mobile" }) }) }), _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: "Address" }), _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: "Role Type" }), _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: "Gender" })] }) }), _jsx("tbody", { className: "bg-white divide-y divide-gray-200 dark:divide-gray-700 dark:bg-gray-900", children: paginatedUsers.map((user, 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", { onClick: () => handleDeleteClick(user.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", { onClick: (event) => handleEditClick(event, "/admin/users/userform?id=", user.id), 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-4 text-sm font-medium text-gray-700 whitespace-nowrap", children: _jsx("div", { className: "inline-flex items-center gap-x-3", children: _jsx("div", { className: "flex items-center gap-x-2", children: _jsx("div", { children: _jsx("h2", { className: " text-sm font-medium text-gray-800 dark:text-white ", children: user.name }) }) }) }) }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap", children: user.email }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap", children: (user === null || user === void 0 ? void 0 : user.mobile) || "Not Provided" }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap", children: (user === null || user === void 0 ? void 0 : user.address) || "Not Provided" }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap", children: (user === null || user === void 0 ? void 0 : user.gender) || "Not Provided" }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap", children: user.roleType === 1 ? "Guest" : "Admin" })] }, user.id || index))) })] }) }), _jsxs("div", { className: "flex items-center justify-between mt-6", children: [_jsxs("button", { onClick: handlePreviousPage, disabled: currentPage === 1, className: "flex items-center px-5 py-2 text-sm text-gray-700 capitalize transition-colors duration-200 bg-white border rounded-md gap-x-2 hover:bg-gray-100 dark:bg-gray-900 dark:text-gray-200 dark:border-gray-700 dark:hover:bg-gray-800", 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 rtl:-scale-x-100", children: _jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M6.75 15.75L3 12m0 0l3.75-3.75M3 12h18" }) }), _jsx("span", { children: "previous" })] }), _jsx("div", { className: "items-center hidden lg:flex gap-x-3", children: Array.from({ length: totalPages }, (_, index) => (_jsx("button", { onClick: () => handlePageClick(index + 1), className: `px-2 py-1 text-sm ${currentPage === index + 1
|
66
66
|
? "text-blue-500 bg-blue-100"
|
67
67
|
: "text-gray-500 hover:bg-gray-100"} rounded-md`, children: index + 1 }, index + 1))) }), _jsxs("button", { onClick: handleNextPage, disabled: currentPage === totalPages, className: "flex items-center px-5 py-2 text-sm text-gray-700 capitalize transition-colors duration-200 bg-white border rounded-md gap-x-2 hover:bg-gray-100 dark:bg-gray-900 dark:text-gray-200 dark:border-gray-700 dark:hover:bg-gray-800", children: [_jsx("span", { children: "Next" }), _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 rtl:-scale-x-100", children: _jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M17.25 8.25L21 12m0 0l-3.75 3.75M21 12H3" }) })] })] }), _jsx("div", { className: "flex-grow ml-0 mt-4 w-0", children: _jsxs("button", { type: "button", onClick: (event) => handleNavigation(event, "/admin/users/userform"), 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" }), "User"] }) })] })] }));
|
68
68
|
};
|
@@ -1,7 +1,7 @@
|
|
1
|
-
export declare const addUserApi: (url: string, name: string, email: string, mobile: string, address: string, roleType: string) => Promise<Axios.AxiosXHR<unknown>>;
|
1
|
+
export declare const addUserApi: (url: string, name: string, email: string, mobile: string, address: string, roleType: string, gender: string) => Promise<Axios.AxiosXHR<unknown>>;
|
2
2
|
export declare const fetchUsersApi: (url: string) => Promise<unknown>;
|
3
3
|
export declare const fetchUserByIdApi: (url: string, userId: string) => Promise<unknown>;
|
4
4
|
export declare const deleteUserApi: (url: string, id: string) => Promise<{
|
5
5
|
id: string;
|
6
6
|
}>;
|
7
|
-
export declare const updateUserApi: (url: string, id: string, name: string, mobile: string, address: string, roleType: string) => Promise<unknown>;
|
7
|
+
export declare const updateUserApi: (url: string, id: string, name: string, mobile: string, address: string, roleType: string, gender: string) => Promise<unknown>;
|
@@ -11,7 +11,7 @@ import axios from "axios";
|
|
11
11
|
import Cookies from "universal-cookie";
|
12
12
|
const apiUrl = "http://localhost:5260";
|
13
13
|
const cookies = new Cookies();
|
14
|
-
export const addUserApi = (url, name, email, mobile, address, roleType) => __awaiter(void 0, void 0, void 0, function* () {
|
14
|
+
export const addUserApi = (url, name, email, mobile, address, roleType, gender) => __awaiter(void 0, void 0, void 0, function* () {
|
15
15
|
const token = cookies.get("token");
|
16
16
|
try {
|
17
17
|
const response = yield axios.post(`${url}/login/adduser`, {
|
@@ -20,6 +20,7 @@ export const addUserApi = (url, name, email, mobile, address, roleType) => __awa
|
|
20
20
|
Mobile: mobile,
|
21
21
|
Address: address,
|
22
22
|
RoleType: Number(roleType),
|
23
|
+
Gender: gender,
|
23
24
|
}, {
|
24
25
|
headers: {
|
25
26
|
Authorization: `Bearer ${token}`,
|
@@ -84,7 +85,7 @@ export const deleteUserApi = (url, id) => __awaiter(void 0, void 0, void 0, func
|
|
84
85
|
throw error;
|
85
86
|
}
|
86
87
|
});
|
87
|
-
export const updateUserApi = (url, id, name, mobile, address, roleType) => __awaiter(void 0, void 0, void 0, function* () {
|
88
|
+
export const updateUserApi = (url, id, name, mobile, address, roleType, gender) => __awaiter(void 0, void 0, void 0, function* () {
|
88
89
|
const token = cookies.get("token");
|
89
90
|
try {
|
90
91
|
const response = yield axios.post(`${url}/login/updateuser`, {
|
@@ -93,6 +94,7 @@ export const updateUserApi = (url, id, name, mobile, address, roleType) => __awa
|
|
93
94
|
Mobile: mobile,
|
94
95
|
Address: address,
|
95
96
|
RoleType: Number(roleType),
|
97
|
+
Gender: gender,
|
96
98
|
}, {
|
97
99
|
headers: {
|
98
100
|
Authorization: `Bearer ${token}`,
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import React from "react";
|
2
|
+
interface AddMissingDetailsProps {
|
3
|
+
usermodalopen: boolean;
|
4
|
+
closeusermodal: () => void;
|
5
|
+
url: string;
|
6
|
+
isDarkMode: boolean;
|
7
|
+
}
|
8
|
+
declare const AddMissingDetails: React.FC<AddMissingDetailsProps>;
|
9
|
+
export default AddMissingDetails;
|
@@ -0,0 +1,56 @@
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
+
});
|
9
|
+
};
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
11
|
+
import { useState, useEffect } from "react";
|
12
|
+
import { getProfileApi } from "../api/updateuser";
|
13
|
+
import Cookies from "universal-cookie";
|
14
|
+
const AddMissingDetails = ({ usermodalopen, closeusermodal, url, isDarkMode, }) => {
|
15
|
+
var _a;
|
16
|
+
const [name, setName] = useState("");
|
17
|
+
const [mobile, setMobile] = useState("");
|
18
|
+
const [address, setAddress] = useState("");
|
19
|
+
const [user, setUser] = useState(undefined);
|
20
|
+
const cookies = new Cookies();
|
21
|
+
const token = cookies.get("authToken");
|
22
|
+
const userToken = ((_a = token === null || token === void 0 ? void 0 : token.data) === null || _a === void 0 ? void 0 : _a.token) || token;
|
23
|
+
useEffect(() => {
|
24
|
+
const fetchUserProfile = () => __awaiter(void 0, void 0, void 0, function* () {
|
25
|
+
if (usermodalopen && userToken && !user) {
|
26
|
+
try {
|
27
|
+
const userProfile = yield getProfileApi(userToken, url);
|
28
|
+
if (userProfile) {
|
29
|
+
setUser(userProfile);
|
30
|
+
setName(userProfile.name);
|
31
|
+
setMobile(userProfile.mobile);
|
32
|
+
setAddress(userProfile.address);
|
33
|
+
}
|
34
|
+
}
|
35
|
+
catch (error) {
|
36
|
+
console.error("Error fetching user profile:", error);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
});
|
40
|
+
fetchUserProfile();
|
41
|
+
}, [usermodalopen, userToken, user]);
|
42
|
+
return (_jsx("div", { className: `fixed inset-0 flex items-center justify-center ${isDarkMode ? "bg-gray-800 bg-opacity-90" : "bg-gray-500 bg-opacity-75"}`, children: _jsxs("div", { className: `rounded-lg p-6 w-full max-w-md relative ${isDarkMode
|
43
|
+
? "border border-gray-300 bg-[#242424] text-white"
|
44
|
+
: "bg-white text-black"}`, children: [_jsx("button", { onClick: closeusermodal, className: `absolute top-3 right-3 ${isDarkMode
|
45
|
+
? "text-gray-300 hover:text-gray-500"
|
46
|
+
: "text-gray-400 hover:text-gray-600"} text-2xl`, children: "\u00D7" }), _jsx("h3", { className: "text-center text-xl font-bold mb-4", children: "Add User Details" }), _jsxs("div", { className: "mb-4", children: [_jsx("label", { className: `block text-sm font-medium mb-1 ${isDarkMode ? "text-gray-300" : "text-gray-700"}`, children: "Name" }), _jsx("input", { type: "text", placeholder: "Name", className: `w-full p-2 border rounded focus:outline-none focus:ring ${isDarkMode
|
47
|
+
? "bg-gray-800 border-gray-700 text-white "
|
48
|
+
: "border-gray-300 "}` })] }), _jsxs("div", { className: "mb-4", children: [_jsx("label", { className: `block text-sm font-medium mb-1 ${isDarkMode ? "text-gray-300" : "text-gray-700"}`, children: "Mobile" }), _jsx("input", { type: "tel", placeholder: "Mobile", className: `w-full p-2 border rounded focus:outline-none focus:ring ${isDarkMode
|
49
|
+
? "bg-gray-800 border-gray-700 text-white "
|
50
|
+
: "border-gray-300 "}` })] }), _jsxs("div", { className: "mb-4", children: [_jsx("label", { className: `block text-sm font-medium mb-1 ${isDarkMode ? "text-gray-300" : "text-gray-700"}`, children: "Address" }), _jsx("input", { type: "text", placeholder: "Address", className: `w-full p-2 border rounded focus:outline-none focus:ring ${isDarkMode
|
51
|
+
? "bg-gray-800 border-gray-700 text-white "
|
52
|
+
: "border-gray-300 "}` })] }), _jsx("div", { className: "flex justify-end", children: _jsx("button", { className: `px-4 py-2 rounded ${isDarkMode
|
53
|
+
? "bg-blue-500 hover:bg-blue-400 text-white"
|
54
|
+
: "bg-blue-500 hover:bg-blue-400 text-white"}`, children: "Add Details" }) })] }) }));
|
55
|
+
};
|
56
|
+
export default AddMissingDetails;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useState } from "react";
|
3
|
+
const AddUserDetails = ({ usermodalopen, closeusermodal, url, isDarkMode, }) => {
|
4
|
+
const [name, setName] = useState("");
|
5
|
+
const [mobile, setMobile] = useState("");
|
6
|
+
const [address, setAddress] = useState("");
|
7
|
+
return (_jsx("div", { className: `fixed inset-0 flex items-center justify-center ${isDarkMode ? "bg-gray-800 bg-opacity-90" : "bg-gray-500 bg-opacity-75"}`, children: _jsxs("div", { className: `rounded-lg p-6 w-full max-w-md relative ${isDarkMode
|
8
|
+
? "border border-gray-300 bg-[#242424] text-white"
|
9
|
+
: "bg-white text-black"}`, children: [_jsx("button", { onClick: closeusermodal, className: `absolute top-3 right-3 ${isDarkMode
|
10
|
+
? "text-gray-300 hover:text-gray-500"
|
11
|
+
: "text-gray-400 hover:text-gray-600"} text-2xl`, children: "\u00D7" }), _jsx("h3", { className: "text-center text-xl font-bold mb-4", children: "Update User Details" }), _jsxs("div", { className: "mb-4", children: [_jsx("label", { className: `block text-sm font-medium mb-1 ${isDarkMode ? "text-gray-300" : "text-gray-700"}`, children: "Name" }), _jsx("input", { type: "text", placeholder: "Name", value: name, onChange: (e) => setName(e.target.value), className: `w-full p-2 border rounded focus:outline-none focus:ring ${isDarkMode
|
12
|
+
? "bg-gray-800 border-gray-700 text-white "
|
13
|
+
: "border-gray-300 "}` })] }), _jsxs("div", { className: "mb-4", children: [_jsx("label", { className: `block text-sm font-medium mb-1 ${isDarkMode ? "text-gray-300" : "text-gray-700"}`, children: "Mobile" }), _jsx("input", { type: "tel", placeholder: "Mobile", value: mobile, onChange: (e) => setMobile(e.target.value), className: `w-full p-2 border rounded focus:outline-none focus:ring ${isDarkMode
|
14
|
+
? "bg-gray-800 border-gray-700 text-white "
|
15
|
+
: "border-gray-300 "}` })] }), _jsxs("div", { className: "mb-4", children: [_jsx("label", { className: `block text-sm font-medium mb-1 ${isDarkMode ? "text-gray-300" : "text-gray-700"}`, children: "Address" }), _jsx("input", { type: "text", placeholder: "Address", value: address, onChange: (e) => setAddress(e.target.value), className: `w-full p-2 border rounded focus:outline-none focus:ring ${isDarkMode
|
16
|
+
? "bg-gray-800 border-gray-700 text-white "
|
17
|
+
: "border-gray-300 "}` })] }), _jsx("div", { className: "flex justify-end", children: _jsx("button", { className: `px-4 py-2 rounded ${isDarkMode
|
18
|
+
? "bg-blue-500 hover:bg-blue-400 text-white"
|
19
|
+
: "bg-blue-500 hover:bg-blue-400 text-white"}`, children: "Update Details" }) })] }) }));
|
20
|
+
};
|
21
|
+
export default AddUserDetails;
|
package/package.json
CHANGED
@@ -306,19 +306,6 @@ const Taxionomies = ({ url }: TaxionomiesProps) => {
|
|
306
306
|
</svg>
|
307
307
|
</button>
|
308
308
|
</div>
|
309
|
-
|
310
|
-
{/* <div className="flex-grow ml-0 mt-4 w-0 ">
|
311
|
-
<button
|
312
|
-
type="button"
|
313
|
-
onClick={(event) =>
|
314
|
-
handleNavigation(event, "/admin/taxinomies/taxonomyform")
|
315
|
-
}
|
316
|
-
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"
|
317
|
-
>
|
318
|
-
<FaPlus className="mr-2 font-medium" />
|
319
|
-
Taxonomy
|
320
|
-
</button>
|
321
|
-
</div> */}
|
322
309
|
</div>
|
323
310
|
</div>
|
324
311
|
);
|
@@ -231,17 +231,6 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
|
|
231
231
|
setIsModalOpen(true);
|
232
232
|
};
|
233
233
|
|
234
|
-
// const handleEditClick = (index: number, id: string) => {
|
235
|
-
// setIsAddingSubType(false);
|
236
|
-
|
237
|
-
// const item = similarTaxonomies[index];
|
238
|
-
// setSelectedTaxonomyId(id);
|
239
|
-
|
240
|
-
// setEditTaxonomyItem(item);
|
241
|
-
// setNewCode(item.code);
|
242
|
-
// setNewValue(item.value);
|
243
|
-
// setIsModalOpen(true);
|
244
|
-
// };
|
245
234
|
const handleEditClick = (index: number, id: string) => {
|
246
235
|
setIsAddingSubType(false);
|
247
236
|
|
@@ -714,114 +703,6 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
|
|
714
703
|
</div>
|
715
704
|
)}
|
716
705
|
|
717
|
-
{/* Table for Temp taxonomy
|
718
|
-
{isEditMode && (
|
719
|
-
<>
|
720
|
-
{tempTaxonomy.length > 0 && (
|
721
|
-
<div className="flex-grow ml-0 mt-4 w-full">
|
722
|
-
<div className="overflow-hidden border border-gray-200 dark:border-gray-700 md:rounded-lg mt-6">
|
723
|
-
<table className="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
|
724
|
-
<thead className="bg-gray-50 dark:bg-gray-800">
|
725
|
-
<tr>
|
726
|
-
<th
|
727
|
-
scope="col"
|
728
|
-
className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400"
|
729
|
-
style={{ width: "200px" }}
|
730
|
-
>
|
731
|
-
Actions
|
732
|
-
</th>
|
733
|
-
<th
|
734
|
-
scope="col"
|
735
|
-
className="px-4 py-3.5 text-md font-normal text-left text-gray-500 dark:text-gray-400"
|
736
|
-
>
|
737
|
-
Code
|
738
|
-
</th>
|
739
|
-
<th
|
740
|
-
scope="col"
|
741
|
-
className="px-4 py-3.5 text-md font-normal text-left text-gray-500 dark:text-gray-400"
|
742
|
-
>
|
743
|
-
Value
|
744
|
-
</th>
|
745
|
-
</tr>
|
746
|
-
</thead>
|
747
|
-
<tbody className="bg-white divide-y divide-gray-200 dark:bg-gray-800 dark:divide-gray-700">
|
748
|
-
{[...tempTaxonomy].map((item, index) => (
|
749
|
-
<tr key={index}>
|
750
|
-
<td className="px-4 py-4 text-sm whitespace-nowrap">
|
751
|
-
<div className="flex items-center gap-x-6">
|
752
|
-
<button
|
753
|
-
type="button"
|
754
|
-
onClick={() => {
|
755
|
-
const newTempTaxonomy = [...tempTaxonomy];
|
756
|
-
newTempTaxonomy.splice(index, 1);
|
757
|
-
setTempTaxonomy(newTempTaxonomy);
|
758
|
-
}}
|
759
|
-
className="text-gray-500 transition-colors duration-200 dark:hover:text-red-600 dark:text-gray-300 hover:text-red-500 focus:outline-none"
|
760
|
-
>
|
761
|
-
<svg
|
762
|
-
xmlns="http://www.w3.org/2000/svg"
|
763
|
-
fill="none"
|
764
|
-
viewBox="0 0 24 24"
|
765
|
-
stroke-width="1.5"
|
766
|
-
stroke="currentColor"
|
767
|
-
className="w-5 h-5"
|
768
|
-
>
|
769
|
-
<path
|
770
|
-
stroke-linecap="round"
|
771
|
-
stroke-linejoin="round"
|
772
|
-
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"
|
773
|
-
/>
|
774
|
-
</svg>
|
775
|
-
</button>
|
776
|
-
<button
|
777
|
-
type="button"
|
778
|
-
onClick={() => {
|
779
|
-
handleTempEditClick(index);
|
780
|
-
}}
|
781
|
-
className="text-gray-500 transition-colors duration-200 dark:hover:text-yellow-500 dark:text-gray-300 hover:text-yellow-500 focus:outline-none"
|
782
|
-
>
|
783
|
-
<svg
|
784
|
-
xmlns="http://www.w3.org/2000/svg"
|
785
|
-
fill="none"
|
786
|
-
viewBox="0 0 24 24"
|
787
|
-
stroke-width="1.5"
|
788
|
-
stroke="currentColor"
|
789
|
-
className="w-5 h-5"
|
790
|
-
>
|
791
|
-
<path
|
792
|
-
stroke-linecap="round"
|
793
|
-
stroke-linejoin="round"
|
794
|
-
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"
|
795
|
-
/>
|
796
|
-
</svg>
|
797
|
-
</button>
|
798
|
-
</div>
|
799
|
-
</td>
|
800
|
-
<td className="px-4 py-4 text-sm text-gray-500 dark:text-gray-400">
|
801
|
-
{item.code}
|
802
|
-
</td>
|
803
|
-
<td className="px-4 py-4 text-sm text-gray-500 dark:text-gray-400">
|
804
|
-
{item.value}
|
805
|
-
</td>
|
806
|
-
</tr>
|
807
|
-
))}
|
808
|
-
</tbody>
|
809
|
-
</table>
|
810
|
-
</div>
|
811
|
-
<div className="flex space-x-4 mt-6 justify-start">
|
812
|
-
<button
|
813
|
-
type="button"
|
814
|
-
onClick={handleSaveClick}
|
815
|
-
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"
|
816
|
-
>
|
817
|
-
Save
|
818
|
-
</button>
|
819
|
-
</div>
|
820
|
-
</div>
|
821
|
-
)}
|
822
|
-
</>
|
823
|
-
)} */}
|
824
|
-
|
825
706
|
<div className="flex space-x-4 mt-6 justify-start">
|
826
707
|
{similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (
|
827
708
|
<button
|
@@ -934,7 +815,6 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
|
|
934
815
|
<div className="flex space-x-4 justify-end">
|
935
816
|
<button
|
936
817
|
onClick={
|
937
|
-
// editTaxonomyItem ? handleEditTaxClick : handleAddClick
|
938
818
|
editTaxonomyItem ? handleEditTaxClick : addTaxonomyClick
|
939
819
|
}
|
940
820
|
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"
|
@@ -13,6 +13,7 @@ const UserForm = ({ url }: UserFormProps) => {
|
|
13
13
|
const [mobile, setMobile] = useState("");
|
14
14
|
const [address, setAddress] = useState("");
|
15
15
|
const [roleType, setRoleType] = useState("");
|
16
|
+
const [gender, setGender] = useState("");
|
16
17
|
|
17
18
|
const [isEditMode, setIsEditMode] = useState<boolean>(false);
|
18
19
|
|
@@ -41,6 +42,7 @@ const UserForm = ({ url }: UserFormProps) => {
|
|
41
42
|
mobile: string;
|
42
43
|
address: string;
|
43
44
|
roleType: string;
|
45
|
+
gender: string;
|
44
46
|
};
|
45
47
|
setIsEditMode(true);
|
46
48
|
setUserName(user.name);
|
@@ -48,6 +50,7 @@ const UserForm = ({ url }: UserFormProps) => {
|
|
48
50
|
setMobile(user.mobile);
|
49
51
|
setAddress(user.address);
|
50
52
|
setRoleType(user.roleType);
|
53
|
+
setGender(user.gender);
|
51
54
|
}
|
52
55
|
} catch (error) {
|
53
56
|
console.error("Unable to fetch user data", error);
|
@@ -63,10 +66,26 @@ const UserForm = ({ url }: UserFormProps) => {
|
|
63
66
|
|
64
67
|
try {
|
65
68
|
if (isEditMode) {
|
66
|
-
await updateUserApi(
|
69
|
+
await updateUserApi(
|
70
|
+
url,
|
71
|
+
id,
|
72
|
+
userName,
|
73
|
+
mobile,
|
74
|
+
address,
|
75
|
+
roleType,
|
76
|
+
gender
|
77
|
+
);
|
67
78
|
alert("User updated successfully");
|
68
79
|
} else {
|
69
|
-
await addUserApi(
|
80
|
+
await addUserApi(
|
81
|
+
url,
|
82
|
+
userName,
|
83
|
+
email,
|
84
|
+
mobile,
|
85
|
+
address,
|
86
|
+
roleType,
|
87
|
+
gender
|
88
|
+
);
|
70
89
|
alert("User added successfully");
|
71
90
|
}
|
72
91
|
// window.location.href = "/admin/users";
|
@@ -84,6 +103,7 @@ const UserForm = ({ url }: UserFormProps) => {
|
|
84
103
|
setMobile("");
|
85
104
|
setAddress("");
|
86
105
|
setRoleType("");
|
106
|
+
setGender("");
|
87
107
|
|
88
108
|
window.history.pushState({}, "", "/admin/users");
|
89
109
|
window.dispatchEvent(new PopStateEvent("popstate"));
|
@@ -151,6 +171,22 @@ const UserForm = ({ url }: UserFormProps) => {
|
|
151
171
|
/>
|
152
172
|
</div>
|
153
173
|
|
174
|
+
<div className="mb-6 w-full">
|
175
|
+
<label className="text-gray-900 dark:text-gray-200 font-semibold">
|
176
|
+
Gender <span className="text-red-500">*</span>
|
177
|
+
</label>
|
178
|
+
<select
|
179
|
+
required
|
180
|
+
value={roleType}
|
181
|
+
onChange={(e) => setGender(e.target.value)}
|
182
|
+
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"
|
183
|
+
>
|
184
|
+
<option value="">Select a Role Type</option>
|
185
|
+
<option value="Male">Male</option>
|
186
|
+
<option value="Female">Female</option>
|
187
|
+
</select>
|
188
|
+
</div>
|
189
|
+
|
154
190
|
<div className="mb-6 w-full">
|
155
191
|
<label className="text-gray-900 dark:text-gray-200 font-semibold">
|
156
192
|
Role Type <span className="text-red-500">*</span>
|
@@ -179,6 +179,12 @@ const Users = ({ url }: UsersProps) => {
|
|
179
179
|
>
|
180
180
|
Role Type
|
181
181
|
</th>
|
182
|
+
<th
|
183
|
+
scope="col"
|
184
|
+
className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400"
|
185
|
+
>
|
186
|
+
Gender
|
187
|
+
</th>
|
182
188
|
</tr>
|
183
189
|
</thead>
|
184
190
|
<tbody className="bg-white divide-y divide-gray-200 dark:divide-gray-700 dark:bg-gray-900">
|
@@ -231,7 +237,6 @@ const Users = ({ url }: UsersProps) => {
|
|
231
237
|
/>
|
232
238
|
</svg>
|
233
239
|
</button>
|
234
|
-
{/* </a> */}
|
235
240
|
</div>
|
236
241
|
</td>
|
237
242
|
<td className="px-4 py-4 text-sm font-medium text-gray-700 whitespace-nowrap">
|
@@ -255,7 +260,10 @@ const Users = ({ url }: UsersProps) => {
|
|
255
260
|
{user?.address || "Not Provided"}
|
256
261
|
</td>
|
257
262
|
<td className="px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap">
|
258
|
-
{user
|
263
|
+
{user?.gender || "Not Provided"}
|
264
|
+
</td>
|
265
|
+
<td className="px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap">
|
266
|
+
{user.roleType === 1 ? "Guest" : "Admin"}
|
259
267
|
</td>
|
260
268
|
</tr>
|
261
269
|
))}
|
@@ -9,7 +9,8 @@ export const addUserApi = async (
|
|
9
9
|
email: string,
|
10
10
|
mobile: string,
|
11
11
|
address: string,
|
12
|
-
roleType: string
|
12
|
+
roleType: string,
|
13
|
+
gender: string
|
13
14
|
) => {
|
14
15
|
const token = cookies.get("token");
|
15
16
|
|
@@ -22,6 +23,7 @@ export const addUserApi = async (
|
|
22
23
|
Mobile: mobile,
|
23
24
|
Address: address,
|
24
25
|
RoleType: Number(roleType),
|
26
|
+
Gender: gender,
|
25
27
|
},
|
26
28
|
{
|
27
29
|
headers: {
|
@@ -100,7 +102,8 @@ export const updateUserApi = async (
|
|
100
102
|
name: string,
|
101
103
|
mobile: string,
|
102
104
|
address: string,
|
103
|
-
roleType: string
|
105
|
+
roleType: string,
|
106
|
+
gender: string
|
104
107
|
) => {
|
105
108
|
const token = cookies.get("token");
|
106
109
|
|
@@ -113,6 +116,7 @@ export const updateUserApi = async (
|
|
113
116
|
Mobile: mobile,
|
114
117
|
Address: address,
|
115
118
|
RoleType: Number(roleType),
|
119
|
+
Gender: gender,
|
116
120
|
},
|
117
121
|
{
|
118
122
|
headers: {
|
@@ -0,0 +1,153 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { useState, useEffect } from "react";
|
3
|
+
import { getProfileApi } from "../api/updateuser";
|
4
|
+
import Cookies from "universal-cookie";
|
5
|
+
|
6
|
+
interface AddMissingDetailsProps {
|
7
|
+
usermodalopen: boolean;
|
8
|
+
closeusermodal: () => void;
|
9
|
+
url: string;
|
10
|
+
isDarkMode: boolean;
|
11
|
+
}
|
12
|
+
interface UserProfile {
|
13
|
+
name: string;
|
14
|
+
mobile: string;
|
15
|
+
address: string;
|
16
|
+
}
|
17
|
+
|
18
|
+
const AddMissingDetails: React.FC<AddMissingDetailsProps> = ({
|
19
|
+
usermodalopen,
|
20
|
+
closeusermodal,
|
21
|
+
url,
|
22
|
+
isDarkMode,
|
23
|
+
}) => {
|
24
|
+
const [name, setName] = useState<string>("");
|
25
|
+
const [mobile, setMobile] = useState<string>("");
|
26
|
+
const [address, setAddress] = useState<string>("");
|
27
|
+
const [user, setUser] = useState<UserProfile | undefined>(undefined);
|
28
|
+
|
29
|
+
const cookies = new Cookies();
|
30
|
+
const token = cookies.get("authToken");
|
31
|
+
|
32
|
+
const userToken = token?.data?.token || token;
|
33
|
+
|
34
|
+
useEffect(() => {
|
35
|
+
const fetchUserProfile = async () => {
|
36
|
+
if (usermodalopen && userToken && !user) {
|
37
|
+
try {
|
38
|
+
const userProfile = await getProfileApi(userToken, url);
|
39
|
+
if (userProfile) {
|
40
|
+
setUser(userProfile);
|
41
|
+
setName(userProfile.name);
|
42
|
+
setMobile(userProfile.mobile);
|
43
|
+
setAddress(userProfile.address);
|
44
|
+
}
|
45
|
+
} catch (error) {
|
46
|
+
console.error("Error fetching user profile:", error);
|
47
|
+
}
|
48
|
+
}
|
49
|
+
};
|
50
|
+
|
51
|
+
fetchUserProfile();
|
52
|
+
}, [usermodalopen, userToken, user]);
|
53
|
+
|
54
|
+
return (
|
55
|
+
<div
|
56
|
+
className={`fixed inset-0 flex items-center justify-center ${
|
57
|
+
isDarkMode ? "bg-gray-800 bg-opacity-90" : "bg-gray-500 bg-opacity-75"
|
58
|
+
}`}
|
59
|
+
>
|
60
|
+
<div
|
61
|
+
className={`rounded-lg p-6 w-full max-w-md relative ${
|
62
|
+
isDarkMode
|
63
|
+
? "border border-gray-300 bg-[#242424] text-white"
|
64
|
+
: "bg-white text-black"
|
65
|
+
}`}
|
66
|
+
>
|
67
|
+
<button
|
68
|
+
onClick={closeusermodal}
|
69
|
+
className={`absolute top-3 right-3 ${
|
70
|
+
isDarkMode
|
71
|
+
? "text-gray-300 hover:text-gray-500"
|
72
|
+
: "text-gray-400 hover:text-gray-600"
|
73
|
+
} text-2xl`}
|
74
|
+
>
|
75
|
+
×
|
76
|
+
</button>
|
77
|
+
|
78
|
+
<h3 className="text-center text-xl font-bold mb-4">Add User Details</h3>
|
79
|
+
|
80
|
+
<div className="mb-4">
|
81
|
+
<label
|
82
|
+
className={`block text-sm font-medium mb-1 ${
|
83
|
+
isDarkMode ? "text-gray-300" : "text-gray-700"
|
84
|
+
}`}
|
85
|
+
>
|
86
|
+
Name
|
87
|
+
</label>
|
88
|
+
<input
|
89
|
+
type="text"
|
90
|
+
placeholder="Name"
|
91
|
+
className={`w-full p-2 border rounded focus:outline-none focus:ring ${
|
92
|
+
isDarkMode
|
93
|
+
? "bg-gray-800 border-gray-700 text-white "
|
94
|
+
: "border-gray-300 "
|
95
|
+
}`}
|
96
|
+
/>
|
97
|
+
</div>
|
98
|
+
|
99
|
+
<div className="mb-4">
|
100
|
+
<label
|
101
|
+
className={`block text-sm font-medium mb-1 ${
|
102
|
+
isDarkMode ? "text-gray-300" : "text-gray-700"
|
103
|
+
}`}
|
104
|
+
>
|
105
|
+
Mobile
|
106
|
+
</label>
|
107
|
+
<input
|
108
|
+
type="tel"
|
109
|
+
placeholder="Mobile"
|
110
|
+
className={`w-full p-2 border rounded focus:outline-none focus:ring ${
|
111
|
+
isDarkMode
|
112
|
+
? "bg-gray-800 border-gray-700 text-white "
|
113
|
+
: "border-gray-300 "
|
114
|
+
}`}
|
115
|
+
/>
|
116
|
+
</div>
|
117
|
+
|
118
|
+
<div className="mb-4">
|
119
|
+
<label
|
120
|
+
className={`block text-sm font-medium mb-1 ${
|
121
|
+
isDarkMode ? "text-gray-300" : "text-gray-700"
|
122
|
+
}`}
|
123
|
+
>
|
124
|
+
Address
|
125
|
+
</label>
|
126
|
+
<input
|
127
|
+
type="text"
|
128
|
+
placeholder="Address"
|
129
|
+
className={`w-full p-2 border rounded focus:outline-none focus:ring ${
|
130
|
+
isDarkMode
|
131
|
+
? "bg-gray-800 border-gray-700 text-white "
|
132
|
+
: "border-gray-300 "
|
133
|
+
}`}
|
134
|
+
/>
|
135
|
+
</div>
|
136
|
+
|
137
|
+
<div className="flex justify-end">
|
138
|
+
<button
|
139
|
+
className={`px-4 py-2 rounded ${
|
140
|
+
isDarkMode
|
141
|
+
? "bg-blue-500 hover:bg-blue-400 text-white"
|
142
|
+
: "bg-blue-500 hover:bg-blue-400 text-white"
|
143
|
+
}`}
|
144
|
+
>
|
145
|
+
Add Details
|
146
|
+
</button>
|
147
|
+
</div>
|
148
|
+
</div>
|
149
|
+
</div>
|
150
|
+
);
|
151
|
+
};
|
152
|
+
|
153
|
+
export default AddMissingDetails;
|
@@ -0,0 +1,136 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { useState } from "react";
|
3
|
+
import { getProfileApi } from "../api/updateuser";
|
4
|
+
|
5
|
+
interface AddUserDetailsProps {
|
6
|
+
usermodalopen: boolean;
|
7
|
+
closeusermodal: () => void;
|
8
|
+
url: string;
|
9
|
+
isDarkMode: boolean;
|
10
|
+
}
|
11
|
+
|
12
|
+
interface UserProfile {
|
13
|
+
name: string;
|
14
|
+
mobile: string;
|
15
|
+
address: string;
|
16
|
+
// add any other fields that `userProfile` is expected to have
|
17
|
+
}
|
18
|
+
|
19
|
+
const AddUserDetails: React.FC<AddUserDetailsProps> = ({
|
20
|
+
usermodalopen,
|
21
|
+
closeusermodal,
|
22
|
+
url,
|
23
|
+
isDarkMode,
|
24
|
+
}) => {
|
25
|
+
const [name, setName] = useState("");
|
26
|
+
const [mobile, setMobile] = useState("");
|
27
|
+
const [address, setAddress] = useState("");
|
28
|
+
|
29
|
+
return (
|
30
|
+
<div
|
31
|
+
className={`fixed inset-0 flex items-center justify-center ${
|
32
|
+
isDarkMode ? "bg-gray-800 bg-opacity-90" : "bg-gray-500 bg-opacity-75"
|
33
|
+
}`}
|
34
|
+
>
|
35
|
+
<div
|
36
|
+
className={`rounded-lg p-6 w-full max-w-md relative ${
|
37
|
+
isDarkMode
|
38
|
+
? "border border-gray-300 bg-[#242424] text-white"
|
39
|
+
: "bg-white text-black"
|
40
|
+
}`}
|
41
|
+
>
|
42
|
+
<button
|
43
|
+
onClick={closeusermodal}
|
44
|
+
className={`absolute top-3 right-3 ${
|
45
|
+
isDarkMode
|
46
|
+
? "text-gray-300 hover:text-gray-500"
|
47
|
+
: "text-gray-400 hover:text-gray-600"
|
48
|
+
} text-2xl`}
|
49
|
+
>
|
50
|
+
×
|
51
|
+
</button>
|
52
|
+
|
53
|
+
<h3 className="text-center text-xl font-bold mb-4">
|
54
|
+
Update User Details
|
55
|
+
</h3>
|
56
|
+
|
57
|
+
<div className="mb-4">
|
58
|
+
<label
|
59
|
+
className={`block text-sm font-medium mb-1 ${
|
60
|
+
isDarkMode ? "text-gray-300" : "text-gray-700"
|
61
|
+
}`}
|
62
|
+
>
|
63
|
+
Name
|
64
|
+
</label>
|
65
|
+
<input
|
66
|
+
type="text"
|
67
|
+
placeholder="Name"
|
68
|
+
value={name}
|
69
|
+
onChange={(e) => setName(e.target.value)}
|
70
|
+
className={`w-full p-2 border rounded focus:outline-none focus:ring ${
|
71
|
+
isDarkMode
|
72
|
+
? "bg-gray-800 border-gray-700 text-white "
|
73
|
+
: "border-gray-300 "
|
74
|
+
}`}
|
75
|
+
/>
|
76
|
+
</div>
|
77
|
+
|
78
|
+
<div className="mb-4">
|
79
|
+
<label
|
80
|
+
className={`block text-sm font-medium mb-1 ${
|
81
|
+
isDarkMode ? "text-gray-300" : "text-gray-700"
|
82
|
+
}`}
|
83
|
+
>
|
84
|
+
Mobile
|
85
|
+
</label>
|
86
|
+
<input
|
87
|
+
type="tel"
|
88
|
+
placeholder="Mobile"
|
89
|
+
value={mobile}
|
90
|
+
onChange={(e) => setMobile(e.target.value)}
|
91
|
+
className={`w-full p-2 border rounded focus:outline-none focus:ring ${
|
92
|
+
isDarkMode
|
93
|
+
? "bg-gray-800 border-gray-700 text-white "
|
94
|
+
: "border-gray-300 "
|
95
|
+
}`}
|
96
|
+
/>
|
97
|
+
</div>
|
98
|
+
|
99
|
+
<div className="mb-4">
|
100
|
+
<label
|
101
|
+
className={`block text-sm font-medium mb-1 ${
|
102
|
+
isDarkMode ? "text-gray-300" : "text-gray-700"
|
103
|
+
}`}
|
104
|
+
>
|
105
|
+
Address
|
106
|
+
</label>
|
107
|
+
<input
|
108
|
+
type="text"
|
109
|
+
placeholder="Address"
|
110
|
+
value={address}
|
111
|
+
onChange={(e) => setAddress(e.target.value)}
|
112
|
+
className={`w-full p-2 border rounded focus:outline-none focus:ring ${
|
113
|
+
isDarkMode
|
114
|
+
? "bg-gray-800 border-gray-700 text-white "
|
115
|
+
: "border-gray-300 "
|
116
|
+
}`}
|
117
|
+
/>
|
118
|
+
</div>
|
119
|
+
|
120
|
+
<div className="flex justify-end">
|
121
|
+
<button
|
122
|
+
className={`px-4 py-2 rounded ${
|
123
|
+
isDarkMode
|
124
|
+
? "bg-blue-500 hover:bg-blue-400 text-white"
|
125
|
+
: "bg-blue-500 hover:bg-blue-400 text-white"
|
126
|
+
}`}
|
127
|
+
>
|
128
|
+
Update Details
|
129
|
+
</button>
|
130
|
+
</div>
|
131
|
+
</div>
|
132
|
+
</div>
|
133
|
+
);
|
134
|
+
};
|
135
|
+
|
136
|
+
export default AddUserDetails;
|