Skip to content

feat: staff scheduling, floor plan editor, and advanced reports [#1194 #1195 #1196 #1197]#1258

Open
Tyler7x wants to merge 1 commit into
DistinctCodes:mainfrom
Tyler7x:feature/tyler7x-issues-1194-1195-1196-1197
Open

feat: staff scheduling, floor plan editor, and advanced reports [#1194 #1195 #1196 #1197]#1258
Tyler7x wants to merge 1 commit into
DistinctCodes:mainfrom
Tyler7x:feature/tyler7x-issues-1194-1195-1196-1197

Conversation

@Tyler7x

@Tyler7x Tyler7x commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #1194, #1195, #1196, #1197

This PR delivers four interconnected features spanning the backend and frontend:


BE-23 — Admin Floor Plan Layout (/floor-plan)

Introduces two new TypeORM entities with full CRUD:

  • FloorPlan: stores canvas dimensions (canvasWidth, canvasHeight), an optional backgroundImageUrl, and an isActive flag. Only one plan is active at a time.
  • FloorPlanZone: child records linked to a FloorPlan, each carrying x, y, width, height, label, color, and an optional workspaceId FK for linking zones to bookable spaces.

Endpoints (FloorPlanController, admin-gated except GET /floor-plan/active):

Method Path Description
POST /floor-plan Create a new floor plan
GET /floor-plan List all floor plans
GET /floor-plan/active Return the currently active plan with zones
PATCH /floor-plan/:id Update plan metadata
PUT /floor-plan/:id/zones Replace all zones for a plan (bulk save)
PATCH /floor-plan/:id/activate Mark this plan as active (deactivates others)

BE-24 — Advanced Reports & CSV Export (/reports)

Four new reporting endpoints, all admin/super_admin gated:

Endpoint Description
GET /reports/bookings Bookings in date range with member + workspace info
GET /reports/revenue Invoice totals, paid vs outstanding breakdown
GET /reports/members New members in period with profile data
GET /reports/occupancy Per-workspace booking count in date range

All endpoints accept ?from=ISO&to=ISO date range filters. Pass ?format=csv to get a downloadable CSV attachment instead of JSON. Default range is the last 30 days.


FE-21 — Staff Scheduling Frontend

  • /admin/staff — Weekly calendar grid (Mon–Sun). Admin can navigate weeks with prev/next arrows. Each day column lists shifts as cards showing staff name, role, and time range. Admins can delete shifts inline and open a "Add Shift" modal (requires staff UUID, role name, start/end datetime, optional notes).
  • /my-shifts — Staff-facing view showing this week's shifts grouped by day. Empty state shown when no shifts are scheduled.
  • Sidebar nav updated: "My Shifts" added to member nav; "Staff Schedule" and "Facilities" added to admin nav.

FE-22 — Admin Floor Plan Editor (/admin/facilities)

SVG-based drag-to-draw floor plan editor:

  • Lists all floor plans as tab buttons; clicking loads its zones onto the canvas.
  • Drawing: click and drag directly on the SVG canvas to draw a new rectangular zone. Zones under 10×10px are discarded.
  • Each drawn zone appears as a labeled rectangle with indigo fill. Zone labels are editable via an input list below the canvas.
  • Zones can be deleted individually before saving.
  • Save Zones submits all zones to PUT /floor-plan/:id/zones.
  • Set as Active calls PATCH /floor-plan/:id/activate (only shown when the plan is not already active).
  • New Floor Plan modal lets admins name and create a plan (defaults to 900×600 canvas).

Files Changed

Backend

  • backend/src/shifts/entities/shift.entity.ts (new)
  • backend/src/shifts/shifts.service.ts (new)
  • backend/src/shifts/shifts.controller.ts (new)
  • backend/src/shifts/shifts.module.ts (new)
  • backend/src/floor-plan/entities/floor-plan.entity.ts (new)
  • backend/src/floor-plan/entities/floor-plan-zone.entity.ts (new)
  • backend/src/floor-plan/floor-plan.service.ts (new)
  • backend/src/floor-plan/floor-plan.controller.ts (new)
  • backend/src/floor-plan/floor-plan.module.ts (new)
  • backend/src/reports/reports.service.ts (new)
  • backend/src/reports/reports.controller.ts (new)
  • backend/src/reports/reports.module.ts (new)
  • backend/src/app.module.ts (ShiftsModule, FloorPlanModule, ReportsModule registered)

Frontend

  • frontend/app/admin/staff/page.tsx (new)
  • frontend/app/my-shifts/page.tsx (new)
  • frontend/app/admin/facilities/page.tsx (new)
  • frontend/components/dashboard/DashboardSidebar.tsx (My Shifts + Staff Schedule + Facilities nav items)

Test Plan

  • POST /shifts creates shift; GET /shifts?startDate=&endDate= returns it
  • GET /shifts/this-week returns only current week, scoped to staff if non-admin
  • POST /floor-planPUT /floor-plan/:id/zonesGET /floor-plan/active returns zones
  • PATCH /floor-plan/:id/activate deactivates all other plans
  • GET /reports/bookings?format=csv returns CSV attachment
  • Admin staff page renders calendar, Add Shift modal works, delete works
  • /my-shifts shows only shifts for logged-in staff user
  • Facilities page: draw zone → save → reload shows persisted zones

…inctCodes#1194-DistinctCodes#1197)

- FE-21: /admin/staff weekly calendar grid + /my-shifts page for staff
- BE-23: FloorPlan + FloorPlanZone entities with full CRUD and zone save/activate endpoints
- FE-22: /admin/facilities SVG drag-to-draw floor plan editor with zone labelling
- BE-24: /reports/bookings, /reports/revenue, /reports/members, /reports/occupancy with ?format=csv support
- BE shifts module: Shift entity with staff scheduling CRUD (admin-gated create/update/delete)
@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown

@Tyler7x is attempting to deploy a commit to the naijabuz's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

[FE-21] Staff scheduling: frontend (/admin/staff page)

1 participant