Bug: after selecting Yes, entering a PID, then switching Set PID? to No, submit still showed a PID mandatory alert on Custom Cover Letter create (generate-cl). Fixed by syncing PID validators before submit and refreshing control validity on toggle (parity with view-cl edit flow). Time tracking could not start (ClickUp Advanced Time Tracking usage limit).
template_for_id === 1 (see generate-cl.component.ts).need_pid handling in cover letter modules.generate-cl) vs edit (view-cl) submit paths.syncNeedPidAndPidFieldBeforeSubmit and harden changeNeedPID on create.frontend-contract-portal-devsrc/app/modules/generate-cl/generate-cl.component.ts
syncNeedPidAndPidFieldBeforeSubmit() — aligns need_pid, need_pid_label, showPID, and pid validators with current Y/N selection before validation.saveCoverLetter() now calls sync before updateValueAndValidity / invalid-form Swal.changeNeedPID() now clears validators, nulls pid when No, patches need_pid_label, and calls updateValueAndValidity on the pid control (fixes stale required state after Yes → No).view-cl already had syncNeedPidAndPidFieldBeforeSubmit at submit; bug was specific to create flow.| Criterion | Verification |
|---|---|
| No PID mandatory alert when Set PID? = No after Yes → PID → No | Manual: Custom CL create → Yes → type PID → No → Submit or Save Draft — form should proceed without PID in invalid list |
| Yes still requires PID | Manual: Yes → empty PID → Submit — PID should appear in invalid modal |
| Edit draft path unaffected / consistent | view-cl already syncs on submit; spot-check edit if QA has bandwidth |
view-cl pattern.view-cl) before fix; edit path was already guarded.generate-cl (Custom, template_for_id=1).generate-cl.component.ts (IDE diagnostics).frontend-contract-portal-dev/src/app/modules/generate-cl/generate-cl.component.tsfrontend-contract-portal-dev/src/app/modules/view-cl/view-cl.component.ts (reference implementation)Inbox/clickup-execute-SYS-2012-2026-05-19.md during scheduled inbox triage (2026-05-19).Inbox/ (scheduled triage 2026-05-20); inbox copy used broken hub path Projects/contract-management-system/….