25 Commits
Author SHA1 Message Date
ricky 167e956457 Add holiday management functionality with CRUD operations
- Implement HolidaysController for managing holidays
- Create Holiday model with validation for recurrence types
- Add holiday form and views for creating, editing, and listing holidays
- Integrate holiday checks into customer appointment scheduling
- Update locale file for holiday-related labels and error messages
- Add migration for holidays table
- Update plugin version and add holidays to admin menu
2026-09-05 22:08:36 -04:00
ricky 9a8787c3da Moved calendar JavaScript inclusion from view hook to the calendar view 2026-08-26 10:37:35 -04:00
ricky 2acbbd343a Moved javascript into javascript file 2026-08-25 14:38:24 -04:00
ricky 46784cff44 Added a today button to bring the calendar to the current day 2026-08-25 14:30:06 -04:00
ricky e3b2d33f8e Added session management for calendar month/year 2026-08-25 14:24:30 -04:00
ricky 40fc92b692 2026.8.1 2026-08-25 14:11:28 -04:00
ricky 8427c26532 Refactor appointment labels to use localization for edit and new appointment headers; add missing localization keys. 2026-08-24 20:30:13 -04:00
ricky de7aba15ce Add inline customer creation modal and functionality 2026-08-24 20:17:41 -04:00
ricky 7807e5a1e7 Tweaked layout for avatar & days 2026-08-19 13:56:51 -04:00
ricky a93fdfe63b Added call out status 2026-08-19 12:50:40 -04:00
ricky edd75af01b update the favicon without java script 2026-08-19 08:20:02 -04:00
ricky bd649daa4e added js to dynamically change fav icon to a calendar 2026-08-18 22:05:42 -04:00
ricky 7dbec61c78 Added new issue link 2026-08-18 07:53:59 -04:00
ricky 3e961e2ae9 added option to hide past weeks 2026-08-17 19:31:31 -04:00
ricky e80769bf05 added border around today 2026-08-17 19:10:32 -04:00
ricky e4a51ca393 automatically scroll to today 2026-08-17 18:58:09 -04:00
ricky f99450a58b updated colors and style 2026-08-17 18:52:28 -04:00
ricky d529c99a02 Add day count calculation to appointment display in calendar 2026-08-12 08:37:28 -04:00
ricky 631afa5a6d Refactor calendar to have the date placed on the left and the total estimated hours placed on the right 2026-08-12 07:18:13 -04:00
ricky 97d2fbf5bc Implement responsive mobile view for calendar layout and tooltip positioning 2026-08-12 07:13:24 -04:00
ricky 4e4389dbb8 Remove new apointment links from non working days 2026-08-11 15:13:21 -04:00
ricky 045414e789 Redefine grid layout for calendar and optimize weekend cell display 2026-08-11 14:59:39 -04:00
ricky fbe3eb7382 Enhance appointment card layout with improved styling and structure 2026-08-11 14:46:50 -04:00
ricky 7d6cddf5ca Open estimates in new tab 2026-08-11 14:31:11 -04:00
ricky 62985e9ca2 Added header for simple appointments partial 2026-08-10 19:51:58 -04:00
57 changed files with 1060 additions and 163 deletions

No files matched your search

+81
View File
@@ -0,0 +1,81 @@
#The MIT License (MIT)
#
#Copyright (c) 2026 rick barrette
#
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO CustomerAppointment SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
class HolidaysController < ApplicationController
layout 'admin' # Uses Redmine's admin layout to fit standard administration menus
before_action :require_admin # Adjust permissions if regular project managers should access this
before_action :find_holiday, only: [:edit, :update, :destroy]
def index
@holidays = Holiday.order(exact_date: :asc, month: :asc)
end
def new
@holiday = Holiday.new
end
def create
@holiday = Holiday.new(holiday_params)
if @holiday.save
flash[:notice] = l(:notice_successful_create)
redirect_to holidays_path
else
respond_to do |format|
format.html { render action: 'new' }
end
end
end
def edit
# @holiday is loaded via before_action
end
def update
if @holiday.update(holiday_params)
flash[:notice] = l(:notice_successful_update)
redirect_to holidays_path
else
respond_to do |format|
format.html { render action: 'edit' }
end
end
end
def destroy
@holiday.destroy
flash[:notice] = l(:notice_successful_delete)
redirect_to holidays_path
rescue ActiveRecord::DeleteRestrictionError
flash[:error] = l(:notice_unable_delete_holiday)
redirect_to holidays_path
end
private
def find_holiday
@holiday = Holiday.find(params[:id])
rescue ActiveRecord::RecordNotFound
render_404
end
def holiday_params
params.require(:holiday).permit(
:name,
:exact_date,
:is_recurring,
:recurrence_type,
:month,
:day_of_week,
:week_of_month
)
end
end
+23 -2
View File
@@ -19,15 +19,19 @@ class CustomerAppointment < ActiveRecord::Base
validates :subject, presence: true validates :subject, presence: true
validates :date, presence: true validates :date, presence: true
# Prevent scheduling on non-working days or holidays
validate :validate_working_day
normalizes :subject, with: ->(subject) { subject.strip.titleize } normalizes :subject, with: ->(subject) { subject.strip.titleize }
STATUSES = %w[ STATUSES = %w[
Scheduled Scheduled
CheckedIn Checked_In
InProgress In_Progress
Ready Ready
Completed Completed
Cancelled Cancelled
Call_Out
] ]
# Scans the QBO Estimate's InvoiceLineItems for "Labor" sales items # Scans the QBO Estimate's InvoiceLineItems for "Labor" sales items
@@ -114,6 +118,23 @@ class CustomerAppointment < ActiveRecord::Base
Rails.logger.info "[CustomerAppointment] #{msg}" Rails.logger.info "[CustomerAppointment] #{msg}"
end end
# Validates that the appointment date does not land on a weekend or holiday
def validate_working_day
return if date.blank?
target_date = date.to_date
non_working_days = Setting.non_working_week_days || []
if non_working_days.include?(target_date.cwday.to_s)
errors.add(:date, :invalid, message: I18n.t(:error_non_working_day))
elsif defined?(Holiday)
matched_holiday = Holiday.all.find { |h| h.occurs_on?(target_date) }
if matched_holiday.present?
errors.add(:date, :invalid, message: I18n.t(:error_holiday, name: matched_holiday.name))
end
end
end
# Helper to parse item name across Quickbooks::Model::Line and Hash structures # Helper to parse item name across Quickbooks::Model::Line and Hash structures
def extract_item_name(line) def extract_item_name(line)
if line.respond_to?(:sales_line_item_detail) && line.sales_line_item_detail.present? if line.respond_to?(:sales_line_item_detail) && line.sales_line_item_detail.present?
+40
View File
@@ -0,0 +1,40 @@
#The MIT License (MIT)
#
#Copyright (c) 2026 rick barrette
#
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
class Holiday < ApplicationRecord
TYPES = %w[
fixed
dynamic
]
validates :recurrence_type, inclusion: { in: TYPES }, allow_blank: true
def occurs_on?(target_date)
if !is_recurring
return exact_date == target_date
end
if recurrence_type == 'fixed'
return target_date.month == exact_date.month && target_date.day == exact_date.day
end
if recurrence_type == 'dynamic'
# Check if month and day of week match
return false unless target_date.month == month && target_date.wday == day_of_week
# Calculate if it's the correct week of the month (1st, 2nd, 3rd, etc.)
week_in_month = ((target_date.day - 1) / 7) + 1
return week_in_month == week_of_month
end
false
end
end
+87 -44
View File
@@ -1,10 +1,19 @@
<%= javascript_include_tag("calendar", plugin: :redmine_qbo_calendar) %>
<% <%
# Check if toggle is active via query params # Check if toggles are active via query params
only_appointments = params[:only_appointments] == '1' only_appointments = params[:only_appointments] == '1'
hide_past_weeks = params[:hide_past_weeks] == '1'
# Current date context
today = User.current.today
is_current_month = (calendar.instance_variable_get(:@month) == today.month && calendar.instance_variable_get(:@year) == today.year)
# Get Redmine's configured non-working week days (e.g., ["6", "7"] for Sat/Sun) # Get Redmine's configured non-working week days (e.g., ["6", "7"] for Sat/Sun)
non_working_days = Setting.non_working_week_days || [] non_working_days = Setting.non_working_week_days || []
all_holidays = Holiday.all
# Safely collect all unique CustomerAppointments across the entire calendar date range # Safely collect all unique CustomerAppointments across the entire calendar date range
all_appointments = (calendar.startdt..calendar.enddt).flat_map { |date| all_appointments = (calendar.startdt..calendar.enddt).flat_map { |date|
calendar.events_on(date) calendar.events_on(date)
@@ -19,15 +28,23 @@
target_date = current_day.to_date target_date = current_day.to_date
return false if target_date < start_date return false if target_date < start_date
# Skip rendering on Redmine non-working days
# Skip rendering on Redmine standard non-working days
return false if non_working_days.include?(target_date.cwday.to_s) return false if non_working_days.include?(target_date.cwday.to_s)
# Skip rendering on custom non-working days (Holidays)
return false if all_holidays.any? { |h| h.occurs_on?(target_date) }
duration = [appointment.duration.to_i, 1].max duration = [appointment.duration.to_i, 1].max
date_cursor = start_date date_cursor = start_date
working_days_count = 0 working_days_count = 0
while date_cursor <= target_date while date_cursor <= target_date
unless non_working_days.include?(date_cursor.cwday.to_s) is_standard_weekend = non_working_days.include?(date_cursor.cwday.to_s)
is_custom_holiday = all_holidays.any? { |h| h.occurs_on?(date_cursor) }
# Only increment duration count if it's a standard working day AND not a holiday
unless is_standard_weekend || is_custom_holiday
working_days_count += 1 working_days_count += 1
end end
@@ -64,7 +81,35 @@
<% end %> <% end %>
<!-- Toggle Bar --> <!-- Toggle Bar -->
<div class="calendar-filter-toolbar" style="margin-bottom: 12px; display: flex; align-items: center; justify-content: flex-end;"> <div class="calendar-filter-toolbar" style="margin-bottom: 12px; display: flex; align-items: center; justify-content: flex-end; gap: 16px;">
<% if is_current_month %>
<button type="button"
onclick="scrollToToday()"
class="button-small"
style="display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-weight: 600; font-size: 0.9em; padding: 4px 10px; border-radius: 3px;"
title="<%= l(:label_today) %>">
<i class="fa fa-calendar-check-o" aria-hidden="true"></i>
<%= l(:label_today) %>
</button>
<% else %>
<%= link_to url_for(request.query_parameters.merge(year: today.year, month: today.month)),
class: 'button-small',
style: 'display: inline-flex; align-items: center; gap: 5px; text-decoration: none; font-weight: 600; font-size: 0.9em; padding: 4px 10px; border-radius: 3px;',
title: l(:label_today) do %>
<i class="fa fa-calendar-check-o" aria-hidden="true"></i>
<%= l(:label_today,) %>
<% end %>
<% end %>
<label for="toggle-hide-past-weeks" style="cursor: pointer; font-weight: 600; font-size: 0.9em; color: #444; display: inline-flex; align-items: center; gap: 6px;">
<%= check_box_tag 'hide_past_weeks',
'1',
hide_past_weeks,
id: 'toggle-hide-past-weeks',
onchange: 'toggleHidePastWeeks(this.checked)' %>
<%= l(:label_hide_past_weeks, default: 'Hide Past Weeks') %>
</label>
<label for="toggle-only-appointments" style="cursor: pointer; font-weight: 600; font-size: 0.9em; color: #444; display: inline-flex; align-items: center; gap: 6px;"> <label for="toggle-only-appointments" style="cursor: pointer; font-weight: 600; font-size: 0.9em; color: #444; display: inline-flex; align-items: center; gap: 6px;">
<%= check_box_tag 'only_appointments', <%= check_box_tag 'only_appointments',
'1', '1',
@@ -88,6 +133,8 @@
<% end %> <% end %>
<% calendar.format_month.each_slice(7) do |week| %> <% calendar.format_month.each_slice(7) do |week| %>
<%# Skip week if "hide past weeks" is active and every day in the week is in the past %>
<% next if hide_past_weeks && week.last < User.current.today %>
<li class="week-number"> <li class="week-number">
<span class="label-week"><%= l(:label_week) %></span> <span class="label-week"><%= l(:label_week) %></span>
@@ -97,6 +144,13 @@
<% week.each do |day| %> <% week.each do |day| %>
<% <%
is_today = (day == User.current.today)
# Find the specific holiday for this day (if any)
current_holiday = all_holidays.find { |h| h.occurs_on?(day) }
is_custom_holiday = current_holiday.present?
is_standard_weekend = non_working_days.include?(day.cwday.to_s)
# Filter out standard events if "only appointments" toggle is active # Filter out standard events if "only appointments" toggle is active
standard_events = only_appointments ? [] : calendar.events_on(day).reject { |e| e.is_a?(CustomerAppointment) } standard_events = only_appointments ? [] : calendar.events_on(day).reject { |e| e.is_a?(CustomerAppointment) }
@@ -130,19 +184,22 @@
end end
%> %>
<li class="<%= calendar.day_css_classes(day) %> calbody"> <%# Added 'week-end' class and background color styling for custom holidays to mimic weekends %>
<li class="<%= calendar.day_css_classes(day) %> calbody <%= 'week-end' if is_custom_holiday %>" style="<%= 'background-color: #f6f6f6;' if is_custom_holiday %>"<%= ' id="today"'.html_safe if is_today %>>
<p class="day-num" style="display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-bottom: 4px;"> <p class="day-num" style="display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-bottom: 4px;">
<span class="day-num-left" style="display: inline-flex; align-items: center; justify-self: start;"> <!-- Left: Day number and abbreviated weekday -->
<% if total_hours > 0 %> <span class="day-num-left" style="display: inline-flex; align-items: center; justify-self: start; gap: 3px;">
<span class="hours-total" style="font-weight: bold; color: #555;" title="<%= l(:label_estimated_hours, default: 'Estimated hours') %>"> <a name="<%= day.to_s %>" <%= 'id="today-anchor"'.html_safe if is_today %> style="text-decoration: none; color: inherit;">
<%= total_hours.round(1) %>h <span class="day-value" style="font-weight: bold;"><%= day.day %></span>
</span> </a>
<% end %> <span class="abbr-day" style="font-size: 0.85em; color: #777;">(<%= abbr_day_name(day.cwday) %>)</span>
</span> </span>
<!-- Center: New Appointment Action -->
<span class="day-num-center" style="display: inline-flex; align-items: center; justify-self: center;"> <span class="day-num-center" style="display: inline-flex; align-items: center; justify-self: center;">
<% if day >= User.current.today %> <%# Only show ADD button if it's in the future, NOT a weekend, and NOT a custom holiday %>
<% if day >= User.current.today && !is_standard_weekend && !is_custom_holiday %>
<%= link_to sprite_icon('add'), <%= link_to sprite_icon('add'),
new_customer_appointment_path(start_date: day), new_customer_appointment_path(start_date: day),
class: 'icon-only icon-add', class: 'icon-only icon-add',
@@ -150,12 +207,27 @@
<% end %> <% end %>
</span> </span>
<span class="day-num-right" style="display: inline-flex; align-items: center; justify-self: end; gap: 3px;"> <!-- Right: Total Hours -->
<span class="abbr-day" style="font-size: 0.85em; color: #777;">(<%= abbr_day_name(day.cwday) %>)</span> <span class="day-num-right" style="display: inline-flex; align-items: center; justify-self: end;">
<span class="day-value" style="font-weight: bold;"><%= day.day %></span> <% if total_hours > 0 %>
<span class="hours-total" style="font-weight: bold; color: #555;" title="<%= l(:label_estimated_hours, default: 'Estimated hours') %>">
<%= total_hours.round(1) %>h
</span>
<% end %>
</span> </span>
</p> </p>
<%# Render Holiday Name Badge if it's a holiday %>
<% if is_custom_holiday %>
<div class="holiday-badge" style="background-color: #f2dede; color: #a94442; padding: 3px 6px; border-radius: 3px; font-size: 0.8em; font-weight: bold; margin-bottom: 4px; border: 1px solid #ebccd1; display: flex; align-items: center; gap: 4px;">
<span class="fa-stack fa-lg">
<i class="fas fa-calendar fa-stack-1x"></i>
<i class="fas fa-slash fa-stack-2x" style="color:Tomato"></i>
</span>
<span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"><%= current_holiday.name %></span>
</div>
<% end %>
<% day_events.each do |event| %> <% day_events.each do |event| %>
<% if event.is_a?(Issue) %> <% if event.is_a?(Issue) %>
@@ -231,32 +303,3 @@
<% end %> <% end %>
<%= context_menu %> <%= context_menu %>
<script>
(function() {
const STORAGE_KEY = 'redmine_cal_only_appointments';
document.addEventListener('DOMContentLoaded', function() {
const urlParams = new URLSearchParams(window.location.search);
const savedState = localStorage.getItem(STORAGE_KEY);
// If URL does not specify the parameter, sync with saved preference in localStorage
if (!urlParams.has('only_appointments') && savedState === '1') {
urlParams.set('only_appointments', '1');
window.location.search = urlParams.toString();
}
});
window.toggleOnlyAppointments = function(checked) {
const urlParams = new URLSearchParams(window.location.search);
if (checked) {
urlParams.set('only_appointments', '1');
localStorage.setItem(STORAGE_KEY, '1');
} else {
urlParams.delete('only_appointments');
localStorage.setItem(STORAGE_KEY, '0');
}
window.location.search = urlParams.toString();
};
})();
</script>
@@ -1,24 +1,64 @@
<%
non_working_days = Setting.non_working_week_days || []
app_datetime = (appointment.respond_to?(:date) && appointment.date.present?) ? appointment.date : appointment.start_date
start_date = app_datetime.to_date
target_date = day.to_date
duration = [appointment.duration.to_i, 1].max
day_number = 0
if target_date >= start_date
date_cursor = start_date
working_count = 0
while date_cursor <= target_date
unless non_working_days.include?(date_cursor.cwday.to_s)
working_count += 1
end
if date_cursor == target_date
day_number = working_count
break
end
date_cursor += 1
end
end
%>
<%= tag.div class: ['appointment-block', 'tooltip', appointment.status.to_s.parameterize] do %> <%= tag.div class: ['appointment-block', 'tooltip', appointment.status.to_s.parameterize] do %>
<div class="appointment-bar"></div> <div class="appointment-bar"></div>
<div class="appointment-card"> <div class="appointment-card">
<%# Row 1: Avatar | Title %>
<div class="appointment-header"> <div class="appointment-header">
<% if appointment.user %> <% if appointment.user %>
<%= avatar(appointment.user, size: 14, class: "appointment-avatar") %> <%= avatar(appointment.user, size: 25, class: "appointment-avatar") %>
<% end %> <% end %>
<span class="appointment-title"> <span class="appointment-title">
<%= link_to(appointment.subject, customer_appointment_path(appointment), class: "appointment-link") %> <%= link_to(appointment.subject, customer_appointment_path(appointment), class: "appointment-link") %>
</span> </span>
</div>
<hr class="appointment-divider" />
<%# Row 2: Time | Day Count | Hours %>
<div class="appointment-meta">
<span class="appointment-time">
<%= appointment.date.strftime('%I:%M %p') if appointment.date.present? %>
</span>
<% if duration > 1 && day_number.positive? && day_number <= duration %>
<span class="appointment-days">(Day <%= day_number %> of <%= duration %>)</span>
<% end %>
<span class="appointment-hours"> <span class="appointment-hours">
<%= number_with_precision(appointment.estimated_hours.to_f, precision: 1) %>h <%= number_with_precision(appointment.estimated_hours.to_f, precision: 1) %>h
</span> </span>
</div> </div>
<%# Row 3: Details %>
<% if appointment.customer %> <% if appointment.customer %>
<hr class="appointment-divider" />
<div class="appointment-detail"> <div class="appointment-detail">
<%= appointment.customer.name %> <%= appointment.customer.name %>
<% if appointment.vehicle %> <% if appointment.vehicle %>
@@ -30,7 +70,7 @@
</div> </div>
<span class="tip"> <span class="tip">
<%= render partial: "customer_appointments/tooltip", locals: { appointment: appointment } %> <%= render partial: "customer_appointments/tooltip", locals: { appointment: appointment, day: day } %>
</span> </span>
<% end %> <% end %>
@@ -1,3 +1,5 @@
<%= javascript_include_tag("customer-modal", plugin: :redmine_qbo_calendar) %>
<%= labelled_form_for @appointment do |f| %> <%= labelled_form_for @appointment do |f| %>
<%= error_messages_for @appointment %> <%= error_messages_for @appointment %>
@@ -7,6 +9,8 @@
<p> <p>
<%= f.text_field :customer, label: :label_customer, class: "customer-name", autocomplete: "off", data: { autocomplete_url: "/customers/autocomplete" } %> <%= 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" %> <%= f.hidden_field :customer_id, id: "customer_id" %>
<!-- Add Quick Create Button -->
<a href="#" id="inline-create-customer-btn" class="icon-only icon-add" title="<%=l(:label_new_customer)%>"></a>
</p> </p>
<p> <p>
@@ -43,3 +47,8 @@
<%= submit_tag l(:button_save) %> <%= submit_tag l(:button_save) %>
<% end %> <% end %>
<!-- Modal Container for Inline Customer Creation -->
<div id="new-customer-dialog" style="display:none;" title="<%= t(:label_new_customer, default: 'New Customer') %>">
<!-- The form will be dynamically loaded via JS or rendered here -->
</div>
@@ -1,3 +1,4 @@
<h4><%=t(:label_appointments)%>:</h4>
<table class="list"> <table class="list">
<thead> <thead>
@@ -51,7 +51,7 @@
<tr> <tr>
<th><%= l(:label_estimate) %></th> <th><%= l(:label_estimate) %></th>
<td> <td>
<%= link_to appointment.estimate %> <%= link_to appointment.estimate, appointment.estimate, target: "_blank" %>
</td> </td>
</tr> </tr>
<% end %> <% end %>
@@ -1,3 +1,3 @@
<h2>Edit Appointment</h2> <h2><%=l(:label_edit_appointment)%></h2>
<%= render "form" %> <%= render "form" %>
+1 -1
View File
@@ -1,3 +1,3 @@
<h2>New Appointment</h2> <h2><%=l(:label_new_appointment)%></h2>
<%= render "form" %> <%= render "form" %>
@@ -3,8 +3,8 @@
<i class="fa-regular fa-calendar-days"></i> <%= l(:button_calendar) %> <i class="fa-regular fa-calendar-days"></i> <%= l(:button_calendar) %>
<% end %> <% end %>
<%= link_to customer_appointments_path do %> <%= 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-list"></i> <%= l(:button_appointments) %> <i class="fa-solid fa-plus"></i> <%= l(:label_new_issue) %>
<% end %> <% end %>
<%= link_to edit_customer_appointment_path(@appointment) do %> <%= link_to edit_customer_appointment_path(@appointment) do %>
@@ -68,8 +68,10 @@
<div class="value"><%= @appointment.customer&.primary_phone %></div> <div class="value"><%= @appointment.customer&.primary_phone %></div>
</div> </div>
<div class="attribute"> <div class="attribute">
<div class="label"><%= l(:label_estimate, default: 'Estimate') %>:</div> <div class="label"><%= l(:label_estimate) %>:</div>
<div class="value"><%= link_to_if @appointment.estimate, @appointment.estimate&.name, @appointment.estimate %></div> <% if @appointment.estimate %>
<div class="value"><%= link_to @appointment.estimate, @appointment.estimate, target: "_blank" %></div>
<% end %>
</div> </div>
</div> </div>
+97
View File
@@ -0,0 +1,97 @@
<%= error_messages_for 'holiday' %>
<div class="box tabular">
<p>
<label for="holiday_name"><%= l(:field_name, default: 'Name') %> <span class="required">*</span></label>
<%= f.text_field :name, required: true, size: 40 %>
</p>
<p>
<label for="holiday_is_recurring"><%= l(:field_is_recurring, default: 'Is this a recurring holiday?') %></label>
<%= f.check_box :is_recurring, id: 'holiday_is_recurring' %>
</p>
<p id="p_recurrence_type" style="display: none;">
<label for="holiday_recurrence_type"><%= l(:field_recurrence_type, default: 'Recurrence Type') %></label>
<%= f.select :recurrence_type,
Holiday::TYPES.map { |type_key|
label_text = case type_key
when 'fixed' then l(:label_recurrence_fixed, default: 'Fixed Date (e.g., Dec 25)')
when 'dynamic' then l(:label_recurrence_dynamic, default: 'Dynamic Date (e.g., 1st Monday of Sept)')
else type_key.humanize
end
[label_text, type_key]
},
{},
id: 'holiday_recurrence_type' %>
</p>
<!-- Fields for Exact Date (One-Time or Fixed Recurring) -->
<p id="p_exact_date">
<label for="holiday_exact_date"><%= l(:field_date, default: 'Date') %></label>
<%= f.date_field :exact_date, id: 'holiday_exact_date' %>
</p>
<!-- Fields for Dynamic Date -->
<div id="p_dynamic_date" style="display: none;">
<p>
<label><%= l(:field_dynamic_rule, default: 'Rule') %></label>
<%= f.select :week_of_month, [
[l(:label_week_1st, default: '1st'), 1],
[l(:label_week_2nd, default: '2nd'), 2],
[l(:label_week_3rd, default: '3rd'), 3],
[l(:label_week_4th, default: '4th'), 4],
[l(:label_week_last, default: 'Last'), 5]
], {}, style: 'width: 80px;' %>
<%= f.select :day_of_week,
[
[l(:day_name_sunday, default: 'Sunday'), 0],
[l(:day_name_monday, default: 'Monday'), 1],
[l(:day_name_tuesday, default: 'Tuesday'), 2],
[l(:day_name_wednesday, default: 'Wednesday'), 3],
[l(:day_name_thursday, default: 'Thursday'), 4],
[l(:day_name_friday, default: 'Friday'), 5],
[l(:day_name_saturday, default: 'Saturday'), 6]
],
{}, style: 'width: 120px;' %>
<span style="margin: 0 10px;"><%= l(:label_of, default: 'of') %></span>
<%= f.select :month,
Date::MONTHNAMES.compact.each_with_index.map { |m, i| [m, i+1] },
{}, style: 'width: 120px;' %>
</p>
</div>
</div>
<script type="text/javascript">
function toggleHolidayFields() {
var isRecurring = $('#holiday_is_recurring').is(':checked');
var recurrenceType = $('#holiday_recurrence_type').val();
if (isRecurring) {
$('#p_recurrence_type').show();
if (recurrenceType === 'dynamic') {
$('#p_exact_date').hide();
$('#p_dynamic_date').show();
} else {
$('#p_exact_date').show();
$('#p_dynamic_date').hide();
}
} else {
$('#p_recurrence_type').hide();
$('#p_exact_date').show();
$('#p_dynamic_date').hide();
}
}
$(document).ready(function() {
toggleHolidayFields();
$('#holiday_is_recurring, #holiday_recurrence_type').on('change', function() {
toggleHolidayFields();
});
});
</script>
+7
View File
@@ -0,0 +1,7 @@
<h2><%= l(:label_holiday_edit, default: 'Edit Holiday') %></h2>
<%= form_with model: @holiday, url: holiday_path(@holiday), method: :patch, local: true do |f| %>
<%= render partial: 'form', locals: { f: f } %>
<%= submit_tag l(:button_save) %>
<%= link_to l(:button_cancel), holidays_path, class: 'cancel' %>
<% end %>
+55
View File
@@ -0,0 +1,55 @@
<div class="contextual">
<%= link_to 'New Holiday', new_holiday_path, class: 'icon icon-add' %>
</div>
<h2><%= l(:label_holiday_plural, default: 'Holidays') %></h2>
<% if @holidays.any? %>
<div class="autoscroll">
<table class="list holidays">
<thead>
<tr>
<th><%= l(:field_name, default: 'Name') %></th>
<th><%= l(:field_type, default: 'Type') %></th>
<th><%= l(:field_date, default: 'Date / Rule') %></th>
<th></th>
</tr>
</thead>
<tbody>
<% @holidays.each do |holiday| %>
<tr class="<%= cycle('odd', 'even') %>">
<td class="name"><%= holiday.name %></td>
<td class="type">
<% if !holiday.is_recurring %>
<span class="badge">One-Time</span>
<% else %>
<span class="badge" style="color: #169;">Recurring (<%= holiday.recurrence_type.capitalize %>)</span>
<% end %>
</td>
<td class="date-rule">
<% if !holiday.is_recurring || holiday.recurrence_type == 'fixed' %>
<%= holiday.exact_date&.strftime('%B %d, %Y') %>
<% elsif holiday.recurrence_type == 'dynamic' %>
<%= ['1st', '2nd', '3rd', '4th', 'Last'][holiday.week_of_month - 1] %>
<%= Date::DAYNAMES[holiday.day_of_week] %> of
<%= Date::MONTHNAMES[holiday.month] %>
<% end %>
</td>
<td class="buttons">
<%= link_to l(:button_edit), edit_holiday_path(holiday), class: 'icon icon-edit' %>
<%= link_to l(:button_delete), holiday_path(holiday),
method: :delete,
data: { confirm: l(:text_are_you_sure) },
class: 'icon icon-del' %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
+7
View File
@@ -0,0 +1,7 @@
<h2><%= l(:label_holiday_new, default: 'New Holiday') %></h2>
<%= form_with model: @holiday, url: holidays_path, local: true do |f| %>
<%= render partial: 'form', locals: { f: f } %>
<%= submit_tag l(:button_create) %>
<%= link_to l(:button_cancel), holidays_path, class: 'cancel' %>
<% end %>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

+63
View File
@@ -20,3 +20,66 @@ document.addEventListener('DOMContentLoaded', function() {
} }
}); });
}); });
(function() {
const STORAGE_KEY_ONLY_APPTS = 'redmine_cal_only_appointments';
const STORAGE_KEY_HIDE_PAST = 'redmine_cal_hide_past_weeks';
window.scrollToToday = function() {
const todayElement = document.getElementById('today');
if (todayElement) {
todayElement.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
};
document.addEventListener('DOMContentLoaded', function() {
const urlParams = new URLSearchParams(window.location.search);
let needsRedirect = false;
// Sync "Show Customer Appointments Only" with localStorage if missing from URL
if (!urlParams.has('only_appointments') && localStorage.getItem(STORAGE_KEY_ONLY_APPTS) === '1') {
urlParams.set('only_appointments', '1');
needsRedirect = true;
}
// Sync "Hide Past Weeks" with localStorage if missing from URL
if (!urlParams.has('hide_past_weeks') && localStorage.getItem(STORAGE_KEY_HIDE_PAST) === '1') {
urlParams.set('hide_past_weeks', '1');
needsRedirect = true;
}
if (needsRedirect) {
window.location.search = urlParams.toString();
return;
}
// Automatically scroll to today if present and no hash anchor is in the URL
if (!window.location.hash) {
window.scrollToToday();
}
});
window.toggleOnlyAppointments = function(checked) {
const urlParams = new URLSearchParams(window.location.search);
if (checked) {
urlParams.set('only_appointments', '1');
localStorage.setItem(STORAGE_KEY_ONLY_APPTS, '1');
} else {
urlParams.delete('only_appointments');
localStorage.setItem(STORAGE_KEY_ONLY_APPTS, '0');
}
window.location.search = urlParams.toString();
};
window.toggleHidePastWeeks = function(checked) {
const urlParams = new URLSearchParams(window.location.search);
if (checked) {
urlParams.set('hide_past_weeks', '1');
localStorage.setItem(STORAGE_KEY_HIDE_PAST, '1');
} else {
urlParams.delete('hide_past_weeks');
localStorage.setItem(STORAGE_KEY_HIDE_PAST, '0');
}
window.location.search = urlParams.toString();
};
})();
+106
View File
@@ -0,0 +1,106 @@
$(document).ready(function() {
var $dialog = $('#new-customer-dialog');
var customerFormXHR = null;
// 1. Initialize jQuery UI Dialog (built into Redmine)
$dialog.dialog({
autoOpen: false,
modal: true,
width: 500,
title: "New Customer",
buttons: {
"Save": function() {
submitInlineCustomer();
},
"Cancel": function() {
$(this).dialog("close");
}
},
close: function() {
// Abort in-flight request if closing before load finishes
if (customerFormXHR) {
customerFormXHR.abort();
}
// Force hide Redmine's global loading overlay
$('#ajax-indicator').hide();
// Reset modal contents
$dialog.empty();
}
});
// 2. Open Modal & Fetch Form
$('#inline-create-customer-btn').on('click', function(e) {
e.preventDefault();
// Explicitly grab value by the appointment field's specific ID
var typedName = $('#customer_appointment_customer').val();
$dialog.dialog('open');
// Fetch form bypassing Redmine's global ajax-indicator
customerFormXHR = $.ajax({
url: '/customers/new',
type: 'GET',
global: false,
success: function(data) {
$dialog.html(data);
// Hide standalone submit button and wiki toolbar inside modal
$dialog.find('.actions, .jstBlock').hide();
// Copy typed name into the modal's specific customer_name field
if (typedName && typedName.trim() !== '') {
$dialog.find('#customer_name').val(typedName.trim());
}
// Handle ENTER key submission inside modal form
$dialog.find('form').off('submit').on('submit', function(ev) {
ev.preventDefault();
submitInlineCustomer();
});
},
error: function(xhr, status) {
if (status !== 'abort') {
$dialog.html('<p style="color: red; padding: 10px;">Failed to load customer form.</p>');
}
}
});
});
// 3. Submit Customer Form via AJAX
function submitInlineCustomer() {
var $form = $dialog.find('form');
if ($form.length === 0) return;
$.ajax({
url: $form.attr('action'),
type: 'POST',
data: $form.serialize(),
dataType: 'json',
global: false,
success: function(response) {
// Populate main appointment form fields with newly created customer details
$('#customer_id').val(response.id);
$('#customer_appointment_customer').val(response.name);
// Reset dependent select dropdowns for new customer
$('#appointment_vehicle_id').empty().append('<option value=""></option>');
$('#appointment_estimate_id').empty().append('<option value=""></option>');
// Close and clean up modal
$dialog.dialog('close');
},
error: function(xhr) {
var errors = (xhr.responseJSON && xhr.responseJSON.errors)
? xhr.responseJSON.errors
: ['Failed to create customer'];
alert("Errors:\n" + errors.join("\n"));
}
});
}
// 4. Dismiss Redmine's global loader when selecting from autocomplete
$(document).on('autocompleteselect', '.customer-name', function(event, ui) {
$('#ajax-indicator').hide();
});
});
+306 -98
View File
@@ -12,7 +12,7 @@ table.cal td {
overflow: hidden; overflow: hidden;
} }
/* Container Box */ /* Container Box Base */
.appointment-block { .appointment-block {
position: relative; position: relative;
display: flex; display: flex;
@@ -20,8 +20,8 @@ table.cal td {
box-sizing: border-box; box-sizing: border-box;
margin: 2px 0; margin: 2px 0;
padding: 3px 4px 3px 0; padding: 3px 4px 3px 0;
background: #edf4ff; background: #e8f8ff;
border: 1px solid #c5d8f3; border: 1px solid #91e2ff;
border-radius: 3px; border-radius: 3px;
font-size: 0.9em; font-size: 0.9em;
line-height: 1.3; line-height: 1.3;
@@ -36,16 +36,16 @@ table.cal td {
/* Hover Cue */ /* Hover Cue */
.appointment-block:hover { .appointment-block:hover {
transform: translateY(-1px); transform: translateY(-1px);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12); box-shadow: 0 3px 6px rgba(0, 0, 0, 0.18);
} }
/* Left Indicator Bar */ /* Left Indicator Bar Base */
.appointment-block .appointment-bar { .appointment-block .appointment-bar {
width: 4px; width: 5px;
background-color: #3c78d8; background-color: #1fc0ff;
flex-shrink: 0; flex-shrink: 0;
margin-right: 4px; margin-right: 5px;
border-radius: 1px; border-radius: 2px 0 0 2px;
} }
/* Card Content Area */ /* Card Content Area */
@@ -57,9 +57,10 @@ table.cal td {
overflow: hidden; overflow: hidden;
} }
/* Row 1: Header (Avatar + Title) */
.appointment-header { .appointment-header {
display: flex; display: flex;
align-items: flex-start; align-items: center;
gap: 4px; gap: 4px;
font-weight: bold; font-weight: bold;
min-width: 0; min-width: 0;
@@ -73,37 +74,54 @@ table.cal td {
object-fit: cover; object-fit: cover;
} }
/* Multi-line wrapping for titles */
.appointment-card .appointment-title { .appointment-card .appointment-title {
flex-grow: 1; flex-grow: 1;
white-space: normal; white-space: normal;
overflow-wrap: anywhere; overflow-wrap: anywhere;
word-break: break-word; word-break: break-word;
min-width: 0; min-width: 0;
vertical-align: top; vertical-align: middle;
} }
.appointment-link { .appointment-link {
color: #111; color: #000000;
text-decoration: none; text-decoration: none;
} }
.appointment-hours { /* Row 2: Meta Bar (Time + Hours) */
flex-shrink: 0; .appointment-meta {
color: #444; display: flex;
font-size: 0.85em; justify-content: space-between;
align-items: center;
font-weight: bold; font-weight: bold;
margin-left: auto; font-size: 0.85em;
color: #222222;
} }
/* Multi-line wrapping for details */ .appointment-time,
.appointment-hours{
flex-shrink: 0;
}
.appointment-days {
place-items: center;
}
/* Horizontal Dividers */
.appointment-card .appointment-divider {
border: 0;
border-top: 1px solid #91e2ff;
margin: 3px 0;
width: 100%;
}
/* Row 3: Details */
.appointment-detail { .appointment-detail {
color: #555; color: #000000;
font-size: 0.9em; font-size: 1em;
white-space: normal; white-space: normal;
overflow-wrap: anywhere; overflow-wrap: anywhere;
word-break: break-word; word-break: break-word;
margin-top: 2px;
min-width: 0; min-width: 0;
} }
@@ -112,14 +130,17 @@ table.cal td {
z-index: 1000 !important; z-index: 1000 !important;
} }
/* Redmine Tooltip Popover (Hidden by Default & on Hover) */ /* Redmine Tooltip Popover Base - Fixed Positioning Overriding JS Inline Coordinates */
.appointment-block .tip, .appointment-block .tip {
.appointment-block:hover .tip {
display: none !important; display: none !important;
position: absolute; position: absolute !important;
top: 100%; top: 100% !important;
left: 0; left: 0 !important;
width: 320px; right: auto !important;
bottom: auto !important;
transform: none !important;
margin: 4px 0 0 0 !important;
width: 320px !important;
padding: 10px; padding: 10px;
background: #ffffff; background: #ffffff;
border: 1px solid #ccc; border: 1px solid #ccc;
@@ -132,13 +153,12 @@ table.cal td {
/* Align tooltips to the right on Friday/Saturday columns */ /* Align tooltips to the right on Friday/Saturday columns */
table.cal td:nth-child(n+6) .appointment-block .tip { table.cal td:nth-child(n+6) .appointment-block .tip {
left: auto; left: auto !important;
right: 0; right: 0 !important;
} }
/* Display Tooltip ONLY on Click (.open class) */ /* Display Tooltip ONLY on Click (.open class) */
.appointment-block.open .tip, .appointment-block.open .tip {
.appointment-block.open:hover .tip {
display: block !important; display: block !important;
} }
@@ -152,7 +172,7 @@ table.cal td:nth-child(n+6) .appointment-block .tip {
.appointment-block .tip .subtitle { .appointment-block .tip .subtitle {
margin: 0 0 8px 0; margin: 0 0 8px 0;
font-size: 11px; font-size: 11px;
color: #666; color: #555;
text-transform: capitalize; text-transform: capitalize;
} }
@@ -166,7 +186,7 @@ table.cal td:nth-child(n+6) .appointment-block .tip {
.appointment-block .tip table.attributes th { .appointment-block .tip table.attributes th {
text-align: left; text-align: left;
padding: 3px 6px 3px 0; padding: 3px 6px 3px 0;
color: #555; color: #444;
font-weight: bold; font-weight: bold;
width: 35%; width: 35%;
vertical-align: top; vertical-align: top;
@@ -174,7 +194,7 @@ table.cal td:nth-child(n+6) .appointment-block .tip {
.appointment-block .tip table.attributes td { .appointment-block .tip table.attributes td {
padding: 3px 0; padding: 3px 0;
color: #222; color: #111;
vertical-align: top; vertical-align: top;
} }
@@ -185,7 +205,7 @@ table.cal td:nth-child(n+6) .appointment-block .tip {
.appointment-block .tip hr { .appointment-block .tip hr {
border: 0; border: 0;
border-top: 1px solid #e0e0e0; border-top: 1px solid rgba(0, 0, 0, 0.12);
margin: 8px 0; margin: 8px 0;
} }
@@ -193,7 +213,7 @@ table.cal td:nth-child(n+6) .appointment-block .tip {
max-height: 120px; max-height: 120px;
overflow-y: auto; overflow-y: auto;
font-size: 11px; font-size: 11px;
color: #444; color: #333;
line-height: 1.4; line-height: 1.4;
} }
@@ -218,7 +238,7 @@ table.cal td:nth-child(n+6) .appointment-block .tip {
} }
.calendar-badge .month { .calendar-badge .month {
background-color: #c22b2b; background-color: #d92626;
color: #ffffff; color: #ffffff;
font-size: 9px; font-size: 9px;
font-weight: bold; font-weight: bold;
@@ -228,7 +248,7 @@ table.cal td:nth-child(n+6) .appointment-block .tip {
} }
.calendar-badge .day { .calendar-badge .day {
color: #333333; color: #222222;
font-size: 16px; font-size: 16px;
font-weight: bold; font-weight: bold;
padding: 4px 0 3px 0; padding: 4px 0 3px 0;
@@ -240,47 +260,124 @@ h2 .appointment-title {
.appointment-dates { .appointment-dates {
font-size: 70%; font-size: 70%;
color: #666; color: #555;
margin-left: 8px; margin-left: 8px;
font-weight: normal; font-weight: normal;
vertical-align: middle; vertical-align: middle;
} }
/* Calendar Card Status Colors & Indicator Bars */ /* ==========================================================================
Custom High-Vibrancy Hex Status Themes & Tinted Tooltips
========================================================================== */
/* Scheduled - Blue */ /* Scheduled - #1FC0FF */
.appointment-block.scheduled .appointment-bar { background-color: #1f77d0; } .appointment-block.scheduled,
.appointment-block.scheduled { background: #edf4ff; border-color: #c5d8f3; } .appointment-block.scheduled:hover,
.appointment-block.scheduled.open { background: #e8f8ff !important; border-color: #91e2ff !important; }
.appointment-block.scheduled .appointment-bar { background-color: #1fc0ff !important; }
.appointment-block.scheduled .appointment-divider { border-top-color: #b3ebff !important; }
.appointment-block.scheduled .tip,
.appointment-block.scheduled:hover .tip,
.appointment-block.scheduled.open .tip { background: #f2faff !important; border-color: #70d6ff !important; }
/* CheckedIn - Purple */ /* Ready - #1FFF1F */
.appointment-block.checked-in .appointment-bar, .appointment-block.ready,
.appointment-block.checkedin .appointment-bar, .appointment-block.ready:hover,
.appointment-block.checked_in .appointment-bar { background-color: #8e44ad; } .appointment-block.ready.open { background: #e8ffe8 !important; border-color: #8bff8b !important; }
.appointment-block.ready .appointment-bar { background-color: #1fff1f !important; }
.appointment-block.ready .appointment-divider { border-top-color: #b5ffb5 !important; }
.appointment-block.ready .tip,
.appointment-block.ready:hover .tip,
.appointment-block.ready.open .tip { background: #f2fff2 !important; border-color: #66ff66 !important; }
/* CheckedIn - #CE1FFF */
.appointment-block.checked-in, .appointment-block.checked-in,
.appointment-block.checkedin, .appointment-block.checkedin,
.appointment-block.checked_in { background: #f6f0fa; border-color: #e2d0fb; } .appointment-block.checked_in,
.appointment-block.checked-in:hover,
.appointment-block.checkedin:hover,
.appointment-block.checked_in:hover,
.appointment-block.checked-in.open,
.appointment-block.checkedin.open,
.appointment-block.checked_in.open { background: #f8e8ff !important; border-color: #e891ff !important; }
/* InProgress - Orange */ .appointment-block.checked-in .appointment-bar,
.appointment-block.in-progress .appointment-bar, .appointment-block.checkedin .appointment-bar,
.appointment-block.inprogress .appointment-bar, .appointment-block.checked_in .appointment-bar { background-color: #ce1fff !important; }
.appointment-block.in_progress .appointment-bar { background-color: #e68a00; }
.appointment-block.checked-in .appointment-divider,
.appointment-block.checkedin .appointment-divider,
.appointment-block.checked_in .appointment-divider { border-top-color: #f0b3ff !important; }
.appointment-block.checked-in .tip,
.appointment-block.checkedin .tip,
.appointment-block.checked_in .tip,
.appointment-block.checked-in:hover .tip,
.appointment-block.checkedin:hover .tip,
.appointment-block.checked_in:hover .tip,
.appointment-block.checked-in.open .tip,
.appointment-block.checkedin.open .tip,
.appointment-block.checked_in.open .tip { background: #fcf2ff !important; border-color: #df70ff !important; }
/* InProgress - #FF5E1F */
.appointment-block.in-progress, .appointment-block.in-progress,
.appointment-block.inprogress, .appointment-block.inprogress,
.appointment-block.in_progress { background: #fff4df; border-color: #fce2b6; } .appointment-block.in_progress,
.appointment-block.in-progress:hover,
.appointment-block.inprogress:hover,
.appointment-block.in_progress:hover,
.appointment-block.in-progress.open,
.appointment-block.inprogress.open,
.appointment-block.in_progress.open { background: #fff0e8 !important; border-color: #ffb391 !important; }
/* Ready - Teal */ .appointment-block.in-progress .appointment-bar,
.appointment-block.ready .appointment-bar { background-color: #16a085; } .appointment-block.inprogress .appointment-bar,
.appointment-block.ready { background: #e8f8f5; border-color: #a3e4d7; } .appointment-block.in_progress .appointment-bar { background-color: #ff5e1f !important; }
/* Completed - Green */ .appointment-block.in-progress .appointment-divider,
.appointment-block.completed .appointment-bar { background-color: #2d8a34; } .appointment-block.inprogress .appointment-divider,
.appointment-block.completed { background: #edf9ee; border-color: #c7eecb; } .appointment-block.in_progress .appointment-divider { border-top-color: #ffccb3 !important; }
/* Cancelled - Red & Strikethrough Subject */ .appointment-block.in-progress .tip,
.appointment-block.cancelled .appointment-bar, .appointment-block.inprogress .tip,
.appointment-block.canceled .appointment-bar { background-color: #d9534f; } .appointment-block.in_progress .tip,
.appointment-block.in-progress:hover .tip,
.appointment-block.inprogress:hover .tip,
.appointment-block.in_progress:hover .tip,
.appointment-block.in-progress.open .tip,
.appointment-block.inprogress.open .tip,
.appointment-block.in_progress.open .tip { background: #fff6f2 !important; border-color: #ff9970 !important; }
/* Completed - #008000 */
.appointment-block.completed,
.appointment-block.completed:hover,
.appointment-block.completed.open { background: #e6f5e6 !important; border-color: #80c080 !important; }
.appointment-block.completed .appointment-bar { background-color: #008000 !important; }
.appointment-block.completed .appointment-divider { border-top-color: #a3d9a3 !important; }
.appointment-block.completed .tip,
.appointment-block.completed:hover .tip,
.appointment-block.completed.open .tip { background: #f0fcf0 !important; border-color: #66b366 !important; }
/* Cancelled - #FF1F1F & Strikethrough */
.appointment-block.cancelled, .appointment-block.cancelled,
.appointment-block.canceled { background: #fdf2f2; border-color: #f8c8c8; } .appointment-block.canceled,
.appointment-block.cancelled:hover,
.appointment-block.canceled:hover,
.appointment-block.cancelled.open,
.appointment-block.canceled.open { background: #ffe8e8 !important; border-color: #ff9191 !important; }
.appointment-block.cancelled .appointment-bar,
.appointment-block.canceled .appointment-bar { background-color: #ff1f1f !important; }
.appointment-block.cancelled .appointment-divider,
.appointment-block.canceled .appointment-divider { border-top-color: #ffb3b3 !important; }
.appointment-block.cancelled .tip,
.appointment-block.canceled .tip,
.appointment-block.cancelled:hover .tip,
.appointment-block.canceled:hover .tip,
.appointment-block.cancelled.open .tip,
.appointment-block.canceled.open .tip { background: #fff2f2 !important; border-color: #ff7070 !important; }
.appointment-block.cancelled .appointment-title, .appointment-block.cancelled .appointment-title,
.appointment-block.cancelled .appointment-link, .appointment-block.cancelled .appointment-link,
@@ -289,6 +386,16 @@ h2 .appointment-title {
text-decoration: line-through; text-decoration: line-through;
} }
/* Call Out - #FFFF00 */
.appointment-block.call_out,
.appointment-block.call_out:hover,
.appointment-block.call_out.open { background: hsl(60, 100%, 95%) !important; border-color: hsl(60, 100%, 50%) !important; }
.appointment-block.call_out .appointment-bar { background-color: hsl(60, 100%, 45%) !important; }
.appointment-block.call_out .appointment-divider { border-top-color: hsl(60, 100%, 80%) !important; }
.appointment-block.call_out .tip,
.appointment-block.call_out:hover .tip,
.appointment-block.call_out.open .tip { background: hsl(60, 100%, 97%) !important; border-color: hsl(60, 100%, 60%) !important; }
/* Table List Alignment */ /* Table List Alignment */
table.appointments td, table.appointments td,
table.appointments th { table.appointments th {
@@ -311,22 +418,22 @@ table.appointments td.status {
.quick-action-label { .quick-action-label {
font-weight: bold; font-weight: bold;
color: #555; color: #333;
font-size: 0.85em; font-size: 0.85em;
margin-right: 4px; margin-right: 4px;
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 0.5px; letter-spacing: 0.5px;
} }
/* Shared Badge & Quick-Status Button Base Styling */ /* Shared Badge Base */
.status-badge, .status-badge,
.quick-status-btn { .quick-status-btn {
display: inline-flex !important; display: inline-flex !important;
align-items: center !important; align-items: center !important;
justify-content: center !important; justify-content: center !important;
padding: 3px 10px; padding: 4px 11px;
font-size: 11px; font-size: 11px;
font-weight: 600; font-weight: 700;
line-height: 1.2 !important; line-height: 1.2 !important;
border-radius: 12px; border-radius: 12px;
border: 1px solid transparent; border: 1px solid transparent;
@@ -337,55 +444,156 @@ table.appointments td.status {
} }
.quick-status-btn:hover { .quick-status-btn:hover {
opacity: 0.85; opacity: 0.88;
transform: translateY(-1px); transform: translateY(-1px);
} }
/* Status Colors (Supports hyphen, underscore, and concatenated naming) */ /* ==========================================================================
Badges & Quick Action Buttons
========================================================================== */
/* Scheduled - Blue */ /* Scheduled - #1FC0FF */
.status-scheduled { .status-scheduled {
background-color: #edf4ff !important; background-color: #e8f8ff !important;
border-color: #c5d8f3 !important; border-color: #91e2ff !important;
color: #1f77d0 !important; color: #0077a3 !important;
} }
/* CheckedIn - Purple */ /* Ready - #1FFF1F */
.status-ready {
background-color: #e8ffe8 !important;
border-color: #8bff8b !important;
color: #008f00 !important;
}
/* CheckedIn - #CE1FFF */
.status-checked-in, .status-checked-in,
.status-checkedin, .status-checkedin,
.status-checked_in { .status-checked_in {
background-color: #f6f0fa !important; background-color: #f8e8ff !important;
border-color: #e2d0fb !important; border-color: #e891ff !important;
color: #8e44ad !important; color: #8300ad !important;
} }
/* InProgress - Orange */ /* InProgress - #FF5E1F */
.status-in-progress, .status-in-progress,
.status-inprogress, .status-inprogress,
.status-in_progress { .status-in_progress {
background-color: #fff4df !important; background-color: #fff0e8 !important;
border-color: #fce2b6 !important; border-color: #ff9191 !important;
color: #e68a00 !important; color: #b33000 !important;
} }
/* Ready - Teal */ /* Completed - #008000 */
.status-ready {
background-color: #e8f8f5 !important;
border-color: #a3e4d7 !important;
color: #16a085 !important;
}
/* Completed - Green */
.status-completed { .status-completed {
background-color: #edf9ee !important; background-color: #e6f5e6 !important;
border-color: #c7eecb !important; border-color: #80c080 !important;
color: #2d8a34 !important; color: #005200 !important;
} }
/* Cancelled - Red */ /* Cancelled - #FF1F1F */
.status-cancelled, .status-cancelled,
.status-canceled { .status-canceled {
background-color: #fdf2f2 !important; background-color: #ffe8e8 !important;
border-color: #f8c8c8 !important; border-color: #ff9191 !important;
color: #d9534f !important; color: #b30000 !important;
}
/* Completed - #FFFF00 */
.status-call_out {
background-color: hwb(60 0% 0%) !important;
border-color: lab(0% 0 0) !important;
color: hwb(60 0% 100%) !important;
}
/* Redefine grid column proportions for the calendar layout */
ul.cal {
display: grid;
grid-template-columns: max-content 0.5fr repeat(5, 1fr) 0.5fr !important;
}
/* Compress content and dim non-working weekend cells */
ul.cal li.nwday,
ul.cal li.sunday,
ul.cal li.saturday {
background-color: #f7f7f7;
padding: 2px !important;
}
/* Hide non-essential metadata on narrow weekend cells */
ul.cal li.nwday .icon-user,
ul.cal li.nwday .buttons {
display: none;
}
/* Highlight Today's Calendar Box & Number */
ul.cal li.today,
ul.cal li#today,
table.cal td.today {
outline: 2px solid #ff00bf !important;
outline-offset: -2px !important;
}
/* Responsive Mobile View */
@media screen and (max-width: 768px) {
table.cal thead {
display: none !important;
}
table.cal,
table.cal tbody,
table.cal tr,
table.cal td {
display: block !important;
width: 100% !important;
max-width: 100% !important;
box-sizing: border-box !important;
}
table.cal td {
width: 100% !important;
min-height: 48px;
margin-bottom: 8px;
border: 1px solid #d7d7d7 !important;
border-radius: 4px;
padding: 6px !important;
background: #ffffff;
}
ul.cal {
display: flex !important;
flex-direction: column !important;
grid-template-columns: 1fr !important;
padding: 0 !important;
margin: 0 !important;
}
ul.cal li {
width: 100% !important;
margin-bottom: 8px;
box-sizing: border-box;
}
.appointment-block {
width: 100% !important;
max-width: 100% !important;
}
.appointment-block .tip,
.appointment-block.open .tip {
position: fixed !important;
top: 50% !important;
left: 50% !important;
transform: translate(-50%, -50%) !important;
width: 90vw !important;
max-width: 340px !important;
max-height: 80vh !important;
overflow-y: auto !important;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4) !important;
}
table.cal td:nth-child(n+6) .appointment-block .tip {
left: 50% !important;
right: auto !important;
}
} }
+32 -2
View File
@@ -14,27 +14,57 @@ en:
are_you_sure: "Are you sure?" are_you_sure: "Are you sure?"
button_appointments: Appointments button_appointments: Appointments
button_calendar: Calendar button_calendar: Calendar
day_name_friday: "Friday"
day_name_monday: "Monday"
day_name_saturday: "Saturday"
day_name_sunday: "Sunday"
day_name_thursday: "Thursday"
day_name_tuesday: "Tuesday"
day_name_wednesday: "Wednesday"
error_holiday: "Cannot be scheduled on holiday: %{name}"
error_non_working_day: "Cannot be scheduled on a non-working day"
field_customer_name: Customer field_customer_name: Customer
field_date: Date
field_dynamic_rule: Rule
field_is_recurring: "Is this a recurring holiday?"
field_license_plate: License Plate field_license_plate: License Plate
field_phone: Phone field_phone: Phone
field_recurrence_type: Recurrence Type
field_type: Type
field_vehicle: Vehicle field_vehicle: Vehicle
label_add_appointment: Add Appointment label_add_appointment: Add Appointment
label_appointment: Appointment label_appointment: Appointment
label_appointments: Appointments
label_customer_appointment: Customer Appointment label_customer_appointment: Customer Appointment
label_customer_calendar: Customer Calendar label_customer_calendar: Customer Calendar
label_days: Days label_days: Days
label_duration: Duration label_duration: Duration
label_edit_appointment: Edit Appointment
label_end_date: End Date label_end_date: End Date
label_estimated_hours: Estimated Time label_estimated_hours: Estimated Time
label_event: Event label_event: Event
label_open_appointment: Open Appointment label_holiday_edit: Edit Holiday
label_holiday_new: New Holiday
label_holiday_plural: Holidays
label_new_appointment: New Appointment
label_of: "of"
label_only_customer_appointments: Show Customer Appointments Only label_only_customer_appointments: Show Customer Appointments Only
label_open_appointment: Open Appointment
label_recurrence_dynamic: "Dynamic Date (e.g., 1st Monday of Sept)"
label_recurrence_fixed: "Fixed Date (e.g., Dec 25)"
label_start_date: Start Date label_start_date: Start Date
label_status: Status label_status: Status
label_technician: Technician label_technician: Technician
label_time: Time label_time: Time
label_title: Title label_title: Title
label_today: Today
label_upcoming_appointments: "My Upcoming Appointments" label_upcoming_appointments: "My Upcoming Appointments"
label_week_1st: "1st"
label_week_2nd: "2nd"
label_week_3rd: "3rd"
label_week_4th: "4th"
label_week_last: "Last"
notice_unable_delete_holiday: "Unable to delete holiday"
permission_manage_customer_appointments: Manage Customer Appointments permission_manage_customer_appointments: Manage Customer Appointments
permission_view_customer_appointments: View Customer Appointments permission_view_customer_appointments: View Customer Appointments
title_customer_appointments: Customer Appoitnments title_customer_appointments: Customer Appointments
+1
View File
@@ -10,6 +10,7 @@
RedmineApp::Application.routes.draw do RedmineApp::Application.routes.draw do
resources :holidays, except: [:show] # Exclude :show since we don't need a separate page for individual holidays
resources :customer_appointments do resources :customer_appointments do
collection do collection do
get :customer_options get :customer_options
+33
View File
@@ -0,0 +1,33 @@
#The MIT License (MIT)
#
#Copyright (c) 2026 rick barrette
#
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
class CreateHolidays < ActiveRecord::Migration[7.0]
def change
create_table :holidays do |t|
t.string :name, null: false
# Use date instead of datetime since holidays are full days
t.date :exact_date
# For recurring logic
t.boolean :is_recurring, default: false
# "fixed" (same date every year) or "dynamic" (e.g., 1st Monday)
t.string :recurrence_type
# Fields for dynamic recurring holidays (Labor Day)
t.integer :month # e.g., 9 (September)
t.integer :day_of_week # e.g., 1 (Monday)
t.integer :week_of_month # e.g., 1 (First week)
t.timestamps
end
end
end
+5 -2
View File
@@ -14,15 +14,18 @@ Redmine::Plugin.register :redmine_qbo_calendar do
name 'Redmine QBO Calendar plugin' name 'Redmine QBO Calendar plugin'
author 'Rick Barrette' author 'Rick Barrette'
description 'A plugin for Redmine to extend the capabilitys of the Redmine QuickBooks Online plugin to create customer appointments for the Redmine Calendar' description 'A plugin for Redmine to extend the capabilitys of the Redmine QuickBooks Online plugin to create customer appointments for the Redmine Calendar'
version '2026.8.0' version '2026.9.0'
url 'https://github.com/rickbarrette/redmine_qbo_calendar' url 'https://github.com/rickbarrette/redmine_qbo_calendar'
author_url 'https://barrettefabrication.com' author_url 'https://barrettefabrication.com'
requires_redmine version_or_higher: '7.0.0' requires_redmine version_or_higher: '7.0.0'
settings partial: 'calendar/settings' settings partial: 'calendar/settings'
# Add Holidays index to the Redmine Administration Menu
menu :admin_menu, :holidays, { controller: 'holidays', action: 'index' }, caption: :label_holiday_plural, html: { class: 'icon icon-list' }
# Ensure redmine_qbo is installed # Ensure redmine_qbo is installed
begin begin
requires_redmine_plugin :redmine_qbo, version_or_higher: '2026.8.0' requires_redmine_plugin :redmine_qbo, version_or_higher: '2026.8.2'
rescue Redmine::PluginNotFound rescue Redmine::PluginNotFound
raise 'Please install the redmine_qbo plugin (https://github.com/rickbarrette/redmine_qbo)' raise 'Please install the redmine_qbo plugin (https://github.com/rickbarrette/redmine_qbo)'
end end
+1
View File
@@ -14,6 +14,7 @@ module RedmineQboCalendar
Customer.prepend(RedmineQboCalendar::Patches::CustomerPatch) Customer.prepend(RedmineQboCalendar::Patches::CustomerPatch)
User.prepend(RedmineQboCalendar::Patches::UserPatch) User.prepend(RedmineQboCalendar::Patches::UserPatch)
CalendarsController.prepend(RedmineQboCalendar::Patches::CalendarsControllerPatch) CalendarsController.prepend(RedmineQboCalendar::Patches::CalendarsControllerPatch)
ApplicationHelper.prepend(RedmineQboCalendar::Patches::ApplicationHelperPatch)
# Hooks # Hooks
RedmineQboCalendar::Hooks::ViewHookListener RedmineQboCalendar::Hooks::ViewHookListener
@@ -17,7 +17,6 @@ module RedmineQboCalendar
def view_layouts_base_html_head(context = {}) def view_layouts_base_html_head(context = {})
safe_join([ safe_join([
javascript_include_tag("customer_appointments", plugin: :redmine_qbo_calendar), 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), stylesheet_link_tag('customer_appointments', plugin: :redmine_qbo_calendar),
javascript_include_tag('https://kit.fontawesome.com/4be4394b21.js', crossorigin: 'anonymous') javascript_include_tag('https://kit.fontawesome.com/4be4394b21.js', crossorigin: 'anonymous')
]) ])
@@ -0,0 +1,39 @@
#The MIT License (MIT)
#
#Copyright (c) 2026 rick barrette
#
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
module RedmineQboCalendar
module Patches
module ApplicationHelperPatch
def favicon
if calendar_or_appointments_view?
tag.link(rel: 'icon', type: 'image/png', href: favicon_path)
else
# Force an explicit type tag so the browser replaces the PNG on non-calendar pages
tag.link(rel: 'icon', type: 'image/x-icon', href: favicon_path)
end
end
def favicon_path
if calendar_or_appointments_view?
image_path("plugin_assets/redmine_qbo_calendar/favicons/#{Date.current.day}.png")
else
super
end
end
private
def calendar_or_appointments_view?
controller_name == 'calendars' || controller_name == 'customer_appointments'
end
end
end
end
@@ -1,12 +1,12 @@
#The MIT License (MIT) # The MIT License (MIT)
# #
#Copyright (c) 2026 rick barrette # Copyright (c) 2026 rick barrette
# #
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
# #
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
# #
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
module RedmineQboCalendar module RedmineQboCalendar
module Patches module Patches
@@ -14,6 +14,17 @@ module RedmineQboCalendar
def show def show
log "show" log "show"
# 1. Update or retrieve saved month/year from session before super runs
if params[:year].present? && params[:month].present?
session[:qbo_calendar_year] = params[:year].to_i
session[:qbo_calendar_month] = params[:month].to_i
elsif session[:qbo_calendar_year].present? && session[:qbo_calendar_month].present?
params[:year] ||= session[:qbo_calendar_year]
params[:month] ||= session[:qbo_calendar_month]
end
# 2. Call Redmine core CalendarsController#show
super super
return unless @calendar return unless @calendar