From 1cf104aafe89c7b721eed32aa8eddf57588265ae Mon Sep 17 00:00:00 2001 From: Eckerman Date: Wed, 13 Sep 2023 12:55:12 -0700 Subject: [PATCH 1/4] limit grade options for schl/dist view --- .../components/common/forms/SchoolDetailsForm.vue | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/common/forms/SchoolDetailsForm.vue b/frontend/src/components/common/forms/SchoolDetailsForm.vue index 072e78f06..1e8652f15 100644 --- a/frontend/src/components/common/forms/SchoolDetailsForm.vue +++ b/frontend/src/components/common/forms/SchoolDetailsForm.vue @@ -445,7 +445,7 @@ v-if="isGradeOfferedUpdateAllowed && editing" id="schoolGrades" v-model="schoolDetailsCopy.grades" - :items="gradeCodes" + :items="gradeOptions" item-title="label" item-value="schoolGradeCode" variant="underlined" @@ -1089,6 +1089,17 @@ export default { isGradeOfferedUpdateAllowed() { return this.school.schoolCategoryCode !== 'INDP_FNS' && this.school.schoolCategoryCode !== 'INDEPEND'; }, + gradeOptions(){ + const gradeOptionList = []; + for (let i=0; i < this.gradeCodes.length; i++){ + if((this.school.schoolCategoryCode !== 'INDP_FNS' && this.school.schoolCategoryCode !== 'INDEPEND' && this.gradeCodes[i].schoolGradeCode === 'KINDHALF') || + (this.gradeCodes[i].schoolGradeCode === 'ELEMUNGR' || this.gradeCodes[i].schoolGradeCode === 'SECUNGR')){ + continue; + } + gradeOptionList.push(this.gradeCodes[i]); + } + return gradeOptionList; + } }, watch: { schoolDetailsFormValid(value) { From 676943ad2816007b209ec92a2446ac5ae3cb1d0f Mon Sep 17 00:00:00 2001 From: Eckerman Date: Wed, 13 Sep 2023 15:23:38 -0700 Subject: [PATCH 2/4] untested grade options getter in institute --- .../src/components/common/forms/SchoolDetailsForm.vue | 10 +--------- frontend/src/store/modules/institute.js | 3 ++- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/frontend/src/components/common/forms/SchoolDetailsForm.vue b/frontend/src/components/common/forms/SchoolDetailsForm.vue index 1e8652f15..8fb9f6d12 100644 --- a/frontend/src/components/common/forms/SchoolDetailsForm.vue +++ b/frontend/src/components/common/forms/SchoolDetailsForm.vue @@ -1062,6 +1062,7 @@ export default { ...mapState(instituteStore, ['provinceCodes']), ...mapState(instituteStore, ['countryCodes']), ...mapState(instituteStore, ['gradeCodes']), + ...mapState(instituteStore, ['gradeOptions']), dataReady: function () { return this.userInfo; }, @@ -1397,15 +1398,6 @@ export default { }); } }, - sortGrades() { - const gradeList = []; - for (const grade of this.schoolGradeTypes) { - if (this.schoolDetailsCopy.grades.find((rawGrade) => rawGrade.schoolGradeCode === grade.schoolGradeCode)) { - gradeList.push(grade); - } - } - this.schoolDetailsCopy.grades = gradeList; - }, } }; diff --git a/frontend/src/store/modules/institute.js b/frontend/src/store/modules/institute.js index 58a672d7a..d8484ca43 100644 --- a/frontend/src/store/modules/institute.js +++ b/frontend/src/store/modules/institute.js @@ -40,7 +40,8 @@ export const instituteStore = defineStore('institute', { activeCountryCodesGet: state => state.activeCountryCodes, independentAuthoritySchoolContacts: state => state.schoolContactTypeCodes?.filter(type => !type.offshoreOnly), offshoreSchoolContacts: state => state.schoolContactTypeCodes?.filter(type => !type.indOnly), - regularSchoolContactTypes: state => state.schoolContactTypeCodes?.filter(type => !type.indOnly && !type.offshoreOnly) + regularSchoolContactTypes: state => state.schoolContactTypeCodes?.filter(type => !type.indOnly && !type.offshoreOnly), + gradeOptions: state => state.gradeCodes.filter(grade => !['KINDHALF', 'ELEMENUNGR', 'SECUNGR'].includes(grade) ) }, actions: { async setFacilityTypeCodes(facilityTypeCodes) { From 36e41b85fd39ee6566f154a0fdb020ffd8249f0e Mon Sep 17 00:00:00 2001 From: Eckerman Date: Wed, 13 Sep 2023 15:59:10 -0700 Subject: [PATCH 3/4] add back in sort --- .../src/components/common/forms/SchoolDetailsForm.vue | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frontend/src/components/common/forms/SchoolDetailsForm.vue b/frontend/src/components/common/forms/SchoolDetailsForm.vue index 8fb9f6d12..6914daef8 100644 --- a/frontend/src/components/common/forms/SchoolDetailsForm.vue +++ b/frontend/src/components/common/forms/SchoolDetailsForm.vue @@ -1398,6 +1398,15 @@ export default { }); } }, + sortGrades() { + const gradeList = []; + for (const grade of this.schoolGradeTypes) { + if (this.schoolDetailsCopy.grades.find((rawGrade) => rawGrade.schoolGradeCode === grade.schoolGradeCode)) { + gradeList.push(grade); + } + } + this.schoolDetailsCopy.grades = gradeList; + }, } }; From 7383e5b723535d1c82bb05d45fecf08fec89b9bd Mon Sep 17 00:00:00 2001 From: Eckerman Date: Thu, 14 Sep 2023 15:08:29 -0700 Subject: [PATCH 4/4] move grade options creation to institute module --- .../components/common/forms/SchoolDetailsForm.vue | 13 +------------ frontend/src/store/modules/institute.js | 2 +- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/frontend/src/components/common/forms/SchoolDetailsForm.vue b/frontend/src/components/common/forms/SchoolDetailsForm.vue index 6914daef8..1cec8cbd2 100644 --- a/frontend/src/components/common/forms/SchoolDetailsForm.vue +++ b/frontend/src/components/common/forms/SchoolDetailsForm.vue @@ -1089,17 +1089,6 @@ export default { }, isGradeOfferedUpdateAllowed() { return this.school.schoolCategoryCode !== 'INDP_FNS' && this.school.schoolCategoryCode !== 'INDEPEND'; - }, - gradeOptions(){ - const gradeOptionList = []; - for (let i=0; i < this.gradeCodes.length; i++){ - if((this.school.schoolCategoryCode !== 'INDP_FNS' && this.school.schoolCategoryCode !== 'INDEPEND' && this.gradeCodes[i].schoolGradeCode === 'KINDHALF') || - (this.gradeCodes[i].schoolGradeCode === 'ELEMUNGR' || this.gradeCodes[i].schoolGradeCode === 'SECUNGR')){ - continue; - } - gradeOptionList.push(this.gradeCodes[i]); - } - return gradeOptionList; } }, watch: { @@ -1401,7 +1390,7 @@ export default { sortGrades() { const gradeList = []; for (const grade of this.schoolGradeTypes) { - if (this.schoolDetailsCopy.grades.find((rawGrade) => rawGrade.schoolGradeCode === grade.schoolGradeCode)) { + if (this.schoolDetailsCopy.grades.find((rawGrade) => rawGrade.schoolGradeCode === grade.schoolGradeCode )) { gradeList.push(grade); } } diff --git a/frontend/src/store/modules/institute.js b/frontend/src/store/modules/institute.js index d8484ca43..df6c28401 100644 --- a/frontend/src/store/modules/institute.js +++ b/frontend/src/store/modules/institute.js @@ -41,7 +41,7 @@ export const instituteStore = defineStore('institute', { independentAuthoritySchoolContacts: state => state.schoolContactTypeCodes?.filter(type => !type.offshoreOnly), offshoreSchoolContacts: state => state.schoolContactTypeCodes?.filter(type => !type.indOnly), regularSchoolContactTypes: state => state.schoolContactTypeCodes?.filter(type => !type.indOnly && !type.offshoreOnly), - gradeOptions: state => state.gradeCodes.filter(grade => !['KINDHALF', 'ELEMENUNGR', 'SECUNGR'].includes(grade) ) + gradeOptions: state => state.gradeCodes?.filter(grade => !['KINDHALF', 'ELEMUNGR', 'SECUNGR'].includes(grade.schoolGradeCode)) }, actions: { async setFacilityTypeCodes(facilityTypeCodes) {