Fix: time->time_from/time_to mapping, auto time_to +2h, captcha session fix
This commit is contained in:
+16
-2
@@ -273,6 +273,20 @@ def reservations():
|
||||
# POST: Neue Reservierung
|
||||
data = request.get_json()
|
||||
|
||||
# Fix: time -> time_from/time_to Mapping
|
||||
# Frontend sendet 'time', Backend erwartet 'time_from'/'time_to'
|
||||
if 'time' in data and 'time_from' not in data:
|
||||
data['time_from'] = data['time']
|
||||
|
||||
# time_to automatisch +2h berechnen wenn nicht angegeben
|
||||
if 'time_to' not in data or not data['time_to']:
|
||||
from datetime import datetime as dt
|
||||
try:
|
||||
tf = dt.strptime(data['time_from'], '%H:%M')
|
||||
data['time_to'] = (tf + timedelta(minutes=120)).strftime('%H:%M')
|
||||
except:
|
||||
data['time_to'] = '22:00' # Default
|
||||
|
||||
# Gast finden oder erstellen
|
||||
guest_id = data.get('guest_id')
|
||||
if not guest_id and data.get('email'):
|
||||
@@ -301,7 +315,7 @@ def reservations():
|
||||
data.get('guests'),
|
||||
data.get('occasion'),
|
||||
data.get('notes'),
|
||||
data.get('source', 'manual'),
|
||||
data.get('source', 'web'),
|
||||
data.get('phone_caller_name'),
|
||||
data.get('created_by', 'system')
|
||||
))
|
||||
@@ -975,7 +989,7 @@ def check_reservation_availability():
|
||||
data = request.get_json()
|
||||
|
||||
date = data.get('date')
|
||||
time_from = data.get('time_from')
|
||||
time_from = data.get('time_from') or data.get('time') + ':00' if data.get('time') else None
|
||||
time_to = data.get('time_to', '23:00')
|
||||
guests = data.get('guests', 2)
|
||||
preferred_room_id = data.get('room_id')
|
||||
|
||||
Reference in New Issue
Block a user