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

+105
View File
@@ -0,0 +1,105 @@
<h1>THIS IS OSOR!!!</h1>
<%= form_tag({}, data: { cm_url: issues_context_menu_path }) do %>
<%= hidden_field_tag 'back_url', url_for(params: request.query_parameters), id: nil %>
<ul class="cal">
<li scope="col" title="<%= l(:label_week) %>" class="calhead week-number"></li>
<% 7.times do |i| %>
<li scope="col" class="calhead">
<%= day_name((calendar.first_wday + i) % 7) %>
</li>
<% end %>
<% calendar.format_month.each_slice(7) do |week| %>
<li class="week-number">
<span class="label-week"><%= l(:label_week) %></span>
<%= calendar.week_number(week.first) %>
</li>
<% week.each do |day| %>
<li class="<%= calendar.day_css_classes(day) %> calbody">
<p class="day-num">
<span class="day-value"><%= day.day %></span>
<span class="abbr-day">(<%= abbr_day_name(day.cwday) %>)</span>
</p>
<% calendar.events_on(day).each do |event| %>
<% if event.is_a?(Issue) %>
<% starting = (day == event.start_date) %>
<% ending = (day == event.due_date) %>
<%= tag.div class: [
event.css_classes,
'tooltip',
'hascontextmenu',
('starting' if starting),
('ending' if ending)
].compact do %>
<%= "#{event.project} -" unless @project && @project == event.project %>
<%= sprite_icon('bullet-go', rtl: true) if starting && !ending %>
<%= sprite_icon('bullet-end', rtl: true) if ending && !starting %>
<%= sprite_icon('bullet-go-end') if starting && ending %>
<%= link_to_issue(event, truncate: 30) %>
<span class="tip">
<%= render_issue_tooltip(event) %>
</span>
<%= check_box_tag 'ids[]',
event.id,
false,
style: 'display:none;',
id: nil %>
<% end %>
<% elsif event.is_a?(Version) %>
<span class="icon icon-package">
<%= sprite_icon 'package' %>
<%= "#{event.project} -" unless @project && @project == event.project %>
<%= link_to_version(event) %>
</span>
<% elsif event.is_a?(CustomerAppointment) %>
<%= render partial: 'customer_appointments/calendar_event',
locals: {
appointment: event,
day: day,
project: @project
} %>
<% else %>
<% Rails.logger.warn("Unknown calendar event: #{event.class}") %>
<% end %>
<% end %>
</li>
<% end %>
<% end %>
</ul>
<% end %>
<%= context_menu %>
@@ -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" %>