Commit 7d2cd24624a31299647d90753bd452d8fee1f0e1

Authored by Neeraj Sharma
1 parent 610e873a0e

fixed bugs

Showing 1 changed file with 26 additions and 20 deletions   Show diff stats
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> 4 <v-dialog v-model="editCourseDetailDialog" max-width="1000px" scrollable>
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 <!-- ****** Edit Chapter detail ****** --> 70 <!-- ****** Edit Chapter detail ****** -->
71 <v-dialog v-model="editChapterDetailDialog" max-width="1000px" scrollable> 71 <v-dialog v-model="editChapterDetailDialog" max-width="1000px" scrollable>
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 size="24" class="right" @click="editChapterDetailDialog = false">cancel</v-icon> 76 <v-icon size="24" class="right" @click="editChapterDetailDialog = false">cancel</v-icon>
77 </v-flex> 77 </v-flex>
78 </v-layout> 78 </v-layout>
79 <v-card-text> 79 <v-card-text>
80 <v-layout wrap> 80 <v-layout wrap>
81 <v-flex xs12 sm12> 81 <v-flex xs12 sm12>
82 <v-layout> 82 <v-layout>
83 <v-flex xs4 class="pt-4 subheading"> 83 <v-flex xs4 class="pt-4 subheading">
84 <label class="right">Chapter Name:</label> 84 <label class="right">Chapter Name:</label>
85 </v-flex> 85 </v-flex>
86 <v-flex xs8 sm6 class="ml-3"> 86 <v-flex xs8 sm6 class="ml-3">
87 <v-text-field 87 <v-text-field
88 v-model="editChapter.chapterName" 88 v-model="editChapter.chapterName"
89 placeholder="fill your Title" 89 placeholder="fill your Title"
90 type="text" 90 type="text"
91 required 91 required
92 ></v-text-field> 92 ></v-text-field>
93 </v-flex> 93 </v-flex>
94 </v-layout> 94 </v-layout>
95 </v-flex> 95 </v-flex>
96 <v-flex xs12 sm12> 96 <v-flex xs12 sm12>
97 <v-layout> 97 <v-layout>
98 <v-flex xs4 class="pt-4 subheading"> 98 <v-flex xs4 class="pt-4 subheading">
99 <label class="right">Description:</label> 99 <label class="right">Description:</label>
100 </v-flex> 100 </v-flex>
101 <v-flex xs8 sm6 class="ml-3"> 101 <v-flex xs8 sm6 class="ml-3">
102 <v-text-field 102 <v-text-field
103 placeholder="fill your Description" 103 placeholder="fill your Description"
104 v-model="editChapter.description" 104 v-model="editChapter.description"
105 type="text" 105 type="text"
106 required 106 required
107 ></v-text-field> 107 ></v-text-field>
108 </v-flex> 108 </v-flex>
109 </v-layout> 109 </v-layout>
110 </v-flex> 110 </v-flex>
111 </v-layout> 111 </v-layout>
112 <v-flex xs12 v-if="editChapter.chapterPoints !=[]"> 112 <v-flex xs12 v-if="editChapter.chapterPoints !=[]">
113 <v-layout 113 <v-layout
114 wrap 114 wrap
115 v-for="(editChapterPoint,index) in editChapter.chapterPoints" 115 v-for="(editChapterPoint,index) in editChapter.chapterPoints"
116 :key="index" 116 :key="index"
117 > 117 >
118 <v-flex xs12 sm12 md4 class="pt-4 subheading"> 118 <v-flex xs12 sm12 md4 class="pt-4 subheading">
119 <label class="right hidden-xs-only hidden-sm-only">Chapter Points:</label> 119 <label class="right hidden-xs-only hidden-sm-only">Chapter Points:</label>
120 <label class="hidden-md-only hidden-lg-only hidden-xl-only">Chapter Points:</label> 120 <label class="hidden-md-only hidden-lg-only hidden-xl-only">Chapter Points:</label>
121 </v-flex> 121 </v-flex>
122 <v-layout> 122 <v-layout>
123 <v-flex xs10 sm10 sm5 md9 class="ml-3"> 123 <v-flex xs10 sm10 sm5 md9 class="ml-3">
124 <v-text-field :value="editChapterPoint" type="text" required></v-text-field> 124 <v-text-field :value="editChapterPoint" type="text" required></v-text-field>
125 </v-flex> 125 </v-flex>
126 <v-flex xs2 class="pt-4"> 126 <v-flex xs2 class="pt-4">
127 <v-icon @click="deleteUrl(index)">cancel</v-icon> 127 <v-icon @click="deleteUrl(index)">cancel</v-icon>
128 <!-- <v-icon @click="update()">add_circle</v-icon> --> 128 <!-- <v-icon @click="update()">add_circle</v-icon> -->
129 </v-flex> 129 </v-flex>
130 </v-layout> 130 </v-layout>
131 </v-layout> 131 </v-layout>
132 </v-flex> 132 </v-flex>
133 <v-flex xs12> 133 <v-flex xs12>
134 <div v-for="(updateImage,index) in updates" :key="index"> 134 <div v-for="(updateImage,index) in updates" :key="index">
135 <v-layout wrap> 135 <v-layout wrap>
136 <v-flex xs12 sm12 md4 class="pt-4 subheading"> 136 <v-flex xs12 sm12 md4 class="pt-4 subheading">
137 <label class="right hidden-xs-only hidden-sm-only">Chapter Points:</label> 137 <label class="right hidden-xs-only hidden-sm-only">Chapter Points:</label>
138 <label class="hidden-md-only hidden-lg-only hidden-xl-only">Chapter Points:</label> 138 <label class="hidden-md-only hidden-lg-only hidden-xl-only">Chapter Points:</label>
139 </v-flex> 139 </v-flex>
140 <v-layout> 140 <v-layout>
141 <v-flex xs10 sm12 md9 class="ml-3"> 141 <v-flex xs10 sm12 md9 class="ml-3">
142 <v-text-field 142 <v-text-field
143 v-model="updateImage.value" 143 v-model="updateImage.value"
144 placeholder="Upload new Chapter Points" 144 placeholder="Upload new Chapter Points"
145 required 145 required
146 ></v-text-field> 146 ></v-text-field>
147 </v-flex> 147 </v-flex>
148 <v-flex xs2 class="pt-4"> 148 <v-flex xs2 class="pt-4">
149 <v-icon @click="deleteUpdate(index)" v-if="index !=0">cancel</v-icon> 149 <v-icon @click="deleteUpdate(index)" v-if="index !=0">cancel</v-icon>
150 <v-icon @click="update">add_circle</v-icon> 150 <v-icon @click="update">add_circle</v-icon>
151 </v-flex> 151 </v-flex>
152 </v-layout> 152 </v-layout>
153 </v-layout> 153 </v-layout>
154 </div> 154 </div>
155 </v-flex> 155 </v-flex>
156 <v-layout> 156 <v-layout>
157 <v-flex xs12 sm12 md11 lg11> 157 <v-flex xs12 sm12 md11 lg11>
158 <v-card-actions class="hidden-xs-only hidden-sm-only"> 158 <v-card-actions class="hidden-xs-only hidden-sm-only">
159 <v-spacer></v-spacer> 159 <v-spacer></v-spacer>
160 <v-btn 160 <v-btn
161 round 161 round
162 dark 162 dark
163 @click="saveChapter" 163 @click="saveChapter"
164 :loading="editLoading" 164 :loading="editLoading"
165 class="add-button mr-4" 165 class="add-button mr-4"
166 >Save</v-btn> 166 >Save</v-btn>
167 </v-card-actions> 167 </v-card-actions>
168 <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> 168 <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only">
169 <v-spacer></v-spacer> 169 <v-spacer></v-spacer>
170 <v-btn 170 <v-btn
171 round 171 round
172 dark 172 dark
173 @click="saveChapter" 173 @click="saveChapter"
174 :loading="editLoading" 174 :loading="editLoading"
175 class="add-button" 175 class="add-button"
176 >Save</v-btn> 176 >Save</v-btn>
177 <v-spacer></v-spacer> 177 <v-spacer></v-spacer>
178 </v-card-actions> 178 </v-card-actions>
179 </v-flex> 179 </v-flex>
180 </v-layout> 180 </v-layout>
181 </v-card-text> 181 </v-card-text>
182 </v-card> 182 </v-card>
183 </v-dialog> 183 </v-dialog>
184 <!-- ****** Add Chapter detail ****** --> 184 <!-- ****** Add Chapter detail ****** -->
185 <v-dialog v-model="addChapterDialog" max-width="1000px" scrollable> 185 <v-dialog v-model="addChapterDialog" max-width="1000px" scrollable>
186 <v-card class="card-style pa-2" dark> 186 <v-card class="card-style pa-2" dark>
187 <v-layout> 187 <v-layout>
188 <v-flex xs12> 188 <v-flex xs12>
189 <label class="title text-xs-center">Add Chapter Detail</label> 189 <label class="title text-xs-center">Add Chapter Detail</label>
190 <v-icon size="24" class="right" @click="addChapterDialog = false">cancel</v-icon> 190 <v-icon size="24" class="right" @click="addChapterDialog = false">cancel</v-icon>
191 </v-flex> 191 </v-flex>
192 </v-layout> 192 </v-layout>
193 <v-card-text> 193 <v-card-text>
194 <v-layout wrap> 194 <v-layout wrap>
195 <v-flex xs12 sm12> 195 <v-flex xs12 sm12>
196 <v-layout> 196 <v-layout>
197 <v-flex xs4 class="pt-4 subheading"> 197 <v-flex xs4 class="pt-4 subheading">
198 <label class="right">Chapter Name:</label> 198 <label class="right">Chapter Name:</label>
199 </v-flex> 199 </v-flex>
200 <v-flex xs8 sm6 class="ml-3"> 200 <v-flex xs8 sm6 class="ml-3">
201 <v-text-field 201 <v-text-field
202 v-model="addChapterItem.chapterName" 202 v-model="addChapterItem.chapterName"
203 placeholder="fill your Title" 203 placeholder="fill your Title"
204 type="text" 204 type="text"
205 required 205 required
206 ></v-text-field> 206 ></v-text-field>
207 </v-flex> 207 </v-flex>
208 </v-layout> 208 </v-layout>
209 </v-flex> 209 </v-flex>
210 <v-flex xs12 sm12> 210 <v-flex xs12 sm12>
211 <v-layout> 211 <v-layout>
212 <v-flex xs4 class="pt-4 subheading"> 212 <v-flex xs4 class="pt-4 subheading">
213 <label class="right">Description:</label> 213 <label class="right">Description:</label>
214 </v-flex> 214 </v-flex>
215 <v-flex xs8 sm6 class="ml-3"> 215 <v-flex xs8 sm6 class="ml-3">
216 <v-text-field 216 <v-text-field
217 placeholder="fill your Description" 217 placeholder="fill your Description"
218 v-model="addChapterItem.description" 218 v-model="addChapterItem.description"
219 type="text" 219 type="text"
220 required 220 required
221 ></v-text-field> 221 ></v-text-field>
222 </v-flex> 222 </v-flex>
223 </v-layout> 223 </v-layout>
224 </v-flex> 224 </v-flex>
225 </v-layout> 225 </v-layout>
226 <v-flex xs12> 226 <v-flex xs12>
227 <div v-for="(chapterPoints,index) in findsChapterPoint" :key="index"> 227 <div v-for="(chapterPoints,index) in findsChapterPoint" :key="index">
228 <v-layout> 228 <v-layout>
229 <v-flex xs4 class="pt-4 subheading"> 229 <v-flex xs4 class="pt-4 subheading">
230 <label class="right">Chapter Points:</label> 230 <label class="right">Chapter Points:</label>
231 </v-flex> 231 </v-flex>
232 <v-flex xs8 sm8 md6 class="ml-3"> 232 <v-flex xs8 sm8 md6 class="ml-3">
233 <v-text-field 233 <v-text-field
234 placeholder="fill your Chapter Points" 234 placeholder="fill your Chapter Points"
235 v-model="chapterPoints.value" 235 v-model="chapterPoints.value"
236 type="text" 236 type="text"
237 name="link" 237 name="link"
238 required 238 required
239 ></v-text-field> 239 ></v-text-field>
240 </v-flex> 240 </v-flex>
241 <v-flex xs2 class="pt-4"> 241 <v-flex xs2 class="pt-4">
242 <v-icon @click="deleteChapterPoint(index)" v-if="index !=0 ">cancel</v-icon> 242 <v-icon @click="deleteChapterPoint(index)" v-if="index !=0 ">cancel</v-icon>
243 <v-icon @click="addChapterPoint()">add_circle</v-icon> 243 <v-icon @click="addChapterPoint()">add_circle</v-icon>
244 </v-flex> 244 </v-flex>
245 </v-layout> 245 </v-layout>
246 </div> 246 </div>
247 </v-flex> 247 </v-flex>
248 <v-layout> 248 <v-layout>
249 <v-flex xs12 sm12 md11 lg11> 249 <v-flex xs12 sm12 md11 lg11>
250 <v-card-actions class="hidden-xs-only hidden-sm-only"> 250 <v-card-actions class="hidden-xs-only hidden-sm-only">
251 <v-spacer></v-spacer> 251 <v-spacer></v-spacer>
252 <v-btn 252 <v-btn
253 round 253 round
254 dark 254 dark
255 @click="submitChapter" 255 @click="submitChapter"
256 :loading="editLoading" 256 :loading="editLoading"
257 class="add-button mr-4" 257 class="add-button mr-4"
258 >Submit</v-btn> 258 >Submit</v-btn>
259 </v-card-actions> 259 </v-card-actions>
260 <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only"> 260 <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only">
261 <v-spacer></v-spacer> 261 <v-spacer></v-spacer>
262 <v-btn round dark @click="save" :loading="editLoading" class="add-button">Save</v-btn> 262 <v-btn round dark @click="save" :loading="editLoading" class="add-button">Save</v-btn>
263 <v-spacer></v-spacer> 263 <v-spacer></v-spacer>
264 </v-card-actions> 264 </v-card-actions>
265 </v-flex> 265 </v-flex>
266 </v-layout> 266 </v-layout>
267 </v-card-text> 267 </v-card-text>
268 </v-card> 268 </v-card>
269 </v-dialog> 269 </v-dialog>
270 270
271 <!-- ****** PROFILE Gallery ****** --> 271 <!-- ****** PROFILE Gallery ****** -->
272 272
273 <v-dialog v-model="viewProfileGallery" max-width="1000" scrollable> 273 <v-dialog v-model="viewProfileGallery" max-width="1000" scrollable>
274 <v-card flat class="card-style pa-3" dark> 274 <v-card flat class="card-style pa-3" dark>
275 <v-layout> 275 <v-layout>
276 <v-flex xs12> 276 <v-flex xs12>
277 <label class="title text-xs-center">View Course Detail</label> 277 <label class="title text-xs-center">View Course Detail</label>
278 <v-icon size="24" class="right" @click="closeProfileGallery">cancel</v-icon> 278 <v-icon size="24" class="right" @click="closeProfileGallery">cancel</v-icon>
279 </v-flex> 279 </v-flex>
280 </v-layout> 280 </v-layout>
281 <v-card-text> 281 <v-card-text>
282 <v-container grid-list-md> 282 <v-container grid-list-md>
283 <v-layout wrap> 283 <v-layout wrap>
284 <v-flex xs12> 284 <v-flex xs12>
285 <v-layout> 285 <v-layout>
286 <v-flex xs4 sm6> 286 <v-flex xs4 sm6>
287 <h5 class="right my-1"> 287 <h5 class="right my-1">
288 <b>Chapter Name:</b> 288 <b>Chapter Name:</b>
289 </h5> 289 </h5>
290 </v-flex> 290 </v-flex>
291 <v-flex sm6 xs8> 291 <v-flex sm6 xs8>
292 <h5 class="my-1">{{ editedItem.chapterName }}</h5> 292 <h5 class="my-1">{{ editedItem.chapterName }}</h5>
293 </v-flex> 293 </v-flex>
294 </v-layout> 294 </v-layout>
295 <v-layout> 295 <v-layout>
296 <v-flex xs4 sm6> 296 <v-flex xs4 sm6>
297 <h5 class="right my-1"> 297 <h5 class="right my-1">
298 <b>Description:</b> 298 <b>Description:</b>
299 </h5> 299 </h5>
300 </v-flex> 300 </v-flex>
301 <v-flex sm6 xs8> 301 <v-flex sm6 xs8>
302 <h5 class="my-1">{{ editedItem.description }}</h5> 302 <h5 class="my-1">{{ editedItem.description }}</h5>
303 </v-flex> 303 </v-flex>
304 </v-layout> 304 </v-layout>
305 <v-layout> 305 <v-layout>
306 <v-flex xs5 sm6> 306 <v-flex xs5 sm6>
307 <h5 class="right my-1"> 307 <h5 class="right my-1">
308 <b>You Tube Link Url:</b> 308 <b>You Tube Link Url:</b>
309 </h5> 309 </h5>
310 </v-flex> 310 </v-flex>
311 <v-flex sm6 xs8> 311 <v-flex sm6 xs8>
312 <h5 class="my-1"> 312 <h5 class="my-1">
313 <ul v-for="chapterPoint in editedItem.chapterPoints" :key="chapterPoint"> 313 <ul v-for="chapterPoint in editedItem.chapterPoints" :key="chapterPoint">
314 <li>{{ chapterPoint}}</li> 314 <li>{{ chapterPoint}}</li>
315 </ul> 315 </ul>
316 </h5> 316 </h5>
317 </v-flex> 317 </v-flex>
318 </v-layout> 318 </v-layout>
319 </v-flex> 319 </v-flex>
320 </v-layout> 320 </v-layout>
321 </v-container> 321 </v-container>
322 </v-card-text> 322 </v-card-text>
323 </v-card> 323 </v-card>
324 </v-dialog> 324 </v-dialog>
325 325
326 <!-- ****** Course Detail TABLE ****** --> 326 <!-- ****** Course Detail TABLE ****** -->
327 327
328 <v-toolbar color="transparent" flat> 328 <v-toolbar color="transparent" flat>
329 <v-btn 329 <v-btn
330 fab 330 fab
331 dark 331 dark
332 class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" 332 class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only"
333 small 333 small
334 @click="addCourseDetailDialog = true" 334 @click="addCourseDetailDialog = true"
335 > 335 >
336 <v-icon dark>add</v-icon> 336 <v-icon dark>add</v-icon>
337 </v-btn> 337 </v-btn>
338 <v-btn 338 <v-btn
339 round 339 round
340 class="open-dialog-button hidden-sm-only hidden-xs-only" 340 class="open-dialog-button hidden-sm-only hidden-xs-only"
341 dark 341 dark
342 @click="addCourseDetailDialog = true" 342 @click="addCourseDetailDialog = true"
343 > 343 >
344 <v-icon class="white--text pr-1" size="20">add</v-icon>Add Course Detail 344 <v-icon class="white--text pr-1" size="20">add</v-icon>Add Course Detail
345 </v-btn> 345 </v-btn>
346 <v-flex xs12 sm4 md2> 346 <v-flex xs12 sm4 md2>
347 <v-select 347 <v-select
348 small 348 small
349 :items="addclass" 349 :items="addclass"
350 label="Select Class" 350 label="Select Class"
351 v-model="getCourse.classId" 351 v-model="getCourse.classId"
352 item-text="classNum" 352 item-text="classNum"
353 item-value="_id" 353 item-value="_id"
354 name="Select Class" 354 name="Select Class"
355 @change="getCourses(getCourse.classId)" 355 @change="getCourses(getCourse.classId)"
356 class="mr-2" 356 class="mr-2"
357 required 357 required
358 ></v-select> 358 ></v-select>
359 </v-flex> 359 </v-flex>
360 <v-flex xs12 sm4 md2> 360 <v-flex xs12 sm4 md2>
361 <v-select 361 <v-select
362 :items="courseData" 362 :items="courseData"
363 label="Select Course" 363 label="Select Course"
364 v-model="getCourse.courseId" 364 v-model="getCourse.courseId"
365 item-text="courseName" 365 item-text="courseName"
366 item-value="_id" 366 item-value="_id"
367 required 367 required
368 class="ml-2" 368 class="ml-2"
369 @change="getCourseDetailsList(getCourse.courseId)" 369 @change="getCourseDetailsList(getCourse.courseId)"
370 ></v-select> 370 ></v-select>
371 </v-flex> 371 </v-flex>
372 <v-spacer></v-spacer> 372 <v-spacer></v-spacer>
373 <v-card-title class="body-1" v-show="show"> 373 <v-card-title class="body-1" v-show="show">
374 <v-btn icon large flat @click="displaySearch"> 374 <v-btn icon large flat @click="displaySearch">
375 <v-avatar size="27"> 375 <v-avatar size="27">
376 <img src="/static/icon/search.png" alt="icon" /> 376 <img src="/static/icon/search.png" alt="icon" />
377 </v-avatar> 377 </v-avatar>
378 </v-btn> 378 </v-btn>
379 </v-card-title> 379 </v-card-title>
380 <v-flex xs8 sm8 md3 lg2 v-show="showSearch"> 380 <v-flex xs8 sm8 md3 lg2 v-show="showSearch">
381 <v-layout> 381 <v-layout>
382 <v-text-field v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> 382 <v-text-field v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field>
383 <v-icon @click="closeSearch" color="error">close</v-icon> 383 <v-icon @click="closeSearch" color="error">close</v-icon>
384 </v-layout> 384 </v-layout>
385 </v-flex> 385 </v-flex>
386 </v-toolbar> 386 </v-toolbar>
387 <v-data-table 387 <v-data-table
388 :headers="headers" 388 :headers="headers"
389 :items="CourseDetailsList" 389 :items="CourseDetailsList"
390 :pagination.sync="pagination" 390 :pagination.sync="pagination"
391 :search="search" 391 :search="search"
392 item-key="_id" 392 item-key="_id"
393 > 393 >
394 <template slot="items" slot-scope="props"> 394 <template slot="items" slot-scope="props">
395 <tr class="tr" @click="courseTableRow(props.item._id)"> 395 <tr class="tr" @click="courseTableRow(props.item._id)">
396 <td class="td td-row">{{ props.index + 1}}</td> 396 <td class="td td-row">{{ props.index + 1}}</td>
397 <td class="td td-row text-xs-center">{{ props.item.classId.classNum }}</td> 397 <td class="td td-row text-xs-center">{{ props.item.classId.classNum }}</td>
398 <td class="td td-row text-xs-center">{{ props.item.courseId.courseName }}</td> 398 <td class="td td-row text-xs-center">{{ props.item.courseId.courseName }}</td>
399 <td class="td td-row text-xs-center"> 399 <td class="td td-row text-xs-center">
400 <div style="vertical-align: top;"> 400 <div style="vertical-align: top;">
401 <v-tooltip top> 401 <v-tooltip top>
402 <v-icon 402 <v-icon
403 slot="activator" 403 slot="activator"
404 style="cursor:pointer;font-size:22px;position: relative;top: -4px; " 404 style="cursor:pointer;font-size:22px;position: relative;top: -4px; "
405 class="mr-3" 405 class="mr-3"
406 @click="addChapters(props.item)" 406 @click="addChapters(props.item)"
407 >add_circle_outline</v-icon> 407 >add_circle_outline</v-icon>
408 <span>Add</span> 408 <span>Add</span>
409 </v-tooltip> 409 </v-tooltip>
410 <v-tooltip top> 410 <v-tooltip top>
411 <img 411 <img
412 slot="activator" 412 slot="activator"
413 style="cursor:pointer; width:25px; height:25px; " 413 style="cursor:pointer; width:25px; height:25px; "
414 class="mr-3" 414 class="mr-3"
415 @click="props.expanded = !props.expanded" 415 @click="props.expanded = !props.expanded"
416 src="/static/icon/view.png" 416 src="/static/icon/view.png"
417 /> 417 />
418 <span>View</span> 418 <span>View</span>
419 </v-tooltip> 419 </v-tooltip>
420 <v-tooltip top> 420 <v-tooltip top>
421 <img 421 <img
422 slot="activator" 422 slot="activator"
423 style="cursor:pointer; width:20px; height:18px; " 423 style="cursor:pointer; width:20px; height:18px; "
424 class="mr-3" 424 class="mr-3"
425 @click="editItem(props.item)" 425 @click="editItem(props.item)"
426 src="/static/icon/edit.png" 426 src="/static/icon/edit.png"
427 /> 427 />
428 <span>Edit</span> 428 <span>Edit</span>
429 </v-tooltip> 429 </v-tooltip>
430 <v-tooltip top> 430 <v-tooltip top>
431 <img 431 <img
432 slot="activator" 432 slot="activator"
433 style="cursor:pointer; width:20px; height:20px; " 433 style="cursor:pointer; width:20px; height:20px; "
434 class="mr-3" 434 class="mr-3"
435 @click="deleteItem(props.item)" 435 @click="deleteItem(props.item)"
436 src="/static/icon/delete.png" 436 src="/static/icon/delete.png"
437 /> 437 />
438 <span>Delete</span> 438 <span>Delete</span>
439 </v-tooltip> 439 </v-tooltip>
440 </div> 440 </div>
441 </td> 441 </td>
442 </tr> 442 </tr>
443 </template> 443 </template>
444 <template slot="expand" slot-scope="props"> 444 <template slot="expand">
445 <v-data-table :items="chapters" hide-actions item-key="chapterName" style="width: auto;"> 445 <v-data-table :items="chapters" hide-actions item-key="chapterName" style="width: auto;">
446 <template slot="items" slot-scope="props"> 446 <template slot="items" slot-scope="props">
447 <tr class="tr" @click="props.expanded = !props.expanded"> 447 <tr class="tr" @click="props.expanded = !props.expanded">
448 <td class="td td-row">{{ props.index + 1}}</td> 448 <td class="td td-row">{{ props.index + 1}}</td>
449 <td class="text-xs-center td td-row">{{ props.item.chapterName}}</td> 449 <td class="text-xs-center td td-row">{{ props.item.chapterName}}</td>
450 <td class="text-xs-center td td-row">{{ props.item.description }}</td> 450 <td class="text-xs-center td td-row">{{ props.item.description }}</td>
451 <td class="text-xs-center td td-row"> 451 <td class="text-xs-center td td-row">
452 <v-tooltip top> 452 <v-tooltip top>
453 <img 453 <img
454 slot="activator" 454 slot="activator"
455 style="cursor:pointer; width:25px; height:25px; " 455 style="cursor:pointer; width:25px; height:25px; "
456 class="mr-3" 456 class="mr-3"
457 @click="profile(props.item)" 457 @click="profile(props.item)"
458 src="/static/icon/view.png" 458 src="/static/icon/view.png"
459 /> 459 />
460 <span>View</span> 460 <span>View</span>
461 </v-tooltip> 461 </v-tooltip>
462 <v-tooltip top> 462 <v-tooltip top>
463 <img 463 <img
464 slot="activator" 464 slot="activator"
465 style="cursor:pointer; width:20px; height:18px; " 465 style="cursor:pointer; width:20px; height:18px; "
466 class="mr-3" 466 class="mr-3"
467 @click="editChapterItem(props.item)" 467 @click="editChapterItem(props.item)"
468 src="/static/icon/edit.png" 468 src="/static/icon/edit.png"
469 /> 469 />
470 <span>Edit</span> 470 <span>Edit</span>
471 </v-tooltip> 471 </v-tooltip>
472 <v-tooltip top> 472 <v-tooltip top>
473 <img 473 <img
474 slot="activator" 474 slot="activator"
475 style="cursor:pointer; width:20px; height:20px; " 475 style="cursor:pointer; width:20px; height:20px; "
476 class="mr-3" 476 class="mr-3"
477 @click="deleteChapters(props.item)" 477 @click="deleteChapters(props.item)"
478 src="/static/icon/delete.png" 478 src="/static/icon/delete.png"
479 /> 479 />
480 <span>Delete Chapter</span> 480 <span>Delete Chapter</span>
481 </v-tooltip> 481 </v-tooltip>
482 </td> 482 </td>
483 </tr> 483 </tr>
484 </template> 484 </template>
485 </v-data-table> 485 </v-data-table>
486 </template> 486 </template>
487 487
488 <v-alert 488 <v-alert
489 slot="no-results" 489 slot="no-results"
490 :value="true" 490 :value="true"
491 color="error" 491 color="error"
492 icon="warning" 492 icon="warning"
493 >Your search for "{{ search }}" found no results.</v-alert> 493 >Your search for "{{ search }}" found no results.</v-alert>
494 </v-data-table> 494 </v-data-table>
495 <!-- ****** ADD Course Detail ****** --> 495 <!-- ****** ADD Course Detail ****** -->
496 <v-dialog v-model="addCourseDetailDialog" max-width="600px" persistent> 496 <v-dialog v-model="addCourseDetailDialog" max-width="600px" persistent>
497 <v-card flat class="card-style pa-2" dark> 497 <v-card flat class="card-style pa-2" dark>
498 <v-layout> 498 <v-layout>
499 <v-flex xs12> 499 <v-flex xs12>
500 <label class="title text-xs-center">Add Course Details</label> 500 <label class="title text-xs-center">Add Course Details</label>
501 <v-icon size="24" class="right" @click="addCourseDetailDialog = false; clear();">cancel</v-icon> 501 <v-icon size="24" class="right" @click="addCourseDetailDialog = false; clear();">cancel</v-icon>
502 </v-flex> 502 </v-flex>
503 </v-layout> 503 </v-layout>
504 <v-form ref="form" v-model="valid" lazy-validation> 504 <v-form ref="form" v-model="valid" lazy-validation>
505 <v-container fluid> 505 <v-container fluid>
506 <v-flex xs12> 506 <v-flex xs12>
507 <v-layout> 507 <v-layout>
508 <v-flex xs4 class="pt-4 subheading"> 508 <v-flex xs4 class="pt-4 subheading">
509 <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> 509 <label class="right hidden-xs-only hidden-sm-only">Select Class:</label>
510 <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> 510 <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label>
511 </v-flex> 511 </v-flex>
512 <v-flex xs8 sm8 md7 class="ml-3"> 512 <v-flex xs8 sm8 md7 class="ml-3">
513 <v-select 513 <v-select
514 :items="addclass" 514 :items="addclass"
515 label="Select Class" 515 label="Select Class"
516 v-model="addCourseDetail.classId" 516 v-model="addCourseDetail.classId"
517 item-text="classNum" 517 item-text="classNum"
518 item-value="_id" 518 item-value="_id"
519 name="Select Class" 519 name="Select Class"
520 :rules="clsssRules" 520 :rules="clsssRules"
521 @change="getCourses(addCourseDetail.classId)" 521 @change="getCourses(addCourseDetail.classId)"
522 required 522 required
523 ></v-select> 523 ></v-select>
524 </v-flex> 524 </v-flex>
525 </v-layout> 525 </v-layout>
526 </v-flex> 526 </v-flex>
527 <v-flex xs12> 527 <v-flex xs12>
528 <v-layout> 528 <v-layout>
529 <v-flex xs4 class="pt-4 subheading"> 529 <v-flex xs4 class="pt-4 subheading">
530 <label class="right hidden-xs-only hidden-sm-only">Select Course:</label> 530 <label class="right hidden-xs-only hidden-sm-only">Select Course:</label>
531 <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Course:</label> 531 <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Course:</label>
532 </v-flex> 532 </v-flex>
533 <v-flex xs8 sm8 md7 class="ml-3"> 533 <v-flex xs8 sm8 md7 class="ml-3">
534 <v-select 534 <v-select
535 :items="courseData" 535 :items="courseData"
536 label="Select Course" 536 label="Select Course"
537 v-model="addCourseDetail.courseId" 537 v-model="addCourseDetail.courseId"
538 item-text="courseName" 538 item-text="courseName"
539 item-value="_id" 539 item-value="_id"
540 :rules="courseRules" 540 :rules="courseRules"
541 required 541 required
542 ></v-select> 542 ></v-select>
543 </v-flex> 543 </v-flex>
544 </v-layout> 544 </v-layout>
545 </v-flex> 545 </v-flex>
546 <v-flex xs12> 546 <v-flex xs12>
547 <v-layout> 547 <v-layout>
548 <v-flex xs4 class="pt-4 subheading"> 548 <v-flex xs4 class="pt-4 subheading">
549 <label class="right">Chapter Name:</label> 549 <label class="right">Chapter Name:</label>
550 </v-flex> 550 </v-flex>
551 <v-flex xs8 sm8 md7 class="ml-3"> 551 <v-flex xs8 sm8 md7 class="ml-3">
552 <v-text-field 552 <v-text-field
553 v-model="addCourseDetail.chapterName" 553 v-model="addCourseDetail.chapterName"
554 placeholder="fill your Title" 554 placeholder="fill your Title"
555 name="name" 555 name="name"
556 type="text" 556 type="text"
557 :rules="chapterNameRules" 557 :rules="chapterNameRules"
558 required 558 required
559 ></v-text-field> 559 ></v-text-field>
560 </v-flex> 560 </v-flex>
561 </v-layout> 561 </v-layout>
562 </v-flex> 562 </v-flex>
563 <v-flex xs12> 563 <v-flex xs12>
564 <v-layout> 564 <v-layout>
565 <v-flex xs4 class="pt-4 subheading"> 565 <v-flex xs4 class="pt-4 subheading">
566 <label class="right">Description:</label> 566 <label class="right">Description:</label>
567 </v-flex> 567 </v-flex>
568 <v-flex xs8 sm8 md7 class="ml-3"> 568 <v-flex xs8 sm8 md7 class="ml-3">
569 <v-text-field 569 <v-text-field
570 placeholder="fill your Description" 570 placeholder="fill your Description"
571 :rules="descriptionRules" 571 :rules="descriptionRules"
572 v-model="addCourseDetail.description" 572 v-model="addCourseDetail.description"
573 type="text" 573 type="text"
574 name="email" 574 name="email"
575 required 575 required
576 ></v-text-field> 576 ></v-text-field>
577 </v-flex> 577 </v-flex>
578 </v-layout> 578 </v-layout>
579 </v-flex> 579 </v-flex>
580 <v-layout> 580 <v-layout>
581 <v-flex xs12> 581 <v-flex xs12>
582 <div v-for="(chapterPoints,index) in finds" :key="index"> 582 <div v-for="(chapterPoints,index) in finds" :key="index">
583 <v-layout> 583 <v-layout>
584 <v-flex xs4 class="pt-4 subheading"> 584 <v-flex xs4 class="pt-4 subheading">
585 <label class="right">Chapter Points:</label> 585 <label class="right">Chapter Points:</label>
586 </v-flex> 586 </v-flex>
587 <v-flex xs8 sm8 md6 class="ml-3"> 587 <v-flex xs8 sm8 md6 class="ml-3">
588 <v-text-field 588 <v-text-field
589 placeholder="fill your Chapter Points" 589 placeholder="fill your Chapter Points"
590 v-model="chapterPoints.value" 590 v-model="chapterPoints.value"
591 type="text" 591 type="text"
592 required 592 required
593 ></v-text-field> 593 ></v-text-field>
594 </v-flex> 594 </v-flex>
595 <v-flex xs2 class="pt-4"> 595 <v-flex xs2 class="pt-4">
596 <v-icon @click="deleteFind(index)" v-if="index !=0 ">cancel</v-icon> 596 <v-icon @click="deleteFind(index)" v-if="index !=0 ">cancel</v-icon>
597 <v-icon @click="addFind">add_circle</v-icon> 597 <v-icon @click="addFind">add_circle</v-icon>
598 </v-flex> 598 </v-flex>
599 </v-layout> 599 </v-layout>
600 </div> 600 </div>
601 </v-flex> 601 </v-flex>
602 </v-layout> 602 </v-layout>
603 <v-layout> 603 <v-layout>
604 <v-flex xs12 sm12> 604 <v-flex xs12 sm12>
605 <v-layout class="right"> 605 <v-layout class="right">
606 <v-btn @click="clear" round dark class="clear-button">Clear</v-btn> 606 <v-btn @click="clear" round dark class="clear-button">Clear</v-btn>
607 <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn> 607 <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn>
608 </v-layout> 608 </v-layout>
609 </v-flex> 609 </v-flex>
610 </v-layout> 610 </v-layout>
611 </v-container> 611 </v-container>
612 </v-form> 612 </v-form>
613 </v-card> 613 </v-card>
614 </v-dialog> 614 </v-dialog>
615 <v-snackbar 615 <v-snackbar
616 :timeout="timeout" 616 :timeout="timeout"
617 :top="y === 'top'" 617 :top="y === 'top'"
618 :right="x === 'right'" 618 :right="x === 'right'"
619 :vertical="mode === 'vertical'" 619 :vertical="mode === 'vertical'"
620 v-model="snackbar" 620 v-model="snackbar"
621 :color="color" 621 :color="color"
622 >{{ text }}</v-snackbar> 622 >{{ text }}</v-snackbar>
623 <div class="loader" v-if="showLoader"> 623 <div class="loader" v-if="showLoader">
624 <v-progress-circular indeterminate color="white"></v-progress-circular> 624 <v-progress-circular indeterminate color="white"></v-progress-circular>
625 </div> 625 </div>
626 </v-container> 626 </v-container>
627 </template> 627 </template>
628 628
629 <script> 629 <script>
630 import http from "@/Services/http.js"; 630 import http from "@/Services/http.js";
631 631
632 export default { 632 export default {
633 data: () => ({ 633 data: () => ({
634 snackbar: false, 634 snackbar: false,
635 y: "top", 635 y: "top",
636 x: "right", 636 x: "right",
637 mode: "", 637 mode: "",
638 timeout: 3000, 638 timeout: 3000,
639 text: "", 639 text: "",
640 loading: false, 640 loading: false,
641 color: "", 641 color: "",
642 date: null, 642 date: null,
643 search: "", 643 search: "",
644 show: true, 644 show: true,
645 addCourseDetailDialog: false, 645 addCourseDetailDialog: false,
646 showSearch: false, 646 showSearch: false,
647 showLoader: false, 647 showLoader: false,
648 editCourseDetailDialog: false, 648 editCourseDetailDialog: false,
649 editChapterDetailDialog: false, 649 editChapterDetailDialog: false,
650 viewProfileGallery: false, 650 viewProfileGallery: false,
651 valid: true, 651 valid: true,
652 editLoading: false, 652 editLoading: false,
653 addclass: [], 653 addclass: [],
654 courseData: [], 654 courseData: [],
655 addSection: [], 655 addSection: [],
656 getCourse: {}, 656 getCourse: {},
657 finds: [{ value: "" }], 657 finds: [{ value: "" }],
658 findsChapterPoint: [{ value: "" }], 658 findsChapterPoint: [{ value: "" }],
659 updates: [{ value: "" }], 659 updates: [{ value: "" }],
660 youTubeLink: {}, 660 youTubeLink: {},
661 addCourseDetail: { 661 addCourseDetail: {
662 chapters: [ 662 chapters: [
663 { 663 {
664 chapterName: "", 664 chapterName: "",
665 description: "", 665 description: "",
666 chapterPoints: [] 666 chapterPoints: []
667 } 667 }
668 ] 668 ]
669 }, 669 },
670 chapters: [], 670 chapters: [],
671 pagination: { 671 pagination: {
672 rowsPerPage: 10 672 rowsPerPage: 10
673 }, 673 },
674 editFiles: [], 674 editFiles: [],
675 files: [], 675 files: [],
676 courseData: [], 676 courseData: [],
677 token: "", 677 token: "",
678 courseId: "", 678 courseId: "",
679 clsssRules: [v => !!v || " Class is required"], 679 clsssRules: [v => !!v || " Class is required"],
680 courseRules: [v => !!v || " Course is required"], 680 courseRules: [v => !!v || " Course is required"],
681 chapterNameRules: [v => !!v || " Tilte is required"], 681 chapterNameRules: [v => !!v || " Tilte is required"],
682 descriptionRules: [v => !!v || " Description is required"], 682 descriptionRules: [v => !!v || " Description is required"],
683 headers: [ 683 headers: [
684 { 684 {
685 align: "", 685 align: "",
686 text: "No", 686 text: "No",
687 sortable: false, 687 sortable: false,
688 value: "index" 688 value: "index"
689 }, 689 },
690 { 690 {
691 text: "Class Name", 691 text: "Class Name",
692 value: "classNum", 692 value: "classNum",
693 sortable: false, 693 sortable: false,
694 align: "center" 694 align: "center"
695 }, 695 },
696 { 696 {
697 text: "Course Name", 697 text: "Course Name",
698 value: "courseName", 698 value: "courseName",
699 sortable: false, 699 sortable: false,
700 align: "center" 700 align: "center"
701 }, 701 },
702 { text: "Action", value: "", sortable: false, align: "center" } 702 { text: "Action", value: "", sortable: false, align: "center" }
703 ], 703 ],
704 CourseDetailsList: [], 704 CourseDetailsList: [],
705 editedIndex: -1, 705 editedIndex: -1,
706 editedItem: {}, 706 editedItem: {},
707 editedCourse: {}, 707 editedCourse: {},
708 editChapter: {}, 708 editChapter: {},
709 index: "", 709 index: "",
710 addChapterItem: {}, 710 addChapterItem: {},
711 addChapterItemObj: {},
711 addChapterDialog: false 712 addChapterDialog: false
712 }), 713 }),
713 methods: { 714 methods: {
714 getCourses(classId) { 715 getCourses(classId) {
715 this.showLoader = true; 716 this.showLoader = true;
716 http() 717 http()
717 .get("/getCourseesList", { 718 .get("/getCourseesList", {
718 params: { 719 params: {
719 classId: classId 720 classId: classId
720 } 721 }
721 }) 722 })
722 .then(response => { 723 .then(response => {
723 this.editChapter.courseId = ""; 724 this.editChapter.courseId = "";
724 this.courseData = response.data.data; 725 this.courseData = response.data.data;
725 console.log("this.courseData", this.courseData); 726 // console.log("this.courseData", this.courseData);
726 this.showLoader = false; 727 this.showLoader = false;
727 }) 728 })
728 .catch(err => { 729 .catch(err => {
729 console.log("err====>", err); 730 console.log("err====>", err);
730 this.showLoader = false; 731 this.showLoader = false;
731 }); 732 });
732 }, 733 },
733 getCourseDetailsList() { 734 getCourseDetailsList() {
734 this.showLoader = true; 735 this.showLoader = true;
735 http() 736 http()
736 .get("/getParticularCourseDetail", { 737 .get("/getParticularCourseDetail", {
737 params: { 738 params: {
738 courseId: this.getCourse.courseId 739 courseId: this.getCourse.courseId
739 } 740 }
740 }) 741 })
741 .then(response => { 742 .then(response => {
742 this.CourseDetailsList = response.data.data; 743 this.CourseDetailsList = response.data.data;
743 this.chapters = response.data.data[0].chapters; 744 if (response.data.data[0]) {
745 this.chapters = response.data.data[0].chapters;
746 }
744 // console.log("response.data.data", this.CourseDetailsList); 747 // console.log("response.data.data", this.CourseDetailsList);
745 this.showLoader = false; 748 this.showLoader = false;
746 }) 749 })
747 .catch(error => { 750 .catch(error => {
748 // console.log("err====>", err); 751 // console.log("err====>", err);
749 this.showLoader = false; 752 this.showLoader = false;
750 if (error.response.status === 401) { 753 if (error.response.status === 401) {
751 this.$router.replace({ path: "/" }); 754 this.$router.replace({ path: "/" });
752 this.$store.dispatch("setToken", null); 755 this.$store.dispatch("setToken", null);
753 this.$store.dispatch("Id", null); 756 this.$store.dispatch("Id", null);
754 } 757 }
755 }); 758 });
756 }, 759 },
757 courseTableRow(id) { 760 courseTableRow(id) {
758 // console.log("click7", id); 761 // console.log("click7", id);
759 this.courseId = id; 762 this.courseId = id;
760 }, 763 },
761 addChapters(item) { 764 addChapters(item) {
762 this.files = [];
763 this.editedIndex = this.CourseDetailsList.indexOf(item); 765 this.editedIndex = this.CourseDetailsList.indexOf(item);
764 let addChapterItem = Object.assign({}, item); 766 this.addChapterItemObj = Object.assign({}, item);
765 this.addChapterItem.courseDetailId = addChapterItem._id; 767 this.addChapterItem.courseDetailId = this.addChapterItemObj._id;
766 this.addChapterDialog = true; 768 this.addChapterDialog = true;
767 console.log("this.addChapterItem", this.addChapterItem);
768 }, 769 },
769 submitChapter() { 770 submitChapter() {
770 this.addChapterItem.chapterPoints = []; 771 this.addChapterItem.chapterPoints = [];
771 for (let i = 0; i < this.findsChapterPoint.length; i++) { 772 for (let i = 0; i < this.findsChapterPoint.length; i++) {
772 this.addChapterItem.chapterPoints.push(this.findsChapterPoint[i].value); 773 this.addChapterItem.chapterPoints.push(this.findsChapterPoint[i].value);
773 } 774 }
774 // console.log("this.addChapterItem", this.addChapterItem); 775 // console.log("this.addChapterItem", this.addChapterItem);
775 this.loading = true; 776 this.loading = true;
776 http() 777 http()
777 .put("/addChapters", this.addChapterItem) 778 .put("/addChapters", this.addChapterItem)
778 .then(response => { 779 .then(response => {
779 this.addChapterDialog = false; 780 this.addChapterDialog = false;
780 this.loading = false; 781 this.loading = false;
781 this.snackbar = true; 782 this.snackbar = true;
782 this.text = response.data.message; 783 this.text = response.data.message;
783 this.color = "green"; 784 this.color = "green";
785 this.addChapterItem = {};
786 this.removeChapterPoint();
784 this.getCourseDetailsList(); 787 this.getCourseDetailsList();
785 this.clear();
786 this.findsChapterPoint = "";
787 }) 788 })
788 .catch(error => { 789 .catch(error => {
789 this.snackbar = true; 790 this.snackbar = true;
790 this.text = error.response.data.message; 791 this.text = error.response.data.message;
791 this.color = "error"; 792 this.color = "error";
792 this.loading = false; 793 this.loading = false;
793 }); 794 });
794 }, 795 },
795 profile(item) { 796 profile(item) {
796 this.editedIndex = this.chapters.indexOf(item); 797 this.editedIndex = this.chapters.indexOf(item);
797 this.editedItem = Object.assign({}, item); 798 this.editedItem = Object.assign({}, item);
798 this.viewProfileGallery = true; 799 this.viewProfileGallery = true;
799 }, 800 },
800 editItem(item) { 801 editItem(item) {
801 this.editedIndex = this.CourseDetailsList.indexOf(item); 802 this.editedIndex = this.CourseDetailsList.indexOf(item);
802 this.editedCourse = Object.assign({}, item); 803 this.editedCourse = Object.assign({}, item);
803 console.log("this.editChapter", this.editedCourse);
804 this.editCourseDetailDialog = true; 804 this.editCourseDetailDialog = true;
805 }, 805 },
806 editChapterItem(item) { 806 editChapterItem(item) {
807 this.editedIndex = this.chapters.indexOf(item); 807 this.editedIndex = this.chapters.indexOf(item);
808 this.editChapter = Object.assign({}, item); 808 this.editChapter = Object.assign({}, item);
809 // console.log("this.editChapter", this.editChapter);
810 this.editChapterDetailDialog = true; 809 this.editChapterDetailDialog = true;
811 }, 810 },
812 deleteItem(item) { 811 deleteItem(item) {
813 let deleteGallery = { 812 let deleteGallery = {
814 courseDetailId: item._id 813 courseDetailId: item._id
815 }; 814 };
816 http() 815 http()
817 .delete( 816 .delete(
818 "/deleteCourseDetail", 817 "/deleteCourseDetail",
819 confirm("Are you sure you want to delete this?") && { 818 confirm("Are you sure you want to delete this?") && {
820 params: deleteGallery, 819 params: deleteGallery,
821 headers: { 820 headers: {
822 Authorization: "Bearer " + this.token 821 Authorization: "Bearer " + this.token
823 } 822 }
824 } 823 }
825 ) 824 )
826 .then(response => { 825 .then(response => {
827 this.snackbar = true; 826 this.snackbar = true;
828 this.text = "Successfully delete Course Details"; 827 this.text = "Successfully delete Course Details";
829 this.color = "green"; 828 this.color = "green";
830 this.getCourseDetailsList(); 829 this.getCourseDetailsList();
831 }) 830 })
832 .catch(error => { 831 .catch(error => {
833 // console.log(error); 832 // console.log(error);
834 this.snackbar = true; 833 this.snackbar = true;
835 this.text = error.response.data.message; 834 this.text = error.response.data.message;
836 this.color = "error"; 835 this.color = "error";
837 }); 836 });
838 }, 837 },
839 deleteChapters(item) { 838 deleteChapters(item) {
840 // console.log("item", item); 839 // console.log("item", item);
841 let deleteChapters = { 840 let deleteChapters = {
842 courseDetailId: this.courseId, 841 courseDetailId: this.courseId,
843 chapterId: item._id 842 chapterId: item._id
844 }; 843 };
845 http() 844 http()
846 .put( 845 .put(
847 "/deleteChapters", 846 "/deleteChapters",
848 confirm("Are you sure you want to delete this?") && deleteChapters 847 confirm("Are you sure you want to delete this?") && deleteChapters
849 ) 848 )
850 .then(response => { 849 .then(response => {
851 this.snackbar = true; 850 this.snackbar = true;
852 this.text = "Successfully delete Chapters"; 851 this.text = "Successfully delete Chapters";
853 this.color = "green"; 852 this.color = "green";
854 this.getCourseDetailsList(); 853 this.getCourseDetailsList();
855 }) 854 })
856 .catch(error => { 855 .catch(error => {
857 // console.log(error); 856 // console.log(error);
858 this.snackbar = true; 857 this.snackbar = true;
859 this.text = error.response.data.message; 858 this.text = error.response.data.message;
860 this.color = "error"; 859 this.color = "error";
861 }); 860 });
862 }, 861 },
863 close() { 862 close() {
864 this.editCourseDetailDialog = false; 863 this.editCourseDetailDialog = false;
865 }, 864 },
866 closeProfileGallery() { 865 closeProfileGallery() {
867 this.viewProfileGallery = false; 866 this.viewProfileGallery = false;
868 }, 867 },
869 submit() { 868 submit() {
870 let chapters = []; 869 let chapters = [];
871 var chapterPoints = []; 870 var chapterPoints = [];
872 for (let i = 0; i < this.finds.length; i++) { 871 for (let i = 0; i < this.finds.length; i++) {
873 chapterPoints.push(this.finds[i].value); 872 chapterPoints.push(this.finds[i].value);
874 // console.log("this.finds[i].value", this.finds[i].value); 873 // console.log("this.finds[i].value", this.finds[i].value);
875 chapters = [ 874 chapters = [
876 { 875 {
877 chapterName: this.addCourseDetail.chapterName, 876 chapterName: this.addCourseDetail.chapterName,
878 description: this.addCourseDetail.description, 877 description: this.addCourseDetail.description,
879 chapterPoints: chapterPoints 878 chapterPoints: chapterPoints
880 } 879 }
881 ]; 880 ];
882 } 881 }
883 if (this.$refs.form.validate()) { 882 if (this.$refs.form.validate()) {
884 // console.log("this.addCourseDetail", this.addCourseDetail); 883 // console.log("this.addCourseDetail", this.addCourseDetail);
885 var courseDetailsData = { 884 var courseDetailsData = {
886 classId: this.addCourseDetail.classId, 885 classId: this.addCourseDetail.classId,
887 courseId: this.addCourseDetail.courseId, 886 courseId: this.addCourseDetail.courseId,
888 chapters: chapters 887 chapters: chapters
889 }; 888 };
890 this.loading = true; 889 this.loading = true;
891 http() 890 http()
892 .post("/createCourseDetail", courseDetailsData) 891 .post("/createCourseDetail", courseDetailsData)
893 .then(response => { 892 .then(response => {
894 this.addCourseDetailDialog = false; 893 this.addCourseDetailDialog = false;
895 this.loading = false; 894 this.loading = false;
896 this.snackbar = true; 895 this.snackbar = true;
897 this.text = response.data.message; 896 this.text = response.data.message;
898 this.color = "green"; 897 this.color = "green";
899 this.clear(); 898 this.clear();
900 this.files = ""; 899 this.removeAddFind();
901 }) 900 })
902 .catch(error => { 901 .catch(error => {
903 this.snackbar = true; 902 this.snackbar = true;
904 this.text = error.response.data.message; 903 this.text = error.response.data.message;
905 this.color = "error"; 904 this.color = "error";
906 this.loading = false; 905 this.loading = false;
907 }); 906 });
908 } 907 }
909 }, 908 },
910 clear() { 909 clear() {
911 this.$refs.form.reset(); 910 this.$refs.form.reset();
912 this.files = [];
913 }, 911 },
914 saveChapter() { 912 saveChapter() {
915 this.editedItem.courseDetailId = this.editedItem._id; 913 this.editedItem.courseDetailId = this.editedItem._id;
914 console.log("this.updates", this.updates);
916 for (let i = 0; i < this.updates.length; i++) { 915 for (let i = 0; i < this.updates.length; i++) {
917 this.editChapter.chapterPoints.push(this.updates[i].value); 916 if (this.updates[i].value != "") {
917 var chapterPoints = [];
918 chapterPoints.push(this.updates[i].value);
919 } else {
920 chapterPoints = this.editChapter.chapterPoints;
921 }
918 } 922 }
919 var updateData = { 923 var updateData = {
920 courseDetailId: this.courseId, 924 courseDetailId: this.courseId,
921 chapterId: this.editChapter._id, 925 chapterId: this.editChapter._id,
922 chapterName: this.editChapter.chapterName, 926 chapterName: this.editChapter.chapterName,
923 description: this.editChapter.description, 927 description: this.editChapter.description,
924 chapterPoints: this.editChapter.chapterPoints 928 chapterPoints: chapterPoints
925 }; 929 };
926 this.editLoading = true; 930 this.editLoading = true;
927 http() 931 http()
928 .put("/updateChapters", updateData) 932 .put("/updateChapters", updateData)
929 .then(response => { 933 .then(response => {
930 this.getCourseDetailsList(); 934 this.editChapterDetailDialog = false;
931 this.close();
932 this.snackbar = true; 935 this.snackbar = true;
933 this.text = response.data.message; 936 this.text = response.data.message;
934 this.color = "green"; 937 this.color = "green";
935 this.editLoading = false; 938 this.editLoading = false;
936 // this.editChapterPointName = ""; 939 this.removeUpdatePoints();
937 this.editFiles = []; 940 this.getCourseDetailsList();
938 }) 941 })
939 .catch(error => { 942 .catch(error => {
940 this.editLoading = false; 943 this.editLoading = false;
941 this.snackbar = true; 944 this.snackbar = true;
942 this.text = error.response.data.message; 945 this.text = error.response.data.message;
943 this.color = "error"; 946 this.color = "error";
944 }); 947 });
945 }, 948 },
946 save() { 949 save() {
947 // console.log("utykgigiu", this.editedCourse); 950 // console.log("utykgigiu", this.editedCourse);
948 var updateData = { 951 var updateData = {
949 courseDetailId: this.editedCourse._id, 952 courseDetailId: this.editedCourse._id,
950 courseId: this.editedCourse.courseId, 953 courseId: this.editedCourse.courseId,
951 classId: this.editedCourse.classId 954 classId: this.editedCourse.classId
952 }; 955 };
953 this.editLoading = true; 956 this.editLoading = true;
954 http() 957 http()
955 .put("/updateCourseDetail", updateData) 958 .put("/updateCourseDetail", updateData)
956 .then(response => { 959 .then(response => {
957 this.getCourseDetailsList(); 960 this.getCourseDetailsList();
958 this.editCourseDetailDialog = false; 961 this.editCourseDetailDialog = false;
959 this.snackbar = true; 962 this.snackbar = true;
960 this.text = response.data.message; 963 this.text = response.data.message;
961 this.color = "green"; 964 this.color = "green";
962 this.editLoading = false; 965 this.editLoading = false;
963 // this.editChapterPointName = ""; 966 // this.editChapterPointName = "";
964 this.editFiles = []; 967 this.editFiles = [];
965 }) 968 })
966 .catch(error => { 969 .catch(error => {
967 this.editLoading = false; 970 this.editLoading = false;
968 this.snackbar = true; 971 this.snackbar = true;
969 this.text = error.response.data.message; 972 this.text = error.response.data.message;
970 this.color = "error"; 973 this.color = "error";
971 }); 974 });
972 }, 975 },
973 getAllClasses() { 976 getAllClasses() {
974 http() 977 http()
975 .get("/getClassesList", { 978 .get("/getClassesList", {
976 headers: { Authorization: "Bearer " + this.token } 979 headers: { Authorization: "Bearer " + this.token }
977 }) 980 })
978 .then(response => { 981 .then(response => {
979 this.addclass = response.data.data; 982 this.addclass = response.data.data;
980 }) 983 })
981 .catch(err => { 984 .catch(err => {
982 // console.log("err====>", err); 985 // console.log("err====>", err);
983 }); 986 });
984 }, 987 },
985 removeChapterPoint: function() { 988 removeChapterPoint: function() {
986 this.findsChapterPoint = [{ value: "" }]; 989 this.findsChapterPoint = [{ value: "" }];
987 }, 990 },
988 removeAddFind: function() { 991 removeAddFind: function() {
989 this.finds = [{ value: "" }]; 992 this.finds = [{ value: "" }];
990 }, 993 },
991 addFind: function() { 994 addFind: function() {
992 this.finds.push({ value: "" }); 995 this.finds.push({ value: "" });
993 }, 996 },
994 addChapterPoint: function() { 997 addChapterPoint: function() {
995 this.findsChapterPoint.push({ value: "" }); 998 this.findsChapterPoint.push({ value: "" });
999 console.log("this.findsChapterPoint", this.findsChapterPoint);
996 }, 1000 },
997 update: function() { 1001 update: function() {
998 console.log("click");
999 this.updates.push({ value: "" }); 1002 this.updates.push({ value: "" });
1000 }, 1003 },
1004 removeUpdatePoints: function() {
1005 this.updates = [{ value: "" }];
1006 },
1001 deleteFind: function(index) { 1007 deleteFind: function(index) {
1002 this.finds.splice(index, 1); 1008 this.finds.splice(index, 1);
1003 if (index === 0) this.addFind(); 1009 if (index === 0) this.addFind();
1004 }, 1010 },
1005 deleteChapterPoint: function(index) { 1011 deleteChapterPoint: function(index) {
1006 this.findsChapterPoint.splice(index, 1); 1012 this.findsChapterPoint.splice(index, 1);
1007 if (index === 0) this.addChapterPoint(); 1013 if (index === 0) this.addChapterPoint();
1008 }, 1014 },
1009 deleteUpdate: function(index) { 1015 deleteUpdate: function(index) {
1010 this.updates.splice(index, 1); 1016 this.updates.splice(index, 1);
1011 if (index === 0) this.update(); 1017 if (index === 0) this.update();
1012 }, 1018 },
1013 deleteUrl: function(index, youTubelinkId, id) { 1019 deleteUrl: function(index, youTubelinkId, id) {
1014 this.editChapter.chapterPoints.splice(index, 1); 1020 this.editChapter.chapterPoints.splice(index, 1);
1015 if (index === 0) this.update(); 1021 if (index === 0) this.update();
1016 }, 1022 },
1017 displaySearch() { 1023 displaySearch() {
1018 this.show = false; 1024 this.show = false;
1019 this.showSearch = true; 1025 this.showSearch = true;
1020 }, 1026 },
1021 closeSearch() { 1027 closeSearch() {
1022 this.showSearch = false; 1028 this.showSearch = false;
1023 this.show = true; 1029 this.show = true;