diff --git a/frontend/src/components/Batch/Forms/DistrunUserForm.vue b/frontend/src/components/Batch/Forms/DistrunUserForm.vue index 1fdc3153..c829e36a 100644 --- a/frontend/src/components/Batch/Forms/DistrunUserForm.vue +++ b/frontend/src/components/Batch/Forms/DistrunUserForm.vue @@ -260,6 +260,7 @@ import DistributionInput from "@/components/Batch/Forms/FormInputs/DistributionI import { mapActions, mapState } from "pinia"; import BatchProcessingService from "@/services/BatchProcessingService.js"; +import { useAppStore } from "../../../store/modules/app"; import { useAccessStore } from "../../../store/modules/access"; import { useAuthStore } from "../../../store/modules/auth"; import { useSnackbarStore } from "../../../store/modules/snackbar"; @@ -536,42 +537,46 @@ export default { "setActiveTab", "updateDashboards", ]), - getTranscriptTypes() { - GraduationReportService.getTranscriptTypes() - .then((response) => { - this.transcriptTypes = response.data; - }) - // eslint-disable-next-line - .catch((error) => { - if (error.response.statusText) { - console.log("ERROR " + error.response.statusText, "danger"); - } else { - console.log("ERROR " + "error with webservice", "danger"); - } - }); - }, - getCertificateTypes() { - GraduationReportService.getCertificateTypes() - .then((response) => { - this.certificateTypes = response.data; - }) - // eslint-disable-next-line - .catch((error) => { - if (error.response.statusText) { - this.snackbarStore.showSnackbar( - "ERROR " + error.response.statusText, - "danger", - 10000 - ); - } else { - this.snackbarStore.showSnackbar( - "ERROR " + "error with web service", - "danger", - 10000 - ); - } - }); - }, + ...mapState(useAppStore, [ + "getTranscriptTypes", + "getCertificateTypes" + ]), + // getTranscriptTypes() { + // GraduationReportService.getTranscriptTypes() + // .then((response) => { + // this.transcriptTypes = response.data; + // }) + // // eslint-disable-next-line + // .catch((error) => { + // if (error.response.statusText) { + // console.log("ERROR " + error.response.statusText, "danger"); + // } else { + // console.log("ERROR " + "error with webservice", "danger"); + // } + // }); + // }, + // getCertificateTypes() { + // GraduationReportService.getCertificateTypes() + // .then((response) => { + // this.certificateTypes = response.data; + // }) + // // eslint-disable-next-line + // .catch((error) => { + // if (error.response.statusText) { + // this.snackbarStore.showSnackbar( + // "ERROR " + error.response.statusText, + // "danger", + // 10000 + // ); + // } else { + // this.snackbarStore.showSnackbar( + // "ERROR " + "error with web service", + // "danger", + // 10000 + // ); + // } + // }); + // }, closeDialogAndResetForm() { this.blankCertificateDetails = []; this.blankTranscriptDetails = []; diff --git a/frontend/src/store/modules/app.js b/frontend/src/store/modules/app.js index 0fb91d26..bf143b15 100644 --- a/frontend/src/store/modules/app.js +++ b/frontend/src/store/modules/app.js @@ -1,6 +1,7 @@ import { defineStore } from "pinia"; import ApiService from "../../common/apiService.js"; import InstituteService from "../../services/InstituteService.js"; +import GraduationReportService from "@/services/GraduationReportService.js"; import sharedMethods from "../../sharedMethods.js"; export const useAppStore = defineStore("app", { state: () => ({ @@ -10,6 +11,8 @@ export const useAppStore = defineStore("app", { pageTitle: "GRAD", districtsList: [], schoolsList: [], + transcriptTypes: [], + certificationTypes: [] }), getters: { getProgramOptions: (state) => state.programOptions, @@ -55,6 +58,8 @@ export const useAppStore = defineStore("app", { (gradeCode) => code === gradeCode.schoolGradeCode ); }, + getTranscriptTypes: (state) => state.transcriptTypes, + getCertificateTypes: (state) => state.certificationTypes }, actions: { setApplicationVariables() { @@ -100,10 +105,6 @@ export const useAppStore = defineStore("app", { InstituteService.getDistrictsList().then((response) => { try { this.districtsList = response.data; - this.districtList = - sharedMethods.sortDistrictListByActiveAndDistrictNumber( - this.districtsList - ); } catch (error) { console.error(error); } @@ -149,6 +150,38 @@ export const useAppStore = defineStore("app", { console.error(error); } }); + GraduationReportService.getTranscriptTypes().then((response) => { + try { + this.transcriptTypes = response.data; + console.log("Transcript Service") + } catch (error) { + if (error.response.statusText) { + console.log("ERROR " + error.response.statusText, "danger"); + } else { + console.log("ERROR " + "error with webservice", "danger"); + } + } + }) + GraduationReportService.getCertificateTypes().then((response) => { + try { + this.certificationTypes = response.data; + console.log("Certificate Service") + } catch (error) { + if (error.response.statusText) { + this.snackbarStore.showSnackbar( + "ERROR " + error.response.statusText, + "danger", + 10000 + ); + } else { + this.snackbarStore.showSnackbar( + "ERROR " + "error with web service", + "danger", + 10000 + ); + } + } + }) } }, },