Blame view

src/pages/Academic/routine.vue 37.4 KB
710438de6   Shikha Mishra   added teacher mod...
1
2
3
4
5
6
7
  <template>
    <v-container fluid class="body-color">
      <!-- ****** EDIT  Subject ****** -->
      <v-dialog v-model="editRoutineDialog" max-width="600px">
        <v-card flat class="card-style pa-2" dark>
          <v-layout>
            <v-flex xs12>
5ceb88b44   Shikha Mishra   added pdf option ...
8
              <label class="title text-xs-center">Edit Routine</label>
710438de6   Shikha Mishra   added teacher mod...
9
10
11
12
13
14
              <v-icon size="24" class="right" @click="editRoutineDialog = false">cancel</v-icon>
            </v-flex>
          </v-layout>
          <v-container fluid>
            <v-form ref="formEditRoutine" v-model="validEditRoutine" lazy-validation>
              <v-layout>
5ceb88b44   Shikha Mishra   added pdf option ...
15
16
17
18
19
20
21
22
23
24
                <v-flex xs4 sm4 class="pt-4 subheading">
                  <label class="right">School Year :</label>
                </v-flex>
                <v-flex xs8 sm8 class="ml-3">
                  <v-text-field v-model="editedItem.schoolYear" label="Select Year"></v-text-field>
                </v-flex>
              </v-layout>
              <v-layout>
                <v-flex xs4 sm4 class="pt-4 subheading">
                  <label class="right">Class :</label>
710438de6   Shikha Mishra   added teacher mod...
25
                </v-flex>
5ceb88b44   Shikha Mishra   added pdf option ...
26
                <v-flex xs8 sm8 class="ml-3">
710438de6   Shikha Mishra   added teacher mod...
27
                  <v-select
710438de6   Shikha Mishra   added teacher mod...
28
                    :items="classList"
5ceb88b44   Shikha Mishra   added pdf option ...
29
                    label="Select Class"
710438de6   Shikha Mishra   added teacher mod...
30
31
                    item-text="classNum"
                    item-value="_id"
5ceb88b44   Shikha Mishra   added pdf option ...
32
33
                    v-model="editedItem.classId"
                    name="Select Class"
710438de6   Shikha Mishra   added teacher mod...
34
                    :rules="classRules"
5ceb88b44   Shikha Mishra   added pdf option ...
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
                    @change="getSections(addRoutine.classId)"
                    class="pl-2"
                    required
                  ></v-select>
                </v-flex>
              </v-layout>
              <v-layout>
                <v-flex xs4 sm4 class="pt-4 subheading">
                  <label class="right">Section :</label>
                </v-flex>
                <v-flex xs8 sm8 class="ml-3">
                  <v-select
                    :items="addSection"
                    label="Select Section"
                    item-text="name"
                    item-value="_id"
                    v-model="editedItem.sectionId"
                    name="Select Section"
                    :rules="sectionRules"
                    @change="getClassSubject(addRoutine.classId)"
                    class="px-2"
                    required
                  ></v-select>
                </v-flex>
              </v-layout>
              <v-layout>
                <v-flex xs3 sm4 class="pt-4 subheading">
                  <label class="right">Subject :</label>
                </v-flex>
                <v-flex xs8 sm8 class="ml-2">
                  <v-select
                    :items="subjectList.subjects"
                    label="Select your subject"
                    v-model="editedItem.subjectName"
                    item-text="subjectName"
                    item-value="_id"
                    :rules="subjectRules"
                    required
                  ></v-select>
                </v-flex>
              </v-layout>
              <v-layout>
                <v-flex xs3 sm4 class="pt-4 subheading">
                  <label class="right">Day :</label>
                </v-flex>
                <v-flex xs8 sm8 class="ml-2">
                  <v-select
                    :items="day"
                    label="Select your day"
                    v-model="editedItem.day"
                    item-text="text"
                    :rules="dayRules"
710438de6   Shikha Mishra   added teacher mod...
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
                    required
                  ></v-select>
                </v-flex>
              </v-layout>
              <v-layout>
                <v-flex xs4 sm4 class="pt-4 subheading">
                  <label class="right">Teacher Name :</label>
                </v-flex>
                <v-flex xs8 sm8 class="ml-3">
                  <v-select
                    v-model="editedItem.teacherId"
                    label="Select your teacher"
                    type="text"
                    :items="teacherList"
                    item-text="name"
                    item-value="_id"
                    :rules="teacherRules"
                    required
                  ></v-select>
                </v-flex>
              </v-layout>
              <v-layout>
                <v-flex xs4 sm4 class="pt-4 subheading">
5ceb88b44   Shikha Mishra   added pdf option ...
110
                  <label class="right">Starting time:</label>
710438de6   Shikha Mishra   added teacher mod...
111
112
                </v-flex>
                <v-flex xs8 sm8 class="ml-3">
5ceb88b44   Shikha Mishra   added pdf option ...
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
                  <v-menu
                    ref="menuA"
                    :close-on-content-click="false"
                    v-model="menuB"
                    :nudge-right="40"
                    :return-value.sync="addRoutine.startingTime"
                    lazy
                    transition="scale-transition"
                    offset-y
                    full-width
                    max-width="290px"
                    min-width="290px"
                  >
                    <v-text-field
                      slot="activator"
                      v-model="editedItem.startingTime"
                      label="Select your starting time"
                      append-icon="access_time"
                      :rules="timeInRules"
                      readonly
                    ></v-text-field>
                    <v-time-picker
                      v-model="editedItem.startingTime"
                      @change="$refs.menuA.save(addRoutine.startingTime)"
                    ></v-time-picker>
                  </v-menu>
710438de6   Shikha Mishra   added teacher mod...
139
140
141
142
                </v-flex>
              </v-layout>
              <v-layout>
                <v-flex xs4 sm4 class="pt-4 subheading">
5ceb88b44   Shikha Mishra   added pdf option ...
143
                  <label class="right">Ending Time:</label>
710438de6   Shikha Mishra   added teacher mod...
144
145
                </v-flex>
                <v-flex xs8 sm8 class="ml-3">
5ceb88b44   Shikha Mishra   added pdf option ...
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
                  <v-menu
                    ref="menu"
                    :close-on-content-click="false"
                    v-model="menu1"
                    :nudge-right="40"
                    :return-value.sync="addRoutine.endingTime"
                    lazy
                    transition="scale-transition"
                    offset-y
                    full-width
                    max-width="290px"
                    min-width="290px"
                  >
                    <v-text-field
                      slot="activator"
                      v-model="editedItem.endingTime"
                      label="Select your end time"
                      append-icon="access_time"
                      :rules="timeOutRules"
                      readonly
                    ></v-text-field>
                    <v-time-picker
                      v-model="editedItem.endingTime"
                      @change="$refs.menu.save(addRoutine.endingTime)"
                    ></v-time-picker>
                  </v-menu>
710438de6   Shikha Mishra   added teacher mod...
172
173
174
                </v-flex>
              </v-layout>
              <v-layout>
5ceb88b44   Shikha Mishra   added pdf option ...
175
176
                <v-flex xs4 sm4 class="pt-4 subheading">
                  <label class="right">Room:</label>
710438de6   Shikha Mishra   added teacher mod...
177
                </v-flex>
5ceb88b44   Shikha Mishra   added pdf option ...
178
                <v-flex xs8 sm8 class="ml-3">
710438de6   Shikha Mishra   added teacher mod...
179
                  <v-text-field
5ceb88b44   Shikha Mishra   added pdf option ...
180
181
182
183
                    label="fill your room"
                    :rules="roomRules"
                    v-model="editedItem.room"
                    @keyup.enter="submit"
710438de6   Shikha Mishra   added teacher mod...
184
185
186
187
188
                  ></v-text-field>
                </v-flex>
              </v-layout>
              <v-layout>
                <v-flex xs4 sm4 class="pt-4 subheading">
5ceb88b44   Shikha Mishra   added pdf option ...
189
                  <label class="right">Period:</label>
710438de6   Shikha Mishra   added teacher mod...
190
191
192
                </v-flex>
                <v-flex xs8 sm8 class="ml-3">
                  <v-text-field
5ceb88b44   Shikha Mishra   added pdf option ...
193
194
195
196
                    label="fill your period"
                    :rules="periodRules"
                    v-model="editedItem.period"
                    @keyup.enter="submit"
710438de6   Shikha Mishra   added teacher mod...
197
198
199
200
                  ></v-text-field>
                </v-flex>
              </v-layout>
              <v-layout>
5ceb88b44   Shikha Mishra   added pdf option ...
201
202
203
204
205
206
207
208
209
210
211
                <v-flex xs12 sm12>
                  <v-card-actions>
                    <v-spacer></v-spacer>
                    <v-btn
                      @click="update"
                      round
                      dark
                      :loading="loading"
                      class="add-button"
                    >Update Routine</v-btn>
                  </v-card-actions>
710438de6   Shikha Mishra   added teacher mod...
212
213
                </v-flex>
              </v-layout>
710438de6   Shikha Mishra   added teacher mod...
214
215
216
217
            </v-form>
          </v-container>
        </v-card>
      </v-dialog>
5ceb88b44   Shikha Mishra   added pdf option ...
218
      <!-- ****** EXISTING ROUTINE TABLE ****** -->
710438de6   Shikha Mishra   added teacher mod...
219
220
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
      <v-toolbar color="transparent" flat>
        <v-btn
          fab
          dark
          class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only"
          small
          @click="addRoutineDialog = 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="addRoutineDialog = true"
            v-if="role != 'TEACHER' "
          >
            <v-icon class="white--text pr-1" size="20">add</v-icon>Add Routine
          </v-btn>
        </v-flex>
        <v-spacer></v-spacer>
        <v-flex lg2 md2 xs12 v-show="show">
          <v-select
            :items="classList"
            label="Select Your Class"
            v-model="addRoutine.classId"
            item-text="classNum"
            item-value="_id"
            name="Select Class"
            :rules="classRules"
            @change="getSections(addRoutine.classId)"
            class="pl-2"
            required
          ></v-select>
        </v-flex>
        <v-flex xs8 sm3 md2 class="mr-3">
          <v-select
            v-model="addRoutine.sectionId"
            label="Select your section"
710438de6   Shikha Mishra   added teacher mod...
259
260
261
            :items="addSection"
            item-text="name"
            item-value="_id"
5ceb88b44   Shikha Mishra   added pdf option ...
262
263
            name="Select Section"
            :rules="sectionRules"
710438de6   Shikha Mishra   added teacher mod...
264
            @change="getRoutineList()"
5ceb88b44   Shikha Mishra   added pdf option ...
265
            class="pl-2"
710438de6   Shikha Mishra   added teacher mod...
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
            required
          ></v-select>
        </v-flex>
        <v-card-title class="body-1" v-show="show">
          <v-btn icon flat @click="displaySearch">
            <v-avatar size="27">
              <img src="/static/icon/search.png" alt="icon" />
            </v-avatar>
          </v-btn>
        </v-card-title>
        <v-flex xs9 sm9 md2 lg2 xl2 v-show="showSearch">
          <v-layout>
            <v-text-field
              v-model="search"
              label="Search"
              prepend-inner-icon="search"
              color="primary"
              style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important"
            ></v-text-field>
            <v-icon @click="closeSearch" color="error">close</v-icon>
          </v-layout>
        </v-flex>
      </v-toolbar>
  
      <div class="col-sm-12">
5ceb88b44   Shikha Mishra   added pdf option ...
291
292
293
294
295
296
297
298
299
        <div class="box-body">
          <div class="row">
            <div class="col-sm-12">
              <div class="nav-tabs-custom">
                <ul class="nav nav-tabs">
                  <li class="active">
                    <a data-toggle="tab" href="#all" aria-expanded="true">All Routines</a>
                  </li>
                </ul>
710438de6   Shikha Mishra   added teacher mod...
300

5ceb88b44   Shikha Mishra   added pdf option ...
301
302
                <div class="tab-content" v-show="hideTable">
                  <div id="all" class="tab-pane active mCustomScrollbar _mCS_1 mCS_no_scrollbar">
710438de6   Shikha Mishra   added teacher mod...
303
                    <div
5ceb88b44   Shikha Mishra   added pdf option ...
304
305
306
307
                      id="mCSB_1"
                      class="mCustomScrollBox mCS-light"
                      style="max-height: none;"
                      tabindex="0"
710438de6   Shikha Mishra   added teacher mod...
308
                    >
5ceb88b44   Shikha Mishra   added pdf option ...
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
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
                      <div
                        id="mCSB_1_container"
                        class="mCSB_container mCS_x_hidden mCS_no_scrollbar_x"
                        style="position: relative; top: 0px; left: 0px; width: 100%;"
                        dir="ltr"
                      >
                        <div id="hide-table-2">
                          <table id="table" class="table table-striped">
                            <tbody>
                              <tr>
                                <td>MONDAY</td>
                              </tr>
                              <tr>
                                <td>TUESDAY</td>
                              </tr>
                              <tr>
                                <td>WEDNESDAY</td>
                              </tr>
                              <tr>
                                <td>THURSDAY</td>
                              </tr>
                              <tr>
                                <td>FRIDAY</td>
                              </tr>
                              <tr>
                                <td>SATURDAY</td>
                              </tr>
                            </tbody>
                          </table>
                        </div>
                      </div>
                      <div
                        id="mCSB_1_scrollbar_horizontal"
                        class="mCSB_scrollTools mCSB_1_scrollbar mCS-light mCSB_scrollTools_horizontal"
                        style="display: none;"
                      >
                        <div class="mCSB_draggerContainer">
                          <div
                            id="mCSB_1_dragger_horizontal"
                            class="mCSB_dragger"
                            style="position: absolute; min-width: 30px; width: 0px; left: 0px;"
                          >
                            <div class="mCSB_dragger_bar"></div>
                          </div>
                          <div class="mCSB_draggerRail"></div>
                        </div>
                      </div>
710438de6   Shikha Mishra   added teacher mod...
356
                    </div>
710438de6   Shikha Mishra   added teacher mod...
357
358
                  </div>
                </div>
5ceb88b44   Shikha Mishra   added pdf option ...
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
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
                <div>
                  <table id="table" class="table table-bordered" v-show="showTable">
                    <tbody>
                      <div class="nav-tabs-custom">
                        <div class="tab-content" id="scrolling">
                          <div id="hide-table-2">
                            <v-data-table :items="routineList">
                              <template slot="items" slot-scope="props">
                                <tr class="tr">
                                  <td>{{ props.item.day }}</td>
                                  <td class="text-center">
                                    <br />
                                    {{ props.item.classId.classNum }}
                                    <br />
                                    {{ props.item.sectionId.name }}
                                  </td>
                                  <td class="text-center" v-for="list in props.item.lectureRoutine">
                                    {{ list.startingTime }} - {{ list.endingTime }}
                                    <br />
                                    {{ list.room }}
                                    <br />
                                    {{ list.subjectName }}
                                    <br />
                                    {{ list.teacherId .name}}
                                    <br />
                                    <span>
                                      <v-tooltip top>
                                        <img
                                          slot="activator"
                                          style="cursor:pointer; width:20px; height:18px; "
                                          class="mr-3"
                                          @click="editItem()"
                                          src="/static/icon/edit.png"
                                        />
                                        <span>Edit</span>
                                      </v-tooltip>
                                      <v-tooltip top>
                                        <img
                                          slot="activator"
                                          style="cursor:pointer; width:20px; height:18px; "
                                          class="mr-3"
                                          @click="deleteItem(props.item)"
                                          src="/static/icon/delete.png"
                                        />
                                        <span>Delete</span>
                                      </v-tooltip>
                                    </span>
                                  </td>
                                </tr>
                              </template>
                            </v-data-table>
                          </div>
                        </div>
                      </div>
                    </tbody>
                  </table>
                </div>
710438de6   Shikha Mishra   added teacher mod...
416
417
418
419
420
              </div>
            </div>
          </div>
        </div>
      </div>
710438de6   Shikha Mishra   added teacher mod...
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
      <!-- ****** ADD MULTIPLE Subject ****** -->
      <v-snackbar
        :timeout="timeout"
        :top="y === 'top'"
        :right="x === 'right'"
        :vertical="mode === 'vertical'"
        v-model="snackbar"
        :color="color"
      >{{ text }}</v-snackbar>
      <v-dialog v-model="addRoutineDialog" max-width="600px">
        <v-card flat class="card-style pa-2" dark>
          <v-layout>
            <v-flex xs12>
              <label class="title text-xs-center">Add Routine</label>
              <v-icon size="24" class="right" @click="addRoutineDialog = false">cancel</v-icon>
            </v-flex>
          </v-layout>
          <v-container fluid fill-height>
            <v-layout align-center>
              <v-flex xs12>
                <v-form ref="form" v-model="valid" lazy-validation>
                  <v-layout>
                    <v-flex xs4 sm4 class="pt-4 subheading">
                      <label class="right">School Year :</label>
                    </v-flex>
                    <v-flex xs8 sm8 class="ml-3">
                      <v-text-field
5ceb88b44   Shikha Mishra   added pdf option ...
448
                        label="fill your year"
710438de6   Shikha Mishra   added teacher mod...
449
450
451
                        :rules="schoolRules"
                        v-model="addRoutine.schoolYear"
                      ></v-text-field>
710438de6   Shikha Mishra   added teacher mod...
452
453
454
455
456
457
458
459
460
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs4 sm4 class="pt-4 subheading">
                      <label class="right">Class :</label>
                    </v-flex>
                    <v-flex xs8 sm8 class="ml-3">
                      <v-select
                        :items="classList"
710438de6   Shikha Mishra   added teacher mod...
461
462
463
                        item-text="classNum"
                        item-value="_id"
                        v-model="addRoutine.classId"
5ceb88b44   Shikha Mishra   added pdf option ...
464
                        label="Select Class"
710438de6   Shikha Mishra   added teacher mod...
465
466
467
468
469
470
471
472
473
474
475
476
477
478
                        :rules="classRules"
                        @change="getSections(addRoutine.classId)"
                        class="pl-2"
                        required
                      ></v-select>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs4 sm4 class="pt-4 subheading">
                      <label class="right">Section :</label>
                    </v-flex>
                    <v-flex xs8 sm8 class="ml-3">
                      <v-select
                        :items="addSection"
710438de6   Shikha Mishra   added teacher mod...
479
480
481
                        item-text="name"
                        item-value="_id"
                        v-model="addRoutine.sectionId"
5ceb88b44   Shikha Mishra   added pdf option ...
482
                        label="Select Section"
710438de6   Shikha Mishra   added teacher mod...
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
                        :rules="sectionRules"
                        @change="getClassSubject(addRoutine.classId)"
                        class="px-2"
                        required
                      ></v-select>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs3 sm4 class="pt-4 subheading">
                      <label class="right">Subject :</label>
                    </v-flex>
                    <v-flex xs8 sm8 class="ml-2">
                      <v-select
                        :items="subjectList.subjects"
                        label="Select your subject"
                        v-model="addRoutine.subjectName"
                        item-text="subjectName"
5ceb88b44   Shikha Mishra   added pdf option ...
500
                        item-value="subjectName"
710438de6   Shikha Mishra   added teacher mod...
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
                        :rules="subjectRules"
                        required
                      ></v-select>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs3 sm4 class="pt-4 subheading">
                      <label class="right">Day :</label>
                    </v-flex>
                    <v-flex xs8 sm8 class="ml-2">
                      <v-select
                        :items="day"
                        label="Select your day"
                        v-model="addRoutine.day"
                        item-text="text"
                        :rules="dayRules"
                        required
                      ></v-select>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs4 sm4 class="pt-4 subheading">
                      <label class="right">Teacher Name :</label>
                    </v-flex>
                    <v-flex xs8 sm8 class="ml-3">
                      <v-select
                        v-model="addRoutine.teacherId"
                        label="Select your teacher"
                        type="text"
                        :items="teacherList"
                        item-text="name"
                        item-value="_id"
                        :rules="teacherRules"
                        required
                      ></v-select>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs4 sm4 class="pt-4 subheading">
                      <label class="right">Starting time:</label>
                    </v-flex>
                    <v-flex xs8 sm8 class="ml-3">
                      <v-menu
                        ref="menuA"
                        :close-on-content-click="false"
                        v-model="menuB"
                        :nudge-right="40"
5ceb88b44   Shikha Mishra   added pdf option ...
548
                        :return-value.sync="addRoutine.startingTime"
710438de6   Shikha Mishra   added teacher mod...
549
550
551
552
553
554
555
556
557
                        lazy
                        transition="scale-transition"
                        offset-y
                        full-width
                        max-width="290px"
                        min-width="290px"
                      >
                        <v-text-field
                          slot="activator"
5ceb88b44   Shikha Mishra   added pdf option ...
558
                          v-model="addRoutine.startingTime"
710438de6   Shikha Mishra   added teacher mod...
559
560
561
562
563
564
                          label="Select your starting time"
                          append-icon="access_time"
                          :rules="timeInRules"
                          readonly
                        ></v-text-field>
                        <v-time-picker
5ceb88b44   Shikha Mishra   added pdf option ...
565
566
                          v-model="addRoutine.startingTime"
                          @change="$refs.menuA.save(addRoutine.startingTime)"
710438de6   Shikha Mishra   added teacher mod...
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
                        ></v-time-picker>
                      </v-menu>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs4 sm4 class="pt-4 subheading">
                      <label class="right">Ending Time:</label>
                    </v-flex>
                    <v-flex xs8 sm8 class="ml-3">
                      <v-menu
                        ref="menu"
                        :close-on-content-click="false"
                        v-model="menu1"
                        :nudge-right="40"
                        :return-value.sync="addRoutine.endingTime"
                        lazy
                        transition="scale-transition"
                        offset-y
                        full-width
                        max-width="290px"
                        min-width="290px"
                      >
                        <v-text-field
                          slot="activator"
                          v-model="addRoutine.endingTime"
                          label="Select your end time"
                          append-icon="access_time"
                          :rules="timeOutRules"
                          readonly
                        ></v-text-field>
                        <v-time-picker
                          v-model="addRoutine.endingTime"
                          @change="$refs.menu.save(addRoutine.endingTime)"
                        ></v-time-picker>
                      </v-menu>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs4 sm4 class="pt-4 subheading">
                      <label class="right">Room:</label>
                    </v-flex>
                    <v-flex xs8 sm8 class="ml-3">
                      <v-text-field
5ceb88b44   Shikha Mishra   added pdf option ...
610
                        label="fill your room"
710438de6   Shikha Mishra   added teacher mod...
611
612
613
614
615
616
617
618
619
620
621
622
                        :rules="roomRules"
                        v-model="addRoutine.room"
                        @keyup.enter="submit"
                      ></v-text-field>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs4 sm4 class="pt-4 subheading">
                      <label class="right">Period:</label>
                    </v-flex>
                    <v-flex xs8 sm8 class="ml-3">
                      <v-text-field
5ceb88b44   Shikha Mishra   added pdf option ...
623
                        label="fill your period"
710438de6   Shikha Mishra   added teacher mod...
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
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
                        :rules="periodRules"
                        v-model="addRoutine.period"
                        @keyup.enter="submit"
                      ></v-text-field>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs12 sm12>
                      <v-card-actions>
                        <v-spacer></v-spacer>
                        <v-btn
                          @click="create"
                          round
                          dark
                          :loading="loading"
                          class="add-button"
                        >Add Routine</v-btn>
                      </v-card-actions>
                    </v-flex>
                  </v-layout>
                </v-form>
              </v-flex>
            </v-layout>
          </v-container>
        </v-card>
      </v-dialog>
      <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";
  import Util from "@/util";
  
  export default {
    data: () => ({
      snackbar: false,
      y: "top",
      x: "right",
      role: "",
      mode: "",
      timeout: 3000,
      text: "",
      color: "",
      show: true,
      showSearch: false,
      showLoader: false,
      loading: false,
      editLoading: false,
      date: null,
      search: "",
710438de6   Shikha Mishra   added teacher mod...
677
678
679
680
      editRoutineDialog: false,
      valid: true,
      validEditRoutine: true,
      addRoutineDialog: false,
5ceb88b44   Shikha Mishra   added pdf option ...
681
682
683
      showTable: false,
      hideTable: true,
      name: "",
710438de6   Shikha Mishra   added teacher mod...
684
685
686
687
688
689
690
691
692
693
  
      day: [
        "Monday",
        "Tuesday",
        "Wednesday",
        "Thursday",
        "Friday",
        "Saturday",
        "Sunday"
      ],
5ceb88b44   Shikha Mishra   added pdf option ...
694

710438de6   Shikha Mishra   added teacher mod...
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
      token: "",
  
      menu1: false,
      menuB: false,
      menu2: false,
  
      schoolRules: [v => !!v || "School Year is required"],
      classRules: [v => !!v || " Class Name is required"],
      teacherRules: [v => !!v || " Teacher Name is required"],
      sectionRules: [v => !!v || "Section is required"],
      studentRules: [v => !!v || " Student is required"],
      finalRules: [v => !!v || "Final MArk is required"],
      subjectRules: [v => !!v || " Subject Name is required"],
      dayRules: [v => !!v || "Day is required"],
      timeInRules: [v => !!v || "Start Time is required"],
      timeOutRules: [v => !!v || "End Time is required"],
      roomRules: [v => !!v || "Room is required"],
      periodRules: [v => !!v || "Period is required"],
5ceb88b44   Shikha Mishra   added pdf option ...
713

710438de6   Shikha Mishra   added teacher mod...
714
715
716
717
718
719
720
721
722
723
      classList: [],
      addSection: [],
      subjectList: [],
      teacherList: [],
      titleRules: [],
      markRules: [],
      typeRules: [],
      routineList: [],
      editedIndex: -1,
      addRoutine: {},
5ceb88b44   Shikha Mishra   added pdf option ...
724
725
      startingTime: "",
      editedItem: {}
710438de6   Shikha Mishra   added teacher mod...
726

5ceb88b44   Shikha Mishra   added pdf option ...
727
728
729
730
731
732
733
734
735
736
737
738
      // editedItem: {
      //   schoolYear: "",
      //   day: "",
      //   teacherId: "",
      //   classId: "",
      //   sectionId: "",
      //   startingTime: "",
      //   endingTime: "",
      //   room: "",
      //   period: "",
      //   subjectName: ""
      // }
710438de6   Shikha Mishra   added teacher mod...
739
740
    }),
    methods: {
710438de6   Shikha Mishra   added teacher mod...
741
      editItem(item) {
5ceb88b44   Shikha Mishra   added pdf option ...
742
        this.editedIndex = this.routineList;
710438de6   Shikha Mishra   added teacher mod...
743
        this.editedItem = Object.assign({}, item);
5ceb88b44   Shikha Mishra   added pdf option ...
744
        // this.editedItem.subjectName = item.lectureRoutine.subjectName;
710438de6   Shikha Mishra   added teacher mod...
745
746
747
        this.dialog = true;
        this.editRoutineDialog = true;
      },
710438de6   Shikha Mishra   added teacher mod...
748
      deleteItem(item) {
5ceb88b44   Shikha Mishra   added pdf option ...
749
750
751
        let deleteLecture = {
          routineId: item._id,
          lectureId: item.lectureRoutine[0]._id
710438de6   Shikha Mishra   added teacher mod...
752
753
754
        };
        http()
          .delete(
5ceb88b44   Shikha Mishra   added pdf option ...
755
            "/deleteRoutineLecture",
710438de6   Shikha Mishra   added teacher mod...
756
            confirm("Are you sure you want to delete this?") && {
5ceb88b44   Shikha Mishra   added pdf option ...
757
              params: deleteLecture
710438de6   Shikha Mishra   added teacher mod...
758
759
760
            }
          )
          .then(response => {
710438de6   Shikha Mishra   added teacher mod...
761
            this.snackbar = true;
5ceb88b44   Shikha Mishra   added pdf option ...
762
            this.text = "Successfully delete Existing Routine";
710438de6   Shikha Mishra   added teacher mod...
763
            this.color = "green";
5ceb88b44   Shikha Mishra   added pdf option ...
764
            this.getRoutineList();
710438de6   Shikha Mishra   added teacher mod...
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
          })
          .catch(error => {
            this.snackbar = true;
            this.text = error.response.data.message;
            this.color = "error";
          });
      },
      close() {
        this.editRoutineDialog = false;
      },
  
      create() {
        var routineData = {
          schoolYear: this.addRoutine.schoolYear,
          classId: this.addRoutine.classId,
          sectionId: this.addRoutine.sectionId,
          day: this.addRoutine.day,
          lectureRoutine: []
        };
        if (this.$refs.form.validate()) {
          routineData.lectureRoutine.push({
            teacherId: this.addRoutine.teacherId,
5ceb88b44   Shikha Mishra   added pdf option ...
787
            startingTime: this.addRoutine.startingTime,
710438de6   Shikha Mishra   added teacher mod...
788
789
790
791
792
793
794
795
            endingTime: this.addRoutine.endingTime,
            room: this.addRoutine.room,
            period: this.addRoutine.period,
            subjectName: this.addRoutine.subjectName
          });
          http()
            .post("/createRoutine", routineData)
            .then(response => {
5ceb88b44   Shikha Mishra   added pdf option ...
796
              this.getRoutineList();
710438de6   Shikha Mishra   added teacher mod...
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
              this.text = "Routine added successfully";
              this.clear();
              this.snackbar = true;
              this.color = "green";
              this.addRoutineDialog = false;
            })
            .catch(error => {
              // console.log(error);
              this.snackbar = true;
              this.text = error.response.data.message;
              this.color = "error";
            });
        }
      },
      clear() {
        this.$refs.form.reset();
      },
5ceb88b44   Shikha Mishra   added pdf option ...
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
      update() {
        // if (this.$refs.formEditRoutine.validate()) {
        //   let editSubject = {
        //     classId: this.editedItem.classId,
        //     subjectId: this.editedItem._id,
        //     teacherId: this.editedItem.teacherId,
        //     type: this.editedItem.type,
        //     passMarks: this.editedItem.passMarks,
        //     finalMarks: this.editedItem.finalMarks,
        //     subjectAuthor: this.editedItem.subjectAuthor,
        //     subjectCode: this.editedItem.subjectCode,
        //     subjectName: this.editedItem.subjectName
        //   };
        //   this.editLoading = true;
        //   http()
        //     .put("/updateSubject", editSubject)
        //     .then(response => {
        //       this.snackbar = true;
        //       this.text = "Successfully Edit Existing Subject";
        //       this.color = "green";
        //       this.editLoading = false;
        //       this.editRoutineDialog = false;
        //       http()
        //         .get(
        //           "/getParticularClass",
        //           { params: { classId: _id } },
        //           {
        //             headers: { Authorization: "Bearer " + this.token }
        //           }
        //         )
        //         .then(response => {
        //           this.subjectList = response.data.data;
        //           this.snackbar = true;
        //           this.color = "green";
        //           this.text = response.data.message;
        //           this.close();
        //         })
        //         .catch(err => {
        //           console.log("err====>", err);
        //         });
        //     })
        //     .catch(error => {
        //       this.editLoading = false;
710438de6   Shikha Mishra   added teacher mod...
857

5ceb88b44   Shikha Mishra   added pdf option ...
858
859
860
        //       // console.log(error);
        //     });
        // }
710438de6   Shikha Mishra   added teacher mod...
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
      },
      getClass() {
        http()
          .get("/getClassesList", {
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
            this.classList = response.data.data;
          })
          .catch(error => {
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
            }
          });
      },
      getSections(_id) {
        var token = this.$store.state.token;
        this.showLoader = true;
        http()
          .get(
            "/getSectionsList",
            { params: { classId: _id } },
            {
              headers: { Authorization: "Bearer " + token }
            }
          )
          .then(response => {
            this.addSection = response.data.data;
            this.showLoader = false;
          })
          .catch(err => {
            this.showLoader = false;
          });
      },
      getClassSubject(_id) {
        this.showLoader = true;
        //   this.classId = this.classId;
        http()
          .get(
            "/getParticularClass",
            { params: { classId: _id } },
            {
              headers: { Authorization: "Bearer " + this.token }
            }
          )
          .then(response => {
            this.subjectList = response.data.data;
            this.showLoader = false;
          })
          .catch(err => {
            this.showLoader = false;
          });
      },
      getTeacherList() {
        this.showLoader = true;
        var token = this.$store.state.token;
        http()
          .get("/getTeachersList", {
            headers: { Authorization: "Bearer " + token }
          })
          .then(response => {
            this.teacherList = response.data.data;
            this.showLoader = false;
            // console.log("getTeacherList=====>",this.desserts)
          })
          .catch(error => {
            this.showLoader = false;
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
            }
          });
      },
      getRoutineList() {
        this.showLoader = true;
        http()
          .get(
            "/getRoutineList",
            {
              params: {
                classId: this.addRoutine.classId,
                sectionId: this.addRoutine.sectionId
              }
            },
            {
              headers: { Authorization: "Bearer " + this.token }
            }
          )
          .then(response => {
            this.routineList = response.data.data;
            this.showLoader = false;
5ceb88b44   Shikha Mishra   added pdf option ...
955
956
            this.showTable = true;
            this.hideTable = false;
710438de6   Shikha Mishra   added teacher mod...
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
          })
          .catch(err => {
            this.showLoader = false;
          });
      },
      displaySearch() {
        (this.show = false), (this.showSearch = true);
      },
      closeSearch() {
        this.showSearch = false;
        this.show = true;
        this.search = "";
      }
    },
    mounted() {
      this.token = this.$store.state.token;
710438de6   Shikha Mishra   added teacher mod...
973
974
975
976
977
978
979
980
      this.getClass();
      this.getTeacherList();
      this.role = this.$store.state.role;
    }
  };
  </script>
  
  <style scoped>
5ceb88b44   Shikha Mishra   added pdf option ...
981
982
983
984
985
986
987
988
989
990
991
  html,
  body {
    font-family: "OpenSans Regular";
  }
  .box .box-body {
    padding: 15px;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 3px;
    border-bottom-left-radius: 3px;
  }
710438de6   Shikha Mishra   added teacher mod...
992
993
994
995
996
  .nav-tabs-custom {
    margin-bottom: 20px;
    background: #fff;
    box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1);
  }
710438de6   Shikha Mishra   added teacher mod...
997
998
999
1000
1001
1002
1003
  .nav-tabs {
    border-bottom: 1px solid #ddd;
  }
  .nav {
    padding-left: 0;
    list-style: none;
  }
5ceb88b44   Shikha Mishra   added pdf option ...
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
  .tab-content > .active {
    display: block;
  }
  .nav-tabs-custom > .nav-tabs > li.active > a {
    border-top: 0;
    border-left-color: #09a3a3;
    border-right-color: #09a3a3;
  }
  .nav-tabs-custom > .nav-tabs {
    background-color: #e5e5e5;
    margin: 0;
    border-bottom-color: #e5e5e5;
  }
710438de6   Shikha Mishra   added teacher mod...
1017
1018
1019
1020
  .nav-tabs-custom > .nav-tabs > li:first-of-type {
    margin-left: 0px;
  }
  .nav-tabs-custom > .nav-tabs > li.active {
5ceb88b44   Shikha Mishra   added pdf option ...
1021
    border-bottom-color: #09a3a3;
710438de6   Shikha Mishra   added teacher mod...
1022
1023
  }
  .nav-tabs-custom > .nav-tabs > li {
5ceb88b44   Shikha Mishra   added pdf option ...
1024
    border-bottom: 2px solid transparent;
710438de6   Shikha Mishra   added teacher mod...
1025
1026
1027
1028
1029
1030
1031
1032
1033
    border-top: 3px solid transparent;
    margin-bottom: -2px;
    margin-right: 5px;
  }
  .nav-tabs-custom > .nav-tabs > li:first-of-type.active > a {
    border-left-width: 0;
  }
  .nav-tabs-custom > .nav-tabs > li.active > a {
    border-top: 0;
5ceb88b44   Shikha Mishra   added pdf option ...
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
    border-bottom-color: #09a3a3;
  }
  .nav-tabs-custom > .nav-tabs > li.active > a,
  .nav-tabs-custom > .nav-tabs > li.active:hover > a {
    background-color: #e5e5e5;
    border: 0px;
    color: #000000db;
  }
  .nav-tabs-custom > .nav-tabs > li > a,
  .nav-tabs-custom > .nav-tabs > li > a:hover {
    border-radius: 0 !important;
710438de6   Shikha Mishra   added teacher mod...
1045
1046
1047
  }
  .nav-tabs-custom > .tab-content {
    background: #fff;
5ceb88b44   Shikha Mishra   added pdf option ...
1048
1049
1050
1051
1052
1053
1054
    padding: 10px;
  }
  .page-header {
    margin: 10px 0 20px 0;
    padding: 0px 0px 16px;
    font-size: 22px;
    border: none;
710438de6   Shikha Mishra   added teacher mod...
1055
  }
5ceb88b44   Shikha Mishra   added pdf option ...
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
  .table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
  }
  .table > tbody > tr > th,
  .table > tfoot > tr > th,
  .table > tbody > tr > td,
  .table > tfoot > tr > td {
    padding: 8px;
    line-height: 1.428571429;
    vertical-align: top;
    border-top: 1px solid #ddd;
  }
  .nav::before,
  .nav::after {
    display: table;
    content: "";
  }
  .box .box-body .table {
    margin-bottom: 0;
  }
  .table-bordered {
    border: 1px solid #e2e7eb;
  }
  .table-striped > tbody > tr:nth-child(2n + 1) > td,
  .table-striped > tbody > tr:nth-child(2n + 1) > th {
    background-color: #f0f3f5;
  }
  .table-bordered > tbody > v-data-table > template > tr > th,
  .table-bordered > tbody > tr > td {
    border-color: #e2e7eb;
    font-size: 12px;
  }
  .table-bordered > tbody > tr > td {
    color: #707070;
  }
  /*
  .table-bordered > tbody > tr > th,
  .table-bordered > tfoot > tr > th,
  .table-bordered > tbody > tr > td,
  .table-bordered > tfoot > tr > td {
    border: 1px solid #ddd;
  } */
710438de6   Shikha Mishra   added teacher mod...
1100
1101
1102
1103
  .mCustomScrollbar.mCS_no_scrollbar,
  .mCustomScrollbar.mCS_touch_action {
    touch-action: auto;
  }
5ceb88b44   Shikha Mishra   added pdf option ...
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
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
  .mCSB_scrollTools.mCSB_scrollTools_horizontal {
    width: auto;
    height: 16px;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
  }
  .mCSB_scrollTools {
    opacity: 0.75;
  }
  .mCSB_scrollTools .mCSB_draggerContainer {
    position: absolute;
    height: auto;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
  }
  .mCSB_scrollTools.mCSB_scrollTools_horizontal .mCSB_dragger {
    height: 100%;
  }
  .mCSB_scrollTools .mCSB_dragger {
    cursor: pointer;
    z-index: 1;
  }
  .mCSB_scrollTools.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar {
    width: 100%;
    height: 4px;
    margin: 6px auto;
  }
  .mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar {
    background-color: rgba(255, 255, 255, 0.75);
  }
  .mCSB_scrollTools.mCSB_scrollTools_horizontal .mCSB_draggerRail {
    width: 100%;
    height: 2px;
    margin: 7px 0;
  }
  .mCSB_scrollTools .mCSB_draggerRail {
    background-color: rgba(0, 0, 0, 0.4);
    border-radius: 16px;
710438de6   Shikha Mishra   added teacher mod...
1146
1147
1148
1149
1150
1151
1152
1153
1154
  }
  .mCustomScrollBox {
    position: relative;
    overflow: hidden;
    height: 100%;
    max-width: 100%;
    outline: none;
    direction: ltr;
  }
5ceb88b44   Shikha Mishra   added pdf option ...
1155
  /* .mCSB_horizontal > .mCSB_container.mCS_no_scrollbar_x.mCS_x_hidden {
710438de6   Shikha Mishra   added teacher mod...
1156
1157
1158
1159
    margin-bottom: 0;
  }
  .mCSB_horizontal.mCSB_inside > .mCSB_container {
    margin-right: 0;
5ceb88b44   Shikha Mishra   added pdf option ...
1160
  } */
710438de6   Shikha Mishra   added teacher mod...
1161
1162
1163
1164
  .mCSB_container {
    overflow: hidden;
    height: auto;
  }
710438de6   Shikha Mishra   added teacher mod...
1165
1166
1167
1168
1169
1170
1171
  
  @media (min-width: 768px) {
    .col-sm-12 {
      width: 100%;
    }
  }
  </style>