Scaffold job model
This commit is contained in:
92
app/views/jobs/_form.html.erb
Normal file
92
app/views/jobs/_form.html.erb
Normal file
@@ -0,0 +1,92 @@
|
||||
<%= 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 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 :operator_id_id %>
|
||||
<%= form.text_field :operator_id_id, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :costumer_id_id %>
|
||||
<%= form.text_field :costumer_id_id, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :operator_firstname %>
|
||||
<%= form.text_field :operator_firstname, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :operator_lastname %>
|
||||
<%= form.text_field :operator_lastname, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :costumer_firstname %>
|
||||
<%= form.text_field :costumer_firstname, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :costumer_lastname %>
|
||||
<%= form.text_field :costumer_lastname, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :paid %>
|
||||
<%= form.check_box :paid, class: "block mt-2 h-5 w-5" %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :printed_at %>
|
||||
<%= form.datetime_field :printed_at, class: "block shadow rounded-md border border-gray-400 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 rounded-md border border-gray-400 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 rounded-md border border-gray-400 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 rounded-md border border-gray-400 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 rounded-md border border-gray-400 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 rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :costum_qm_plan %>
|
||||
<%= form.text_field :costum_qm_plan, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
|
||||
</div>
|
||||
|
||||
<div class="inline">
|
||||
<%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
|
||||
</div>
|
||||
<% end %>
|
||||
77
app/views/jobs/_job.html.erb
Normal file
77
app/views/jobs/_job.html.erb
Normal file
@@ -0,0 +1,77 @@
|
||||
<div id="<%= dom_id job %>">
|
||||
<p class="my-5">
|
||||
<strong class="block font-medium mb-1">Operator:</strong>
|
||||
<%= job.operator_id_id %>
|
||||
</p>
|
||||
|
||||
<p class="my-5">
|
||||
<strong class="block font-medium mb-1">Costumer:</strong>
|
||||
<%= job.costumer_id_id %>
|
||||
</p>
|
||||
|
||||
<p class="my-5">
|
||||
<strong class="block font-medium mb-1">Operator firstname:</strong>
|
||||
<%= job.operator_firstname %>
|
||||
</p>
|
||||
|
||||
<p class="my-5">
|
||||
<strong class="block font-medium mb-1">Operator lastname:</strong>
|
||||
<%= job.operator_lastname %>
|
||||
</p>
|
||||
|
||||
<p class="my-5">
|
||||
<strong class="block font-medium mb-1">Costumer firstname:</strong>
|
||||
<%= job.costumer_firstname %>
|
||||
</p>
|
||||
|
||||
<p class="my-5">
|
||||
<strong class="block font-medium mb-1">Costumer lastname:</strong>
|
||||
<%= job.costumer_lastname %>
|
||||
</p>
|
||||
|
||||
<p class="my-5">
|
||||
<strong class="block font-medium mb-1">Paid:</strong>
|
||||
<%= job.paid %>
|
||||
</p>
|
||||
|
||||
<p class="my-5">
|
||||
<strong class="block font-medium mb-1">Printed at:</strong>
|
||||
<%= job.printed_at %>
|
||||
</p>
|
||||
|
||||
<p class="my-5">
|
||||
<strong class="block font-medium mb-1">Intern:</strong>
|
||||
<%= job.intern %>
|
||||
</p>
|
||||
|
||||
<p class="my-5">
|
||||
<strong class="block font-medium mb-1">Cost center:</strong>
|
||||
<%= job.cost_center %>
|
||||
</p>
|
||||
|
||||
<p class="my-5">
|
||||
<strong class="block font-medium mb-1">Number of plans a0:</strong>
|
||||
<%= job.number_of_plans_a0 %>
|
||||
</p>
|
||||
|
||||
<p class="my-5">
|
||||
<strong class="block font-medium mb-1">Number of plans a1:</strong>
|
||||
<%= job.number_of_plans_a1 %>
|
||||
</p>
|
||||
|
||||
<p class="my-5">
|
||||
<strong class="block font-medium mb-1">Number of plans a2:</strong>
|
||||
<%= job.number_of_plans_a2 %>
|
||||
</p>
|
||||
|
||||
<p class="my-5">
|
||||
<strong class="block font-medium mb-1">Number of plans a3:</strong>
|
||||
<%= job.number_of_plans_a3 %>
|
||||
</p>
|
||||
|
||||
<p class="my-5">
|
||||
<strong class="block font-medium mb-1">Costum qm plan:</strong>
|
||||
<%= job.costum_qm_plan %>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
2
app/views/jobs/_job.json.jbuilder
Normal file
2
app/views/jobs/_job.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
||||
json.extract! job, :id, :operator_id_id, :costumer_id_id, :operator_firstname, :operator_lastname, :costumer_firstname, :costumer_lastname, :paid, :printed_at, :intern, :cost_center, :number_of_plans_a0, :number_of_plans_a1, :number_of_plans_a2, :number_of_plans_a3, :costum_qm_plan, :created_at, :updated_at
|
||||
json.url job_url(job, format: :json)
|
||||
8
app/views/jobs/edit.html.erb
Normal file
8
app/views/jobs/edit.html.erb
Normal file
@@ -0,0 +1,8 @@
|
||||
<div class="mx-auto md:w-2/3 w-full">
|
||||
<h1 class="font-bold text-4xl">Editing job</h1>
|
||||
|
||||
<%= render "form", job: @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 "Back to jobs", jobs_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
|
||||
</div>
|
||||
21
app/views/jobs/index.html.erb
Normal file
21
app/views/jobs/index.html.erb
Normal file
@@ -0,0 +1,21 @@
|
||||
<div class="w-full">
|
||||
<% if notice.present? %>
|
||||
<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" %>
|
||||
|
||||
<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>
|
||||
|
||||
<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>
|
||||
</div>
|
||||
1
app/views/jobs/index.json.jbuilder
Normal file
1
app/views/jobs/index.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.array! @jobs, partial: "jobs/job", as: :job
|
||||
7
app/views/jobs/new.html.erb
Normal file
7
app/views/jobs/new.html.erb
Normal file
@@ -0,0 +1,7 @@
|
||||
<div class="mx-auto md:w-2/3 w-full">
|
||||
<h1 class="font-bold text-4xl">New job</h1>
|
||||
|
||||
<%= render "form", job: @job %>
|
||||
|
||||
<%= link_to "Back to jobs", jobs_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
|
||||
</div>
|
||||
15
app/views/jobs/show.html.erb
Normal file
15
app/views/jobs/show.html.erb
Normal file
@@ -0,0 +1,15 @@
|
||||
<div class="mx-auto md:w-2/3 w-full flex">
|
||||
<div class="mx-auto">
|
||||
<% if notice.present? %>
|
||||
<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 %>
|
||||
|
||||
<%= render @job %>
|
||||
|
||||
<%= link_to "Edit this job", edit_job_path(@job), class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
|
||||
<%= link_to "Back to jobs", jobs_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
|
||||
<div class="inline-block ml-2">
|
||||
<%= button_to "Destroy this job", @job, method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
1
app/views/jobs/show.json.jbuilder
Normal file
1
app/views/jobs/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.partial! "jobs/job", job: @job
|
||||
Reference in New Issue
Block a user