eleven-solutions-common-website-unique-web 21.0.14 → 21.0.16

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.
@@ -35,13 +35,6 @@ const Users = ({ url }) => {
35
35
  };
36
36
  const [currentPage, setCurrentPage] = useState(1);
37
37
  const itemsPerPage = 10;
38
- // const filteredUsers = users.filter((user) => {
39
- // if (searchTerm.length < 2) return true;
40
- // const nameMatch = user.name?.toLowerCase().includes(searchTerm) ?? false;
41
- // const emailMatch = user.email?.toLowerCase().includes(searchTerm) ?? false;
42
- // const mobileMatch = user.mobile?.toString().includes(searchTerm) ?? false;
43
- // return nameMatch || emailMatch || mobileMatch;
44
- // });
45
38
  const filteredUsers = users.filter((user) => {
46
39
  var _a, _b, _c;
47
40
  const matchesSearch = searchTerm.length < 2 ||
@@ -56,6 +49,9 @@ const Users = ({ url }) => {
56
49
  setSelectedRoleType(event.target.value);
57
50
  setCurrentPage(1);
58
51
  };
52
+ const resetFilter = () => {
53
+ setSelectedRoleType("");
54
+ };
59
55
  const totalPages = Math.ceil(filteredUsers.length / itemsPerPage);
60
56
  const handleNextPage = () => {
61
57
  if (currentPage < totalPages) {
@@ -104,6 +100,6 @@ const Users = ({ url }) => {
104
100
  : "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
105
101
  ? "text-blue-500 bg-blue-100"
106
102
  : "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"] }) })] }), _jsx("div", { className: "inset-0 bg-gray-800 bg-opacity-50 z-50 transition-opacity duration-300", children: _jsxs("div", { className: `fixed top-0 right-0 h-full w-[300px] md:w-[500px] bg-white p-4 rounded-md shadow-lg transform transition-transform duration-500 ease-in-out
107
- ${filterModal ? "translate-x-0" : "translate-x-full"}`, children: [_jsx("h1", { className: "text-2xl md:text-3xl font-bold text-blue-600 mb-4 md:mb-6", children: "Filter" }), _jsx("button", { onClick: () => setFilterModal(false), className: "absolute top-1 right-3 text-gray-400 hover:text-gray-600 text-2xl", children: "\u00D7" }), _jsx("div", { className: "flex flex-col", children: _jsxs("div", { className: "mb-4 flex flex-col", children: [_jsx("label", { className: "block text-gray-700 mb-2", children: "Role Type" }), _jsx("div", { className: "w-full", children: _jsxs("select", { value: Number(selectedRoleType), onChange: handleRoleTypeChange, required: true, className: "w-full px-4 py-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: "All" }), _jsx("option", { value: "1", children: "Guest" }), _jsx("option", { value: "2", children: "Admin" })] }) })] }) })] }) })] }));
103
+ ${filterModal ? "translate-x-0" : "translate-x-full"}`, children: [_jsx("h1", { className: "text-2xl md:text-3xl font-bold text-blue-600 mb-4 md:mb-6", children: "Filter" }), _jsx("button", { onClick: () => setFilterModal(false), className: "absolute top-1 right-3 text-gray-400 hover:text-gray-600 text-2xl", children: "\u00D7" }), _jsxs("div", { className: "flex flex-col", children: [_jsxs("div", { className: "mb-4 flex flex-col", children: [_jsx("label", { className: "block text-gray-700 mb-2", children: "Role Type" }), _jsx("div", { className: "w-full", children: _jsxs("select", { value: Number(selectedRoleType), onChange: handleRoleTypeChange, required: true, className: "w-full px-4 py-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: "All" }), _jsx("option", { value: "1", children: "Guest" }), _jsx("option", { value: "2", children: "Admin" })] }) })] }), _jsx("button", { onClick: resetFilter, className: "mt-2 px-4 py-2 bg-blue-500 text-white rounded-md", children: "Reset" })] })] }) })] }));
108
104
  };
109
105
  export default Users;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleven-solutions-common-website-unique-web",
3
- "version": "21.0.14",
3
+ "version": "21.0.16",
4
4
  "main": "./dist/index.js",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -38,16 +38,6 @@ const Users = ({ url }: UsersProps) => {
38
38
  const [currentPage, setCurrentPage] = useState(1);
39
39
  const itemsPerPage = 10;
40
40
 
41
- // const filteredUsers = users.filter((user) => {
42
- // if (searchTerm.length < 2) return true;
43
-
44
- // const nameMatch = user.name?.toLowerCase().includes(searchTerm) ?? false;
45
- // const emailMatch = user.email?.toLowerCase().includes(searchTerm) ?? false;
46
- // const mobileMatch = user.mobile?.toString().includes(searchTerm) ?? false;
47
-
48
- // return nameMatch || emailMatch || mobileMatch;
49
- // });
50
-
51
41
  const filteredUsers = users.filter((user) => {
52
42
  const matchesSearch =
53
43
  searchTerm.length < 2 ||
@@ -69,6 +59,10 @@ const Users = ({ url }: UsersProps) => {
69
59
  setCurrentPage(1);
70
60
  };
71
61
 
62
+ const resetFilter = () => {
63
+ setSelectedRoleType("");
64
+ };
65
+
72
66
  const totalPages = Math.ceil(filteredUsers.length / itemsPerPage);
73
67
 
74
68
  const handleNextPage = () => {
@@ -453,6 +447,12 @@ const Users = ({ url }: UsersProps) => {
453
447
  </select>
454
448
  </div>
455
449
  </div>
450
+ <button
451
+ onClick={resetFilter}
452
+ className="mt-2 px-4 py-2 bg-blue-500 text-white rounded-md"
453
+ >
454
+ Reset
455
+ </button>
456
456
  </div>
457
457
  </div>
458
458
  </div>