diff --git a/src/pages/Dashboard/dashboard.vue b/src/pages/Dashboard/dashboard.vue index 5b4328d..dd78d80 100644 --- a/src/pages/Dashboard/dashboard.vue +++ b/src/pages/Dashboard/dashboard.vue @@ -100,7 +100,10 @@ - Link : {{particularEvent.link}} + + Link : + {{particularEvent.link}} + @@ -327,7 +330,7 @@ - + Latest Events
- - - + + +

@@ -618,20 +635,20 @@ export default { activityEvents: [], onlineUser: [ { - user: "Student Demo" + user: "Student Demo", }, { - user: "Teacher Demo" + user: "Teacher Demo", }, { - user: "Priyansh Gupta" + user: "Priyansh Gupta", }, { - user: "Gaurav Aggarwal" + user: "Gaurav Aggarwal", }, { - user: "Approve Arorra" - } + user: "Approve Arorra", + }, ], showLoader: false, calendarData: {}, @@ -641,10 +658,10 @@ export default { EventsList: [], events: [], config: { - eventClick: event => { + eventClick: (event) => { this.selected = event; this.dialog = true; - } + }, }, selected: {}, barGraph: [], @@ -669,27 +686,27 @@ export default { { key: "today", highlight: true, - dates: new Date() - } + dates: new Date(), + }, ], drawer: true, items: [ { title: "Home", icon: "dashboard" }, - { title: "About", icon: "question_answer" } + { title: "About", icon: "question_answer" }, ], right: null, series: [ { name: "Total", - data: [] - } + data: [], + }, ], chartOptions: { chart: { type: "bar", height: 150, - stacked: true + stacked: true, // animations: { // enabled: true, // easing: "easeinout", @@ -709,8 +726,8 @@ export default { horizontal: false, columnWidth: "25%", // endingShape: "rounded", - distributed: true - } + distributed: true, + }, }, responsive: [ { @@ -719,46 +736,46 @@ export default { legend: { position: "bottom", offsetX: -10, - offsetY: 0 - } - } - } + offsetY: 0, + }, + }, + }, ], legend: { - show: false + show: false, }, colors: ["#7852cc", "#f9a825", "#ff8a89"], dataLabels: { - enabled: false + enabled: false, }, stroke: { show: true, width: 2, - colors: ["transparent"] + colors: ["transparent"], }, xaxis: { - categories: ["Fee", "Collections", "Expences"] + categories: ["Fee", "Collections", "Expences"], }, yaxis: { title: { - text: "" - } + text: "", + }, }, fill: { - opacity: 1 + opacity: 1, }, tooltip: { y: { - formatter: function(val, opts) { + formatter: function (val, opts) { return "" + val + " "; - } - } - } + }, + }, + }, }, // LATEST ACTIVITY colorsArray: ["#ff8a89", "#71d9ea", "#7852cc", "#F9A825"], - activityList: [] + activityList: [], }; }, methods: { @@ -767,7 +784,7 @@ export default { }, async handleDayChanged(e) { await this.getParticularMeetingEvent({ - meetingEventId: e.events[0]._id + meetingEventId: e.events[0]._id, }); this.viewEventDetails = true; }, @@ -778,7 +795,7 @@ export default { } if (this.$store.state.role === "PARENT") { await this.getParticularMeetingEvent({ - meetingEventId: activity.meetingEvent._id + meetingEventId: activity.meetingEvent._id, }); this.viewEventDetails = true; } @@ -791,7 +808,7 @@ export default { if (response.data.data.length > 0) { this.$router.push({ name: "Course Details", - query: { courseId: courseId } + query: { courseId: courseId }, }); } else { this.seeSnackbar("No Data Available", "warning"); @@ -807,7 +824,7 @@ export default { // this.dialogNotice = true; this.$router.push("/noticeBoard"); }, - date: function(date) { + date: function (date) { return moment(date).format("MMMM DD, YYYY HH:mm"); }, activityDate(date) { @@ -833,14 +850,14 @@ export default { http() .get("/getStudentsList", { headers: { - Authorization: "Bearer " + this.token - } + Authorization: "Bearer " + this.token, + }, }) - .then(response => { + .then((response) => { this.students = response.data.data; this.showLoader = false; }) - .catch(error => { + .catch((error) => { // console.log("err====>", err); this.showLoader = false; if (error.response.status === 401) { @@ -854,14 +871,14 @@ export default { http() .get("/getParentsList", { headers: { - Authorization: "Bearer " + this.token - } + Authorization: "Bearer " + this.token, + }, }) - .then(response => { + .then((response) => { this.parents = response.data.data; this.showLoader = false; }) - .catch(error => { + .catch((error) => { // console.log("err====>", err); this.showLoader = false; }); @@ -870,14 +887,14 @@ export default { http() .get("/getTeachersList", { headers: { - Authorization: "Bearer " + this.token - } + Authorization: "Bearer " + this.token, + }, }) - .then(response => { + .then((response) => { this.teachers = response.data.data; this.showLoader = false; }) - .catch(error => { + .catch((error) => { // console.log("err====>", err); this.showLoader = false; }); @@ -886,14 +903,14 @@ export default { http() .get("/getClassesList", { headers: { - Authorization: "Bearer " + this.token - } + Authorization: "Bearer " + this.token, + }, }) - .then(response => { + .then((response) => { this.classes = response.data.data; this.showLoader = false; }) - .catch(error => { + .catch((error) => { this.showLoader = false; }); }, @@ -902,14 +919,14 @@ export default { http() .get("/getEventsList", { headers: { - Authorization: "Bearer " + this.token - } + Authorization: "Bearer " + this.token, + }, }) - .then(response => { + .then((response) => { this.noticeData = response.data.data; this.showLoader = false; }) - .catch(error => { + .catch((error) => { this.showLoader = false; }); }, @@ -919,31 +936,31 @@ export default { http() .get("/getParticularUserDetail", { headers: { - Authorization: "Bearer " + this.token + Authorization: "Bearer " + this.token, }, params: { - studentId: localStorage.getItem("parentStudentId") - } + studentId: localStorage.getItem("parentStudentId"), + }, }) - .then(response => { + .then((response) => { this.userData = response.data.data; this.showLoader = false; }) - .catch(error => { + .catch((error) => { this.showLoader = false; }); } else { http() .get("/getParticularUserDetail", { headers: { - Authorization: "Bearer " + this.token - } + Authorization: "Bearer " + this.token, + }, }) - .then(response => { + .then((response) => { this.userData = response.data.data; this.showLoader = false; }) - .catch(error => { + .catch((error) => { this.showLoader = false; }); } @@ -953,10 +970,10 @@ export default { http() .get("/getTotalFeesAndCollections", { headers: { - Authorization: "Bearer " + this.token - } + Authorization: "Bearer " + this.token, + }, }) - .then(response => { + .then((response) => { this.feeData = response.data.data; // this.collectionData = response.data.data; this.series[0].data[0] = this.feeData.totalFees; @@ -964,7 +981,7 @@ export default { this.showLoader = false; }) - .catch(error => { + .catch((error) => { this.showLoader = false; }); }, @@ -972,10 +989,10 @@ export default { http() .get("/getTotalExpenses", { headers: { - Authorization: "Bearer " + this.token - } + Authorization: "Bearer " + this.token, + }, }) - .then(response => { + .then((response) => { this.expenseData = response.data.data; // var array = response.data.data.sum; this.series[0].data[2] = this.expenseData.sum; @@ -987,7 +1004,7 @@ export default { // ]; this.showLoader = false; }) - .catch(error => { + .catch((error) => { this.showLoader = false; }); }, @@ -997,7 +1014,7 @@ export default { var classId; await http() .get("/parentStudentsList") - .then(response => { + .then((response) => { this.studentsData = response.data.data; localStorage.setItem( "parentStudentId", @@ -1019,7 +1036,7 @@ export default { this.showLoader = false; }) - .catch(err => { + .catch((err) => { console.log("err====>", err); this.showLoader = false; }); @@ -1030,7 +1047,7 @@ export default { /* getStudentCourses - to get courseData - defined in GetApis.js*/ await this.getStudentCourses({ classId: classId, - studentId: parentStudentsId + studentId: parentStudentsId, }); }, getAnnoucementes(classId) { @@ -1038,14 +1055,14 @@ export default { http() .get("/getAnnoucementesList", { params: { - classId: classId - } + classId: classId, + }, }) - .then(response => { + .then((response) => { this.annoucementData = response.data.data; this.showLoader = false; }) - .catch(err => { + .catch((err) => { console.log("err====>", err); this.showLoader = false; }); @@ -1056,10 +1073,10 @@ export default { await http() .get("/getMeetingEventesList", { headers: { - Authorization: "Bearer " + this.token - } + Authorization: "Bearer " + this.token, + }, }) - .then(response => { + .then((response) => { var activityList = response.data.data; this.activityList = activityList; this.showLoader = false; @@ -1075,11 +1092,11 @@ export default { this.activityEvents.push(obj); } }) - .catch(error => { + .catch((error) => { this.showLoader = false; }); } - } + }, }, mounted() { @@ -1091,8 +1108,12 @@ export default { async created() { if (this.$store.state.role === "ADMIN") { this.token = this.$store.state.token; + await this.getFeesAndCollectionsData(); + await this.getExpensesData(); } else if (this.$store.state.schoolRole === "SUPERADMIN") { this.token = this.$store.state.schoolToken; + await this.getFeesAndCollectionsData(); + await this.getExpensesData(); } else if (this.$store.state.role === "TEACHER") { this.token = this.$store.state.token; } else if (this.$store.state.role === "ACCOUNTANT") { @@ -1112,13 +1133,11 @@ export default { await this.getClasses(); await this.getNoticeData(); await this.getUserData(); - await this.getFeesAndCollectionsData(); - await this.getExpensesData(); /* get Latest events list for student login*/ if (this.$store.state.role == "PARENT") { let response = await this.studentMeetingEvents({ - studentId: localStorage.getItem("parentStudentId") + studentId: localStorage.getItem("parentStudentId"), }); this.activityList = response.data.data; @@ -1138,7 +1157,7 @@ export default { if (this.role == "TEACHER") { await this.getMeetingEventes(); } - } + }, };