DashboardSupportWelcome

👤 USER DOCS

Getting Started

Daily Operations

Shift Workspace & TasksPre-Shift SetupLine-Up CardsShift ReportsForms

Staff & Locations

Staff SchedulingManaging Locations

Oversight

Manager ReportsAnalyticsPre-Shift & Compliance

Incidents & Feedback

Incident ReportingAnonymous FeedbackMessages & Announcements

AI & Settings

AI ChatgearApp Settings

Administration

Dashboard & OnboardingAdmin

⚙️ DEVELOPER DOCS

Getting Started

Getting StartedDevelopmentDeployment Guide

Architecture

Architecture OverviewData FlowArchitecture Decision Records

Core Domain

Core DomainDatabase ReferenceLocations DomainAuth & RBACScheduling DomainReports DomainIncidents DomainNotifications DomainAudit Log & OptimizationDesign Audit Findings

Frontend

Frontend ArchitectureFormsLoading SkeletonsComponentsPWA & NotificationsimageScreenshots

API Reference

API Reference

Endpoints

POS Sales APIOptimization Data APISchedule Shifts APIEmployee Export APIReports APIIncidents APIAI Chat APIPush Notifications APIWebhooks APICron API

Contributing

ContributingcodeCode Examples

Security

Security & Compliance
Danvas IconDanvas
Danvas IconDanvas

Pre-Shift & Compliance

Staff rostering, sales goals, and compliance tracking

Danvas compliance tracks whether staff file their required shift reports. Combined with pre-shift setup, it ensures accountability across your organization.

Pre-Shift Setup

Managers create pre-shift assignments that roster staff and set sales goals:

  1. Manager navigates to Reports → Pre-Shift
  2. Sets date and shift (morning/afternoon/evening)
  3. Selects staff members to roster
  4. Sets sales goals per staff member
  5. Submits via createPreShift() server action

What Happens on Creation

When a pre-shift is created:

  1. Shift goal stored in shiftGoals table
  2. Compliance rows auto-generated for each assignee with filed: false
  3. Slack notification sent to assigned staff via buildPreshiftBlocks()
  4. Audit log entry created (preshift.created)

Staff Notifications

Staff receive a Slack message with:

  • Shift date and time
  • Sales goals
  • Roster information
  • Read receipt tracking via preshiftReads table

Compliance Tracking

Compliance rows track filing status for each staff member per shift:

Database Schema

Analytics

Organization-wide metrics and performance dashboards

Incident Reporting

Real-time incident reporting with escalation workflows

On this page

Pre-Shift SetupWhat Happens on CreationStaff NotificationsCompliance TrackingDatabase SchemaUnique ConstraintFiling a ReportCompliance DashboardMissing Report RemindersDaily Reminder (8PM UTC)Live Compliance Checks (Every 15 Minutes)ConfigurationEnvironmentCompliance ReportsRelated Files
interface ComplianceRow {
  id: string;
  teamId: string;
  userId: string;
  date: string;           // ISO date
  shift: 'morning' | 'afternoon' | 'evening';
  filed: boolean;         // Default false
  reportId?: string;      // References reports.id when filed
  filedAt?: timestamp;
  remindedAt

Unique Constraint

Each (userId, date, shift) combination must be unique — prevents duplicate compliance entries.

Filing a Report

When a staff member submits a shift report via submitReport():

  1. Report inserted/updated in reports table
  2. Compliance row found matching (userId, date, shift)
  3. Row updated: filed: true, reportId set, filedAt timestamp
  4. Audit log entry created

Compliance Dashboard

Admins view compliance status at Reports → Compliance:

  • Color-coded status: green (filed), yellow (pending), red (missing)
  • Filter by date range and shift
  • Shows filed/total counts per location
  • Drill down to see which staff haven't filed

Missing Report Reminders

Daily Reminder (8PM UTC)

A daily cron job finds missing reports and sends Slack reminders:

  1. Query compliance table for yesterday's rows where filed: false
  2. Update each row with remindedAt: now
  3. Map user IDs to names via users table
  4. Post to Slack missing-reports channel

Live Compliance Checks (Every 15 Minutes)

During operating hours (2PM–4AM UTC), an additional cron job checks for unfiled staff and manager reports in real-time:

  1. Queries compliance rows where filed=false and remindedAt is null or older than 1 hour
  2. Updates all matched rows to set remindedAt = now()
  3. Sends separate Slack nudges to the reports and manager-reports channels

This ensures staff receive timely reminders without being spammed — the 1-hour cooldown prevents repeated pings for the same unfiled report.

⚠️ 3 missing report(s) for 2024-01-15

• John D. — morning shift
• Sarah M. — afternoon shift
• Mike R. — evening shift

Configuration

SLACK_WEBHOOK_MISSING_REPORTS=https://hooks.slack.com/services/...

Environment

The cron is protected by a bearer token:

CRON_SECRET=<generated-with-openssl-rand-hex-32>

Compliance Reports

The admin compliance page (/admin/compliance) shows:

MetricDescription
Compliance RatePercentage of reports filed on time
Missing CountNumber of unfiled reports
Reminder CountHow many reminders sent
TrendWeek-over-week comparison

Related Files

FilePurpose
apps/app/app/(authenticated)/reports/preshift/actions.tsPre-shift creation, compliance generation
apps/app/app/(authenticated)/reports/actions.tsReport submission, compliance update
apps/app/app/(authenticated)/admin/compliance/actions.tsCompliance queries
apps/app/app/(authenticated)/admin/compliance/page.tsxAdmin compliance dashboard UI
apps/api/app/cron/report-reminder/route.tsDaily cron for reminders
packages/database/src/schema/Domain-split schema modules (compliance, preshiftReads)
packages/slack/templates/preshift.tsPre-shift Slack notifications
?:
timestamp
;
// When reminder was sent
}