Examples
Time-off request
Built with the mantine-calendar skill
Build the time-off request form of an HR app.
Data:
- the current employee has 14 days of vacation left this year
- public holidays for the current and next year, hard-coded with their names
- a blackout period in the last week of each quarter ("Quarter close") when vacation cannot be requested
- about 15 absences of 6 teammates (name, type: vacation, sick leave, conference) over the next 3 months, generated relative to today
- 3 existing requests of the current employee (approved, pending, rejected)
Form:
- type (vacation, unpaid leave, sick leave), the period, a "half day" option for the first or the last day, an optional return-to-work date for sick leave that can be typed
- the period is picked in a date input with a dropdown that shows two months; weekends and public holidays look different from working days and do not count towards the request
- in the dropdown, days on which teammates are away show small marks; hovering or focusing such a day lists who is away under the calendar, and the same text is read by screen readers
- the employee's own existing requests are shown in the dropdown with their status, and a new period cannot overlap a pending or approved one
- a vacation cannot start in the past or touch a blackout period, and its working days cannot exceed the remaining balance; unpaid and sick leave ignore the balance; the form shows the reason when a rule fails
- the form shows the number of working days the request takes and the balance after it
Value:
- "Submit request" shows a short notification and displays the request and the updated list of requests as JSON under the form
The component is shown on a demo page that already has a title: do not add a page title or intro text.
Write tests for the component.