feat(reservar): load weekly statuses asynchronously#191
Conversation
|
📝 Manual Update Required? It looks like you've modified core logic. Please check if the user manual needs a refresh! @marpisco |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 86f4a284d1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| window.history.pushState({ before: data.before || '' }, '', url.toString()); | ||
| } | ||
| }) | ||
| .catch(() => window.location.reload()); |
There was a problem hiding this comment.
Stop reloading on unrecoverable fetch errors
If the API returns a persistent 400/404, for example from a bookmarked URL whose sala was deleted or a before value that is not accepted by api/reservation_statuses.php, this reloads the exact same page; DOMContentLoaded immediately issues the same failing fetch again, causing an endless refresh loop instead of leaving the server-rendered fallback or showing an error.
Useful? React with 👍 / 👎.
| document.querySelectorAll('.reservation-day-header').forEach((header, index) => { | ||
| if (data.days[index]) header.innerHTML = data.days[index].label; | ||
| }); |
There was a problem hiding this comment.
Recompute header styling when changing weeks
When a user navigates weeks through the new async links, this only replaces each header's label and leaves the inline style that was rendered for the original week. Because the initial PHP markup encodes today/past state in that style, moving to another week keeps the old blue highlight or opacity on the same column, so the UI can mark the wrong date as today or past even though the API returns fresh isToday/isPast values.
Useful? React with 👍 / 👎.
|
@codex Please fix PR #191 before merge. Local checkout/static testing passes, but there are still user-visible issues in the async reservation table:
Keep the fix scoped to |
|
Summary
Testing
|
|
📝 Manual Update Required? It looks like you've modified core logic. Please check if the user manual needs a refresh! @marpisco |
Adds a small reservation statuses API for weekly room availability. The reservation page now renders the existing server-side table as a fallback, then fetches the weekly statuses on load and when navigating between weeks. The navigation links and browser URL stay in sync with the selected week. Tested with PHP syntax checks for all PHP files, a JavaScript syntax check, and git diff whitespace checks. Co-authored-by: Codex <noreply@openai.com>
|
@codex my page is being force dragged down as soon as it loads, and keeps being dragged down forever. Check what is causing this behavior. |
1d1de31 to
4348409
Compare
|
📝 Manual Update Required? It looks like you've modified core logic. Please check if the user manual needs a refresh! @marpisco |
|
Summary
Testing
|
Motivation
Description
api/reservation_statuses.phpwhich validatessalaand optionalbeforeweek parameters, enforces the same session/auth guards used elsewhere, queriestemposandreservasvia prepared statements, and returns a JSON structure withdays,tempos, and per-slotslotsincludingstatus,label,requisitor,canInteract, andcanCreateReservationflags.assets/reservation-statuses.jsto fetch the API, show skeleton cells while loading, render slot cells (including bulk-checkbox and links when allowed), update week navigation links, and push/pop history so the URL and navigation remain understandable.reservar/index.phpto include the new script, mark the table withid='reservationTable'anddata-sala/data-before, addid='reservationTableBody'and.reservation-day-headerfor dynamic updates, and adddata-week-beforeattributes to the week navigation links; the original server-rendered table remains as the no-JS fallback.Testing
php -l(including newapi/reservation_statuses.phpand modifiedreservar/index.php) and no syntax errors were reported. (passed)node --check assets/reservation-statuses.jsand it reported no syntax errors. (passed)git diff --checkand fixed issues where needed. (passed)Codex Task