Add validation to CPNI and STIR/SHAKEN intake steps
- CPNI: requires either clean compliance checkbox OR issues section opened - STIR/SHAKEN: requires selecting implementation status before advancing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
06143c51c2
commit
862c06a8fd
2 changed files with 26 additions and 1 deletions
|
|
@ -118,6 +118,17 @@
|
||||||
const PW = (window as any).PWIntake;
|
const PW = (window as any).PWIntake;
|
||||||
if (PW.steps[PW.get().step_index] !== "cpni_questions") return;
|
if (PW.steps[PW.get().step_index] !== "cpni_questions") return;
|
||||||
|
|
||||||
|
const errEl = document.getElementById("pw-cpni-err") as HTMLDivElement;
|
||||||
|
|
||||||
|
// Validate: if not clean, must have opened issues section
|
||||||
|
if (!cleanBox.checked && !issuesEl.open) {
|
||||||
|
errEl.hidden = false;
|
||||||
|
errEl.textContent = "Please either confirm clean compliance or expand the issues section and provide details.";
|
||||||
|
evt.preventDefault();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
errEl.hidden = true;
|
||||||
|
|
||||||
const g = (id: string) => (document.getElementById(id) as HTMLInputElement)?.value || "";
|
const g = (id: string) => (document.getElementById(id) as HTMLInputElement)?.value || "";
|
||||||
|
|
||||||
if (cleanBox.checked) {
|
if (cleanBox.checked) {
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,8 @@
|
||||||
|
|
||||||
<label class="pw-field">Upstream voice provider (if partial / robocall-mitigation-only)</label>
|
<label class="pw-field">Upstream voice provider (if partial / robocall-mitigation-only)</label>
|
||||||
<input type="text" id="pw-ss-upstream" class="pw-input" placeholder="e.g. Bandwidth.com, VoIP Innovations" />
|
<input type="text" id="pw-ss-upstream" class="pw-input" placeholder="e.g. Bandwidth.com, VoIP Innovations" />
|
||||||
|
|
||||||
|
<div id="pw-ss-err" class="pw-err" hidden></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
@ -31,6 +33,7 @@
|
||||||
.pw-help { color: #64748b; font-size: 0.9rem; margin-bottom: 1rem; }
|
.pw-help { color: #64748b; font-size: 0.9rem; margin-bottom: 1rem; }
|
||||||
.pw-field { display: block; font-weight: 600; margin: 0.8rem 0 0.2rem; font-size: 0.88rem; }
|
.pw-field { display: block; font-weight: 600; margin: 0.8rem 0 0.2rem; font-size: 0.88rem; }
|
||||||
.pw-input { width: 100%; padding: 0.5rem 0.7rem; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 0.93rem; }
|
.pw-input { width: 100%; padding: 0.5rem 0.7rem; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 0.93rem; }
|
||||||
|
.pw-err { color: #b91c1c; margin-top: 0.75rem; font-size: 0.9rem; }
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
@ -45,8 +48,19 @@
|
||||||
window.addEventListener("pw:step-next", (evt: any) => {
|
window.addEventListener("pw:step-next", (evt: any) => {
|
||||||
const PW = (window as any).PWIntake;
|
const PW = (window as any).PWIntake;
|
||||||
if (PW.steps[PW.get().step_index] !== "stir_shaken") return;
|
if (PW.steps[PW.get().step_index] !== "stir_shaken") return;
|
||||||
|
|
||||||
|
const status = g<HTMLSelectElement>("pw-ss-status").value;
|
||||||
|
if (!status) {
|
||||||
|
const errEl = document.getElementById("pw-ss-err");
|
||||||
|
if (errEl) { errEl.hidden = false; errEl.textContent = "Please select your STIR/SHAKEN implementation status."; }
|
||||||
|
evt.preventDefault();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const errEl2 = document.getElementById("pw-ss-err");
|
||||||
|
if (errEl2) errEl2.hidden = true;
|
||||||
|
|
||||||
PW.patchIntakeData({
|
PW.patchIntakeData({
|
||||||
target_stir_shaken_status: g<HTMLSelectElement>("pw-ss-status").value,
|
target_stir_shaken_status: status,
|
||||||
sti_ca_vendor: g<HTMLInputElement>("pw-ss-vendor").value.trim(),
|
sti_ca_vendor: g<HTMLInputElement>("pw-ss-vendor").value.trim(),
|
||||||
upstream_provider_name: g<HTMLInputElement>("pw-ss-upstream").value.trim(),
|
upstream_provider_name: g<HTMLInputElement>("pw-ss-upstream").value.trim(),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue