Switch between calendar and pagy of admin/jobs#index

This commit is contained in:
2024-09-25 15:35:25 +02:00
parent f7bf922f44
commit d81d44ce9f
2 changed files with 52 additions and 50 deletions

View File

@@ -1,25 +1,27 @@
<% content_for :title, "Benutzerliste" %> <% content_for :title, "Benutzerliste" %>
<h1 class="font-bold text-4xl py-4 text-hsrm-gray">Alle Druckaufträge</h1> <h1 class="font-bold text-4xl py-4 text-hsrm-gray">Alle Druckaufträge</h1>
<div class="flex justify-between items-center"> <% if @calendar %>
<%= link_to icon("magnifying-glass", class: "icon size-5 mr-3") + 'Filter', admin_jobs_path(), class: "px-4 py-2 hover:bg-gray-50 hover:text-hsrm-red border-b-4 hover:border-hsrm-red-light" %>
<%= content_tag :span, icon("calendar", class: "icon size-5 mr-3") + 'Kalender', class: "px-4 py-2 border-b-4 border-hsrm-red-light" %>
<div class="pt-2">
<%== pagy_nav(@calendar[:year]) %>
<%== pagy_nav(@calendar[:month]) if @calendar[:month] %>
</div>
<% else %>
<%= content_tag :span, icon("magnifying-glass", class: "icon size-5 mr-3") + 'Filter', class: "px-4 py-2 border-b-4 border-hsrm-red-light" %>
<%= link_to icon("calendar", class: "icon size-5 mr-3") + 'Kalender', admin_jobs_path(calendar: true), class: "px-4 py-2 hover:text-hsrm-red border-b-4 hover:border-hsrm-red-light" %>
<div class="flex items-center justify-between py-4"> <div class="flex items-center justify-between py-4">
<%= search_form_for @q, data: { turbo_frame: :admin_jobs, turbo_action: 'advance' }, url: admin_jobs_path do |f| %> <%= search_form_for @q, data: { turbo_frame: :admin_jobs, turbo_action: 'advance' }, url: admin_jobs_path() do |f| %>
<%= f.search_field :costumer_firstname_or_costumer_lastname_or_pdf_blob_filename_cont, placeholder: "Suchen", oninput: 'this.form.requestSubmit();' %> <%= f.search_field :costumer_firstname_or_costumer_lastname_or_pdf_blob_filename_cont, placeholder: "Suchen", oninput: 'this.form.requestSubmit();' %>
<%= f.label :status_eq, "Status:" %> <%= f.label :status_eq, "Status:" %>
<%= f.select :status_eq, Job.statuses.keys, {include_blank: "alle"}, onchange: 'this.form.requestSubmit();' %> <%= f.select :status_eq, Job.statuses.keys, {include_blank: "alle"}, onchange: 'this.form.requestSubmit();' %>
<%#= f. %>
<%= f.submit "Filter anwenden", class: "py-2 px-3 bg-hsrm-red hover:bg-hsrm-red-light shadow-lg text-white inline-block font-medium cursor-pointer" %> <%= f.submit "Filter anwenden", class: "py-2 px-3 bg-hsrm-red hover:bg-hsrm-red-light shadow-lg text-white inline-block font-medium cursor-pointer" %>
</div>
<% end %>
<% end %> <% end %>
</div>
</div>
<%= turbo_frame_tag "admin_jobs", data: { turbo_action: 'advance'} do %>
<div> <div>
<% if @calendar %> <%= turbo_frame_tag "admin_jobs", data: { turbo_action: 'advance'} do %>
<%= link_to 'Kalender ausblenden', admin_jobs_path() %> <div class="flex justify-between items-center">
<%== pagy_nav(@calendar[:year]) %>
<%== pagy_nav(@calendar[:month]) if @calendar[:month] %>
<% else %>
<%= link_to 'Kalender anzeigen', admin_jobs_path(calendar: true) %>
<% end %>
<%== pagy_nav(@pagy) %> <%== pagy_nav(@pagy) %>
<%== pagy_info(@pagy, item_name: "Users") %> <%== pagy_info(@pagy, item_name: "Users") %>
</div> </div>

View File

@@ -3,24 +3,24 @@
<nav> <nav>
<ul class="flex justify-center space-x-2 font-semibold items-color"> <ul class="flex justify-center space-x-2 font-semibold items-color">
<li class="relative"> <li class="relative">
<button class="px-4 py-2 cursor-default hover:text-hsrm-red border-b-4 <%= root_tab? && 'border-hsrm-red-light' %>"> <button class="px-4 py-2 cursor-default hover:text-hsrm-red border-b-4 <%= root_tab? && 'border-hsrm-red-light' || 'hover:border-hsrm-red-light' %>">
<%= link_to "Aktuelle Druckaufträge", root_path %> <%= link_to "Aktuelle Druckaufträge", root_path %>
</button> </button>
</li> </li>
<% if user_signed_in? %> <% if user_signed_in? %>
<li class="relative"> <li class="relative">
<button class="px-4 py-2 cursor-default hover:text-hsrm-red border-b-4 <%= profile_tab? && 'border-hsrm-red-light' %>"> <button class="px-4 py-2 cursor-default hover:text-hsrm-red border-b-4 <%= profile_tab? && 'border-hsrm-red-light' || 'hover:border-hsrm-red-light' %>">
<%= link_to "Profil", profile_path %> <%= link_to "Profil", profile_path %>
</button> </button>
</li> </li>
<% if (current_user.admin? || current_user.operator?) %> <% if (current_user.admin? || current_user.operator?) %>
<li class="relative"> <li class="relative">
<button class="px-4 py-2 cursor-default <%= current_user.admin? && 'hover:text-hsrm-red' || 'text-hsrm-gray-light' %> border-b-4 <%= admin_tab? && 'border-hsrm-red-light' %>"> <button class="px-4 py-2 cursor-default <%= current_user.admin? && 'hover:text-hsrm-red' || 'text-hsrm-gray-light' %> border-b-4 <%= admin_tab? && 'border-hsrm-red-light' || 'hover:border-hsrm-red-light' %>">
<%= link_to_if current_user.admin?, "Admin", admin_dashboard_path %> <%= link_to_if current_user.admin?, "Admin", admin_dashboard_path %>
</button> </button>
</li> </li>
<li class="relative"> <li class="relative">
<button class="px-4 py-2 cursor-default hover:text-hsrm-red border-b-4 <%= operator_tab? && 'border-hsrm-red-light' %>"> <button class="px-4 py-2 cursor-default hover:text-hsrm-red border-b-4 <%= operator_tab? && 'border-hsrm-red-light' || 'hover:border-hsrm-red-light' %>">
<%= link_to 'Operator', operator_jobs_path %> <%= link_to 'Operator', operator_jobs_path %>
</button> </button>
</li> </li>