|
| 1 | +<% content_for :title, t("common.holidays") %> |
| 2 | + |
| 3 | +<div class="flex flex-col gap-y-8"> |
| 4 | + <!-- Header --> |
| 5 | + <div class="flex flex-row justify-between items-center border-b border-gray-100 py-3"> |
| 6 | + <div class="flex flex-row items-center gap-x-2"> |
| 7 | + <span class="font-medium text-gray-600 text-lg"><%= t("common.holidays") %></span> |
| 8 | + </div> |
| 9 | + </div> |
| 10 | + |
| 11 | + <!-- Country Selection Form --> |
| 12 | + <%= form_with model: @organization, url: workspace_holidays_path, method: :patch do |form| %> |
| 13 | + <div class="flex flex-row gap-4 items-end"> |
| 14 | + <div class="flex-1 max-w-md"> |
| 15 | + <%= render RubyUI::FormField.new do %> |
| 16 | + <%= render RubyUI::FormFieldLabel.new { t("holidays.select_country") } %> |
| 17 | + <%= form.select :holiday_country_code, |
| 18 | + for_select_countries(@available_countries), |
| 19 | + { prompt: t("holidays.select_country_prompt") }, |
| 20 | + class: "border-gray-200 rounded-md w-full" %> |
| 21 | + <% end %> |
| 22 | + </div> |
| 23 | + <div> |
| 24 | + <%= render ButtonComponent.new(type: :submit) do %> |
| 25 | + <span><%= t("holidays.show_holidays") %></span> |
| 26 | + <% end %> |
| 27 | + </div> |
| 28 | + </div> |
| 29 | + <% end %> |
| 30 | + |
| 31 | + <!-- Holidays Table --> |
| 32 | + <% if @selected_country.present? %> |
| 33 | + <div> |
| 34 | + <% holidays = holidays_for_country(@selected_country) %> |
| 35 | + <% if holidays.any? %> |
| 36 | + <%= render RubyUI::Table.new do %> |
| 37 | + <%= render RubyUI::TableHeader.new do %> |
| 38 | + <%= render RubyUI::TableRow.new do %> |
| 39 | + <%= render RubyUI::TableHead.new { t("holidays.holiday_name") } %> |
| 40 | + <%= render RubyUI::TableHead.new { t("holidays.date") } %> |
| 41 | + <% end %> |
| 42 | + <% end %> |
| 43 | + <%= render RubyUI::TableBody.new(class: "text-base") do %> |
| 44 | + <% holidays.each do |holiday| %> |
| 45 | + <%= render RubyUI::TableRow.new do %> |
| 46 | + <%= render RubyUI::TableCell.new(class: "py-4 font-medium") { holiday[:name] } %> |
| 47 | + <%= render RubyUI::TableCell.new(class: "py-4") { format_holiday_date(holiday[:date]) } %> |
| 48 | + <% end %> |
| 49 | + <% end %> |
| 50 | + <% end %> |
| 51 | + <% end %> |
| 52 | + <% else %> |
| 53 | + <p class="text-gray-500 text-center py-8"><%= t("holidays.no_holidays_found") %></p> |
| 54 | + <% end %> |
| 55 | + </div> |
| 56 | + <% else %> |
| 57 | + <div class="bg-blue-50 border border-blue-200 rounded-md p-4"> |
| 58 | + <p class="text-blue-800"><%= t("holidays.please_select_country") %></p> |
| 59 | + </div> |
| 60 | + <% end %> |
| 61 | +</div> |
0 commit comments