Skip to content

Commit 555184a

Browse files
Merge pull request #1925 from bcgov/fix/EDX-2937
Added export button to Step 2 of Data Collection
2 parents 844d2f7 + 647f060 commit 555184a

File tree

3 files changed

+57
-8
lines changed

3 files changed

+57
-8
lines changed

frontend/src/components/sdcCollection/sdcDistrictCollection/StepTwoMonitor.vue

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,15 @@
168168
justify="end"
169169
no-gutters
170170
>
171+
<v-btn
172+
id="export"
173+
color="#003366"
174+
text="Export"
175+
class="mr-2 mb-1"
176+
prepend-icon="mdi-tray-arrow-down"
177+
variant="elevated"
178+
@click="showExportDialog = true"
179+
/>
171180
<v-btn
172181
id="filters"
173182
color="#003366"
@@ -261,11 +270,38 @@
261270
<ConfirmationDialog ref="confirmRemovalOfCollection">
262271
<template #message />
263272
</ConfirmationDialog>
273+
<v-dialog
274+
v-model="showExportDialog"
275+
:max-width="443"
276+
>
277+
<v-card>
278+
<v-card-title>
279+
Export Student Records
280+
</v-card-title>
281+
<v-card-actions>
282+
<v-btn
283+
color="#003366"
284+
variant="elevated"
285+
style="white-space: pre-wrap;"
286+
text="Students Only"
287+
@click="downloadStudentReport"
288+
/>
289+
<v-btn
290+
color="#003366"
291+
variant="elevated"
292+
style="white-space: pre-wrap;"
293+
text="Students with Errors & Warnings"
294+
@click="downloadStudentWithErrorsReport"
295+
/>
296+
</v-card-actions>
297+
</v-card>
298+
</v-dialog>
264299
</template>
265300
<script>
266301
import {defineComponent} from 'vue';
267302
import ApiService from '../../../common/apiService';
268303
import {ApiRoutes} from '../../../utils/constants';
304+
import {downloadStudentOnlyReportURL,downloadStudentErrorsReportURL} from '../../../utils/common';
269305
import {setFailureAlert, setSuccessAlert} from '../../composable/alertComposable';
270306
import PrimaryButton from '../../util/PrimaryButton.vue';
271307
import Filters from '../../common/Filters.vue';
@@ -298,6 +334,7 @@ export default defineComponent({
298334
data() {
299335
return {
300336
allowedFilters: MONITORING.allowedFilters,
337+
showExportDialog: false,
301338
filters: {},
302339
sortBy: [{ key: 'schoolTitle', order:'asc'}],
303340
headers: [
@@ -386,6 +423,16 @@ export default defineComponent({
386423
387424
},
388425
methods: {
426+
downloadStudentReport(){
427+
const routeData = this.$router.resolve({path: downloadStudentOnlyReportURL()});
428+
window.open(routeData.href, '_blank');
429+
this.showExportDialog = false;
430+
},
431+
downloadStudentWithErrorsReport(){
432+
const routeData = this.$router.resolve({path: downloadStudentErrorsReportURL()});
433+
window.open(routeData.href, '_blank');
434+
this.showExportDialog = false;
435+
},
389436
canMoveForward(){
390437
return this.isStepComplete || this.hasEditPermission;
391438
},

frontend/src/components/sdcCollection/sdcDistrictCollection/stepThreeVerifyData/DetailComponent.vue

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
<script>
128128
import alertMixin from '../../../../mixins/alertMixin';
129129
import CustomTable from '../../../common/CustomTable.vue';
130+
import {downloadStudentOnlyReportURL,downloadStudentErrorsReportURL} from '../../../utils/common';
130131
import ApiService from '../../../../common/apiService';
131132
import {ApiRoutes} from '../../../../utils/constants';
132133
import {cloneDeep, isEmpty, omitBy} from 'lodash';
@@ -213,21 +214,15 @@ export default {
213214
this.reloadStudentsFlag = false;
214215
},
215216
downloadStudentReport(){
216-
const routeData = this.$router.resolve({path: this.downloadStudentOnlyReportURL()});
217+
const routeData = this.$router.resolve({path: downloadStudentOnlyReportURL()});
217218
window.open(routeData.href, '_blank');
218219
this.showExportDialog = false;
219220
},
220221
downloadStudentWithErrorsReport(){
221-
const routeData = this.$router.resolve({path: this.downloadStudentErrorsReportURL()});
222+
const routeData = this.$router.resolve({path: downloadStudentErrorsReportURL()});
222223
window.open(routeData.href, '_blank');
223224
this.showExportDialog = false;
224225
},
225-
downloadStudentOnlyReportURL() {
226-
return `${ApiRoutes.sdc.SDC_DISTRICT_COLLECTION}/${this.$route.params.sdcDistrictCollectionID}/report/csv_dis/download`;
227-
},
228-
downloadStudentErrorsReportURL() {
229-
return `${ApiRoutes.sdc.SDC_DISTRICT_COLLECTION}/${this.$route.params.sdcDistrictCollectionID}/report/csv_dis_errors_warns/download`;
230-
},
231226
editStudent($event) {
232227
const selectedStudent = cloneDeep($event);
233228
this.studentForEdit.splice(0);

frontend/src/utils/common.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ export function getDemogValidationResults(student, sdcSchoolCollectionID) {
7272
});
7373
});
7474
}
75+
export function downloadStudentOnlyReportURL() {
76+
return `${ApiRoutes.sdc.SDC_DISTRICT_COLLECTION}/${this.$route.params.sdcDistrictCollectionID}/report/csv_dis/download`;
77+
}
78+
79+
export function downloadStudentErrorsReportURL() {
80+
return `${ApiRoutes.sdc.SDC_DISTRICT_COLLECTION}/${this.$route.params.sdcDistrictCollectionID}/report/csv_dis_errors_warns/download`;
81+
}
7582

7683
export function getCollectionLink(currentCollectionTypeCode) {
7784
let collectionLink = '';

0 commit comments

Comments
 (0)