eleven-solutions-common-website-unique-web 1.0.33 → 1.0.35
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,359 +1,384 @@
|
|
1
|
-
import React from "react";
|
2
|
-
import { useState, useEffect } from "react";
|
1
|
+
// import React from "react";
|
2
|
+
// import { useState, useEffect } from "react";
|
3
3
|
|
4
|
-
import { FaPlus } from "react-icons/fa";
|
4
|
+
// import { FaPlus } from "react-icons/fa";
|
5
5
|
|
6
|
-
import { fetchUsersApi, deleteUserApi } from "../api/user";
|
6
|
+
// import { fetchUsersApi, deleteUserApi } from "../api/user";
|
7
7
|
|
8
|
-
function Users() {
|
9
|
-
|
10
|
-
|
11
|
-
const fetchUsersData = async () => {
|
12
|
-
const data = await fetchUsersApi();
|
13
|
-
if (data) {
|
14
|
-
setUsers(data as any[]);
|
15
|
-
} else {
|
16
|
-
console.error("Failed to fetch users");
|
17
|
-
}
|
18
|
-
};
|
8
|
+
// function Users() {
|
9
|
+
// const [users, setUsers] = useState<any[]>([]);
|
19
10
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
11
|
+
// const fetchUsersData = async () => {
|
12
|
+
// const data = await fetchUsersApi();
|
13
|
+
// if (data) {
|
14
|
+
// setUsers(data as any[]);
|
15
|
+
// } else {
|
16
|
+
// console.error("Failed to fetch users");
|
17
|
+
// }
|
18
|
+
// };
|
26
19
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
20
|
+
// useEffect(() => {
|
21
|
+
// fetchUsersData();
|
22
|
+
// }, []);
|
23
|
+
// // const handleNav = (e: React.FormEvent) => {
|
24
|
+
// // e.preventDefault();
|
25
|
+
// // window.history.pushState({}, "", "/admin/users/userform");
|
31
26
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
};
|
27
|
+
// // // Trigger React's routing logic manually if required
|
28
|
+
// // const navEvent = new PopStateEvent("popstate");
|
29
|
+
// // window.dispatchEvent(navEvent);
|
30
|
+
// // };
|
37
31
|
|
38
|
-
|
39
|
-
|
32
|
+
// const handleNavigation = (event: React.MouseEvent, path: string) => {
|
33
|
+
// event.preventDefault();
|
34
|
+
// window.history.pushState({}, "", path);
|
35
|
+
// window.dispatchEvent(new PopStateEvent("popstate"));
|
36
|
+
// };
|
40
37
|
|
41
|
-
|
38
|
+
// const [currentPage, setCurrentPage] = useState(1);
|
39
|
+
// const itemsPerPage = 10;
|
42
40
|
|
43
|
-
|
44
|
-
if (currentPage < totalPages) {
|
45
|
-
setCurrentPage(currentPage + 1);
|
46
|
-
}
|
47
|
-
};
|
41
|
+
// const totalPages = Math.ceil(users.length / itemsPerPage);
|
48
42
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
43
|
+
// const handleNextPage = () => {
|
44
|
+
// if (currentPage < totalPages) {
|
45
|
+
// setCurrentPage(currentPage + 1);
|
46
|
+
// }
|
47
|
+
// };
|
54
48
|
|
55
|
-
|
56
|
-
|
57
|
-
|
49
|
+
// const handlePreviousPage = () => {
|
50
|
+
// if (currentPage > 1) {
|
51
|
+
// setCurrentPage(currentPage - 1);
|
52
|
+
// }
|
53
|
+
// };
|
58
54
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
);
|
55
|
+
// const handlePageClick = (pageNumber: number) => {
|
56
|
+
// setCurrentPage(pageNumber);
|
57
|
+
// };
|
63
58
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
59
|
+
// const paginatedUsers = users.slice(
|
60
|
+
// (currentPage - 1) * itemsPerPage,
|
61
|
+
// currentPage * itemsPerPage
|
62
|
+
// );
|
68
63
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
};
|
64
|
+
// const handleDeleteClick = async (id: string) => {
|
65
|
+
// try {
|
66
|
+
// await deleteUserApi(id);
|
67
|
+
// alert("User deleted successfully");
|
74
68
|
|
75
|
-
|
76
|
-
|
77
|
-
|
69
|
+
// fetchUsersData();
|
70
|
+
// } catch (error) {
|
71
|
+
// console.error("Error deleting User:", error);
|
72
|
+
// }
|
73
|
+
// };
|
78
74
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
75
|
+
// // const handleEditClick = (id: string) => {
|
76
|
+
// // navigate("/admin/user/userform", { state: { id } });
|
77
|
+
// // };
|
78
|
+
|
79
|
+
// const handleEditClick = (id: string) => {
|
80
|
+
// return (
|
81
|
+
// <a
|
82
|
+
// href={`/admin/users/userform?id=${id}`}
|
83
|
+
// onClick={(e) => e.preventDefault()}
|
84
|
+
// >
|
85
|
+
// Edit User
|
86
|
+
// </a>
|
87
|
+
// );
|
88
|
+
// };
|
89
|
+
|
90
|
+
// return (
|
91
|
+
// <div className="container px-4 mx-auto mt-6">
|
92
|
+
// <div className="w-3/4">
|
93
|
+
// <h1 className="text-3xl font-bold text-blue-600 mb-5">Users</h1>
|
94
|
+
// </div>
|
95
|
+
// <div className="flex-grow ml-0 w-full mt-10">
|
96
|
+
// <form className="w-full ">
|
97
|
+
// <label
|
98
|
+
// htmlFor="default-search"
|
99
|
+
// className="mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white"
|
100
|
+
// >
|
101
|
+
// Search
|
102
|
+
// </label>
|
103
|
+
// <div className="relative w-full">
|
104
|
+
// <div className="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none">
|
105
|
+
// <svg
|
106
|
+
// className="w-4 h-4 text-gray-500 dark:text-gray-400"
|
107
|
+
// aria-hidden="true"
|
108
|
+
// xmlns="http://www.w3.org/2000/svg"
|
109
|
+
// fill="none"
|
110
|
+
// viewBox="0 0 20 20"
|
111
|
+
// >
|
112
|
+
// <path
|
113
|
+
// stroke="currentColor"
|
114
|
+
// stroke-linecap="round"
|
115
|
+
// stroke-linejoin="round"
|
116
|
+
// stroke-width="2"
|
117
|
+
// d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"
|
118
|
+
// />
|
119
|
+
// </svg>
|
120
|
+
// </div>
|
121
|
+
// <input
|
122
|
+
// type="search"
|
123
|
+
// id="default-search"
|
124
|
+
// 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"
|
125
|
+
// placeholder="Search Users"
|
126
|
+
// required
|
127
|
+
// />
|
128
|
+
// <button
|
129
|
+
// type="submit"
|
130
|
+
// 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"
|
131
|
+
// >
|
132
|
+
// Search
|
133
|
+
// </button>
|
134
|
+
// </div>
|
135
|
+
// </form>
|
136
|
+
// </div>
|
137
|
+
// <div className="flex-grow ml-0 w-3/4">
|
138
|
+
// <form className="w-auto">{/* Search Form */}</form>
|
139
|
+
// </div>
|
140
|
+
// <div className="flex-grow ml-0 mt-4 w-full">
|
141
|
+
// <div className="overflow-hidden border border-gray-200 dark:border-gray-700 md:rounded-lg mt-6">
|
142
|
+
// <table className="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
|
143
|
+
// <thead className="bg-gray-50 dark:bg-gray-800">
|
144
|
+
// <tr>
|
145
|
+
// <th
|
146
|
+
// scope="col"
|
147
|
+
// className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400"
|
148
|
+
// >
|
149
|
+
// Edit/Delete
|
150
|
+
// </th>
|
151
|
+
// <th
|
152
|
+
// scope="col"
|
153
|
+
// className="py-3.5 px-4 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400"
|
154
|
+
// >
|
155
|
+
// <div className="flex items-center gap-x-3">
|
156
|
+
// <span>Name</span>
|
157
|
+
// </div>
|
158
|
+
// </th>
|
159
|
+
|
160
|
+
// <th
|
161
|
+
// scope="col"
|
162
|
+
// className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400"
|
163
|
+
// >
|
164
|
+
// <button className="flex items-center gap-x-2">
|
165
|
+
// <span>Email</span>
|
166
|
+
// </button>
|
167
|
+
// </th>
|
168
|
+
|
169
|
+
// <th
|
170
|
+
// scope="col"
|
171
|
+
// className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400"
|
172
|
+
// >
|
173
|
+
// <button className="flex items-center gap-x-2">
|
174
|
+
// <span>Mobile</span>
|
175
|
+
// </button>
|
176
|
+
// </th>
|
177
|
+
|
178
|
+
// <th
|
179
|
+
// scope="col"
|
180
|
+
// className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400"
|
181
|
+
// >
|
182
|
+
// Address
|
183
|
+
// </th>
|
184
|
+
|
185
|
+
// <th
|
186
|
+
// scope="col"
|
187
|
+
// className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400"
|
188
|
+
// >
|
189
|
+
// Role Type
|
190
|
+
// </th>
|
191
|
+
// </tr>
|
192
|
+
// </thead>
|
193
|
+
// <tbody className="bg-white divide-y divide-gray-200 dark:divide-gray-700 dark:bg-gray-900">
|
194
|
+
// {paginatedUsers.map((user, index) => (
|
195
|
+
// <tr key={user.id || index}>
|
196
|
+
// <td className="px-4 py-4 text-sm whitespace-nowrap">
|
197
|
+
// <div className="flex items-center gap-x-6">
|
198
|
+
// <button
|
199
|
+
// onClick={() => handleDeleteClick(user.id)}
|
200
|
+
// className="text-gray-500 transition-colors duration-200 dark:hover:text-red-600 dark:text-gray-300 hover:text-red-500 focus:outline-none"
|
201
|
+
// >
|
202
|
+
// <svg
|
203
|
+
// xmlns="http://www.w3.org/2000/svg"
|
204
|
+
// fill="none"
|
205
|
+
// viewBox="0 0 24 24"
|
206
|
+
// stroke-width="1.5"
|
207
|
+
// stroke="currentColor"
|
208
|
+
// className="w-5 h-5"
|
209
|
+
// >
|
210
|
+
// <path
|
211
|
+
// stroke-linecap="round"
|
212
|
+
// stroke-linejoin="round"
|
213
|
+
// 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"
|
214
|
+
// />
|
215
|
+
// </svg>
|
216
|
+
// </button>
|
217
|
+
|
218
|
+
// <a
|
219
|
+
// href={`/admin/users/userform?id=${user.id}`}
|
220
|
+
// onClick={(e) => {
|
221
|
+
// e.preventDefault(); // Prevent default navigation
|
222
|
+
// handleEditClick(user.id); // Trigger the edit functionality
|
223
|
+
// window.location.href = `/admin/users/userform?id=${user.id}`; // Manually navigate
|
224
|
+
// }}
|
225
|
+
// >
|
226
|
+
// <button className="text-gray-500 transition-colors duration-200 dark:hover:text-yellow-500 dark:text-gray-300 hover:text-yellow-500 focus:outline-none">
|
227
|
+
// <svg
|
228
|
+
// xmlns="http://www.w3.org/2000/svg"
|
229
|
+
// fill="none"
|
230
|
+
// viewBox="0 0 24 24"
|
231
|
+
// strokeWidth="1.5"
|
232
|
+
// stroke="currentColor"
|
233
|
+
// className="w-5 h-5"
|
234
|
+
// >
|
235
|
+
// <path
|
236
|
+
// strokeLinecap="round"
|
237
|
+
// strokeLinejoin="round"
|
238
|
+
// 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"
|
239
|
+
// />
|
240
|
+
// </svg>
|
241
|
+
// </button>
|
242
|
+
// </a>
|
243
|
+
// </div>
|
244
|
+
// </td>
|
245
|
+
// <td className="px-4 py-4 text-sm font-medium text-gray-700 whitespace-nowrap">
|
246
|
+
// <div className="inline-flex items-center gap-x-3">
|
247
|
+
// <div className="flex items-center gap-x-2">
|
248
|
+
// <div>
|
249
|
+
// <h2 className=" text-sm font-medium text-gray-800 dark:text-white ">
|
250
|
+
// {user.name}
|
251
|
+
// </h2>
|
252
|
+
// </div>
|
253
|
+
// </div>
|
254
|
+
// </div>
|
255
|
+
// </td>
|
256
|
+
// <td className="px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap">
|
257
|
+
// {user.email}
|
258
|
+
// </td>
|
259
|
+
// <td className="px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap">
|
260
|
+
// {user?.mobile || "Not Provided"}
|
261
|
+
// </td>
|
262
|
+
// <td className="px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap">
|
263
|
+
// {user?.address || "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"}
|
267
|
+
// </td>
|
268
|
+
// </tr>
|
269
|
+
// ))}
|
270
|
+
// </tbody>
|
271
|
+
// </table>
|
272
|
+
// </div>
|
273
|
+
|
274
|
+
// <div className="flex items-center justify-between mt-6">
|
275
|
+
// <button
|
276
|
+
// onClick={handlePreviousPage}
|
277
|
+
// disabled={currentPage === 1}
|
278
|
+
// 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"
|
279
|
+
// >
|
280
|
+
// <svg
|
281
|
+
// xmlns="http://www.w3.org/2000/svg"
|
282
|
+
// fill="none"
|
283
|
+
// viewBox="0 0 24 24"
|
284
|
+
// stroke-width="1.5"
|
285
|
+
// stroke="currentColor"
|
286
|
+
// className="w-5 h-5 rtl:-scale-x-100"
|
287
|
+
// >
|
288
|
+
// <path
|
289
|
+
// stroke-linecap="round"
|
290
|
+
// stroke-linejoin="round"
|
291
|
+
// d="M6.75 15.75L3 12m0 0l3.75-3.75M3 12h18"
|
292
|
+
// />
|
293
|
+
// </svg>
|
294
|
+
|
295
|
+
// <span>previous</span>
|
296
|
+
// </button>
|
297
|
+
|
298
|
+
// <div className="items-center hidden lg:flex gap-x-3">
|
299
|
+
// {Array.from({ length: totalPages }, (_, index) => (
|
300
|
+
// <button
|
301
|
+
// key={index + 1}
|
302
|
+
// onClick={() => handlePageClick(index + 1)}
|
303
|
+
// className={`px-2 py-1 text-sm ${
|
304
|
+
// currentPage === index + 1
|
305
|
+
// ? "text-blue-500 bg-blue-100"
|
306
|
+
// : "text-gray-500 hover:bg-gray-100"
|
307
|
+
// } rounded-md`}
|
308
|
+
// >
|
309
|
+
// {index + 1}
|
310
|
+
// </button>
|
311
|
+
// ))}
|
312
|
+
// </div>
|
313
|
+
// <button
|
314
|
+
// onClick={handleNextPage}
|
315
|
+
// disabled={currentPage === totalPages}
|
316
|
+
// 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"
|
317
|
+
// >
|
318
|
+
// <span>Next</span>
|
319
|
+
|
320
|
+
// <svg
|
321
|
+
// xmlns="http://www.w3.org/2000/svg"
|
322
|
+
// fill="none"
|
323
|
+
// viewBox="0 0 24 24"
|
324
|
+
// stroke-width="1.5"
|
325
|
+
// stroke="currentColor"
|
326
|
+
// className="w-5 h-5 rtl:-scale-x-100"
|
327
|
+
// >
|
328
|
+
// <path
|
329
|
+
// stroke-linecap="round"
|
330
|
+
// stroke-linejoin="round"
|
331
|
+
// d="M17.25 8.25L21 12m0 0l-3.75 3.75M21 12H3"
|
332
|
+
// />
|
333
|
+
// </svg>
|
334
|
+
// </button>
|
335
|
+
// </div>
|
336
|
+
|
337
|
+
// <div className="flex-grow ml-0 mt-4 w-0">
|
338
|
+
// {/* <a href="/admin/users/userform">
|
339
|
+
// <button
|
340
|
+
// type="button"
|
341
|
+
// 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"
|
342
|
+
// >
|
343
|
+
// <FaPlus className="mr-2 font-medium" />
|
344
|
+
// User
|
345
|
+
// </button>
|
346
|
+
// </a> */}
|
347
|
+
// <button
|
348
|
+
// type="button"
|
349
|
+
// onClick={(event) => handleNavigation(event, "users/userform")}
|
350
|
+
// 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"
|
351
|
+
// >
|
352
|
+
// <FaPlus className="mr-2 font-medium" />
|
353
|
+
// User
|
354
|
+
// </button>
|
355
|
+
// </div>
|
356
|
+
// </div>
|
357
|
+
// </div>
|
358
|
+
// );
|
359
|
+
// }
|
360
|
+
|
361
|
+
// export default Users;
|
362
|
+
|
363
|
+
import React from "react";
|
364
|
+
|
365
|
+
function Users() {
|
366
|
+
const handleNavigation = (event: React.MouseEvent, path: string) => {
|
367
|
+
event.preventDefault();
|
368
|
+
window.history.pushState({}, "", path);
|
369
|
+
window.dispatchEvent(new PopStateEvent("popstate"));
|
88
370
|
};
|
89
371
|
|
90
372
|
return (
|
91
|
-
<div
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
>
|
101
|
-
Search
|
102
|
-
</label>
|
103
|
-
<div className="relative w-full">
|
104
|
-
<div className="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none">
|
105
|
-
<svg
|
106
|
-
className="w-4 h-4 text-gray-500 dark:text-gray-400"
|
107
|
-
aria-hidden="true"
|
108
|
-
xmlns="http://www.w3.org/2000/svg"
|
109
|
-
fill="none"
|
110
|
-
viewBox="0 0 20 20"
|
111
|
-
>
|
112
|
-
<path
|
113
|
-
stroke="currentColor"
|
114
|
-
stroke-linecap="round"
|
115
|
-
stroke-linejoin="round"
|
116
|
-
stroke-width="2"
|
117
|
-
d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"
|
118
|
-
/>
|
119
|
-
</svg>
|
120
|
-
</div>
|
121
|
-
<input
|
122
|
-
type="search"
|
123
|
-
id="default-search"
|
124
|
-
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"
|
125
|
-
placeholder="Search Users"
|
126
|
-
required
|
127
|
-
/>
|
128
|
-
<button
|
129
|
-
type="submit"
|
130
|
-
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"
|
131
|
-
>
|
132
|
-
Search
|
133
|
-
</button>
|
134
|
-
</div>
|
135
|
-
</form>
|
136
|
-
</div>
|
137
|
-
<div className="flex-grow ml-0 w-3/4">
|
138
|
-
<form className="w-auto">{/* Search Form */}</form>
|
139
|
-
</div>
|
140
|
-
<div className="flex-grow ml-0 mt-4 w-full">
|
141
|
-
<div className="overflow-hidden border border-gray-200 dark:border-gray-700 md:rounded-lg mt-6">
|
142
|
-
<table className="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
|
143
|
-
<thead className="bg-gray-50 dark:bg-gray-800">
|
144
|
-
<tr>
|
145
|
-
<th
|
146
|
-
scope="col"
|
147
|
-
className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400"
|
148
|
-
>
|
149
|
-
Edit/Delete
|
150
|
-
</th>
|
151
|
-
<th
|
152
|
-
scope="col"
|
153
|
-
className="py-3.5 px-4 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400"
|
154
|
-
>
|
155
|
-
<div className="flex items-center gap-x-3">
|
156
|
-
<span>Name</span>
|
157
|
-
</div>
|
158
|
-
</th>
|
159
|
-
|
160
|
-
<th
|
161
|
-
scope="col"
|
162
|
-
className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400"
|
163
|
-
>
|
164
|
-
<button className="flex items-center gap-x-2">
|
165
|
-
<span>Email</span>
|
166
|
-
</button>
|
167
|
-
</th>
|
168
|
-
|
169
|
-
<th
|
170
|
-
scope="col"
|
171
|
-
className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400"
|
172
|
-
>
|
173
|
-
<button className="flex items-center gap-x-2">
|
174
|
-
<span>Mobile</span>
|
175
|
-
</button>
|
176
|
-
</th>
|
177
|
-
|
178
|
-
<th
|
179
|
-
scope="col"
|
180
|
-
className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400"
|
181
|
-
>
|
182
|
-
Address
|
183
|
-
</th>
|
184
|
-
|
185
|
-
<th
|
186
|
-
scope="col"
|
187
|
-
className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400"
|
188
|
-
>
|
189
|
-
Role Type
|
190
|
-
</th>
|
191
|
-
</tr>
|
192
|
-
</thead>
|
193
|
-
<tbody className="bg-white divide-y divide-gray-200 dark:divide-gray-700 dark:bg-gray-900">
|
194
|
-
{paginatedUsers.map((user, index) => (
|
195
|
-
<tr key={user.id || index}>
|
196
|
-
<td className="px-4 py-4 text-sm whitespace-nowrap">
|
197
|
-
<div className="flex items-center gap-x-6">
|
198
|
-
<button
|
199
|
-
onClick={() => handleDeleteClick(user.id)}
|
200
|
-
className="text-gray-500 transition-colors duration-200 dark:hover:text-red-600 dark:text-gray-300 hover:text-red-500 focus:outline-none"
|
201
|
-
>
|
202
|
-
<svg
|
203
|
-
xmlns="http://www.w3.org/2000/svg"
|
204
|
-
fill="none"
|
205
|
-
viewBox="0 0 24 24"
|
206
|
-
stroke-width="1.5"
|
207
|
-
stroke="currentColor"
|
208
|
-
className="w-5 h-5"
|
209
|
-
>
|
210
|
-
<path
|
211
|
-
stroke-linecap="round"
|
212
|
-
stroke-linejoin="round"
|
213
|
-
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"
|
214
|
-
/>
|
215
|
-
</svg>
|
216
|
-
</button>
|
217
|
-
|
218
|
-
<a
|
219
|
-
href={`/admin/users/userform?id=${user.id}`}
|
220
|
-
onClick={(e) => {
|
221
|
-
e.preventDefault(); // Prevent default navigation
|
222
|
-
handleEditClick(user.id); // Trigger the edit functionality
|
223
|
-
window.location.href = `/admin/users/userform?id=${user.id}`; // Manually navigate
|
224
|
-
}}
|
225
|
-
>
|
226
|
-
<button className="text-gray-500 transition-colors duration-200 dark:hover:text-yellow-500 dark:text-gray-300 hover:text-yellow-500 focus:outline-none">
|
227
|
-
<svg
|
228
|
-
xmlns="http://www.w3.org/2000/svg"
|
229
|
-
fill="none"
|
230
|
-
viewBox="0 0 24 24"
|
231
|
-
strokeWidth="1.5"
|
232
|
-
stroke="currentColor"
|
233
|
-
className="w-5 h-5"
|
234
|
-
>
|
235
|
-
<path
|
236
|
-
strokeLinecap="round"
|
237
|
-
strokeLinejoin="round"
|
238
|
-
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"
|
239
|
-
/>
|
240
|
-
</svg>
|
241
|
-
</button>
|
242
|
-
</a>
|
243
|
-
</div>
|
244
|
-
</td>
|
245
|
-
<td className="px-4 py-4 text-sm font-medium text-gray-700 whitespace-nowrap">
|
246
|
-
<div className="inline-flex items-center gap-x-3">
|
247
|
-
<div className="flex items-center gap-x-2">
|
248
|
-
<div>
|
249
|
-
<h2 className=" text-sm font-medium text-gray-800 dark:text-white ">
|
250
|
-
{user.name}
|
251
|
-
</h2>
|
252
|
-
</div>
|
253
|
-
</div>
|
254
|
-
</div>
|
255
|
-
</td>
|
256
|
-
<td className="px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap">
|
257
|
-
{user.email}
|
258
|
-
</td>
|
259
|
-
<td className="px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap">
|
260
|
-
{user?.mobile || "Not Provided"}
|
261
|
-
</td>
|
262
|
-
<td className="px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap">
|
263
|
-
{user?.address || "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"}
|
267
|
-
</td>
|
268
|
-
</tr>
|
269
|
-
))}
|
270
|
-
</tbody>
|
271
|
-
</table>
|
272
|
-
</div>
|
273
|
-
|
274
|
-
<div className="flex items-center justify-between mt-6">
|
275
|
-
<button
|
276
|
-
onClick={handlePreviousPage}
|
277
|
-
disabled={currentPage === 1}
|
278
|
-
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"
|
279
|
-
>
|
280
|
-
<svg
|
281
|
-
xmlns="http://www.w3.org/2000/svg"
|
282
|
-
fill="none"
|
283
|
-
viewBox="0 0 24 24"
|
284
|
-
stroke-width="1.5"
|
285
|
-
stroke="currentColor"
|
286
|
-
className="w-5 h-5 rtl:-scale-x-100"
|
287
|
-
>
|
288
|
-
<path
|
289
|
-
stroke-linecap="round"
|
290
|
-
stroke-linejoin="round"
|
291
|
-
d="M6.75 15.75L3 12m0 0l3.75-3.75M3 12h18"
|
292
|
-
/>
|
293
|
-
</svg>
|
294
|
-
|
295
|
-
<span>previous</span>
|
296
|
-
</button>
|
297
|
-
|
298
|
-
<div className="items-center hidden lg:flex gap-x-3">
|
299
|
-
{Array.from({ length: totalPages }, (_, index) => (
|
300
|
-
<button
|
301
|
-
key={index + 1}
|
302
|
-
onClick={() => handlePageClick(index + 1)}
|
303
|
-
className={`px-2 py-1 text-sm ${
|
304
|
-
currentPage === index + 1
|
305
|
-
? "text-blue-500 bg-blue-100"
|
306
|
-
: "text-gray-500 hover:bg-gray-100"
|
307
|
-
} rounded-md`}
|
308
|
-
>
|
309
|
-
{index + 1}
|
310
|
-
</button>
|
311
|
-
))}
|
312
|
-
</div>
|
313
|
-
<button
|
314
|
-
onClick={handleNextPage}
|
315
|
-
disabled={currentPage === totalPages}
|
316
|
-
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"
|
317
|
-
>
|
318
|
-
<span>Next</span>
|
319
|
-
|
320
|
-
<svg
|
321
|
-
xmlns="http://www.w3.org/2000/svg"
|
322
|
-
fill="none"
|
323
|
-
viewBox="0 0 24 24"
|
324
|
-
stroke-width="1.5"
|
325
|
-
stroke="currentColor"
|
326
|
-
className="w-5 h-5 rtl:-scale-x-100"
|
327
|
-
>
|
328
|
-
<path
|
329
|
-
stroke-linecap="round"
|
330
|
-
stroke-linejoin="round"
|
331
|
-
d="M17.25 8.25L21 12m0 0l-3.75 3.75M21 12H3"
|
332
|
-
/>
|
333
|
-
</svg>
|
334
|
-
</button>
|
335
|
-
</div>
|
336
|
-
|
337
|
-
<div className="flex-grow ml-0 mt-4 w-0">
|
338
|
-
{/* <a href="/admin/users/userform">
|
339
|
-
<button
|
340
|
-
type="button"
|
341
|
-
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"
|
342
|
-
>
|
343
|
-
<FaPlus className="mr-2 font-medium" />
|
344
|
-
User
|
345
|
-
</button>
|
346
|
-
</a> */}
|
347
|
-
<button
|
348
|
-
type="button"
|
349
|
-
onClick={(event) => handleNavigation(event, "users/userform")}
|
350
|
-
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"
|
351
|
-
>
|
352
|
-
<FaPlus className="mr-2 font-medium" />
|
353
|
-
User
|
354
|
-
</button>
|
355
|
-
</div>
|
356
|
-
</div>
|
373
|
+
<div>
|
374
|
+
Users
|
375
|
+
<button
|
376
|
+
type="button"
|
377
|
+
onClick={(event) => handleNavigation(event, "users/userform")}
|
378
|
+
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"
|
379
|
+
>
|
380
|
+
User
|
381
|
+
</button>
|
357
382
|
</div>
|
358
383
|
);
|
359
384
|
}
|