eleven-solutions-common-website-unique-web 20.0.41 → 20.0.43
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.
@@ -81,9 +81,7 @@ const UserForm = ({ url }) => {
|
|
81
81
|
window.history.pushState({}, "", "/admin/users");
|
82
82
|
window.dispatchEvent(new PopStateEvent("popstate"));
|
83
83
|
};
|
84
|
-
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: ["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",
|
85
|
-
// disabled={isEditMode}
|
86
|
-
disabled: isEditMode && email !== null && email.trim() !== "" })] }), _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: [_jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Gender" }), _jsxs("select", { required: true, value: gender,
|
84
|
+
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: ["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: [_jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Gender" }), _jsxs("select", { required: true, value: gender,
|
87
85
|
// onChange={(e) => setGender(e.target.value)}
|
88
86
|
onChange: (e) => setGender(e.target.value === "" ? null : 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 Gender" }), _jsx("option", { value: "1", children: "Male" }), _jsx("option", { value: "2", 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" })] })] }) }) }));
|
89
87
|
};
|
@@ -33,12 +33,22 @@ const Users = ({ url }) => {
|
|
33
33
|
};
|
34
34
|
const [currentPage, setCurrentPage] = useState(1);
|
35
35
|
const itemsPerPage = 10;
|
36
|
+
// const filteredUsers = users.filter((user) => {
|
37
|
+
// if (searchTerm.length < 2) return true;
|
38
|
+
// return (
|
39
|
+
// user.name.toLowerCase().includes(searchTerm) ||
|
40
|
+
// user.email.toLowerCase().includes(searchTerm) ||
|
41
|
+
// user.mobile.toString().includes(searchTerm)
|
42
|
+
// );
|
43
|
+
// });
|
36
44
|
const filteredUsers = users.filter((user) => {
|
45
|
+
var _a, _b, _c, _d, _e, _f;
|
37
46
|
if (searchTerm.length < 2)
|
38
47
|
return true;
|
39
|
-
|
40
|
-
|
41
|
-
|
48
|
+
const nameMatch = (_b = (_a = user.name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTerm)) !== null && _b !== void 0 ? _b : false;
|
49
|
+
const emailMatch = (_d = (_c = user.email) === null || _c === void 0 ? void 0 : _c.toLowerCase().includes(searchTerm)) !== null && _d !== void 0 ? _d : false;
|
50
|
+
const mobileMatch = (_f = (_e = user.mobile) === null || _e === void 0 ? void 0 : _e.toString().includes(searchTerm)) !== null && _f !== void 0 ? _f : false;
|
51
|
+
return nameMatch || emailMatch || mobileMatch;
|
42
52
|
});
|
43
53
|
const totalPages = Math.ceil(filteredUsers.length / itemsPerPage);
|
44
54
|
const handleNextPage = () => {
|
package/package.json
CHANGED
@@ -140,8 +140,8 @@ const UserForm = ({ url }: UserFormProps) => {
|
|
140
140
|
type="email"
|
141
141
|
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"
|
142
142
|
placeholder="Enter Email"
|
143
|
-
|
144
|
-
disabled={isEditMode && email !== null && email.trim() !== ""}
|
143
|
+
disabled={isEditMode}
|
144
|
+
// disabled={isEditMode && email !== null && email.trim() !== ""}
|
145
145
|
/>
|
146
146
|
</div>
|
147
147
|
<div className="mb-6 w-full">
|
@@ -35,13 +35,23 @@ const Users = ({ url }: UsersProps) => {
|
|
35
35
|
const [currentPage, setCurrentPage] = useState(1);
|
36
36
|
const itemsPerPage = 10;
|
37
37
|
|
38
|
+
// const filteredUsers = users.filter((user) => {
|
39
|
+
// if (searchTerm.length < 2) return true;
|
40
|
+
// return (
|
41
|
+
// user.name.toLowerCase().includes(searchTerm) ||
|
42
|
+
// user.email.toLowerCase().includes(searchTerm) ||
|
43
|
+
// user.mobile.toString().includes(searchTerm)
|
44
|
+
// );
|
45
|
+
// });
|
46
|
+
|
38
47
|
const filteredUsers = users.filter((user) => {
|
39
48
|
if (searchTerm.length < 2) return true;
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
49
|
+
|
50
|
+
const nameMatch = user.name?.toLowerCase().includes(searchTerm) ?? false;
|
51
|
+
const emailMatch = user.email?.toLowerCase().includes(searchTerm) ?? false;
|
52
|
+
const mobileMatch = user.mobile?.toString().includes(searchTerm) ?? false;
|
53
|
+
|
54
|
+
return nameMatch || emailMatch || mobileMatch;
|
45
55
|
});
|
46
56
|
|
47
57
|
const totalPages = Math.ceil(filteredUsers.length / itemsPerPage);
|