Commit eeb8db6032b8cba7bd185c1ea037b91257cc1033
1 parent
d84fa5db26
Exists in
master
and in
2 other branches
added pdf link in teachers
Showing
1 changed file
with
142 additions
and
123 deletions
Show diff stats
src/pages/Course/courseDetail.vue
... | ... | @@ -393,6 +393,22 @@ |
393 | 393 | </h5> |
394 | 394 | </v-flex> |
395 | 395 | </v-layout> |
396 | + <!-- LINK TO PDF --> | |
397 | + <v-layout row justify-center> | |
398 | + <v-flex xs6> | |
399 | + <div style="width: 100%;"> | |
400 | + <a | |
401 | + :href="editedItem.pdfFileUrl" | |
402 | + target="_blank" | |
403 | + style="text-decoration: none!important;" | |
404 | + > | |
405 | + <v-btn flat block> | |
406 | + <span><h5><b>Open PDF</b></h5></span> | |
407 | + </v-btn> | |
408 | + </a> | |
409 | + </div> | |
410 | + </v-flex> | |
411 | + </v-layout> | |
396 | 412 | </v-flex> |
397 | 413 | </v-layout> |
398 | 414 | </v-container> |
... | ... | @@ -401,66 +417,72 @@ |
401 | 417 | </v-dialog> |
402 | 418 | |
403 | 419 | <!-- ****** Course Detail TABLE ****** --> |
404 | - | |
405 | - <v-toolbar color="transparent" flat> | |
406 | - <v-btn | |
407 | - fab | |
408 | - dark | |
409 | - class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | |
410 | - small | |
411 | - @click="addCourseDetailDialog = true" | |
412 | - > | |
413 | - <v-icon dark>add</v-icon> | |
414 | - </v-btn> | |
415 | - <v-btn | |
416 | - round | |
417 | - class="open-dialog-button hidden-sm-only hidden-xs-only" | |
418 | - dark | |
419 | - @click="addCourseDetailDialog = true" | |
420 | - > | |
421 | - <v-icon class="white--text pr-1" size="20">add</v-icon>Add Course Detail | |
422 | - </v-btn> | |
423 | - <v-flex xs12 sm4 md2> | |
424 | - <v-select | |
420 | + <v-container grid-list-lg class="pa-0"> | |
421 | + <v-layout row wrap> | |
422 | + <!-- <v-btn | |
423 | + fab | |
424 | + dark | |
425 | + class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" | |
425 | 426 | small |
426 | - :items="addclass" | |
427 | - label="Select Class" | |
428 | - v-model="getCourse.classId" | |
429 | - item-text="classNum" | |
430 | - item-value="_id" | |
431 | - name="Select Class" | |
432 | - @change="getCourses(getCourse.classId)" | |
433 | - class="mr-2" | |
434 | - required | |
435 | - ></v-select> | |
436 | - </v-flex> | |
437 | - <v-flex xs12 sm4 md2> | |
438 | - <v-select | |
439 | - :items="courseData" | |
440 | - label="Select Course" | |
441 | - v-model="getCourse.courseId" | |
442 | - item-text="courseName" | |
443 | - item-value="_id" | |
444 | - required | |
445 | - class="ml-2" | |
446 | - @change="getCourseDetailsList(getCourse.courseId)" | |
447 | - ></v-select> | |
448 | - </v-flex> | |
449 | - <v-spacer></v-spacer> | |
450 | - <v-card-title class="body-1" v-show="show"> | |
451 | - <v-btn icon large flat @click="displaySearch"> | |
452 | - <v-avatar size="27"> | |
453 | - <img src="/static/icon/search.png" alt="icon" /> | |
454 | - </v-avatar> | |
455 | - </v-btn> | |
456 | - </v-card-title> | |
457 | - <v-flex xs8 sm8 md3 lg2 v-show="showSearch"> | |
458 | - <v-layout> | |
459 | - <v-text-field v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> | |
460 | - <v-icon @click="closeSearch" color="error">close</v-icon> | |
461 | - </v-layout> | |
462 | - </v-flex> | |
463 | - </v-toolbar> | |
427 | + @click="addCourseDetailDialog = true" | |
428 | + > | |
429 | + <v-icon dark>add</v-icon> | |
430 | + </v-btn>--> | |
431 | + <v-flex xs12 sm4> | |
432 | + <v-btn block round class="open-dialog-button" dark @click="addCourseDetailDialog = true"> | |
433 | + <v-icon class="white--text pr-1" size="20">add</v-icon> | |
434 | + <span class="hidden-sm-and-down">Add Course Detail</span> | |
435 | + <span class="hidden-md-and-up">Add</span> | |
436 | + </v-btn> | |
437 | + </v-flex> | |
438 | + | |
439 | + <v-flex xs12 sm4 md2> | |
440 | + <v-select | |
441 | + :items="addclass" | |
442 | + label="Select Class" | |
443 | + v-model="getCourse.classId" | |
444 | + item-text="classNum" | |
445 | + item-value="_id" | |
446 | + name="Select Class" | |
447 | + @change="getCourses(getCourse.classId)" | |
448 | + required | |
449 | + ></v-select> | |
450 | + </v-flex> | |
451 | + <v-flex xs12 sm4 md2> | |
452 | + <v-select | |
453 | + :items="courseData" | |
454 | + label="Select Course" | |
455 | + v-model="getCourse.courseId" | |
456 | + item-text="courseName" | |
457 | + item-value="_id" | |
458 | + required | |
459 | + @change="getCourseDetailsList(getCourse.courseId)" | |
460 | + ></v-select> | |
461 | + </v-flex> | |
462 | + | |
463 | + <v-flex xs12 sm1 v-if="show"> | |
464 | + <v-btn icon large flat @click="show = false;showSearch = true;"> | |
465 | + <v-avatar size="27"> | |
466 | + <img src="/static/icon/search.png" alt="icon" /> | |
467 | + </v-avatar> | |
468 | + </v-btn> | |
469 | + </v-flex> | |
470 | + | |
471 | + <v-flex xs12 sm3 md3 v-if="showSearch"> | |
472 | + <div style="display: inline-block;width: 70%;"> | |
473 | + <v-text-field | |
474 | + v-model="search" | |
475 | + label="Search" | |
476 | + prepend-inner-icon="search" | |
477 | + color="primary" | |
478 | + ></v-text-field> | |
479 | + </div> | |
480 | + <div style="display: inline-block;"> | |
481 | + <v-icon @click="closeSearch" color="error">close</v-icon> | |
482 | + </div> | |
483 | + </v-flex> | |
484 | + </v-layout> | |
485 | + </v-container> | |
464 | 486 | <v-data-table |
465 | 487 | :headers="headers" |
466 | 488 | :items="CourseDetailsList" |
... | ... | @@ -518,6 +540,7 @@ |
518 | 540 | </td> |
519 | 541 | </tr> |
520 | 542 | </template> |
543 | + <!-- CHAPTERS IN A COURSE --> | |
521 | 544 | <template slot="expand"> |
522 | 545 | <v-data-table :items="chapters" hide-actions item-key="chapterName" style="width: auto;"> |
523 | 546 | <template slot="items" slot-scope="props"> |
... | ... | @@ -728,12 +751,7 @@ |
728 | 751 | <v-layout> |
729 | 752 | <v-flex xs12 sm12> |
730 | 753 | <v-layout class="right"> |
731 | - <v-btn | |
732 | - @click="clear();" | |
733 | - round | |
734 | - dark | |
735 | - class="clear-button" | |
736 | - >Clear</v-btn> | |
754 | + <v-btn @click="clear();" round dark class="clear-button">Clear</v-btn> | |
737 | 755 | <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> |
738 | 756 | </v-layout> |
739 | 757 | </v-flex> |
... | ... | @@ -766,7 +784,7 @@ export default { |
766 | 784 | mixins: [AllApiCalls], |
767 | 785 | components: { |
768 | 786 | UploadFiles, |
769 | - UploadPdf | |
787 | + UploadPdf, | |
770 | 788 | }, |
771 | 789 | data: () => ({ |
772 | 790 | snackbar: false, |
... | ... | @@ -801,55 +819,55 @@ export default { |
801 | 819 | { |
802 | 820 | chapterName: "", |
803 | 821 | description: "", |
804 | - chapterPoints: [] | |
805 | - } | |
806 | - ] | |
822 | + chapterPoints: [], | |
823 | + }, | |
824 | + ], | |
807 | 825 | }, |
808 | 826 | chapters: [], |
809 | 827 | pagination: { |
810 | - rowsPerPage: 10 | |
828 | + rowsPerPage: 10, | |
811 | 829 | }, |
812 | 830 | editFiles: [], |
813 | 831 | files: [], |
814 | 832 | courseData: [], |
815 | 833 | token: "", |
816 | 834 | courseId: "", |
817 | - clsssRules: [v => !!v || " Class is required"], | |
818 | - courseRules: [v => !!v || " Course is required"], | |
819 | - chapterNameRules: [v => !!v || " Tilte is required"], | |
820 | - descriptionRules: [v => !!v || " Description is required"], | |
835 | + clsssRules: [(v) => !!v || " Class is required"], | |
836 | + courseRules: [(v) => !!v || " Course is required"], | |
837 | + chapterNameRules: [(v) => !!v || " Tilte is required"], | |
838 | + descriptionRules: [(v) => !!v || " Description is required"], | |
821 | 839 | headers: [ |
822 | 840 | { |
823 | 841 | align: "", |
824 | 842 | text: "No", |
825 | 843 | sortable: false, |
826 | - value: "index" | |
844 | + value: "index", | |
827 | 845 | }, |
828 | 846 | { |
829 | 847 | text: "Class Name", |
830 | 848 | value: "classNum", |
831 | 849 | sortable: false, |
832 | - align: "center" | |
850 | + align: "center", | |
833 | 851 | }, |
834 | 852 | { |
835 | 853 | text: "Course Name", |
836 | 854 | value: "courseName", |
837 | 855 | sortable: false, |
838 | - align: "center" | |
856 | + align: "center", | |
839 | 857 | }, |
840 | - { text: "Action", value: "", sortable: false, align: "center" } | |
858 | + { text: "Action", value: "", sortable: false, align: "center" }, | |
841 | 859 | ], |
842 | 860 | CourseDetailsList: [], |
843 | 861 | editedIndex: -1, |
844 | 862 | editedItem: {}, |
845 | 863 | editedCourse: {}, |
846 | 864 | editChapter: { |
847 | - chapterPoints: [] | |
865 | + chapterPoints: [], | |
848 | 866 | }, |
849 | 867 | index: "", |
850 | 868 | addChapterItem: {}, |
851 | 869 | addChapterItemObj: {}, |
852 | - addChapterDialog: false | |
870 | + addChapterDialog: false, | |
853 | 871 | }), |
854 | 872 | methods: { |
855 | 873 | getCourses(classId) { |
... | ... | @@ -857,16 +875,16 @@ export default { |
857 | 875 | http() |
858 | 876 | .get("/getCourseesList", { |
859 | 877 | params: { |
860 | - classId: classId | |
861 | - } | |
878 | + classId: classId, | |
879 | + }, | |
862 | 880 | }) |
863 | - .then(response => { | |
881 | + .then((response) => { | |
864 | 882 | this.editChapter.courseId = ""; |
865 | 883 | this.courseData = response.data.data; |
866 | 884 | // console.log("this.courseData", this.courseData); |
867 | 885 | this.showLoader = false; |
868 | 886 | }) |
869 | - .catch(err => { | |
887 | + .catch((err) => { | |
870 | 888 | console.log("err====>", err); |
871 | 889 | this.showLoader = false; |
872 | 890 | }); |
... | ... | @@ -876,17 +894,17 @@ export default { |
876 | 894 | http() |
877 | 895 | .get("/getParticularCourseDetail", { |
878 | 896 | params: { |
879 | - courseId: this.getCourse.courseId | |
880 | - } | |
897 | + courseId: this.getCourse.courseId, | |
898 | + }, | |
881 | 899 | }) |
882 | - .then(response => { | |
900 | + .then((response) => { | |
883 | 901 | this.CourseDetailsList = response.data.data; |
884 | 902 | if (response.data.data[0]) { |
885 | 903 | this.chapters = response.data.data[0].chapters; |
886 | 904 | } |
887 | 905 | this.showLoader = false; |
888 | 906 | }) |
889 | - .catch(error => { | |
907 | + .catch((error) => { | |
890 | 908 | // console.log("err====>", err); |
891 | 909 | this.showLoader = false; |
892 | 910 | if (error.response.status === 401) { |
... | ... | @@ -913,7 +931,7 @@ export default { |
913 | 931 | this.loading = true; |
914 | 932 | http() |
915 | 933 | .put("/addChapters", this.addChapterItem) |
916 | - .then(response => { | |
934 | + .then((response) => { | |
917 | 935 | this.addChapterDialog = false; |
918 | 936 | this.loading = false; |
919 | 937 | this.snackbar = true; |
... | ... | @@ -923,7 +941,7 @@ export default { |
923 | 941 | this.removeChapterPoint(); |
924 | 942 | this.getCourseDetailsList(); |
925 | 943 | }) |
926 | - .catch(error => { | |
944 | + .catch((error) => { | |
927 | 945 | this.snackbar = true; |
928 | 946 | this.text = error.response.data.message; |
929 | 947 | this.color = "error"; |
... | ... | @@ -931,6 +949,7 @@ export default { |
931 | 949 | }); |
932 | 950 | }, |
933 | 951 | profile(item) { |
952 | + console.log("chaper - ", item); | |
934 | 953 | this.editedIndex = this.chapters.indexOf(item); |
935 | 954 | this.editedItem = Object.assign({}, item); |
936 | 955 | this.viewProfileGallery = true; |
... | ... | @@ -951,7 +970,7 @@ export default { |
951 | 970 | }, |
952 | 971 | deleteItem(item) { |
953 | 972 | let deleteGallery = { |
954 | - courseDetailId: item._id | |
973 | + courseDetailId: item._id, | |
955 | 974 | }; |
956 | 975 | http() |
957 | 976 | .delete( |
... | ... | @@ -959,17 +978,17 @@ export default { |
959 | 978 | confirm("Are you sure you want to delete this?") && { |
960 | 979 | params: deleteGallery, |
961 | 980 | headers: { |
962 | - Authorization: "Bearer " + this.token | |
963 | - } | |
981 | + Authorization: "Bearer " + this.token, | |
982 | + }, | |
964 | 983 | } |
965 | 984 | ) |
966 | - .then(response => { | |
985 | + .then((response) => { | |
967 | 986 | this.snackbar = true; |
968 | 987 | this.text = "Successfully delete Course Details"; |
969 | 988 | this.color = "green"; |
970 | 989 | this.getCourseDetailsList(); |
971 | 990 | }) |
972 | - .catch(error => { | |
991 | + .catch((error) => { | |
973 | 992 | // console.log(error); |
974 | 993 | this.snackbar = true; |
975 | 994 | this.text = error.response.data.message; |
... | ... | @@ -980,20 +999,20 @@ export default { |
980 | 999 | // console.log("item", item); |
981 | 1000 | let deleteChapters = { |
982 | 1001 | courseDetailId: this.courseId, |
983 | - chapterId: item._id | |
1002 | + chapterId: item._id, | |
984 | 1003 | }; |
985 | 1004 | http() |
986 | 1005 | .put( |
987 | 1006 | "/deleteChapters", |
988 | 1007 | confirm("Are you sure you want to delete this?") && deleteChapters |
989 | 1008 | ) |
990 | - .then(response => { | |
1009 | + .then((response) => { | |
991 | 1010 | this.snackbar = true; |
992 | 1011 | this.text = "Successfully delete Chapters"; |
993 | 1012 | this.color = "green"; |
994 | 1013 | this.getCourseDetailsList(); |
995 | 1014 | }) |
996 | - .catch(error => { | |
1015 | + .catch((error) => { | |
997 | 1016 | // console.log(error); |
998 | 1017 | this.snackbar = true; |
999 | 1018 | this.text = error.response.data.message; |
... | ... | @@ -1018,8 +1037,8 @@ export default { |
1018 | 1037 | description: this.addCourseDetail.description, |
1019 | 1038 | chapterPoints: chapterPoints, |
1020 | 1039 | uploadPdf: this.pdfFile, |
1021 | - uploadPpt: this.pptFile | |
1022 | - } | |
1040 | + uploadPpt: this.pptFile, | |
1041 | + }, | |
1023 | 1042 | ]; |
1024 | 1043 | } |
1025 | 1044 | if (this.$refs.form.validate()) { |
... | ... | @@ -1027,12 +1046,12 @@ export default { |
1027 | 1046 | var courseDetailsData = { |
1028 | 1047 | classId: this.addCourseDetail.classId, |
1029 | 1048 | courseId: this.addCourseDetail.courseId, |
1030 | - chapters: chapters | |
1049 | + chapters: chapters, | |
1031 | 1050 | }; |
1032 | 1051 | this.loading = true; |
1033 | 1052 | http() |
1034 | 1053 | .post("/createCourseDetail", courseDetailsData) |
1035 | - .then(response => { | |
1054 | + .then((response) => { | |
1036 | 1055 | this.addCourseDetailDialog = false; |
1037 | 1056 | this.loading = false; |
1038 | 1057 | this.snackbar = true; |
... | ... | @@ -1043,7 +1062,7 @@ export default { |
1043 | 1062 | this.emptyPdf = "reset"; |
1044 | 1063 | this.removeAddFind(); |
1045 | 1064 | }) |
1046 | - .catch(error => { | |
1065 | + .catch((error) => { | |
1047 | 1066 | this.snackbar = true; |
1048 | 1067 | this.text = error.response.data.message; |
1049 | 1068 | this.color = "error"; |
... | ... | @@ -1068,12 +1087,12 @@ export default { |
1068 | 1087 | description: this.editChapter.description, |
1069 | 1088 | chapterPoints: chapterPoints, |
1070 | 1089 | uploadPdf: this.pdfFile, |
1071 | - uploadPpt: this.pptFile | |
1090 | + uploadPpt: this.pptFile, | |
1072 | 1091 | }; |
1073 | 1092 | this.editLoading = true; |
1074 | 1093 | http() |
1075 | 1094 | .put("/updateChapters", updateData) |
1076 | - .then(response => { | |
1095 | + .then((response) => { | |
1077 | 1096 | this.editChapterDetailDialog = false; |
1078 | 1097 | this.snackbar = true; |
1079 | 1098 | this.text = response.data.message; |
... | ... | @@ -1084,7 +1103,7 @@ export default { |
1084 | 1103 | this.emptyPdf = "reset"; |
1085 | 1104 | this.getCourseDetailsList(); |
1086 | 1105 | }) |
1087 | - .catch(error => { | |
1106 | + .catch((error) => { | |
1088 | 1107 | this.editLoading = false; |
1089 | 1108 | this.snackbar = true; |
1090 | 1109 | this.text = error.response.data.message; |
... | ... | @@ -1095,12 +1114,12 @@ export default { |
1095 | 1114 | var updateData = { |
1096 | 1115 | courseDetailId: this.editedCourse._id, |
1097 | 1116 | courseId: this.editedCourse.courseId, |
1098 | - classId: this.editedCourse.classId | |
1117 | + classId: this.editedCourse.classId, | |
1099 | 1118 | }; |
1100 | 1119 | this.editLoading = true; |
1101 | 1120 | http() |
1102 | 1121 | .put("/updateCourseDetail", updateData) |
1103 | - .then(response => { | |
1122 | + .then((response) => { | |
1104 | 1123 | this.getCourseDetailsList(); |
1105 | 1124 | this.editCourseDetailDialog = false; |
1106 | 1125 | this.snackbar = true; |
... | ... | @@ -1110,7 +1129,7 @@ export default { |
1110 | 1129 | // this.editChapterPointName = ""; |
1111 | 1130 | this.editFiles = []; |
1112 | 1131 | }) |
1113 | - .catch(error => { | |
1132 | + .catch((error) => { | |
1114 | 1133 | this.editLoading = false; |
1115 | 1134 | this.snackbar = true; |
1116 | 1135 | this.text = error.response.data.message; |
... | ... | @@ -1120,46 +1139,46 @@ export default { |
1120 | 1139 | getAllClasses() { |
1121 | 1140 | http() |
1122 | 1141 | .get("/getClassesList", { |
1123 | - headers: { Authorization: "Bearer " + this.token } | |
1142 | + headers: { Authorization: "Bearer " + this.token }, | |
1124 | 1143 | }) |
1125 | - .then(response => { | |
1144 | + .then((response) => { | |
1126 | 1145 | this.addclass = response.data.data; |
1127 | 1146 | }) |
1128 | - .catch(err => { | |
1147 | + .catch((err) => { | |
1129 | 1148 | // console.log("err====>", err); |
1130 | 1149 | }); |
1131 | 1150 | }, |
1132 | - removeChapterPoint: function() { | |
1151 | + removeChapterPoint: function () { | |
1133 | 1152 | this.findsChapterPoint = [{ value: "" }]; |
1134 | 1153 | }, |
1135 | - removeAddFind: function() { | |
1154 | + removeAddFind: function () { | |
1136 | 1155 | this.finds = [{ value: "" }]; |
1137 | 1156 | }, |
1138 | - addFind: function() { | |
1157 | + addFind: function () { | |
1139 | 1158 | this.finds.push({ value: "" }); |
1140 | 1159 | }, |
1141 | - addChapterPoint: function() { | |
1160 | + addChapterPoint: function () { | |
1142 | 1161 | this.findsChapterPoint.push({ value: "" }); |
1143 | 1162 | }, |
1144 | - update: function() { | |
1163 | + update: function () { | |
1145 | 1164 | this.updates.push({ value: "" }); |
1146 | 1165 | }, |
1147 | 1166 | // removeUpdatePoints: function() { |
1148 | 1167 | // this.updates = [{ value: "" }]; |
1149 | 1168 | // }, |
1150 | - deleteFind: function(index) { | |
1169 | + deleteFind: function (index) { | |
1151 | 1170 | this.finds.splice(index, 1); |
1152 | 1171 | if (index === 0) this.addFind(); |
1153 | 1172 | }, |
1154 | - deleteChapterPoint: function(index) { | |
1173 | + deleteChapterPoint: function (index) { | |
1155 | 1174 | this.findsChapterPoint.splice(index, 1); |
1156 | 1175 | if (index === 0) this.addChapterPoint(); |
1157 | 1176 | }, |
1158 | - deleteUpdate: function(index) { | |
1177 | + deleteUpdate: function (index) { | |
1159 | 1178 | this.updates.splice(index, 1); |
1160 | 1179 | if (index === 0) this.update(); |
1161 | 1180 | }, |
1162 | - deleteUrl: function(index, youTubelinkId, id) { | |
1181 | + deleteUrl: function (index, youTubelinkId, id) { | |
1163 | 1182 | this.editChapter.chapterPoints.splice(index, 1); |
1164 | 1183 | if (index === 0) this.update(); |
1165 | 1184 | }, |
... | ... | @@ -1171,11 +1190,11 @@ export default { |
1171 | 1190 | this.showSearch = false; |
1172 | 1191 | this.show = true; |
1173 | 1192 | this.search = ""; |
1174 | - } | |
1193 | + }, | |
1175 | 1194 | }, |
1176 | 1195 | mounted() { |
1177 | 1196 | this.token = this.$store.state.token; |
1178 | 1197 | this.getAllClasses(); |
1179 | - } | |
1198 | + }, | |
1180 | 1199 | }; |
1181 | 1200 | </script> |
1182 | 1201 | \ No newline at end of file | ... | ... |