Commit c3af2406b71cf6ec5db340df067389650a2f3c6b

Authored by Shikha Mishra
1 parent af6c7b97a1

document section for pdf in course detail

src/pages/Common/UploadPdf.vue
... ... @@ -23,7 +23,7 @@ export default {
23 23 return {
24 24 fileToLoad: "",
25 25 fileName: "",
26   - fileInBase64: ""
  26 + fileInBase64: "",
27 27 };
28 28 },
29 29 methods: {
... ... @@ -39,12 +39,12 @@ export default {
39 39 // Select the very first file from list
40 40 this.fileToLoad = selectedFile[0];
41 41 this.fileName = selectedFile[0].name;
42   - console.log("file name - ", this.fileName);
  42 + // console.log("file name - ", this.fileName);
43 43 // FileReader function for read the file.
44 44 var fileReader = new FileReader();
45 45 // Onload of file read the file content
46 46 let vm = this;
47   - fileReader.onload = function(fileLoadedEvent) {
  47 + fileReader.onload = function (fileLoadedEvent) {
48 48 vm.fileInBase64 = fileLoadedEvent.target.result;
49 49 // Print data in console
50 50 // console.log(vm.fileInBase64);
... ... @@ -54,9 +54,9 @@ export default {
54 54 // console.log("required - ", requiredUrl);
55 55  
56 56 let fileData = {
57   - fileName: this.fileName,
  57 + selectedFileName: vm.fileName,
58 58 fileInBase64: requiredUrl,
59   - emptyPdf: ""
  59 + emptyPdf: "",
60 60 };
61 61 vm.$emit("pdfFileSelected", fileData);
62 62 };
... ... @@ -78,10 +78,10 @@ export default {
78 78 let fileData = {
79 79 fileName: this.fileName,
80 80 fileInBase64: this.fileInBase64,
81   - trigger: ""
  81 + trigger: "",
82 82 };
83 83 this.$emit("fileSelected", fileData);
84   - }
  84 + },
85 85 },
86 86 watch: {
87 87 respondToTrigger() {
... ... @@ -89,17 +89,17 @@ export default {
89 89 // console.log("Reset pdf - ", this.emptyPdf);
90 90 this.resetInput();
91 91 }
92   - }
  92 + },
93 93 },
94 94 computed: {
95 95 respondToTrigger: {
96 96 get() {
97 97 return this.emptyPdf;
98 98 },
99   - set(newVal) {}
  99 + set(newVal) {},
100 100 // this.respondToTrigger = this.trigger;
101   - }
102   - }
  101 + },
  102 + },
103 103 };
104 104 </script>
105 105 <style scoped >
... ...
src/pages/Course/courseDetail.vue
... ... @@ -139,7 +139,7 @@
139 139 </v-flex>
140 140 <v-flex xs8 sm6 class="ml-3">
141 141 <UploadPdf
142   - @pdfFileSelected="pdfFileSelected($event,'fileName')"
  142 + @pdfFileSelected="pdfFileSelected($event,'uploadPDF')"
143 143 label="Add PDF"
144 144 reference="editPdf"
145 145 id="editPdfInput"
... ... @@ -290,12 +290,11 @@
290 290 </v-flex>
291 291 <v-flex xs8 sm6 class="ml-3">
292 292 <UploadPdf
293   - @pdfFileSelected="pdfFileSelected($event,'fileName')"
  293 + @pdfFileSelected="pdfFileSelected($event,'uploadPDF')"
294 294 label="Add PDF"
295 295 reference="newChapterPdf"
296 296 id="newChapterPdfInput"
297 297 :emptyPdf="emptyPdf"
298   - v-model="addChapterItem.fileName"
299 298 ></UploadPdf>
300 299 </v-flex>
301 300 </v-layout>
... ... @@ -421,45 +420,6 @@
421 420 </v-card>
422 421 </v-dialog>
423 422  
424   - <v-dialog v-model="viewDocument" max-width="1000" scrollable>
425   - <v-card flat class="card-style pa-3" dark>
426   - <v-layout>
427   - <v-flex xs12>
428   - <label class="title text-xs-center">View Document</label>
429   - <v-icon size="24" class="right" @click="closeviewDocument">cancel</v-icon>
430   - </v-flex>
431   - </v-layout>
432   - <v-card-text>
433   - <v-container grid-list-md>
434   - <v-layout wrap>
435   - <v-flex xs12>
436   - <!-- LINK TO PDF -->
437   - <v-layout row justify-center v-show="editedItem.pdfFileUrl != ''">
438   - <v-flex xs6>
439   - <div style="width: 100%;">
440   - <a
441   - :href="editedItem.pdfFileUrl"
442   - target="_blank"
443   - style="text-decoration: none!important;"
444   - >
445   - <v-btn flat block>
446   - <span>
447   - <h5>
448   - <b>Open PDF</b>
449   - </h5>
450   - </span>
451   - </v-btn>
452   - </a>
453   - </div>
454   - </v-flex>
455   - </v-layout>
456   - </v-flex>
457   - </v-layout>
458   - </v-container>
459   - </v-card-text>
460   - </v-card>
461   - </v-dialog>
462   -
463 423 <!-- ****** Course Detail TABLE ****** -->
464 424 <v-toolbar color="transparent" flat>
465 425 <!-- <v-flex xs1>
... ... @@ -642,16 +602,11 @@
642 602 slot="activator"
643 603 style="cursor:pointer; width:20px; height:20px; "
644 604 class="mr-3"
645   - @click="documents(props.item)"
646 605 src="/static/icon/dashboard icons-34.png"
  606 + @click="openLink(props.item.pdfFileUrl)"
647 607 />
648 608 <span>
649   - <a
650   - :href="editedItem.pdfFileUrl"
651   - style="text-decoration: underline!important; color: white;"
652   - >
653   - <h5>{{editedItem.pdfFileUrl}}</h5>
654   - </a>
  609 + <h5>{{props.item.fileName}}</h5>
655 610 </span>
656 611 </v-tooltip>
657 612 </td>
... ... @@ -782,12 +737,11 @@
782 737 </v-flex>
783 738 <v-flex xs8 sm8 md7 class="ml-3">
784 739 <UploadPdf
785   - @pdfFileSelected="pdfFileSelected($event,'fileName')"
  740 + @pdfFileSelected="pdfFileSelected($event,'uploadPDF')"
786 741 label="Add PDF"
787 742 reference="newCoursePdf"
788 743 id="newCoursePdfInput"
789 744 :emptyPdf="emptyPdf"
790   - v-model="addCourseDetail.fileName"
791 745 ></UploadPdf>
792 746 </v-flex>
793 747 </v-layout>
... ... @@ -871,7 +825,6 @@ export default {
871 825 editCourseDetailDialog: false,
872 826 editChapterDetailDialog: false,
873 827 viewProfileGallery: false,
874   - viewDocument: false,
875 828 valid: true,
876 829 editLoading: false,
877 830 addclass: [],
... ... @@ -939,6 +892,9 @@ export default {
939 892 showData: false,
940 893 }),
941 894 methods: {
  895 + openLink(url) {
  896 + window.open(url, "_blank");
  897 + },
942 898 getCourses(classId) {
943 899 this.showLoader = true;
944 900 http()
... ... @@ -1046,10 +1002,6 @@ export default {
1046 1002 }
1047 1003 this.editChapterDetailDialog = true;
1048 1004 },
1049   - documents(item) {
1050   - this.editedItem = Object.assign({}, item);
1051   - this.viewDocument = true;
1052   - },
1053 1005 deleteItem(item) {
1054 1006 let deleteGallery = {
1055 1007 courseDetailId: item._id,
... ... @@ -1107,9 +1059,6 @@ export default {
1107 1059 closeProfileGallery() {
1108 1060 this.viewProfileGallery = false;
1109 1061 },
1110   - closeviewDocument() {
1111   - this.viewDocument = false;
1112   - },
1113 1062 submit() {
1114 1063 let chapters = [];
1115 1064 var chapterPoints = [];
... ... @@ -1121,8 +1070,9 @@ export default {
1121 1070 chapterName: this.addCourseDetail.chapterName,
1122 1071 description: this.addCourseDetail.description,
1123 1072 chapterPoints: chapterPoints,
1124   - fileName: this.pdfFile,
  1073 + uploadPdf: this.pdfFile,
1125 1074 uploadPpt: this.pptFile,
  1075 + fileName: this.pdfFileName,
1126 1076 },
1127 1077 ];
1128 1078 }
... ... @@ -1201,8 +1151,9 @@ export default {
1201 1151 chapterName: this.editChapter.chapterName,
1202 1152 description: this.editChapter.description,
1203 1153 chapterPoints: chapterPoints,
1204   - fileName: this.pdfFile,
  1154 + uploadPDF: this.pdfFile,
1205 1155 uploadPpt: this.pptFile,
  1156 + fileName: this.pdfFileName,
1206 1157 };
1207 1158 this.editLoading = true;
1208 1159 http()
... ...