Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MIN | All Students by District and Independent School Reports | Filter Panel | Add additional filter options to the filter panel. #2073

Merged
merged 2 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion backend/src/components/sdc/sdc.js
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,20 @@ async function getSdcDistrictCollections(req, res) {
}
}

async function getSdcSchoolCollectionsFromSdcDistrictCollectionID(req, res) {
try {
const data = await getData(`${config.get('sdc:districtCollectionURL')}/${req.params.sdcDistrictCollectionID}/sdcSchoolCollections`);

data?.forEach(value => {
value.schoolName = getSchoolName(cacheService.getSchoolBySchoolID(value.schoolID));
});
return res.status(HttpStatus.OK).json(data);
} catch (e) {
await logApiError(e, 'getSdcSchoolCollectionBySdcDistrictCollectionId', 'error getSdcSchoolCollectionBySdcDistrictCollectionId');
return errorResponse(res);
}
}

async function downloadSdcReport(req, res) {
const reportTypeValues = [
['csv_school', 'ALL_STUDENT_SCHOOL_CSV'],
Expand Down Expand Up @@ -962,5 +976,6 @@ module.exports = {
downloadSdcReport,
updateBandCode,
moveSld,
getDistrictHeadcounts
getDistrictHeadcounts,
getSdcSchoolCollectionsFromSdcDistrictCollectionID
};
3 changes: 2 additions & 1 deletion backend/src/routes/sdc.js

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

149 changes: 129 additions & 20 deletions frontend/src/components/common/Filters.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,21 @@
<span>Name and ID Filtering</span>

<v-tooltip content-class="customTooltip">
<template #activator="{ props: tooltipProps }">
<v-icon
v-bind="tooltipProps"
size="25"
color="#003366"
style="align-self: center;"
>
mdi-help-circle
</v-icon>
</template>
<span id="penLocalIdNameFilterTooltip">
The search button must be used to apply changes to PEN or Local ID or Name searches. All other filters will apply on change without use of the search button.
</span>
</v-tooltip>
<template #activator="{ props: tooltipProps }">
<v-icon
v-bind="tooltipProps"
size="25"
color="#003366"
style="align-self: center;"
>
mdi-help-circle
</v-icon>
</template>
<span id="penLocalIdNameFilterTooltip">
The search button must be used to apply changes to PEN or Local ID or Name searches. All other filters will apply on change without use of the search button.
</span>
</v-tooltip>
</v-col>

</v-row>
<v-row>
<v-col
Expand Down Expand Up @@ -194,9 +193,11 @@
School and District Filtering
</v-col>
</v-row>
<v-row
>
<v-col cols="6" class="pt-0">
<v-row>
<v-col
cols="6"
class="pt-0"
>
<v-row v-if="false">
<v-text-field
id="searchInput"
Expand Down Expand Up @@ -225,7 +226,10 @@
/>
</slot>
</v-col>
<v-col cols="6" class="pt-0">
<v-col
cols="6"
class="pt-0"
>
<slot
name="text-search"
>
Expand All @@ -247,6 +251,41 @@
</v-col>
</v-row>
</div>
<div v-if="isDistrict === true">
<v-row>
<v-col
id="schoolFilters"
class="filter-heading pb-0"
>
School Filtering
</v-col>
</v-row>
<v-row>
<v-col
cols="6"
class="pt-0"
>
<slot
name="text-search"
>
<v-autocomplete
id="selectSchool"
v-model="schoolNameNumberFilterForDistrict"
variant="underlined"
:items="schoolSearchNamesForDistrict"
color="#003366"
label="School Name or Number"
single-line
:clearable="true"
item-title="schoolCodeName"
item-value="sdcSchoolCollectionID"
autocomplete="off"
@update:model-value="setSchoolNameNumberFilterForDistrict('schoolNameNumber', $event)"
/>
</slot>
</v-col>
</v-row>
</div>
<div
v-for="(filter, key) in filters"
:key="key"
Expand Down Expand Up @@ -282,6 +321,20 @@
</v-btn>
</div>
</v-btn-toggle>
<v-col v-if="key === 'bandCode'">
<v-autocomplete
id="bandCode"
v-model="bandCodeValue"
label="Band of Residence"
variant="underlined"
:items="sdcCollection.bandCodes"
item-value="bandCode"
item-title="dropdownText"
class="mt-n7 mb-n8"
clearable
@update:model-value="setBandCodeFilter('bandResidence', $event)"
/>
</v-col>
<v-col v-if="key === 'courses'">
<v-range-slider
id="courses-slider"
Expand Down Expand Up @@ -345,6 +398,7 @@ import {appStore} from '@/store/modules/app';
import {edxStore} from '@/store/modules/edx';
import {authStore} from '@/store/modules/auth';
import {mapState} from 'pinia';
import {sdcCollectionStore} from '@/store/modules/sdcCollection';

export default {
name: 'Filters',
Expand Down Expand Up @@ -378,6 +432,11 @@ export default {
required: false,
default: null
},
isDistrict: {
type: Boolean,
required: false,
default: false
},
},
emits: ['clearFilters', 'apply-filters', 'close'],
data() {
Expand All @@ -388,6 +447,7 @@ export default {
courseRange: [0, 15],
penLocalIdNameFilter: null,
schoolNameNumberFilter: null,
schoolNameNumberFilterForDistrict: null,
districtNameNumberFilter: null,
legalFirstName: null,
legalMiddleNames: null,
Expand All @@ -399,7 +459,9 @@ export default {
assignedPen: null,
localID: null,
schoolSearchNames: [],
schoolSearchNamesForDistrict: [],
districtSearchNames: [],
sdcCollection: sdcCollectionStore(),
};
},
computed: {
Expand Down Expand Up @@ -427,6 +489,9 @@ export default {
Object.keys(this.filters).forEach(key => {
this.selected[key] = [];
});
if (this.isDistrict) {
this.setupSchoolListForDistrict(this.indySchoolDistrictObject.id);
}
},
methods: {
setupSchoolList(){
Expand All @@ -449,6 +514,27 @@ export default {
console.error(error);
});
},
setupSchoolListForDistrict(sdcDistrictCollectionID){
this.schoolSearchNames = [];
ApiService.apiAxios.get(`${Routes.sdc.SDC_DISTRICT_COLLECTION}/${sdcDistrictCollectionID}/sdcSchoolCollections`)
.then((res) => {
res.data.forEach(schoolCollection => {
const school = this.schoolsMap.get(schoolCollection.schoolID);
if (school) {
let schoolItem = {
schoolCodeName: school.schoolName + ' - ' + school.mincode,
schoolID: school.schoolID,
districtID: school.districtID
};
this.schoolSearchNames.push(schoolItem);
}
});
this.schoolSearchNamesForDistrict = sortBy(this.schoolSearchNames, ['schoolCodeName']);
})
.catch(error => {
console.error(error);
});
},
setupDistrictList(){
this.schoolSearchNames = [];
ApiService.apiAxios.get(`${Routes.sdc.BASE_URL}/collection/${this.$route.params.collectionID}/sdcDistrictCollections`)
Expand Down Expand Up @@ -503,6 +589,16 @@ export default {
this.apply();
}
},
setSchoolNameNumberFilterForDistrict(key, $event) {
this.setPenLocalIdNameFilter($event, null);
if($event) {
this.selected[key] = [{title: 'SchoolNameOrNumber', value: $event}];
this.apply();
} else {
delete this.selected[key];
this.apply();
}
},
setDistrictNameNumberFilter(key, $event) {
this.setPenLocalIdNameFilter($event, null);
if($event) {
Expand Down Expand Up @@ -561,7 +657,20 @@ export default {
},
apply() {
this.$emit('apply-filters', this.selected);
}
},
setBandCodeFilter(key, $event){
if (this.penLocalIdNameFilter != null) {
if (this.penLocalIdNameFilter.length > 0) this.selected['penLocalIdNameFilter'] = [{title: 'PenOrLocalIdOrName', value: this.penLocalIdNameFilter}];
else delete this.selected['penLocalIdNameFilter'];
}
if($event) {
this.selected[key] = [{title: this.sdcCollection.bandCodes.find(value => value.bandCode === $event).dropdownText, value: $event}];
this.apply();
} else {
delete this.selected[key];
this.apply();
}
},
}
};
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
:filters="config.allowedFilters"
:collection-object="collectionObject"
:indy-school-district-object="indySchoolDistrictObject"
:is-district="isDistrict"
@apply-filters="applyFilters"
@clear-filters="clearFilters"
@close="showFilters= !showFilters"
Expand Down Expand Up @@ -146,6 +147,11 @@ export default {
required: false,
default: () => null
},
isDistrict: {
type: Boolean,
required: false,
default: false
},
showExportBtn: {
type: Boolean,
required: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
:config="indySchoolsNameNumberFilter != null ? configSchools : configDistricts"
:collection-object="collectionObject"
:indy-school-district-object="indySchoolDistrictObject"
:is-district="isDistrict"
:show-export-btn="true"
:read-only="true"
/>
Expand Down Expand Up @@ -84,6 +85,7 @@ export default {
configDistricts: FTE_DISTRICT,
configSchools: FTE_SCHOOL,
indySchoolDistrictObject: null,
isDistrict: false,
};
},
computed: {
Expand All @@ -99,8 +101,10 @@ export default {
setIndySchoolsDistrictsNameNumberFilter(key, $event) {
if ($event) {
this.indySchoolDistrictObject = { type: key, id: $event };
this.isDistrict = key === 'district';
} else {
this.indySchoolDistrictObject = null;
this.isDistrict = false;
}
},
setupIndySchoolsDistrictsList() {
Expand Down
Loading
Loading