Blame view

src/pages/Exam/examSchedule.vue 32.7 KB
0551a0f15   Neeraj Sharma   implemnet functio...
1
      <template>
68d742034   Neeraj Sharma   implement new des...
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
    <v-container fluid class="body-color">
      <!-- ****** Edit Exam Schedule****** -->
      <v-dialog v-model="editExamScheduleDialog" max-width="800px" scrollable>
        <v-card flat class="card-style pa-2" dark>
          <v-layout>
            <v-flex xs12>
              <label class="title text-xs-center">Edit Exam Schedule</label>
              <v-icon size="24" class="right" @click="editExamScheduleDialog = false">cancel</v-icon>
            </v-flex>
          </v-layout>
          <v-card-text>
            <v-form ref="form">
              <v-container fluid>
                <v-layout wrap>
                  <v-flex xs12 sm12>
0551a0f15   Neeraj Sharma   implemnet functio...
17
                    <v-layout>
68d742034   Neeraj Sharma   implement new des...
18
19
                      <v-flex xs4 class="pt-4 subheading">
                        <label class="right">Exam Name:</label>
0551a0f15   Neeraj Sharma   implemnet functio...
20
                      </v-flex>
68d742034   Neeraj Sharma   implement new des...
21
22
                      <v-flex xs7 class="ml-3">
                        <v-select
65d5475b6   Shikha Mishra   changes in api an...
23
                          :rules="examRules"
68d742034   Neeraj Sharma   implement new des...
24
                          :items="examList"
65d5475b6   Shikha Mishra   changes in api an...
25
                          v-model="editedItem.examId"
68d742034   Neeraj Sharma   implement new des...
26
27
                          label="Select your Exam Name"
                          item-text="examName"
65d5475b6   Shikha Mishra   changes in api an...
28
                          item-value="_id"
68d742034   Neeraj Sharma   implement new des...
29
                        ></v-select>
0551a0f15   Neeraj Sharma   implemnet functio...
30
                      </v-flex>
68d742034   Neeraj Sharma   implement new des...
31
32
33
34
35
36
                    </v-layout>
                  </v-flex>
                  <v-flex xs12 sm12>
                    <v-layout>
                      <v-flex xs4 class="pt-4 subheading">
                        <label class="right">Class:</label>
0551a0f15   Neeraj Sharma   implemnet functio...
37
                      </v-flex>
68d742034   Neeraj Sharma   implement new des...
38
39
40
41
42
43
44
45
46
47
48
                      <v-flex xs7 class="ml-3">
                        <v-select
                          v-model="editedItem.classId"
                          label="Select your Class"
                          type="text"
                          :items="classList"
                          item-text="classNum"
                          item-value="_id"
                          @change="getSections(editedItem.classId)"
                          required
                        ></v-select>
0551a0f15   Neeraj Sharma   implemnet functio...
49
                      </v-flex>
68d742034   Neeraj Sharma   implement new des...
50
51
52
53
54
                    </v-layout>
                  </v-flex>
                  <v-flex xs12 sm12>
                    <v-layout>
                      <v-flex xs4 class="pt-4 subheading">
68d742034   Neeraj Sharma   implement new des...
55
                        <label class="right">Subject Name:</label>
0551a0f15   Neeraj Sharma   implemnet functio...
56
                      </v-flex>
68d742034   Neeraj Sharma   implement new des...
57
58
59
                      <v-flex xs7 class="ml-3">
                        <v-select
                          :items="subjects"
8627b2890   Shikha Mishra   set table fields ...
60
                          label="Select your Subject"
68d742034   Neeraj Sharma   implement new des...
61
62
63
                          v-model="editedItem.subjectName"
                          item-text="subjectName"
                          item-value="subjectName"
8627b2890   Shikha Mishra   set table fields ...
64
                          name="Select Subject"
68d742034   Neeraj Sharma   implement new des...
65
66
                          required
                        ></v-select>
0551a0f15   Neeraj Sharma   implemnet functio...
67
68
                      </v-flex>
                    </v-layout>
68d742034   Neeraj Sharma   implement new des...
69
70
                  </v-flex>
                  <v-flex xs12 sm12>
0551a0f15   Neeraj Sharma   implemnet functio...
71
                    <v-layout>
68d742034   Neeraj Sharma   implement new des...
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
                      <v-flex xs4 class="pt-4 subheading">
                        <label class="right">Date:</label>
                      </v-flex>
                      <v-flex xs7 class="ml-3">
                        <v-menu
                          ref="editDate"
                          :close-on-content-click="false"
                          v-model="editDate"
                          :nudge-right="40"
                          :return-value.sync="editDate"
                          lazy
                          transition="scale-transition"
                          offset-y
                          full-width
                          min-width="290px"
                        >
                          <v-text-field
                            slot="activator"
                            v-model="editedItem.date"
                            label="Select Date"
                            append-icon="event"
                            readonly
                          ></v-text-field>
                          <v-date-picker v-model="editedItem.date" @input="editDate = false"></v-date-picker>
                        </v-menu>
0551a0f15   Neeraj Sharma   implemnet functio...
97
98
                      </v-flex>
                    </v-layout>
68d742034   Neeraj Sharma   implement new des...
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
                  </v-flex>
                  <v-flex xs12 sm12>
                    <v-layout>
                      <v-flex xs4 class="pt-4 subheading">
                        <label class="right">Time From:</label>
                      </v-flex>
                      <v-flex xs7 class="ml-3">
                        <v-menu
                          ref="menuEdit"
                          :close-on-content-click="false"
                          v-model="menuEdit"
                          :nudge-right="40"
                          :return-value.sync="editedItem.timeFrom"
                          lazy
                          transition="scale-transition"
                          offset-y
                          full-width
                          max-width="290px"
                          min-width="290px"
                        >
                          <v-text-field
                            slot="activator"
                            v-model="editedItem.timeFrom"
                            label="Select your time From"
                            append-icon="access_time"
                            readonly
                          ></v-text-field>
                          <v-time-picker
                            v-model="editedItem.timeIn"
                            @change="$refs.menuEdit.save(editedItem.timeIn)"
                          ></v-time-picker>
                        </v-menu>
                      </v-flex>
                    </v-layout>
                  </v-flex>
                  <v-flex xs12 sm12>
                    <v-layout>
                      <v-flex xs4 class="pt-4 subheading">
                        <label class="right">Time To:</label>
                      </v-flex>
                      <v-flex xs7 class="ml-3">
                        <v-menu
                          ref="timeToEdit"
                          :close-on-content-click="false"
                          v-model="timeToEdit"
                          :nudge-right="40"
                          :return-value.sync="editedItem.timeTo"
                          lazy
                          transition="scale-transition"
                          offset-y
                          full-width
                          max-width="290px"
                          min-width="290px"
                        >
                          <v-text-field
                            slot="activator"
                            v-model="editedItem.timeTo"
                            label="Select your Time To"
                            append-icon="access_time"
                            readonly
                          ></v-text-field>
                          <v-time-picker
                            v-model="editedItem.timeTo"
                            @change="$refs.timeToEdit.save(editedItem.timeTo)"
                          ></v-time-picker>
                        </v-menu>
                      </v-flex>
                    </v-layout>
                  </v-flex>
                  <v-flex xs12 sm12>
                    <v-layout>
                      <v-flex xs4 class="pt-4 subheading">
                        <label class="right">Room:</label>
                      </v-flex>
                      <v-flex xs7 class="ml-3">
                        <v-text-field
                          placeholder="fill your room"
                          v-model="editedItem.room"
                          @keyup.enter="save"
                        ></v-text-field>
                      </v-flex>
                    </v-layout>
                  </v-flex>
                </v-layout>
                <v-layout>
                  <v-flex xs12>
                    <v-card-actions>
                      <v-spacer></v-spacer>
e8965626f   Shikha Mishra   set login design ...
187
                      <v-btn round dark @click="update" class="add-button">Save</v-btn>
68d742034   Neeraj Sharma   implement new des...
188
189
190
191
192
193
194
195
                    </v-card-actions>
                  </v-flex>
                </v-layout>
              </v-container>
            </v-form>
          </v-card-text>
        </v-card>
      </v-dialog>
0551a0f15   Neeraj Sharma   implemnet functio...
196

68d742034   Neeraj Sharma   implement new des...
197
      <!-- ****** PROFILE VIEW Exam Schedule  DATA ******  -->
0551a0f15   Neeraj Sharma   implemnet functio...
198

68d742034   Neeraj Sharma   implement new des...
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
      <v-dialog v-model="profileExamScheduleDialog" max-width="600px">
        <v-card flat class="card-style pa-3" dark>
          <v-layout>
            <v-flex xs12>
              <label class="title text-xs-center">View Exam Schedule</label>
              <v-icon size="24" class="right" @click="profileExamScheduleDialog = false">cancel</v-icon>
            </v-flex>
          </v-layout>
          <v-card-text>
            <v-container grid-list-md>
              <v-layout wrap>
                <v-flex>
                  <v-layout>
                    <v-flex xs5 sm6>
                      <h5 class="right my-1">
                        <b>Exam Name:</b>
                      </h5>
                    </v-flex>
                    <v-flex sm6 xs8>
65d5475b6   Shikha Mishra   changes in api an...
218
                      <h5 class="my-1">{{ editedItem.examId}}</h5>
0551a0f15   Neeraj Sharma   implemnet functio...
219
220
                    </v-flex>
                  </v-layout>
68d742034   Neeraj Sharma   implement new des...
221
222
223
224
225
226
227
228
229
230
231
232
233
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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
                  <v-layout>
                    <v-flex xs5 sm6>
                      <h5 class="right my-1">
                        <b>Class:</b>
                      </h5>
                    </v-flex>
                    <v-flex sm6 xs8>
                      <h5 class="my-1">{{ editedItem.classId }}</h5>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs5 sm6>
                      <h5 class="right my-1">
                        <b>Section:</b>
                      </h5>
                    </v-flex>
                    <v-flex sm6 xs8>
                      <h5 class="my-1">{{ editedItem.sectionId }}</h5>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs5 sm6>
                      <h5 class="right my-1">
                        <b>Subject Name:</b>
                      </h5>
                    </v-flex>
                    <v-flex sm6 xs8>
                      <h5 class="my-1">{{ editedItem.subjectName }}</h5>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs5 sm6>
                      <h5 class="right my-1">
                        <b>Date:</b>
                      </h5>
                    </v-flex>
                    <v-flex sm6 xs8>
                      <h5 class="my-1">{{ dates(editedItem.date) }}</h5>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs5 sm6>
                      <h5 class="right my-1">
                        <b>Time From:</b>
                      </h5>
                    </v-flex>
                    <v-flex sm6 xs8>
                      <h5 class="my-1">{{ editedItem.timeFrom }}</h5>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs5 sm6>
                      <h5 class="right my-1">
                        <b>Time To:</b>
                      </h5>
                    </v-flex>
                    <v-flex sm6 xs8>
                      <h5 class="my-1">{{ editedItem.timeTo }}</h5>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs5 sm6>
                      <h5 class="right my-1">
                        <b>Room:</b>
                      </h5>
                    </v-flex>
                    <v-flex sm6 xs8>
                      <h5 class="my-1">{{ editedItem.room }}</h5>
                    </v-flex>
                  </v-layout>
                </v-flex>
              </v-layout>
            </v-container>
          </v-card-text>
        </v-card>
      </v-dialog>
      <!-- *****  Exam Schedule TABLE****** -->
      <v-toolbar color="transparent" flat>
        <v-btn
          fab
          dark
          class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only"
          small
          @click="addExamScheduleDialog = true"
        >
          <v-icon dark>add</v-icon>
        </v-btn>
        <v-btn
710438de6   Shikha Mishra   added teacher mod...
309
          v-if="role != 'TEACHER' "
68d742034   Neeraj Sharma   implement new des...
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
          round
          class="open-dialog-button hidden-sm-only hidden-xs-only"
          dark
          @click="addExamScheduleDialog = true"
        >
          <v-icon class="white--text pr-1" size="20">add</v-icon>Add Exam Schedule
        </v-btn>
        <v-spacer></v-spacer>
        <v-flex xs8 sm3 md2 class="mr-3">
          <v-select
            v-model="getScheduleData.classId"
            label="Select your class"
            type="text"
            :items="classList"
            item-text="classNum"
            item-value="_id"
b039d39fb   Shikha Mishra   Hide Edit functio...
326
327
328
329
330
331
332
333
334
335
336
337
338
            @change="getSections(getScheduleData.classId)"
            required
          ></v-select>
        </v-flex>
        <v-flex xs8 sm3 md2 class="mr-3">
          <v-select
            v-model="getScheduleData.sectionId"
            label="Select your section"
            type="text"
            :items="addSection"
            item-text="name"
            item-value="_id"
            @change="getSchedulesList(getScheduleData.classId,getScheduleData.sectionId)"
68d742034   Neeraj Sharma   implement new des...
339
340
341
342
343
344
            required
          ></v-select>
        </v-flex>
        <v-card-title class="body-1" v-show="show">
          <v-btn icon large flat @click="displaySearch">
            <v-avatar size="27">
aa310d61a   Shikha Mishra   added functionali...
345
              <img src="/static/icon/search.png" alt="icon" />
68d742034   Neeraj Sharma   implement new des...
346
347
348
            </v-avatar>
          </v-btn>
        </v-card-title>
612b79bb4   Amber Dev   made serch auto f...
349
        <v-flex xs8 sm8 md3 lg2 v-if="showSearch">
68d742034   Neeraj Sharma   implement new des...
350
          <v-layout>
8e8d14254   Shikha Mishra   Cleared data whil...
351
352
353
354
355
356
357
            <v-text-field
              autofocus
              v-model="search"
              label="Search"
              prepend-inner-icon="search"
              color="primary"
            ></v-text-field>
68d742034   Neeraj Sharma   implement new des...
358
359
360
361
362
363
364
365
366
367
368
369
370
            <v-icon @click="closeSearch" color="error">close</v-icon>
          </v-layout>
        </v-flex>
      </v-toolbar>
      <v-data-table
        :headers="headers"
        :items="ScheduleData"
        :pagination.sync="pagination"
        :search="search"
      >
        <template slot="items" slot-scope="props">
          <tr class="tr">
            <td class="td td-row">{{ props.index + 1}}</td>
65d5475b6   Shikha Mishra   changes in api an...
371
            <td class="td td-row text-xs-center">{{ props.item.examId.examName}}</td>
68d742034   Neeraj Sharma   implement new des...
372
            <td class="td td-row text-xs-center">{{ props.item.classId.classNum}}</td>
68d742034   Neeraj Sharma   implement new des...
373
374
375
376
            <td class="td td-row text-xs-center">{{ props.item.subjectName }}</td>
            <td class="td td-row text-xs-center">{{ dates(props.item.date) }}</td>
            <td class="td td-row text-xs-center">{{ props.item.timeFrom }} - {{ props.item.timeTo }}</td>
            <td class="td td-row text-xs-center">{{ props.item.room }}</td>
7281a47c4   Shikha Mishra   show class name a...
377
            <td class="td td-row text-xs-center">
68d742034   Neeraj Sharma   implement new des...
378
              <span>
fe0d05d29   Neeraj Sharma   complete design a...
379
                <v-tooltip top>
68d742034   Neeraj Sharma   implement new des...
380
381
382
383
384
                  <img
                    slot="activator"
                    style="cursor:pointer; width:25px; height:25px; "
                    class="mr-3"
                    @click="profile(props.item)"
aa310d61a   Shikha Mishra   added functionali...
385
                    src="/static/icon/view.png"
68d742034   Neeraj Sharma   implement new des...
386
387
388
                  />
                  <span>View</span>
                </v-tooltip>
7281a47c4   Shikha Mishra   show class name a...
389
                <v-tooltip top v-if="role != 'TEACHER' ">
68d742034   Neeraj Sharma   implement new des...
390
391
392
393
394
                  <img
                    slot="activator"
                    style="cursor:pointer; width:20px; height:18px; "
                    class="mr-3"
                    @click="editItem(props.item)"
aa310d61a   Shikha Mishra   added functionali...
395
                    src="/static/icon/edit.png"
68d742034   Neeraj Sharma   implement new des...
396
397
398
                  />
                  <span>Edit</span>
                </v-tooltip>
7281a47c4   Shikha Mishra   show class name a...
399
                <v-tooltip top v-if="role != 'TEACHER' ">
68d742034   Neeraj Sharma   implement new des...
400
401
402
                  <img
                    slot="activator"
                    style="cursor:pointer; width:20px; height:20px; "
65d5475b6   Shikha Mishra   changes in api an...
403
                    @click="deleteSchedule(props.item)"
aa310d61a   Shikha Mishra   added functionali...
404
                    src="/static/icon/delete.png"
68d742034   Neeraj Sharma   implement new des...
405
406
407
408
409
410
411
412
413
414
415
416
417
418
                  />
                  <span>Delete</span>
                </v-tooltip>
              </span>
            </td>
          </tr>
        </template>
        <v-alert
          slot="no-results"
          :value="true"
          color="error"
          icon="warning"
        >Your search for "{{ search }}" found no results.</v-alert>
      </v-data-table>
0551a0f15   Neeraj Sharma   implemnet functio...
419

68d742034   Neeraj Sharma   implement new des...
420
      <!-- ****** ADD  Exam Schedule ****** -->
8e8d14254   Shikha Mishra   Cleared data whil...
421
      <v-dialog v-model="addExamScheduleDialog" max-width="600" v-if="addExamScheduleDialog">
68d742034   Neeraj Sharma   implement new des...
422
423
424
        <v-card flat class="card-style pa-2" dark>
          <v-layout>
            <v-flex xs12>
8c3acf4a9   Shikha Mishra   improve details
425
              <label class="title text-xs-center">Add Exam Schedule</label>
8e8d14254   Shikha Mishra   Cleared data whil...
426
427
428
429
430
              <v-icon
                size="24"
                class="right"
                @click="$refs.form.reset();addExamScheduleDialog = false"
              >cancel</v-icon>
68d742034   Neeraj Sharma   implement new des...
431
432
433
434
435
436
437
438
439
440
441
442
            </v-flex>
          </v-layout>
          <v-form ref="form" v-model="valid" lazy-validation>
            <v-container fluid>
              <v-flex xs12>
                <v-layout>
                  <v-flex xs5 class="pt-4 subheading">
                    <label class="right">Exam Name:</label>
                  </v-flex>
                  <v-flex xs7 sm7 md6 class="ml-3">
                    <v-select
                      label="Select your Exam Name"
65d5475b6   Shikha Mishra   changes in api an...
443
                      :rules="examRules"
68d742034   Neeraj Sharma   implement new des...
444
                      :items="examList"
65d5475b6   Shikha Mishra   changes in api an...
445
                      v-model="addSchedule.examId"
68d742034   Neeraj Sharma   implement new des...
446
                      item-text="examName"
65d5475b6   Shikha Mishra   changes in api an...
447
                      item-value="_id"
68d742034   Neeraj Sharma   implement new des...
448
449
450
451
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
0551a0f15   Neeraj Sharma   implemnet functio...
452
453
              <v-flex xs12>
                <v-layout>
68d742034   Neeraj Sharma   implement new des...
454
                  <v-flex xs5 class="pt-4 subheading">
0551a0f15   Neeraj Sharma   implemnet functio...
455
456
                    <label class="right">Class:</label>
                  </v-flex>
68d742034   Neeraj Sharma   implement new des...
457
                  <v-flex xs7 sm7 md6 class="ml-3">
0551a0f15   Neeraj Sharma   implemnet functio...
458
                    <v-select
68d742034   Neeraj Sharma   implement new des...
459
                      v-model="addSchedule.classId"
0551a0f15   Neeraj Sharma   implemnet functio...
460
461
462
463
464
                      label="Select your class"
                      type="text"
                      :items="classList"
                      item-text="classNum"
                      item-value="_id"
68d742034   Neeraj Sharma   implement new des...
465
466
                      :rules="classRules"
                      @change="getSections(addSchedule.classId)"
0551a0f15   Neeraj Sharma   implemnet functio...
467
468
469
470
471
                      required
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
68d742034   Neeraj Sharma   implement new des...
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
              <v-flex xs12>
                <v-layout>
                  <v-flex xs5 class="pt-4 subheading">
                    <label class="right">Section:</label>
                  </v-flex>
                  <v-flex xs7 sm7 md6 class="ml-3">
                    <v-select
                      :items="addSection"
                      label="Select Section"
                      v-model="addSchedule.sectionId"
                      item-text="name"
                      item-value="_id"
                      name="Select Section"
                      :rules="sectionRules"
                      required
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
              <v-flex xs12>
                <v-layout>
                  <v-flex xs5 class="pt-4 subheading">
                    <label class="right">Subject Name:</label>
                  </v-flex>
                  <v-flex xs7 sm7 md6 class="ml-3">
                    <v-select
                      :items="subjects"
                      label="Select Subject"
                      v-model="addSchedule.subjectName"
                      item-text="subjectName"
                      item-value="subjectName"
                      name="Select Section"
                      :rules="subjectRules"
                      required
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
              <v-flex xs12>
                <v-layout>
                  <v-flex xs5 class="pt-4 subheading">
                    <label class="right">Date:</label>
                  </v-flex>
                  <v-flex xs7 sm7 md6 class="ml-3">
                    <v-menu
                      ref="menu2"
                      :close-on-content-click="false"
                      v-model="menu2"
                      :nudge-right="40"
                      :return-value.sync="addSchedule.date"
                      lazy
                      transition="scale-transition"
                      offset-y
                      full-width
                      min-width="290px"
                    >
                      <v-text-field
                        slot="activator"
                        v-model="addSchedule.date"
                        :rules="examScheduleDateRules"
                        label="Select Date"
                        append-icon="event"
                        readonly
                      ></v-text-field>
                      <v-date-picker
                        v-model="addSchedule.date"
                        @input="$refs.menu2.save(addSchedule.date)"
                      ></v-date-picker>
                    </v-menu>
                  </v-flex>
                </v-layout>
              </v-flex>
              <v-flex xs12>
                <v-layout>
                  <v-flex xs5 class="pt-4 subheading">
                    <label class="right">Time From:</label>
                  </v-flex>
                  <v-flex xs7 sm7 md6 class="ml-3">
                    <v-menu
                      ref="menuA"
                      :close-on-content-click="false"
                      v-model="menuB"
                      :nudge-right="40"
                      :return-value.sync="addSchedule.timeFrom"
                      lazy
                      transition="scale-transition"
                      offset-y
                      full-width
                      max-width="290px"
                      min-width="290px"
                    >
                      <v-text-field
                        slot="activator"
                        v-model="addSchedule.timeIn"
                        label="Select your time From"
                        append-icon="access_time"
                        :rules="timeInRules"
                        readonly
                      ></v-text-field>
                      <v-time-picker
                        v-model="addSchedule.timeIn"
                        @change="$refs.menuA.save(addSchedule.timeIn)"
                      ></v-time-picker>
                    </v-menu>
                  </v-flex>
                </v-layout>
              </v-flex>
              <v-flex xs12>
                <v-layout>
                  <v-flex xs5 class="pt-4 subheading">
                    <label class="right">Time To:</label>
                  </v-flex>
                  <v-flex xs7 sm7 md6 class="ml-3">
                    <v-menu
                      ref="menu"
                      :close-on-content-click="false"
                      v-model="menu1"
                      :nudge-right="40"
                      :return-value.sync="addSchedule.timeTo"
                      lazy
                      transition="scale-transition"
                      offset-y
                      full-width
                      max-width="290px"
                      min-width="290px"
                    >
                      <v-text-field
                        slot="activator"
                        v-model="addSchedule.timeTo"
                        label="Select your Time To"
                        append-icon="access_time"
                        :rules="timeOutRules"
                        readonly
                      ></v-text-field>
                      <v-time-picker
                        v-model="addSchedule.timeTo"
                        @change="$refs.menu.save(addSchedule.timeTo)"
                      ></v-time-picker>
                    </v-menu>
                  </v-flex>
                </v-layout>
              </v-flex>
              <v-flex xs12>
                <v-layout>
                  <v-flex xs5 class="pt-4 subheading">
                    <label class="right">Room:</label>
                  </v-flex>
                  <v-flex xs7 sm7 md6 class="ml-3">
                    <v-text-field
                      placeholder="fill your room"
                      :rules="roomRules"
                      v-model="addSchedule.room"
                      @keyup.enter="submit"
                    ></v-text-field>
                  </v-flex>
                </v-layout>
              </v-flex>
              <v-layout>
                <v-flex xs12>
                  <v-card-actions>
                    <v-spacer class="hidden-xs-only"></v-spacer>
                    <v-btn @click="clear" round dark class="clear-button">clear</v-btn>
                    <v-btn @click="submit" round dark :loading="loading" class="add-button">Add</v-btn>
                  </v-card-actions>
                </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>
0551a0f15   Neeraj Sharma   implemnet functio...
650
651
652
      <div class="loader" v-if="showLoader">
        <v-progress-circular indeterminate color="white"></v-progress-circular>
      </div>
68d742034   Neeraj Sharma   implement new des...
653
    </v-container>
0551a0f15   Neeraj Sharma   implemnet functio...
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
  </template>
  
  <script>
  import http from "@/Services/http.js";
  import moment from "moment";
  
  export default {
    data: () => ({
      snackbar: false,
      date: null,
      editDate: false,
      menu1: false,
      menuB: false,
      menu2: false,
      menuEdit: false,
      timeToEdit: false,
68d742034   Neeraj Sharma   implement new des...
670
671
672
      show: true,
      showSearch: false,
      addExamScheduleDialog: false,
0551a0f15   Neeraj Sharma   implemnet functio...
673
674
675
676
677
678
679
680
681
682
      color: "",
      y: "top",
      x: "right",
      mode: "",
      timeout: 10000,
      text: "",
      loading: false,
      date: null,
      search: "",
      showLoader: false,
68d742034   Neeraj Sharma   implement new des...
683
684
      editExamScheduleDialog: false,
      profileExamScheduleDialog: false,
0551a0f15   Neeraj Sharma   implemnet functio...
685
      valid: true,
fe0d05d29   Neeraj Sharma   complete design a...
686
      role: "",
0551a0f15   Neeraj Sharma   implemnet functio...
687
      pagination: {
8e8d14254   Shikha Mishra   Cleared data whil...
688
        rowsPerPage: 10,
0551a0f15   Neeraj Sharma   implemnet functio...
689
      },
8e8d14254   Shikha Mishra   Cleared data whil...
690
691
692
693
694
695
696
697
      examRules: [(v) => !!v || "Exam Name is required"],
      classRules: [(v) => !!v || "Class Name is required"],
      sectionRules: [(v) => !!v || "section is required"],
      subjectRules: [(v) => !!v || "Subject is required"],
      timeInRules: [(v) => !!v || "Time In is required"],
      timeOutRules: [(v) => !!v || "time Out s is required"],
      roomRules: [(v) => !!v || "Room is required"],
      examScheduleDateRules: [(v) => !!v || "Date is required"],
0551a0f15   Neeraj Sharma   implemnet functio...
698
699
      headers: [
        {
68d742034   Neeraj Sharma   implement new des...
700
          align: "",
0551a0f15   Neeraj Sharma   implemnet functio...
701
702
          text: "No",
          sortable: false,
8e8d14254   Shikha Mishra   Cleared data whil...
703
          value: "No",
0551a0f15   Neeraj Sharma   implemnet functio...
704
705
706
        },
        {
          text: "Exam Name",
65d5475b6   Shikha Mishra   changes in api an...
707
          vaue: "examId.examName",
0551a0f15   Neeraj Sharma   implemnet functio...
708
          sortable: false,
8e8d14254   Shikha Mishra   Cleared data whil...
709
          align: "center",
0551a0f15   Neeraj Sharma   implemnet functio...
710
711
712
713
714
        },
        {
          text: "Class",
          value: "classId.classNum",
          sortable: false,
8e8d14254   Shikha Mishra   Cleared data whil...
715
          align: "center",
0551a0f15   Neeraj Sharma   implemnet functio...
716
        },
c1975052a   Shikha Mishra   show data in table
717
718
719
720
721
722
        // {
        //   text: "Section",
        //   value: "sectionId.name",
        //   sortable: false,
        //   align: "center"
        // },
0551a0f15   Neeraj Sharma   implemnet functio...
723
724
725
726
        {
          text: "Subject Name",
          value: "subjectName",
          sortable: false,
8e8d14254   Shikha Mishra   Cleared data whil...
727
          align: "center",
0551a0f15   Neeraj Sharma   implemnet functio...
728
729
730
731
732
        },
        {
          text: "Date",
          value: "date",
          sortable: false,
8e8d14254   Shikha Mishra   Cleared data whil...
733
          align: "center",
0551a0f15   Neeraj Sharma   implemnet functio...
734
735
736
737
738
        },
        {
          text: "Time",
          value: "timeFrom",
          sortable: false,
8e8d14254   Shikha Mishra   Cleared data whil...
739
          align: "center",
0551a0f15   Neeraj Sharma   implemnet functio...
740
        },
fe0d05d29   Neeraj Sharma   complete design a...
741
        {
0551a0f15   Neeraj Sharma   implemnet functio...
742
743
744
          text: "Room",
          value: "room",
          sortable: false,
8e8d14254   Shikha Mishra   Cleared data whil...
745
          align: "center",
0551a0f15   Neeraj Sharma   implemnet functio...
746
        },
8e8d14254   Shikha Mishra   Cleared data whil...
747
        { text: "Action", value: "", sortable: false, align: "center" },
0551a0f15   Neeraj Sharma   implemnet functio...
748
749
      ],
      classList: [],
8627b2890   Shikha Mishra   set table fields ...
750
      addSection: [],
0551a0f15   Neeraj Sharma   implemnet functio...
751
752
753
      examList: [],
      subjects: [],
      addSchedule: {},
c1975052a   Shikha Mishra   show data in table
754
755
      editedItem: {
        sectionId: {
8e8d14254   Shikha Mishra   Cleared data whil...
756
757
          name: "",
        },
c1975052a   Shikha Mishra   show data in table
758
      },
0551a0f15   Neeraj Sharma   implemnet functio...
759
760
      getScheduleData: {},
      ScheduleData: [],
8e8d14254   Shikha Mishra   Cleared data whil...
761
      token: "",
0551a0f15   Neeraj Sharma   implemnet functio...
762
    }),
8e8d14254   Shikha Mishra   Cleared data whil...
763
764
765
766
767
768
769
    watch: {
      addExamScheduleDialog: function (val) {
        if (!val) {
          this.addSchedule = [];
        }
      },
    },
0551a0f15   Neeraj Sharma   implemnet functio...
770
    methods: {
8e8d14254   Shikha Mishra   Cleared data whil...
771
      dates: function (date) {
0551a0f15   Neeraj Sharma   implemnet functio...
772
773
774
775
776
777
        return moment(date).format("MMMM DD, YYYY");
      },
      pickFile() {
        this.$refs.image.click();
      },
      getSchedulesList() {
fe0d05d29   Neeraj Sharma   complete design a...
778
779
780
        if (this.addSchedule.classId) {
          this.getScheduleData.classId = this.addSchedule.classId;
        }
0551a0f15   Neeraj Sharma   implemnet functio...
781
782
783
        this.showLoader = true;
        http()
          .get("/getSchedulesList", {
b039d39fb   Shikha Mishra   Hide Edit functio...
784
785
            params: {
              classId: this.getScheduleData.classId,
8e8d14254   Shikha Mishra   Cleared data whil...
786
              sectionId: this.getScheduleData.sectionId,
b039d39fb   Shikha Mishra   Hide Edit functio...
787
            },
8e8d14254   Shikha Mishra   Cleared data whil...
788
            headers: { Authorization: "Bearer " + this.token },
0551a0f15   Neeraj Sharma   implemnet functio...
789
          })
8e8d14254   Shikha Mishra   Cleared data whil...
790
          .then((response) => {
68d742034   Neeraj Sharma   implement new des...
791
792
            this.ScheduleData = response.data.data;
            // console.log("this.ScheduleData", this.ScheduleData);
0551a0f15   Neeraj Sharma   implemnet functio...
793
794
            this.showLoader = false;
          })
8e8d14254   Shikha Mishra   Cleared data whil...
795
          .catch((error) => {
0551a0f15   Neeraj Sharma   implemnet functio...
796
797
798
799
            // console.log("err====>", err);
            this.showLoader = false;
            this.loadingSearch = false;
            this.snackbar = true;
b039d39fb   Shikha Mishra   Hide Edit functio...
800
            this.color = "error";
0551a0f15   Neeraj Sharma   implemnet functio...
801
802
803
804
805
806
807
808
809
            this.text = error.response.data.message;
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
            }
          });
      },
      editItem(item) {
68d742034   Neeraj Sharma   implement new des...
810
        // console.log("item", item);
0551a0f15   Neeraj Sharma   implemnet functio...
811
812
        this.editedIndex = this.ScheduleData.indexOf(item);
        this.editedItem = Object.assign({}, item);
fe0d05d29   Neeraj Sharma   complete design a...
813
        this.editedItem.examId = this.editedItem.examId._id;
0551a0f15   Neeraj Sharma   implemnet functio...
814
        this.editedItem.classId = this.editedItem.classId._id;
b039d39fb   Shikha Mishra   Hide Edit functio...
815
816
817
818
        this.editedItem.sectionId =
          this.editedItem.sectionId === null
            ? (this.editedItem.sectionId = this.editedItem.sectionId = "")
            : this.editedItem.sectionId._id;
0551a0f15   Neeraj Sharma   implemnet functio...
819
820
821
822
        this.editedItem.date =
          this.editedItem.date != undefined
            ? (this.editedItem.date = this.editedItem.date.substring(0, 10))
            : (this.editedItem.date = "");
68d742034   Neeraj Sharma   implement new des...
823
        this.editExamScheduleDialog = true;
0551a0f15   Neeraj Sharma   implemnet functio...
824
825
826
827
      },
      profile(item) {
        this.editedIndex = this.ScheduleData.indexOf(item);
        this.editedItem = Object.assign({}, item);
65d5475b6   Shikha Mishra   changes in api an...
828
        this.editedItem.examId = this.editedItem.examId.examName;
0551a0f15   Neeraj Sharma   implemnet functio...
829
        this.editedItem.classId = this.editedItem.classId.classNum;
b039d39fb   Shikha Mishra   Hide Edit functio...
830
831
832
833
        this.editedItem.sectionId =
          this.editedItem.sectionId === null
            ? (this.editedItem.sectionId = this.editedItem.sectionId = "")
            : this.editedItem.sectionId.name;
68d742034   Neeraj Sharma   implement new des...
834
        this.profileExamScheduleDialog = true;
0551a0f15   Neeraj Sharma   implemnet functio...
835
836
837
      },
      deleteSchedule(item) {
        let deleteSchedule = {
8e8d14254   Shikha Mishra   Cleared data whil...
838
          scheduleId: item._id,
0551a0f15   Neeraj Sharma   implemnet functio...
839
840
841
842
843
        };
        http()
          .delete(
            "/deleteSchedule",
            confirm("Are you sure you want to Delete this?") && {
8e8d14254   Shikha Mishra   Cleared data whil...
844
              params: deleteSchedule,
0551a0f15   Neeraj Sharma   implemnet functio...
845
846
            }
          )
8e8d14254   Shikha Mishra   Cleared data whil...
847
          .then((response) => {
0551a0f15   Neeraj Sharma   implemnet functio...
848
            this.snackbar = true;
68d742034   Neeraj Sharma   implement new des...
849
850
            this.text = response.data.message;
            this.color = "green";
0551a0f15   Neeraj Sharma   implemnet functio...
851
852
            this.getSchedulesList();
          })
8e8d14254   Shikha Mishra   Cleared data whil...
853
          .catch((error) => {
68d742034   Neeraj Sharma   implement new des...
854
855
856
            this.snackbar = true;
            this.color = "error";
            this.text = error.response.data.message;
0551a0f15   Neeraj Sharma   implemnet functio...
857
858
          });
      },
0551a0f15   Neeraj Sharma   implemnet functio...
859
860
861
      close() {
        this.dialog = false;
      },
0551a0f15   Neeraj Sharma   implemnet functio...
862
      submit() {
0551a0f15   Neeraj Sharma   implemnet functio...
863
        if (this.$refs.form.validate()) {
e0f163768   Neeraj Sharma   fixed valiadtion ...
864
          this.loading = true;
0551a0f15   Neeraj Sharma   implemnet functio...
865
866
          http()
            .post("/createSchedule", this.addSchedule)
8e8d14254   Shikha Mishra   Cleared data whil...
867
            .then((response) => {
fe0d05d29   Neeraj Sharma   complete design a...
868
              this.loading = false;
0551a0f15   Neeraj Sharma   implemnet functio...
869
              this.snackbar = true;
68d742034   Neeraj Sharma   implement new des...
870
              this.text = response.data.message;
e0f163768   Neeraj Sharma   fixed valiadtion ...
871
              this.color = "green";
fe0d05d29   Neeraj Sharma   complete design a...
872
873
              this.addExamScheduleDialog = false;
              this.getSchedulesList();
0551a0f15   Neeraj Sharma   implemnet functio...
874
875
              this.clear();
            })
8e8d14254   Shikha Mishra   Cleared data whil...
876
            .catch((error) => {
e0f163768   Neeraj Sharma   fixed valiadtion ...
877
878
879
880
              this.snackbar = true;
              this.text = error.response.data.message;
              this.color = "red";
              this.loading = false;
0551a0f15   Neeraj Sharma   implemnet functio...
881
882
883
884
885
886
887
888
            });
        }
      },
      clear() {
        this.$refs.form.reset();
        this.disable = false;
        this.loading = false;
      },
e8965626f   Shikha Mishra   set login design ...
889
      update() {
0551a0f15   Neeraj Sharma   implemnet functio...
890
891
892
        this.editedItem.scheduleId = this.editedItem._id;
        http()
          .put("/updateSchedule", this.editedItem)
8e8d14254   Shikha Mishra   Cleared data whil...
893
          .then((response) => {
0551a0f15   Neeraj Sharma   implemnet functio...
894
895
896
            this.snackbar = true;
            this.text = "Successfully Edit Exam Schedule";
            this.color = "green";
fe0d05d29   Neeraj Sharma   complete design a...
897
            this.editExamScheduleDialog = false;
0551a0f15   Neeraj Sharma   implemnet functio...
898
899
900
            this.getSchedulesList();
            this.close();
          })
8e8d14254   Shikha Mishra   Cleared data whil...
901
          .catch((error) => {
0551a0f15   Neeraj Sharma   implemnet functio...
902
            this.snackbar = true;
b039d39fb   Shikha Mishra   Hide Edit functio...
903
904
905
            this.text = error.response.data.messages;
            this.color = "error";
            this.loading = false;
0551a0f15   Neeraj Sharma   implemnet functio...
906
907
908
909
910
          });
      },
      getClass() {
        http()
          .get("/getClassesList", {
8e8d14254   Shikha Mishra   Cleared data whil...
911
            headers: { Authorization: "Bearer " + this.token },
0551a0f15   Neeraj Sharma   implemnet functio...
912
          })
8e8d14254   Shikha Mishra   Cleared data whil...
913
          .then((response) => {
0551a0f15   Neeraj Sharma   implemnet functio...
914
            this.classList = response.data.data;
0551a0f15   Neeraj Sharma   implemnet functio...
915
          })
8e8d14254   Shikha Mishra   Cleared data whil...
916
          .catch((err) => {
0551a0f15   Neeraj Sharma   implemnet functio...
917
918
919
920
            // console.log("err====>", err);
          });
      },
      getSections(_id) {
0551a0f15   Neeraj Sharma   implemnet functio...
921
922
        for (let i = 0; i < this.classList.length; i++) {
          if (_id == this.classList[i]._id) {
0551a0f15   Neeraj Sharma   implemnet functio...
923
924
925
926
927
928
929
930
            this.subjects = this.classList[i].subjects;
          }
        }
        http()
          .get(
            "/getSectionsList",
            { params: { classId: _id } },
            {
8e8d14254   Shikha Mishra   Cleared data whil...
931
              headers: { Authorization: "Bearer " + this.token },
0551a0f15   Neeraj Sharma   implemnet functio...
932
933
            }
          )
8e8d14254   Shikha Mishra   Cleared data whil...
934
          .then((response) => {
0551a0f15   Neeraj Sharma   implemnet functio...
935
936
            this.addSection = response.data.data;
          })
8e8d14254   Shikha Mishra   Cleared data whil...
937
          .catch((err) => {});
0551a0f15   Neeraj Sharma   implemnet functio...
938
939
940
941
942
943
      },
      getExamList() {
        this.showLoader = true;
        this.loadingSearch = true;
        http()
          .get("/getExamsList", {
8e8d14254   Shikha Mishra   Cleared data whil...
944
            headers: { Authorization: "Bearer " + this.token },
0551a0f15   Neeraj Sharma   implemnet functio...
945
          })
8e8d14254   Shikha Mishra   Cleared data whil...
946
          .then((response) => {
0551a0f15   Neeraj Sharma   implemnet functio...
947
948
949
950
            this.examList = response.data.data;
            this.showLoader = false;
            this.loadingSearch = false;
          })
8e8d14254   Shikha Mishra   Cleared data whil...
951
          .catch((error) => {
0551a0f15   Neeraj Sharma   implemnet functio...
952
953
954
955
956
957
958
959
960
961
            this.showLoader = false;
            this.loadingSearch = false;
            this.snackbar = true;
            this.text = error.response.data.message;
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
            }
          });
68d742034   Neeraj Sharma   implement new des...
962
963
964
965
966
967
968
969
      },
      displaySearch() {
        (this.show = false), (this.showSearch = true);
      },
      closeSearch() {
        this.showSearch = false;
        this.show = true;
        this.search = "";
8e8d14254   Shikha Mishra   Cleared data whil...
970
      },
0551a0f15   Neeraj Sharma   implemnet functio...
971
972
973
    },
    mounted() {
      this.token = this.$store.state.token;
0551a0f15   Neeraj Sharma   implemnet functio...
974
975
      this.getClass();
      this.getExamList();
710438de6   Shikha Mishra   added teacher mod...
976
      this.role = this.$store.state.role;
8e8d14254   Shikha Mishra   Cleared data whil...
977
    },
0551a0f15   Neeraj Sharma   implemnet functio...
978
  };
68d742034   Neeraj Sharma   implement new des...
979
  </script>