Skip to content

Holiday front end - #1697

Open
tkakar0451 wants to merge 228 commits into
OpenEnergyDashboard:timeVaryfrom
JSmevog1:holidayFrontEnd
Open

Holiday front end#1697
tkakar0451 wants to merge 228 commits into
OpenEnergyDashboard:timeVaryfrom
JSmevog1:holidayFrontEnd

Conversation

@tkakar0451

Copy link
Copy Markdown

Description

This PR adds an administrator workflow for creating and managing holiday exceptions used by OED's time-varying conversion system, but it does not apply holiday exceptions while calculating conversions. That future server side RRule work is tracked separately in issue #1681

The workflow consists of three new connected holiday administration pages, with an additional integration into the existing Week Patterns page:

  • Holidays: Allows an administrator to select a location and add the base holidays that should be available in OED.
  • Holiday Rates: Allows an administrator to pair one saved base holiday with one day pattern. The page supports creating, viewing, editing, and deleting Holiday Rates, filtering base holidays by location, validating required fields, displaying saved rates as cards, and saving changes through the OED API.
  • Holiday Rate Groups: Allows an administrator to combine multiple Holiday Rates into reusable groups for the time-varying conversion workflow.
  • Week patterns: Adds an optional Holiday Rate Group selection to Week Patterns.

This PR also includes the frontend routes, navigation entries, Redux API integration, translations, help text, notifications, database tables, models, queries, and server routes needed to support the three-page holiday workflow.

Contributors

  • @RoseArias: Holidays page and location-based holiday selection workflow.
  • @tkakar0451: Holiday Rates page, including create, edit, delete, validation, location filtering, Redux API integration, translations, notifications, and help content.
  • @JSmevog1: Holiday Rate Groups page and its connection to the time-varying conversion workflow.

Testing

  • Manually tested the complete three-page holiday workflow.
  • Confirmed that the Holidays, Holiday Rates, and Holiday Rate Groups pages load and operate correctly.
  • Confirmed that records created on one page are available to the next page in the workflow.
  • Confirmed create, edit, and permitted delete operations.
  • Confirmed that the delete interlock prevents a Holiday Rate from being deleted while it is referenced by a Holiday Rate Group.
  • No new holiday-specific automated tests were added.

No existing GitHub issue was identified specifically for the three-page holiday administration workflow.

Type of change

  • Note merging this changes the database configuration.
  • This change requires a documentation update

Checklist

  • I have followed the OED pull request ideas
  • I have removed text in ( ) from the issue request
  • You acknowledge that every person contributing to this work has signed the OED Contributing License Agreement and each author is listed in the Description section.

Limitations

  • No automated tests were added specifically for the new holiday functionality. The complete three-page workflow was tested manually, but automated regression coverage should be added in future work.
  • The Holiday Rates page does not yet check for duplicate names or duplicate base-holiday/day-pattern combinations before saving. The database enforces these restrictions, but the user may receive a general failure notification instead of field-level feedback.
  • A Holiday Rate cannot be deleted while it is referenced by a Holiday Rate Group. The database interlock correctly protects the relationship, but the page does not check for that relationship before sending the delete request, so the user may receive a general deletion failure message rather than a specific explanation.
  • The Holiday Rates page still contains some page-local confirmation, selection, unsaved-change, and styling logic that could be migrated to OED's shared components in future cleanup.
  • Holidays page:
  • Importing is immediate and imports all holidays returned for the selected location and year. There is no preview or confirmation step and no way to select individual holidays before saving
  • Previously imported location and year combinations are not displayed as separate manageable items. Administrators must reselect the location and year to view them, and those selections are not retained after leaving the page.
  • The date-holiday api does not have a good way to indicate historical holidays and their start and end dates. Admins should review historical schedules before using imported holidays.
  • Location is stored as one combination code, A future redesign should consider providing holiday location/region cards instead of the holidays themselves.
  • The page does not currently provide a safe way to delete an accidentally imported holiday/region. Dependency checks would be needed before deletion.
  • Holiday and location names are currently requested from the date-holidays api in English regardless of OED’s language.
    Holiday Rate Groups page
    -The Holiday Rate Groups page does not yet check for duplicate names before saving, a user friendly error message shows up, but the create or save button should not be clickable if the name is a duplicate.
    -In the Holiday Rate Groups page, you can not select a holiday rate without selecting a location first. Users should be able to choose holiday rates without location selected and selecting a location just filters holiday rates.
    -In the holiday Rate Groups page, holiday rates is a required input, therefore should be highlighted red when empty. It is not highlighted as of now.
    -A Holiday Rate Group cannot be deleted while it is referenced by a weekly pattern. The database interlock correctly protects the relationship, but the page does not check for that relationship before sending the delete request, so the user may receive a general deletion failure message rather than a specific explanation.
    -A schema issue related to weeks prevents holiday rate groups from saving when creating weekly patterns.

minhtriet359 and others added 30 commits June 29, 2025 18:28
Currently read-only. Uses fake data, as the Weeks API is not yet implemented.
Signed-off-by: PRINCESANCHEZ <princesanchez72@gmail.com>
* CRUD operations working with back-end
* client-side validation
* delete confirmation
* Spanish and French translations
Omit `id` from the default week values model
docker-compose should not be ignored and should not have to be altered for our time-varying conversion work
…on conflict

Signed-off-by: PRINCESANCHEZ <princesanchez72@gmail.com>
JSmevog1 and others added 30 commits July 15, 2026 16:54
- holidaysApi: read-only queries for base holidays (Rose's page owns mutations)
- holidayInstancesApi: queries + add/edit/delete mutations matching Hugo's
  server routes (/api/holidayInstances)
- New wire types in types/redux/holidays.ts matching server response shapes
- Register Holidays and HolidayInstances tag types in baseApi
…nce page branch

# Conflicts:
#	src/server/models/ConversionSegment.js
#	src/server/models/DaySegment.js
#	src/server/routes/daySegments.js
The merge kept a leftover block from the old instance-method version
(const earlierSegment = this) inside Hugo's newer static method, causing
a duplicate declaration. The static version already inserts the earlier
segment correctly.
Replace the three DATA SEAM mock hooks with adapter hooks over
holidaysApi, daysApi (existing day patterns slice), and
holidayInstancesApi. Adapters map internal field names to wire names
(instanceName/name, baseHolidayId/holidayId, patternId/dayPatternId).
Edit resends the unchanged holidayId since the route requires it.
Mutations follow the OED unwrap + success/error notification pattern
(strings via STRINGS pending i18n).
The page's queries hit admin-only routes; outside the guard the page
mounted before token verification and its requests fired without the
auth token (403).
- Clip card names at 15 chars (notes stay at 30)
- Rename modal field label to 'Holiday Day Name'
- Warn (non-blocking, text-warning) when the base holiday changes after
  a name was entered
- Replace STRINGS object with translate() calls via useTranslate;
  reuse existing keys (cancel, note, discard.changes, unsaved.warning)
  and add holiday.* / day.pattern.* keys to translations/data.ts for
  en/fr/es with lightning-bolt placeholders on untranslated entries
Used date-holidays to load reginal holiday to the db and made them duplicate safe.
…s working. Filters Holiday rates based on location.
- Alphabetize the three holiday entries in the Pages menu
- Use state field names directly; remove the renaming adapter layer
- Keep location labels for base holidays (Name (Location))
- Move state types to types/redux; drop the Omit patch type
- Remove unused getHolidayInstancesByHolidayId endpoint
- Rename EMPTY_DRAFT -> defaultValues, isDirty -> hasUnsavedChanges
- Remove loading gate; add tooltip help icon + translation key
- Comment cleanup: no meeting/date/person references; TODOs marked
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants