Redirect to reservation after created notification

This commit is contained in:
2025-04-22 08:23:29 +02:00
parent defe45f631
commit dc51f532a4
2 changed files with 5 additions and 6 deletions

View File

@@ -47,7 +47,7 @@ class ReservationsController < ApplicationController
assign_customer_to_reservation
if @reservation.save
redirect_to @reservation, notice: t('.reservation_created')
redirect_to reservations_url, notice: t('.reservation_created')
else
@customers = @company.customers
render :new, status: :unprocessable_entity
@@ -98,7 +98,7 @@ class ReservationsController < ApplicationController
# Check if reservation update was successful
# (We might ignore customer_updated status for now, or add more complex checks)
if reservation_updated
format.html { redirect_to reservation_url(@reservation), notice: t('.reservation_updated') }
format.html { redirect_to reservations_url, notice: t('.reservation_updated') }
format.json { render :show, status: :ok, location: @reservation }
else
@customers = @company.customers # Reload for form

View File

@@ -2,15 +2,14 @@
<div class="reservation-page" data-controller="main-calendar" style="display: block; width: 100%; height: 100vh; overflow: hidden;">
<!-- Fixed height header -->
<header style="height: 80px; padding: 15px; background-color: white; box-shadow: 0 2px 4px rgba(0,0,0,0.1); position: relative; z-index: 100;">
<% if notice.present? %>
<p class="py-2 px-3 bg-green-50 text-green-500 font-medium rounded-lg inline-block" id="notice"><%= notice %></p>
<% end %>
<% content_for :title, "Reservations" %>
<div class="flex justify-between items-center-calendar">
<div class="flex items-center space-x-4">
<h1 class="font-bold text-4xl px-5">Reservations</h1>
<% if notice.present? %>
<p class="py-1 px-3 ml-4 bg-green-100 text-green-700 font-medium rounded-lg inline-block" id="notice"><%= notice %></p>
<% end %>
<div class="flex items-center space-x-2 ml-6" data-main-calendar-target="navigation">
<button data-action="main-calendar#prev" class="px-3 py-1 bg-gray-100 rounded-md hover:bg-gray-200">
&laquo; Prev