Commit c3af2406b71cf6ec5db340df067389650a2f3c6b

Authored by Shikha Mishra
1 parent af6c7b97a1

document section for pdf in course detail

src/pages/Common/UploadPdf.vue
1 <template> 1 <template>
2 <div> 2 <div>
3 <v-text-field 3 <v-text-field
4 :label="label" 4 :label="label"
5 @click="clickInputTag" 5 @click="clickInputTag"
6 v-model="fileName" 6 v-model="fileName"
7 append-icon="attach_file" 7 append-icon="attach_file"
8 ></v-text-field> 8 ></v-text-field>
9 <input 9 <input
10 type="file" 10 type="file"
11 style="display: none" 11 style="display: none"
12 :id="id" 12 :id="id"
13 :ref="reference" 13 :ref="reference"
14 accept="image/*" 14 accept="image/*"
15 @change="convertToBase64()" 15 @change="convertToBase64()"
16 /> 16 />
17 </div> 17 </div>
18 </template> 18 </template>
19 <script > 19 <script >
20 export default { 20 export default {
21 props: ["label", "reference", "id", "emptyPdf"], 21 props: ["label", "reference", "id", "emptyPdf"],
22 data() { 22 data() {
23 return { 23 return {
24 fileToLoad: "", 24 fileToLoad: "",
25 fileName: "", 25 fileName: "",
26 fileInBase64: "" 26 fileInBase64: "",
27 }; 27 };
28 }, 28 },
29 methods: { 29 methods: {
30 clickInputTag() { 30 clickInputTag() {
31 document.getElementById(this.id).click(); 31 document.getElementById(this.id).click();
32 }, 32 },
33 convertToBase64(e) { 33 convertToBase64(e) {
34 //Read File 34 //Read File
35 var selectedFile = document.getElementById(this.id).files; 35 var selectedFile = document.getElementById(this.id).files;
36 //Check File is not Empty 36 //Check File is not Empty
37 37
38 if (selectedFile.length > 0) { 38 if (selectedFile.length > 0) {
39 // Select the very first file from list 39 // Select the very first file from list
40 this.fileToLoad = selectedFile[0]; 40 this.fileToLoad = selectedFile[0];
41 this.fileName = selectedFile[0].name; 41 this.fileName = selectedFile[0].name;
42 console.log("file name - ", this.fileName); 42 // console.log("file name - ", this.fileName);
43 // FileReader function for read the file. 43 // FileReader function for read the file.
44 var fileReader = new FileReader(); 44 var fileReader = new FileReader();
45 // Onload of file read the file content 45 // Onload of file read the file content
46 let vm = this; 46 let vm = this;
47 fileReader.onload = function(fileLoadedEvent) { 47 fileReader.onload = function (fileLoadedEvent) {
48 vm.fileInBase64 = fileLoadedEvent.target.result; 48 vm.fileInBase64 = fileLoadedEvent.target.result;
49 // Print data in console 49 // Print data in console
50 // console.log(vm.fileInBase64); 50 // console.log(vm.fileInBase64);
51 51
52 var str = vm.fileInBase64; 52 var str = vm.fileInBase64;
53 const [baseUrl, requiredUrl] = str.split(/,/); 53 const [baseUrl, requiredUrl] = str.split(/,/);
54 // console.log("required - ", requiredUrl); 54 // console.log("required - ", requiredUrl);
55 55
56 let fileData = { 56 let fileData = {
57 fileName: this.fileName, 57 selectedFileName: vm.fileName,
58 fileInBase64: requiredUrl, 58 fileInBase64: requiredUrl,
59 emptyPdf: "" 59 emptyPdf: "",
60 }; 60 };
61 vm.$emit("pdfFileSelected", fileData); 61 vm.$emit("pdfFileSelected", fileData);
62 }; 62 };
63 63
64 // Convert data to base64 64 // Convert data to base64
65 fileReader.readAsDataURL(this.fileToLoad); 65 fileReader.readAsDataURL(this.fileToLoad);
66 } 66 }
67 }, 67 },
68 resetInput(params) { 68 resetInput(params) {
69 // RESET INPUT ELEMENT,fileName and selectedfile array 69 // RESET INPUT ELEMENT,fileName and selectedfile array
70 this.fileToLoad = null; 70 this.fileToLoad = null;
71 this.fileName = null; 71 this.fileName = null;
72 this.fileInBase64 = null; 72 this.fileInBase64 = null;
73 let inputTag = document.getElementById(this.id); 73 let inputTag = document.getElementById(this.id);
74 inputTag.value = null; 74 inputTag.value = null;
75 // inputTag.type = "text"; 75 // inputTag.type = "text";
76 // inputTag.type = "file"; 76 // inputTag.type = "file";
77 77
78 let fileData = { 78 let fileData = {
79 fileName: this.fileName, 79 fileName: this.fileName,
80 fileInBase64: this.fileInBase64, 80 fileInBase64: this.fileInBase64,
81 trigger: "" 81 trigger: "",
82 }; 82 };
83 this.$emit("fileSelected", fileData); 83 this.$emit("fileSelected", fileData);
84 } 84 },
85 }, 85 },
86 watch: { 86 watch: {
87 respondToTrigger() { 87 respondToTrigger() {
88 if (this.respondToTrigger == "reset") { 88 if (this.respondToTrigger == "reset") {
89 // console.log("Reset pdf - ", this.emptyPdf); 89 // console.log("Reset pdf - ", this.emptyPdf);
90 this.resetInput(); 90 this.resetInput();
91 } 91 }
92 } 92 },
93 }, 93 },
94 computed: { 94 computed: {
95 respondToTrigger: { 95 respondToTrigger: {
96 get() { 96 get() {
97 return this.emptyPdf; 97 return this.emptyPdf;
98 }, 98 },
99 set(newVal) {} 99 set(newVal) {},
100 // this.respondToTrigger = this.trigger; 100 // this.respondToTrigger = this.trigger;
101 } 101 },
102 } 102 },
103 }; 103 };
104 </script> 104 </script>
105 <style scoped > 105 <style scoped >
106 </style> 106 </style>
src/pages/Course/courseDetail.vue
1 <template> 1 <template>
2 <v-container fluid class="body-color"> 2 <v-container fluid class="body-color">
3 <!-- ****** Edit Chapter detail ****** --> 3 <!-- ****** Edit Chapter detail ****** -->
4 <v-dialog v-model="editCourseDetailDialog" max-width="1000px" scrollable persistent> 4 <v-dialog v-model="editCourseDetailDialog" max-width="1000px" scrollable persistent>
5 <v-card class="card-style pa-2" dark> 5 <v-card class="card-style pa-2" dark>
6 <v-layout> 6 <v-layout>
7 <v-flex xs12> 7 <v-flex xs12>
8 <label class="title text-xs-center">Edit Chapter</label> 8 <label class="title text-xs-center">Edit Chapter</label>
9 <v-icon size="24" class="right" @click="editCourseDetailDialog = false">cancel</v-icon> 9 <v-icon size="24" class="right" @click="editCourseDetailDialog = false">cancel</v-icon>
10 </v-flex> 10 </v-flex>
11 </v-layout> 11 </v-layout>
12 <v-card-text> 12 <v-card-text>
13 <v-layout wrap> 13 <v-layout wrap>
14 <v-flex xs12 sm12> 14 <v-flex xs12 sm12>
15 <v-layout> 15 <v-layout>
16 <v-flex xs4 class="pt-4 subheading"> 16 <v-flex xs4 class="pt-4 subheading">
17 <label class="right">Select Class:</label> 17 <label class="right">Select Class:</label>
18 </v-flex> 18 </v-flex>
19 <v-flex xs8 sm6 class="ml-3"> 19 <v-flex xs8 sm6 class="ml-3">
20 <v-select 20 <v-select
21 small 21 small
22 :items="addclass" 22 :items="addclass"
23 label="Select Class" 23 label="Select Class"
24 v-model="editedCourse.classId" 24 v-model="editedCourse.classId"
25 item-text="classNum" 25 item-text="classNum"
26 item-value="_id" 26 item-value="_id"
27 name="Select Class" 27 name="Select Class"
28 @change="getCourses(editedCourse.classId)" 28 @change="getCourses(editedCourse.classId)"
29 class="mr-2" 29 class="mr-2"
30 required 30 required
31 ></v-select> 31 ></v-select>
32 </v-flex> 32 </v-flex>
33 </v-layout> 33 </v-layout>
34 </v-flex> 34 </v-flex>
35 <v-flex xs12 sm12> 35 <v-flex xs12 sm12>
36 <v-layout> 36 <v-layout>
37 <v-flex xs4 class="pt-4 subheading"> 37 <v-flex xs4 class="pt-4 subheading">
38 <label class="right">Select Course:</label> 38 <label class="right">Select Course:</label>
39 </v-flex> 39 </v-flex>
40 <v-flex xs8 sm6 class="ml-3"> 40 <v-flex xs8 sm6 class="ml-3">
41 <v-select 41 <v-select
42 :items="courseData" 42 :items="courseData"
43 label="Select Course" 43 label="Select Course"
44 v-model="editedCourse.courseId" 44 v-model="editedCourse.courseId"
45 item-text="courseName" 45 item-text="courseName"
46 item-value="_id" 46 item-value="_id"
47 required 47 required
48 class="ml-2" 48 class="ml-2"
49 ></v-select> 49 ></v-select>
50 </v-flex> 50 </v-flex>
51 </v-layout> 51 </v-layout>
52 </v-flex> 52 </v-flex>
53 </v-layout> 53 </v-layout>
54 <v-layout> 54 <v-layout>
55 <v-flex xs12 sm12 md11 lg11> 55 <v-flex xs12 sm12 md11 lg11>
56 <v-card-actions class="hidden-xs-only hidden-sm-only"> 56 <v-card-actions class="hidden-xs-only hidden-sm-only">
57 <v-spacer></v-spacer> 57 <v-spacer></v-spacer>
58 <v-btn round dark @click="save" :loading="editLoading" class="add-button mr-4">Save</v-btn> 58 <v-btn round dark @click="save" :loading="editLoading" class="add-button mr-4">Save</v-btn>
59 </v-card-actions> 59 </v-card-actions>
60 <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> 60 <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only">
61 <v-spacer></v-spacer> 61 <v-spacer></v-spacer>
62 <v-btn round dark @click="save" :loading="editLoading" class="add-button">Save</v-btn> 62 <v-btn round dark @click="save" :loading="editLoading" class="add-button">Save</v-btn>
63 <v-spacer></v-spacer> 63 <v-spacer></v-spacer>
64 </v-card-actions> 64 </v-card-actions>
65 </v-flex> 65 </v-flex>
66 </v-layout> 66 </v-layout>
67 </v-card-text> 67 </v-card-text>
68 </v-card> 68 </v-card>
69 </v-dialog> 69 </v-dialog>
70 <!-- DIALOG BOX - EDIT CHAPTER--> 70 <!-- DIALOG BOX - EDIT CHAPTER-->
71 <v-dialog v-model="editChapterDetailDialog" max-width="1000px" scrollable persistent> 71 <v-dialog v-model="editChapterDetailDialog" max-width="1000px" scrollable persistent>
72 <v-card class="card-style pa-2" dark> 72 <v-card class="card-style pa-2" dark>
73 <v-layout> 73 <v-layout>
74 <v-flex xs12> 74 <v-flex xs12>
75 <label class="title text-xs-center">Edit Chapter</label> 75 <label class="title text-xs-center">Edit Chapter</label>
76 <v-icon 76 <v-icon
77 size="24" 77 size="24"
78 class="right" 78 class="right"
79 @click="editChapterDetailDialog = false; trigger = 'reset'; emptyPdf = 'reset' " 79 @click="editChapterDetailDialog = false; trigger = 'reset'; emptyPdf = 'reset' "
80 >cancel</v-icon> 80 >cancel</v-icon>
81 </v-flex> 81 </v-flex>
82 </v-layout> 82 </v-layout>
83 <v-card-text> 83 <v-card-text>
84 <v-layout wrap> 84 <v-layout wrap>
85 <!-- CHAPTER NAME --> 85 <!-- CHAPTER NAME -->
86 <v-flex xs12 sm12> 86 <v-flex xs12 sm12>
87 <v-layout> 87 <v-layout>
88 <v-flex xs4 class="pt-4 subheading"> 88 <v-flex xs4 class="pt-4 subheading">
89 <label class="right">Chapter Name:</label> 89 <label class="right">Chapter Name:</label>
90 </v-flex> 90 </v-flex>
91 <v-flex xs8 sm6 class="ml-3"> 91 <v-flex xs8 sm6 class="ml-3">
92 <v-text-field 92 <v-text-field
93 v-model="editChapter.chapterName" 93 v-model="editChapter.chapterName"
94 placeholder="fill your Title" 94 placeholder="fill your Title"
95 type="text" 95 type="text"
96 required 96 required
97 ></v-text-field> 97 ></v-text-field>
98 </v-flex> 98 </v-flex>
99 </v-layout> 99 </v-layout>
100 </v-flex> 100 </v-flex>
101 <!-- DESCRIPTION --> 101 <!-- DESCRIPTION -->
102 <v-flex xs12 sm12> 102 <v-flex xs12 sm12>
103 <v-layout> 103 <v-layout>
104 <v-flex xs4 class="pt-4 subheading"> 104 <v-flex xs4 class="pt-4 subheading">
105 <label class="right">Description:</label> 105 <label class="right">Description:</label>
106 </v-flex> 106 </v-flex>
107 <v-flex xs8 sm6 class="ml-3"> 107 <v-flex xs8 sm6 class="ml-3">
108 <v-text-field 108 <v-text-field
109 placeholder="fill your Description" 109 placeholder="fill your Description"
110 v-model="editChapter.description" 110 v-model="editChapter.description"
111 type="text" 111 type="text"
112 required 112 required
113 ></v-text-field> 113 ></v-text-field>
114 </v-flex> 114 </v-flex>
115 </v-layout> 115 </v-layout>
116 </v-flex> 116 </v-flex>
117 <!-- UPLOAD PPT --> 117 <!-- UPLOAD PPT -->
118 <!-- <v-flex xs12> 118 <!-- <v-flex xs12>
119 <v-layout> 119 <v-layout>
120 <v-flex xs4 class="pt-4 subheading"> 120 <v-flex xs4 class="pt-4 subheading">
121 <label class="right">Upload PPT:</label> 121 <label class="right">Upload PPT:</label>
122 </v-flex> 122 </v-flex>
123 <v-flex xs8 sm6 class="ml-3"> 123 <v-flex xs8 sm6 class="ml-3">
124 <UploadFiles 124 <UploadFiles
125 @fileSelected="fileSelected($event,'uploadPPT')" 125 @fileSelected="fileSelected($event,'uploadPPT')"
126 label="Add PPT" 126 label="Add PPT"
127 reference="EditPpt" 127 reference="EditPpt"
128 id="editPptInput" 128 id="editPptInput"
129 :trigger="trigger" 129 :trigger="trigger"
130 ></UploadFiles> 130 ></UploadFiles>
131 </v-flex> 131 </v-flex>
132 </v-layout> 132 </v-layout>
133 </v-flex>--> 133 </v-flex>-->
134 <!-- UPLOAD PDF --> 134 <!-- UPLOAD PDF -->
135 <v-flex xs12> 135 <v-flex xs12>
136 <v-layout> 136 <v-layout>
137 <v-flex xs4 class="pt-4 subheading"> 137 <v-flex xs4 class="pt-4 subheading">
138 <label class="right">Upload PDF:</label> 138 <label class="right">Upload PDF:</label>
139 </v-flex> 139 </v-flex>
140 <v-flex xs8 sm6 class="ml-3"> 140 <v-flex xs8 sm6 class="ml-3">
141 <UploadPdf 141 <UploadPdf
142 @pdfFileSelected="pdfFileSelected($event,'fileName')" 142 @pdfFileSelected="pdfFileSelected($event,'uploadPDF')"
143 label="Add PDF" 143 label="Add PDF"
144 reference="editPdf" 144 reference="editPdf"
145 id="editPdfInput" 145 id="editPdfInput"
146 :emptyPdf="emptyPdf" 146 :emptyPdf="emptyPdf"
147 ></UploadPdf> 147 ></UploadPdf>
148 </v-flex> 148 </v-flex>
149 </v-layout> 149 </v-layout>
150 </v-flex> 150 </v-flex>
151 </v-layout> 151 </v-layout>
152 <!-- <v-flex xs12 v-if="editChapter.chapterPoints.length != 0"> 152 <!-- <v-flex xs12 v-if="editChapter.chapterPoints.length != 0">
153 <v-layout 153 <v-layout
154 wrap 154 wrap
155 v-for="(editChapterPoint,index) in editChapter.chapterPoints" 155 v-for="(editChapterPoint,index) in editChapter.chapterPoints"
156 :key="index" 156 :key="index"
157 > 157 >
158 <v-flex xs12 sm12 md4 class="pt-4 subheading"> 158 <v-flex xs12 sm12 md4 class="pt-4 subheading">
159 <label class="right hidden-xs-only hidden-sm-only">Chapter Points:</label> 159 <label class="right hidden-xs-only hidden-sm-only">Chapter Points:</label>
160 <label class="hidden-md-only hidden-lg-only hidden-xl-only">Chapter Points:</label> 160 <label class="hidden-md-only hidden-lg-only hidden-xl-only">Chapter Points:</label>
161 </v-flex> 161 </v-flex>
162 <v-layout> 162 <v-layout>
163 <v-flex xs10 sm10 sm5 md9 class="ml-3"> 163 <v-flex xs10 sm10 sm5 md9 class="ml-3">
164 <v-text-field :value="editChapterPoint" type="text" required></v-text-field> 164 <v-text-field :value="editChapterPoint" type="text" required></v-text-field>
165 </v-flex> 165 </v-flex>
166 <v-flex xs2 class="pt-4"> 166 <v-flex xs2 class="pt-4">
167 <v-icon @click="deleteUrl(index)">cancel</v-icon> 167 <v-icon @click="deleteUrl(index)">cancel</v-icon>
168 </v-flex> 168 </v-flex>
169 </v-layout> 169 </v-layout>
170 </v-layout> 170 </v-layout>
171 </v-flex>--> 171 </v-flex>-->
172 <v-flex xs12> 172 <v-flex xs12>
173 <div v-for="(updateImage,index) in updates" :key="index"> 173 <div v-for="(updateImage,index) in updates" :key="index">
174 <v-layout wrap> 174 <v-layout wrap>
175 <v-flex xs12 sm12 md4 class="pt-4 subheading"> 175 <v-flex xs12 sm12 md4 class="pt-4 subheading">
176 <label class="right hidden-xs-only hidden-sm-only">Chapter Points:</label> 176 <label class="right hidden-xs-only hidden-sm-only">Chapter Points:</label>
177 <label class="hidden-md-only hidden-lg-only hidden-xl-only">Chapter Points:</label> 177 <label class="hidden-md-only hidden-lg-only hidden-xl-only">Chapter Points:</label>
178 </v-flex> 178 </v-flex>
179 <v-layout> 179 <v-layout>
180 <v-flex xs10 sm12 md9 class="ml-3"> 180 <v-flex xs10 sm12 md9 class="ml-3">
181 <v-text-field 181 <v-text-field
182 v-model="updateImage.value" 182 v-model="updateImage.value"
183 placeholder="Upload new Chapter Points" 183 placeholder="Upload new Chapter Points"
184 required 184 required
185 ></v-text-field> 185 ></v-text-field>
186 </v-flex> 186 </v-flex>
187 <v-flex xs2 class="pt-4"> 187 <v-flex xs2 class="pt-4">
188 <v-icon @click="deleteUpdate(index)" v-if="index !=0">cancel</v-icon> 188 <v-icon @click="deleteUpdate(index)" v-if="index !=0">cancel</v-icon>
189 <v-icon @click="update">add_circle</v-icon> 189 <v-icon @click="update">add_circle</v-icon>
190 </v-flex> 190 </v-flex>
191 </v-layout> 191 </v-layout>
192 </v-layout> 192 </v-layout>
193 </div> 193 </div>
194 </v-flex> 194 </v-flex>
195 <v-layout> 195 <v-layout>
196 <v-flex xs12 sm12 md11 lg11> 196 <v-flex xs12 sm12 md11 lg11>
197 <v-card-actions class="hidden-xs-only hidden-sm-only"> 197 <v-card-actions class="hidden-xs-only hidden-sm-only">
198 <v-spacer></v-spacer> 198 <v-spacer></v-spacer>
199 <v-btn 199 <v-btn
200 round 200 round
201 dark 201 dark
202 @click="saveChapter" 202 @click="saveChapter"
203 :loading="editLoading" 203 :loading="editLoading"
204 class="add-button mr-4" 204 class="add-button mr-4"
205 >Save</v-btn> 205 >Save</v-btn>
206 </v-card-actions> 206 </v-card-actions>
207 <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> 207 <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only">
208 <v-spacer></v-spacer> 208 <v-spacer></v-spacer>
209 <v-btn 209 <v-btn
210 round 210 round
211 dark 211 dark
212 @click="saveChapter" 212 @click="saveChapter"
213 :loading="editLoading" 213 :loading="editLoading"
214 class="add-button" 214 class="add-button"
215 >Save</v-btn> 215 >Save</v-btn>
216 <v-spacer></v-spacer> 216 <v-spacer></v-spacer>
217 </v-card-actions> 217 </v-card-actions>
218 </v-flex> 218 </v-flex>
219 </v-layout> 219 </v-layout>
220 </v-card-text> 220 </v-card-text>
221 </v-card> 221 </v-card>
222 </v-dialog> 222 </v-dialog>
223 <!-- ADD NEW CHAPTER--> 223 <!-- ADD NEW CHAPTER-->
224 <v-dialog v-model="addChapterDialog" max-width="1000px" scrollable persistent> 224 <v-dialog v-model="addChapterDialog" max-width="1000px" scrollable persistent>
225 <v-card class="card-style pa-2" dark> 225 <v-card class="card-style pa-2" dark>
226 <v-layout> 226 <v-layout>
227 <v-flex xs12> 227 <v-flex xs12>
228 <label class="title text-xs-center">Add Chapter Detail</label> 228 <label class="title text-xs-center">Add Chapter Detail</label>
229 <v-icon 229 <v-icon
230 size="24" 230 size="24"
231 class="right" 231 class="right"
232 @click="addChapterDialog = false; trigger = 'reset'; emptyPdf = 'reset' " 232 @click="addChapterDialog = false; trigger = 'reset'; emptyPdf = 'reset' "
233 >cancel</v-icon> 233 >cancel</v-icon>
234 </v-flex> 234 </v-flex>
235 </v-layout> 235 </v-layout>
236 <v-card-text> 236 <v-card-text>
237 <v-layout wrap> 237 <v-layout wrap>
238 <v-flex xs12 sm12> 238 <v-flex xs12 sm12>
239 <v-layout> 239 <v-layout>
240 <v-flex xs4 class="pt-4 subheading"> 240 <v-flex xs4 class="pt-4 subheading">
241 <label class="right">Chapter Name:</label> 241 <label class="right">Chapter Name:</label>
242 </v-flex> 242 </v-flex>
243 <v-flex xs8 sm6 class="ml-3"> 243 <v-flex xs8 sm6 class="ml-3">
244 <v-text-field 244 <v-text-field
245 v-model="addChapterItem.chapterName" 245 v-model="addChapterItem.chapterName"
246 placeholder="fill your Title" 246 placeholder="fill your Title"
247 type="text" 247 type="text"
248 required 248 required
249 ></v-text-field> 249 ></v-text-field>
250 </v-flex> 250 </v-flex>
251 </v-layout> 251 </v-layout>
252 </v-flex> 252 </v-flex>
253 <v-flex xs12 sm12> 253 <v-flex xs12 sm12>
254 <v-layout> 254 <v-layout>
255 <v-flex xs4 class="pt-4 subheading"> 255 <v-flex xs4 class="pt-4 subheading">
256 <label class="right">Description:</label> 256 <label class="right">Description:</label>
257 </v-flex> 257 </v-flex>
258 <v-flex xs8 sm6 class="ml-3"> 258 <v-flex xs8 sm6 class="ml-3">
259 <v-text-field 259 <v-text-field
260 placeholder="fill your Description" 260 placeholder="fill your Description"
261 v-model="addChapterItem.description" 261 v-model="addChapterItem.description"
262 type="text" 262 type="text"
263 required 263 required
264 ></v-text-field> 264 ></v-text-field>
265 </v-flex> 265 </v-flex>
266 </v-layout> 266 </v-layout>
267 </v-flex> 267 </v-flex>
268 <!-- UPLOAD PPT --> 268 <!-- UPLOAD PPT -->
269 <!-- <v-flex xs12> 269 <!-- <v-flex xs12>
270 <v-layout> 270 <v-layout>
271 <v-flex xs4 class="pt-4 subheading"> 271 <v-flex xs4 class="pt-4 subheading">
272 <label class="right">Upload PPT:</label> 272 <label class="right">Upload PPT:</label>
273 </v-flex> 273 </v-flex>
274 <v-flex xs8 sm6 class="ml-3"> 274 <v-flex xs8 sm6 class="ml-3">
275 <UploadFiles 275 <UploadFiles
276 @fileSelected="fileSelected($event,'uploadPPT')" 276 @fileSelected="fileSelected($event,'uploadPPT')"
277 label="Add PPT" 277 label="Add PPT"
278 reference="newChapterPpt" 278 reference="newChapterPpt"
279 id="newChapterPptInput" 279 id="newChapterPptInput"
280 :trigger="trigger" 280 :trigger="trigger"
281 ></UploadFiles> 281 ></UploadFiles>
282 </v-flex> 282 </v-flex>
283 </v-layout> 283 </v-layout>
284 </v-flex>--> 284 </v-flex>-->
285 <!-- UPLOAD PDF --> 285 <!-- UPLOAD PDF -->
286 <v-flex xs12> 286 <v-flex xs12>
287 <v-layout> 287 <v-layout>
288 <v-flex xs4 class="pt-4 subheading"> 288 <v-flex xs4 class="pt-4 subheading">
289 <label class="right">Upload PDF:</label> 289 <label class="right">Upload PDF:</label>
290 </v-flex> 290 </v-flex>
291 <v-flex xs8 sm6 class="ml-3"> 291 <v-flex xs8 sm6 class="ml-3">
292 <UploadPdf 292 <UploadPdf
293 @pdfFileSelected="pdfFileSelected($event,'fileName')" 293 @pdfFileSelected="pdfFileSelected($event,'uploadPDF')"
294 label="Add PDF" 294 label="Add PDF"
295 reference="newChapterPdf" 295 reference="newChapterPdf"
296 id="newChapterPdfInput" 296 id="newChapterPdfInput"
297 :emptyPdf="emptyPdf" 297 :emptyPdf="emptyPdf"
298 v-model="addChapterItem.fileName"
299 ></UploadPdf> 298 ></UploadPdf>
300 </v-flex> 299 </v-flex>
301 </v-layout> 300 </v-layout>
302 </v-flex> 301 </v-flex>
303 </v-layout> 302 </v-layout>
304 <v-flex xs12> 303 <v-flex xs12>
305 <div v-for="(chapterPoints,index) in findsChapterPoint" :key="index"> 304 <div v-for="(chapterPoints,index) in findsChapterPoint" :key="index">
306 <v-layout> 305 <v-layout>
307 <v-flex xs4 class="pt-4 subheading"> 306 <v-flex xs4 class="pt-4 subheading">
308 <label class="right">Chapter Points:</label> 307 <label class="right">Chapter Points:</label>
309 </v-flex> 308 </v-flex>
310 <v-flex xs8 sm8 md6 class="ml-3"> 309 <v-flex xs8 sm8 md6 class="ml-3">
311 <v-text-field 310 <v-text-field
312 placeholder="fill your Chapter Points" 311 placeholder="fill your Chapter Points"
313 v-model="chapterPoints.value" 312 v-model="chapterPoints.value"
314 type="text" 313 type="text"
315 name="link" 314 name="link"
316 required 315 required
317 ></v-text-field> 316 ></v-text-field>
318 </v-flex> 317 </v-flex>
319 <v-flex xs2 class="pt-4"> 318 <v-flex xs2 class="pt-4">
320 <v-icon @click="deleteChapterPoint(index)" v-if="index !=0 ">cancel</v-icon> 319 <v-icon @click="deleteChapterPoint(index)" v-if="index !=0 ">cancel</v-icon>
321 <v-icon @click="addChapterPoint()">add_circle</v-icon> 320 <v-icon @click="addChapterPoint()">add_circle</v-icon>
322 </v-flex> 321 </v-flex>
323 </v-layout> 322 </v-layout>
324 </div> 323 </div>
325 </v-flex> 324 </v-flex>
326 <v-layout> 325 <v-layout>
327 <v-flex xs12 sm12 md11 lg11> 326 <v-flex xs12 sm12 md11 lg11>
328 <v-card-actions class="hidden-xs-only hidden-sm-only"> 327 <v-card-actions class="hidden-xs-only hidden-sm-only">
329 <v-spacer></v-spacer> 328 <v-spacer></v-spacer>
330 <v-btn 329 <v-btn
331 round 330 round
332 dark 331 dark
333 @click="submitChapter" 332 @click="submitChapter"
334 :loading="editLoading" 333 :loading="editLoading"
335 class="add-button mr-4" 334 class="add-button mr-4"
336 >Submit</v-btn> 335 >Submit</v-btn>
337 </v-card-actions> 336 </v-card-actions>
338 <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> 337 <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only">
339 <v-spacer></v-spacer> 338 <v-spacer></v-spacer>
340 <v-btn round dark @click="save" :loading="editLoading" class="add-button">Save</v-btn> 339 <v-btn round dark @click="save" :loading="editLoading" class="add-button">Save</v-btn>
341 <v-spacer></v-spacer> 340 <v-spacer></v-spacer>
342 </v-card-actions> 341 </v-card-actions>
343 </v-flex> 342 </v-flex>
344 </v-layout> 343 </v-layout>
345 </v-card-text> 344 </v-card-text>
346 </v-card> 345 </v-card>
347 </v-dialog> 346 </v-dialog>
348 347
349 <!-- ****** PROFILE Gallery ****** --> 348 <!-- ****** PROFILE Gallery ****** -->
350 349
351 <v-dialog v-model="viewProfileGallery" max-width="1000" scrollable persistent> 350 <v-dialog v-model="viewProfileGallery" max-width="1000" scrollable persistent>
352 <v-card flat class="card-style pa-3" dark> 351 <v-card flat class="card-style pa-3" dark>
353 <v-layout> 352 <v-layout>
354 <v-flex xs12> 353 <v-flex xs12>
355 <label class="title text-xs-center">View Course Detail</label> 354 <label class="title text-xs-center">View Course Detail</label>
356 <v-icon size="24" class="right" @click="closeProfileGallery">cancel</v-icon> 355 <v-icon size="24" class="right" @click="closeProfileGallery">cancel</v-icon>
357 </v-flex> 356 </v-flex>
358 </v-layout> 357 </v-layout>
359 <v-card-text> 358 <v-card-text>
360 <v-container grid-list-md> 359 <v-container grid-list-md>
361 <v-layout wrap> 360 <v-layout wrap>
362 <v-flex xs12> 361 <v-flex xs12>
363 <v-layout> 362 <v-layout>
364 <v-flex xs4 sm6> 363 <v-flex xs4 sm6>
365 <h5 class="right my-1"> 364 <h5 class="right my-1">
366 <b>Chapter Name:</b> 365 <b>Chapter Name:</b>
367 </h5> 366 </h5>
368 </v-flex> 367 </v-flex>
369 <v-flex sm6 xs8> 368 <v-flex sm6 xs8>
370 <h5 class="my-1">{{ editedItem.chapterName }}</h5> 369 <h5 class="my-1">{{ editedItem.chapterName }}</h5>
371 </v-flex> 370 </v-flex>
372 </v-layout> 371 </v-layout>
373 <v-layout> 372 <v-layout>
374 <v-flex xs4 sm6> 373 <v-flex xs4 sm6>
375 <h5 class="right my-1"> 374 <h5 class="right my-1">
376 <b>Description:</b> 375 <b>Description:</b>
377 </h5> 376 </h5>
378 </v-flex> 377 </v-flex>
379 <v-flex sm6 xs8> 378 <v-flex sm6 xs8>
380 <h5 class="my-1">{{ editedItem.description }}</h5> 379 <h5 class="my-1">{{ editedItem.description }}</h5>
381 </v-flex> 380 </v-flex>
382 </v-layout> 381 </v-layout>
383 <v-layout> 382 <v-layout>
384 <v-flex xs5 sm6> 383 <v-flex xs5 sm6>
385 <h5 class="right my-1"> 384 <h5 class="right my-1">
386 <b>Chapter Points:</b> 385 <b>Chapter Points:</b>
387 </h5> 386 </h5>
388 </v-flex> 387 </v-flex>
389 <v-flex sm6 xs8> 388 <v-flex sm6 xs8>
390 <h5 class="my-1"> 389 <h5 class="my-1">
391 <ul v-for="chapterPoint in editedItem.chapterPoints" :key="chapterPoint"> 390 <ul v-for="chapterPoint in editedItem.chapterPoints" :key="chapterPoint">
392 <li>{{ chapterPoint}}</li> 391 <li>{{ chapterPoint}}</li>
393 </ul> 392 </ul>
394 </h5> 393 </h5>
395 </v-flex> 394 </v-flex>
396 </v-layout> 395 </v-layout>
397 <!-- LINK TO PDF --> 396 <!-- LINK TO PDF -->
398 <!-- <v-layout row justify-center v-show="editedItem.pdfFileUrl != ''"> 397 <!-- <v-layout row justify-center v-show="editedItem.pdfFileUrl != ''">
399 <v-flex xs6> 398 <v-flex xs6>
400 <div style="width: 100%;"> 399 <div style="width: 100%;">
401 <a 400 <a
402 :href="editedItem.pdfFileUrl" 401 :href="editedItem.pdfFileUrl"
403 target="_blank" 402 target="_blank"
404 style="text-decoration: none!important;" 403 style="text-decoration: none!important;"
405 > 404 >
406 <v-btn flat block> 405 <v-btn flat block>
407 <span> 406 <span>
408 <h5> 407 <h5>
409 <b>Open PDF</b> 408 <b>Open PDF</b>
410 </h5> 409 </h5>
411 </span> 410 </span>
412 </v-btn> 411 </v-btn>
413 </a> 412 </a>
414 </div> 413 </div>
415 </v-flex> 414 </v-flex>
416 </v-layout>--> 415 </v-layout>-->
417 </v-flex> 416 </v-flex>
418 </v-layout> 417 </v-layout>
419 </v-container> 418 </v-container>
420 </v-card-text> 419 </v-card-text>
421 </v-card> 420 </v-card>
422 </v-dialog> 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 <!-- ****** Course Detail TABLE ****** --> 423 <!-- ****** Course Detail TABLE ****** -->
464 <v-toolbar color="transparent" flat> 424 <v-toolbar color="transparent" flat>
465 <!-- <v-flex xs1> 425 <!-- <v-flex xs1>
466 <v-btn round class="open-dialog-button" dark @click="addCourseDetailDialog = true"> 426 <v-btn round class="open-dialog-button" dark @click="addCourseDetailDialog = true">
467 <v-icon size="20">add</v-icon> 427 <v-icon size="20">add</v-icon>
468 <span class="hidden-sm-and-down">Add Course Detail</span> 428 <span class="hidden-sm-and-down">Add Course Detail</span>
469 <span class="hidden-md-and-up">Add</span> 429 <span class="hidden-md-and-up">Add</span>
470 </v-btn> 430 </v-btn>
471 </v-flex>--> 431 </v-flex>-->
472 <v-btn 432 <v-btn
473 fab 433 fab
474 dark 434 dark
475 class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" 435 class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only"
476 small 436 small
477 @click="addCourseDetailDialog = true" 437 @click="addCourseDetailDialog = true"
478 > 438 >
479 <v-icon dark>add</v-icon> 439 <v-icon dark>add</v-icon>
480 </v-btn> 440 </v-btn>
481 <v-flex xs1 class="hidden-sm-only hidden-xs-only"> 441 <v-flex xs1 class="hidden-sm-only hidden-xs-only">
482 <v-btn round class="open-dialog-button" dark @click="addCourseDetailDialog = true"> 442 <v-btn round class="open-dialog-button" dark @click="addCourseDetailDialog = true">
483 <v-icon class="white--text pr-1" size="20">add</v-icon>Add Course Detail 443 <v-icon class="white--text pr-1" size="20">add</v-icon>Add Course Detail
484 </v-btn> 444 </v-btn>
485 </v-flex> 445 </v-flex>
486 <v-spacer></v-spacer> 446 <v-spacer></v-spacer>
487 <v-flex xs12 sm4 md2> 447 <v-flex xs12 sm4 md2>
488 <v-select 448 <v-select
489 :items="addclass" 449 :items="addclass"
490 label="Select Class" 450 label="Select Class"
491 v-model="getCourse.classId" 451 v-model="getCourse.classId"
492 item-text="classNum" 452 item-text="classNum"
493 item-value="_id" 453 item-value="_id"
494 name="Select Class" 454 name="Select Class"
495 @change="getCourses(getCourse.classId)" 455 @change="getCourses(getCourse.classId)"
496 required 456 required
497 ></v-select> 457 ></v-select>
498 </v-flex> 458 </v-flex>
499 <v-flex xs12 sm4 md2 class="ml-2"> 459 <v-flex xs12 sm4 md2 class="ml-2">
500 <v-select 460 <v-select
501 :items="courseData" 461 :items="courseData"
502 label="Select Course" 462 label="Select Course"
503 v-model="getCourse.courseId" 463 v-model="getCourse.courseId"
504 item-text="courseName" 464 item-text="courseName"
505 item-value="_id" 465 item-value="_id"
506 required 466 required
507 @change="getCourseDetailsList(getCourse.courseId)" 467 @change="getCourseDetailsList(getCourse.courseId)"
508 ></v-select> 468 ></v-select>
509 </v-flex> 469 </v-flex>
510 470
511 <v-flex xs12 sm1 v-if="show"> 471 <v-flex xs12 sm1 v-if="show">
512 <v-btn icon large flat @click="show = false;showSearch = true;"> 472 <v-btn icon large flat @click="show = false;showSearch = true;">
513 <v-avatar size="27"> 473 <v-avatar size="27">
514 <img src="/static/icon/search.png" alt="icon" /> 474 <img src="/static/icon/search.png" alt="icon" />
515 </v-avatar> 475 </v-avatar>
516 </v-btn> 476 </v-btn>
517 </v-flex> 477 </v-flex>
518 478
519 <v-flex xs12 sm3 md3 v-if="showSearch" class="ml-2"> 479 <v-flex xs12 sm3 md3 v-if="showSearch" class="ml-2">
520 <div style="display: inline-block;width: 70%;"> 480 <div style="display: inline-block;width: 70%;">
521 <v-text-field 481 <v-text-field
522 autofocus 482 autofocus
523 v-model="search" 483 v-model="search"
524 label="Search" 484 label="Search"
525 prepend-inner-icon="search" 485 prepend-inner-icon="search"
526 color="primary" 486 color="primary"
527 ></v-text-field> 487 ></v-text-field>
528 </div> 488 </div>
529 <div style="display: inline-block;"> 489 <div style="display: inline-block;">
530 <v-icon @click="closeSearch" color="error">close</v-icon> 490 <v-icon @click="closeSearch" color="error">close</v-icon>
531 </div> 491 </div>
532 </v-flex> 492 </v-flex>
533 </v-toolbar> 493 </v-toolbar>
534 494
535 <v-data-table 495 <v-data-table
536 :headers="headers" 496 :headers="headers"
537 :items="CourseDetailsList" 497 :items="CourseDetailsList"
538 :pagination.sync="pagination" 498 :pagination.sync="pagination"
539 :search="search" 499 :search="search"
540 item-key="_id" 500 item-key="_id"
541 > 501 >
542 <template slot="items" slot-scope="props"> 502 <template slot="items" slot-scope="props">
543 <tr class="tr" @click="courseTableRow(props.item._id)"> 503 <tr class="tr" @click="courseTableRow(props.item._id)">
544 <td class="td td-row">{{ props.index + 1}}</td> 504 <td class="td td-row">{{ props.index + 1}}</td>
545 <td class="td td-row text-xs-center">{{ props.item.classId.classNum }}</td> 505 <td class="td td-row text-xs-center">{{ props.item.classId.classNum }}</td>
546 <td class="td td-row text-xs-center">{{ props.item.courseId.courseName }}</td> 506 <td class="td td-row text-xs-center">{{ props.item.courseId.courseName }}</td>
547 <td class="td td-row text-xs-center"> 507 <td class="td td-row text-xs-center">
548 <div style="vertical-align: top;"> 508 <div style="vertical-align: top;">
549 <v-tooltip top> 509 <v-tooltip top>
550 <v-icon 510 <v-icon
551 slot="activator" 511 slot="activator"
552 style="cursor:pointer;font-size:22px;position: relative;top: -4px; " 512 style="cursor:pointer;font-size:22px;position: relative;top: -4px; "
553 class="mr-3" 513 class="mr-3"
554 @click="addChapters(props.item)" 514 @click="addChapters(props.item)"
555 >add_circle_outline</v-icon> 515 >add_circle_outline</v-icon>
556 <span>Add</span> 516 <span>Add</span>
557 </v-tooltip> 517 </v-tooltip>
558 <v-tooltip top> 518 <v-tooltip top>
559 <img 519 <img
560 slot="activator" 520 slot="activator"
561 style="cursor:pointer; width:25px; height:25px; " 521 style="cursor:pointer; width:25px; height:25px; "
562 class="mr-3" 522 class="mr-3"
563 @click="props.expanded = !props.expanded" 523 @click="props.expanded = !props.expanded"
564 src="/static/icon/view.png" 524 src="/static/icon/view.png"
565 /> 525 />
566 <span>View</span> 526 <span>View</span>
567 </v-tooltip> 527 </v-tooltip>
568 <v-tooltip top> 528 <v-tooltip top>
569 <img 529 <img
570 slot="activator" 530 slot="activator"
571 style="cursor:pointer; width:20px; height:18px; " 531 style="cursor:pointer; width:20px; height:18px; "
572 class="mr-3" 532 class="mr-3"
573 @click="editItem(props.item)" 533 @click="editItem(props.item)"
574 src="/static/icon/edit.png" 534 src="/static/icon/edit.png"
575 /> 535 />
576 <span>Edit</span> 536 <span>Edit</span>
577 </v-tooltip> 537 </v-tooltip>
578 <v-tooltip top> 538 <v-tooltip top>
579 <img 539 <img
580 slot="activator" 540 slot="activator"
581 style="cursor:pointer; width:20px; height:20px; " 541 style="cursor:pointer; width:20px; height:20px; "
582 class="mr-3" 542 class="mr-3"
583 @click="deleteItem(props.item)" 543 @click="deleteItem(props.item)"
584 src="/static/icon/delete.png" 544 src="/static/icon/delete.png"
585 /> 545 />
586 <span>Delete</span> 546 <span>Delete</span>
587 </v-tooltip> 547 </v-tooltip>
588 </div> 548 </div>
589 </td> 549 </td>
590 </tr> 550 </tr>
591 </template> 551 </template>
592 <!-- CHAPTERS IN A COURSE --> 552 <!-- CHAPTERS IN A COURSE -->
593 <template slot="expand"> 553 <template slot="expand">
594 <v-data-table :items="chapters" hide-actions item-key="chapterName" style="width: auto;"> 554 <v-data-table :items="chapters" hide-actions item-key="chapterName" style="width: auto;">
595 <template slot="items" slot-scope="props"> 555 <template slot="items" slot-scope="props">
596 <tr class="tr" @click="props.expanded = !props.expanded"> 556 <tr class="tr" @click="props.expanded = !props.expanded">
597 <td class="td td-row">{{ props.index + 1}}</td> 557 <td class="td td-row">{{ props.index + 1}}</td>
598 <td class="text-xs-center td td-row">{{ props.item.chapterName}}</td> 558 <td class="text-xs-center td td-row">{{ props.item.chapterName}}</td>
599 <td class="text-xs-center td td-row">{{ props.item.description }}</td> 559 <td class="text-xs-center td td-row">{{ props.item.description }}</td>
600 <td class="text-xs-center td td-row"> 560 <td class="text-xs-center td td-row">
601 <v-tooltip top> 561 <v-tooltip top>
602 <v-icon 562 <v-icon
603 slot="activator" 563 slot="activator"
604 style="cursor:pointer;font-size:22px;position: relative;top: -4px; " 564 style="cursor:pointer;font-size:22px;position: relative;top: -4px; "
605 class="mr-3" 565 class="mr-3"
606 @click="$router.push({name: 'Live Online Class', query: {chapterId: props.item._id, chapterName: props.item.chapterName, courseId: getCourse.courseId, classId: getCourse.classId }})" 566 @click="$router.push({name: 'Live Online Class', query: {chapterId: props.item._id, chapterName: props.item.chapterName, courseId: getCourse.courseId, classId: getCourse.classId }})"
607 >video_call</v-icon> 567 >video_call</v-icon>
608 <span>Live Session</span> 568 <span>Live Session</span>
609 </v-tooltip> 569 </v-tooltip>
610 <v-tooltip top> 570 <v-tooltip top>
611 <img 571 <img
612 slot="activator" 572 slot="activator"
613 style="cursor:pointer; width:25px; height:25px; " 573 style="cursor:pointer; width:25px; height:25px; "
614 class="mr-3" 574 class="mr-3"
615 @click="profile(props.item)" 575 @click="profile(props.item)"
616 src="/static/icon/view.png" 576 src="/static/icon/view.png"
617 /> 577 />
618 <span>View</span> 578 <span>View</span>
619 </v-tooltip> 579 </v-tooltip>
620 <v-tooltip top> 580 <v-tooltip top>
621 <img 581 <img
622 slot="activator" 582 slot="activator"
623 style="cursor:pointer; width:20px; height:18px; " 583 style="cursor:pointer; width:20px; height:18px; "
624 class="mr-3" 584 class="mr-3"
625 @click="editChapterItem(props.item)" 585 @click="editChapterItem(props.item)"
626 src="/static/icon/edit.png" 586 src="/static/icon/edit.png"
627 /> 587 />
628 <span>Edit</span> 588 <span>Edit</span>
629 </v-tooltip> 589 </v-tooltip>
630 <v-tooltip top> 590 <v-tooltip top>
631 <img 591 <img
632 slot="activator" 592 slot="activator"
633 style="cursor:pointer; width:20px; height:20px; " 593 style="cursor:pointer; width:20px; height:20px; "
634 class="mr-3" 594 class="mr-3"
635 @click="deleteChapters(props.item)" 595 @click="deleteChapters(props.item)"
636 src="/static/icon/delete.png" 596 src="/static/icon/delete.png"
637 /> 597 />
638 <span>Delete Chapter</span> 598 <span>Delete Chapter</span>
639 </v-tooltip> 599 </v-tooltip>
640 <v-tooltip top> 600 <v-tooltip top>
641 <img 601 <img
642 slot="activator" 602 slot="activator"
643 style="cursor:pointer; width:20px; height:20px; " 603 style="cursor:pointer; width:20px; height:20px; "
644 class="mr-3" 604 class="mr-3"
645 @click="documents(props.item)"
646 src="/static/icon/dashboard icons-34.png" 605 src="/static/icon/dashboard icons-34.png"
606 @click="openLink(props.item.pdfFileUrl)"
647 /> 607 />
648 <span> 608 <span>
649 <a 609 <h5>{{props.item.fileName}}</h5>
650 :href="editedItem.pdfFileUrl"
651 style="text-decoration: underline!important; color: white;"
652 >
653 <h5>{{editedItem.pdfFileUrl}}</h5>
654 </a>
655 </span> 610 </span>
656 </v-tooltip> 611 </v-tooltip>
657 </td> 612 </td>
658 </tr> 613 </tr>
659 </template> 614 </template>
660 </v-data-table> 615 </v-data-table>
661 </template> 616 </template>
662 617
663 <v-alert 618 <v-alert
664 slot="no-results" 619 slot="no-results"
665 :value="true" 620 :value="true"
666 color="error" 621 color="error"
667 icon="warning" 622 icon="warning"
668 >Your search for "{{ search }}" found no results.</v-alert> 623 >Your search for "{{ search }}" found no results.</v-alert>
669 </v-data-table> 624 </v-data-table>
670 <!-- ****** ADD Course Detail ****** --> 625 <!-- ****** ADD Course Detail ****** -->
671 <v-dialog v-model="addCourseDetailDialog" max-width="600px" persistent> 626 <v-dialog v-model="addCourseDetailDialog" max-width="600px" persistent>
672 <v-card flat class="card-style pa-2" dark> 627 <v-card flat class="card-style pa-2" dark>
673 <v-layout> 628 <v-layout>
674 <v-flex xs12> 629 <v-flex xs12>
675 <label class="title text-xs-center">Add Course Details</label> 630 <label class="title text-xs-center">Add Course Details</label>
676 <v-icon 631 <v-icon
677 size="24" 632 size="24"
678 class="right" 633 class="right"
679 @click="addCourseDetailDialog = false; clear() ; trigger = 'reset' ; emptyPdf = 'reset' " 634 @click="addCourseDetailDialog = false; clear() ; trigger = 'reset' ; emptyPdf = 'reset' "
680 >cancel</v-icon> 635 >cancel</v-icon>
681 </v-flex> 636 </v-flex>
682 </v-layout> 637 </v-layout>
683 <v-form ref="form" v-model="valid" lazy-validation> 638 <v-form ref="form" v-model="valid" lazy-validation>
684 <v-container fluid> 639 <v-container fluid>
685 <v-flex xs12> 640 <v-flex xs12>
686 <v-layout> 641 <v-layout>
687 <v-flex xs4 class="pt-4 subheading"> 642 <v-flex xs4 class="pt-4 subheading">
688 <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> 643 <label class="right hidden-xs-only hidden-sm-only">Select Class:</label>
689 <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> 644 <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label>
690 </v-flex> 645 </v-flex>
691 <v-flex xs8 sm8 md7 class="ml-3"> 646 <v-flex xs8 sm8 md7 class="ml-3">
692 <v-select 647 <v-select
693 :items="addclass" 648 :items="addclass"
694 label="Select Class" 649 label="Select Class"
695 v-model="addCourseDetail.classId" 650 v-model="addCourseDetail.classId"
696 item-text="classNum" 651 item-text="classNum"
697 item-value="_id" 652 item-value="_id"
698 name="Select Class" 653 name="Select Class"
699 :rules="clsssRules" 654 :rules="clsssRules"
700 @change="getCourses(addCourseDetail.classId)" 655 @change="getCourses(addCourseDetail.classId)"
701 required 656 required
702 ></v-select> 657 ></v-select>
703 </v-flex> 658 </v-flex>
704 </v-layout> 659 </v-layout>
705 </v-flex> 660 </v-flex>
706 <v-flex xs12> 661 <v-flex xs12>
707 <v-layout> 662 <v-layout>
708 <v-flex xs4 class="pt-4 subheading"> 663 <v-flex xs4 class="pt-4 subheading">
709 <label class="right hidden-xs-only hidden-sm-only">Select Course:</label> 664 <label class="right hidden-xs-only hidden-sm-only">Select Course:</label>
710 <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Course:</label> 665 <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Course:</label>
711 </v-flex> 666 </v-flex>
712 <v-flex xs8 sm8 md7 class="ml-3"> 667 <v-flex xs8 sm8 md7 class="ml-3">
713 <v-select 668 <v-select
714 :items="courseData" 669 :items="courseData"
715 label="Select Course" 670 label="Select Course"
716 v-model="addCourseDetail.courseId" 671 v-model="addCourseDetail.courseId"
717 item-text="courseName" 672 item-text="courseName"
718 item-value="_id" 673 item-value="_id"
719 :rules="courseRules" 674 :rules="courseRules"
720 required 675 required
721 ></v-select> 676 ></v-select>
722 </v-flex> 677 </v-flex>
723 </v-layout> 678 </v-layout>
724 </v-flex> 679 </v-flex>
725 <v-flex xs12> 680 <v-flex xs12>
726 <v-layout> 681 <v-layout>
727 <v-flex xs4 class="pt-4 subheading"> 682 <v-flex xs4 class="pt-4 subheading">
728 <label class="right">Chapter Name:</label> 683 <label class="right">Chapter Name:</label>
729 </v-flex> 684 </v-flex>
730 <v-flex xs8 sm8 md7 class="ml-3"> 685 <v-flex xs8 sm8 md7 class="ml-3">
731 <v-text-field 686 <v-text-field
732 v-model="addCourseDetail.chapterName" 687 v-model="addCourseDetail.chapterName"
733 placeholder="fill your Title" 688 placeholder="fill your Title"
734 name="name" 689 name="name"
735 type="text" 690 type="text"
736 :rules="chapterNameRules" 691 :rules="chapterNameRules"
737 required 692 required
738 ></v-text-field> 693 ></v-text-field>
739 </v-flex> 694 </v-flex>
740 </v-layout> 695 </v-layout>
741 </v-flex> 696 </v-flex>
742 <!-- DESCRIPTION --> 697 <!-- DESCRIPTION -->
743 <v-flex xs12> 698 <v-flex xs12>
744 <v-layout> 699 <v-layout>
745 <v-flex xs4 class="pt-4 subheading"> 700 <v-flex xs4 class="pt-4 subheading">
746 <label class="right">Description:</label> 701 <label class="right">Description:</label>
747 </v-flex> 702 </v-flex>
748 <v-flex xs8 sm8 md7 class="ml-3"> 703 <v-flex xs8 sm8 md7 class="ml-3">
749 <v-text-field 704 <v-text-field
750 placeholder="fill your Description" 705 placeholder="fill your Description"
751 :rules="descriptionRules" 706 :rules="descriptionRules"
752 v-model="addCourseDetail.description" 707 v-model="addCourseDetail.description"
753 type="text" 708 type="text"
754 name="email" 709 name="email"
755 required 710 required
756 ></v-text-field> 711 ></v-text-field>
757 </v-flex> 712 </v-flex>
758 </v-layout> 713 </v-layout>
759 </v-flex> 714 </v-flex>
760 <!-- UPLOAD PPT --> 715 <!-- UPLOAD PPT -->
761 <!-- <v-flex xs12> 716 <!-- <v-flex xs12>
762 <v-layout> 717 <v-layout>
763 <v-flex xs4 class="pt-4 subheading"> 718 <v-flex xs4 class="pt-4 subheading">
764 <label class="right">Upload PPT:</label> 719 <label class="right">Upload PPT:</label>
765 </v-flex> 720 </v-flex>
766 <v-flex xs8 sm8 md7 class="ml-3"> 721 <v-flex xs8 sm8 md7 class="ml-3">
767 <UploadFiles 722 <UploadFiles
768 @fileSelected="fileSelected($event,'uploadPPT')" 723 @fileSelected="fileSelected($event,'uploadPPT')"
769 label="Add PPT" 724 label="Add PPT"
770 reference="newCoursePpt" 725 reference="newCoursePpt"
771 id="newCoursePptInput" 726 id="newCoursePptInput"
772 :trigger="trigger" 727 :trigger="trigger"
773 ></UploadFiles> 728 ></UploadFiles>
774 </v-flex> 729 </v-flex>
775 </v-layout> 730 </v-layout>
776 </v-flex>--> 731 </v-flex>-->
777 <!-- UPLOAD PDF --> 732 <!-- UPLOAD PDF -->
778 <v-flex xs12> 733 <v-flex xs12>
779 <v-layout> 734 <v-layout>
780 <v-flex xs4 class="pt-4 subheading"> 735 <v-flex xs4 class="pt-4 subheading">
781 <label class="right">Upload PDF:</label> 736 <label class="right">Upload PDF:</label>
782 </v-flex> 737 </v-flex>
783 <v-flex xs8 sm8 md7 class="ml-3"> 738 <v-flex xs8 sm8 md7 class="ml-3">
784 <UploadPdf 739 <UploadPdf
785 @pdfFileSelected="pdfFileSelected($event,'fileName')" 740 @pdfFileSelected="pdfFileSelected($event,'uploadPDF')"
786 label="Add PDF" 741 label="Add PDF"
787 reference="newCoursePdf" 742 reference="newCoursePdf"
788 id="newCoursePdfInput" 743 id="newCoursePdfInput"
789 :emptyPdf="emptyPdf" 744 :emptyPdf="emptyPdf"
790 v-model="addCourseDetail.fileName"
791 ></UploadPdf> 745 ></UploadPdf>
792 </v-flex> 746 </v-flex>
793 </v-layout> 747 </v-layout>
794 </v-flex> 748 </v-flex>
795 <v-layout> 749 <v-layout>
796 <v-flex xs12> 750 <v-flex xs12>
797 <div v-for="(chapterPoints,index) in finds" :key="index"> 751 <div v-for="(chapterPoints,index) in finds" :key="index">
798 <v-layout> 752 <v-layout>
799 <v-flex xs4 class="pt-4 subheading"> 753 <v-flex xs4 class="pt-4 subheading">
800 <label class="right">Chapter Points:</label> 754 <label class="right">Chapter Points:</label>
801 </v-flex> 755 </v-flex>
802 <v-flex xs8 sm8 md6 class="ml-3"> 756 <v-flex xs8 sm8 md6 class="ml-3">
803 <v-text-field 757 <v-text-field
804 placeholder="fill your Chapter Points" 758 placeholder="fill your Chapter Points"
805 v-model="chapterPoints.value" 759 v-model="chapterPoints.value"
806 type="text" 760 type="text"
807 required 761 required
808 ></v-text-field> 762 ></v-text-field>
809 </v-flex> 763 </v-flex>
810 <v-flex xs2 class="pt-4"> 764 <v-flex xs2 class="pt-4">
811 <v-icon @click="deleteFind(index)" v-if="index !=0 ">cancel</v-icon> 765 <v-icon @click="deleteFind(index)" v-if="index !=0 ">cancel</v-icon>
812 <v-icon @click="addFind">add_circle</v-icon> 766 <v-icon @click="addFind">add_circle</v-icon>
813 </v-flex> 767 </v-flex>
814 </v-layout> 768 </v-layout>
815 </div> 769 </div>
816 </v-flex> 770 </v-flex>
817 </v-layout> 771 </v-layout>
818 <v-layout> 772 <v-layout>
819 <v-flex xs12 sm12> 773 <v-flex xs12 sm12>
820 <v-layout class="right"> 774 <v-layout class="right">
821 <v-btn @click="clear();" round dark class="clear-button">Clear</v-btn> 775 <v-btn @click="clear();" round dark class="clear-button">Clear</v-btn>
822 <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> 776 <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn>
823 </v-layout> 777 </v-layout>
824 </v-flex> 778 </v-flex>
825 </v-layout> 779 </v-layout>
826 </v-container> 780 </v-container>
827 </v-form> 781 </v-form>
828 </v-card> 782 </v-card>
829 </v-dialog> 783 </v-dialog>
830 <v-snackbar 784 <v-snackbar
831 :timeout="timeout" 785 :timeout="timeout"
832 :top="y === 'top'" 786 :top="y === 'top'"
833 :right="x === 'right'" 787 :right="x === 'right'"
834 :vertical="mode === 'vertical'" 788 :vertical="mode === 'vertical'"
835 v-model="snackbar" 789 v-model="snackbar"
836 :color="color" 790 :color="color"
837 >{{ text }}</v-snackbar> 791 >{{ text }}</v-snackbar>
838 <div class="loader" v-if="showLoader"> 792 <div class="loader" v-if="showLoader">
839 <v-progress-circular indeterminate color="white"></v-progress-circular> 793 <v-progress-circular indeterminate color="white"></v-progress-circular>
840 </div> 794 </div>
841 </v-container> 795 </v-container>
842 </template> 796 </template>
843 797
844 <script> 798 <script>
845 import http from "@/Services/http.js"; 799 import http from "@/Services/http.js";
846 import UploadFiles from "@/pages/Common/UploadFiles.vue"; 800 import UploadFiles from "@/pages/Common/UploadFiles.vue";
847 import UploadPdf from "@/pages/Common/UploadPdf.vue"; 801 import UploadPdf from "@/pages/Common/UploadPdf.vue";
848 import AllApiCalls from "@/Services/AllApiCalls.js"; 802 import AllApiCalls from "@/Services/AllApiCalls.js";
849 803
850 export default { 804 export default {
851 mixins: [AllApiCalls], 805 mixins: [AllApiCalls],
852 components: { 806 components: {
853 UploadFiles, 807 UploadFiles,
854 UploadPdf, 808 UploadPdf,
855 }, 809 },
856 data: () => ({ 810 data: () => ({
857 snackbar: false, 811 snackbar: false,
858 y: "top", 812 y: "top",
859 x: "right", 813 x: "right",
860 mode: "", 814 mode: "",
861 timeout: 3000, 815 timeout: 3000,
862 text: "", 816 text: "",
863 loading: false, 817 loading: false,
864 color: "", 818 color: "",
865 date: null, 819 date: null,
866 search: "", 820 search: "",
867 show: true, 821 show: true,
868 addCourseDetailDialog: false, 822 addCourseDetailDialog: false,
869 showSearch: false, 823 showSearch: false,
870 showLoader: false, 824 showLoader: false,
871 editCourseDetailDialog: false, 825 editCourseDetailDialog: false,
872 editChapterDetailDialog: false, 826 editChapterDetailDialog: false,
873 viewProfileGallery: false, 827 viewProfileGallery: false,
874 viewDocument: false,
875 valid: true, 828 valid: true,
876 editLoading: false, 829 editLoading: false,
877 addclass: [], 830 addclass: [],
878 courseData: [], 831 courseData: [],
879 addSection: [], 832 addSection: [],
880 getCourse: {}, 833 getCourse: {},
881 finds: [{ value: "" }], 834 finds: [{ value: "" }],
882 findsChapterPoint: [{ value: "" }], 835 findsChapterPoint: [{ value: "" }],
883 updates: [], 836 updates: [],
884 youTubeLink: {}, 837 youTubeLink: {},
885 addCourseDetail: { 838 addCourseDetail: {
886 chapters: [ 839 chapters: [
887 { 840 {
888 chapterName: "", 841 chapterName: "",
889 description: "", 842 description: "",
890 chapterPoints: [], 843 chapterPoints: [],
891 }, 844 },
892 ], 845 ],
893 }, 846 },
894 chapters: [], 847 chapters: [],
895 pagination: { 848 pagination: {
896 rowsPerPage: 10, 849 rowsPerPage: 10,
897 }, 850 },
898 editFiles: [], 851 editFiles: [],
899 files: [], 852 files: [],
900 courseData: [], 853 courseData: [],
901 token: "", 854 token: "",
902 courseId: "", 855 courseId: "",
903 clsssRules: [(v) => !!v || " Class is required"], 856 clsssRules: [(v) => !!v || " Class is required"],
904 courseRules: [(v) => !!v || " Course is required"], 857 courseRules: [(v) => !!v || " Course is required"],
905 chapterNameRules: [(v) => !!v || " Tilte is required"], 858 chapterNameRules: [(v) => !!v || " Tilte is required"],
906 descriptionRules: [(v) => !!v || " Description is required"], 859 descriptionRules: [(v) => !!v || " Description is required"],
907 headers: [ 860 headers: [
908 { 861 {
909 align: "", 862 align: "",
910 text: "No", 863 text: "No",
911 sortable: false, 864 sortable: false,
912 value: "index", 865 value: "index",
913 }, 866 },
914 { 867 {
915 text: "Class Name", 868 text: "Class Name",
916 value: "classNum", 869 value: "classNum",
917 sortable: false, 870 sortable: false,
918 align: "center", 871 align: "center",
919 }, 872 },
920 { 873 {
921 text: "Course Name", 874 text: "Course Name",
922 value: "courseName", 875 value: "courseName",
923 sortable: false, 876 sortable: false,
924 align: "center", 877 align: "center",
925 }, 878 },
926 { text: "Action", value: "", sortable: false, align: "center" }, 879 { text: "Action", value: "", sortable: false, align: "center" },
927 ], 880 ],
928 CourseDetailsList: [], 881 CourseDetailsList: [],
929 editedIndex: -1, 882 editedIndex: -1,
930 editedItem: {}, 883 editedItem: {},
931 editedCourse: {}, 884 editedCourse: {},
932 editChapter: { 885 editChapter: {
933 chapterPoints: [], 886 chapterPoints: [],
934 }, 887 },
935 index: "", 888 index: "",
936 addChapterItem: {}, 889 addChapterItem: {},
937 addChapterItemObj: {}, 890 addChapterItemObj: {},
938 addChapterDialog: false, 891 addChapterDialog: false,
939 showData: false, 892 showData: false,
940 }), 893 }),
941 methods: { 894 methods: {
895 openLink(url) {
896 window.open(url, "_blank");
897 },
942 getCourses(classId) { 898 getCourses(classId) {
943 this.showLoader = true; 899 this.showLoader = true;
944 http() 900 http()
945 .get("/getCourseesList", { 901 .get("/getCourseesList", {
946 params: { 902 params: {
947 classId: classId, 903 classId: classId,
948 }, 904 },
949 }) 905 })
950 .then((response) => { 906 .then((response) => {
951 this.editChapter.courseId = ""; 907 this.editChapter.courseId = "";
952 this.courseData = response.data.data; 908 this.courseData = response.data.data;
953 // console.log("this.courseData", this.courseData); 909 // console.log("this.courseData", this.courseData);
954 this.showLoader = false; 910 this.showLoader = false;
955 }) 911 })
956 .catch((err) => { 912 .catch((err) => {
957 console.log("err====>", err); 913 console.log("err====>", err);
958 this.showLoader = false; 914 this.showLoader = false;
959 }); 915 });
960 }, 916 },
961 getCourseDetailsList() { 917 getCourseDetailsList() {
962 this.showLoader = true; 918 this.showLoader = true;
963 http() 919 http()
964 .get("/getParticularCourseDetail", { 920 .get("/getParticularCourseDetail", {
965 params: { 921 params: {
966 courseId: this.getCourse.courseId, 922 courseId: this.getCourse.courseId,
967 }, 923 },
968 }) 924 })
969 .then((response) => { 925 .then((response) => {
970 this.CourseDetailsList = response.data.data; 926 this.CourseDetailsList = response.data.data;
971 if (this.CourseDetailsList.length === 0) { 927 if (this.CourseDetailsList.length === 0) {
972 this.showLoader = false; 928 this.showLoader = false;
973 this.snackbar = true; 929 this.snackbar = true;
974 this.text = "Data not found!"; 930 this.text = "Data not found!";
975 this.color = "error"; 931 this.color = "error";
976 return; 932 return;
977 } 933 }
978 this.showData = true; 934 this.showData = true;
979 if (response.data.data[0]) { 935 if (response.data.data[0]) {
980 this.chapters = response.data.data[0].chapters; 936 this.chapters = response.data.data[0].chapters;
981 } 937 }
982 this.showLoader = false; 938 this.showLoader = false;
983 }) 939 })
984 .catch((error) => { 940 .catch((error) => {
985 // console.log("err====>", err); 941 // console.log("err====>", err);
986 this.showLoader = false; 942 this.showLoader = false;
987 if (error.response.status === 401) { 943 if (error.response.status === 401) {
988 this.$router.replace({ path: "/" }); 944 this.$router.replace({ path: "/" });
989 this.$store.dispatch("setToken", null); 945 this.$store.dispatch("setToken", null);
990 this.$store.dispatch("Id", null); 946 this.$store.dispatch("Id", null);
991 } 947 }
992 }); 948 });
993 }, 949 },
994 courseTableRow(id) { 950 courseTableRow(id) {
995 this.courseId = id; 951 this.courseId = id;
996 }, 952 },
997 addChapters(item) { 953 addChapters(item) {
998 this.editedIndex = this.CourseDetailsList.indexOf(item); 954 this.editedIndex = this.CourseDetailsList.indexOf(item);
999 this.addChapterItemObj = Object.assign({}, item); 955 this.addChapterItemObj = Object.assign({}, item);
1000 this.addChapterItem.courseDetailId = this.addChapterItemObj._id; 956 this.addChapterItem.courseDetailId = this.addChapterItemObj._id;
1001 this.addChapterDialog = true; 957 this.addChapterDialog = true;
1002 }, 958 },
1003 submitChapter() { 959 submitChapter() {
1004 console.log("addChapterItem", this.addChapterItem); 960 console.log("addChapterItem", this.addChapterItem);
1005 this.addChapterItem.chapterPoints = []; 961 this.addChapterItem.chapterPoints = [];
1006 for (let i = 0; i < this.findsChapterPoint.length; i++) { 962 for (let i = 0; i < this.findsChapterPoint.length; i++) {
1007 this.addChapterItem.chapterPoints.push(this.findsChapterPoint[i].value); 963 this.addChapterItem.chapterPoints.push(this.findsChapterPoint[i].value);
1008 } 964 }
1009 this.loading = true; 965 this.loading = true;
1010 http() 966 http()
1011 .put("/addChapters", this.addChapterItem) 967 .put("/addChapters", this.addChapterItem)
1012 .then((response) => { 968 .then((response) => {
1013 this.addChapterDialog = false; 969 this.addChapterDialog = false;
1014 this.loading = false; 970 this.loading = false;
1015 this.snackbar = true; 971 this.snackbar = true;
1016 this.text = response.data.message; 972 this.text = response.data.message;
1017 this.color = "green"; 973 this.color = "green";
1018 this.addChapterItem = {}; 974 this.addChapterItem = {};
1019 this.removeChapterPoint(); 975 this.removeChapterPoint();
1020 this.getCourseDetailsList(); 976 this.getCourseDetailsList();
1021 }) 977 })
1022 .catch((error) => { 978 .catch((error) => {
1023 this.snackbar = true; 979 this.snackbar = true;
1024 this.text = error.response.data.message; 980 this.text = error.response.data.message;
1025 this.color = "error"; 981 this.color = "error";
1026 this.loading = false; 982 this.loading = false;
1027 }); 983 });
1028 }, 984 },
1029 profile(item) { 985 profile(item) {
1030 // console.log("chaper - ", item); 986 // console.log("chaper - ", item);
1031 this.editedIndex = this.chapters.indexOf(item); 987 this.editedIndex = this.chapters.indexOf(item);
1032 this.editedItem = Object.assign({}, item); 988 this.editedItem = Object.assign({}, item);
1033 this.viewProfileGallery = true; 989 this.viewProfileGallery = true;
1034 }, 990 },
1035 editItem(item) { 991 editItem(item) {
1036 this.editedIndex = this.CourseDetailsList.indexOf(item); 992 this.editedIndex = this.CourseDetailsList.indexOf(item);
1037 this.editedCourse = Object.assign({}, item); 993 this.editedCourse = Object.assign({}, item);
1038 this.editCourseDetailDialog = true; 994 this.editCourseDetailDialog = true;
1039 }, 995 },
1040 editChapterItem(item) { 996 editChapterItem(item) {
1041 this.editedIndex = this.chapters.indexOf(item); 997 this.editedIndex = this.chapters.indexOf(item);
1042 this.editChapter = Object.assign({}, item); 998 this.editChapter = Object.assign({}, item);
1043 this.updates = []; 999 this.updates = [];
1044 for (let i = 0; i < this.editChapter.chapterPoints.length; i++) { 1000 for (let i = 0; i < this.editChapter.chapterPoints.length; i++) {
1045 this.updates.push({ value: this.editChapter.chapterPoints[i] }); 1001 this.updates.push({ value: this.editChapter.chapterPoints[i] });
1046 } 1002 }
1047 this.editChapterDetailDialog = true; 1003 this.editChapterDetailDialog = true;
1048 }, 1004 },
1049 documents(item) {
1050 this.editedItem = Object.assign({}, item);
1051 this.viewDocument = true;
1052 },
1053 deleteItem(item) { 1005 deleteItem(item) {
1054 let deleteGallery = { 1006 let deleteGallery = {
1055 courseDetailId: item._id, 1007 courseDetailId: item._id,
1056 }; 1008 };
1057 http() 1009 http()
1058 .delete( 1010 .delete(
1059 "/deleteCourseDetail", 1011 "/deleteCourseDetail",
1060 confirm("Are you sure you want to delete this?") && { 1012 confirm("Are you sure you want to delete this?") && {
1061 params: deleteGallery, 1013 params: deleteGallery,
1062 headers: { 1014 headers: {
1063 Authorization: "Bearer " + this.token, 1015 Authorization: "Bearer " + this.token,
1064 }, 1016 },
1065 } 1017 }
1066 ) 1018 )
1067 .then((response) => { 1019 .then((response) => {
1068 this.snackbar = true; 1020 this.snackbar = true;
1069 this.text = "Successfully delete Course Details"; 1021 this.text = "Successfully delete Course Details";
1070 this.color = "green"; 1022 this.color = "green";
1071 this.getCourseDetailsList(); 1023 this.getCourseDetailsList();
1072 }) 1024 })
1073 .catch((error) => { 1025 .catch((error) => {
1074 // console.log(error); 1026 // console.log(error);
1075 this.snackbar = true; 1027 this.snackbar = true;
1076 this.text = error.response.data.message; 1028 this.text = error.response.data.message;
1077 this.color = "error"; 1029 this.color = "error";
1078 }); 1030 });
1079 }, 1031 },
1080 deleteChapters(item) { 1032 deleteChapters(item) {
1081 // console.log("item", item); 1033 // console.log("item", item);
1082 let deleteChapters = { 1034 let deleteChapters = {
1083 courseDetailId: this.courseId, 1035 courseDetailId: this.courseId,
1084 chapterId: item._id, 1036 chapterId: item._id,
1085 }; 1037 };
1086 http() 1038 http()
1087 .put( 1039 .put(
1088 "/deleteChapters", 1040 "/deleteChapters",
1089 confirm("Are you sure you want to delete this?") && deleteChapters 1041 confirm("Are you sure you want to delete this?") && deleteChapters
1090 ) 1042 )
1091 .then((response) => { 1043 .then((response) => {
1092 this.snackbar = true; 1044 this.snackbar = true;
1093 this.text = "Successfully delete Chapters"; 1045 this.text = "Successfully delete Chapters";
1094 this.color = "green"; 1046 this.color = "green";
1095 this.getCourseDetailsList(); 1047 this.getCourseDetailsList();
1096 }) 1048 })
1097 .catch((error) => { 1049 .catch((error) => {
1098 // console.log(error); 1050 // console.log(error);
1099 this.snackbar = true; 1051 this.snackbar = true;
1100 this.text = error.response.data.message; 1052 this.text = error.response.data.message;
1101 this.color = "error"; 1053 this.color = "error";
1102 }); 1054 });
1103 }, 1055 },
1104 close() { 1056 close() {
1105 this.editCourseDetailDialog = false; 1057 this.editCourseDetailDialog = false;
1106 }, 1058 },
1107 closeProfileGallery() { 1059 closeProfileGallery() {
1108 this.viewProfileGallery = false; 1060 this.viewProfileGallery = false;
1109 }, 1061 },
1110 closeviewDocument() {
1111 this.viewDocument = false;
1112 },
1113 submit() { 1062 submit() {
1114 let chapters = []; 1063 let chapters = [];
1115 var chapterPoints = []; 1064 var chapterPoints = [];
1116 for (let i = 0; i < this.finds.length; i++) { 1065 for (let i = 0; i < this.finds.length; i++) {
1117 chapterPoints.push(this.finds[i].value); 1066 chapterPoints.push(this.finds[i].value);
1118 // console.log("this.finds[i].value", this.finds[i].value); 1067 // console.log("this.finds[i].value", this.finds[i].value);
1119 chapters = [ 1068 chapters = [
1120 { 1069 {
1121 chapterName: this.addCourseDetail.chapterName, 1070 chapterName: this.addCourseDetail.chapterName,
1122 description: this.addCourseDetail.description, 1071 description: this.addCourseDetail.description,
1123 chapterPoints: chapterPoints, 1072 chapterPoints: chapterPoints,
1124 fileName: this.pdfFile, 1073 uploadPdf: this.pdfFile,
1125 uploadPpt: this.pptFile, 1074 uploadPpt: this.pptFile,
1075 fileName: this.pdfFileName,
1126 }, 1076 },
1127 ]; 1077 ];
1128 } 1078 }
1129 if (this.$refs.form.validate()) { 1079 if (this.$refs.form.validate()) {
1130 // console.log("this.addCourseDetail", this.addCourseDetail); 1080 // console.log("this.addCourseDetail", this.addCourseDetail);
1131 var courseDetailsData = { 1081 var courseDetailsData = {
1132 classId: this.addCourseDetail.classId, 1082 classId: this.addCourseDetail.classId,
1133 courseId: this.addCourseDetail.courseId, 1083 courseId: this.addCourseDetail.courseId,
1134 chapters: chapters, 1084 chapters: chapters,
1135 }; 1085 };
1136 this.loading = true; 1086 this.loading = true;
1137 http() 1087 http()
1138 .post("/createCourseDetail", courseDetailsData) 1088 .post("/createCourseDetail", courseDetailsData)
1139 .then((response) => { 1089 .then((response) => {
1140 this.addCourseDetailDialog = false; 1090 this.addCourseDetailDialog = false;
1141 this.loading = false; 1091 this.loading = false;
1142 this.snackbar = true; 1092 this.snackbar = true;
1143 this.text = response.data.message; 1093 this.text = response.data.message;
1144 this.color = "green"; 1094 this.color = "green";
1145 // this.clear(); 1095 // this.clear();
1146 this.trigger = "reset"; 1096 this.trigger = "reset";
1147 this.emptyPdf = "reset"; 1097 this.emptyPdf = "reset";
1148 http() 1098 http()
1149 .get("/getParticularCourseDetail", { 1099 .get("/getParticularCourseDetail", {
1150 params: { 1100 params: {
1151 courseId: this.addCourseDetail.courseId, 1101 courseId: this.addCourseDetail.courseId,
1152 }, 1102 },
1153 }) 1103 })
1154 .then((response) => { 1104 .then((response) => {
1155 this.CourseDetailsList = response.data.data; 1105 this.CourseDetailsList = response.data.data;
1156 if (this.CourseDetailsList.length === 0) { 1106 if (this.CourseDetailsList.length === 0) {
1157 this.showLoader = false; 1107 this.showLoader = false;
1158 this.snackbar = true; 1108 this.snackbar = true;
1159 this.text = "Data not found!"; 1109 this.text = "Data not found!";
1160 this.color = "error"; 1110 this.color = "error";
1161 return; 1111 return;
1162 } 1112 }
1163 this.showData = true; 1113 this.showData = true;
1164 if (response.data.data[0]) { 1114 if (response.data.data[0]) {
1165 this.chapters = response.data.data[0].chapters; 1115 this.chapters = response.data.data[0].chapters;
1166 } 1116 }
1167 this.showLoader = false; 1117 this.showLoader = false;
1168 }) 1118 })
1169 .catch((error) => { 1119 .catch((error) => {
1170 // console.log("err====>", err); 1120 // console.log("err====>", err);
1171 this.showLoader = false; 1121 this.showLoader = false;
1172 if (error.response.status === 401) { 1122 if (error.response.status === 401) {
1173 this.$router.replace({ path: "/" }); 1123 this.$router.replace({ path: "/" });
1174 this.$store.dispatch("setToken", null); 1124 this.$store.dispatch("setToken", null);
1175 this.$store.dispatch("Id", null); 1125 this.$store.dispatch("Id", null);
1176 } 1126 }
1177 }); 1127 });
1178 this.removeAddFind(); 1128 this.removeAddFind();
1179 }) 1129 })
1180 .catch((error) => { 1130 .catch((error) => {
1181 this.snackbar = true; 1131 this.snackbar = true;
1182 this.text = error.response.data.message; 1132 this.text = error.response.data.message;
1183 this.color = "error"; 1133 this.color = "error";
1184 this.loading = false; 1134 this.loading = false;
1185 }); 1135 });
1186 } 1136 }
1187 }, 1137 },
1188 clear() { 1138 clear() {
1189 this.$refs.form.reset(); 1139 this.$refs.form.reset();
1190 }, 1140 },
1191 saveChapter() { 1141 saveChapter() {
1192 this.editedItem.courseDetailId = this.editedItem._id; 1142 this.editedItem.courseDetailId = this.editedItem._id;
1193 // console.log("this.updates", this.updates); 1143 // console.log("this.updates", this.updates);
1194 var chapterPoints = []; 1144 var chapterPoints = [];
1195 for (let i = 0; i < this.updates.length; i++) { 1145 for (let i = 0; i < this.updates.length; i++) {
1196 chapterPoints.push(this.updates[i].value); 1146 chapterPoints.push(this.updates[i].value);
1197 } 1147 }
1198 var updateData = { 1148 var updateData = {
1199 courseDetailId: this.courseId, 1149 courseDetailId: this.courseId,
1200 chapterId: this.editChapter._id, 1150 chapterId: this.editChapter._id,
1201 chapterName: this.editChapter.chapterName, 1151 chapterName: this.editChapter.chapterName,
1202 description: this.editChapter.description, 1152 description: this.editChapter.description,
1203 chapterPoints: chapterPoints, 1153 chapterPoints: chapterPoints,
1204 fileName: this.pdfFile, 1154 uploadPDF: this.pdfFile,
1205 uploadPpt: this.pptFile, 1155 uploadPpt: this.pptFile,
1156 fileName: this.pdfFileName,
1206 }; 1157 };
1207 this.editLoading = true; 1158 this.editLoading = true;
1208 http() 1159 http()
1209 .put("/updateChapters", updateData) 1160 .put("/updateChapters", updateData)
1210 .then((response) => { 1161 .then((response) => {
1211 this.editChapterDetailDialog = false; 1162 this.editChapterDetailDialog = false;
1212 this.snackbar = true; 1163 this.snackbar = true;
1213 this.text = response.data.message; 1164 this.text = response.data.message;
1214 this.color = "green"; 1165 this.color = "green";
1215 this.editLoading = false; 1166 this.editLoading = false;
1216 // this.removeUpdatePoints(); 1167 // this.removeUpdatePoints();
1217 this.trigger = "reset"; 1168 this.trigger = "reset";
1218 this.emptyPdf = "reset"; 1169 this.emptyPdf = "reset";
1219 http() 1170 http()
1220 .get("/getParticularCourseDetail", { 1171 .get("/getParticularCourseDetail", {
1221 params: { 1172 params: {
1222 courseId: this.getCourse.courseId, 1173 courseId: this.getCourse.courseId,
1223 }, 1174 },
1224 }) 1175 })
1225 .then((response) => { 1176 .then((response) => {
1226 this.CourseDetailsList = response.data.data; 1177 this.CourseDetailsList = response.data.data;
1227 if (this.CourseDetailsList.length === 0) { 1178 if (this.CourseDetailsList.length === 0) {
1228 this.showLoader = false; 1179 this.showLoader = false;
1229 this.snackbar = true; 1180 this.snackbar = true;
1230 this.text = "Data not found!"; 1181 this.text = "Data not found!";
1231 this.color = "error"; 1182 this.color = "error";
1232 return; 1183 return;
1233 } 1184 }
1234 this.showData = true; 1185 this.showData = true;
1235 if (response.data.data[0]) { 1186 if (response.data.data[0]) {
1236 this.chapters = response.data.data[0].chapters; 1187 this.chapters = response.data.data[0].chapters;
1237 } 1188 }
1238 this.showLoader = false; 1189 this.showLoader = false;
1239 }) 1190 })
1240 .catch((error) => { 1191 .catch((error) => {
1241 // console.log("err====>", err); 1192 // console.log("err====>", err);
1242 this.showLoader = false; 1193 this.showLoader = false;
1243 if (error.response.status === 401) { 1194 if (error.response.status === 401) {
1244 this.$router.replace({ path: "/" }); 1195 this.$router.replace({ path: "/" });
1245 this.$store.dispatch("setToken", null); 1196 this.$store.dispatch("setToken", null);
1246 this.$store.dispatch("Id", null); 1197 this.$store.dispatch("Id", null);
1247 } 1198 }
1248 }); 1199 });
1249 }) 1200 })
1250 .catch((error) => { 1201 .catch((error) => {
1251 this.editLoading = false; 1202 this.editLoading = false;
1252 this.snackbar = true; 1203 this.snackbar = true;
1253 this.text = error.response.data.message; 1204 this.text = error.response.data.message;
1254 this.color = "error"; 1205 this.color = "error";
1255 }); 1206 });
1256 }, 1207 },
1257 save() { 1208 save() {
1258 var updateData = { 1209 var updateData = {
1259 courseDetailId: this.editedCourse._id, 1210 courseDetailId: this.editedCourse._id,
1260 courseId: this.editedCourse.courseId._id, 1211 courseId: this.editedCourse.courseId._id,
1261 classId: this.editedCourse.classId._id, 1212 classId: this.editedCourse.classId._id,
1262 }; 1213 };
1263 this.editLoading = true; 1214 this.editLoading = true;
1264 http() 1215 http()
1265 .put("/updateCourseDetail", updateData) 1216 .put("/updateCourseDetail", updateData)
1266 .then((response) => { 1217 .then((response) => {
1267 this.getCourseDetailsList(); 1218 this.getCourseDetailsList();
1268 this.editCourseDetailDialog = false; 1219 this.editCourseDetailDialog = false;
1269 this.snackbar = true; 1220 this.snackbar = true;
1270 this.text = response.data.message; 1221 this.text = response.data.message;
1271 this.color = "green"; 1222 this.color = "green";
1272 this.editLoading = false; 1223 this.editLoading = false;
1273 // this.editChapterPointName = ""; 1224 // this.editChapterPointName = "";
1274 this.editFiles = []; 1225 this.editFiles = [];
1275 }) 1226 })
1276 .catch((error) => { 1227 .catch((error) => {
1277 this.editLoading = false; 1228 this.editLoading = false;
1278 this.snackbar = true; 1229 this.snackbar = true;
1279 this.text = error.response.data.message; 1230 this.text = error.response.data.message;
1280 this.color = "error"; 1231 this.color = "error";
1281 }); 1232 });
1282 }, 1233 },
1283 getAllClasses() { 1234 getAllClasses() {
1284 http() 1235 http()
1285 .get("/getClassesList", { 1236 .get("/getClassesList", {
1286 headers: { Authorization: "Bearer " + this.token }, 1237 headers: { Authorization: "Bearer " + this.token },
1287 }) 1238 })
1288 .then((response) => { 1239 .then((response) => {
1289 this.addclass = response.data.data; 1240 this.addclass = response.data.data;
1290 }) 1241 })
1291 .catch((err) => { 1242 .catch((err) => {
1292 // console.log("err====>", err); 1243 // console.log("err====>", err);
1293 }); 1244 });
1294 }, 1245 },
1295 removeChapterPoint: function () { 1246 removeChapterPoint: function () {
1296 this.findsChapterPoint = [{ value: "" }]; 1247 this.findsChapterPoint = [{ value: "" }];
1297 }, 1248 },
1298 removeAddFind: function () { 1249 removeAddFind: function () {
1299 this.finds = [{ value: "" }]; 1250 this.finds = [{ value: "" }];
1300 }, 1251 },
1301 addFind: function () { 1252 addFind: function () {
1302 this.finds.push({ value: "" }); 1253 this.finds.push({ value: "" });
1303 }, 1254 },
1304 addChapterPoint: function () { 1255 addChapterPoint: function () {
1305 this.findsChapterPoint.push({ value: "" }); 1256 this.findsChapterPoint.push({ value: "" });
1306 }, 1257 },
1307 update: function () { 1258 update: function () {
1308 this.updates.push({ value: "" }); 1259 this.updates.push({ value: "" });
1309 }, 1260 },
1310 // removeUpdatePoints: function() { 1261 // removeUpdatePoints: function() {
1311 // this.updates = [{ value: "" }]; 1262 // this.updates = [{ value: "" }];
1312 // }, 1263 // },
1313 deleteFind: function (index) { 1264 deleteFind: function (index) {
1314 this.finds.splice(index, 1); 1265 this.finds.splice(index, 1);
1315 if (index === 0) this.addFind(); 1266 if (index === 0) this.addFind();
1316 }, 1267 },
1317 deleteChapterPoint: function (index) { 1268 deleteChapterPoint: function (index) {
1318 this.findsChapterPoint.splice(index, 1); 1269 this.findsChapterPoint.splice(index, 1);
1319 if (index === 0) this.addChapterPoint(); 1270 if (index === 0) this.addChapterPoint();
1320 }, 1271 },
1321 deleteUpdate: function (index) { 1272 deleteUpdate: function (index) {
1322 this.updates.splice(index, 1); 1273 this.updates.splice(index, 1);
1323 if (index === 0) this.update(); 1274 if (index === 0) this.update();
1324 }, 1275 },
1325 deleteUrl: function (index, youTubelinkId, id) { 1276 deleteUrl: function (index, youTubelinkId, id) {
1326 this.editChapter.chapterPoints.splice(index, 1); 1277 this.editChapter.chapterPoints.splice(index, 1);
1327 if (index === 0) this.update(); 1278 if (index === 0) this.update();
1328 }, 1279 },
1329 displaySearch() { 1280 displaySearch() {
1330 this.show = false; 1281 this.show = false;
1331 this.showSearch = true; 1282 this.showSearch = true;
1332 }, 1283 },
1333 closeSearch() { 1284 closeSearch() {
1334 this.showSearch = false; 1285 this.showSearch = false;
1335 this.show = true; 1286 this.show = true;
1336 this.search = ""; 1287 this.search = "";
1337 }, 1288 },
1338 }, 1289 },