From d33e430c754f2fe6a5b80f6f846947d73e5ab91d Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Sat, 8 Aug 2026 11:11:34 -0400 Subject: [PATCH] Enhance customer appointments view with localization, improved links, and additional actions --- .../customer_appointments/index.html.erb | 43 +++++++++---------- app/views/customer_appointments/show.html.erb | 17 +++++++- config/locales/en.yml | 5 ++- .../hooks/view_hook_listener.rb | 17 ++++---- 4 files changed, 48 insertions(+), 34 deletions(-) diff --git a/app/views/customer_appointments/index.html.erb b/app/views/customer_appointments/index.html.erb index e22db06..51bbd45 100644 --- a/app/views/customer_appointments/index.html.erb +++ b/app/views/customer_appointments/index.html.erb @@ -1,13 +1,15 @@ -

Customer Appointments

+

<%= l(:title_customer_appointments) %>

-

+

+ <%= link_to issues_calendar_path do %> + <%= l(:button_calendar) %> + <% end %> -<%= link_to( - l(:button_add), - new_project_event_path(@project) - ) %> + <%= link_to new_customer_appointment_path do %> + <%= l(:button_add) %> + <% end %> -

+
@@ -15,17 +17,17 @@ - + - + - + - + - + - + @@ -39,37 +41,32 @@ diff --git a/app/views/customer_appointments/show.html.erb b/app/views/customer_appointments/show.html.erb index e847948..a735405 100644 --- a/app/views/customer_appointments/show.html.erb +++ b/app/views/customer_appointments/show.html.erb @@ -1,6 +1,19 @@
- <%= 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' %> + <%= link_to issues_calendar_path do %> + <%= l(:button_calendar) %> + <% end %> + + <%= link_to customer_appointments_path do %> + <%= l(:button_appointments) %> + <% end %> + + <%= link_to edit_customer_appointment_path(@appointment) do %> + <%= l(:button_edit) %> + <% end %> + + <%= link_to customer_appointment_path(@appointment), method: :delete, data: { confirm: l(:text_are_you_sure) } do %> + <%= l(:button_delete) %> + <% end %>

diff --git a/config/locales/en.yml b/config/locales/en.yml index 526c179..5fac3b7 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -12,10 +12,13 @@ # Usage I18n.t(:label) en: are_you_sure: "Are you sure?" + button_appointments: Appointments + button_calendar: Calendar field_customer_name: Customer field_license_plate: License Plate field_phone: Phone field_vehicle: Vehicle + label_appointment: Appointment label_customer_appointment: Customer Appointment label_customer_calendar: Customer Calendar label_duration: Duration @@ -29,4 +32,4 @@ en: label_upcoming_appointments: "My Upcoming Appointments" permission_manage_customer_appointments: Manage Customer Appointments permission_view_customer_appointments: View Customer Appointments - \ No newline at end of file + title_customer_appointments: Customer Appoitnments \ No newline at end of file diff --git a/lib/redmine_qbo_calendar/hooks/view_hook_listener.rb b/lib/redmine_qbo_calendar/hooks/view_hook_listener.rb index c6693c2..a7eeca4 100644 --- a/lib/redmine_qbo_calendar/hooks/view_hook_listener.rb +++ b/lib/redmine_qbo_calendar/hooks/view_hook_listener.rb @@ -13,14 +13,15 @@ module RedmineQboCalendar class ViewHookListener < Redmine::Hook::ViewListener - # Load the javascript to support the autocomplete forms - def view_layouts_base_html_head(context = {}) - safe_join([ - javascript_include_tag("customer_appointments", plugin: :redmine_qbo_calendar), - javascript_include_tag("calendar", plugin: :redmine_qbo_calendar), - stylesheet_link_tag('customer_appointments', plugin: :redmine_qbo_calendar) - ]) - end + # Load the javascript and stylesheet assets + def view_layouts_base_html_head(context = {}) + safe_join([ + javascript_include_tag("customer_appointments", plugin: :redmine_qbo_calendar), + javascript_include_tag("calendar", plugin: :redmine_qbo_calendar), + stylesheet_link_tag('customer_appointments', plugin: :redmine_qbo_calendar), + javascript_include_tag('https://kit.fontawesome.com/4be4394b21.js', crossorigin: 'anonymous') + ]) + end end end

Customer<%= l(:label_customer) %>Vehicle<%= l(:label_vehicle) %>Appointment<%= l(:label_appointment) %>Assigned<%= l(:label_user) %>Date<%= l(:label_date) %>Status<%= l(:label_status) %>
-<%= link_to( - appointment.customer_name, - customer_appointment_path( - appointment - ) - ) %> +<%= link_to appointment.customer unless appointment.customer.nil? %> -<%= appointment.vehicle %> +<%= link_to appointment.vehicle unless appointment.vehicle.nil? %> -<%= appointment.subject %> +<%= link_to appointment %> -<%= appointment.user&.name %> +<%= link_to appointment.user unless appointment.user.nil? %> <%= format_date( - appointment.start_date + appointment.date ) %>