Commit graph

5 commits

Author SHA1 Message Date
Maaxxs
b5fec1d3c7 Redesign raid group editor and keep editor mode open while dragging
Two changes to the raid editor (raids.php/raids.js):

- Moving a member via drag&drop no longer reloads the page. It now
  patches the DOM in place (moves the list item, updates each
  group's member count/empty-state, and adjusts the header's
  "X / Y angemeldet" badge when bench vs. a real group is involved),
  so the editor panel stays open and multiple members can be
  reshuffled without re-entering edit mode each time. The form's own
  "Speichern" still reloads on success, since that's the point where
  the edit is actually committed.
- Replaces the single comma-separated "Gruppennamen" text field and
  the separate "Gruppen sperren" checkbox grid with one row per
  group (name input + inline lock toggle + remove button), plus a
  "+ Gruppe hinzufügen" button to append a new row. Group names and
  locked_groups are now read from these rows on submit instead of
  parsing a comma-separated string.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-19 07:47:02 +02:00
Maaxxs
5f64c6fe75 Block moving members into locked groups in the raid editor
Drag&drop moves and the underlying raid_move_action.php had no idea
about locked_groups, so an admin could still drag a member into a
group that was explicitly locked. Locked drop zones are now flagged
in the markup, the frontend refuses the drag/drop, and the endpoint
rejects the move server-side as well.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-19 07:12:34 +02:00
Maaxxs
73b670a305 Block joining locked groups and fall back to the bench when none are open
The Wunschgruppe picker let members select a locked group, and the
signup endpoint didn't check locked_groups at all, so the wish could
still go through. Locked groups are now passed to the frontend and
rendered disabled with a lock icon, and the server rejects a locked
group the same way it already rejects a role-capped one. When every
group is locked (or the raid has none), the signup is now assigned
straight to the Ersatzbank instead of relying on the bot's own
auto-assign to skip locked groups.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-19 06:57:45 +02:00
Maaxxs
5c28cb5735 Fix signup modal showing on load and switch group picker to buttons
.modal-overlay set display:flex unconditionally, which beats the
browser's default [hidden] { display: none } since author styles
always win over the UA stylesheet - so the popup was visible on every
page load regardless of the hidden attribute. Now display is none by
default and only :not([hidden]) switches to flex.

Also: class picker was auto-fill grid producing an uneven 3/3/2 layout
for 8 classes - now a fixed 4x2 grid (2x4 on narrow screens). Group
selection is no longer a <select>, but the same pill-button pattern as
the class picker (Automatisch/group names/Ersatzbank), built by JS to
match the class picker's look.

Verified via screenshots: modal closed by default, opens only via
button click, uniform icon grid, group pills render and highlight
correctly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 18:46:17 +02:00
Maaxxs
fea0cc3a91 Overhaul raid signup/management to match the Discord bot's full feature set
Signup is now a single "Anmelden" button that opens a class-icon
picker + optional group choice. A new raid_wish_is_sensible() mirrors
the bot's exact role-cap algorithm (Tank/Heal 1, DPS 3 per 5-player
group, ROLE_MAPPING copied from teamplaner.py) to decide server-side
whether the requested group is honored or the request falls back to
the bot's own auto-assignment - with a message telling the member to
ping the raid lead if they wanted something specific. Verified the
cap logic with 7 synthetic cases (own-signup exclusion, full group,
role caps, bench always allowed) before wiring it up.

Admins get a per-raid edit-mode toggle (pencil icon) that reveals:
inline raid editing (title/date/requirements/gearscore/groups/slots/
group locks) via PATCH, a premade-invite mini-form via the new
premades endpoint, and native HTML5 drag-and-drop to move a signup
between groups/bench via PATCH .../signup/{user_id}.

New pieces: includes/raids_api.php gained move_signup(), update_raid(),
invite_premade(), fetch_premades(), fetch_raid_by_id() and the wish-
sensibility check; four new JSON action endpoints (raid_signup_action,
raid_move_action, raid_edit_action, raid_premade_invite_action) reusing
the session CSRF token via a new verify_csrf_token()/read_json_body()/
json_response() trio in functions.php; assets/js/raids.js drives the
modal, edit-mode, and drag-and-drop with plain fetch() (no framework).

Read-heavy parts (page render, class icons, signup-wish logic) verified
against real data/live API. Edit, move and premade-invite are NOT
tested against the live API yet since they'd mutate the real raid or
send real Discord DMs to guild members - flagging this for a
supervised live check before considering it fully verified.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 18:36:04 +02:00