diff --git a/frontend/src/assets/variables.scss b/frontend/src/assets/variables.scss index d6cbdeef..0c1f42c7 100644 --- a/frontend/src/assets/variables.scss +++ b/frontend/src/assets/variables.scss @@ -11,6 +11,7 @@ $app-primary: #036; $app-link-text: #1a5a96; $app-link-text-hover: #00f; $app-outline-on-primary: #fff; +$app-error: #D8292F; // highlighted sections, table rows $app-highlight-background: #d9e1e8; diff --git a/frontend/src/components/form/Dropdown.vue b/frontend/src/components/form/Dropdown.vue index 7f65947d..45e6045c 100644 --- a/frontend/src/components/form/Dropdown.vue +++ b/frontend/src/components/form/Dropdown.vue @@ -53,7 +53,7 @@ const emit = defineEmits(['onChange']); /> {{ helpText }} -
+
diff --git a/frontend/src/components/form/InputMask.vue b/frontend/src/components/form/InputMask.vue index 1fefc7d3..b53d82e7 100644 --- a/frontend/src/components/form/InputMask.vue +++ b/frontend/src/components/form/InputMask.vue @@ -38,7 +38,7 @@ const props = withDefaults(defineProps(), { /> {{ helpText }} -
+
diff --git a/frontend/src/components/form/InputNumber.vue b/frontend/src/components/form/InputNumber.vue index badf86ce..62513e4c 100644 --- a/frontend/src/components/form/InputNumber.vue +++ b/frontend/src/components/form/InputNumber.vue @@ -57,7 +57,7 @@ const fieldActive: Ref = ref(false); > {{ helpText }} -
+
diff --git a/frontend/src/components/form/InputText.vue b/frontend/src/components/form/InputText.vue index ff2cc310..c094bb50 100644 --- a/frontend/src/components/form/InputText.vue +++ b/frontend/src/components/form/InputText.vue @@ -49,7 +49,7 @@ const fieldActive: Ref = ref(false); > {{ helpText }} -
+
diff --git a/frontend/src/components/form/RadioList.vue b/frontend/src/components/form/RadioList.vue index 2c2690ca..8f1eb429 100644 --- a/frontend/src/components/form/RadioList.vue +++ b/frontend/src/components/form/RadioList.vue @@ -63,7 +63,7 @@ watch(value, () => { {{ helpText }} -
+
diff --git a/frontend/src/components/intake/ShasIntakeForm.vue b/frontend/src/components/intake/ShasIntakeForm.vue index 83c9d8c3..3cccec69 100644 --- a/frontend/src/components/intake/ShasIntakeForm.vue +++ b/frontend/src/components/intake/ShasIntakeForm.vue @@ -32,14 +32,15 @@ import { useTypeStore } from '@/store'; import { ContactPreferenceList, NumResidentialUnits, + ProjectLocation, ProjectRelationshipList, RouteNames, YesNo, YesNoUnsure } from '@/utils/constants'; -import { BASIC_RESPONSES } from '@/utils/enums'; +import { BASIC_RESPONSES, INTAKE_FORM_CATEGORIES, PROJECT_LOCATION } from '@/utils/enums'; import { deepToRaw } from '@/utils/utils'; -import { getIntakeSchema } from './ShasIntakeSchema'; +import { intakeSchema } from './ShasIntakeSchema'; import type { Ref } from 'vue'; import Calendar from '../form/Calendar.vue'; @@ -52,26 +53,28 @@ const { getPermitTypes } = storeToRefs(typeStore); const activeStep: Ref = ref(0); const assignedActivityId: Ref = ref(undefined); const editable: Ref = ref(true); +const formRef: Ref | null> = ref(null); const geomarkAccordionIndex: Ref = ref(undefined); +const isSubmittable: Ref = ref(false); const initialFormValues: Ref = ref(undefined); const parcelAccordionIndex: Ref = ref(undefined); const spacialAccordionIndex: Ref = ref(undefined); - -// Enums -const enum PROJECT_LOCATION { - STREET_ADDRESS = 'Street address', - LOCATION_COORDINATES = 'Location coordinates' -} - -// Constants -const ProjectLocation = [PROJECT_LOCATION.STREET_ADDRESS, PROJECT_LOCATION.LOCATION_COORDINATES]; -const formSchema = getIntakeSchema(ProjectLocation); +const validationErrors: Ref = ref([]); // Actions const confirm = useConfirm(); const toast = useToast(); -function confirmSubmit(data: any) { +const checkSubmittable = (stepNumber: number) => { + if (stepNumber === 3) isSubmittable.value = true; +}; + +function displayErrors(a: any) { + validationErrors.value = Array.from(new Set(a.errors ? Object.keys(a.errors).map((x) => x.split('.')[0]) : [])); + document.getElementById('form')?.scrollIntoView({ behavior: 'smooth' }); +} + +function value(data: any) { confirm.require({ message: 'Are you sure you wish to submit this form? Please review the form before submitting.', header: 'Please confirm submission', @@ -134,21 +137,26 @@ onBeforeMount(async () => { typeStore.setPermitTypes((await permitService.getPermitTypes()).data); }); -const formRef: Ref | null> = ref(null);