diff --git a/src/app/components/TokenTable.jsx b/src/app/components/TokenTable.jsx index 73aa564..c210109 100644 --- a/src/app/components/TokenTable.jsx +++ b/src/app/components/TokenTable.jsx @@ -55,15 +55,15 @@ export default function TokenTable({ statusFilter }) { const applyFilters = (data, search) => { let filtered = data.filter((entry) => { - const matchesSearch = + const matchesSearch = entry.patientName.toLowerCase().includes(search.toLowerCase()) || entry.tokenNumber.toString().includes(search); - - const matchesFilter = - statusFilter === "all" || + + const matchesFilter = + statusFilter === "all" || entry.status === statusFilter || (statusFilter === "booked" && entry.status === "booked"); - + return matchesSearch && matchesFilter; }); setFilteredEntries(filtered); @@ -96,162 +96,153 @@ export default function TokenTable({ statusFilter }) { -// Handle theme loading state -if (darkMode === undefined) { - return ( -
-
-
-

- Loading... -

+ // Handle theme loading state + if (darkMode === undefined) { + return ( +
+
+
+

+ Loading... +

+
+ ); + } + if (loading) return ( +
+
+

+ Loading... +

); -} -if (loading) return ( -
-
-

- Loading... -

-
-); -if (error) return ( -
- Error: {error} -
-); + if (error) return ( +
+ Error: {error} +
+ ); -return ( -
- + setSearchQuery(e.target.value)} - /> + }`} + value={searchQuery} + onChange={(e) => setSearchQuery(e.target.value)} + /> - {filteredEntries.length === 0 ? ( -
- No entries found. -
- ) : ( - <> -
- - - - - - - - - - - {currentEntries.map((entry) => ( - - - - + + ))} + +
TokenNameStatusActions
{entry.tokenNumber}{entry.patientName} - + No entries found. + + ) : ( + <> +
+ + + + + + + + + + + {currentEntries.map((entry) => ( + + + + - + - - ))} - -
TokenNameStatusActions
{entry.tokenNumber}{entry.patientName} + - {entry.status === "booked" ? "In-Queue" : entry.status} - - - {entry.status === "booked" && ( - <> - + {entry.status === "booked" && ( + <> + - + - - )} -
-
+ }`} + > + Missed + + + )} +
+
-
- - - Page {currentPage} of {totalPages} - - + + Page {currentPage} of {totalPages} + + -
- - )} -
-); + }`} + > + Next + +
+ + )} +
+ ); } \ No newline at end of file