Skip to content

Commit

Permalink
Merge pull request #74 from bcgov/feature/intake-form-validation
Browse files Browse the repository at this point in the history
Yup validation for SHAS intake form
  • Loading branch information
kyle1morel authored May 21, 2024
2 parents 9b94430 + 98ddbf2 commit cdf13ee
Show file tree
Hide file tree
Showing 16 changed files with 643 additions and 52 deletions.
6 changes: 0 additions & 6 deletions app/src/db/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,3 @@ model user {
@@index([identity_id], map: "user_identity_id_index")
@@index([username], map: "user_username_index")
}

enum yes_no_unsure {
Yes
No
Unsure
}
31 changes: 20 additions & 11 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"pinia-plugin-persistedstate": "^3.2.1",
"primeflex": "^3.3.1",
"primeicons": "^6.0.1",
"primevue": "3.50.0",
"primevue": "3.52.0",
"qrcode.vue": "^3.4.1",
"quill": "^2.0.0",
"uuid": "^9.0.1",
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/assets/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@ label {
}
}

.app-error-color {
color: $app-error !important;
}

.app-error-message {
color: $app-error;
font-size: 0.8rem;
}

/* ---------- primevue overrides ------------ */

/* buttons */
Expand Down
1 change: 1 addition & 0 deletions frontend/src/assets/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 5 additions & 2 deletions frontend/src/components/form/Dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ const emit = defineEmits(['onChange']);
/>

<small :id="`${name}-help`">{{ helpText }}</small>
<div>
<ErrorMessage :name="name" />
<div class="mt-2">
<ErrorMessage
:name="name"
class="app-error-message"
/>
</div>
</div>
</template>
7 changes: 5 additions & 2 deletions frontend/src/components/form/InputMask.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ const props = withDefaults(defineProps<Props>(), {
/>

<small :id="`${name}-help`">{{ helpText }}</small>
<div>
<ErrorMessage :name="name" />
<div class="mt-2">
<ErrorMessage
:name="name"
class="app-error-message"
/>
</div>
</div>
</template>
7 changes: 5 additions & 2 deletions frontend/src/components/form/InputNumber.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@ const fieldActive: Ref<boolean> = ref(false);
>
{{ helpText }}
</small>
<div>
<ErrorMessage :name="name" />
<div class="mt-2">
<ErrorMessage
:name="name"
class="app-error-message"
/>
</div>
</div>
</template>
12 changes: 6 additions & 6 deletions frontend/src/components/form/InputText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ const fieldActive: Ref<boolean> = ref(false);

<template>
<div class="field">
<FloatLabel
v-if="props.floatLabel"
class="mb-3"
>
<FloatLabel v-if="props.floatLabel">
<InputTextInternal v-bind="props" />
</FloatLabel>
<InputTextInternal
Expand All @@ -52,8 +49,11 @@ const fieldActive: Ref<boolean> = ref(false);
>
{{ helpText }}
</small>
<div>
<ErrorMessage :name="name" />
<div class="mt-2">
<ErrorMessage
:name="name"
class="app-error-message"
/>
</div>
</div>
</template>
5 changes: 4 additions & 1 deletion frontend/src/components/form/Password.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ const { errorMessage, value } = useField<string>(toRef(props, 'name'));
/>
<small :id="`${name}-help`">{{ helptext }}</small>
<div>
<ErrorMessage :name="props.name" />
<ErrorMessage
:name="props.name"
class="app-error-message"
/>
</div>
</div>
</template>
7 changes: 5 additions & 2 deletions frontend/src/components/form/RadioList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,11 @@ watch(value, () => {
</div>

<small :id="`${name}-help`">{{ helpText }}</small>
<div>
<ErrorMessage :name="name" />
<div class="mt-2">
<ErrorMessage
:name="name"
class="app-error-message"
/>
</div>
</div>
</template>
Loading

0 comments on commit cdf13ee

Please sign in to comment.