Number of plans can no be incremented or decremented

This commit is contained in:
2024-08-13 13:00:59 +02:00
parent 3a660d42de
commit eaf7fdd2be
4 changed files with 70 additions and 40 deletions

View File

@@ -6,7 +6,7 @@
</td>
<td class="p-3 text-sm text-hsrm-gray whitespace-nowrap w-6">
<% if job.pdf.attached? %>
<%= link_to_if job.printing?, image_tag(url_for(job.pdf.preview(resize_to_limit: [100, 100]))), job.pdf, download:true, class: "shadow-lg" %>
<%= link_to_if job.printing?, image_tag(url_for(job.pdf.preview(resize_to_limit: [100, 100]))), job.pdf, target: "_blank", class: "shadow-lg" %>
<!--<iframe src=<%= url_for(job.pdf) %> width="500" height="700" style="border: none;"></iframe>-->
<% end %>
</td>
@@ -16,42 +16,31 @@
<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 %>
<%= link_to_if job.printing?, 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">
<% if job.printing? %>
<span class="p-1 bg-gray-300 bg-opacity-50 font-medium rounded-lg inline-block">
<%= button_to icon("chevron-up", class: "size-5 inline", title: "erhöhen"), operator_job_path(job), method: :patch, form_class: "inline" %>
</span>
<% end %>
<span class="p-1.5 bg-gray-300 bg-opacity-50 font-medium rounded-lg text-center">
<%= job.number_of_plans_a0 %>
</span>
<% if job.printing? %>
<span class="p-1 bg-gray-300 bg-opacity-50 font-medium rounded-lg inline-block">
<%= button_to icon("chevron-down", class: "size-5 inline", title: "verringern"), operator_job_path(job), method: :patch, form_class: "inline" %>
</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_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>
<% Job::AVAILABLE_PAGE_FORMATS.each do |din| %>
<td class="p-3 text-sm text-left text-hsrm-gray whitespace-nowrap">
<% if job.printing? %>
<div class="flex flex-col items-center">
<span class="p-1 bg-gray-300 bg-opacity-50 font-medium rounded-lg inline-block">
<%= button_to icon("chevron-up", class: "size-5 inline", title: "erhöhen"), increment_page_operator_job_path(job, din:), method: :patch, form_class: "inline" %>
</span>
<% end %>
<span class="p-1.5 bg-gray-300 bg-opacity-50 font-medium rounded-lg text-center">
<%= job.public_send("number_of_plans_#{din}") if job.respond_to? "number_of_plans_#{din}" %>
</span>
<% if job.printing? %>
<span class="p-1 bg-gray-300 bg-opacity-50 font-medium rounded-lg inline-block">
<%= button_to icon("chevron-down", class: "size-5 inline", title: "verringern"), decrement_page_operator_job_path(job, din:), method: :patch, form_class: "inline" %>
</span>
</div>
<% end %>
</td>
<% end %>
<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²