Worked on layout, added model funktions, changed database

Changes to the migration file make it necessary to reimport the
database: db:drop, db:create, db:migrate, db:seed
This commit is contained in:
2024-08-01 00:27:55 +02:00
parent 40ea1910c7
commit e3d5d97c6c
9 changed files with 137 additions and 34 deletions

View File

@@ -0,0 +1,23 @@
<tr id="<%= dom_id job %>" class="<%= cycle('bg-gray-50','bg-gray-200') %> ">
<td class="p-3 text-sm text-gray-900"> <%= job.id %> </td>
<td class="p-3 text-sm text-gray-900"> <%= job.fullname %> </td>
<td class="p-3 text-sm text-gray-900"> <%= job.pdf %> </td>
<td class="p-3 text-sm text-gray-900"> <%= job.number_of_plans_a0 %> </td>
<td class="p-3 text-sm text-gray-900"> <%= job.number_of_plans_a1 %> </td>
<td class="p-3 text-sm text-gray-900"> <%= job.number_of_plans_a2 %> </td>
<td class="p-3 text-sm text-gray-900"> <%= job.number_of_plans_a3 %> </td>
<td class="p-3 text-sm text-gray-900">
<% case job.status.to_sym %>
<% when :open %>
<span class="p-1.5 text-xs font-medium upercase tracking-wieder text-gray-900 bg-gray-300 rounded-lg"> <%= job.status %> </span>
<% when :printing %>
<span class="p-1.5 text-xs font-medium upercase tracking-wieder text-yellow-900 bg-yellow-300 rounded-lg"> <%= job.status %> </span>
<% when :ready_for_pickup %>
<span class="p-1.5 text-xs font-medium upercase tracking-wieder text-orange-900 bg-orange-300 rounded-lg"> <%= job.status %> </span>
<% when :paid %>
<span class="p-1.5 text-xs font-medium upercase tracking-wieder text-green-900 bg-green-300 rounded-lg"> <%= job.status %> </span>
<% when :cancelled %>
<span class="p-1.5 text-xs font-medium upercase tracking-wieder text-red-900 bg-red-300 rounded-lg"> <%= job.status %> </span>
<% end %>
</td>
</tr>

View File

@@ -3,19 +3,31 @@
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%= notice %></p>
<% end %>
<% content_for :title, "Jobs" %>
<% content_for :title, "Current Print Jobs" %>
<div class="flex justify-between items-center">
<h1 class="font-bold text-4xl">Jobs</h1>
<%= link_to "New job", new_job_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %>
<div class="flex justify-between items-center py-4">
<h1 class="font-bold text-4xl">Plottaufträge am <%= Date.today.strftime("%d.%m.%Y") %></h1>
<%= link_to "Plottauftrag aufgeben", new_job_path, class: "py-3 px-5 bg-hsrm-red drop-shadow-lg transition-colors duration-100 hover:bg-hsrm-red-light text-white block font-medium" %>
</div>
<div id="jobs" class="min-w-full">
<% @jobs.each do |job| %>
<%= render job %>
<p>
<%= link_to "Show this job", job, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
</p>
<% end %>
<div id="jobs" class="min-w-full drop-shadow-lg">
<table class="w-full">
<thead class="bg-gray-200 border-b-2 border-gray-400">
<tr>
<th class="p-3 text-sm font-semibold tracking-wide text-left"> ID </th>
<th class="p-3 text-sm font-semibold tracking-wide text-left"> Name </th>
<th 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"> A0 </th>
<th class="p-3 text-sm font-semibold tracking-wide text-left"> A1 </th>
<th class="p-3 text-sm font-semibold tracking-wide text-left"> A2 </th>
<th class="p-3 text-sm font-semibold tracking-wide text-left"> A3 </th>
<th class="p-3 text-sm font-semibold tracking-wide text-left"> Status </th>
</tr>
</thead>
<tbody>
<%= 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>

View File

@@ -10,16 +10,28 @@
<%= javascript_importmap_tags %>
</head>
<body>
<header class="container mx-auto px-4 py-6 flex items-center justify-between">
<a href="/" class="font-bold text-black text-xl">Plottservice</a>
<header class="container mx-auto px-4 py-6 flex items-center justify-between border-b-2">
<a href="/" class="font-bold text-black text-4xl">Plottservice Fachbereich AB</a>
<nav>
<ul class="flex items-color justify-center font-semibold">
<li class="relative">
<button class="px-4 py-2 hover:text-hsrm-red cursor-default">
Products
</button>
</li>
<li class="relative">
<button class="px-4 py-2 hover:text-hsrm-red cursor-default">
Products
</button>
</li>
</ul>
</nav>
<nav>
<ul>
<li>
<a href="#" class="rounded-full px-3 py-2 font-semibold bg-white bg-opacity-10 flex items-center group">
<span class="mr-2">Sign in</span>
<svg class="stroke-current" width="10" height="10" viewBox="0 0 10 10" aria-hidden="true" style="stroke: rgb(194, 62, 110);">
<a href="#" class="px-3 py-2 font-semibold bg-hsrm-red hover:bg-hsrm-red-light drop-shadow-lg transition-colors duration-100 bg-opacity-100 flex items-center group text-white">
<span class="mr-2">Anmelden</span>
<svg class="stroke-current" width="10" height="10" viewBox="0 0 10 10" aria-hidden="true" style="stroke: rgb(255, 255, 255);">
<g fill-rule="evenodd">
<path class="opacity-0 group-hover:opacity-100 transition ease-in-out duration-200" d="M0 5h7"></path>
<path class="HoverArrow__tipPath" d="M1 1l4 4-4 4"></path>
@@ -30,10 +42,11 @@
</ul>
</nav>
</header>
<main class="container mx-auto mt-28 px-5 flex">
<main class="container mx-auto mt-8 px-5 flex">
<%= yield %>
</main>
<footer>
<p></p>
</footer>
</body>
</html>