intake: guard category/officer/jurisdiction step scripts when hoisted

This commit is contained in:
justin 2026-06-02 13:16:48 -05:00
parent 4e916821c6
commit bb3604c97b
3 changed files with 6 additions and 0 deletions

View file

@ -172,6 +172,7 @@ import { LINE_105_CATALOG, LINE_105_BY_ID } from "../../../lib/line_105_catalog"
<script>
import { LINE_105_CATALOG, LINE_105_BY_ID } from "../../../lib/line_105_catalog";
if (document.querySelector('[data-slug="category"], [data-step="category"]')) {
const err = document.getElementById("pw-cat-err") as HTMLDivElement;
const wizard = document.getElementById("pw-wizard") as HTMLDivElement | null;
const result = document.getElementById("pw-result") as HTMLDivElement | null;
@ -476,4 +477,5 @@ import { LINE_105_CATALOG, LINE_105_BY_ID } from "../../../lib/line_105_catalog"
});
} // end of: if (!wizard) {} else {
}
</script>

View file

@ -93,6 +93,7 @@
</style>
<script>
if (document.querySelector('[data-slug="jurisdiction"], [data-step="jurisdiction"]')) {
const STATES = [
"AL","AK","AS","AZ","AR","CA","CO","CT","DE","DC","FL","GA","GU","HI",
"ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO",
@ -265,4 +266,5 @@
const st = PW.get();
PW.set({ entity: { ...st.entity, jurisdictions_served: selected } });
});
}
</script>

View file

@ -111,6 +111,7 @@
</style>
<script>
if (document.querySelector('[data-slug="officer"], [data-step="officer"]')) {
const g = <T extends HTMLElement>(id: string) => document.getElementById(id) as T;
const count = g<HTMLSelectElement>("pw-officer-count");
const o2wrap = g<HTMLElement>("pw-o2-wrap");
@ -308,4 +309,5 @@
officer_count_claimed: n,
});
});
}
</script>