Added sort function and pagy calendar to admin/jobs index
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
<% end %>
|
||||
<%= link_to admin_users_path() do %>
|
||||
<div class="p-4 shadow bg-gray-50">
|
||||
<h2 class="text-xl">Tutoren:</h2>
|
||||
<h2 class="text-xl">Operatoren:</h2>
|
||||
<p class="size-28"><%= @user.operator.size %></p>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -29,10 +29,15 @@
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="flex space-x-2">
|
||||
<h2>Aktueller Monat</h2>
|
||||
<%= link_to admin_jobs_path() do %>
|
||||
<%= link_to operator_jobs_path() do %>
|
||||
<div class="p-4 shadow bg-gray-50">
|
||||
<h2 class="text-xl">aktuelle Druckaufträge:</h2>
|
||||
<p class="size-28"><%= @jobs.where(status: %i[open printing pickup]).size %></p>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= link_to admin_jobs_path() do %>
|
||||
<div class="p-4 shadow bg-gray-50">
|
||||
<h2 class="text-xl">Alle Druckaufträge:</h2>
|
||||
<p class="size-28"><%= @jobs.size %></p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -1,37 +1,49 @@
|
||||
<%= turbo_frame_tag "admin_jobs" do %>
|
||||
<% content_for :title, "Benutzerliste" %>
|
||||
<h1 class="font-bold text-4xl py-4 text-hsrm-gray">Alle Druckaufträge</h1>
|
||||
<div class="flex justify-between items-center">
|
||||
<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| %>
|
||||
<%= 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.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" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<%= turbo_frame_tag "admin_jobs", data: { turbo_action: 'advance'} do %>
|
||||
<div>
|
||||
<h1 class="font-bold text-4xl py-4 text-hsrm-gray">Alle Druckaufträge</h1>
|
||||
<div class="flex justify-between items-center">
|
||||
<%== pagy_nav(@pagy) %>
|
||||
<%== pagy_info(@pagy, item_name: "Users") %>
|
||||
</div>
|
||||
<div class="min-w-full overflow-auto shadow-lg pt-2">
|
||||
<table class="w-full py-8 table-auto">
|
||||
<thead class="font-semibold tracking-wide bg-gray-200 border-b-2 border-gray-300 text text-hsrm-gray">
|
||||
<tr>
|
||||
<th class="w-1 p-2 py-3 text-center text-nowrap"><%= sort_link(@q, :id, "ID", ) %></th>
|
||||
<th class="min-w-24 p-2 py-3 text-left"><%= sort_link(@q, :costumer_firstname, "Vorname") %></th>
|
||||
<th class="min-w-24 p-2 py-3 text-left"><%= sort_link(@q, :costumer_lastname, "Nachname") %></th>
|
||||
<th class="p-2 py-3 text-left"><%= sort_link(@q, :pdf_blob_filename, "PDF") %></th>
|
||||
<th class="w-1 p-1 py-3 text-left text-nowrap"><%= sort_link(@q, :number_of_plans_a0, "A0") %></th>
|
||||
<th class="w-1 p-1 py-3 text-left text-nowrap"><%= sort_link(@q, :number_of_plans_a1, "A1") %></th>
|
||||
<th class="w-1 p-1 py-3 text-left text-nowrap"><%= sort_link(@q, :number_of_plans_a2, "A2") %></th>
|
||||
<th class="w-1 p-1 py-3 text-left text-nowrap"><%= sort_link(@q, :number_of_plans_a3, "A3") %></th>
|
||||
<th class="w-1 p-2 py-3 text-center text-nowrap"><%= sort_link(@q, :costum_qm_plan, "no DIN") %></th>
|
||||
<th class="w-1 p-2 py-3 text-center"><%= sort_link(@q, :cost, "Kosten") %></th>
|
||||
<th class="w-1 p-2 py-3 text-center text-nowrap"><%= sort_link(@q, :created_at, "Erstellt am") %></th>
|
||||
<th class="w-1 p-2 py-3 text-center text-nowrap"><%= sort_link(@q, :created_at, "Bezahlt am") %></th>
|
||||
<th class="w-1 p-2 py-3 text-center"><%= sort_link(@q, :status, "Status") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id='jobs' class="divide-y divivde-gray-300">
|
||||
<%= render partial: "job_tr", collection: @records, as: :job, locals: { no_actions: true } %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="flex justify-between items-center">
|
||||
<%== pagy_nav(@pagy) %>
|
||||
<%== pagy_info(@pagy, item_name: "Users") %>
|
||||
</div>
|
||||
<%== pagy_nav(@calendar[:year]) %>
|
||||
<%== pagy_nav(@calendar[:month]) %>
|
||||
<%== pagy_nav(@pagy) %>
|
||||
<%== pagy_info(@pagy, item_name: "Users") %>
|
||||
</div>
|
||||
<div class="min-w-full overflow-auto shadow-lg pt-2">
|
||||
<table class="w-full py-8 table-auto">
|
||||
<thead class="font-semibold tracking-wide bg-gray-200 border-b-2 border-gray-300 text text-hsrm-gray">
|
||||
<tr>
|
||||
<th class="w-1 p-2 py-3 text-center text-nowrap"><%= sort_link(@q, :id, "ID", ) %></th>
|
||||
<th class="min-w-24 p-2 py-3 text-left"><%= sort_link(@q, :costumer_firstname, "Vorname") %></th>
|
||||
<th class="min-w-24 p-2 py-3 text-left"><%= sort_link(@q, :costumer_lastname, "Nachname") %></th>
|
||||
<th class="p-2 py-3 text-left"><%= sort_link(@q, :pdf_blob_filename, "PDF") %></th>
|
||||
<th class="w-1 p-1 py-3 text-left text-nowrap"><%= sort_link(@q, :number_of_plans_a0, "A0") %></th>
|
||||
<th class="w-1 p-1 py-3 text-left text-nowrap"><%= sort_link(@q, :number_of_plans_a1, "A1") %></th>
|
||||
<th class="w-1 p-1 py-3 text-left text-nowrap"><%= sort_link(@q, :number_of_plans_a2, "A2") %></th>
|
||||
<th class="w-1 p-1 py-3 text-left text-nowrap"><%= sort_link(@q, :number_of_plans_a3, "A3") %></th>
|
||||
<th class="w-1 p-2 py-3 text-center text-nowrap"><%= sort_link(@q, :costum_qm_plan, "no DIN") %></th>
|
||||
<th class="w-1 p-2 py-3 text-center"><%= sort_link(@q, :cost, "Kosten") %></th>
|
||||
<th class="w-1 p-2 py-3 text-center text-nowrap"><%= sort_link(@q, :created_at, "Erstellt am") %></th>
|
||||
<th class="w-1 p-2 py-3 text-center text-nowrap"><%= sort_link(@q, :created_at, "Bezahlt am") %></th>
|
||||
<th class="w-1 p-2 py-3 text-center"><%= sort_link(@q, :status, "Status") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id='jobs' class="divide-y divivde-gray-300">
|
||||
<%= render partial: "job_tr", collection: @records, as: :job, locals: { no_actions: true } %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="flex justify-between items-center">
|
||||
<%== pagy_nav(@pagy) %>
|
||||
<%== pagy_info(@pagy, item_name: "Users") %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user