mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
Overview shows coming due and the last flight; intervals in days, months or years
- Overview: "Coming due" (next 30 days or 10 hours) and "Last flight" (the most recent day's legs, meters at the end, fuel and oil left). - Component replace / TBO / inspect intervals, inspection types and ADs take a number and a days / months / years choice (CalendarInterval). Components gain month columns (years stored as 12 months; months land on the same date); inspection types and ADs keep end-of-month. ADs now honour days. - Due list: hours already run out count as overdue; a component covered by an inspection type no longer gets its own "Inspect every" item. - Loading calculator moved to a partial; no limit warnings until a load is entered. Header buttons don't wrap on phones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
215efe6814
commit
31ac991bab
37 files changed
+385
-75
No files matched your search
@@ -39,6 +39,23 @@ class AppFormBuilder < ActionView::Helpers::FormBuilder
|
||||
end
|
||||
end
|
||||
|
||||
# A calendar interval: a number and a days / months / years choice
|
||||
# (see CalendarInterval).
|
||||
# <%= f.interval :replacement, label: "Replace every" %>
|
||||
def interval(name, label:, hint: nil, wrapper: {})
|
||||
every = :"#{name}_every"
|
||||
errors = object.errors[every]
|
||||
@template.content_tag(:div, class: wrapper[:class]) do
|
||||
label(every, label, class: "label") +
|
||||
@template.content_tag(:div, class: "flex gap-2") do
|
||||
number_field(every, class: "input min-w-0 flex-1", min: 1, step: 1, inputmode: "numeric") +
|
||||
select(:"#{name}_unit", CalendarInterval::UNITS.invert, {}, class: "input w-auto", "aria-label": "#{label} unit")
|
||||
end +
|
||||
(hint ? @template.content_tag(:p, hint, class: "hint") : "".html_safe) +
|
||||
errors.map { |e| @template.content_tag(:p, "#{label} #{e}", class: "field-error") }.join.html_safe
|
||||
end
|
||||
end
|
||||
|
||||
def errors_summary
|
||||
return "".html_safe unless object&.errors&.any?
|
||||
@template.content_tag(:div, class: "rounded-md bg-red-50 p-3 text-sm text-red-700 ring-1 ring-red-200") do
|
||||
|
||||
Reference in new issue
Block a user