Commit 3311ad345da53df300459b3302cb95a27eab61b8

Authored by Neeraj Sharma
1 parent ab1ba03f4a

add event list in dashbaord

src/pages/Annoucement/annoucementForum.vue
... ... @@ -14,11 +14,12 @@
14 14 </v-list-tile-avatar>
15 15 <v-list-tile-content>
16 16 <v-list-tile-title>{{ annoucementData.discussionType }}</v-list-tile-title>
17   - <!-- <v-list-tile-sub-title>
  17 + <v-list-tile-sub-title>
18 18 By
19   - <span class="info--text">{{ annoucementData.studentId.name }}</span>
  19 + <span class="info--text" v-if="annoucementData.studentId">{{ annoucementData.studentId.name }}</span>
  20 + <span class="info--text" v-if="annoucementData.teacherId">{{ annoucementData.teacherId.name }}</span>
20 21 - {{dates(annoucementData.created ) }}
21   - </v-list-tile-sub-title>-->
  22 + </v-list-tile-sub-title>
22 23 </v-list-tile-content>
23 24 <v-list-tile-action>
24 25 <div>
... ...
src/pages/Dashboard/dashboard.vue
... ... @@ -386,9 +386,16 @@
386 386 <div class="text-xs-center py-3 subheading font-weight-bold">Calender</div>
387 387 <vue-event-calendar :events="activityEvents"></vue-event-calendar>
388 388 <!-- LATEST ACTIVITY -->
389   - <v-card class="my-3 elevation-0" v-if="role == 'PARENT'">
  389 + <v-card class="my-3 elevation-0">
390 390 <v-card-text>
391   - <v-card-title class="justify-center subheading font-weight-bold">Latest Activity</v-card-title>
  391 + <v-card-title
  392 + class="justify-center subheading font-weight-bold"
  393 + v-if="role != 'TEACHER'"
  394 + >Latest Activity</v-card-title>
  395 + <v-card-title
  396 + class="justify-center subheading font-weight-bold"
  397 + v-if="role == 'TEACHER'"
  398 + >Latest Event</v-card-title>
392 399 <div v-for="(activity,index) in activityList" :key="index" class="mt-2">
393 400 <span
394 401 :style="{ 'background-color': colorsArray[index%colorsArray.length] }"
... ... @@ -397,10 +404,21 @@
397 404 <div style="display: inline-block;" class="ml-2">
398 405 <div
399 406 class="grey--text lighten-1 caption"
  407 + v-if="activity.meetingEvent"
400 408 >{{moment(activity.meetingEvent.dateOfEvent).format("DD MMMM, YYYY")}}</div>
401   - <div class="body-2">{{activity.meetingEvent.title}}</div>
  409 + <div class="body-2" v-if="activity.meetingEvent">{{activity.meetingEvent.title}}</div>
  410 + <div v-if="role == 'TEACHER'">
  411 + <div
  412 + class="grey--text lighten-1 caption"
  413 + v-if="activity.dateOfEvent"
  414 + >{{moment(activity.dateOfEvent).format("DD MMMM, YYYY")}}</div>
  415 + <div class="body-2" v-if="activity.title">{{activity.title}}</div>
  416 + </div>
402 417 </div>
403 418 </div>
  419 + <div v-if="activityList.length == 0">
  420 + <p class="text-center title grey lighten-4 error--text">No Data Found!</p>
  421 + </div>
404 422 </v-card-text>
405 423 </v-card>
406 424 </v-card-text>
... ... @@ -636,6 +654,7 @@ export default {
636 654 this.getFeesAndCollectionsData();
637 655 this.getExpensesData();
638 656 this.getparentStudents();
  657 + this.getMeetingEventes();
639 658 // this.getUsersList();
640 659 },
641 660 methods: {
... ... @@ -907,23 +926,44 @@ export default {
907 926 console.log("err====>", err);
908 927 this.showLoader = false;
909 928 });
  929 + },
  930 + getMeetingEventes() {
  931 + if (this.role == "TEACHER") {
  932 + this.showLoader = true;
  933 + http()
  934 + .get("/getMeetingEventesList", {
  935 + headers: {
  936 + Authorization: "Bearer " + this.token
  937 + }
  938 + })
  939 + .then(response => {
  940 + var activityList = response.data.data;
  941 + this.activityList = activityList;
  942 + this.showLoader = false;
  943 + })
  944 + .catch(error => {
  945 + this.showLoader = false;
  946 + });
  947 + }
910 948 }
911 949 },
912 950 async created() {
913 951 /* get Latest events list */
914   - let response = await this.studentMeetingEvents({
915   - studentId: localStorage.getItem("parentStudentId")
916   - });
917   - this.activityList = response.data.data;
  952 + if (this.$store.state.role != "TEACHER") {
  953 + let response = await this.studentMeetingEvents({
  954 + studentId: localStorage.getItem("parentStudentId")
  955 + });
  956 + this.activityList = response.data.data;
918 957  
919   - /* set activityEvents array to highlight event dates in calender */
920   - for (var i = 0; i < this.activityList.length; i++) {
921   - let obj = {};
922   - obj.date = moment(this.activityList[i].meetingEvent.dateOfEvent).format(
923   - "YYYY/MM/DD"
924   - );
925   - obj.title = this.activityList[i].meetingEvent.title;
926   - this.activityEvents.push(obj);
  958 + /* set activityEvents array to highlight event dates in calender */
  959 + for (var i = 0; i < this.activityList.length; i++) {
  960 + let obj = {};
  961 + obj.date = moment(this.activityList[i].meetingEvent.dateOfEvent).format(
  962 + "YYYY/MM/DD"
  963 + );
  964 + obj.title = this.activityList[i].meetingEvent.title;
  965 + this.activityEvents.push(obj);
  966 + }
927 967 }
928 968 }
929 969 };
... ...