mirror of
https://github.com/rickbarrette/redmine_qbo_calendar.git
synced 2026-11-17 21:50:37 -05:00
- Appointment view: show the day of the week on the start and end dates, and lay the header out as a flex row so it no longer wraps under the action links - Calendar: month total of estimated hours and appointments in the toolbar, counting only the shown month's days (hidden past weeks included) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
156 lines
6.7 KiB
ERB
156 lines
6.7 KiB
ERB
<div class="contextual">
|
|
<%= link_to issues_calendar_path do %>
|
|
<i class="fa-regular fa-calendar-days"></i> <%= l(:button_calendar) %>
|
|
<% end %>
|
|
|
|
<% if @appointment.customer %>
|
|
<%= link_to history_customer_appointments_path(customer_id: @appointment.customer_id) do %>
|
|
<i class="fa-solid fa-clock-rotate-left"></i> <%= l(:label_appointment_history) %>
|
|
<% end %>
|
|
<% end %>
|
|
<% if !@appointment.call_out? && User.current.allowed_to?(:add_customer_appointments, nil, global: true) %>
|
|
<%= link_to new_issue_path(issue: { customer_id: @appointment.customer_id, vehicle_id: @appointment.vehicle_id, estimate_id: @appointment.estimate_id }), target: :_blank do %>
|
|
<i class="fa-solid fa-plus"></i> <%= l(:label_new_issue) %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<%# Issues from the estimate are made by redmine_qbo, with this appointment's dates, technician and vehicle %>
|
|
<% if @appointment.estimate && User.current.allowed_to?(:create_estimate_issues, nil, global: true) %>
|
|
<%= link_to issues_preview_qbo_estimate_path(@appointment.estimate_id, appointment_id: @appointment.id) do %>
|
|
<i class="fa-solid fa-list-check"></i> <%= l(:button_create_issues_from_estimate) %>
|
|
<% end %>
|
|
<% end %>
|
|
<% if User.current.allowed_to?(:edit_customer_appointments, nil, global: true) %>
|
|
<%= link_to edit_customer_appointment_path(@appointment) do %>
|
|
<i class="fa-solid fa-pen-to-square"></i> <%= l(:button_edit) %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% if User.current.allowed_to?(:delete_customer_appointments, nil, global: true) %>
|
|
<%= link_to customer_appointment_path(@appointment), method: :delete, data: { confirm: l(:text_are_you_sure) } do %>
|
|
<i class="fa-solid fa-trash"></i> <%= l(:button_delete) %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<h2 class="appointment-header">
|
|
<% if @appointment.date %>
|
|
<div class="calendar-badge">
|
|
<div class="month"><%= @appointment.date.strftime('%b').upcase %></div>
|
|
<div class="day"><%= @appointment.date.day %></div>
|
|
</div>
|
|
<% end %>
|
|
|
|
<div class="appointment-heading">
|
|
<span class="appointment-title"><%= @appointment.subject %></span>
|
|
|
|
<% if @appointment.date %>
|
|
<span class="appointment-dates">
|
|
<span class="appointment-date"><%= day_name(@appointment.date.wday) %>, <%= format_date(@appointment.date) %> <%= l(:label_at, default: 'at') %> <%= @appointment.date.strftime('%I:%M %p') %></span>
|
|
<% if @appointment.respond_to?(:due_date) && @appointment.due_date.present? && @appointment.duration.to_i > 1 %>
|
|
– <span class="appointment-date"><%= day_name(@appointment.due_date.wday) %>, <%= format_date(@appointment.due_date) %></span>
|
|
<% end %>
|
|
</span>
|
|
<% end %>
|
|
</div>
|
|
</h2>
|
|
|
|
<%# Quick status buttons; call-outs have no status %>
|
|
<% if !@appointment.call_out? && User.current.allowed_to?(:edit_customer_appointments, nil, global: true) %>
|
|
<div class="appointment-quick-actions">
|
|
<span class="quick-action-label"><%= l(:label_change_status, default: 'Change Status:') %></span>
|
|
<% CustomerAppointment.statuses.reject { |s| s.key == @appointment.status_record.key }.each do |status| %>
|
|
<%= link_to status.name,
|
|
customer_appointment_path(@appointment, customer_appointment: { status: status.key }),
|
|
method: :patch,
|
|
class: 'quick-status-btn', style: status.style %>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
|
|
<div class="issue details">
|
|
<div class="attributes">
|
|
<div class="splitcontent">
|
|
<div class="splitcontentleft">
|
|
<% if @appointment.call_out? %>
|
|
<%# A call-out is about the employee who's off, not a customer %>
|
|
<div class="attribute">
|
|
<div class="label"><%= l(:label_employee) %>:</div>
|
|
<div class="value"><%= link_to_user(@appointment.user) %></div>
|
|
</div>
|
|
<% else %>
|
|
<div class="attribute">
|
|
<div class="label"><%= l(:label_customer, default: 'Customer') %>:</div>
|
|
<div class="value"><%= link_to_if @appointment.customer, @appointment.customer&.name, @appointment.customer %></div>
|
|
</div>
|
|
<div class="attribute">
|
|
<div class="label"><%= l(:label_vehicle, default: 'Vehicle') %>:</div>
|
|
<div class="value"><%= link_to_if @appointment.vehicle, @appointment.vehicle&.name, @appointment.vehicle %></div>
|
|
</div>
|
|
<div class="attribute">
|
|
<div class="label"><%= l(:label_primary_phone, default: 'Primary phone') %>:</div>
|
|
<div class="value"><%= @appointment.customer&.primary_phone %></div>
|
|
</div>
|
|
<div class="attribute">
|
|
<div class="label"><%= l(:label_estimate) %>:</div>
|
|
<% if @appointment.estimate %>
|
|
<div class="value"><%= link_to @appointment.estimate, @appointment.estimate, target: "_blank" %></div>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="splitcontentright">
|
|
<div class="attribute">
|
|
<div class="label"><%= l(:field_status) %>:</div>
|
|
<div class="value">
|
|
<%= appointment_status_badge(@appointment) %>
|
|
</div>
|
|
</div>
|
|
<div class="attribute">
|
|
<div class="label"><%= l(:label_time, default: 'Time') %>:</div>
|
|
<div class="value">
|
|
<%= @appointment.date ? @appointment.date.strftime('%I:%M %p') : '-' %>
|
|
</div>
|
|
</div>
|
|
<% unless @appointment.call_out? %>
|
|
<div class="attribute">
|
|
<div class="label"><%= l(:field_user) %>:</div>
|
|
<div class="value"><%= link_to_user(@appointment.user) %></div>
|
|
</div>
|
|
<% end %>
|
|
<div class="attribute">
|
|
<div class="label"><%= l(:label_duration, default: 'Duration') %>:</div>
|
|
<div class="value"><%= @appointment.duration %> <%= l(:label_days) %></div>
|
|
</div>
|
|
<% unless @appointment.call_out? %>
|
|
<div class="attribute">
|
|
<div class="label"><%= l(:field_estimated_hours) %>:</div>
|
|
<div class="value">
|
|
<%= @appointment.estimated_hours %> <%= l(:label_hours) %>
|
|
<% if @appointment.partial_estimate? && @appointment.estimate %>(<%= l(:label_partial_estimate) %>)<% end %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<% if @appointment.description.present? %>
|
|
<hr />
|
|
<div class="description">
|
|
<p><strong><%= l(:field_description) %></strong></p>
|
|
<div class="wiki">
|
|
<%= textilizable(@appointment, :description) %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
|
|
<% if @appointment.estimate %>
|
|
<h3><%= l(:label_estimate_issues, estimate: @appointment.estimate.doc_number) %></h3>
|
|
<%= render partial: 'issues/list_simple', locals: { issues: @estimate_issues } %>
|
|
<% end %>
|
|
|
|
<%= call_hook :show_customer_appointment, { appointment: @appointment } %>
|