Skip to content

Commit

Permalink
Merge pull request #1842 from bcgov/feature/pagination
Browse files Browse the repository at this point in the history
Fixes for optional phone numbers
  • Loading branch information
trev-dev authored Dec 15, 2023
2 parents 9337586 + 82c4446 commit 1f370ac
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
class="pt-0"
item-value="schoolContactTypeCode"
label="School Contact Type"
@update:model-value="validateForm"
/>
<v-text-field
id="editSchoolContactFirstNameInput"
Expand Down Expand Up @@ -63,7 +64,7 @@
<v-text-field
id="editSchoolContactPhoneNumberInput"
v-model="editContact.phoneNumber"
:rules="[rules.required(), rules.phoneNumber()]"
:rules="[rules.requiredIf(isOffshoreContact), rules.phoneNumber()]"
class="pt-0"
variant="underlined"
:maxlength="10"
Expand Down Expand Up @@ -188,20 +189,28 @@ export default {
schoolID: {
type: String,
required: true
},
school: {
type: Object,
required: true
}
},
emits: ['editSchoolContact:editSchoolContactSuccess', 'editSchoolContact:cancelEditSchoolContactPage'],
data() {
let clonedContact = _.cloneDeep(this.contact);
return {
isFormValid: false,
offshoreContactTypes: ['PRINCIPAL','VPRINCIPAL','STUDREGIS'],
processing: false,
editContact: clonedContact,
rules: Rules
};
},
computed: {
...mapState(authStore, ['isAuthenticated', 'userInfo']),
isOffshoreContact(){
return !(this.offshoreContactTypes.includes(this.editContact?.schoolContactTypeCode) && this.school.schoolCategoryCode === 'OFFSHORE');
}
},
mounted() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
class="pt-0"
item-value="schoolContactTypeCode"
label="School Contact Type"
@update:model-value="validateForm"
/>
<v-text-field
id="newContactFirstNameInput"
Expand Down Expand Up @@ -63,7 +64,7 @@
<v-text-field
id="newContactPhoneNumberInput"
v-model="newContact.phoneNumber"
:rules="[rules.required(), rules.phoneNumber()]"
:rules="[rules.requiredIf(isOffshoreContact), rules.phoneNumber()]"
class="pt-0"
variant="underlined"
:maxlength="10"
Expand Down Expand Up @@ -182,12 +183,17 @@ export default {
schoolID: {
type: String,
required: true
},
school: {
type: Object,
required: true
}
},
data() {
return {
isFormValid: false,
processing: false,
offshoreContactTypes: ['PRINCIPAL','VPRINCIPAL','STUDREGIS'],
newContact: {
schoolContactTypeCode: null,
firstName: null,
Expand All @@ -206,6 +212,9 @@ export default {
},
computed: {
...mapState(authStore, ['isAuthenticated', 'userInfo']),
isOffshoreContact(){
return !(this.offshoreContactTypes.includes(this.newContact?.schoolContactTypeCode) && this.school.schoolCategoryCode === 'OFFSHORE');
}
},
mounted() {
this.validateForm();
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/institute/common/SchoolContacts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
v-if="newContactSheet"
:school-contact-types="schoolContactTypes"
:school-i-d="$route.params.schoolID"
:school="school"
@newSchoolContact:closeNewSchoolContactPage="newContactSheet = !newContactSheet"
@newSchoolContact:addNewSchoolContact="newSchoolContactAdded"
/>
Expand All @@ -137,6 +138,7 @@
:contact="editContact"
:school-contact-types="schoolContactTypes"
:school-i-d="$route.params.schoolID"
:school="school"
@editSchoolContact:cancelEditSchoolContactPage="editContactSheet = !editContactSheet"
@editSchoolContact:editSchoolContactSuccess="contactEditSuccess"
/>
Expand Down

0 comments on commit 1f370ac

Please sign in to comment.