Add audit template versioning and multi-year audit lifecycle#6
Open
jonbur wants to merge 6 commits into
Open
Conversation
Introduce version + revision on AuditTemplate (RELEASE vs PATCH) so question sets can evolve atomically or be corrected in place. Each audit is pinned to a template revision and compliance year, with a sectionsSnapshot frozen on completion so historical answers stay stable. Draft audits sync to the latest active template revision; completed audits are read-only. The audit start page shows template info and per-year history, and the wizard supports finishing an audit when all sections are complete. Co-authored-by: jonbur <jonbur@users.noreply.github.com>
Use auditDate (PostgreSQL DATE) instead of auditYear so audits are not tied to calendar years. Multiple audits can exist for any date; only one draft at a time is still enforced. The start panel lets users pick the audit date, defaulting to today. Co-authored-by: jonbur <jonbur@users.noreply.github.com>
The button was disabled until React re-rendered after radio selection, and focus changes from radio inputs could swallow the first mouse click. Validate on press instead of disabling, and handle mouse activation on pointer down. Co-authored-by: jonbur <jonbur@users.noreply.github.com>
Toggle fields now update on pointer down so values are set before Continue is pressed. The wizard also auto-saves to the API on each step and keeps a form ref so the latest answers are always persisted. Co-authored-by: jonbur <jonbur@users.noreply.github.com>
Re-merge the actions summary/editor from the actions-tracker branch: home page link, /premises/[id]/actions page, ActionTracker, PremisesNav tabs, and shared lib/actions API helpers. Co-authored-by: jonbur <jonbur@users.noreply.github.com>
- AuditsManager: historic audits table, status filter, start audit against chosen template - TemplateManager: upload JSON templates, publish releases, activate catalog entries - API routes for audit-templates list/import and template activation - startNewAudit accepts optional templateId; premises audit API returns template catalog - Nav and home links to /templates and updated Audits page Co-authored-by: jonbur <jonbur@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two management surfaces for audits and templates:
Audits (
/premises/[id]/audit)Templates (
/templates)API
GET/POST /api/audit-templates— list catalog, import releasePOST /api/audit-templates/[templateId]/activate— set active templateGET/POST /api/premises/[id]/audit— returns templates list; start acceptstemplateIdOther
AuditStartPanelin favor ofAuditsManager