Blame view

src/pages/TimeTable/timeTable.vue 38.7 KB
76f4f9c78   Neeraj Sharma   all api add in se...
1
2
3
4
5
6
7
8
9
10
11
  <template>
    <v-app id="pages-dasboard">
      <v-toolbar class="fixcolors" fixed app>
        <v-toolbar-title class="ml-0 pl-3">
          <v-toolbar-side-icon @click.stop="handleDrawerToggle" class="hide"></v-toolbar-side-icon>
        </v-toolbar-title>
        <!-- ****** SEARCH ALL EXISTING TIME-TABLE ****** -->
        <v-flex xs7 sm3 class="userSearch">
          <v-text-field
            flat
            append-icon="search"
55f72b7d7   Neeraj Sharma   add new page are ...
12
            label="Find your Time Talbe"
76f4f9c78   Neeraj Sharma   all api add in se...
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
            v-model="search"
            color="white"
            dark
          ></v-text-field>
        </v-flex>
        <v-spacer></v-spacer>
        <v-menu offset-y origin="center center" :nudge-bottom="10" transition="scale-transition">
          <v-btn icon large flat slot="activator">
            <v-avatar size="40px">
              <img src="/static/icon/user.png">
            </v-avatar>
          </v-btn>
          <v-list class="pa-0">
            <v-list-tile
              v-for="(item,index) in items"
              :to="!item.href ? { name: item.name } : null"
              :href="item.href"
              @click="item.click"
              ripple="ripple"
              :disabled="item.disabled"
              :target="item.target"
              rel="noopener"
              :key="index"
            >
              <v-list-tile-action v-if="item.icon">
                <v-icon>{{ item.icon }}</v-icon>
              </v-list-tile-action>
              <v-list-tile-content>
                <v-list-tile-title>{{ item.title }}</v-list-tile-title>
              </v-list-tile-content>
            </v-list-tile>
          </v-list>
        </v-menu>
      </v-toolbar>
      <v-tabs grow slider-color="black">
        <v-tab
          ripple
          @click="activeTab('existing')"
          v-bind:class="{ active: isActive }"
          id="tab"
          class="subheading"
        >Existing Time Table</v-tab>
        <v-tab
          ripple
          @click="activeTab('new')"
          v-bind:class="{ active: newActive }"
          id="tab1"
          User
          class="subheading"
        >Add New Time Table</v-tab>
  
        <!-- ****** EDITS TIME-TABLE****** -->
  
        <v-tab-item>
          <v-snackbar
            :timeout="timeout"
            :top="y === 'top'"
            :right="x === 'right'"
            :vertical="mode === 'vertical'"
            v-model="snackbar"
            color="success"
          >{{ text }}</v-snackbar>
          <v-dialog v-model="dialog" max-width="1000px">
            <v-flex xs12 sm12 class>
              <v-toolbar color="white">
                <v-spacer></v-spacer>
                <v-toolbar-title>Edit Time Table</v-toolbar-title>
                <v-spacer></v-spacer>
              </v-toolbar>
              <v-card flat>
                <v-form ref="form">
                  <v-container fluid>
                    <v-layout>
                      <v-flex
                        xs12
                        class="text-xs-center text-sm-center text-md-center text-lg-center mr-4"
                      >
                        <v-avatar size="100px">
                          <img src="/static/icon/user.png" v-if="!imageUrl">
                        </v-avatar>
                        <input
                          type="file"
                          style="display: none"
                          ref="image"
                          accept="image/*"
                          @change="onFilePicked"
                        >
                        <img
                          :src="imageData.imageUrl"
                          height="150"
                          v-if="imageUrl"
                          style="border-radius:50%; width:200px"
                        >
                      </v-flex>
                    </v-layout>
                    <v-flex xs12 sm12>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">class No:</label>
                        </v-flex>
                        <v-flex xs12 sm5 class="ml-3">
55f72b7d7   Neeraj Sharma   add new page are ...
114
                          <v-select
76f4f9c78   Neeraj Sharma   all api add in se...
115
116
117
118
                            :items="addclass"
                            label="Select Class"
                            v-model="editedItem.classNum"
                            item-text="classNum"
55f72b7d7   Neeraj Sharma   add new page are ...
119
                            item-value="_id"
76f4f9c78   Neeraj Sharma   all api add in se...
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
                            @change="getSections(editedItem.classNum)"
                          ></v-select>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12 sm12>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Section Name:</label>
                        </v-flex>
                        <v-flex xs5 class="ml-3">
                          <v-select
                            :items="addSection"
                            label="Select Section"
                            v-model="editedItem.selectSection"
                            item-text="name"
55f72b7d7   Neeraj Sharma   add new page are ...
136
                            item-value="_id"
76f4f9c78   Neeraj Sharma   all api add in se...
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
                          ></v-select>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-layout>
                      <v-flex xs12 sm8 offset-sm2>
                        <v-card-actions>
                          <v-btn round dark @click.native="close">Cancel</v-btn>
                          <v-spacer></v-spacer>
                          <v-btn round dark @click="save">Save</v-btn>
                        </v-card-actions>
                      </v-flex>
                    </v-layout>
                  </v-container>
                </v-form>
              </v-card>
            </v-flex>
          </v-dialog>
  
          <!-- ****** ADD LECTURES TIME-TABLE ******  -->
  
          <v-dialog v-model="dialogAddLecture" max-width="1000px">
            <v-flex xs12 sm12 class>
              <v-toolbar color="white">
                <v-spacer></v-spacer>
                <v-toolbar-title>Add Lecture</v-toolbar-title>
                <v-spacer></v-spacer>
              </v-toolbar>
              <v-card flat>
                <v-form ref="form" v-model="valid" lazy-validation>
                  <v-container fluid>
                    <v-flex xs12 sm12>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Subject Name:</label>
                        </v-flex>
                        <v-flex xs5 class="ml-3">
                          <v-text-field
                            v-model="addlectures.subjectName"
                            :rules="subjectNameRules"
                            placeholder="fill your Subject Name"
                            type="text"
                          ></v-text-field>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12 sm12>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Time In:</label>
                        </v-flex>
                        <v-flex xs5 class="ml-3">
                          <v-text-field
                            v-model="addlectures.timeIn"
                            :rules="timeInRules"
                            placeholder="fill your Time In"
                            type="text"
                          ></v-text-field>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12 sm12>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Time Out:</label>
                        </v-flex>
                        <v-flex xs5 class="ml-3">
                          <v-text-field
                            v-model="addlectures.timeOut"
                            :rules="timeOutRules"
                            placeholder="fill your Time Out"
                            type="text"
                          ></v-text-field>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12 sm12>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Select Teacher:</label>
                        </v-flex>
                        <v-flex xs5 class="ml-3">
                          <v-select
                            :items="addTeachers"
                            label="Select Teacher"
                            v-model="addlectures.teacherId"
                            :rules="subjectNameRules"
                            item-text="name"
                            item-value="_id"
                            required
                          ></v-select>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-layout>
                      <v-flex xs12 sm8 offset-sm2>
                        <v-card-actions>
                          <v-btn round dark @click.native="closedialogLecture">Cancel</v-btn>
                          <v-spacer></v-spacer>
                          <!-- <v-btn round dark @click="updateParticularTable">Save</v-btn> -->
                          <v-btn round dark @click="AddLecture">Save</v-btn>
76f4f9c78   Neeraj Sharma   all api add in se...
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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
                        </v-card-actions>
                      </v-flex>
                    </v-layout>
                  </v-container>
                </v-form>
              </v-card>
            </v-flex>
          </v-dialog>
  
          <!-- ****** EDIT LECTURES TIME-TABLE ******  -->
  
          <v-dialog v-model="dialogUpdateLectures" max-width="1000px">
            <v-flex xs12 sm12 class>
              <v-toolbar color="white">
                <v-spacer></v-spacer>
                <v-toolbar-title>Edit Lecture</v-toolbar-title>
                <v-spacer></v-spacer>
              </v-toolbar>
              <v-card flat>
                <v-form ref="form">
                  <v-container fluid>
                    <v-flex xs12 sm12>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Subject Name:</label>
                        </v-flex>
                        <v-flex xs5 class="ml-3">
                          <v-text-field
                            v-model="updateLectures.subjectName"
                            placeholder="fill your Subject Name"
                            type="text"
                          ></v-text-field>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12 sm12>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Time In:</label>
                        </v-flex>
                        <v-flex xs5 class="ml-3">
                          <v-text-field
                            v-model="updateLectures.timeIn"
                            placeholder="fill your Time In"
                            type="text"
                          ></v-text-field>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12 sm12>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Time Out:</label>
                        </v-flex>
                        <v-flex xs5 class="ml-3">
                          <v-text-field
                            v-model="updateLectures.timeOut"
                            placeholder="fill your Time Out"
                            type="text"
                          ></v-text-field>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12 sm12>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Select Teacher:</label>
                        </v-flex>
                        <v-flex xs5 class="ml-3">
                          <v-select
                            :items="addTeachers"
                            label="Select Teacher"
                            v-model="updateLectures.teacherId"
                            item-text="name"
                            item-value="_id"
                            required
                          ></v-select>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-layout>
                      <v-flex xs12 sm8 offset-sm2>
                        <v-card-actions>
                          <v-btn round dark @click.native="closeUpdateLectures">Cancel</v-btn>
                          <v-spacer></v-spacer>
                          <v-btn round dark @click="updateParticularTable">Save</v-btn>
76f4f9c78   Neeraj Sharma   all api add in se...
324
325
326
327
328
329
330
331
                        </v-card-actions>
                      </v-flex>
                    </v-layout>
                  </v-container>
                </v-form>
              </v-card>
            </v-flex>
          </v-dialog>
55f72b7d7   Neeraj Sharma   add new page are ...
332

76f4f9c78   Neeraj Sharma   all api add in se...
333
334
335
336
337
338
339
340
341
342
343
          <v-snackbar
            :timeout="timeout"
            :top="y === 'top'"
            :right="x === 'right'"
            :vertical="mode === 'vertical'"
            v-model="snackbar"
            color="success"
          >{{ text }}</v-snackbar>
  
          <!-- ****** EXISTING-USERS TIME-TABLE ****** -->
          <v-flex xs12>
55f72b7d7   Neeraj Sharma   add new page are ...
344
345
346
347
348
349
350
            <v-data-table
              :headers="headers"
              :items="desserts"
              :pagination.sync="pagination"
              :search="search"
              item-key="_id"
            >
76f4f9c78   Neeraj Sharma   all api add in se...
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
              <template slot="items" slot-scope="props">
                <tr
                  style="cursor: pointer;"
                  @click="getTimeTable(props.item), props.expanded = !props.expanded"
                >
                  <td class="text-xs-center">{{ props.index }}</td>
                  <td class="text-xs-center">{{ props.item.classData.classNum}}</td>
                  <td class="text-xs-center">{{ props.item.sectionData.name }}</td>
                  <td class="text-xs-center">
                    <span>
                      <img
                        style="cursor:pointer; width:20px; height:18px; "
                        class="mr-5"
                        @click="editItem(props.item)"
                        src="/static/icon/edit1.png"
                      >
                      <img
                        style="cursor:pointer; height:20px; "
                        class="mr-5"
                        @click="deleteItem(props.item)"
                        src="/static/icon/delete1.png"
                      >
                    </span>
                  </td>
                </tr>
              </template>
              <template slot="expand" slot-scope="props">
                <v-data-table
                  :items="timeTableList.schedule"
                  hide-actions
                  item-key="title"
                  style="width: auto;"
                >
                  <template slot="items" slot-scope="props">
                    <tr>
55f72b7d7   Neeraj Sharma   add new page are ...
386
387
388
                      <td class="text-xs-left subheading">
                        <b>{{ props.item.day }}</b>
                      </td>
76f4f9c78   Neeraj Sharma   all api add in se...
389
                      <td>
55f72b7d7   Neeraj Sharma   add new page are ...
390
391
392
393
394
                        <b>Subject</b>
                        <br>
                        <b>Time In</b>
                        <br>
                        <b>Time Out</b>
76f4f9c78   Neeraj Sharma   all api add in se...
395
396
                      </td>
                      <td v-for="list in props.item.lectures">
55f72b7d7   Neeraj Sharma   add new page are ...
397
                        <b>{{ list.subjectName }}</b>
76f4f9c78   Neeraj Sharma   all api add in se...
398
                        <img
55f72b7d7   Neeraj Sharma   add new page are ...
399
400
401
402
403
404
405
406
407
408
409
410
411
412
                          style="cursor:pointer; width:20px; height:18px; "
                          class="mr-2 ml-2"
                          src="/static/icon/edit1.png"
                          @click="updateTimeTable(list, timeTableList)"
                        >
                        <img
                          style="cursor:pointer; height:20px; "
                          src="/static/icon/delete1.png"
                          @click="deleteTimeTable(list, timeTableList)"
                        >
                        <br>
                        {{list.timeIn.slice(0,16)}}
                        <br>
                        {{list.timeOut.slice(0,16)}}
76f4f9c78   Neeraj Sharma   all api add in se...
413
                      </td>
55f72b7d7   Neeraj Sharma   add new page are ...
414
415
416
417
418
                      <td>
                        <v-icon
                          color="black"
                          @click="addLecture(props.item._id, timeTableList._id)"
                        >add_circle_outline</v-icon>
76f4f9c78   Neeraj Sharma   all api add in se...
419
420
421
422
423
                      </td>
                    </tr>
                  </template>
                </v-data-table>
              </template>
55f72b7d7   Neeraj Sharma   add new page are ...
424
425
426
427
428
429
              <v-alert
                slot="no-results"
                :value="true"
                color="error"
                icon="warning"
              >Your search for "{{ search }}" found no results.</v-alert>
76f4f9c78   Neeraj Sharma   all api add in se...
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
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
            </v-data-table>
            <br>
            <br>
          </v-flex>
        </v-tab-item>
  
        <!-- ****** ADD MULTIPLE TIME-TABLE ****** -->
  
        <v-tab-item>
          <v-container>
            <v-snackbar
              :timeout="timeout"
              :top="y === 'top'"
              :right="x === 'right'"
              :vertical="mode === 'vertical'"
              v-model="snackbar"
              color="success"
            >{{ text }}</v-snackbar>
            <v-flex xs12 sm12 class="my-4">
              <v-card flat>
                <v-form ref="form" v-model="valid" lazy-validation>
                  <v-container fluid>
                    <v-layout>
                      <v-flex
                        xs12
                        class="text-xs-center text-sm-center text-md-center text-lg-center my-4 mr-4"
                      >
                        <v-avatar size="100px">
                          <img src="/static/icon/user.png" v-if="!imageUrl">
                        </v-avatar>
                        <input
                          type="file"
                          style="display: none"
                          ref="image"
                          accept="image/*"
                          @change="onFilePicked"
                        >
                        <img
                          :src="imageData.imageUrl"
                          height="150"
                          v-if="imageUrl"
                          style="border-radius:50%; width:200px"
                        >
                      </v-flex>
                    </v-layout>
                    <v-flex xs12>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Select Class:</label>
                        </v-flex>
                        <v-flex xs4 class="ml-3">
                          <v-select
                            :items="addclass"
                            label="Select Class"
                            v-model="timeTable.select"
                            item-text="classNum"
                            item-value="_id"
                            @change="getSections(timeTable.select)"
                            required
                          ></v-select>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Select Section:</label>
                        </v-flex>
                        <v-flex xs4 class="ml-3">
                          <v-select
                            :items="addSection"
                            label="Select Section"
                            v-model="timeTable.selectSection"
                            item-text="name"
                            item-value="_id"
                            required
                          ></v-select>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Select Teacher:</label>
                        </v-flex>
                        <v-flex xs4 class="ml-3">
                          <v-select
                            :items="addTeachers"
                            label="Select Teacher"
                            v-model="timeTable.selectTeacher"
                            item-text="name"
                            item-value="_id"
                            required
                          ></v-select>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Select Day:</label>
                        </v-flex>
                        <v-flex xs4 class="ml-3">
                          <v-select
                            :items="addOneDay"
                            label="Select Day"
                            v-model="timeTable.selectDay"
                            item-text="name"
                            item-value="_id"
                            required
                          ></v-select>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Time In:</label>
                        </v-flex>
                        <v-flex xs4 class="ml-3">
                          <v-text-field
                            v-model="timeTable.timeIn"
                            placeholder="fill your Time In"
                            type="text"
                            :rules="timeInRules"
                            required
                          ></v-text-field>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Time Out:</label>
                        </v-flex>
                        <v-flex xs4 class="ml-3">
                          <v-text-field
                            placeholder="fill your Time Out"
                            :rules="timeOutRules"
                            v-model="timeTable.timeOut"
                            type="text"
                            required
                          ></v-text-field>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Lecture No:</label>
                        </v-flex>
                        <v-flex xs4 class="ml-3">
                          <v-text-field
                            placeholder="fill your Lecture No"
                            :rules="lectureRules"
                            v-model="timeTable.lectureNum"
                            type="number"
                            required
                          ></v-text-field>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Subject Name:</label>
                        </v-flex>
                        <v-flex xs4 class="ml-3">
                          <v-text-field
                            placeholder="fill your Subject Name"
                            :rules="subjectNameRules"
                            v-model="timeTable.subjectName"
                            type="text"
                            required
                          ></v-text-field>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-layout>
                      <v-flex xs12 sm6 offset-sm3>
                        <v-card-actions>
                          <v-btn @click="clear" round dark>clear</v-btn>
                          <v-spacer></v-spacer>
                          <v-btn @click="submit" round dark :loading="loading">Add</v-btn>
                        </v-card-actions>
                      </v-flex>
                    </v-layout>
                  </v-container>
                </v-form>
              </v-card>
            </v-flex>
          </v-container>
        </v-tab-item>
      </v-tabs>
      <div class="loader" v-if="showLoader">
        <v-progress-circular indeterminate color="white"></v-progress-circular>
      </div>
    </v-app>
  </template>
  
  <script>
  import http from "@/Services/http.js";
  import Util from "@/util";
  
  export default {
    data: () => ({
      y: "top",
      x: "right",
      mode: "",
      timeout: 3000,
      text: "",
      search: "",
      snackbar: false,
      loading: false,
      showLoader: false,
76f4f9c78   Neeraj Sharma   all api add in se...
645
      dialog: false,
55f72b7d7   Neeraj Sharma   add new page are ...
646
647
      dialogAddLecture: false,
      dialogUpdateLectures: false,
76f4f9c78   Neeraj Sharma   all api add in se...
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
677
      dialog1: false,
      valid: true,
      // validLeacture:true,
      isActive: true,
      newActive: false,
      addclass: [],
      addSection: [],
      addTeachers: [],
      gender: ["Male", "Female"],
      AddUsercredentials: {},
      pagination: {
        rowsPerPage: 15
      },
      imageData: {},
      imageName: "",
      imageUrl: "",
      imageFile: "",
      timeInRules: [v => !!v || "Time In is required"],
      timeOutRules: [v => !!v || "Time Out is required"],
      lectureRules: [v => !!v || "Lecture No is required"],
      subjectNameRules: [v => !!v || "Subject Name is required"],
      headers: [
        {
          text: "No",
          align: "center",
          sortable: false,
          value: "No"
        },
        {
          text: "Class Name",
55f72b7d7   Neeraj Sharma   add new page are ...
678
          value: "classData.classNum",
76f4f9c78   Neeraj Sharma   all api add in se...
679
680
681
682
683
          sortable: false,
          align: "center"
        },
        {
          text: "Section Name",
55f72b7d7   Neeraj Sharma   add new page are ...
684
          value: "sectionData.name",
76f4f9c78   Neeraj Sharma   all api add in se...
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
          sortable: false,
          align: "center"
        },
        { text: "Action", value: "", sortable: false, align: "center" }
      ],
      daysHeaders: [
        { text: "Day", value: "dayday", sortable: false, align: "center" },
        {
          text: "Subject Name",
          value: "subjectName",
          sortable: false,
          align: "center"
        },
        { text: "Time In", value: "timeIn", sortable: false, align: "center" },
        { text: "Time Out", value: "timeOut", sortable: false, align: "center" }
      ],
      addOneDay: [
        "Monday",
        "Tuesday",
        "Wednesday",
        "Thursday",
        "Friday",
        "Saturday",
        "Sunday"
      ],
      desserts: [],
      timeTableList: [],
      editedIndex: -1,
      timeTable: {
        select: "",
        selectSection: "",
        selectDay: "",
        timeIn: "",
        timeOut: "",
        lectureNum: "",
        subjectName: "",
        selectTeacher: ""
      },
      editedItem: {
55f72b7d7   Neeraj Sharma   add new page are ...
724
        classNum: "",
76f4f9c78   Neeraj Sharma   all api add in se...
725
726
727
        selectSection: ""
      },
      addlectures: {
55f72b7d7   Neeraj Sharma   add new page are ...
728
729
730
731
732
733
        timeIn: "",
        timeOut: "",
        subjectName: "",
        teacherId: "",
        scheduleId: "",
        timeTableId: ""
76f4f9c78   Neeraj Sharma   all api add in se...
734
      },
55f72b7d7   Neeraj Sharma   add new page are ...
735
736
737
738
739
740
741
      updateLectures: {
        timeIn: "",
        timeOut: "",
        subjectName: "",
        teacherId: "",
        lectureId: "",
        scheduleId: ""
76f4f9c78   Neeraj Sharma   all api add in se...
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
      },
      items: [
        {
          href: "/changepassword",
          title: "Change Password",
          click: e => {
            console.log(e);
          }
        },
        {
          href: "#",
          title: "Logout",
          click: e => {
            window.getApp.$emit("APP_LOGOUT");
          }
        }
      ]
    }),
76f4f9c78   Neeraj Sharma   all api add in se...
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
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
    methods: {
      getSections(_id) {
        var token = this.$store.state.token;
        http()
          .get(
            "/getSectionsList",
            { params: { classId: _id } },
            {
              headers: { Authorization: "Bearer " + token }
            }
          )
          .then(response => {
            this.addSection = response.data.data;
            // console.log("getSectionsList=====>", this.addSection);
          })
          .catch(err => {
            // console.log("err====>", err);
          });
      },
      getTimeTable(item) {
        this.showLoader = true;
        var token = this.$store.state.token;
        http()
          .get(
            "/getParticularTimeTable",
            { params: { timeTableId: item._id } },
            {
              headers: { Authorization: "Bearer " + token }
            }
          )
          .then(response => {
            this.timeTableList = response.data.data;
            this.showLoader = false;
            // console.log("getParticularTimeTable=====>", this.timeTableList);
          })
          .catch(err => {
            this.showLoader = false;
            // console.log("err====>", err);
          });
      },
      pickFile() {
        this.$refs.image.click();
      },
  
      onFilePicked(e) {
        // console.log(e)
        const files = e.target.files;
        this.imageData.upload = e.target.files[0];
        if (files[0] !== undefined) {
          this.imageName = files[0].name;
          if (this.imageName.lastIndexOf(".") <= 0) {
            return;
          }
          const fr = new FileReader();
          fr.readAsDataURL(files[0]);
          fr.addEventListener("load", () => {
            this.imageUrl = fr.result;
            this.imageFile = files[0]; // this is an image file that can be sent to server...
            this.imageData.imageUrl = URL.createObjectURL(this.imageFile);
            // console.log("upload=======>", this.imageData.imageUrl);
            // console.log("imageFile", this.imageFile);
          });
        } else {
          this.imageName = "";
          this.imageFile = "";
          this.imageUrl = "";
        }
      },
      getTimeTableList() {
        this.showLoader = true;
        var token = this.$store.state.token;
        http()
          .get("/getTimeTablesList", {
            headers: { Authorization: "Bearer " + token }
          })
          .then(response => {
            this.desserts = response.data.data;
            this.showLoader = false;
            // console.log("getTimeTableList=====>", response.data.data);
          })
          .catch(err => {
            // console.log("err====>", err);
            this.showLoader = false;
            this.$router.replace({ path: "/" });
          });
      },
      editItem(item) {
        this.editedIndex = this.desserts.indexOf(item);
        this.editedItem = Object.assign({}, item);
        this.dialog = true;
      },
55f72b7d7   Neeraj Sharma   add new page are ...
851
852
853
854
855
856
857
858
      updateTimeTable(timeToUpdate, classToUpdate) {
        console.log(
          "timeToUpdate, classToUpdate",
          timeToUpdate._id,
          classToUpdate.schedule
        );
        for (let i = 0; i < classToUpdate.schedule.length; i++) {
          this.updateLectures.scheduleId = classToUpdate.schedule[i]._id;
76f4f9c78   Neeraj Sharma   all api add in se...
859
        }
55f72b7d7   Neeraj Sharma   add new page are ...
860
861
        (this.updateLectures.lectureId = timeToUpdate._id),
          (this.updateLectures = timeToUpdate);
76f4f9c78   Neeraj Sharma   all api add in se...
862
863
        this.dialogUpdateLectures = true;
      },
55f72b7d7   Neeraj Sharma   add new page are ...
864
      addLecture(scheduleId, timeTableId) {
76f4f9c78   Neeraj Sharma   all api add in se...
865
        // console.log('timeToAdd, classToAdd', scheduleId, timeTableId);
55f72b7d7   Neeraj Sharma   add new page are ...
866
867
        this.addlectures.scheduleId = scheduleId;
        this.addlectures.timeTableId = timeTableId;
76f4f9c78   Neeraj Sharma   all api add in se...
868
869
        this.dialogAddLecture = true;
      },
55f72b7d7   Neeraj Sharma   add new page are ...
870
      AddLecture() {
76f4f9c78   Neeraj Sharma   all api add in se...
871
        if (this.$refs.form.validate()) {
55f72b7d7   Neeraj Sharma   add new page are ...
872
          http()
76f4f9c78   Neeraj Sharma   all api add in se...
873
874
875
876
877
878
            .post("/addLecture", this.addlectures)
            .then(response => {
              // console.log("addTimeTable=====>", this.addlectures);
              if ((this.snackbar = true)) {
                this.text = "New Add Lecture successfully";
              }
55f72b7d7   Neeraj Sharma   add new page are ...
879
              this.closedialogLecture();
76f4f9c78   Neeraj Sharma   all api add in se...
880
881
882
883
884
885
886
887
            })
            .catch(error => {
              if ((this.snackbar = true)) {
                this.text = error.response.data.message;
              }
            });
        }
      },
55f72b7d7   Neeraj Sharma   add new page are ...
888
889
890
891
892
893
894
895
896
897
898
      updateParticularTable() {
        let EditLecture = {
          lectureId: this.updateLectures.lectureId,
          scheduleId: this.updateLectures.scheduleId,
          updatedLecture: {
            timeIn: this.updateLectures.timeIn,
            timeOut: this.updateLectures.timeOut,
            subjectName: this.updateLectures.subjectName,
            teacherId: this.updateLectures.teacherId
          }
        };
76f4f9c78   Neeraj Sharma   all api add in se...
899
        console.log("updateLecture", EditLecture);
55f72b7d7   Neeraj Sharma   add new page are ...
900
901
902
903
904
905
906
907
908
909
910
911
912
        http()
          .put("/updateLecture", EditLecture)
          .then(response => {
            console.log("updateLecture", EditLecture);
            if ((this.snackbar = true)) {
              this.text = "Successfully Edit Update Lecture";
            }
            this.$router.go(0);
          })
          .catch(error => {
            // console.log(error);
          });
        this.closeUpdateLectures();
76f4f9c78   Neeraj Sharma   all api add in se...
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
955
      },
      deleteItem(item) {
        let deleteTimeTable = {
          timeTableId: item._id
        };
        http()
          .delete(
            "/deleteTimeTable",
            confirm("Are you sure you want to delete this?") && {
              params: deleteTimeTable
            }
          )
          .then(response => {
            // console.log("deleteUers",deleteTimeTable)
            if ((this.snackbar = true)) {
              this.text = "Successfully delete Existing User";
            }
            this.getTimeTableList();
          })
          .catch(error => {
            // console.log(error);
          });
      },
      activeTab(type) {
        switch (type) {
          case "existing":
            this.newActive = false;
            this.isActive = true;
            break;
  
          default:
            this.newActive = true;
            this.isActive = false;
            break;
        }
      },
      close() {
        this.dialog = false;
        setTimeout(() => {
          this.editedItem = Object.assign({}, this.defaultItem);
          this.editedIndex = -1;
        }, 300);
      },
55f72b7d7   Neeraj Sharma   add new page are ...
956
      close1() {
76f4f9c78   Neeraj Sharma   all api add in se...
957
958
959
960
        this.dialog1 = false;
      },
      closedialogLecture() {
        this.dialogAddLecture = false;
55f72b7d7   Neeraj Sharma   add new page are ...
961
        this.$router.go(0);
76f4f9c78   Neeraj Sharma   all api add in se...
962
      },
55f72b7d7   Neeraj Sharma   add new page are ...
963
      closeUpdateLectures() {
76f4f9c78   Neeraj Sharma   all api add in se...
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
        this.dialogUpdateLectures = false;
      },
      submit() {
        if (this.$refs.form.validate()) {
          let imageData = new FormData();
          imageData.append("upload", this.imageFile);
          // console.log(imageData);
          let addTimeTable = {
            sectionId: this.timeTable.selectSection,
            classId: this.timeTable.select,
            schedule: [
              {
                day: this.timeTable.selectDay,
                lectures: [
                  {
                    timeIn: this.timeTable.timeIn,
                    timeOut: this.timeTable.timeOut,
                    lectureNum: this.timeTable.lectureNum,
                    subjectName: this.timeTable.subjectName,
                    teacherId: this.timeTable.selectTeacher
                  }
                ]
              }
            ]
          };
          http()
            .post("/createTimeTable", addTimeTable)
            .then(response => {
              // console.log("addTimeTable=====>", addTimeTable);
              if ((this.snackbar = true)) {
                this.text = "New Time Table added successfully";
              }
              this.getTimeTableList();
              this.clear();
            })
            .catch(error => {
              // console.log(error);
              if ((this.snackbar = true)) {
                this.text = error.response.data.message;
              }
            });
        }
      },
      mail() {},
      download() {},
      clear() {
        this.$refs.form.reset();
      },
      save() {
        let imageData = new FormData();
        imageData.append("upload", this.imageFile);
        // console.log(imageData);
        let editTimeTable = {
          timeTableId: this.editedItem._id,
          classId: this.editedItem.classNum,
          sectionId: this.editedItem.selectSection
          // imageData
        };
55f72b7d7   Neeraj Sharma   add new page are ...
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
        http()
          .put("/updateTimeTable", editTimeTable)
          .then(response => {
            console.log("editTimeTable", editTimeTable);
            if ((this.snackbar = true)) {
              this.text = "Successfully Edit Existing User";
            }
            this.getTimeTableList();
          })
          .catch(error => {
            // console.log(error);
          });
76f4f9c78   Neeraj Sharma   all api add in se...
1034
1035
1036
1037
1038
1039
1040
1041
        this.close();
      },
      handleDrawerToggle() {
        window.getApp.$emit("APP_DRAWER_TOGGLED");
      },
      handleFullScreen() {
        Util.toggleFullScreen();
      },
55f72b7d7   Neeraj Sharma   add new page are ...
1042
      deleteTimeTable(timeToDelete) {
76f4f9c78   Neeraj Sharma   all api add in se...
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
        // console.log('timeToUpdate', timeToDelete._id);
        let deleteLecture = {
          lectureId: timeToDelete._id
        };
        http()
          .delete(
            "/deleteLecture",
            confirm("Are you sure you want to delete this?") && {
              params: deleteLecture
            }
          )
          .then(response => {
            // console.log("deleteLecture",deleteLecture)
            if ((this.snackbar = true)) {
              this.text = "Successfully delete Existing User";
            }
55f72b7d7   Neeraj Sharma   add new page are ...
1059
            this.$router.go(0);
76f4f9c78   Neeraj Sharma   all api add in se...
1060
1061
1062
1063
1064
            // this.getTimeTable();
          })
          .catch(error => {
            console.log(error);
          });
55f72b7d7   Neeraj Sharma   add new page are ...
1065
      }
76f4f9c78   Neeraj Sharma   all api add in se...
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
1100
1101
    },
    mounted() {
      this.getTimeTableList();
      var token = this.$store.state.token;
      http()
        .get("/getClassesList", {
          headers: { Authorization: "Bearer " + token }
        })
        .then(response => {
          this.addclass = response.data.data;
          // console.log("getClassesList=====>",this.addclass)
        })
        .catch(err => {
          // console.log("err====>", err);
        });
  
      http()
        .get("/getTeachersList", {
          headers: { Authorization: "Bearer " + token }
        })
        .then(response => {
          this.addTeachers = response.data.data;
          // console.log("getClassesList=====>",this.addTeachers)
        })
        .catch(err => {
          // console.log("err====>", err);
        });
    },
    computed: {
      toolbarColor() {
        return this.$vuetify.options.extra.mainNav;
      }
    }
  };
  </script>
  <style scoped>
55f72b7d7   Neeraj Sharma   add new page are ...
1102
1103
1104
  .theme--light .v-label,
  .application .theme--light.v-label {
    color: black;
76f4f9c78   Neeraj Sharma   all api add in se...
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
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
  }
  .v-tabs__div {
    text-transform: none;
  }
  .v-input__prepend-outer {
    margin-right: 0px !important;
  }
  .v-card__actions .v-btn {
    margin: 0 15px;
    min-width: 120px;
  }
  .primary {
    background-color: #aaa !important;
    border-color: #aaa !important;
  }
  h4 {
    background-repeat: no-repeat;
    padding: 8px;
    margin: auto;
    font-size: 25px;
  }
  #name {
    position: absolute;
    left: 100px;
    top: 17px;
  }
  #icon {
    position: absolute;
    right: 8px;
    top: 8px;
  }
  #m {
    position: relative;
    left: 135px;
    top: -15px;
  }
  #G {
    position: absolute;
    top: 38px;
    color: white;
  }
  #bt {
    position: relative;
    top: -20px;
    left: 115px;
  }
  #e {
    position: relative;
    top: 5px;
    right: -30px;
    height: 17px;
    cursor: pointer;
  }
  #d {
    position: relative;
    top: 5px;
    right: -70px;
    height: 17px;
    cursor: pointer;
  }
  #td {
    border: 1px solid #dddddd;
    text-align: left;
    padding: 8px;
  }
  #dialog {
    height: 550px;
  }
  .active {
    background-color: black;
    color: white !important;
  }
  .activebtn {
    color: black !important;
  }
  #flex {
    height: 300px;
  }
  .top {
    margin-top: 100px;
  }
  .v-tabs__item a {
    font-size: 16px !important;
  }
  @media screen and (max-width: 769px) {
    .top {
      margin-top: 0 !important;
    }
    .userSearch .v-icon {
      font-size: 20px !important;
      margin-left: 20px;
    }
  }
  @media screen and (max-width: 380px) {
    .right {
      float: none !important;
    }
    .subheading {
      font-size: 14px !important;
    }
    .v-card__actions .v-btn {
      margin: 0 0px;
      min-width: 100px;
    }
    /* .searchIcon .v-icon {
      font-size: 20px;
      margin-left: 20px;
  } */
    .subheading {
      font-size: 12px !important;
    }
    h5 {
      font-size: 13px;
    }
  }
  .v-icon {
    font-size: 30px;
  }
  @media screen and (min-width: 1270px) {
    .hide {
      display: none;
    }
    /* }
  @media screen and (max-width: 962px) {
  .imglogo{
      position: absolute;
      top: 13px;
      left: 13px !important;
      width: 70px;
      height: 24px;
  } */
  }
  @media screen and (max-width: 420px) {
    .userSearch .v-text-field .v-label {
      line-height: 24px !important;
    }
    .userSearch .v-label {
      font-size: 13px !important;
    }
    .v-list__tile {
      font-size: 14px;
      padding: 0 10px;
    }
    .name {
      font-size: 15px;
    }
  }
  </style>