Add transport sync button and allow dropping stays onto band-covered days

- Auto-created transports carry auto_ref {from,to} stay ids; new
  POST /api/trips/:id/transports/regenerate reconciles them against the
  current stay order (re-date/re-title kept bridges preserving mode and
  price, delete orphans, create missing) without touching manual
  transports or flight-covered gaps
- Sync transports button in the calendar header with result toast
- The week band strip is now a drop target resolving the day from the
  pointer position, so stays can be dropped onto spots covered by other
  stays; overlapping stays stack in band lanes
This commit is contained in:
2026-07-20 10:22:49 +07:00
parent 71a158aa51
commit 36c4e4f306
14 changed files with 425 additions and 38 deletions
+6 -2
View File
@@ -4,7 +4,7 @@
// partitioning) so a stay keeps the same vertical position across weeks.
import { el } from '../dom.js';
import { parseYMD, daysBetweenInclusive, typeInfo, stayShortName, entrySpanDays } from '../format.js';
import { makeBandDraggable } from './dragdrop.js';
import { makeBandDraggable, makeWeekBandsDropTarget } from './dragdrop.js';
// Per-instance band palette: each stay gets its own hue (not the generic stay
// type colour) so overlapping/adjacent areas read apart. Muted-but-distinct
@@ -63,7 +63,10 @@ export function computeStayLayout(entries) {
}
// Bands strip for one week (7 ymd strings). Returns null if no stay intersects.
export function renderWeekBands(weekYmd, layout, tctx) {
// `entriesById`/`tctx` are threaded through to wire the strip itself as a drop
// target (see makeWeekBandsDropTarget) so dragging onto a spot already covered
// by a band still moves the dragged entry.
export function renderWeekBands(weekYmd, layout, entriesById, tctx) {
const weekStart = weekYmd[0];
const weekEnd = weekYmd[6];
const inWeek = layout.stays.filter((s) => s.start <= weekEnd && s.end >= weekStart);
@@ -103,6 +106,7 @@ export function renderWeekBands(weekYmd, layout, tctx) {
makeBandDraggable(band, s.entry);
strip.appendChild(band);
}
makeWeekBandsDropTarget(strip, weekYmd, entriesById, tctx);
return strip;
}