diff --git a/src/pages/Dashboard/dashboard.vue b/src/pages/Dashboard/dashboard.vue index 3b39d58..281da32 100644 --- a/src/pages/Dashboard/dashboard.vue +++ b/src/pages/Dashboard/dashboard.vue @@ -411,7 +411,7 @@ - Students + Students
- - + +
-
-

No Data Found!

-
- -
- - --> + + + + + - - + - - - + + + + + - - - - - School Events -
- - -
-
- -
{{moment(schoolEvent.dateOfEvent).format("DD MMMM, YYYY")}}
- -
{{schoolEvent.title}}
+ + + + + +
-
-
-

No Data Found!

-
- - +
+

No Data Found!

+
+ + + + - - - - @@ -884,11 +811,11 @@ export default { formatter: function (val, opts) { return val + " - " + opts.w.globals.series[opts.seriesIndex]; }, - position: 'bottom', + position: "bottom", }, dataLabels: { enabled: true, - formatter: function (val,opts) { + formatter: function (val, opts) { return opts.w.globals.series[opts.seriesIndex]; }, }, @@ -943,8 +870,7 @@ export default { feeData: [], collectionData: [], courseData: [], - studentsData: [], - activeStudent: {}, + annoucementData: [], role: "", attrs: [ @@ -1039,6 +965,15 @@ export default { }, }, + /* ROLE PARENT - ACTIVE STUDENTS */ + studentsData: [], + activeStudent: {}, + activeStudentsList: [], + rowsPerPageItems: [2], + pagination: { + rowsPerPage: 2, + }, + // LATEST ACTIVITY colorsArray: ["#ff8a89", "#71d9ea", "#7852cc", "#F9A825"], activityList: [], @@ -1329,6 +1264,7 @@ export default { }) .then((response) => { this.annoucementData = response.data.data; + console.log("avnn - ", this.annoucementData); this.showLoader = false; }) .catch((err) => { @@ -1390,24 +1326,24 @@ export default { } } }, - async getMaleFemaleData(){ - await http() - .get("/getStudentsByGender") - .then((response) => { - console.log("gender response - ", response) - for(var i = 0; i < response.data.data.length; i++){ - if(response.data.data[i]._id == "male"){ - this.maleFemaleSeries.push(response.data.data[i].total) - } - if(response.data.data[i]._id == "female"){ - this.maleFemaleSeries.push(response.data.data[i].total) - } + async getMaleFemaleData() { + await http() + .get("/getStudentsByGender") + .then((response) => { + console.log("gender response - ", response); + for (var i = 0; i < response.data.data.length; i++) { + if (response.data.data[i]._id == "male") { + this.maleFemaleSeries.push(response.data.data[i].total); } - }) - .catch((error) => { - this.showLoader = false; - }); - } + if (response.data.data[i]._id == "female") { + this.maleFemaleSeries.push(response.data.data[i].total); + } + } + }) + .catch((error) => { + this.showLoader = false; + }); + }, }, mounted() { @@ -1435,13 +1371,18 @@ export default { } else if (this.$store.state.role === "LIBRARIAN") { // this.token = this.$store.state.token; } else if (this.$store.state.role === "PARENT") { - // this.token = this.$store.state.token; - // await this.getparentStudents(); - this.studentsData = this.$store.getters.GET_STUDENTS_DATA; - // console.log("students data - ", this.studentsData); await this.getCourses(); await this.getAnnoucementes(); - this.activeStudent = this.$store.getters.GET_ACTIVE_STUDENT + this.studentsData = this.$store.getters.GET_STUDENTS_DATA; + this.activeStudent = this.$store.getters.GET_ACTIVE_STUDENT; + /* MAKE A LIST OF STUDENTS WITH STATUS TRUE, FOR DISPLAYING STUDENTS DATA AT TOP */ + for (var i = 0; i < this.studentsData.length; i++) { + if (this.studentsData[i].status == true) { + this.activeStudentsList.push(this.studentsData[i]); + } + } + console.log("student list - ", this.activeStudentsList); + console.log("active - ", this.activeStudent); } this.role = this.$store.state.role; diff --git a/src/pages/changeStudents/changeStudents.vue b/src/pages/changeStudents/changeStudents.vue index d604262..519d827 100644 --- a/src/pages/changeStudents/changeStudents.vue +++ b/src/pages/changeStudents/changeStudents.vue @@ -77,6 +77,12 @@ export default { methods: { change() { localStorage.setItem("parentStudentId", this.changeStudent); + /* Look for active student object */ + for(var i = 0; i < this.studentsData.length; i++){ + if(this.studentsData[i]._id == this.changeStudent){ + this.$store.dispatch("SET_ACTIVE_STUDENT",this.studentsData[i]) + } + } this.$router.replace({ path: "/" }); }, getparentStudents() {