Commit Graph

13 Commits

Author SHA1 Message Date
jason
95d56b5018 feat: custom violation types — persist, manage, and use in violation form
Adds a full CRUD system for user-defined violation types stored in a new
violation_types table. Custom types appear in the violation dropdown alongside
hardcoded types, grouped by category, with ✦ marker and a green Custom badge.

- db/database.js: auto-migration adds violation_types table on startup
- server.js: GET/POST/PUT/DELETE /api/violation-types; type_key auto-generated
  as custom_<slug>; DELETE blocked if any violations reference the type
- ViolationTypeModal.jsx: create/edit modal with name, category (datalist
  autocomplete from existing categories), handbook chapter reference,
  description/reference text, fixed vs sliding point toggle, context field
  checkboxes; delete with usage guard
- ViolationForm.jsx: fetches custom types on mount; merges into dropdown via
  mergedGroups memo; resolveViolation() checks hardcoded then custom; '+ Add
  Type' button above dropdown; 'Edit Type' button appears when a custom type is
  selected; newly created type auto-selects; all audit calls flow through
  existing audit() helper

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 16:23:21 -05:00
51bf176f96 feat: load version.json at startup, expose via /api/health 2026-03-08 00:54:58 -06:00
7ef00796bd feat: serve demo/ folder as static route at /demo
Adds express.static middleware for the demo/ directory mounted at /demo,
placed before the SPA catch-all so /demo/index.html resolves to the
standalone stakeholder demo page instead of the React app.
2026-03-07 23:59:00 -06:00
979e9724e0 fix: score endpoint now returns total_violations and negated_count
The /api/employees/:id/score endpoint previously only returned data from
the active_cpas_scores view (active_points + violation_count for the 90-day
window). The EmployeeModal score cards reference total_violations and
negated_count which were undefined, causing blank displays.

Now queries the violations table directly for all-time totals alongside
the rolling 90-day active data.
2026-03-07 22:01:35 -06:00
b4edcdc945 feat: accept acknowledged_by/acknowledged_date in violation creation and amendment
- POST /api/violations now accepts acknowledged_by and acknowledged_date
- Both fields added to AMENDABLE_FIELDS whitelist for post-submission edits
- Acknowledgment data persisted to DB and passed through to PDF generation
2026-03-07 21:32:15 -06:00
b02464330b feat: add expiration timeline endpoint and notes field to employee endpoints 2026-03-07 09:42:59 -06:00
5004c56915 feat: employee edit/merge, violation amendment, audit log endpoints 2026-03-07 09:23:04 -06:00
4bb09997ee Upload files to "/" 2026-03-06 17:59:48 -06:00
fdfa0bcf2f Upload files to "/" 2026-03-06 14:42:12 -06:00
333cad41d7 Phase 4 2026-03-06 12:53:40 -06:00
62b142d4a3 Phase 3 2026-03-06 12:19:55 -06:00
13f6c9d164 Phase 2 2026-03-06 12:02:52 -06:00
45d785964d Initial commit of Docker project 2026-03-06 11:33:32 -06:00