Generated operator controller and cleaned job controller
This commit is contained in:
@@ -18,30 +18,6 @@
|
||||
<%= form.label :costumer_lastname, 'Nachname' %>
|
||||
<%= form.text_field :costumer_lastname, class: "block shadow-lg rounded-md border border-hsrm-gray outline-none px-3 py-2 mt-2 w-full" %>
|
||||
</div>
|
||||
<!-- <div class="my-5"> -->
|
||||
<!-- <%= form.label :intern %> -->
|
||||
<!-- <%= form.check_box :intern, class: "block mt-2 h-5 w-5" %> -->
|
||||
<!-- </div> -->
|
||||
<!-- <div class="my-5"> -->
|
||||
<!-- <%= form.label :cost_center %> -->
|
||||
<!-- <%= form.text_field :cost_center, class: "block shadow-lg rounded-md border border-hsrm-gray outline-none px-3 py-2 mt-2 w-full" %> -->
|
||||
<!-- </div> -->
|
||||
<!-- <div class="my-5"> -->
|
||||
<!-- <%= form.label :number_of_plans_a0 %> -->
|
||||
<!-- <%= form.number_field :number_of_plans_a0, class: "block shadow-lg rounded-md border border-hsrm-gray outline-none px-3 py-2 mt-2 w-full" %> -->
|
||||
<!-- </div> -->
|
||||
<!-- <div class="my-5"> -->
|
||||
<!-- <%= form.label :number_of_plans_a1 %> -->
|
||||
<!-- <%= form.number_field :number_of_plans_a1, class: "block shadow-lg rounded-md border border-hsrm-gray outline-none px-3 py-2 mt-2 w-full" %> -->
|
||||
<!-- </div> -->
|
||||
<!-- <div class="my-5"> -->
|
||||
<!-- <%= form.label :number_of_plans_a2 %> -->
|
||||
<!-- <%= form.number_field :number_of_plans_a2, class: "block shadow-lg rounded-md border border-hsrm-gray outline-none px-3 py-2 mt-2 w-full" %> -->
|
||||
<!-- </div> -->
|
||||
<!-- <div class="my-5"> -->
|
||||
<!-- <%= form.label :number_of_plans_a3 %> -->
|
||||
<!-- <%= form.number_field :number_of_plans_a3, class: "block shadow-lg rounded-md border border-hsrm-gray outline-none px-3 py-2 mt-2 w-full" %> -->
|
||||
<!-- </div> -->
|
||||
<div>
|
||||
<%= form.label :pdf, "Plan auswählen (PDF-Format)" %>
|
||||
<%= form.file_field :pdf, accept: "application/pdf", class: "block shadow-lg rounded-md border border-hsrm-gray outline-none px-3 py-2 mt-2 w-full" %>
|
||||
|
||||
55
app/views/operator/jobs/_form.html.erb
Normal file
55
app/views/operator/jobs/_form.html.erb
Normal file
@@ -0,0 +1,55 @@
|
||||
<%= form_with(model: job, class: "contents") do |form| %>
|
||||
<% if job.errors.any? %>
|
||||
<div id="error_explanation" class="bg-red-50 text-red-500 px-3 py-2 font-medium rounded-lg shadow-lg border-l border-red mt-3" >
|
||||
<h2><%= pluralize(job.errors.count, "error") %>
|
||||
prohibited this job from being saved:</h2>
|
||||
<ul>
|
||||
<% job.errors.each do |error| %>
|
||||
<li><%= error.full_message %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="my-5">
|
||||
<%= form.label :costumer_firstname, 'Vorname' %>
|
||||
<%= form.text_field :costumer_firstname, class: "block shadow-lg rounded-md border border-hsrm-gray outline-none px-3 py-2 mt-2 w-full" %>
|
||||
</div>
|
||||
<div class="my-5">
|
||||
<%= form.label :costumer_lastname, 'Nachname' %>
|
||||
<%= form.text_field :costumer_lastname, class: "block shadow-lg rounded-md border border-hsrm-gray outline-none px-3 py-2 mt-2 w-full" %>
|
||||
</div>
|
||||
<!-- <div class="my-5"> -->
|
||||
<!-- <%= form.label :intern %> -->
|
||||
<!-- <%= form.check_box :intern, class: "block mt-2 h-5 w-5" %> -->
|
||||
<!-- </div> -->
|
||||
<!-- <div class="my-5"> -->
|
||||
<!-- <%= form.label :cost_center %> -->
|
||||
<!-- <%= form.text_field :cost_center, class: "block shadow-lg rounded-md border border-hsrm-gray outline-none px-3 py-2 mt-2 w-full" %> -->
|
||||
<!-- </div> -->
|
||||
<!-- <div class="my-5"> -->
|
||||
<!-- <%= form.label :number_of_plans_a0 %> -->
|
||||
<!-- <%= form.number_field :number_of_plans_a0, class: "block shadow-lg rounded-md border border-hsrm-gray outline-none px-3 py-2 mt-2 w-full" %> -->
|
||||
<!-- </div> -->
|
||||
<!-- <div class="my-5"> -->
|
||||
<!-- <%= form.label :number_of_plans_a1 %> -->
|
||||
<!-- <%= form.number_field :number_of_plans_a1, class: "block shadow-lg rounded-md border border-hsrm-gray outline-none px-3 py-2 mt-2 w-full" %> -->
|
||||
<!-- </div> -->
|
||||
<!-- <div class="my-5"> -->
|
||||
<!-- <%= form.label :number_of_plans_a2 %> -->
|
||||
<!-- <%= form.number_field :number_of_plans_a2, class: "block shadow-lg rounded-md border border-hsrm-gray outline-none px-3 py-2 mt-2 w-full" %> -->
|
||||
<!-- </div> -->
|
||||
<!-- <div class="my-5"> -->
|
||||
<!-- <%= form.label :number_of_plans_a3 %> -->
|
||||
<!-- <%= form.number_field :number_of_plans_a3, class: "block shadow-lg rounded-md border border-hsrm-gray outline-none px-3 py-2 mt-2 w-full" %> -->
|
||||
<!-- </div> -->
|
||||
<div>
|
||||
<%= form.label :pdf, "Plan auswählen (PDF-Format)" %>
|
||||
<%= form.file_field :pdf, accept: "application/pdf", class: "block shadow-lg rounded-md border border-hsrm-gray outline-none px-3 py-2 mt-2 w-full" %>
|
||||
</div>
|
||||
<div>
|
||||
<%= form.check_box :privacy_policy_accepted, class: "mt-2 h-5 w-5" %> <%= form.label :privacy_policy_accepted, "Datenschutzerklärung akzeptiert", class: "p-2" %>
|
||||
</div>
|
||||
<div class="inline">
|
||||
<%= form.submit "Plottauftrag abschicken", 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 %>
|
||||
66
app/views/operator/jobs/_job_tr.html.erb
Normal file
66
app/views/operator/jobs/_job_tr.html.erb
Normal file
@@ -0,0 +1,66 @@
|
||||
<tr id="<%= dom_id job %>" class="bg-status-<%= job.status %>-light odd:bg-opacity-20 even:bg-opacity-10">
|
||||
<td class="p-3 text-sm text-hsrm-gray whitespace-nowrap">
|
||||
<span class="p-1.5 text-xs font-medium uppercase tracking-wider bg-opacity-50 text-status-<%= job.status %> bg-status-<%= job.status %>-light rounded-lg">
|
||||
<%= job.id %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="p-3 text-sm text-hsrm-gray whitespace-nowrap">
|
||||
<%= job.costumer_fullname %>
|
||||
</td>
|
||||
<td class="p-3 text-sm text-hsrm-gray whitespace-nowrap w-6">
|
||||
<% if job.pdf.attached? %>
|
||||
<%= image_tag url_for(job.pdf.preview(resize_to_limit: [100, 100])) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="p-3 text-sm text-hsrm-gray whitespace-nowrap">
|
||||
<% if job.pdf.attached? %>
|
||||
<%#= link_to job.pdf.filename, rails_blob_path(job.pdf, disposition: "attachment") %>
|
||||
<%= link_to job.pdf.filename, job.pdf, download:true %>
|
||||
<span class="p-1.5 bg-gray-300 bg-opacity-50 text-hsrm-gray font-medium rounded-lg ml-2">
|
||||
<%=number_to_human_size job.pdf.blob.byte_size%>
|
||||
</span>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="p-3 text-sm text-left text-hsrm-gray whitespace-nowrap">
|
||||
<span class="p-1.5 bg-gray-300 bg-opacity-50 font-medium rounded-lg">
|
||||
<%= job.number_of_plans_a0 %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="p-3 text-sm text-left text-hsrm-gray whitespace-nowrap">
|
||||
<span class="p-1.5 bg-gray-300 bg-opacity-50 font-medium rounded-lg">
|
||||
<%= job.number_of_plans_a1 %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="p-3 text-sm text-left text-hsrm-gray whitespace-nowrap">
|
||||
<span class="p-1.5 bg-gray-300 bg-opacity-50 font-medium rounded-lg">
|
||||
<%= job.number_of_plans_a2 %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="p-3 text-sm text-left text-hsrm-gray whitespace-nowrap">
|
||||
<span class="p-1.5 bg-gray-300 bg-opacity-50 font-medium rounded-lg">
|
||||
<%= job.number_of_plans_a3 %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="p-3 text-sm text-right text-hsrm-gray whitespace-nowrap">
|
||||
<span class="p-1.5 bg-gray-300 bg-opacity-50 font-medium rounded-lg">
|
||||
<%= job.costum_qm_plan.round(2) %> m²
|
||||
</span>
|
||||
</td>
|
||||
<td class="p-3 text-sm text-right text-hsrm-gray whitespace-nowrap">
|
||||
<span class="p-1.5 bg-gray-300 bg-opacity-50 font-medium rounded-lg">
|
||||
<%= job.cost.round(2) %> €
|
||||
</span>
|
||||
</td>
|
||||
<td class="p-3 text-sm text-left text-hsrm-gray whitespace-nowrap">
|
||||
<span class="p-1.5 block text-xs font-medium uppercase tracking-wider bg-opacity-50 w-20 text-center text-status-<%= job.status.to_sym %> bg-status-<%= job.status %>-light rounded-lg">
|
||||
<%= job.status %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="p-3 text-sm text-right text-hsrm-gray whitespace-nowrap">
|
||||
<% if job.able_to_cancel? %>
|
||||
<%= 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>
|
||||
</tr>
|
||||
1
app/views/operator/jobs/cancel.turbo_stream.erb
Normal file
1
app/views/operator/jobs/cancel.turbo_stream.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= turbo_stream.update "flash", partial: "layouts/flash" %>
|
||||
32
app/views/operator/jobs/index.html.erb
Normal file
32
app/views/operator/jobs/index.html.erb
Normal file
@@ -0,0 +1,32 @@
|
||||
<%= turbo_stream_from 'jobs' %>
|
||||
<div class="w-full">
|
||||
<%#= render partial: 'layouts/flash' %>
|
||||
<% content_for :title, "Current Print Jobs" %>
|
||||
<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>
|
||||
<%= 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" %>
|
||||
</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: @jobs, 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>
|
||||
Reference in New Issue
Block a user