Initial Commit with basic functionality

This commit is contained in:
ricky committed 2026-08-06 13:12:19 -04:00
commit 790cefdcfe
22 files changed
+947

No files matched your search

@@ -0,0 +1,35 @@
<%= tag.div class: [
'calendar-appointment',
'tooltip'
] do %>
<% if appointment.user %>
<%= avatar(
appointment.user,
size: 20,
class: 'appointment-avatar'
) %>
<% end %>
<span >
<%= link_to appointment.subject,
customer_appointment_path(appointment) %>
</span>
<span class="tip">
<strong><%= appointment.subject %></strong><br>
Customer:
<%= appointment.customer&.name %><br>
Vehicle:
<%= appointment.vehicle&.name %><br>
Technician:
<%= appointment.user&.name %><br>
Hours:
<%= appointment.estimated_hours %>
</span>
<% end %>
@@ -0,0 +1,79 @@
<%= labelled_form_for @appointment do |f| %>
<p>
<%= f.text_field :subject %>
</p>
<p>
<%= 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()" %>
</p>
<p>
<p>
<%= f.collection_select( :vehicle_id, @appointment.customer&.vehicles || [], :id, :name, include_blank: true ) %>
</p>
<p>
<%= f.collection_select( :estimate_id, @appointment.customer&.estimates || [], :id, :name, include_blank: true ) %>
</p>
<p>
<%= f.collection_select( :user_id, User.active.sorted,:id,:name,include_blank: true ) %>
</p>
<p>
<%= f.date_field :start_date %>
</p>
<p>
<%= f.date_field :end_date %>
</p>
<p>
<%= f.number_field :estimated_hours, step: 0.1 %>
</p>
<p>
<%= f.number_field :duration, step: 1 %>
</p>
<p>
<%= f.select(:status, CustomerAppointment::STATUSES) %>
</p>
<p>
<%= f.text_area :description,
rows: 8 %>
</p>
<p>
<%= submit_tag l(:button_save) %>
</p>
<% end %>
Whitespace-only changes.
@@ -0,0 +1,3 @@
<h2>Edit Appointment</h2>
<%= render "form" %>
@@ -0,0 +1,89 @@
<h2>Customer Appointments</h2>
<p>
<%= link_to(
l(:button_add),
new_project_event_path(@project)
) %>
</p>
<table class="list">
<thead>
<tr>
<th>Customer</th>
<th>Vehicle</th>
<th>Appointment</th>
<th>Assigned</th>
<th>Date</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<% @appointments.each do |appointment| %>
<tr>
<td>
<%= link_to(
appointment.customer_name,
customer_appointment_path(
appointment
)
) %>
</td>
<td>
<%= appointment.vehicle %>
</td>
<td>
<%= appointment.subject %>
</td>
<td>
<%= appointment.user&.name %>
</td>
<td>
<%= format_date(
appointment.start_date
) %>
</td>
<td>
<%= appointment.status %>
</td>
</tr>
<% end %>
</tbody>
</table>
@@ -0,0 +1,3 @@
<h2>New Appointment</h2>
<%= render "form" %>
@@ -0,0 +1,53 @@
<h2><%= @appointment.subject %></h2>
<table class="attributes">
<tr>
<th><%= t(:customer) %></th>
<td><%= link_to @appointment&.customer %></td>
</tr>
<tr>
<th><%= t(:vehicle) %></th>
<td><%= link_to@appointment&.vehicle %></td>
</tr>
<tr>
<th><%= t(:primary_phone) %></th>
<td><%= @appointment&.customer&.primary_phone %></td>
</tr>
<tr>
<th><%= t(:technician) %></th>
<td><%= link_to @appointment.user %></td>
</tr>
<tr>
<th><%= t(:status) %></th>
<td><%= @appointment.status %></td>
</tr>
<tr>
<th><%= t(:estimate) %></th>
<td><%= link_to @appointment.estimate unless @appointment.estimate.nil? %></td>
</tr>
<tr>
<th><%= t(:duration) %></th>
<td><%= @appointment.duration %> <%= t(:days) %></td>
</tr>
<tr>
<th><%= t(:estimated_hours) %></th>
<td><%= @appointment.estimated_hours %></td>
</tr>
<tr>
<th><%= t(:description) %></th>
<td><%= simple_format(@appointment.description) %></td>
</tr>
</table>
<%= 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" %>