mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-22 06:41:46 +00:00
fix: non-transport reservations no longer appear as transports in day planner (issue #914)
getTransportForDay now uses TRANSPORT_TYPES allowlist instead of only excluding hotels, and the click handler dispatches to onEditReservation for non-transport types instead of always opening TransportModal, preventing silent type coercion to 'flight'.
This commit is contained in:
@@ -398,7 +398,7 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar({
|
|||||||
const getTransportForDay = (dayId: number) => {
|
const getTransportForDay = (dayId: number) => {
|
||||||
const dayAssignmentIds = (assignments[String(dayId)] || []).map(a => a.id)
|
const dayAssignmentIds = (assignments[String(dayId)] || []).map(a => a.id)
|
||||||
return reservations.filter(r => {
|
return reservations.filter(r => {
|
||||||
if (r.type === 'hotel') return false
|
if (!TRANSPORT_TYPES.has(r.type)) return false
|
||||||
if (r.assignment_id && dayAssignmentIds.includes(r.assignment_id)) return false
|
if (r.assignment_id && dayAssignmentIds.includes(r.assignment_id)) return false
|
||||||
|
|
||||||
const startDayId = r.day_id
|
const startDayId = r.day_id
|
||||||
@@ -1726,7 +1726,11 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar({
|
|||||||
return (
|
return (
|
||||||
<React.Fragment key={`transport-${res.id}-${day.id}`}>
|
<React.Fragment key={`transport-${res.id}-${day.id}`}>
|
||||||
<div
|
<div
|
||||||
onClick={() => canEditDays && onEditTransport?.(res)}
|
onClick={() => {
|
||||||
|
if (!canEditDays) return
|
||||||
|
if (TRANSPORT_TYPES.has(res.type)) onEditTransport?.(res)
|
||||||
|
else onEditReservation?.(res)
|
||||||
|
}}
|
||||||
onDragOver={e => {
|
onDragOver={e => {
|
||||||
e.preventDefault(); e.stopPropagation()
|
e.preventDefault(); e.stopPropagation()
|
||||||
const rect = e.currentTarget.getBoundingClientRect()
|
const rect = e.currentTarget.getBoundingClientRect()
|
||||||
|
|||||||
Reference in New Issue
Block a user