Commit 4fb0af78fa6ac74ba8c0846d5d1fbe75e87c67bf

Authored by Amber Dev
1 parent f31c3fd76f

added school events to teacher role

Showing 1 changed file with 25 additions and 23 deletions   Show diff stats
src/pages/Dashboard/dashboard.vue
... ... @@ -293,10 +293,10 @@
293 293 </v-layout>
294 294  
295 295 <!-- FOR ADMIN ROLE -->
296   - <v-layout row wrap>
  296 + <v-layout row wrap v-if="role == 'ADMIN'||role == 'TEACHER'">
297 297 <!-- NOTICE -->
298 298 <v-flex xs12 sm6>
299   - <v-card class="card" v-if="role == 'ADMIN'">
  299 + <v-card class="card">
300 300 <v-container>
301 301 <v-card-title class="justify-center subheading font-weight-bold">Notice</v-card-title>
302 302  
... ... @@ -380,11 +380,10 @@
380 380 </v-flex>
381 381 </v-layout>
382 382  
383   - <!-- SCHOOL EVENTS -->
384   - <div></div>
  383 +
385 384  
386 385 <!-- FOR TEACHER ROLE -->
387   - <v-card class="mt-2 card" v-if="role == 'TEACHER'">
  386 + <!-- <v-card class="mt-2 card" v-if="role == 'TEACHER'">
388 387 <v-layout>
389 388 <v-flex xs6 sm6 md6>
390 389 <h4 class="pa-3">
... ... @@ -461,7 +460,7 @@
461 460 </v-card-text>
462 461 </v-flex>
463 462 </v-layout>
464   - </v-card>
  463 + </v-card> -->
465 464  
466 465 <!-- COURSES -->
467 466 <v-layout v-if="role == 'PARENT'">
... ... @@ -641,9 +640,9 @@
641 640  
642 641 <vue-event-calendar :events="activityEvents" @day-changed="handleDayChanged($event)"></vue-event-calendar>
643 642  
644   - <!-- LATEST EVENTS -->
  643 + <!-- MEETING EVENTS -->
645 644 <!-- IF ROLE IS ADMIN -->
646   - <v-card class="my-3 elevation-0" v-if="role != 'TEACHER'">
  645 + <v-card class="my-3 elevation-0">
647 646 <v-card-text v-if="$store.state.role === 'ADMIN' ">
648 647 <!-- MEETING EVENTS -->
649 648 <v-card-title class="justify-center subheading font-weight-bold">Meeting Events</v-card-title>
... ... @@ -675,7 +674,7 @@
675 674  
676 675 <!-- ROLE IS NOT ADMIN -->
677 676 <v-card-text v-if="$store.state.role != 'ADMIN'">
678   - <v-card-title class="justify-center subheading font-weight-bold">Latest Events</v-card-title>
  677 + <v-card-title class="justify-center subheading font-weight-bold">Meeting Events</v-card-title>
679 678 <div
680 679 v-for="(activity,index) in activityList"
681 680 :key="index"
... ... @@ -688,7 +687,7 @@
688 687 style="height: 12px;width: 12px;border-radius: 50%;display: inline-block;vertical-align: top;"
689 688 ></span>
690 689 <div style="display: inline-block;" class="ml-2">
691   - <!-- LATEST EVENTS FOR PARENT -->
  690 + <!-- MEETING EVENTS FOR PARENT -->
692 691 <div v-if="$store.state.role === 'PARENT' ">
693 692 <div
694 693 class="grey--text lighten-1 caption"
... ... @@ -700,7 +699,7 @@
700 699 >{{activity.meetingEvent.title}}</div>
701 700 </div>
702 701  
703   - <!-- LATEST EVENTS FOR TEACHER -->
  702 + <!-- MEETING EVENTS FOR TEACHER -->
704 703 <div v-if="role === 'TEACHER'">
705 704 <div
706 705 class="grey--text lighten-1 caption"
... ... @@ -962,14 +961,14 @@ export default {
962 961 this.viewEventDetails = true;
963 962 },
964 963 async seeEventDetails(activity, message) {
965   - if (this.$store.state.role === "TEACHER") {
966   - let response = await this.getParticularMeetingEvent({
967   - meetingEventId: activity._id,
968   - });
969   - this.displayEventsList = [];
970   - this.displayEventsList.push(response.data.data);
971   - this.viewEventDetails = true;
972   - }
  964 + // if (this.$store.state.role === "TEACHER") {
  965 + // let response = await this.getParticularMeetingEvent({
  966 + // meetingEventId: activity._id,
  967 + // });
  968 + // this.displayEventsList = [];
  969 + // this.displayEventsList.push(response.data.data);
  970 + // this.viewEventDetails = true;
  971 + // }
973 972 if (this.$store.state.role === "PARENT") {
974 973 let response = await this.getParticularMeetingEvent({
975 974 meetingEventId: activity.meetingEvent._id,
... ... @@ -978,7 +977,7 @@ export default {
978 977 this.displayEventsList.push(response.data.data);
979 978 this.viewEventDetails = true;
980 979 }
981   - if (this.$store.state.role === "ADMIN") {
  980 + if (this.$store.state.role === "ADMIN" || this.$store.state.role === "TEACHER") {
982 981 if (message == "schoolEvent") {
983 982 let response = await this.getParticularSchoolEvent({
984 983 schoolEventId: activity._id,
... ... @@ -1219,7 +1218,7 @@ export default {
1219 1218 this.activityList = activityList;
1220 1219 this.showLoader = false;
1221 1220  
1222   - /* set meetingEvents array to highlight event dates in calender */
  1221 + /* set meetingEvents in activityEvents array to highlight event dates in calender */
1223 1222 for (var i = 0; i < this.activityList.length; i++) {
1224 1223 let obj = {};
1225 1224 obj.date = moment(this.activityList[i].dateOfEvent).format(
... ... @@ -1228,6 +1227,7 @@ export default {
1228 1227 obj.title = this.activityList[i].title;
1229 1228 obj._id = this.activityList[i]._id;
1230 1229 obj.eventType = "meetingEvent";
  1230 + /* activityEvents is an array used to display events in calender on particular dates */
1231 1231 this.activityEvents.push(obj);
1232 1232 }
1233 1233 })
... ... @@ -1235,9 +1235,10 @@ export default {
1235 1235 this.showLoader = false;
1236 1236 });
1237 1237 }
1238   - if (this.role === "ADMIN") {
  1238 + /* If role is ADMIN or TEACHER then school events need to be displayed too */
  1239 + if (this.role === "ADMIN" || this.role === "TEACHER") {
1239 1240 await this.getSchoolEventsList();
1240   - /* set schoolEvents array to highlight event dates in calender */
  1241 + /* set schoolEvents in activityEvents array to highlight event dates in calender */
1241 1242 for (var i = 0; i < this.schoolEvents.length; i++) {
1242 1243 let obj = {};
1243 1244 obj.date = moment(this.schoolEvents[i].dateOfEvent).format(
... ... @@ -1246,6 +1247,7 @@ export default {
1246 1247 obj.title = this.schoolEvents[i].title;
1247 1248 obj._id = this.schoolEvents[i]._id;
1248 1249 obj.eventType = "schoolEvent";
  1250 + /* activityEvents is an array used to display events in calender on particular dates */
1249 1251 this.activityEvents.push(obj);
1250 1252 }
1251 1253 }
... ...