Commit bbd60612f52d5ed6c7602bbe596a93a5613413ec

Authored by Amber Dev
1 parent fa975e45a0

apis to admin

Showing 1 changed file with 113 additions and 94 deletions   Show diff stats
src/pages/Dashboard/dashboard.vue
... ... @@ -100,7 +100,10 @@
100 100 </v-list-tile>
101 101 <v-list-tile>
102 102 <v-list-tile-content>
103   - <v-list-tile-title>Link : <a :href="particularEvent.link">{{particularEvent.link}}</a></v-list-tile-title>
  103 + <v-list-tile-title>
  104 + Link :
  105 + <a :href="particularEvent.link">{{particularEvent.link}}</a>
  106 + </v-list-tile-title>
104 107 </v-list-tile-content>
105 108 </v-list-tile>
106 109 </v-list>
... ... @@ -327,7 +330,7 @@
327 330 </v-data-table>
328 331 </v-flex>
329 332  
330   - <v-flex xs6 sm6 md6>
  333 + <v-flex xs6 sm6 md6>
331 334 <v-card-text>
332 335 <v-card-title class="justify-center subheading font-weight-bold">Latest Events</v-card-title>
333 336 <div
... ... @@ -492,9 +495,23 @@
492 495 <v-flex xs12 class="py-3">
493 496 <v-layout wrap>
494 497 <v-flex xs12 sm12 md4>
495   - <img src="/static/icon/user.png" v-if="!userData.profilePicUrl && !userData.schoolLogoUrl" width="80" />
496   - <img :src="userData.profilePicUrl" onerror="this.src='/static/icon/user.png';" v-if="userData.profilePicUrl" width="80" />
497   - <img :src="userData.schoolLogoUrl" onerror="this.src='/static/icon/user.png';" v-if="userData.schoolLogoUrl" width="80" />
  498 + <img
  499 + src="/static/icon/user.png"
  500 + v-if="!userData.profilePicUrl && !userData.schoolLogoUrl"
  501 + width="80"
  502 + />
  503 + <img
  504 + :src="userData.profilePicUrl"
  505 + onerror="this.src='/static/icon/user.png';"
  506 + v-if="userData.profilePicUrl"
  507 + width="80"
  508 + />
  509 + <img
  510 + :src="userData.schoolLogoUrl"
  511 + onerror="this.src='/static/icon/user.png';"
  512 + v-if="userData.schoolLogoUrl"
  513 + width="80"
  514 + />
498 515 </v-flex>
499 516 <v-flex xs12 sm12 md6>
500 517 <p class="mb-0 body-1">
... ... @@ -618,20 +635,20 @@ export default {
618 635 activityEvents: [],
619 636 onlineUser: [
620 637 {
621   - user: "Student Demo"
  638 + user: "Student Demo",
622 639 },
623 640 {
624   - user: "Teacher Demo"
  641 + user: "Teacher Demo",
625 642 },
626 643 {
627   - user: "Priyansh Gupta"
  644 + user: "Priyansh Gupta",
628 645 },
629 646 {
630   - user: "Gaurav Aggarwal"
  647 + user: "Gaurav Aggarwal",
631 648 },
632 649 {
633   - user: "Approve Arorra"
634   - }
  650 + user: "Approve Arorra",
  651 + },
635 652 ],
636 653 showLoader: false,
637 654 calendarData: {},
... ... @@ -641,10 +658,10 @@ export default {
641 658 EventsList: [],
642 659 events: [],
643 660 config: {
644   - eventClick: event => {
  661 + eventClick: (event) => {
645 662 this.selected = event;
646 663 this.dialog = true;
647   - }
  664 + },
648 665 },
649 666 selected: {},
650 667 barGraph: [],
... ... @@ -669,27 +686,27 @@ export default {
669 686 {
670 687 key: "today",
671 688 highlight: true,
672   - dates: new Date()
673   - }
  689 + dates: new Date(),
  690 + },
674 691 ],
675 692 drawer: true,
676 693 items: [
677 694 { title: "Home", icon: "dashboard" },
678   - { title: "About", icon: "question_answer" }
  695 + { title: "About", icon: "question_answer" },
679 696 ],
680 697 right: null,
681 698  
682 699 series: [
683 700 {
684 701 name: "Total",
685   - data: []
686   - }
  702 + data: [],
  703 + },
687 704 ],
688 705 chartOptions: {
689 706 chart: {
690 707 type: "bar",
691 708 height: 150,
692   - stacked: true
  709 + stacked: true,
693 710 // animations: {
694 711 // enabled: true,
695 712 // easing: "easeinout",
... ... @@ -709,8 +726,8 @@ export default {
709 726 horizontal: false,
710 727 columnWidth: "25%",
711 728 // endingShape: "rounded",
712   - distributed: true
713   - }
  729 + distributed: true,
  730 + },
714 731 },
715 732 responsive: [
716 733 {
... ... @@ -719,46 +736,46 @@ export default {
719 736 legend: {
720 737 position: "bottom",
721 738 offsetX: -10,
722   - offsetY: 0
723   - }
724   - }
725   - }
  739 + offsetY: 0,
  740 + },
  741 + },
  742 + },
726 743 ],
727 744 legend: {
728   - show: false
  745 + show: false,
729 746 },
730 747 colors: ["#7852cc", "#f9a825", "#ff8a89"],
731 748 dataLabels: {
732   - enabled: false
  749 + enabled: false,
733 750 },
734 751 stroke: {
735 752 show: true,
736 753 width: 2,
737   - colors: ["transparent"]
  754 + colors: ["transparent"],
738 755 },
739 756 xaxis: {
740   - categories: ["Fee", "Collections", "Expences"]
  757 + categories: ["Fee", "Collections", "Expences"],
741 758 },
742 759 yaxis: {
743 760 title: {
744   - text: ""
745   - }
  761 + text: "",
  762 + },
746 763 },
747 764 fill: {
748   - opacity: 1
  765 + opacity: 1,
749 766 },
750 767 tooltip: {
751 768 y: {
752   - formatter: function(val, opts) {
  769 + formatter: function (val, opts) {
753 770 return "" + val + " ";
754   - }
755   - }
756   - }
  771 + },
  772 + },
  773 + },
757 774 },
758 775  
759 776 // LATEST ACTIVITY
760 777 colorsArray: ["#ff8a89", "#71d9ea", "#7852cc", "#F9A825"],
761   - activityList: []
  778 + activityList: [],
762 779 };
763 780 },
764 781 methods: {
... ... @@ -767,7 +784,7 @@ export default {
767 784 },
768 785 async handleDayChanged(e) {
769 786 await this.getParticularMeetingEvent({
770   - meetingEventId: e.events[0]._id
  787 + meetingEventId: e.events[0]._id,
771 788 });
772 789 this.viewEventDetails = true;
773 790 },
... ... @@ -778,7 +795,7 @@ export default {
778 795 }
779 796 if (this.$store.state.role === "PARENT") {
780 797 await this.getParticularMeetingEvent({
781   - meetingEventId: activity.meetingEvent._id
  798 + meetingEventId: activity.meetingEvent._id,
782 799 });
783 800 this.viewEventDetails = true;
784 801 }
... ... @@ -791,7 +808,7 @@ export default {
791 808 if (response.data.data.length > 0) {
792 809 this.$router.push({
793 810 name: "Course Details",
794   - query: { courseId: courseId }
  811 + query: { courseId: courseId },
795 812 });
796 813 } else {
797 814 this.seeSnackbar("No Data Available", "warning");
... ... @@ -807,7 +824,7 @@ export default {
807 824 // this.dialogNotice = true;
808 825 this.$router.push("/noticeBoard");
809 826 },
810   - date: function(date) {
  827 + date: function (date) {
811 828 return moment(date).format("MMMM DD, YYYY HH:mm");
812 829 },
813 830 activityDate(date) {
... ... @@ -833,14 +850,14 @@ export default {
833 850 http()
834 851 .get("/getStudentsList", {
835 852 headers: {
836   - Authorization: "Bearer " + this.token
837   - }
  853 + Authorization: "Bearer " + this.token,
  854 + },
838 855 })
839   - .then(response => {
  856 + .then((response) => {
840 857 this.students = response.data.data;
841 858 this.showLoader = false;
842 859 })
843   - .catch(error => {
  860 + .catch((error) => {
844 861 // console.log("err====>", err);
845 862 this.showLoader = false;
846 863 if (error.response.status === 401) {
... ... @@ -854,14 +871,14 @@ export default {
854 871 http()
855 872 .get("/getParentsList", {
856 873 headers: {
857   - Authorization: "Bearer " + this.token
858   - }
  874 + Authorization: "Bearer " + this.token,
  875 + },
859 876 })
860   - .then(response => {
  877 + .then((response) => {
861 878 this.parents = response.data.data;
862 879 this.showLoader = false;
863 880 })
864   - .catch(error => {
  881 + .catch((error) => {
865 882 // console.log("err====>", err);
866 883 this.showLoader = false;
867 884 });
... ... @@ -870,14 +887,14 @@ export default {
870 887 http()
871 888 .get("/getTeachersList", {
872 889 headers: {
873   - Authorization: "Bearer " + this.token
874   - }
  890 + Authorization: "Bearer " + this.token,
  891 + },
875 892 })
876   - .then(response => {
  893 + .then((response) => {
877 894 this.teachers = response.data.data;
878 895 this.showLoader = false;
879 896 })
880   - .catch(error => {
  897 + .catch((error) => {
881 898 // console.log("err====>", err);
882 899 this.showLoader = false;
883 900 });
... ... @@ -886,14 +903,14 @@ export default {
886 903 http()
887 904 .get("/getClassesList", {
888 905 headers: {
889   - Authorization: "Bearer " + this.token
890   - }
  906 + Authorization: "Bearer " + this.token,
  907 + },
891 908 })
892   - .then(response => {
  909 + .then((response) => {
893 910 this.classes = response.data.data;
894 911 this.showLoader = false;
895 912 })
896   - .catch(error => {
  913 + .catch((error) => {
897 914 this.showLoader = false;
898 915 });
899 916 },
... ... @@ -902,14 +919,14 @@ export default {
902 919 http()
903 920 .get("/getEventsList", {
904 921 headers: {
905   - Authorization: "Bearer " + this.token
906   - }
  922 + Authorization: "Bearer " + this.token,
  923 + },
907 924 })
908   - .then(response => {
  925 + .then((response) => {
909 926 this.noticeData = response.data.data;
910 927 this.showLoader = false;
911 928 })
912   - .catch(error => {
  929 + .catch((error) => {
913 930 this.showLoader = false;
914 931 });
915 932 },
... ... @@ -919,31 +936,31 @@ export default {
919 936 http()
920 937 .get("/getParticularUserDetail", {
921 938 headers: {
922   - Authorization: "Bearer " + this.token
  939 + Authorization: "Bearer " + this.token,
923 940 },
924 941 params: {
925   - studentId: localStorage.getItem("parentStudentId")
926   - }
  942 + studentId: localStorage.getItem("parentStudentId"),
  943 + },
927 944 })
928   - .then(response => {
  945 + .then((response) => {
929 946 this.userData = response.data.data;
930 947 this.showLoader = false;
931 948 })
932   - .catch(error => {
  949 + .catch((error) => {
933 950 this.showLoader = false;
934 951 });
935 952 } else {
936 953 http()
937 954 .get("/getParticularUserDetail", {
938 955 headers: {
939   - Authorization: "Bearer " + this.token
940   - }
  956 + Authorization: "Bearer " + this.token,
  957 + },
941 958 })
942   - .then(response => {
  959 + .then((response) => {
943 960 this.userData = response.data.data;
944 961 this.showLoader = false;
945 962 })
946   - .catch(error => {
  963 + .catch((error) => {
947 964 this.showLoader = false;
948 965 });
949 966 }
... ... @@ -953,10 +970,10 @@ export default {
953 970 http()
954 971 .get("/getTotalFeesAndCollections", {
955 972 headers: {
956   - Authorization: "Bearer " + this.token
957   - }
  973 + Authorization: "Bearer " + this.token,
  974 + },
958 975 })
959   - .then(response => {
  976 + .then((response) => {
960 977 this.feeData = response.data.data;
961 978 // this.collectionData = response.data.data;
962 979 this.series[0].data[0] = this.feeData.totalFees;
... ... @@ -964,7 +981,7 @@ export default {
964 981  
965 982 this.showLoader = false;
966 983 })
967   - .catch(error => {
  984 + .catch((error) => {
968 985 this.showLoader = false;
969 986 });
970 987 },
... ... @@ -972,10 +989,10 @@ export default {
972 989 http()
973 990 .get("/getTotalExpenses", {
974 991 headers: {
975   - Authorization: "Bearer " + this.token
976   - }
  992 + Authorization: "Bearer " + this.token,
  993 + },
977 994 })
978   - .then(response => {
  995 + .then((response) => {
979 996 this.expenseData = response.data.data;
980 997 // var array = response.data.data.sum;
981 998 this.series[0].data[2] = this.expenseData.sum;
... ... @@ -987,7 +1004,7 @@ export default {
987 1004 // ];
988 1005 this.showLoader = false;
989 1006 })
990   - .catch(error => {
  1007 + .catch((error) => {
991 1008 this.showLoader = false;
992 1009 });
993 1010 },
... ... @@ -997,7 +1014,7 @@ export default {
997 1014 var classId;
998 1015 await http()
999 1016 .get("/parentStudentsList")
1000   - .then(response => {
  1017 + .then((response) => {
1001 1018 this.studentsData = response.data.data;
1002 1019 localStorage.setItem(
1003 1020 "parentStudentId",
... ... @@ -1019,7 +1036,7 @@ export default {
1019 1036  
1020 1037 this.showLoader = false;
1021 1038 })
1022   - .catch(err => {
  1039 + .catch((err) => {
1023 1040 console.log("err====>", err);
1024 1041 this.showLoader = false;
1025 1042 });
... ... @@ -1030,7 +1047,7 @@ export default {
1030 1047 /* getStudentCourses - to get courseData - defined in GetApis.js*/
1031 1048 await this.getStudentCourses({
1032 1049 classId: classId,
1033   - studentId: parentStudentsId
  1050 + studentId: parentStudentsId,
1034 1051 });
1035 1052 },
1036 1053 getAnnoucementes(classId) {
... ... @@ -1038,14 +1055,14 @@ export default {
1038 1055 http()
1039 1056 .get("/getAnnoucementesList", {
1040 1057 params: {
1041   - classId: classId
1042   - }
  1058 + classId: classId,
  1059 + },
1043 1060 })
1044   - .then(response => {
  1061 + .then((response) => {
1045 1062 this.annoucementData = response.data.data;
1046 1063 this.showLoader = false;
1047 1064 })
1048   - .catch(err => {
  1065 + .catch((err) => {
1049 1066 console.log("err====>", err);
1050 1067 this.showLoader = false;
1051 1068 });
... ... @@ -1056,10 +1073,10 @@ export default {
1056 1073 await http()
1057 1074 .get("/getMeetingEventesList", {
1058 1075 headers: {
1059   - Authorization: "Bearer " + this.token
1060   - }
  1076 + Authorization: "Bearer " + this.token,
  1077 + },
1061 1078 })
1062   - .then(response => {
  1079 + .then((response) => {
1063 1080 var activityList = response.data.data;
1064 1081 this.activityList = activityList;
1065 1082 this.showLoader = false;
... ... @@ -1075,11 +1092,11 @@ export default {
1075 1092 this.activityEvents.push(obj);
1076 1093 }
1077 1094 })
1078   - .catch(error => {
  1095 + .catch((error) => {
1079 1096 this.showLoader = false;
1080 1097 });
1081 1098 }
1082   - }
  1099 + },
1083 1100 },
1084 1101  
1085 1102 mounted() {
... ... @@ -1091,8 +1108,12 @@ export default {
1091 1108 async created() {
1092 1109 if (this.$store.state.role === "ADMIN") {
1093 1110 this.token = this.$store.state.token;
  1111 + await this.getFeesAndCollectionsData();
  1112 + await this.getExpensesData();
1094 1113 } else if (this.$store.state.schoolRole === "SUPERADMIN") {
1095 1114 this.token = this.$store.state.schoolToken;
  1115 + await this.getFeesAndCollectionsData();
  1116 + await this.getExpensesData();
1096 1117 } else if (this.$store.state.role === "TEACHER") {
1097 1118 this.token = this.$store.state.token;
1098 1119 } else if (this.$store.state.role === "ACCOUNTANT") {
... ... @@ -1112,13 +1133,11 @@ export default {
1112 1133 await this.getClasses();
1113 1134 await this.getNoticeData();
1114 1135 await this.getUserData();
1115   - await this.getFeesAndCollectionsData();
1116   - await this.getExpensesData();
1117 1136  
1118 1137 /* get Latest events list for student login*/
1119 1138 if (this.$store.state.role == "PARENT") {
1120 1139 let response = await this.studentMeetingEvents({
1121   - studentId: localStorage.getItem("parentStudentId")
  1140 + studentId: localStorage.getItem("parentStudentId"),
1122 1141 });
1123 1142 this.activityList = response.data.data;
1124 1143  
... ... @@ -1138,7 +1157,7 @@ export default {
1138 1157 if (this.role == "TEACHER") {
1139 1158 await this.getMeetingEventes();
1140 1159 }
1141   - }
  1160 + },
1142 1161 };
1143 1162 </script>
1144 1163  
... ...