Blame view

src/pages/Course/courseDetail.vue 44.5 KB
11d037abe   Neeraj Sharma   commit code
1
2
  <template>
    <v-container fluid class="body-color">
6c8f4ba9a   Neeraj Sharma   commit course all...
3
      <!-- ****** Edit Chapter detail  ****** -->
db965de89   Amber Dev   added dialog pers...
4
      <v-dialog v-model="editCourseDetailDialog" max-width="1000px" scrollable persistent>
11d037abe   Neeraj Sharma   commit code
5
6
7
        <v-card class="card-style pa-2" dark>
          <v-layout>
            <v-flex xs12>
6c8f4ba9a   Neeraj Sharma   commit course all...
8
              <label class="title text-xs-center">Edit Chapter</label>
11d037abe   Neeraj Sharma   commit code
9
10
11
12
13
14
15
16
              <v-icon size="24" class="right" @click="editCourseDetailDialog = false">cancel</v-icon>
            </v-flex>
          </v-layout>
          <v-card-text>
            <v-layout wrap>
              <v-flex xs12 sm12>
                <v-layout>
                  <v-flex xs4 class="pt-4 subheading">
6c8f4ba9a   Neeraj Sharma   commit course all...
17
18
19
20
21
22
23
24
25
26
27
                    <label class="right">Select Class:</label>
                  </v-flex>
                  <v-flex xs8 sm6 class="ml-3">
                    <v-select
                      small
                      :items="addclass"
                      label="Select Class"
                      v-model="editedCourse.classId"
                      item-text="classNum"
                      item-value="_id"
                      name="Select Class"
6ef520020   Neeraj Sharma   implement all fun...
28
                      @change="getCourses(editedCourse.classId)"
6c8f4ba9a   Neeraj Sharma   commit course all...
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
                      class="mr-2"
                      required
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
              <v-flex xs12 sm12>
                <v-layout>
                  <v-flex xs4 class="pt-4 subheading">
                    <label class="right">Select Course:</label>
                  </v-flex>
                  <v-flex xs8 sm6 class="ml-3">
                    <v-select
                      :items="courseData"
                      label="Select Course"
                      v-model="editedCourse.courseId"
0a5256600   Amber Dev   added events
45
                      item-text="courseName"
6c8f4ba9a   Neeraj Sharma   commit course all...
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
                      item-value="_id"
                      required
                      class="ml-2"
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
            </v-layout>
            <v-layout>
              <v-flex xs12 sm12 md11 lg11>
                <v-card-actions class="hidden-xs-only hidden-sm-only">
                  <v-spacer></v-spacer>
                  <v-btn round dark @click="save" :loading="editLoading" class="add-button mr-4">Save</v-btn>
                </v-card-actions>
                <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only">
                  <v-spacer></v-spacer>
                  <v-btn round dark @click="save" :loading="editLoading" class="add-button">Save</v-btn>
                  <v-spacer></v-spacer>
                </v-card-actions>
              </v-flex>
            </v-layout>
          </v-card-text>
        </v-card>
      </v-dialog>
de958fcfc   Amber Dev   added upload pdf
70
      <!-- DIALOG BOX -  EDIT CHAPTER-->
db965de89   Amber Dev   added dialog pers...
71
      <v-dialog v-model="editChapterDetailDialog" max-width="1000px" scrollable persistent>
6c8f4ba9a   Neeraj Sharma   commit course all...
72
73
74
75
        <v-card class="card-style pa-2" dark>
          <v-layout>
            <v-flex xs12>
              <label class="title text-xs-center">Edit Chapter</label>
de958fcfc   Amber Dev   added upload pdf
76
77
78
79
80
              <v-icon
                size="24"
                class="right"
                @click="editChapterDetailDialog = false; trigger = 'reset'; emptyPdf = 'reset' "
              >cancel</v-icon>
6c8f4ba9a   Neeraj Sharma   commit course all...
81
82
83
84
            </v-flex>
          </v-layout>
          <v-card-text>
            <v-layout wrap>
8fe241323   Amber Dev   added course comp...
85
              <!-- CHAPTER NAME -->
6c8f4ba9a   Neeraj Sharma   commit course all...
86
87
88
              <v-flex xs12 sm12>
                <v-layout>
                  <v-flex xs4 class="pt-4 subheading">
11d037abe   Neeraj Sharma   commit code
89
90
91
92
93
94
95
96
97
98
99
100
                    <label class="right">Chapter Name:</label>
                  </v-flex>
                  <v-flex xs8 sm6 class="ml-3">
                    <v-text-field
                      v-model="editChapter.chapterName"
                      placeholder="fill your Title"
                      type="text"
                      required
                    ></v-text-field>
                  </v-flex>
                </v-layout>
              </v-flex>
8fe241323   Amber Dev   added course comp...
101
              <!-- DESCRIPTION -->
11d037abe   Neeraj Sharma   commit code
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
              <v-flex xs12 sm12>
                <v-layout>
                  <v-flex xs4 class="pt-4 subheading">
                    <label class="right">Description:</label>
                  </v-flex>
                  <v-flex xs8 sm6 class="ml-3">
                    <v-text-field
                      placeholder="fill your Description"
                      v-model="editChapter.description"
                      type="text"
                      required
                    ></v-text-field>
                  </v-flex>
                </v-layout>
              </v-flex>
8fe241323   Amber Dev   added course comp...
117
              <!-- UPLOAD PPT -->
39a6d21a0   Shikha Mishra   improve add stude...
118
              <!-- <v-flex xs12>
8fe241323   Amber Dev   added course comp...
119
120
121
122
123
124
125
126
                <v-layout>
                  <v-flex xs4 class="pt-4 subheading">
                    <label class="right">Upload PPT:</label>
                  </v-flex>
                  <v-flex xs8 sm6 class="ml-3">
                    <UploadFiles
                      @fileSelected="fileSelected($event,'uploadPPT')"
                      label="Add PPT"
de958fcfc   Amber Dev   added upload pdf
127
128
129
                      reference="EditPpt"
                      id="editPptInput"
                      :trigger="trigger"
8fe241323   Amber Dev   added course comp...
130
131
132
                    ></UploadFiles>
                  </v-flex>
                </v-layout>
39a6d21a0   Shikha Mishra   improve add stude...
133
              </v-flex>-->
8fe241323   Amber Dev   added course comp...
134
135
136
137
138
139
140
              <!-- UPLOAD PDF -->
              <v-flex xs12>
                <v-layout>
                  <v-flex xs4 class="pt-4 subheading">
                    <label class="right">Upload PDF:</label>
                  </v-flex>
                  <v-flex xs8 sm6 class="ml-3">
de958fcfc   Amber Dev   added upload pdf
141
                    <UploadPdf
c3af2406b   Shikha Mishra   document section ...
142
                      @pdfFileSelected="pdfFileSelected($event,'uploadPDF')"
8fe241323   Amber Dev   added course comp...
143
                      label="Add PDF"
de958fcfc   Amber Dev   added upload pdf
144
145
                      reference="editPdf"
                      id="editPdfInput"
34a2a2609   Amber Dev   added upload file...
146
                      :emptyPdf="emptyPdf"
de958fcfc   Amber Dev   added upload pdf
147
                    ></UploadPdf>
8fe241323   Amber Dev   added course comp...
148
149
150
                  </v-flex>
                </v-layout>
              </v-flex>
11d037abe   Neeraj Sharma   commit code
151
            </v-layout>
c3a54d5c1   Neeraj Sharma   fixed bugs
152
            <!-- <v-flex xs12 v-if="editChapter.chapterPoints.length != 0">
11d037abe   Neeraj Sharma   commit code
153
154
155
156
157
158
159
160
161
162
163
164
165
166
              <v-layout
                wrap
                v-for="(editChapterPoint,index) in editChapter.chapterPoints"
                :key="index"
              >
                <v-flex xs12 sm12 md4 class="pt-4 subheading">
                  <label class="right hidden-xs-only hidden-sm-only">Chapter Points:</label>
                  <label class="hidden-md-only hidden-lg-only hidden-xl-only">Chapter Points:</label>
                </v-flex>
                <v-layout>
                  <v-flex xs10 sm10 sm5 md9 class="ml-3">
                    <v-text-field :value="editChapterPoint" type="text" required></v-text-field>
                  </v-flex>
                  <v-flex xs2 class="pt-4">
6c8f4ba9a   Neeraj Sharma   commit course all...
167
                    <v-icon @click="deleteUrl(index)">cancel</v-icon>
11d037abe   Neeraj Sharma   commit code
168
169
170
                  </v-flex>
                </v-layout>
              </v-layout>
c3a54d5c1   Neeraj Sharma   fixed bugs
171
            </v-flex>-->
6c8f4ba9a   Neeraj Sharma   commit course all...
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
            <v-flex xs12>
              <div v-for="(updateImage,index) in updates" :key="index">
                <v-layout wrap>
                  <v-flex xs12 sm12 md4 class="pt-4 subheading">
                    <label class="right hidden-xs-only hidden-sm-only">Chapter Points:</label>
                    <label class="hidden-md-only hidden-lg-only hidden-xl-only">Chapter Points:</label>
                  </v-flex>
                  <v-layout>
                    <v-flex xs10 sm12 md9 class="ml-3">
                      <v-text-field
                        v-model="updateImage.value"
                        placeholder="Upload new Chapter Points"
                        required
                      ></v-text-field>
                    </v-flex>
                    <v-flex xs2 class="pt-4">
                      <v-icon @click="deleteUpdate(index)" v-if="index !=0">cancel</v-icon>
                      <v-icon @click="update">add_circle</v-icon>
                    </v-flex>
                  </v-layout>
                </v-layout>
              </div>
            </v-flex>
11d037abe   Neeraj Sharma   commit code
195
196
197
198
            <v-layout>
              <v-flex xs12 sm12 md11 lg11>
                <v-card-actions class="hidden-xs-only hidden-sm-only">
                  <v-spacer></v-spacer>
6c8f4ba9a   Neeraj Sharma   commit course all...
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
                  <v-btn
                    round
                    dark
                    @click="saveChapter"
                    :loading="editLoading"
                    class="add-button mr-4"
                  >Save</v-btn>
                </v-card-actions>
                <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only">
                  <v-spacer></v-spacer>
                  <v-btn
                    round
                    dark
                    @click="saveChapter"
                    :loading="editLoading"
                    class="add-button"
                  >Save</v-btn>
                  <v-spacer></v-spacer>
                </v-card-actions>
              </v-flex>
            </v-layout>
          </v-card-text>
        </v-card>
      </v-dialog>
de958fcfc   Amber Dev   added upload pdf
223
      <!-- ADD NEW CHAPTER-->
db965de89   Amber Dev   added dialog pers...
224
      <v-dialog v-model="addChapterDialog" max-width="1000px" scrollable persistent>
6c8f4ba9a   Neeraj Sharma   commit course all...
225
226
227
228
        <v-card class="card-style pa-2" dark>
          <v-layout>
            <v-flex xs12>
              <label class="title text-xs-center">Add Chapter Detail</label>
de958fcfc   Amber Dev   added upload pdf
229
230
231
232
233
              <v-icon
                size="24"
                class="right"
                @click="addChapterDialog = false;  trigger = 'reset'; emptyPdf = 'reset' "
              >cancel</v-icon>
6c8f4ba9a   Neeraj Sharma   commit course all...
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
            </v-flex>
          </v-layout>
          <v-card-text>
            <v-layout wrap>
              <v-flex xs12 sm12>
                <v-layout>
                  <v-flex xs4 class="pt-4 subheading">
                    <label class="right">Chapter Name:</label>
                  </v-flex>
                  <v-flex xs8 sm6 class="ml-3">
                    <v-text-field
                      v-model="addChapterItem.chapterName"
                      placeholder="fill your Title"
                      type="text"
                      required
                    ></v-text-field>
                  </v-flex>
                </v-layout>
              </v-flex>
              <v-flex xs12 sm12>
                <v-layout>
                  <v-flex xs4 class="pt-4 subheading">
                    <label class="right">Description:</label>
                  </v-flex>
                  <v-flex xs8 sm6 class="ml-3">
                    <v-text-field
                      placeholder="fill your Description"
                      v-model="addChapterItem.description"
                      type="text"
                      required
                    ></v-text-field>
                  </v-flex>
                </v-layout>
              </v-flex>
8fe241323   Amber Dev   added course comp...
268
              <!-- UPLOAD PPT -->
39a6d21a0   Shikha Mishra   improve add stude...
269
              <!-- <v-flex xs12>
8fe241323   Amber Dev   added course comp...
270
271
272
273
274
275
276
277
                <v-layout>
                  <v-flex xs4 class="pt-4 subheading">
                    <label class="right">Upload PPT:</label>
                  </v-flex>
                  <v-flex xs8 sm6 class="ml-3">
                    <UploadFiles
                      @fileSelected="fileSelected($event,'uploadPPT')"
                      label="Add PPT"
de958fcfc   Amber Dev   added upload pdf
278
279
280
                      reference="newChapterPpt"
                      id="newChapterPptInput"
                      :trigger="trigger"
8fe241323   Amber Dev   added course comp...
281
282
283
                    ></UploadFiles>
                  </v-flex>
                </v-layout>
39a6d21a0   Shikha Mishra   improve add stude...
284
              </v-flex>-->
8fe241323   Amber Dev   added course comp...
285
286
287
288
289
290
291
              <!-- UPLOAD PDF -->
              <v-flex xs12>
                <v-layout>
                  <v-flex xs4 class="pt-4 subheading">
                    <label class="right">Upload PDF:</label>
                  </v-flex>
                  <v-flex xs8 sm6 class="ml-3">
de958fcfc   Amber Dev   added upload pdf
292
                    <UploadPdf
c3af2406b   Shikha Mishra   document section ...
293
                      @pdfFileSelected="pdfFileSelected($event,'uploadPDF')"
8fe241323   Amber Dev   added course comp...
294
                      label="Add PDF"
de958fcfc   Amber Dev   added upload pdf
295
296
                      reference="newChapterPdf"
                      id="newChapterPdfInput"
34a2a2609   Amber Dev   added upload file...
297
                      :emptyPdf="emptyPdf"
de958fcfc   Amber Dev   added upload pdf
298
                    ></UploadPdf>
8fe241323   Amber Dev   added course comp...
299
300
301
                  </v-flex>
                </v-layout>
              </v-flex>
6c8f4ba9a   Neeraj Sharma   commit course all...
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
            </v-layout>
            <v-flex xs12>
              <div v-for="(chapterPoints,index) in findsChapterPoint" :key="index">
                <v-layout>
                  <v-flex xs4 class="pt-4 subheading">
                    <label class="right">Chapter Points:</label>
                  </v-flex>
                  <v-flex xs8 sm8 md6 class="ml-3">
                    <v-text-field
                      placeholder="fill your Chapter Points"
                      v-model="chapterPoints.value"
                      type="text"
                      name="link"
                      required
                    ></v-text-field>
                  </v-flex>
                  <v-flex xs2 class="pt-4">
                    <v-icon @click="deleteChapterPoint(index)" v-if="index !=0 ">cancel</v-icon>
                    <v-icon @click="addChapterPoint()">add_circle</v-icon>
                  </v-flex>
                </v-layout>
              </div>
            </v-flex>
            <v-layout>
              <v-flex xs12 sm12 md11 lg11>
                <v-card-actions class="hidden-xs-only hidden-sm-only">
                  <v-spacer></v-spacer>
                  <v-btn
                    round
                    dark
                    @click="submitChapter"
                    :loading="editLoading"
                    class="add-button mr-4"
                  >Submit</v-btn>
11d037abe   Neeraj Sharma   commit code
336
337
338
339
340
341
342
343
344
345
346
347
348
                </v-card-actions>
                <v-card-actions class="hidden-md-only hidden-lg-only hidden-xl-only">
                  <v-spacer></v-spacer>
                  <v-btn round dark @click="save" :loading="editLoading" class="add-button">Save</v-btn>
                  <v-spacer></v-spacer>
                </v-card-actions>
              </v-flex>
            </v-layout>
          </v-card-text>
        </v-card>
      </v-dialog>
  
      <!-- ****** PROFILE Gallery ******  -->
db965de89   Amber Dev   added dialog pers...
349
      <v-dialog v-model="viewProfileGallery" max-width="1000" scrollable persistent>
11d037abe   Neeraj Sharma   commit code
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
        <v-card flat class="card-style pa-3" dark>
          <v-layout>
            <v-flex xs12>
              <label class="title text-xs-center">View Course Detail</label>
              <v-icon size="24" class="right" @click="closeProfileGallery">cancel</v-icon>
            </v-flex>
          </v-layout>
          <v-card-text>
            <v-container grid-list-md>
              <v-layout wrap>
                <v-flex xs12>
                  <v-layout>
                    <v-flex xs4 sm6>
                      <h5 class="right my-1">
                        <b>Chapter Name:</b>
                      </h5>
                    </v-flex>
                    <v-flex sm6 xs8>
                      <h5 class="my-1">{{ editedItem.chapterName }}</h5>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs4 sm6>
                      <h5 class="right my-1">
                        <b>Description:</b>
                      </h5>
                    </v-flex>
                    <v-flex sm6 xs8>
                      <h5 class="my-1">{{ editedItem.description }}</h5>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs5 sm6>
                      <h5 class="right my-1">
cb844617e   Shikha Mishra   Added functionali...
384
                        <b>Chapter Points:</b>
11d037abe   Neeraj Sharma   commit code
385
386
387
388
389
390
391
392
393
394
                      </h5>
                    </v-flex>
                    <v-flex sm6 xs8>
                      <h5 class="my-1">
                        <ul v-for="chapterPoint in editedItem.chapterPoints" :key="chapterPoint">
                          <li>{{ chapterPoint}}</li>
                        </ul>
                      </h5>
                    </v-flex>
                  </v-layout>
eeb8db603   Amber Dev   added pdf link in...
395
                  <!-- LINK TO PDF -->
af6c7b97a   Shikha Mishra   add document sect...
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
                  <!-- <v-layout row justify-center v-show="editedItem.pdfFileUrl != ''">
                    <v-flex xs6>
                      <div style="width: 100%;">
                        <a
                          :href="editedItem.pdfFileUrl"
                          target="_blank"
                          style="text-decoration: none!important;"
                        >
                          <v-btn flat block>
                            <span>
                              <h5>
                                <b>Open PDF</b>
                              </h5>
                            </span>
                          </v-btn>
                        </a>
                      </div>
                    </v-flex>
                  </v-layout>-->
                </v-flex>
              </v-layout>
            </v-container>
          </v-card-text>
        </v-card>
      </v-dialog>
11d037abe   Neeraj Sharma   commit code
421
      <!-- ****** Course Detail TABLE ****** -->
add6421d5   Shikha Mishra   Improve updateCou...
422
423
424
425
      <v-toolbar color="transparent" flat>
        <!-- <v-flex xs1>
            <v-btn round class="open-dialog-button" dark @click="addCourseDetailDialog = true">
              <v-icon  size="20">add</v-icon>
eeb8db603   Amber Dev   added pdf link in...
426
427
428
              <span class="hidden-sm-and-down">Add Course Detail</span>
              <span class="hidden-md-and-up">Add</span>
            </v-btn>
add6421d5   Shikha Mishra   Improve updateCou...
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
        </v-flex>-->
        <v-btn
          fab
          dark
          class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only"
          small
          @click="addCourseDetailDialog = true"
        >
          <v-icon dark>add</v-icon>
        </v-btn>
        <v-flex xs1 class="hidden-sm-only hidden-xs-only">
          <v-btn round class="open-dialog-button" dark @click="addCourseDetailDialog = true">
            <v-icon class="white--text pr-1" size="20">add</v-icon>Add Course Detail
          </v-btn>
        </v-flex>
        <v-spacer></v-spacer>
        <v-flex xs12 sm4 md2>
          <v-select
            :items="addclass"
            label="Select Class"
            v-model="getCourse.classId"
            item-text="classNum"
            item-value="_id"
            name="Select Class"
            @change="getCourses(getCourse.classId)"
            required
          ></v-select>
        </v-flex>
        <v-flex xs12 sm4 md2 class="ml-2">
          <v-select
            :items="courseData"
            label="Select Course"
            v-model="getCourse.courseId"
            item-text="courseName"
            item-value="_id"
            required
            @change="getCourseDetailsList(getCourse.courseId)"
          ></v-select>
        </v-flex>
eeb8db603   Amber Dev   added pdf link in...
468

add6421d5   Shikha Mishra   Improve updateCou...
469
470
471
472
473
474
475
        <v-flex xs12 sm1 v-if="show">
          <v-btn icon large flat @click="show = false;showSearch = true;">
            <v-avatar size="27">
              <img src="/static/icon/search.png" alt="icon" />
            </v-avatar>
          </v-btn>
        </v-flex>
eeb8db603   Amber Dev   added pdf link in...
476

add6421d5   Shikha Mishra   Improve updateCou...
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
        <v-flex xs12 sm3 md3 v-if="showSearch" class="ml-2">
          <div style="display: inline-block;width: 70%;">
            <v-text-field
              autofocus
              v-model="search"
              label="Search"
              prepend-inner-icon="search"
              color="primary"
            ></v-text-field>
          </div>
          <div style="display: inline-block;">
            <v-icon @click="closeSearch" color="error">close</v-icon>
          </div>
        </v-flex>
      </v-toolbar>
eeb8db603   Amber Dev   added pdf link in...
492

11d037abe   Neeraj Sharma   commit code
493
494
495
496
497
498
499
500
      <v-data-table
        :headers="headers"
        :items="CourseDetailsList"
        :pagination.sync="pagination"
        :search="search"
        item-key="_id"
      >
        <template slot="items" slot-scope="props">
6c8f4ba9a   Neeraj Sharma   commit course all...
501
          <tr class="tr" @click="courseTableRow(props.item._id)">
11d037abe   Neeraj Sharma   commit code
502
503
            <td class="td td-row">{{ props.index + 1}}</td>
            <td class="td td-row text-xs-center">{{ props.item.classId.classNum }}</td>
0a5256600   Amber Dev   added events
504
            <td class="td td-row text-xs-center">{{ props.item.courseId.courseName }}</td>
11d037abe   Neeraj Sharma   commit code
505
            <td class="td td-row text-xs-center">
a8bd267e9   Amber Dev   added course disc...
506
              <div style="vertical-align: top;">
6c8f4ba9a   Neeraj Sharma   commit course all...
507
508
509
                <v-tooltip top>
                  <v-icon
                    slot="activator"
a8bd267e9   Amber Dev   added course disc...
510
                    style="cursor:pointer;font-size:22px;position: relative;top: -4px; "
6c8f4ba9a   Neeraj Sharma   commit course all...
511
512
513
514
515
516
                    class="mr-3"
                    @click="addChapters(props.item)"
                  >add_circle_outline</v-icon>
                  <span>Add</span>
                </v-tooltip>
                <v-tooltip top>
11d037abe   Neeraj Sharma   commit code
517
518
519
520
                  <img
                    slot="activator"
                    style="cursor:pointer; width:25px; height:25px; "
                    class="mr-3"
6c8f4ba9a   Neeraj Sharma   commit course all...
521
                    @click="props.expanded = !props.expanded"
11d037abe   Neeraj Sharma   commit code
522
523
524
525
526
527
528
529
530
531
532
533
534
                    src="/static/icon/view.png"
                  />
                  <span>View</span>
                </v-tooltip>
                <v-tooltip top>
                  <img
                    slot="activator"
                    style="cursor:pointer; width:20px; height:18px; "
                    class="mr-3"
                    @click="editItem(props.item)"
                    src="/static/icon/edit.png"
                  />
                  <span>Edit</span>
6c8f4ba9a   Neeraj Sharma   commit course all...
535
                </v-tooltip>
11d037abe   Neeraj Sharma   commit code
536
537
538
539
540
541
542
543
544
545
                <v-tooltip top>
                  <img
                    slot="activator"
                    style="cursor:pointer; width:20px; height:20px; "
                    class="mr-3"
                    @click="deleteItem(props.item)"
                    src="/static/icon/delete.png"
                  />
                  <span>Delete</span>
                </v-tooltip>
a8bd267e9   Amber Dev   added course disc...
546
              </div>
11d037abe   Neeraj Sharma   commit code
547
548
549
            </td>
          </tr>
        </template>
eeb8db603   Amber Dev   added pdf link in...
550
        <!-- CHAPTERS IN A COURSE -->
7d2cd2462   Neeraj Sharma   fixed bugs
551
        <template slot="expand">
11d037abe   Neeraj Sharma   commit code
552
553
554
555
556
557
558
559
          <v-data-table :items="chapters" hide-actions item-key="chapterName" style="width: auto;">
            <template slot="items" slot-scope="props">
              <tr class="tr" @click="props.expanded = !props.expanded">
                <td class="td td-row">{{ props.index + 1}}</td>
                <td class="text-xs-center td td-row">{{ props.item.chapterName}}</td>
                <td class="text-xs-center td td-row">{{ props.item.description }}</td>
                <td class="text-xs-center td td-row">
                  <v-tooltip top>
2b2d18143   Amber Dev   added live sessio...
560
561
562
563
                    <v-icon
                      slot="activator"
                      style="cursor:pointer;font-size:22px;position: relative;top: -4px; "
                      class="mr-3"
e91641fe5   Amber Dev   solved bugs
564
                      @click="$router.push({name: 'Live Online Class', query: {chapterId: props.item._id, chapterName: props.item.chapterName, courseId: getCourse.courseId, classId: getCourse.classId }})"
2b2d18143   Amber Dev   added live sessio...
565
566
567
568
                    >video_call</v-icon>
                    <span>Live Session</span>
                  </v-tooltip>
                  <v-tooltip top>
11d037abe   Neeraj Sharma   commit code
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
                    <img
                      slot="activator"
                      style="cursor:pointer; width:25px; height:25px; "
                      class="mr-3"
                      @click="profile(props.item)"
                      src="/static/icon/view.png"
                    />
                    <span>View</span>
                  </v-tooltip>
                  <v-tooltip top>
                    <img
                      slot="activator"
                      style="cursor:pointer; width:20px; height:18px; "
                      class="mr-3"
                      @click="editChapterItem(props.item)"
                      src="/static/icon/edit.png"
                    />
                    <span>Edit</span>
                  </v-tooltip>
11d037abe   Neeraj Sharma   commit code
588
                  <v-tooltip top>
6c8f4ba9a   Neeraj Sharma   commit course all...
589
                    <img
11d037abe   Neeraj Sharma   commit code
590
                      slot="activator"
6c8f4ba9a   Neeraj Sharma   commit course all...
591
592
593
594
595
596
                      style="cursor:pointer; width:20px; height:20px; "
                      class="mr-3"
                      @click="deleteChapters(props.item)"
                      src="/static/icon/delete.png"
                    />
                    <span>Delete Chapter</span>
11d037abe   Neeraj Sharma   commit code
597
                  </v-tooltip>
af6c7b97a   Shikha Mishra   add document sect...
598
599
600
601
602
                  <v-tooltip top>
                    <img
                      slot="activator"
                      style="cursor:pointer; width:20px; height:20px; "
                      class="mr-3"
af6c7b97a   Shikha Mishra   add document sect...
603
                      src="/static/icon/dashboard icons-34.png"
c3af2406b   Shikha Mishra   document section ...
604
                      @click="openLink(props.item.pdfFileUrl)"
af6c7b97a   Shikha Mishra   add document sect...
605
606
                    />
                    <span>
c3af2406b   Shikha Mishra   document section ...
607
                      <h5>{{props.item.fileName}}</h5>
af6c7b97a   Shikha Mishra   add document sect...
608
609
                    </span>
                  </v-tooltip>
11d037abe   Neeraj Sharma   commit code
610
                </td>
6c8f4ba9a   Neeraj Sharma   commit course all...
611
              </tr>
11d037abe   Neeraj Sharma   commit code
612
            </template>
11d037abe   Neeraj Sharma   commit code
613
614
615
616
617
618
619
620
621
622
623
          </v-data-table>
        </template>
  
        <v-alert
          slot="no-results"
          :value="true"
          color="error"
          icon="warning"
        >Your search for "{{ search }}" found no results.</v-alert>
      </v-data-table>
      <!-- ****** ADD Course Detail  ****** -->
a8bd267e9   Amber Dev   added course disc...
624
      <v-dialog v-model="addCourseDetailDialog" max-width="600px" persistent>
11d037abe   Neeraj Sharma   commit code
625
626
627
628
        <v-card flat class="card-style pa-2" dark>
          <v-layout>
            <v-flex xs12>
              <label class="title text-xs-center">Add Course Details</label>
de958fcfc   Amber Dev   added upload pdf
629
630
631
632
633
              <v-icon
                size="24"
                class="right"
                @click="addCourseDetailDialog = false; clear() ; trigger = 'reset' ; emptyPdf = 'reset' "
              >cancel</v-icon>
11d037abe   Neeraj Sharma   commit code
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
            </v-flex>
          </v-layout>
          <v-form ref="form" v-model="valid" lazy-validation>
            <v-container fluid>
              <v-flex xs12>
                <v-layout>
                  <v-flex xs4 class="pt-4 subheading">
                    <label class="right hidden-xs-only hidden-sm-only">Select Class:</label>
                    <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label>
                  </v-flex>
                  <v-flex xs8 sm8 md7 class="ml-3">
                    <v-select
                      :items="addclass"
                      label="Select Class"
                      v-model="addCourseDetail.classId"
                      item-text="classNum"
                      item-value="_id"
                      name="Select Class"
                      :rules="clsssRules"
                      @change="getCourses(addCourseDetail.classId)"
                      required
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
              <v-flex xs12>
                <v-layout>
                  <v-flex xs4 class="pt-4 subheading">
                    <label class="right hidden-xs-only hidden-sm-only">Select Course:</label>
                    <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Course:</label>
                  </v-flex>
                  <v-flex xs8 sm8 md7 class="ml-3">
                    <v-select
                      :items="courseData"
                      label="Select Course"
                      v-model="addCourseDetail.courseId"
0a5256600   Amber Dev   added events
670
                      item-text="courseName"
11d037abe   Neeraj Sharma   commit code
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
                      item-value="_id"
                      :rules="courseRules"
                      required
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
              <v-flex xs12>
                <v-layout>
                  <v-flex xs4 class="pt-4 subheading">
                    <label class="right">Chapter Name:</label>
                  </v-flex>
                  <v-flex xs8 sm8 md7 class="ml-3">
                    <v-text-field
                      v-model="addCourseDetail.chapterName"
                      placeholder="fill your Title"
                      name="name"
                      type="text"
                      :rules="chapterNameRules"
                      required
                    ></v-text-field>
                  </v-flex>
                </v-layout>
              </v-flex>
8fe241323   Amber Dev   added course comp...
695
              <!-- DESCRIPTION -->
11d037abe   Neeraj Sharma   commit code
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
              <v-flex xs12>
                <v-layout>
                  <v-flex xs4 class="pt-4 subheading">
                    <label class="right">Description:</label>
                  </v-flex>
                  <v-flex xs8 sm8 md7 class="ml-3">
                    <v-text-field
                      placeholder="fill your Description"
                      :rules="descriptionRules"
                      v-model="addCourseDetail.description"
                      type="text"
                      name="email"
                      required
                    ></v-text-field>
                  </v-flex>
                </v-layout>
              </v-flex>
8fe241323   Amber Dev   added course comp...
713
              <!-- UPLOAD PPT -->
39a6d21a0   Shikha Mishra   improve add stude...
714
              <!-- <v-flex xs12>
8fe241323   Amber Dev   added course comp...
715
716
717
718
719
720
721
722
                <v-layout>
                  <v-flex xs4 class="pt-4 subheading">
                    <label class="right">Upload PPT:</label>
                  </v-flex>
                  <v-flex xs8 sm8 md7 class="ml-3">
                    <UploadFiles
                      @fileSelected="fileSelected($event,'uploadPPT')"
                      label="Add PPT"
de958fcfc   Amber Dev   added upload pdf
723
724
725
                      reference="newCoursePpt"
                      id="newCoursePptInput"
                      :trigger="trigger"
8fe241323   Amber Dev   added course comp...
726
727
728
                    ></UploadFiles>
                  </v-flex>
                </v-layout>
39a6d21a0   Shikha Mishra   improve add stude...
729
              </v-flex>-->
8fe241323   Amber Dev   added course comp...
730
731
732
733
734
735
736
              <!-- UPLOAD PDF -->
              <v-flex xs12>
                <v-layout>
                  <v-flex xs4 class="pt-4 subheading">
                    <label class="right">Upload PDF:</label>
                  </v-flex>
                  <v-flex xs8 sm8 md7 class="ml-3">
de958fcfc   Amber Dev   added upload pdf
737
                    <UploadPdf
c3af2406b   Shikha Mishra   document section ...
738
                      @pdfFileSelected="pdfFileSelected($event,'uploadPDF')"
8fe241323   Amber Dev   added course comp...
739
                      label="Add PDF"
de958fcfc   Amber Dev   added upload pdf
740
741
                      reference="newCoursePdf"
                      id="newCoursePdfInput"
34a2a2609   Amber Dev   added upload file...
742
                      :emptyPdf="emptyPdf"
de958fcfc   Amber Dev   added upload pdf
743
                    ></UploadPdf>
8fe241323   Amber Dev   added course comp...
744
745
746
                  </v-flex>
                </v-layout>
              </v-flex>
11d037abe   Neeraj Sharma   commit code
747
748
749
750
751
752
753
754
755
756
757
758
              <v-layout>
                <v-flex xs12>
                  <div v-for="(chapterPoints,index) in finds" :key="index">
                    <v-layout>
                      <v-flex xs4 class="pt-4 subheading">
                        <label class="right">Chapter Points:</label>
                      </v-flex>
                      <v-flex xs8 sm8 md6 class="ml-3">
                        <v-text-field
                          placeholder="fill your Chapter Points"
                          v-model="chapterPoints.value"
                          type="text"
11d037abe   Neeraj Sharma   commit code
759
760
761
762
763
764
765
766
767
768
769
770
771
772
                          required
                        ></v-text-field>
                      </v-flex>
                      <v-flex xs2 class="pt-4">
                        <v-icon @click="deleteFind(index)" v-if="index !=0 ">cancel</v-icon>
                        <v-icon @click="addFind">add_circle</v-icon>
                      </v-flex>
                    </v-layout>
                  </div>
                </v-flex>
              </v-layout>
              <v-layout>
                <v-flex xs12 sm12>
                  <v-layout class="right">
eeb8db603   Amber Dev   added pdf link in...
773
                    <v-btn @click="clear();" round dark class="clear-button">Clear</v-btn>
11d037abe   Neeraj Sharma   commit code
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
                    <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn>
                  </v-layout>
                </v-flex>
              </v-layout>
            </v-container>
          </v-form>
        </v-card>
      </v-dialog>
      <v-snackbar
        :timeout="timeout"
        :top="y === 'top'"
        :right="x === 'right'"
        :vertical="mode === 'vertical'"
        v-model="snackbar"
        :color="color"
      >{{ text }}</v-snackbar>
      <div class="loader" v-if="showLoader">
        <v-progress-circular indeterminate color="white"></v-progress-circular>
      </div>
    </v-container>
  </template>
  
  <script>
  import http from "@/Services/http.js";
8fe241323   Amber Dev   added course comp...
798
  import UploadFiles from "@/pages/Common/UploadFiles.vue";
de958fcfc   Amber Dev   added upload pdf
799
800
  import UploadPdf from "@/pages/Common/UploadPdf.vue";
  import AllApiCalls from "@/Services/AllApiCalls.js";
11d037abe   Neeraj Sharma   commit code
801
802
  
  export default {
de958fcfc   Amber Dev   added upload pdf
803
    mixins: [AllApiCalls],
8fe241323   Amber Dev   added course comp...
804
    components: {
de958fcfc   Amber Dev   added upload pdf
805
      UploadFiles,
eeb8db603   Amber Dev   added pdf link in...
806
      UploadPdf,
8fe241323   Amber Dev   added course comp...
807
    },
11d037abe   Neeraj Sharma   commit code
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
    data: () => ({
      snackbar: false,
      y: "top",
      x: "right",
      mode: "",
      timeout: 3000,
      text: "",
      loading: false,
      color: "",
      date: null,
      search: "",
      show: true,
      addCourseDetailDialog: false,
      showSearch: false,
      showLoader: false,
      editCourseDetailDialog: false,
6c8f4ba9a   Neeraj Sharma   commit course all...
824
      editChapterDetailDialog: false,
11d037abe   Neeraj Sharma   commit code
825
826
827
828
829
830
831
832
      viewProfileGallery: false,
      valid: true,
      editLoading: false,
      addclass: [],
      courseData: [],
      addSection: [],
      getCourse: {},
      finds: [{ value: "" }],
6c8f4ba9a   Neeraj Sharma   commit course all...
833
      findsChapterPoint: [{ value: "" }],
c3a54d5c1   Neeraj Sharma   fixed bugs
834
      updates: [],
11d037abe   Neeraj Sharma   commit code
835
836
837
838
839
840
      youTubeLink: {},
      addCourseDetail: {
        chapters: [
          {
            chapterName: "",
            description: "",
eeb8db603   Amber Dev   added pdf link in...
841
842
843
            chapterPoints: [],
          },
        ],
11d037abe   Neeraj Sharma   commit code
844
845
846
      },
      chapters: [],
      pagination: {
eeb8db603   Amber Dev   added pdf link in...
847
        rowsPerPage: 10,
11d037abe   Neeraj Sharma   commit code
848
849
850
851
852
      },
      editFiles: [],
      files: [],
      courseData: [],
      token: "",
6c8f4ba9a   Neeraj Sharma   commit course all...
853
      courseId: "",
eeb8db603   Amber Dev   added pdf link in...
854
855
856
857
      clsssRules: [(v) => !!v || " Class is required"],
      courseRules: [(v) => !!v || " Course is required"],
      chapterNameRules: [(v) => !!v || " Tilte is required"],
      descriptionRules: [(v) => !!v || " Description is required"],
11d037abe   Neeraj Sharma   commit code
858
859
860
861
862
      headers: [
        {
          align: "",
          text: "No",
          sortable: false,
eeb8db603   Amber Dev   added pdf link in...
863
          value: "index",
11d037abe   Neeraj Sharma   commit code
864
865
866
867
868
        },
        {
          text: "Class Name",
          value: "classNum",
          sortable: false,
eeb8db603   Amber Dev   added pdf link in...
869
          align: "center",
11d037abe   Neeraj Sharma   commit code
870
871
872
873
874
        },
        {
          text: "Course Name",
          value: "courseName",
          sortable: false,
eeb8db603   Amber Dev   added pdf link in...
875
          align: "center",
11d037abe   Neeraj Sharma   commit code
876
        },
eeb8db603   Amber Dev   added pdf link in...
877
        { text: "Action", value: "", sortable: false, align: "center" },
11d037abe   Neeraj Sharma   commit code
878
879
880
881
      ],
      CourseDetailsList: [],
      editedIndex: -1,
      editedItem: {},
6c8f4ba9a   Neeraj Sharma   commit course all...
882
      editedCourse: {},
c3a54d5c1   Neeraj Sharma   fixed bugs
883
      editChapter: {
eeb8db603   Amber Dev   added pdf link in...
884
        chapterPoints: [],
c3a54d5c1   Neeraj Sharma   fixed bugs
885
      },
6c8f4ba9a   Neeraj Sharma   commit course all...
886
887
      index: "",
      addChapterItem: {},
7d2cd2462   Neeraj Sharma   fixed bugs
888
      addChapterItemObj: {},
eeb8db603   Amber Dev   added pdf link in...
889
      addChapterDialog: false,
01a4a5246   Shikha Mishra   When the modal wa...
890
      showData: false,
11d037abe   Neeraj Sharma   commit code
891
892
    }),
    methods: {
c3af2406b   Shikha Mishra   document section ...
893
894
895
      openLink(url) {
        window.open(url, "_blank");
      },
11d037abe   Neeraj Sharma   commit code
896
897
      getCourses(classId) {
        this.showLoader = true;
342f9c0ca   Shikha Mishra   clear previous da...
898
899
        this.CourseDetailsList = [];
        this.getCourse.courseId = "";
11d037abe   Neeraj Sharma   commit code
900
901
902
        http()
          .get("/getCourseesList", {
            params: {
eeb8db603   Amber Dev   added pdf link in...
903
904
              classId: classId,
            },
11d037abe   Neeraj Sharma   commit code
905
          })
eeb8db603   Amber Dev   added pdf link in...
906
          .then((response) => {
6c8f4ba9a   Neeraj Sharma   commit course all...
907
            this.editChapter.courseId = "";
11d037abe   Neeraj Sharma   commit code
908
            this.courseData = response.data.data;
cb844617e   Shikha Mishra   Added functionali...
909
            // console.log("this.courseData", this.courseData);
11d037abe   Neeraj Sharma   commit code
910
911
            this.showLoader = false;
          })
eeb8db603   Amber Dev   added pdf link in...
912
          .catch((err) => {
860da881d   Shikha Mishra   comment all consoles
913
            //   console.log("err====>", err);
11d037abe   Neeraj Sharma   commit code
914
            this.showLoader = false;
860da881d   Shikha Mishra   comment all consoles
915
916
917
            this.snackbar = true;
            this.color = "error";
            this.text = error.response.data.message;
11d037abe   Neeraj Sharma   commit code
918
919
920
921
922
923
924
          });
      },
      getCourseDetailsList() {
        this.showLoader = true;
        http()
          .get("/getParticularCourseDetail", {
            params: {
eeb8db603   Amber Dev   added pdf link in...
925
926
              courseId: this.getCourse.courseId,
            },
11d037abe   Neeraj Sharma   commit code
927
          })
eeb8db603   Amber Dev   added pdf link in...
928
          .then((response) => {
11d037abe   Neeraj Sharma   commit code
929
            this.CourseDetailsList = response.data.data;
01a4a5246   Shikha Mishra   When the modal wa...
930
931
932
933
934
935
936
937
            if (this.CourseDetailsList.length === 0) {
              this.showLoader = false;
              this.snackbar = true;
              this.text = "Data not found!";
              this.color = "error";
              return;
            }
            this.showData = true;
7d2cd2462   Neeraj Sharma   fixed bugs
938
939
940
            if (response.data.data[0]) {
              this.chapters = response.data.data[0].chapters;
            }
11d037abe   Neeraj Sharma   commit code
941
942
            this.showLoader = false;
          })
eeb8db603   Amber Dev   added pdf link in...
943
          .catch((error) => {
11d037abe   Neeraj Sharma   commit code
944
945
946
947
948
949
950
951
952
            // console.log("err====>", err);
            this.showLoader = false;
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
            }
          });
      },
6c8f4ba9a   Neeraj Sharma   commit course all...
953
      courseTableRow(id) {
6c8f4ba9a   Neeraj Sharma   commit course all...
954
955
956
        this.courseId = id;
      },
      addChapters(item) {
6c8f4ba9a   Neeraj Sharma   commit course all...
957
        this.editedIndex = this.CourseDetailsList.indexOf(item);
7d2cd2462   Neeraj Sharma   fixed bugs
958
959
        this.addChapterItemObj = Object.assign({}, item);
        this.addChapterItem.courseDetailId = this.addChapterItemObj._id;
6c8f4ba9a   Neeraj Sharma   commit course all...
960
        this.addChapterDialog = true;
6c8f4ba9a   Neeraj Sharma   commit course all...
961
962
      },
      submitChapter() {
b8258078b   Shikha Mishra   upload pdf sectio...
963
        //   console.log("addChapterItem", this.addChapterItem);
6c8f4ba9a   Neeraj Sharma   commit course all...
964
965
966
967
        this.addChapterItem.chapterPoints = [];
        for (let i = 0; i < this.findsChapterPoint.length; i++) {
          this.addChapterItem.chapterPoints.push(this.findsChapterPoint[i].value);
        }
b8258078b   Shikha Mishra   upload pdf sectio...
968
969
970
        this.addChapterItem.uploadPdf = this.pdfFile;
        this.addChapterItem.uploadPpt = this.pptFile;
        this.addChapterItem.fileName = this.pdfFileName;
6c8f4ba9a   Neeraj Sharma   commit course all...
971
972
973
        this.loading = true;
        http()
          .put("/addChapters", this.addChapterItem)
eeb8db603   Amber Dev   added pdf link in...
974
          .then((response) => {
6c8f4ba9a   Neeraj Sharma   commit course all...
975
976
977
978
979
            this.addChapterDialog = false;
            this.loading = false;
            this.snackbar = true;
            this.text = response.data.message;
            this.color = "green";
7d2cd2462   Neeraj Sharma   fixed bugs
980
981
            this.addChapterItem = {};
            this.removeChapterPoint();
6c8f4ba9a   Neeraj Sharma   commit course all...
982
            this.getCourseDetailsList();
6c8f4ba9a   Neeraj Sharma   commit course all...
983
          })
eeb8db603   Amber Dev   added pdf link in...
984
          .catch((error) => {
6c8f4ba9a   Neeraj Sharma   commit course all...
985
986
987
988
989
990
            this.snackbar = true;
            this.text = error.response.data.message;
            this.color = "error";
            this.loading = false;
          });
      },
11d037abe   Neeraj Sharma   commit code
991
      profile(item) {
98a0010d3   Shikha Mishra   issue solved rela...
992
        //   console.log("chaper - ", item);
11d037abe   Neeraj Sharma   commit code
993
994
995
996
        this.editedIndex = this.chapters.indexOf(item);
        this.editedItem = Object.assign({}, item);
        this.viewProfileGallery = true;
      },
6c8f4ba9a   Neeraj Sharma   commit course all...
997
998
999
      editItem(item) {
        this.editedIndex = this.CourseDetailsList.indexOf(item);
        this.editedCourse = Object.assign({}, item);
6c8f4ba9a   Neeraj Sharma   commit course all...
1000
1001
        this.editCourseDetailDialog = true;
      },
11d037abe   Neeraj Sharma   commit code
1002
1003
1004
      editChapterItem(item) {
        this.editedIndex = this.chapters.indexOf(item);
        this.editChapter = Object.assign({}, item);
c3a54d5c1   Neeraj Sharma   fixed bugs
1005
1006
1007
1008
        this.updates = [];
        for (let i = 0; i < this.editChapter.chapterPoints.length; i++) {
          this.updates.push({ value: this.editChapter.chapterPoints[i] });
        }
6c8f4ba9a   Neeraj Sharma   commit course all...
1009
        this.editChapterDetailDialog = true;
11d037abe   Neeraj Sharma   commit code
1010
1011
1012
      },
      deleteItem(item) {
        let deleteGallery = {
eeb8db603   Amber Dev   added pdf link in...
1013
          courseDetailId: item._id,
11d037abe   Neeraj Sharma   commit code
1014
1015
1016
        };
        http()
          .delete(
6c8f4ba9a   Neeraj Sharma   commit course all...
1017
            "/deleteCourseDetail",
11d037abe   Neeraj Sharma   commit code
1018
1019
1020
            confirm("Are you sure you want to delete this?") && {
              params: deleteGallery,
              headers: {
eeb8db603   Amber Dev   added pdf link in...
1021
1022
                Authorization: "Bearer " + this.token,
              },
11d037abe   Neeraj Sharma   commit code
1023
1024
            }
          )
eeb8db603   Amber Dev   added pdf link in...
1025
          .then((response) => {
11d037abe   Neeraj Sharma   commit code
1026
            this.snackbar = true;
6c8f4ba9a   Neeraj Sharma   commit course all...
1027
            this.text = "Successfully delete Course Details";
11d037abe   Neeraj Sharma   commit code
1028
1029
1030
            this.color = "green";
            this.getCourseDetailsList();
          })
eeb8db603   Amber Dev   added pdf link in...
1031
          .catch((error) => {
11d037abe   Neeraj Sharma   commit code
1032
1033
1034
1035
1036
1037
            // console.log(error);
            this.snackbar = true;
            this.text = error.response.data.message;
            this.color = "error";
          });
      },
6c8f4ba9a   Neeraj Sharma   commit course all...
1038
1039
1040
1041
      deleteChapters(item) {
        // console.log("item", item);
        let deleteChapters = {
          courseDetailId: this.courseId,
eeb8db603   Amber Dev   added pdf link in...
1042
          chapterId: item._id,
11d037abe   Neeraj Sharma   commit code
1043
1044
        };
        http()
6c8f4ba9a   Neeraj Sharma   commit course all...
1045
1046
1047
1048
          .put(
            "/deleteChapters",
            confirm("Are you sure you want to delete this?") && deleteChapters
          )
eeb8db603   Amber Dev   added pdf link in...
1049
          .then((response) => {
11d037abe   Neeraj Sharma   commit code
1050
            this.snackbar = true;
6c8f4ba9a   Neeraj Sharma   commit course all...
1051
            this.text = "Successfully delete Chapters";
11d037abe   Neeraj Sharma   commit code
1052
1053
            this.color = "green";
            this.getCourseDetailsList();
11d037abe   Neeraj Sharma   commit code
1054
          })
eeb8db603   Amber Dev   added pdf link in...
1055
          .catch((error) => {
6c8f4ba9a   Neeraj Sharma   commit course all...
1056
            // console.log(error);
11d037abe   Neeraj Sharma   commit code
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
            this.snackbar = true;
            this.text = error.response.data.message;
            this.color = "error";
          });
      },
      close() {
        this.editCourseDetailDialog = false;
      },
      closeProfileGallery() {
        this.viewProfileGallery = false;
      },
      submit() {
        let chapters = [];
        var chapterPoints = [];
        for (let i = 0; i < this.finds.length; i++) {
          chapterPoints.push(this.finds[i].value);
cb844617e   Shikha Mishra   Added functionali...
1073
          // console.log("this.finds[i].value", this.finds[i].value);
11d037abe   Neeraj Sharma   commit code
1074
1075
1076
1077
          chapters = [
            {
              chapterName: this.addCourseDetail.chapterName,
              description: this.addCourseDetail.description,
8fe241323   Amber Dev   added course comp...
1078
              chapterPoints: chapterPoints,
c3af2406b   Shikha Mishra   document section ...
1079
              uploadPdf: this.pdfFile,
eeb8db603   Amber Dev   added pdf link in...
1080
              uploadPpt: this.pptFile,
c3af2406b   Shikha Mishra   document section ...
1081
              fileName: this.pdfFileName,
eeb8db603   Amber Dev   added pdf link in...
1082
            },
11d037abe   Neeraj Sharma   commit code
1083
1084
1085
          ];
        }
        if (this.$refs.form.validate()) {
cb844617e   Shikha Mishra   Added functionali...
1086
          // console.log("this.addCourseDetail", this.addCourseDetail);
11d037abe   Neeraj Sharma   commit code
1087
1088
1089
          var courseDetailsData = {
            classId: this.addCourseDetail.classId,
            courseId: this.addCourseDetail.courseId,
eeb8db603   Amber Dev   added pdf link in...
1090
            chapters: chapters,
11d037abe   Neeraj Sharma   commit code
1091
1092
1093
1094
          };
          this.loading = true;
          http()
            .post("/createCourseDetail", courseDetailsData)
eeb8db603   Amber Dev   added pdf link in...
1095
            .then((response) => {
11d037abe   Neeraj Sharma   commit code
1096
1097
1098
1099
1100
              this.addCourseDetailDialog = false;
              this.loading = false;
              this.snackbar = true;
              this.text = response.data.message;
              this.color = "green";
947636880   Shikha Mishra   show list of cour...
1101
              // this.clear();
de958fcfc   Amber Dev   added upload pdf
1102
1103
              this.trigger = "reset";
              this.emptyPdf = "reset";
947636880   Shikha Mishra   show list of cour...
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
              http()
                .get("/getParticularCourseDetail", {
                  params: {
                    courseId: this.addCourseDetail.courseId,
                  },
                })
                .then((response) => {
                  this.CourseDetailsList = response.data.data;
                  if (this.CourseDetailsList.length === 0) {
                    this.showLoader = false;
                    this.snackbar = true;
                    this.text = "Data not found!";
                    this.color = "error";
                    return;
                  }
                  this.showData = true;
                  if (response.data.data[0]) {
                    this.chapters = response.data.data[0].chapters;
                  }
                  this.showLoader = false;
                })
                .catch((error) => {
                  // console.log("err====>", err);
                  this.showLoader = false;
                  if (error.response.status === 401) {
                    this.$router.replace({ path: "/" });
                    this.$store.dispatch("setToken", null);
                    this.$store.dispatch("Id", null);
                  }
                });
7d2cd2462   Neeraj Sharma   fixed bugs
1134
              this.removeAddFind();
11d037abe   Neeraj Sharma   commit code
1135
            })
eeb8db603   Amber Dev   added pdf link in...
1136
            .catch((error) => {
11d037abe   Neeraj Sharma   commit code
1137
1138
1139
1140
1141
1142
1143
1144
1145
              this.snackbar = true;
              this.text = error.response.data.message;
              this.color = "error";
              this.loading = false;
            });
        }
      },
      clear() {
        this.$refs.form.reset();
11d037abe   Neeraj Sharma   commit code
1146
      },
6c8f4ba9a   Neeraj Sharma   commit course all...
1147
1148
      saveChapter() {
        this.editedItem.courseDetailId = this.editedItem._id;
cb844617e   Shikha Mishra   Added functionali...
1149
        // console.log("this.updates", this.updates);
c3a54d5c1   Neeraj Sharma   fixed bugs
1150
        var chapterPoints = [];
11d037abe   Neeraj Sharma   commit code
1151
        for (let i = 0; i < this.updates.length; i++) {
c3a54d5c1   Neeraj Sharma   fixed bugs
1152
          chapterPoints.push(this.updates[i].value);
11d037abe   Neeraj Sharma   commit code
1153
        }
6c8f4ba9a   Neeraj Sharma   commit course all...
1154
1155
1156
1157
1158
        var updateData = {
          courseDetailId: this.courseId,
          chapterId: this.editChapter._id,
          chapterName: this.editChapter.chapterName,
          description: this.editChapter.description,
de958fcfc   Amber Dev   added upload pdf
1159
          chapterPoints: chapterPoints,
bf576e652   Rishav Singla   solved issue of p...
1160
          uploadPdf: this.pdfFile,
eeb8db603   Amber Dev   added pdf link in...
1161
          uploadPpt: this.pptFile,
c3af2406b   Shikha Mishra   document section ...
1162
          fileName: this.pdfFileName,
6c8f4ba9a   Neeraj Sharma   commit course all...
1163
        };
11d037abe   Neeraj Sharma   commit code
1164
1165
        this.editLoading = true;
        http()
6c8f4ba9a   Neeraj Sharma   commit course all...
1166
          .put("/updateChapters", updateData)
eeb8db603   Amber Dev   added pdf link in...
1167
          .then((response) => {
7d2cd2462   Neeraj Sharma   fixed bugs
1168
            this.editChapterDetailDialog = false;
11d037abe   Neeraj Sharma   commit code
1169
1170
1171
1172
            this.snackbar = true;
            this.text = response.data.message;
            this.color = "green";
            this.editLoading = false;
c3a54d5c1   Neeraj Sharma   fixed bugs
1173
            // this.removeUpdatePoints();
de958fcfc   Amber Dev   added upload pdf
1174
1175
            this.trigger = "reset";
            this.emptyPdf = "reset";
947636880   Shikha Mishra   show list of cour...
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
            http()
              .get("/getParticularCourseDetail", {
                params: {
                  courseId: this.getCourse.courseId,
                },
              })
              .then((response) => {
                this.CourseDetailsList = response.data.data;
                if (this.CourseDetailsList.length === 0) {
                  this.showLoader = false;
                  this.snackbar = true;
                  this.text = "Data not found!";
                  this.color = "error";
                  return;
                }
                this.showData = true;
                if (response.data.data[0]) {
                  this.chapters = response.data.data[0].chapters;
                }
                this.showLoader = false;
              })
              .catch((error) => {
                // console.log("err====>", err);
                this.showLoader = false;
                if (error.response.status === 401) {
                  this.$router.replace({ path: "/" });
                  this.$store.dispatch("setToken", null);
                  this.$store.dispatch("Id", null);
                }
              });
11d037abe   Neeraj Sharma   commit code
1206
          })
eeb8db603   Amber Dev   added pdf link in...
1207
          .catch((error) => {
11d037abe   Neeraj Sharma   commit code
1208
1209
1210
1211
1212
1213
            this.editLoading = false;
            this.snackbar = true;
            this.text = error.response.data.message;
            this.color = "error";
          });
      },
6c8f4ba9a   Neeraj Sharma   commit course all...
1214
      save() {
6c8f4ba9a   Neeraj Sharma   commit course all...
1215
1216
        var updateData = {
          courseDetailId: this.editedCourse._id,
add6421d5   Shikha Mishra   Improve updateCou...
1217
1218
          courseId: this.editedCourse.courseId._id,
          classId: this.editedCourse.classId._id,
6c8f4ba9a   Neeraj Sharma   commit course all...
1219
1220
1221
1222
        };
        this.editLoading = true;
        http()
          .put("/updateCourseDetail", updateData)
eeb8db603   Amber Dev   added pdf link in...
1223
          .then((response) => {
6c8f4ba9a   Neeraj Sharma   commit course all...
1224
1225
1226
1227
1228
1229
1230
1231
1232
            this.getCourseDetailsList();
            this.editCourseDetailDialog = false;
            this.snackbar = true;
            this.text = response.data.message;
            this.color = "green";
            this.editLoading = false;
            // this.editChapterPointName = "";
            this.editFiles = [];
          })
eeb8db603   Amber Dev   added pdf link in...
1233
          .catch((error) => {
6c8f4ba9a   Neeraj Sharma   commit course all...
1234
1235
1236
1237
1238
1239
            this.editLoading = false;
            this.snackbar = true;
            this.text = error.response.data.message;
            this.color = "error";
          });
      },
11d037abe   Neeraj Sharma   commit code
1240
1241
1242
      getAllClasses() {
        http()
          .get("/getClassesList", {
eeb8db603   Amber Dev   added pdf link in...
1243
            headers: { Authorization: "Bearer " + this.token },
11d037abe   Neeraj Sharma   commit code
1244
          })
eeb8db603   Amber Dev   added pdf link in...
1245
          .then((response) => {
11d037abe   Neeraj Sharma   commit code
1246
1247
            this.addclass = response.data.data;
          })
eeb8db603   Amber Dev   added pdf link in...
1248
          .catch((err) => {
11d037abe   Neeraj Sharma   commit code
1249
1250
1251
            // console.log("err====>", err);
          });
      },
eeb8db603   Amber Dev   added pdf link in...
1252
      removeChapterPoint: function () {
6c8f4ba9a   Neeraj Sharma   commit course all...
1253
1254
        this.findsChapterPoint = [{ value: "" }];
      },
eeb8db603   Amber Dev   added pdf link in...
1255
      removeAddFind: function () {
11d037abe   Neeraj Sharma   commit code
1256
1257
        this.finds = [{ value: "" }];
      },
eeb8db603   Amber Dev   added pdf link in...
1258
      addFind: function () {
11d037abe   Neeraj Sharma   commit code
1259
1260
        this.finds.push({ value: "" });
      },
eeb8db603   Amber Dev   added pdf link in...
1261
      addChapterPoint: function () {
6c8f4ba9a   Neeraj Sharma   commit course all...
1262
1263
        this.findsChapterPoint.push({ value: "" });
      },
eeb8db603   Amber Dev   added pdf link in...
1264
      update: function () {
6c8f4ba9a   Neeraj Sharma   commit course all...
1265
        this.updates.push({ value: "" });
11d037abe   Neeraj Sharma   commit code
1266
      },
c3a54d5c1   Neeraj Sharma   fixed bugs
1267
1268
1269
      // removeUpdatePoints: function() {
      //   this.updates = [{ value: "" }];
      // },
eeb8db603   Amber Dev   added pdf link in...
1270
      deleteFind: function (index) {
11d037abe   Neeraj Sharma   commit code
1271
1272
1273
        this.finds.splice(index, 1);
        if (index === 0) this.addFind();
      },
eeb8db603   Amber Dev   added pdf link in...
1274
      deleteChapterPoint: function (index) {
6c8f4ba9a   Neeraj Sharma   commit course all...
1275
1276
1277
        this.findsChapterPoint.splice(index, 1);
        if (index === 0) this.addChapterPoint();
      },
eeb8db603   Amber Dev   added pdf link in...
1278
      deleteUpdate: function (index) {
11d037abe   Neeraj Sharma   commit code
1279
1280
1281
        this.updates.splice(index, 1);
        if (index === 0) this.update();
      },
eeb8db603   Amber Dev   added pdf link in...
1282
      deleteUrl: function (index, youTubelinkId, id) {
6c8f4ba9a   Neeraj Sharma   commit course all...
1283
        this.editChapter.chapterPoints.splice(index, 1);
11d037abe   Neeraj Sharma   commit code
1284
        if (index === 0) this.update();
11d037abe   Neeraj Sharma   commit code
1285
1286
1287
1288
1289
1290
1291
1292
1293
      },
      displaySearch() {
        this.show = false;
        this.showSearch = true;
      },
      closeSearch() {
        this.showSearch = false;
        this.show = true;
        this.search = "";
eeb8db603   Amber Dev   added pdf link in...
1294
      },
11d037abe   Neeraj Sharma   commit code
1295
1296
1297
1298
    },
    mounted() {
      this.token = this.$store.state.token;
      this.getAllClasses();
eeb8db603   Amber Dev   added pdf link in...
1299
    },
11d037abe   Neeraj Sharma   commit code
1300
1301
  };
  </script>