Skip to content

Commit

Permalink
fix(frontend): add a rule for numbers on shelter page #334
Browse files Browse the repository at this point in the history
closes #334
  • Loading branch information
guilbep committed Mar 25, 2024
1 parent aa6dbff commit 9ed6278
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@
<v-col>
<v-sheet v-if="localShelter" elevation="2" rounded>
<v-container fluid>
<v-form v-model="localShelter.completed_info">
<v-form
ref="form"
v-model="localShelter.completed_info"
:lazy-validation="false"
>
<v-row>
<v-col class="about-first-column" cols="6">
<v-text-field
Expand Down Expand Up @@ -149,13 +153,15 @@
required
:rules="numberRules"
label="Number of people for setup"
type="string"
@change="updateFormInput"
/>
<v-text-field
v-model.number="localShelter.setup_time"
name="setup_time"
required
:rules="numberRules"
type="string"
label="Time for setup (days)"
@change="updateFormInput"
/>
Expand Down Expand Up @@ -417,6 +423,7 @@ export default class Step1 extends Vue {
readonly attribution = attributionMap;
public updateFormInput(): void {
this.$refs.form?.validate();
const newShelter = cloneDeep(this.localShelter);
this.$emit("update:shelter", newShelter);
this.$emit("input", newShelter); // for v-model
Expand Down Expand Up @@ -509,6 +516,9 @@ export default class Step1 extends Vue {
(v: string | number): boolean | string => {
return (v !== undefined && v !== "") || `is required`;
},
(v: string | number): boolean | string => {
return Number.isInteger(v) || `should be an integer`;
},
];
shelterTypeRules = this.textRules;
Expand Down

0 comments on commit 9ed6278

Please sign in to comment.