Skip to content

Commit

Permalink
Merge pull request #999 from bcgov/feature/EDX-1272
Browse files Browse the repository at this point in the history
EDX-1272: SCH - See Headcount for Enrolment
  • Loading branch information
arcshiftsolutions authored Aug 28, 2023
2 parents 7022ad3 + 55b3d25 commit 44973d5
Show file tree
Hide file tree
Showing 7 changed files with 256 additions and 21 deletions.
25 changes: 24 additions & 1 deletion backend/src/components/sdc.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,28 @@ async function deleteSDCSchoolCollectionStudent (req, res) {
}
}

async function getStudentHeadcounts(req, res) {
try {
const token = getAccessToken(req);
validateAccessToken(token);
checkEDXCollectionPermission(req);
await validateEdxUserAccess(token, req, res, req.params.sdcSchoolCollectionID);

const params = {
params: {
type: req.query.type,
compare: req.query.compare
}
};

let headCounts = await getDataWithParams(token,`${config.get('sdc:schoolCollectionStudentURL')}/headcounts/${req.params.sdcSchoolCollectionID}`, params ,req.session?.correlationID);
return res.status(HttpStatus.OK).json(headCounts);
}catch (e) {
log.error('Error getting Student headcount.', e.stack);
return handleExceptionResponse(e, res);
}
}

async function validateEdxUserAccess(token, req, res, sdcSchoolCollectionID){
const urlGetCollection = `${config.get('sdc:rootURL')}/sdcSchoolCollection/${sdcSchoolCollectionID}`;
const sdcSchoolCollection = await getData(token, urlGetCollection, null);
Expand Down Expand Up @@ -292,5 +314,6 @@ module.exports = {
getSDCSchoolCollectionStudentSummaryCounts,
getSDCSchoolCollectionStudentDetail,
updateAndValidateSdcSchoolCollectionStudent,
deleteSDCSchoolCollectionStudent
deleteSDCSchoolCollectionStudent,
getStudentHeadcounts
};
4 changes: 3 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.

34 changes: 19 additions & 15 deletions frontend/src/components/common/CustomTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,27 +66,31 @@
</div>

<div v-else-if="column.key === 'isAdult'">
<span v-if="props.item.value['isAdult'] !== null || props.item.value['isAdult' !== undefined]">{{ props.item.value['isAdult'] ? 'Yes' :'No' }}</span>
<span v-if="props.item.value['isAdult'] !== null || props.item.value['isAdult' !== undefined]">{{ props.item.value['isAdult'] ==="true" ? 'Yes' :'No' }}</span>
</div>

<span v-else-if="props.item.value[column.key]">{{ props.item.value[column.key] }}</span>
<span v-else>-</span>
<div v-else-if="column.key === 'fte'">
<span>{{ props.item.value['fte'] === 0 ? 0 : props.item.value['fte'] }}</span>
</div>

<div v-if="column.hasOwnProperty('subHeader')">
<div v-if="column.subHeader.key === 'usualName'">
<div v-if="props.item.value['usualLastName'] || props.item.value['usualFirstName'] || props.item.value['usualMiddleNames']">
<span v-if="props.item.value['usualLastName']">{{ props.item.value['usualLastName'] }}</span>,
<span v-if="props.item.value['usualFirstName']">{{ props.item.value['usualFirstName'] }}</span>
<span v-if="props.item.value['usualMiddleNames']">({{ props.item.value['usualMiddleNames'] }})</span>
</div>
<span v-else>-</span>
</div>
<span v-else-if="props.item.value[column.subHeader.key]">{{ props.item.value[column.subHeader.key] }}</span>
<div v-else-if="column.subHeader.key === 'isGraduated'">
<span v-if="props.item.value['isGraduated'] !== null || props.item.value['isGraduated'] !== undefined">{{ props.item.value['isGraduated'] ? 'Yes' :'No' }}</span>
<span v-else-if="props.item.value[column.key]">{{ props.item.value[column.key] }}</span>
<span v-else>-</span>

<div v-if="column.hasOwnProperty('subHeader')">
<div v-if="column.subHeader.key === 'usualName'">
<div v-if="props.item.value['usualLastName'] || props.item.value['usualFirstName'] || props.item.value['usualMiddleNames']">
<span v-if="props.item.value['usualLastName']">{{ props.item.value['usualLastName'] }}</span>,
<span v-if="props.item.value['usualFirstName']">{{ props.item.value['usualFirstName'] }}</span>
<span v-if="props.item.value['usualMiddleNames']">({{ props.item.value['usualMiddleNames'] }})</span>
</div>
<span v-else>-</span>
</div>
<div v-else-if="column.subHeader.key === 'isGraduated'">
<span v-if="props.item.value['isGraduated'] !== null || props.item.value['isGraduated'] !== undefined">{{ props.item.value['isGraduated'] === "true" ? 'Yes' :'No' }}</span>
</div>
<span v-else-if="props.item.value[column.subHeader.key]">{{ props.item.value[column.subHeader.key] }}</span>
<span v-else>-</span>
</div>
</div>
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
</h2>
</v-col>
</v-row>
<v-row no-gutters class="mt-2 mb-2 d-flex justify-start">
<v-row
no-gutters
class="mt-2 mb-2 d-flex justify-start"
>
<v-col class="mt-1 d-flex justify-start">
<v-icon
small
Expand Down Expand Up @@ -97,7 +100,7 @@ import router from '../../router';
import {capitalize} from 'lodash';
export default {
name: 'sdcCollectionSummary',
name: 'SdcCollectionSummary',
components: {
DoughnutChart
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,23 @@
<div v-if="reportView === 'detail'">
<DetailComponent :config="config" />
</div>
<div v-if="reportView === 'summary'">
<SummaryComponent />
</div>
</v-container>
</template>

<script>
import alertMixin from '../../../mixins/alertMixin';
import DetailComponent from './DetailComponent.vue';
import SummaryComponent from './SummaryComponent.vue';
import { FTE } from '../../../utils/sdc/TableConfiguration';
export default {
name: 'FTEComponent',
components: {
DetailComponent
DetailComponent,
SummaryComponent
},
mixins: [alertMixin],
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
>
<v-tab
v-for="name in tabs"
class="divider"
:key="name"
class="divider"
:value="name"
>
{{ name }}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
<template>
<v-row>
<v-row v-if="isLoading">
<v-col
cols="12"
class="d-flex justify-center"
>
<v-progress-circular
class="mt-16"
:size="70"
:width="7"
color="primary"
indeterminate
:active="isLoading"
/>
</v-col>
</v-row>

<v-row v-else>
<v-col>
<v-row
justify="end"
class="mb-n6"
>
<v-col>
<v-switch
v-model="compareSwitch"
color="primary"
label="compare to previous September Collection"
style="justify-items: right;"
@update:modelValue="compare()"

Check warning on line 31 in frontend/src/components/sdcCollection/stepThreeVerifyData/SummaryComponent.vue

View workflow job for this annotation

GitHub Actions / test

v-on event '@update:modelValue' must be hyphenated
/>
</v-col>
</v-row>

<v-row class="mt-n6">
<v-slide-group
class="pa-4"
show-arrows
>
<v-slide-group-item
v-for="(header, index) in headcountHeaders"
:key="index"
>
<div class="border ma-1">
<v-row>
<v-col class="column-header">
{{ header.title }}
</v-col>
</v-row>

<v-row
align="center"
justify="space-around"
no-gutters
>
<div
v-for="key in header.orderedColumnTitles"
:key="key"
class="divider"
>
<v-col class="column-data">
<div>{{ key }} </div>
<span
v-if="header.columns[key].comparisonValue !== null"
class="compare-text"
>
{{ header.columns[key].comparisonValue }}
</span>
<span v-if="header.columns[key].comparisonValue !== null">
<v-icon
size="x-small"
:color="getStatusColor(header.columns[key].comparisonValue, header.columns[key].currentValue)"
>
{{ getComparisonIcon(header.columns[key].comparisonValue, header.columns[key].currentValue) }}
</v-icon>

</span>
<span>
{{ header.columns[key].currentValue }}
</span>
</v-col>
</div>
</v-row>
</div>
</v-slide-group-item>
</v-slide-group>
</v-row>
</v-col>
</v-row>
</v-row>
</template>

<script>
import alertMixin from '../../../mixins/alertMixin';
import ApiService from '../../../common/apiService';
import {ApiRoutes} from '../../../utils/constants';
export default {
name: 'SummaryComponent',
components: {
},
mixins: [alertMixin],
props: {
},
emits: [],
data() {
return {
isLoading: false,
headcountHeaders: [],
headcountTableDataList: [],
compareSwitch: false
};
},
mounted() {
this.getStudentHeadCounts();
},
created() {
},
methods: {
getStudentHeadCounts() {
this.isLoading= true;
ApiService.apiAxios.get(`${ApiRoutes.sdc.SDC_SCHOOL_COLLECTION_STUDENT}/getStudentHeadcounts/${this.$route.params.schoolCollectionID}`, {
params: {
type: 'enrollment',
compare: this.compareSwitch
}
}).then(response => {
this.headcountHeaders = response.data.headcountHeaders;
this.headcountTableDataList = response.data.headcountTableDataList;
}).catch(error => {
console.error(error);
this.setFailureAlert('An error occurred while trying to retrieve students list. Please try again later.');
}).finally(() => {
this.isLoading = false;
});
},
getComparisonIcon(comparisonValue, currentValue) {
if(comparisonValue > currentValue) {
return 'mdi-arrow-down';
} else if(comparisonValue < currentValue) {
return 'mdi-arrow-up';
} else {
return 'mdi-equal';
}
},
getStatusColor(comparisonValue, currentValue) {
if(comparisonValue > currentValue) {
return 'red';
} else if(comparisonValue < currentValue) {
return 'green';
} else {
return '#1976d2';
}
},
compare() {
this.getStudentHeadCounts();
}
}
};
</script>

<style scoped>
.border {
border: 2px solid grey;
border-radius: 5px;
padding: 10px;
}
.column-header {
font-weight: bold;
text-align: center;
}
.column-data {
text-align: center;
}
.divider {
border-right: 1px solid lightgray;
border-radius: 0px;
}
.divider:last-child {
border-right: 0
}
.compare-text {
color: gray;
}
</style>




0 comments on commit 44973d5

Please sign in to comment.