feat(admin-portal): port babyboo's date picker and calendar
Adds react-day-picker 10.0.1 (it brings date-fns). The portal bans native date inputs, and the events and leads forms need a date field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
1 parent
1fa7c60fee
commit
c908fbe9fc
13 files changed
+443
-9
No files matched your search
@@ -67,7 +67,7 @@ Alternative: one `services-counter` endpoint that creates both in a transaction.
|
||||
|
||||
### 9. Date picker
|
||||
|
||||
Port babyboo's `app/components/ui/calendar.tsx` and `date-picker.tsx` (with their tests), adding `react-day-picker` 10.0.1 and `date-fns` ^4.4.0, the versions babyboo uses. Required by the native-date-input ban; change 4 reuses the picker on phones.
|
||||
Port babyboo's `app/components/ui/calendar.tsx` and `date-picker.tsx` (with their tests), adding `react-day-picker` 10.0.1, the version babyboo uses (it depends on `date-fns` itself, so no direct `date-fns` dependency). Required by the native-date-input ban; change 4 reuses the picker on phones.
|
||||
|
||||
### 10. Module
|
||||
|
||||
|
||||
@@ -7,12 +7,13 @@ Lead capture (change 4) records every lead against an event, so staff need to cr
|
||||
## What Changes
|
||||
|
||||
- **Admin portal Events screens**: a paged list (search by name, filter by enabled), a create page and an edit page. Desktop-first, like Users and Roles.
|
||||
- **`mobile-api` gains `/api/admin/events`**: list, get, create and update, guarded by a new `BO_EVENTS` module. They call the existing `services-counter` event endpoints (`findByPropertyAndPageable`, `findByUuid`, `save`); `services-counter` and its schema do not change.
|
||||
- **`mobile-api` gains `/api/admin/events`**: list, get, create and update, guarded by a new `BO_EVENTS` module. They call the existing `services-counter` event endpoints (`findByPropertyAndPageable`, `findByUuid`, `save`); the `event` table does not change.
|
||||
- **Event fields kept** from Tastefully: name, location, start date, end date, enabled. Tastefully's backoffice rules carry over: name and location required, both dates required, end date not before start date, dates are whole days, new events start enabled.
|
||||
- **Event team**: each event has a team of salespeople (active admin users), chosen on create and edit and stored in a new `services-counter` table `event_salesperson`. Change 4 limits a lead's salesperson to the event's team.
|
||||
- **Not kept**: the four Tastefully upload fields (floor plan, stage activities, lucky draw, taste rewards). Their columns stay in the table and are left untouched on update.
|
||||
- **No delete**, as in Tastefully. Leads will reference events, so an event is disabled instead.
|
||||
- **Back-office module** `BO_EVENTS` (`/events`) added to `service-system`.`module`; SQL in this change folder, mirrored in `local/seed/`.
|
||||
- **Date picker**: the portal forbids native date inputs (an existing test), so babyboo's `DatePicker` and `Calendar` components are ported, adding `react-day-picker` and `date-fns`. Change 4 reuses them for the follow-up date.
|
||||
- **Date picker**: the portal forbids native date inputs (an existing test), so babyboo's `DatePicker` and `Calendar` components are ported, adding `react-day-picker`. Change 4 reuses them for the follow-up date.
|
||||
|
||||
Not in this change: event booths, products, receipts, lucky draw and the other Tastefully event sub-screens; event company scoping (the design keeps `user` as the only existing table that gains `company_id`).
|
||||
|
||||
@@ -26,8 +27,9 @@ None.
|
||||
|
||||
## Impact
|
||||
|
||||
- `solvway-admin-portal`: new `app/events/**` pages, `app/api/events/**` route handlers, an events service, the ported date picker and calendar, `/events` in the route-module map. New dependencies `react-day-picker` and `date-fns`.
|
||||
- `solvway-admin-portal`: new `app/events/**` pages, `app/api/events/**` route handlers, an events service, the ported date picker and calendar, `/events` in the route-module map. New dependency `react-day-picker`.
|
||||
- `solvway-mobile-api`: new `AdminEventController`, `AdminEventService`, DTOs and counter endpoint constants.
|
||||
- Database `service-system`: one new `module` row. Additive only.
|
||||
- `local/seed/03-colite.sql`: mirrors the module row.
|
||||
- No change to `services-counter`, the gateway, or the `event` table.
|
||||
- `solvway-services-counter`: `EventSalesperson` entity and team endpoints.
|
||||
- Database: new table `service-counter`.`event_salesperson` and one new `service-system`.`module` row. Additive only.
|
||||
- `local/seed/03-colite.sql`: mirrors both.
|
||||
- No change to the gateway or the `event` table.
|
||||
@@ -19,8 +19,8 @@ Babyboo source: `~/Projects/babyboo` (read only). Tastefully backoffice rules: `
|
||||
|
||||
## 4. Admin portal
|
||||
|
||||
- [ ] 4.1 Port babyboo's `calendar.tsx` and `date-picker.tsx` (and their tests) into `app/components/ui/`, adding `react-day-picker` 10.0.1 and `date-fns` ^4.4.0 to `package.json` (`npm install`, commit the lockfile). Verify: `npm run lint && npx tsc --noEmit && npx vitest run` exit 0.
|
||||
- Scope: `solvway-admin-portal/app/components/ui/**`, `solvway-admin-portal/package.json`, `solvway-admin-portal/package-lock.json`
|
||||
- [x] 4.1 Port babyboo's `calendar.tsx` and `date-picker.tsx` (and their tests) into `app/components/ui/`, with their helpers `app/lib/date-input.ts` (and test), `test/pickDate.ts` and the four `Ui*` i18n keys, adding `react-day-picker` 10.0.1 to `package.json` (`npm install`, commit the lockfile; it brings `date-fns` itself). Verify: `npm run lint && npx tsc --noEmit && npx vitest run` exit 0.
|
||||
- Scope: `solvway-admin-portal/app/components/ui/**`, `solvway-admin-portal/app/lib/date-input*`, `solvway-admin-portal/test/pickDate.ts`, `solvway-admin-portal/app/lib/i18n/defaultMessages.ts`, `solvway-admin-portal/package.json`, `solvway-admin-portal/package-lock.json`
|
||||
- [ ] 4.2 Add the Events screens on the Users pattern: `app/events/page.tsx` (list: search, enabled filter, sortable name/start/end, columns name, location, start, end, enabled; row Edit), `app/events/new/page.tsx`, `app/events/[uuid]/page.tsx`, an `EventForm` (name, location, start and end `DatePicker`, enabled on edit only, team multi-select from salesperson-options with inactive members shown marked), route handlers `app/api/events/**`, `app/lib/services/adminEvents.ts`, types, i18n defaults, and `/events` → `BO_EVENTS` in `routeModules`. Form checks required fields and end not before start before submitting; API errors show on the field. `TEAM_NOT_SAVED` lands on the edit page with its message. Tests first (vitest) for each portal-visible scenario. Verify: `npm run lint && npx tsc --noEmit && npx vitest run && npm run build` exit 0.
|
||||
- Scope: `solvway-admin-portal/app/**`
|
||||
|
||||
|
||||
Reference in new issue
Block a user