Added translations to entire app
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
}) do |form| %>
|
||||
<% if reservation.errors.any? %>
|
||||
<div id="error_explanation" class="bg-red-50 text-red-500 px-3 py-2 font-medium rounded-lg mt-3">
|
||||
<h2><%= pluralize(reservation.errors.count, "error") %> prohibited this reservation from being saved:</h2>
|
||||
<h2><%= t('reservations.form.errors.header', count: reservation.errors.count) %></h2>
|
||||
|
||||
<ul>
|
||||
<% reservation.errors.each do |error| %>
|
||||
@@ -17,10 +17,10 @@
|
||||
<% end %>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :customer %>
|
||||
<%= form.label :customer, t('reservations.form.customer') %>
|
||||
<%= form.select :customer_composite_key,
|
||||
[], # Start with empty options
|
||||
{ prompt: "Type to search customers..." },
|
||||
{ prompt: t('reservations.form.search_prompt') },
|
||||
{
|
||||
selected: (reservation.persisted? && reservation.customer ? reservation.customer.to_param : nil),
|
||||
class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full",
|
||||
@@ -29,7 +29,7 @@
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :phone_number %>
|
||||
<%= form.label :phone_number, t('reservations.form.phone_number') %>
|
||||
<%= form.telephone_field :customer_original_phone,
|
||||
class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full",
|
||||
data: { customer_search_target: "phoneField" } %>
|
||||
@@ -37,21 +37,21 @@
|
||||
|
||||
<div data-customer-search-target="newCustomerFields" class="hidden">
|
||||
<div class="my-5">
|
||||
<%= form.label :first_name %>
|
||||
<%= form.label :first_name, t('reservations.form.first_name') %>
|
||||
<%= form.text_field :customer_first_name,
|
||||
class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full",
|
||||
data: { customer_search_target: "firstNameField" } %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :surname %>
|
||||
<%= form.label :surname, t('reservations.form.surname') %>
|
||||
<%= form.text_field :customer_surname,
|
||||
class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full",
|
||||
data: { customer_search_target: "surnameField" } %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :birth_year %>
|
||||
<%= form.label :birth_year, t('reservations.form.birth_year') %>
|
||||
<%= form.number_field :customer_birth_year,
|
||||
class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full",
|
||||
data: { customer_search_target: "birthYearField" } %>
|
||||
@@ -59,30 +59,34 @@
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :team_id %>
|
||||
<%= form.label :team_id, t('reservations.form.team') %>
|
||||
<%= form.collection_select :team_id,
|
||||
@company.teams,
|
||||
:id,
|
||||
:name,
|
||||
{ prompt: "Select a team" },
|
||||
{ prompt: t('reservations.form.select_team') },
|
||||
class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :start_time %>
|
||||
<%= form.label :start_time, t('reservations.form.start_time') %>
|
||||
<%= form.datetime_field :start_time,
|
||||
class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full",
|
||||
id: "start_time_field" %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :end_time %>
|
||||
<%= form.label :end_time, t('reservations.form.end_time') %>
|
||||
<%= form.datetime_field :end_time,
|
||||
class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full",
|
||||
id: "end_time_field" %>
|
||||
</div>
|
||||
|
||||
<div class="inline">
|
||||
<%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
|
||||
<% if reservation.new_record? %>
|
||||
<%= form.submit t('reservations.form.create'), class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
|
||||
<% else %>
|
||||
<%= form.submit t('reservations.form.update'), class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<div class="mx-auto md:w-2/3 w-full">
|
||||
<h1 class="font-bold text-4xl">Editing reservation</h1>
|
||||
<h1 class="font-bold text-4xl"><%= t('.title') %></h1>
|
||||
|
||||
<%= render "form", reservation: @reservation %>
|
||||
|
||||
<%= link_to "Show this reservation", @reservation, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
|
||||
<%= link_to "Back to reservations", reservations_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
|
||||
<%= link_to t('.show'), @reservation, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
|
||||
<%= link_to t('.back'), reservations_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
|
||||
</div>
|
||||
|
||||
@@ -2,35 +2,53 @@
|
||||
<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;">
|
||||
<% content_for :title, "Reservations" %>
|
||||
<% content_for :title, t('.title') %>
|
||||
|
||||
<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>
|
||||
<h1 class="font-bold text-4xl px-5"><%= t('.title') %></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">
|
||||
« Prev
|
||||
<%= t('.prev') %>
|
||||
</button>
|
||||
<button data-action="main-calendar#today" class="px-3 py-1 bg-gray-100 rounded-md hover:bg-gray-200">
|
||||
Today
|
||||
<%= t('.today') %>
|
||||
</button>
|
||||
<button data-action="main-calendar#next" class="px-3 py-1 bg-gray-100 rounded-md hover:bg-gray-200">
|
||||
Next »
|
||||
<%= t('.next') %>
|
||||
</button>
|
||||
<span data-main-calendar-target="dateDisplay" class="ml-3 font-medium"></span>
|
||||
</div>
|
||||
</div>
|
||||
<%= link_to "New reservation", new_reservation_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium ml-auto" %>
|
||||
<%= link_to t('.new_reservation'), new_reservation_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium ml-auto" %>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- Calendar container - with fixed top position and precise height calculation -->
|
||||
<div class="calendar-container" style="height: calc(100vh - 80px); width: 100%; position: relative; top: 0; left: 0;">
|
||||
<div style="height: 100%; width: 100%;">
|
||||
<%= tag.div nil, data: {reservations: @reservations.to_json}, id: "main-calendar", style: "height: 100%; width: 100%;" %>
|
||||
<%
|
||||
calendar_translations = {
|
||||
hours: t('reservations.calendar.hours'),
|
||||
delete_confirm: t('reservations.calendar.delete_confirm'),
|
||||
delete_success: t('reservations.calendar.delete_success'),
|
||||
delete_error: t('reservations.calendar.delete_error'),
|
||||
network_error: t('reservations.calendar.network_error'),
|
||||
edit: t('reservations.calendar.edit'),
|
||||
delete: t('reservations.calendar.delete')
|
||||
}.to_json
|
||||
%>
|
||||
<%= tag.div nil,
|
||||
data: {
|
||||
reservations: @reservations.to_json,
|
||||
translations: calendar_translations
|
||||
},
|
||||
id: "main-calendar",
|
||||
style: "height: 100%; width: 100%;"
|
||||
%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="mx-auto md:w-2/3 w-full">
|
||||
<h1 class="font-bold text-4xl">New reservation</h1>
|
||||
<h1 class="font-bold text-4xl"><%= t('.title') %></h1>
|
||||
|
||||
<%= render "form", reservation: @reservation %>
|
||||
|
||||
<%= link_to "Back to reservations", reservations_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
|
||||
<%= link_to t('.back'), reservations_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user