Started with operator index

This commit is contained in:
2024-08-12 04:22:54 +02:00
parent e53fffdb8d
commit a3373e0288
5 changed files with 70 additions and 28 deletions

View File

@@ -3,7 +3,9 @@ class Operator::JobsController < ApplicationController
# GET /jobs or /jobs.json # GET /jobs or /jobs.json
def index def index
@jobs = Job.currently_working_on @openjobs = Job.open.order(:created_at)
@printingjobs = Job.printing.order(:status_changed_at)
@pickupjobs = Job.pickup.order(:status_changed_at)
end end

View File

@@ -45,7 +45,7 @@ class Job < ApplicationRecord
.where("status_changed_at >= ?", Time.now.beginning_of_day)) .where("status_changed_at >= ?", Time.now.beginning_of_day))
# .in_status_order # .in_status_order
.order(created_at: :desc) .order(created_at: :desc)
.order(:costumer_firstname, :costumer_lastname) #.order(:costumer_firstname, :costumer_lastname)
.with_attached_pdf # scope from activestorage for .includes(pdf_attachment: :blob) .with_attached_pdf # scope from activestorage for .includes(pdf_attachment: :blob)
# .references(:pdf_attachment, :blob) # creates big join table # .references(:pdf_attachment, :blob) # creates big join table
end end

View File

@@ -1,77 +1,64 @@
<div id="<%= dom_id job %>"> <div id="<%= dom_id job %>">
<iframe src=<%= url_for(@job.pdf) %>
width="700" height="780" style="border: none;"></iframe>
<p class="my-5"> <p class="my-5">
<strong class="block font-medium mb-1">Operator:</strong> <strong class="block font-medium mb-1">Operator:</strong>
<%= job.operator_id %> <%= job.operator_id %>
</p> </p>
<p class="my-5"> <p class="my-5">
<strong class="block font-medium mb-1">Costumer:</strong> <strong class="block font-medium mb-1">Costumer:</strong>
<%= job.costumer_id %> <%= job.costumer_id %>
</p> </p>
<p class="my-5"> <p class="my-5">
<strong class="block font-medium mb-1">Operator firstname:</strong> <strong class="block font-medium mb-1">Operator firstname:</strong>
<%= job.operator_firstname %> <%= job.operator_firstname %>
</p> </p>
<p class="my-5"> <p class="my-5">
<strong class="block font-medium mb-1">Operator lastname:</strong> <strong class="block font-medium mb-1">Operator lastname:</strong>
<%= job.operator_lastname %> <%= job.operator_lastname %>
</p> </p>
<p class="my-5"> <p class="my-5">
<strong class="block font-medium mb-1">Costumer firstname:</strong> <strong class="block font-medium mb-1">Costumer firstname:</strong>
<%= job.costumer_firstname %> <%= job.costumer_firstname %>
</p> </p>
<p class="my-5"> <p class="my-5">
<strong class="block font-medium mb-1">Costumer lastname:</strong> <strong class="block font-medium mb-1">Costumer lastname:</strong>
<%= job.costumer_lastname %> <%= job.costumer_lastname %>
</p> </p>
<p class="my-5"> <p class="my-5">
<strong class="block font-medium mb-1">Paid:</strong> <strong class="block font-medium mb-1">Paid:</strong>
<%= job.paid %> <%= job.paid %>
</p> </p>
<p class="my-5"> <p class="my-5">
<strong class="block font-medium mb-1">Printed at:</strong> <strong class="block font-medium mb-1">Printed at:</strong>
<%= job.printed_at %> <%= job.printed_at %>
</p> </p>
<p class="my-5"> <p class="my-5">
<strong class="block font-medium mb-1">Intern:</strong> <strong class="block font-medium mb-1">Intern:</strong>
<%= job.intern %> <%= job.intern %>
</p> </p>
<p class="my-5"> <p class="my-5">
<strong class="block font-medium mb-1">Cost center:</strong> <strong class="block font-medium mb-1">Cost center:</strong>
<%= job.cost_center %> <%= job.cost_center %>
</p> </p>
<p class="my-5"> <p class="my-5">
<strong class="block font-medium mb-1">Number of plans a0:</strong> <strong class="block font-medium mb-1">Number of plans a0:</strong>
<%= job.number_of_plans_a0 %> <%= job.number_of_plans_a0 %>
</p> </p>
<p class="my-5"> <p class="my-5">
<strong class="block font-medium mb-1">Number of plans a1:</strong> <strong class="block font-medium mb-1">Number of plans a1:</strong>
<%= job.number_of_plans_a1 %> <%= job.number_of_plans_a1 %>
</p> </p>
<p class="my-5"> <p class="my-5">
<strong class="block font-medium mb-1">Number of plans a2:</strong> <strong class="block font-medium mb-1">Number of plans a2:</strong>
<%= job.number_of_plans_a2 %> <%= job.number_of_plans_a2 %>
</p> </p>
<p class="my-5"> <p class="my-5">
<strong class="block font-medium mb-1">Number of plans a3:</strong> <strong class="block font-medium mb-1">Number of plans a3:</strong>
<%= job.number_of_plans_a3 %> <%= job.number_of_plans_a3 %>
</p> </p>
<p class="my-5"> <p class="my-5">
<strong class="block font-medium mb-1">Costum qm plan:</strong> <strong class="block font-medium mb-1">Costum qm plan:</strong>
<%= job.costum_qm_plan %> <%= job.costum_qm_plan %>
</p> </p>
</div> </div>

View File

@@ -57,10 +57,7 @@
</span> </span>
</td> </td>
<td class="p-3 text-sm text-right text-hsrm-gray whitespace-nowrap"> <td class="p-3 text-sm text-right text-hsrm-gray whitespace-nowrap">
<% if job.able_to_cancel? %> <%= link_to icon("folder-arrow-down", class: "text-hsrm-gray size-8 inline", title: "Download"), job.pdf, download:true %>
<%= button_to icon("x-circle", class: "text-hsrm-red size-8 inline", title: "Abbrechen"), cancel_job_path(job), method: :patch, form: {data: {turbo_confirm: 'Den Plottauftrag wirklich abbrechen?'}}, form_class: "inline" %> <%= button_to icon("x-circle", class: "text-hsrm-red size-8 inline", title: "Abbrechen"), cancel_job_path(job), method: :patch, form: {data: {turbo_confirm: 'Den Plottauftrag wirklich abbrechen?'}}, form_class: "inline" %>
<% else %>
<%= icon("x-circle", class: "text-hsrm-gray text-opacity-50 size-8 inline", title: "Kann nicht mehr abgebrochen werden") %>
<% end %>
</td> </td>
</tr> </tr>

View File

@@ -1,10 +1,10 @@
<%= turbo_stream_from 'jobs' %> <%= turbo_stream_from 'operator_jobs' %>
<div class="w-full">
<%#= render partial: 'layouts/flash' %>
<% content_for :title, "Current Print Jobs" %> <% content_for :title, "Current Print Jobs" %>
<div class="w-full">
<div class="flex justify-between items-center py-4"> <div class="flex justify-between items-center py-4">
<h1 class="font-bold text-hsrm-gray text-4xl">Aktuelle Plottaufträge <span class="font-semibold text-sm"><%= Date.today.strftime("%d.%m.%Y") %></span></h1> <h1 class="font-bold text-hsrm-gray text-4xl">
<%= link_to "Plottauftrag aufgeben", new_job_path, class: "px-3 py-2 bg-hsrm-red drop-shadow-lg transition-colors hover:bg-hsrm-red-light text-white block font-medium" %> abholbereite Plottaufträge
</h1>
</div> </div>
<div class="overflow-auto min-w-full drop-shadow-lg"> <div class="overflow-auto min-w-full drop-shadow-lg">
<table class="w-full py-8 table-auto"> <table class="w-full py-8 table-auto">
@@ -24,7 +24,63 @@
</tr> </tr>
</thead> </thead>
<tbody id='jobs' class="divide-y divivde-gray-300"> <tbody id='jobs' class="divide-y divivde-gray-300">
<%= render partial: "job_tr", collection: @jobs, as: :job %> <%= render partial: "job_tr", collection: @pickupjobs, as: :job %>
<%#= link_to "Show this job", job, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
</tbody>
</table>
</div>
<div class="flex justify-between items-center py-4">
<h1 class="font-bold text-hsrm-gray text-4xl">
aktuell druckende Plottaufträge
</h1>
</div>
<div class="overflow-auto min-w-full drop-shadow-lg">
<table class="w-full py-8 table-auto">
<thead class="bg-gray-200 text-hsrm-gray border-b-2 border-gray-300">
<tr>
<th class="p-3 text-sm font-semibold tracking-wide text-left w-1"> ID </th>
<th class="p-3 text-sm font-semibold tracking-wide text-left"> Auftraggeber </th>
<th colspan="2" class="p-3 text-sm font-semibold tracking-wide text-left"> PDF </th>
<th class="p-3 text-sm font-semibold tracking-wide text-left w-1"> A0 </th>
<th class="p-3 text-sm font-semibold tracking-wide text-left w-1"> A1 </th>
<th class="p-3 text-sm font-semibold tracking-wide text-left w-1"> A2 </th>
<th class="p-3 text-sm font-semibold tracking-wide text-left w-1"> A3 </th>
<th class="p-3 text-sm font-semibold tracking-wide text-center w-1"> noDIN </th>
<th class="p-3 text-sm font-semibold tracking-wide text-center w-1"> Kosten </th>
<th class="p-3 text-sm font-semibold tracking-wide text-center w-1"> Status </th>
<th class="p-3 text-sm font-semibold tracking-wide text-center w-1"></th>
</tr>
</thead>
<tbody id='jobs' class="divide-y divivde-gray-300">
<%= render partial: "job_tr", collection: @printingjobs, as: :job %>
<%#= link_to "Show this job", job, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
</tbody>
</table>
</div>
<div class="flex justify-between items-center py-4">
<h1 class="font-bold text-hsrm-gray text-4xl">
offene Plottaufträge
</h1>
</div>
<div class="overflow-auto min-w-full drop-shadow-lg">
<table class="w-full py-8 table-auto">
<thead class="bg-gray-200 text-hsrm-gray border-b-2 border-gray-300">
<tr>
<th class="p-3 text-sm font-semibold tracking-wide text-left w-1"> ID </th>
<th class="p-3 text-sm font-semibold tracking-wide text-left"> Auftraggeber </th>
<th colspan="2" class="p-3 text-sm font-semibold tracking-wide text-left"> PDF </th>
<th class="p-3 text-sm font-semibold tracking-wide text-left w-1"> A0 </th>
<th class="p-3 text-sm font-semibold tracking-wide text-left w-1"> A1 </th>
<th class="p-3 text-sm font-semibold tracking-wide text-left w-1"> A2 </th>
<th class="p-3 text-sm font-semibold tracking-wide text-left w-1"> A3 </th>
<th class="p-3 text-sm font-semibold tracking-wide text-center w-1"> noDIN </th>
<th class="p-3 text-sm font-semibold tracking-wide text-center w-1"> Kosten </th>
<th class="p-3 text-sm font-semibold tracking-wide text-center w-1"> Status </th>
<th class="p-3 text-sm font-semibold tracking-wide text-center w-1"></th>
</tr>
</thead>
<tbody id='jobs' class="divide-y divivde-gray-300">
<%= render partial: "job_tr", collection: @openjobs, as: :job %>
<%#= link_to "Show this job", job, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> <%#= link_to "Show this job", job, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
</tbody> </tbody>
</table> </table>