17 Commits
Author SHA1 Message Date
ricky d3b9441f25 2026.9.2 2026-09-09 21:43:55 -04:00
ricky 852d2119a0 Fix over-calculation of hours for multi-day appointments
Updates the calendar view to distribute multi-day appointment hours
across working days, capping each day at 8 hours. This prevents the
total hours from being added to every day and ensures appointments
with fewer hours than their maximum duration don't artificially
inflate daily labor totals.
2026-09-09 21:43:22 -04:00
ricky 041a6441fe 2026.9.1 2026-09-09 21:14:52 -04:00
ricky 0e54316eac Refactor indentation in view_hook_listener.rb for improved readability 2026-09-08 22:39:09 -04:00
ricky 250442db9d removed trailing / 2026-09-08 08:24:00 -04:00
ricky c3a5657b7b Updated README 2026-09-06 21:49:16 -04:00
ricky ee4327152d Updated README 2026-09-06 21:45:45 -04:00
ricky 39f31cfb11 Fix redirect after appointment deletion and handle missing appointment gracefully 2026-09-06 21:38:20 -04:00
ricky df788d4d97 Remove settings partial from plugin registration 2026-09-06 21:31:44 -04:00
ricky 9fac291490 removed unused permissions, moved view registration into setup 2026-09-06 21:30:19 -04:00
ricky 8448c06b10 Refactor menu registration to add top menu item for calendar and remove project menu entry for customer calendar 2026-09-06 21:21:45 -04:00
ricky 97ed852068 Implement global permissions for customer appointments and update views to check permissions before displaying actions 2026-09-06 21:11:18 -04:00
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
23 changed files with 653 additions and 176 deletions

No files matched your search

+22 -18
View File
@@ -64,26 +64,30 @@ Restart your application server (Puma, Passenger, etc.) to initialize the plugin
--- ---
## Configuration
This plugin depends on the **Redmine QuickBooks Online** plugin.
Before using this plugin:
1. Install and configure the parent plugin.
2. Ensure your **QuickBooks Online** company file is connected.
3. Sync Accounts & Items via plugin settings
4. Set default income account for new items via plugin settings
---
## Usage ## Usage
Add appointments 1. Managing Customer Appointments
* Viewing the Calendar: Navigate to the Customer Calendar tab within a project or via the top menu to view scheduled customer appointments.
* Adding Appointments: Click on available days on the calendar grid to schedule a new appointment (restricted by user permissions, working days, and configured holidays).
* Editing & Deleting: Existing appointments can be modified or removed directly from the calendar interface depending on user privileges.
* My Page Integration: Users can add the Upcoming Appointments block to their personal My Page dashboard to track their schedule at a glance.
2. Holidays and Non-Working Days
Administrators can manage the holiday calendar to prevent appointments from being scheduled on non-working days.
* Go to Administration -> Holidays (or the corresponding holidays menu item).
* Fixed Holidays: Set specific dates (e.g., December 25th) that recur annually or apply to a single year.
* Dynamic Holidays: Configure rules for floating holidays (e.g., the 1st Monday of September).
* Validation: The system automatically blocks appointment creation on standard weekends, non-working days, and defined holidays.
3. Permissions & Global Access
Appointment permissions are configured globally to apply system-wide:
1. Navigate to Administration -> Roles and permissions.
2. Scroll to the global permissions section.
3. Assign the following permissions as needed based on user roles (such as Non-member or custom staff roles):
* View customer appointments
* Add customer appointments
* Edit customer appointments
* Delete customer appointments
--- ---
@@ -12,7 +12,8 @@ class CustomerAppointmentsController < ApplicationController
before_action :require_login before_action :require_login
before_action :find_project, except: [:index] before_action :find_project, except: [:index]
before_action :find_appointment, only: [ :show, :edit, :update, :destroy ] before_action :find_appointment, only: [ :show, :edit, :update, :destroy ]
#before_action :authorize # This tells Redmine to check global permissions for the current controller/action
before_action :authorize_global
helper :projects helper :projects
@@ -85,7 +86,7 @@ class CustomerAppointmentsController < ApplicationController
def destroy def destroy
@appointment.destroy @appointment.destroy
flash[:notice] = l(:notice_successful_delete) flash[:notice] = l(:notice_successful_delete)
redirect_to project_customer_appointments_path( @project) redirect_to issues_calendar_path
end end
private private
@@ -116,6 +117,8 @@ class CustomerAppointmentsController < ApplicationController
def find_appointment def find_appointment
@appointment = CustomerAppointment.find(params[:id]) @appointment = CustomerAppointment.find(params[:id])
rescue
render_404
end end
def log(msg) def log(msg)
+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
+20
View File
@@ -18,6 +18,9 @@ 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 }
@@ -115,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
+95 -74
View File
@@ -1,11 +1,19 @@
<%= javascript_include_tag("calendar", plugin: :redmine_qbo_calendar) %>
<% <%
# Check if toggles are 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' 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)
@@ -20,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
@@ -66,6 +82,25 @@
<!-- Toggle Bar --> <!-- Toggle Bar -->
<div class="calendar-filter-toolbar" style="margin-bottom: 12px; display: flex; align-items: center; justify-content: flex-end; gap: 16px;"> <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;"> <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', <%= check_box_tag 'hide_past_weeks',
'1', '1',
@@ -110,6 +145,11 @@
<% <%
is_today = (day == User.current.today) 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) }
@@ -133,7 +173,34 @@
if event.is_a?(Issue) if event.is_a?(Issue)
event.estimated_hours.to_f event.estimated_hours.to_f
elsif event.is_a?(CustomerAppointment) elsif event.is_a?(CustomerAppointment)
if event.respond_to?(:estimated_hours) && event.estimated_hours.present? if event.duration.to_i > 1
# Get the total hours (fallback to duration * 8 if estimated_hours is blank)
app_total_hours = if event.respond_to?(:estimated_hours) && event.estimated_hours.present?
event.estimated_hours.to_f
else
event.duration.to_f * 8.0
end
start_date = (event.respond_to?(:date) && event.date.present? ? event.date : event.start_date).to_date
# Count how many working days occurred before the current calendar 'day'
working_day_index = 0
date_cursor = start_date
while date_cursor < day
is_weekend = non_working_days.include?(date_cursor.cwday.to_s)
is_holiday = all_holidays.any? { |h| h.occurs_on?(date_cursor) }
working_day_index += 1 unless is_weekend || is_holiday
date_cursor += 1
end
# Subtract previous days' hours (8h/day) from the total
hours_already_allocated = working_day_index * 8.0
remaining_hours = app_total_hours - hours_already_allocated
# Allocate up to 8 hours for today, but don't go below 0
[[remaining_hours, 8.0].min, 0.0].max
elsif event.respond_to?(:estimated_hours) && event.estimated_hours.present?
event.estimated_hours.to_f event.estimated_hours.to_f
else else
event.duration.to_f event.duration.to_f
@@ -144,7 +211,8 @@
end end
%> %>
<li class="<%= calendar.day_css_classes(day) %> calbody"<%= ' id="today"'.html_safe if is_today %>> <%# 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;">
<!-- Left: Day number and abbreviated weekday --> <!-- Left: Day number and abbreviated weekday -->
@@ -156,14 +224,17 @@
</span> </span>
<!-- Center: New Appointment Action --> <!-- Center: New Appointment Action -->
<span class="day-num-center" style="display: inline-flex; align-items: center; justify-self: center;"> <% if User.current.allowed_to?(:add_customer_appointments, nil, global: true) %>
<% if day >= User.current.today && !non_working_days.include?(day.cwday.to_s) %> <span class="day-num-center" style="display: inline-flex; align-items: center; justify-self: center;">
<%= link_to sprite_icon('add'), <%# Only show ADD button if it's in the future, NOT a weekend, NOT a holiday, AND user has permission %>
new_customer_appointment_path(start_date: day), <% if day >= User.current.today && !is_standard_weekend && !is_custom_holiday && User.current.allowed_to?(:add_customer_appointments, nil, global: true) %>
class: 'icon-only icon-add', <%= link_to sprite_icon('add'),
title: l(:label_appointment_new, default: 'New Appointment') %> new_customer_appointment_path(start_date: day),
<% end %> class: 'icon-only icon-add',
</span> title: l(:label_appointment_new, default: 'New Appointment') %>
<% end %>
</span>
<% end %>
<!-- Right: Total Hours --> <!-- Right: Total Hours -->
<span class="day-num-right" style="display: inline-flex; align-items: center; justify-self: end;"> <span class="day-num-right" style="display: inline-flex; align-items: center; justify-self: end;">
@@ -175,6 +246,17 @@
</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) %>
@@ -249,65 +331,4 @@
<% end %> <% end %>
<%= context_menu %> <%= context_menu %>
<script>
(function() {
const STORAGE_KEY_ONLY_APPTS = 'redmine_cal_only_appointments';
const STORAGE_KEY_HIDE_PAST = 'redmine_cal_hide_past_weeks';
document.addEventListener('DOMContentLoaded', function() {
const urlParams = new URLSearchParams(window.location.search);
let needsRedirect = false;
// Sync "Show Customer Appointments Only" with localStorage if not present in 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 not present in 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 specific hash anchor is in the URL
if (!window.location.hash) {
const todayElement = document.getElementById('today');
if (todayElement) {
todayElement.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
}
});
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();
};
})();
</script>
@@ -1,4 +1,6 @@
<p> <% if User.current.allowed_to?(:add_customer_appointments, nil, global: true) %>
<% customer = context[:customer] %> <p>
<%= link_to l(:label_add_appointment), new_customer_appointment_path(customer_id: customer.id), target: :_blank, id: :appointment_link %> <% customer = context[:customer] %>
</p> <%= link_to l(:label_add_appointment), new_customer_appointment_path(customer_id: customer.id), target: :_blank, id: :appointment_link %>
</p>
<% end %>
Whitespace-only changes.
@@ -92,6 +92,8 @@
<hr> <hr>
<p class="buttons"> <% if User.current.allowed_to?(:edit_customer_appointments, nil, global: true) %>
<%= link_to l(:label_open_appointment), customer_appointment_path(appointment), class: "icon icon-edit" %> <p class="buttons">
</p> <%= link_to l(:label_open_appointment), customer_appointment_path(appointment), class: "icon icon-edit" %>
</p>
<% end %>
@@ -5,8 +5,10 @@
<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 new_customer_appointment_path do %> <% if User.current.allowed_to?(:add_customer_appointments, nil, global: true) %>
<i class="fa-regular fa-pen-to-square"></i> <%= l(:button_add) %> <%= link_to new_customer_appointment_path do %>
<i class="fa-regular fa-pen-to-square"></i> <%= l(:button_add) %>
<% end %>
<% end %> <% end %>
</div> </div>
+28 -20
View File
@@ -3,16 +3,22 @@
<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 new_issue_path(issue: { customer_id: @appointment.customer_id, vehicle_id: @appointment.vehicle_id, estimate_id: @appointment.estimate_id }), target: :_blank do %> <% if User.current.allowed_to?(:add_customer_appointments, nil, global: true) %>
<i class="fa-solid fa-plus"></i> <%= l(:label_new_issue) %> <%= 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 %> <% end %>
<%= link_to edit_customer_appointment_path(@appointment) do %> <% if User.current.allowed_to?(:edit_customer_appointments, nil, global: true) %>
<i class="fa-solid fa-pen-to-square"></i> <%= l(:button_edit) %> <%= link_to edit_customer_appointment_path(@appointment) do %>
<i class="fa-solid fa-pen-to-square"></i> <%= l(:button_edit) %>
<% end %>
<% end %> <% end %>
<%= link_to customer_appointment_path(@appointment), method: :delete, data: { confirm: l(:text_are_you_sure) } do %> <% if User.current.allowed_to?(:delete_customer_appointments, nil, global: true) %>
<i class="fa-solid fa-trash"></i> <%= l(:button_delete) %> <%= 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 %> <% end %>
</div> </div>
@@ -36,20 +42,22 @@
</span> </span>
</h2> </h2>
<%# Quick Status Action Buttons %> <% if User.current.allowed_to?(:edit_customer_appointments, nil, global: true) %>
<% <%# Quick Status Action Buttons %>
statuses = CustomerAppointment::STATUSES <%
current_status = @appointment.status.to_s.parameterize.underscore statuses = CustomerAppointment::STATUSES
%> current_status = @appointment.status.to_s.parameterize.underscore
<div class="appointment-quick-actions"> %>
<span class="quick-action-label"><%= l(:label_change_status, default: 'Change Status:') %></span> <div class="appointment-quick-actions">
<% statuses.reject { |s| s == current_status }.each do |status_key| %> <span class="quick-action-label"><%= l(:label_change_status, default: 'Change Status:') %></span>
<%= link_to status_key.humanize, <% statuses.reject { |s| s == current_status }.each do |status_key| %>
customer_appointment_path(@appointment, customer_appointment: { status: status_key }), <%= link_to status_key.humanize,
method: :patch, customer_appointment_path(@appointment, customer_appointment: { status: status_key }),
class: "quick-status-btn status-#{status_key.parameterize}" %> method: :patch,
<% end %> class: "quick-status-btn status-#{status_key.parameterize}" %>
</div> <% end %>
</div>
<% end %>
<div class="issue details"> <div class="issue details">
<div class="attributes"> <div class="attributes">
+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 %>
+64 -1
View File
@@ -19,4 +19,67 @@ document.addEventListener('DOMContentLoaded', function() {
clickedBlock.classList.toggle('open'); clickedBlock.classList.toggle('open');
} }
}); });
}); });
(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();
};
})();
+37 -4
View File
@@ -14,12 +14,27 @@ 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_appointment_new: "New Appointment"
label_appointments: Appointments label_appointments: Appointments
label_customer_appointment: Customer Appointment label_customer_appointment: Customer Appointment
label_customer_calendar: Customer Calendar label_customer_calendar: Customer Calendar
@@ -29,15 +44,33 @@ en:
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_hide_past_weeks: "Hide Past Weeks"
label_only_customer_appointments: Show Customer Appointments Only label_holiday_edit: Edit Holiday
label_holiday_new: New Holiday
label_holiday_plural: Holidays
label_legend: "Legend"
label_new_appointment: New Appointment label_new_appointment: New Appointment
label_of: "of"
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_add_customer_appointments: "Add customer appointments"
permission_delete_customer_appointments: "Delete customer appointments"
permission_edit_customer_appointments: "Edit customer appointments"
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
+12 -34
View File
@@ -14,11 +14,13 @@ 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.1' version '2026.9.2'
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'
# 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
@@ -27,39 +29,15 @@ Redmine::Plugin.register :redmine_qbo_calendar do
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
project_module :customer_calendar do # Global Permissions
permission :view_customer_appointments, permission :view_customer_appointments, { customer_appointments: [:index, :show] }, global: true
{ customer_appointments: [:index, :show] } permission :add_customer_appointments, { customer_appointments: [:new, :create] }, global: true
permission :edit_customer_appointments, { customer_appointments: [:edit, :update] }, global: true
permission :delete_customer_appointments, { customer_appointments: [:destroy] }, global: true
permission :manage_customer_appointments, # Register top menu items
{ menu :top_menu, :calendar, { controller: :calendars, action: :show }, caption: :label_calendar, if: Proc.new {User.current.logged?}
customer_appointments: [
:new,
:create,
:edit,
:update,
:destroy
]
}
end
menu :project_menu,
:customer_calendar,
{ controller: 'events',
action: 'index' },
caption: 'Customer Calendar',
after: :calendar,
param: :project_id
end
Rails.configuration.to_prepare do
ApplicationController.prepend_view_path( File.expand_path("app/views", __dir__) )
Redmine::Views::MyPage::Block.register(
'upcoming_appointments',
label: :label_upcoming_appointments,
partial: 'my/blocks/upcoming_appointments'
)
end end
RedmineQboCalendar.setup RedmineQboCalendar.setup
+10
View File
@@ -20,5 +20,15 @@ module RedmineQboCalendar
RedmineQboCalendar::Hooks::ViewHookListener RedmineQboCalendar::Hooks::ViewHookListener
RedmineQboCalendar::Hooks::CustomerActionsHookListener RedmineQboCalendar::Hooks::CustomerActionsHookListener
RedmineQboCalendar::Hooks::CustomerShowHookListener RedmineQboCalendar::Hooks::CustomerShowHookListener
Rails.configuration.to_prepare do
ApplicationController.prepend_view_path( File.expand_path("app/views", __dir__) )
Redmine::Views::MyPage::Block.register(
'upcoming_appointments',
label: :label_upcoming_appointments,
partial: 'my/blocks/upcoming_appointments'
)
end
end end
end end
@@ -13,15 +13,14 @@ module RedmineQboCalendar
class ViewHookListener < Redmine::Hook::ViewListener class ViewHookListener < Redmine::Hook::ViewListener
# Load the javascript and stylesheet assets # Load the javascript and stylesheet assets
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') ])
]) end
end
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