Skip to content

Calendar Layout Component: Views

Back to Calendar Layout Component.

The built-in view names are year, month, week, day and list. They are used in available_views and default_view. For a view with other settings, define it in custom_views and use its key as view name:

{
"type": "calendar",
"options": {
"available_views": ["next7days", "month"],
"default_view": "next7days",
"custom_views": {
"next7days": {
"type": "list",
"duration": {"days": 7}
}
},
"events": []
}
}

The calendar uses the language of the user. The month names, weekday names and week start follow the locale.

The views resourceWeek and resourceMonth show a timeline with one row per entity of another module (for example per employee or room). They are driven by two options that are read by the component but are not part of the published layout types, so treat them as advanced and test them in your system:

  • options.resource: { "module": "<module identifier>", "groupBy": "<field>", "pre_filters": [...] } selects the entities that become rows. The row title is the brezel_name of the entity; the row id is the value of groupBy, or the entity id when groupBy is not set.
  • On every event type, groupBy is the field of the event entity whose value picks the row.

These views use the FullCalendar scheduler. The frontend needs a scheduler license key (VITE_SCHEDULER_LICENSE_KEY at build time of the SPA); without it FullCalendar shows a license notice.

  • Click on an event opens the entity in a drawer at the bottom of the screen, in the module’s normal show layout. The drawer’s layout context contains the date range of the clicked event in calendar.range and, for a repeated event, the rule in calendar.recurrence.
  • Drag or resize an event (if editable) writes the new date into the configured field of the entity with a normal update request. For date fields the new start day is saved, for datetime the new start, for dateRange start, end and the full-day flag. While saving, the event is shown semi-transparent; on failure an error toast appears and the value is not changed. For a repeated event, the date of the entity itself is moved by the amount you dragged.
  • Click on an empty day opens a drawer with the create form of the module, with the clicked date prefilled into field. This only works if at least one event type has quick_create: true. If several have it, the drawer offers a selection of the type to create. Without any quick_create, clicking on a day does nothing.
  • Click on the day number or the week number in the month view switches to the day or week view.
  • Sidebar (filter_sidebar): per event type a checkbox to show or hide it (remembered in the browser), plus a filter button that opens the normal filter UI of the module; these filters are added to the date range and pre_filters and apply to this user only. A button creates a personal iCalendar link for the currently selected event types.

pre_filters use the same format as in other components such as resource_table: a list of conditions that all must hold, or a list of lists (outer list OR, inner list AND). A condition has a column (column or field), an operator (=, !=, <, <=, >, >=, in, not in, like, is, is not) and either a value or a recipe that is evaluated in the browser. A condition with a recipe that returns nothing (or an empty list) is dropped. An optional if recipe removes the condition when it returns false. In the recipe, this is the entity of the surrounding layout and user() the current user, as in other layouts.

{"pre_filters": [
{"column": "employee.id", "operator": "=", "recipe": "user().id"}
]}

Filters only decide what is shown. The calendar loads entities with the same requests as the table of the module and saves with the same update requests as the entity form, so the normal module permissions and policies apply: users only see entities they may read, drag and drop fails with an error for entities they may not update, and creating needs create permission on the module. Do not rely on pre_filters to hide data from a user, use policies for that.