60 lines
2.2 KiB
Plaintext
60 lines
2.2 KiB
Plaintext
<%= form_with(model: customer, class: "contents") do |form| %>
|
|
<% if customer.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(customer.errors.count, "error") %> prohibited this customer from being saved:</h2>
|
|
|
|
<ul>
|
|
<% customer.errors.each do |error| %>
|
|
<li><%= error.full_message %></li>
|
|
<% end %>
|
|
</ul>
|
|
</div>
|
|
<% end %>
|
|
|
|
<div class="my-5">
|
|
<%= form.label :first_name %>
|
|
<%= form.text_field :first_name, 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 :surname %>
|
|
<%= form.text_field :surname, 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 :phone %>
|
|
<%= form.text_field :phone, 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 :notes %>
|
|
<%= form.text_area :notes, rows: 4, 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 :color %>
|
|
<%= form.select :color,
|
|
options_for_select([
|
|
['Green', 'green'],
|
|
['Yellow', 'yellow'],
|
|
['Red', 'red']
|
|
], customer.color),
|
|
{ prompt: 'Select color' },
|
|
{ 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 :email %>
|
|
<%= form.text_field :email, 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 :birthyear %>
|
|
<%= form.number_field :birthyear, 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 %>
|