Rezervacije

This commit is contained in:
2024-08-06 14:16:40 +02:00
parent 8d5a410c60
commit 6d5509856f
58 changed files with 1052 additions and 3 deletions

View File

@@ -0,0 +1,27 @@
<div id="<%= dom_id customer %>">
<p class="my-5">
<strong class="block font-medium mb-1">Name:</strong>
<%= customer.name %>
</p>
<p class="my-5">
<strong class="block font-medium mb-1">Phone:</strong>
<%= customer.phone %>
</p>
<p class="my-5">
<strong class="block font-medium mb-1">Notes:</strong>
<%= customer.notes %>
</p>
<p class="my-5">
<strong class="block font-medium mb-1">Email:</strong>
<%= customer.email %>
</p>
<p class="my-5">
<strong class="block font-medium mb-1">Birthyear:</strong>
<%= customer.birthyear %>
</p>
</div>

View File

@@ -0,0 +1,2 @@
json.extract! customer, :id, :name, :phone, :notes, :email, :birthyear, :created_at, :updated_at
json.url customer_url(customer, format: :json)

View File

@@ -0,0 +1,42 @@
<%= 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 :name %>
<%= form.text_field :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 :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 :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 %>

View File

@@ -0,0 +1,8 @@
<div class="mx-auto md:w-2/3 w-full">
<h1 class="font-bold text-4xl">Editing customer</h1>
<%= render "form", customer: @customer %>
<%= link_to "Show this customer", @customer, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
<%= link_to "Back to customers", customers_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
</div>

View 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, "Customers" %>
<div class="flex justify-between items-center">
<h1 class="font-bold text-4xl">Customers</h1>
<%= link_to "New customer", new_customer_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %>
</div>
<div id="customers" class="min-w-full">
<% @customers.each do |customer| %>
<%= render customer %>
<p>
<%= link_to "Show this customer", customer, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
</p>
<% end %>
</div>
</div>

View File

@@ -0,0 +1 @@
json.array! @customers, partial: "customers/customer", as: :customer

View File

@@ -0,0 +1,7 @@
<div class="mx-auto md:w-2/3 w-full">
<h1 class="font-bold text-4xl">New customer</h1>
<%= render "form", customer: @customer %>
<%= link_to "Back to customers", customers_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
</div>

View 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 @customer %>
<%= link_to "Edit this customer", edit_customer_path(@customer), class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
<%= link_to "Back to customers", customers_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 customer", @customer, method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium" %>
</div>
</div>
</div>

View File

@@ -0,0 +1 @@
json.partial! "customers/customer", customer: @customer