Skip to content

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

Merged
yusuftomilola merged 2 commits into
DistinctCodes:mainfrom
Tyler7x:feature/tyler7x-issues-1194-1195-1196-1197
Jun 28, 2026
Merged

feat: staff scheduling, floor plan editor, and advanced reports [#1194 #1195 #1196 #1197]#1258
yusuftomilola merged 2 commits 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 #1193
Closes #1192
Closes #1191
Closes #1190

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.

@drips-wave

drips-wave Bot commented Jun 28, 2026

Copy link
Copy Markdown

@Tyler7x Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@yusuftomilola yusuftomilola merged commit 58e0046 into DistinctCodes:main Jun 28, 2026
4 of 7 checks passed
@grantfox-oss grantfox-oss Bot mentioned this pull request Jun 28, 2026
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants