From bc7c4e26c6d7d45a769207c82456e7475e72e8e1 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Thu, 6 Aug 2026 16:32:13 -0400 Subject: [PATCH] Added style to show and form --- .../customer_appointments/_form.html.erb | 97 ++++------- app/views/customer_appointments/show.html.erb | 152 +++++++++++++----- 2 files changed, 140 insertions(+), 109 deletions(-) diff --git a/app/views/customer_appointments/_form.html.erb b/app/views/customer_appointments/_form.html.erb index 42493d3..37a61d2 100644 --- a/app/views/customer_appointments/_form.html.erb +++ b/app/views/customer_appointments/_form.html.erb @@ -1,79 +1,42 @@ <%= labelled_form_for @appointment do |f| %> + <%= error_messages_for @appointment %> -

+

+

<%= f.text_field :subject, required: true, style: "width: 95%;" %>

-<%= f.text_field :subject %> +

+ <%= f.text_field :customer, label: :label_customer, class: "customer-name", autocomplete: "off", data: { autocomplete_url: "/customers/autocomplete" } %> + <%= f.hidden_field :customer_id, id: "customer_id", onchange: "this.form.requestSubmit()" %> +

-

+

+ <%= f.label :vehicle_id, l(:label_vehicle) %> + <%= f.collection_select :vehicle_id, @appointment.customer&.vehicles || [], :id, :name, { include_blank: true }, { label: false } %> +

-

+

+ <%= f.label :estimate_id, l(:label_estimate) %> + <%= f.collection_select :estimate_id, @appointment.customer&.estimates || [], :id, :name, { include_blank: true }, { label: false } %> +

-<%= f.text_field :customer, class: "customer-name", autocomplete: "off", data: { autocomplete_url: "/customers/autocomplete"} %> -<%= f.hidden_field :customer_id, id: "customer_id", onchange: "this.form.requestSubmit()" %> -

+

+ <%= f.label :user_id, l(:field_user) %> + <%= f.collection_select :user_id, User.active.sorted, :id, :name, { include_blank: true }, { label: false } %> +

-

+

<%= f.date_field :start_date, size: 10 %>

+

<%= f.date_field :end_date, size: 10 %>

-

+

<%= f.number_field :estimated_hours, step: 0.1, size: 6 %>

+

<%= f.number_field :duration, step: 1, size: 6, label: :label_duration %>

-<%= f.collection_select( :vehicle_id, @appointment.customer&.vehicles || [], :id, :name, include_blank: true ) %> +

<%= f.select :status, CustomerAppointment::STATUSES, label: :field_status %>

-

- -

- -<%= f.collection_select( :estimate_id, @appointment.customer&.estimates || [], :id, :name, include_blank: true ) %> - -

- - -

- -<%= f.collection_select( :user_id, User.active.sorted,:id,:name,include_blank: true ) %> - -

- -

- -<%= f.date_field :start_date %> - -

- -

- -<%= f.date_field :end_date %> - -

- -

- -<%= f.number_field :estimated_hours, step: 0.1 %> - -

- -

- -<%= f.number_field :duration, step: 1 %> - -

- -

- -<%= f.select(:status, CustomerAppointment::STATUSES) %> - -

- -

- -<%= f.text_area :description, - rows: 8 %> - -

- -

- -<%= submit_tag l(:button_save) %> - -

+

+ <%= f.text_area :description, rows: 8, class: 'wiki-edit', style: 'width: 95%;' %> + <%= wikitoolbar_for 'appointment_description' %> +

+
+ <%= submit_tag l(:button_save) %> <% end %> \ No newline at end of file diff --git a/app/views/customer_appointments/show.html.erb b/app/views/customer_appointments/show.html.erb index 657974d..67de750 100644 --- a/app/views/customer_appointments/show.html.erb +++ b/app/views/customer_appointments/show.html.erb @@ -1,53 +1,121 @@ -

<%= @appointment.subject %>

+
+ <%= link_to l(:button_edit), edit_customer_appointment_path(@appointment), class: 'icon icon-edit' %> + <%= link_to l(:button_delete), customer_appointment_path(@appointment), method: :delete, data: { confirm: l(:text_are_you_sure) }, class: 'icon icon-del' %> +
- +

+ <% if @appointment.start_date %> +
+
<%= @appointment.start_date.strftime('%b').upcase %>
+
<%= @appointment.start_date.day %>
+
+ <% end %> -

- - - + <%= @appointment.subject %> - - - - + + (<%= format_date(@appointment.start_date) %> + <% if @appointment.end_date && @appointment.start_date != @appointment.end_date %> + - <%= format_date(@appointment.end_date) %> + <% end %>) + + - - - - + - - - - +
+
+
+
+
+
<%= l(:label_customer, default: 'Customer') %>:
+
<%= link_to_if @appointment.customer, @appointment.customer&.name, @appointment.customer %>
+
+
+
<%= l(:label_vehicle, default: 'Vehicle') %>:
+
<%= link_to_if @appointment.vehicle, @appointment.vehicle&.name, @appointment.vehicle %>
+
+
+
<%= l(:label_primary_phone, default: 'Primary phone') %>:
+
<%= @appointment.customer&.primary_phone %>
+
+
+
<%= l(:label_estimate, default: 'Estimate') %>:
+
<%= link_to_if @appointment.estimate, @appointment.estimate&.name, @appointment.estimate %>
+
+
-
- - - +
+
+
<%= l(:field_status) %>:
+
<%= @appointment.status %>
+
+
+
<%= l(:field_user) %>:
+
<%= link_to_user(@appointment.user) %>
+
+
+
<%= l(:label_duration, default: 'Duration') %>:
+
<%= @appointment.duration %> <%= l(:label_day_plural, default: 'days') %>
+
+
+
<%= l(:field_estimated_hours) %>:
+
<%= @appointment.estimated_hours %>
+
+
+ + -
<%= t(:customer) %><%= link_to @appointment&.customer %>
<%= t(:vehicle) %><%= link_to @appointment&.vehicle unless @appointment&.vehicle.nil? %>
<%= t(:primary_phone) %><%= @appointment&.customer&.primary_phone %>
<%= t(:estimated_hours) %><%= @appointment.estimated_hours %>
<%= t(:description) %><%= simple_format(@appointment.description) %>
- -<%= link_to t(:edit), edit_customer_appointment_path(@appointment), class: "icon icon-edit" %> -<%= link_to t(:delete), customer_appointment_path(@appointment), method: :delete, data: { confirm: t(:are_you_sure) }, class: "icon icon-del" %> \ No newline at end of file + <% if @appointment.description.present? %> +
+
+

<%= l(:field_description) %>

+
+ <%= textilizable(@appointment, :description) %> +
+
+ <% end %> + \ No newline at end of file