Added users support

This commit is contained in:
2025-08-19 07:24:18 +02:00
parent 541b181c87
commit 20b62e7312
18 changed files with 592 additions and 35 deletions

View File

@@ -18,6 +18,15 @@
</head>
<body>
<% if logged_in? %>
<div class="fixed top-4 right-4 text-sm text-gray-600 bg-white px-3 py-1 rounded-md shadow-sm border">
<span class="lowercase"><%= current_user.username %></span>
<span class="mx-2">|</span>
<%= link_to t('sessions.logout_button'), logout_path, method: :delete,
class: "text-blue-600 hover:text-blue-800" %>
</div>
<% end %>
<main class="container mx-auto mt-28 px-5 flex">
<%= yield %>
</main>

View File

@@ -62,7 +62,7 @@
<div class="my-5">
<%= form.label :team_id, t('reservations.form.team') %>
<%= form.collection_select :team_id,
@company.teams,
@company&.teams || [],
:id,
:name,
{ prompt: t('reservations.form.select_team') },

View File

@@ -28,10 +28,12 @@
<label for="team-filter" class="mr-2 font-medium"><%= t('.filter_by_team') %>:</label>
<select id="team-filter" data-main-calendar-target="teamFilter" data-action="change->main-calendar#filterByTeam" class="rounded-md border-gray-300 shadow-sm px-3 py-1 bg-white">
<option value="all"><%= t('.all_teams') %></option>
<% @company.teams.each do |team| %>
<option value="<%= team.id %>" style="background-color: <%= team_color(team.id) %>; color: #000000; padding-left: 10px;">
<%= team.name %>
</option>
<% if @company&.teams %>
<% @company.teams.each do |team| %>
<option value="<%= team.id %>" style="background-color: <%= team_color(team.id) %>; color: #000000; padding-left: 10px;">
<%= team.name %>
</option>
<% end %>
<% end %>
</select>
</div>

View File

@@ -0,0 +1,24 @@
<div class="max-w-md mx-auto mt-8 bg-white p-6 rounded-lg shadow-md">
<h2 class="text-2xl font-bold text-center mb-6"><%= t('sessions.login') %></h2>
<%= form_with url: login_path, method: :post, local: true, class: "space-y-4" do |form| %>
<div>
<%= form.label :login, t('sessions.username_or_email'), class: "block text-sm font-medium text-gray-700 mb-1" %>
<%= form.text_field :login, required: true,
class: "w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",
placeholder: t('sessions.username_or_email_placeholder') %>
</div>
<div>
<%= form.label :password, t('sessions.password'), class: "block text-sm font-medium text-gray-700 mb-1" %>
<%= form.password_field :password, required: true,
class: "w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",
placeholder: t('sessions.password_placeholder') %>
</div>
<div>
<%= form.submit t('sessions.login_button'),
class: "w-full bg-blue-600 text-white py-2 px-4 rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition duration-200" %>
</div>
<% end %>
</div>