Commit c3a54d5c1eea5555ada2caa56742cee21e5417e9

Authored by Neeraj Sharma
1 parent 7d2cd24624

fixed bugs

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