Objective
- Provide a supported path to hide a signed agreement (archive or equivalent) and still add a new instance of the same agreement template on the same work order for the client to sign—without unsafe workarounds.
Background
- Archiving hides an agreement from the client portal and default lists but does not remove its template from Add Agreement dedupe:
existingTemplateIdsinattik-frontend/src/app/tools/inspections/[id]/components/Agreements.tsxandAddAgreementModal.tsxstill treats archived agreements as blocking the template. - The primary “new version” path today is Recreate Outdated when an agreement is stale—there is no general product flow for “same template, new signature” after hiding a non-stale signed agreement.
- Regenerate in the UI is not aimed at replacing signed agreements in place. Manual API duplication (
POSTpaths underattik-backend/src/routes/agreements.ts) can create multiple rows; the gap is consistent product rules (dedupe, portal visibility, locks, activity).
Scope
Frontend (attik-frontend)
src/app/tools/inspections/[id]/components/Agreements.tsxandAddAgreementModal.tsx— template dedupe and add flows.
Backend (attik-backend)
src/routes/agreements.ts,src/models/agreementSchema.js/ agreement templates — archive visibility, portal queries, and creation endpoints.
References
attik-frontend/src/app/tools/inspections/[id]/components/Agreements.tsxattik-frontend/src/app/tools/inspections/[id]/components/AddAgreementModal.tsxattik-backend/src/routes/agreements.ts