table fix
This commit is contained in:
parent
96711af5bc
commit
27055845ea
BIN
assets/pasted-20260114-155921-75e1e840.jpg
Normal file
BIN
assets/pasted-20260114-155921-75e1e840.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
@ -291,8 +291,16 @@ router.get('/', wrapAsync(async (req, res) => {
|
|||||||
const filetype = req.query.filetype
|
const filetype = req.query.filetype
|
||||||
|
|
||||||
const currentUser = req.currentUser;
|
const currentUser = req.currentUser;
|
||||||
|
|
||||||
|
const { sort, ...otherFilters } = req.query;
|
||||||
|
let order = {};
|
||||||
|
if (sort) {
|
||||||
|
const [field, direction] = sort.split(',');
|
||||||
|
order = { field, sort: direction };
|
||||||
|
}
|
||||||
|
|
||||||
const payload = await EventsDBApi.findAll(
|
const payload = await EventsDBApi.findAll(
|
||||||
req.query, { currentUser }
|
{ ...otherFilters, ...order }, { currentUser }
|
||||||
);
|
);
|
||||||
if (filetype && filetype === 'csv') {
|
if (filetype && filetype === 'csv') {
|
||||||
const fields = ['id','name','description',
|
const fields = ['id','name','description',
|
||||||
|
|||||||
BIN
frontend/public/assets/vm-shot-2026-01-14T15-59-17-801Z.jpg
Normal file
BIN
frontend/public/assets/vm-shot-2026-01-14T15-59-17-801Z.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
@ -23,7 +23,7 @@ const Dashboard = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if(hasPermission(currentUser, 'READ_EVENTS')) {
|
if(hasPermission(currentUser, 'READ_EVENTS')) {
|
||||||
dispatch(fetchEvents({ query: '?sort=createdAt,DESC&limit=5' }));
|
dispatch(fetchEvents({ query: '?sort=start_datetime,ASC&limit=5' }));
|
||||||
}
|
}
|
||||||
if(hasPermission(currentUser, 'READ_GUESTS')) {
|
if(hasPermission(currentUser, 'READ_GUESTS')) {
|
||||||
dispatch(fetchGuests({ query: '' }));
|
dispatch(fetchGuests({ query: '' }));
|
||||||
@ -31,7 +31,7 @@ const Dashboard = () => {
|
|||||||
}, [dispatch, currentUser]);
|
}, [dispatch, currentUser]);
|
||||||
|
|
||||||
const upcomingEvents = events.filter(
|
const upcomingEvents = events.filter(
|
||||||
(event) => new Date(event.date) > new Date()
|
(event) => new Date(event.start_datetime) > new Date()
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -96,19 +96,17 @@ const Dashboard = () => {
|
|||||||
events.map((event) => (
|
events.map((event) => (
|
||||||
<tr key={event.id}>
|
<tr key={event.id}>
|
||||||
<td className="px-6 py-4 whitespace-nowrap">{event.name}</td>
|
<td className="px-6 py-4 whitespace-nowrap">{event.name}</td>
|
||||||
<td className="px-6 py-4 whitespace-nowrap">
|
<td className="px-6 py-4 whitespace-nowrap">{new Date(event.start_datetime).toLocaleDateString()}</td>
|
||||||
{new Date(event.date).toLocaleDateString()}
|
|
||||||
</td>
|
|
||||||
<td className="px-6 py-4 whitespace-nowrap">{event.location}</td>
|
<td className="px-6 py-4 whitespace-nowrap">{event.location}</td>
|
||||||
<td className="px-6 py-4 whitespace-nowrap">
|
<td className="px-6 py-4 whitespace-nowrap">
|
||||||
<span
|
<span
|
||||||
className={`px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${
|
className={`px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${
|
||||||
new Date(event.date) < new Date()
|
new Date(event.start_datetime) < new Date()
|
||||||
? 'bg-red-100 text-red-800'
|
? 'bg-red-100 text-red-800'
|
||||||
: 'bg-green-100 text-green-800'
|
: 'bg-green-100 text-green-800'
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{new Date(event.date) < new Date() ? 'Past' : 'Upcoming'}
|
{new Date(event.start_datetime) < new Date() ? 'Past' : 'Upcoming'}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td className="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
<td className="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user