eleven-solutions-common-website-unique-web 2.0.4 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -25,13 +25,6 @@ function Users() {
|
|
25
25
|
useEffect(() => {
|
26
26
|
fetchUsersData();
|
27
27
|
}, []);
|
28
|
-
// const handleNav = (e: React.FormEvent) => {
|
29
|
-
// e.preventDefault();
|
30
|
-
// window.history.pushState({}, "", "/admin/users/userform");
|
31
|
-
// // Trigger React's routing logic manually if required
|
32
|
-
// const navEvent = new PopStateEvent("popstate");
|
33
|
-
// window.dispatchEvent(navEvent);
|
34
|
-
// };
|
35
28
|
const handleNavigation = (event, path) => {
|
36
29
|
event.preventDefault();
|
37
30
|
window.history.pushState({}, "", path);
|
@@ -68,7 +61,9 @@ function Users() {
|
|
68
61
|
// navigate("/admin/user/userform", { state: { id } });
|
69
62
|
// };
|
70
63
|
const handleEditClick = (id) => {
|
71
|
-
|
64
|
+
const path = `/admin/users/userform?id=${id}`;
|
65
|
+
window.history.pushState({}, "", path);
|
66
|
+
window.dispatchEvent(new PopStateEvent("popstate"));
|
72
67
|
};
|
73
68
|
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("a", { href: `/admin/users/userform?id=${user.id}`, onClick: (e) => {
|
74
69
|
e.preventDefault(); // Prevent default navigation
|
package/package.json
CHANGED
@@ -20,14 +20,6 @@ function Users() {
|
|
20
20
|
useEffect(() => {
|
21
21
|
fetchUsersData();
|
22
22
|
}, []);
|
23
|
-
// const handleNav = (e: React.FormEvent) => {
|
24
|
-
// e.preventDefault();
|
25
|
-
// window.history.pushState({}, "", "/admin/users/userform");
|
26
|
-
|
27
|
-
// // Trigger React's routing logic manually if required
|
28
|
-
// const navEvent = new PopStateEvent("popstate");
|
29
|
-
// window.dispatchEvent(navEvent);
|
30
|
-
// };
|
31
23
|
|
32
24
|
const handleNavigation = (event: React.MouseEvent, path: string) => {
|
33
25
|
event.preventDefault();
|
@@ -77,14 +69,9 @@ function Users() {
|
|
77
69
|
// };
|
78
70
|
|
79
71
|
const handleEditClick = (id: string) => {
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
onClick={(e) => e.preventDefault()}
|
84
|
-
>
|
85
|
-
Edit User
|
86
|
-
</a>
|
87
|
-
);
|
72
|
+
const path = `/admin/users/userform?id=${id}`;
|
73
|
+
window.history.pushState({}, "", path);
|
74
|
+
window.dispatchEvent(new PopStateEvent("popstate"));
|
88
75
|
};
|
89
76
|
|
90
77
|
return (
|