Blame view

src/pages/TimeTable/timeTable.vue 46.5 KB
76f4f9c78   Neeraj Sharma   all api add in se...
1
  <template>
969cf1f94   Neeraj Sharma   something changes...
2
    <v-app id="pages-dasboard">
687e0b929   Neeraj Sharma   add user,attenden...
3
      <v-tabs grow slider-color="gray">
969cf1f94   Neeraj Sharma   something changes...
4
5
6
7
8
9
10
11
12
13
14
15
        <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"
969cf1f94   Neeraj Sharma   something changes...
16
17
          class="subheading"
        >Add New Time Table</v-tab>
76f4f9c78   Neeraj Sharma   all api add in se...
18

969cf1f94   Neeraj Sharma   something changes...
19
        <!-- ****** EDITS TIME-TABLE****** -->
76f4f9c78   Neeraj Sharma   all api add in se...
20

969cf1f94   Neeraj Sharma   something changes...
21
22
23
24
25
26
27
28
29
        <v-tab-item>
          <v-snackbar
            :timeout="timeout"
            :top="y === 'top'"
            :right="x === 'right'"
            :vertical="mode === 'vertical'"
            v-model="snackbar"
            color="success"
          >{{ text }}</v-snackbar>
f4df757fe   Neeraj Sharma   responsive vie in...
30
31
          <v-dialog v-model="dialog" max-width="600px">
            <v-flex xs12 sm12>
969cf1f94   Neeraj Sharma   something changes...
32
33
34
35
36
37
38
              <v-toolbar color="grey lighten-2">
                <v-spacer></v-spacer>
                <v-toolbar-title>
                  <h3>Edit Time Table</h3>
                </v-toolbar-title>
                <v-spacer></v-spacer>
              </v-toolbar>
f4df757fe   Neeraj Sharma   responsive vie in...
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
              <v-card flat class="pa-2">
                <!-- <v-layout>
                  <v-flex
                    xs12
                    class="text-xs-center text-sm-center text-md-center text-lg-center"
                  >
                    <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>
969cf1f94   Neeraj Sharma   something changes...
67
                    </v-flex>
f4df757fe   Neeraj Sharma   responsive vie in...
68
69
70
71
72
73
74
75
76
                    <v-flex xs8 sm5 class="ml-3">
                      <v-select
                        :items="addclass"
                        label="Select Class"
                        v-model="editedItem.classNum"
                        item-text="classNum"
                        item-value="_id"
                        @change="getSections(editedItem.classNum)"
                      ></v-select>
969cf1f94   Neeraj Sharma   something changes...
77
                    </v-flex>
f4df757fe   Neeraj Sharma   responsive vie in...
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
                  </v-layout>
                </v-flex>
                <v-flex xs12 sm12>
                  <v-layout>
                    <v-flex xs4 class="pt-4 subheading">
                      <label class="right hidden-xs-only hidden-sm-only">Section Name:</label>
                      <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Section:</label>
                    </v-flex>
                    <v-flex xs8 sm5 class="ml-3">
                      <v-select
                        :items="addSection"
                        label="Select Section"
                        v-model="editedItem.selectSection"
                        item-text="name"
                        item-value="_id"
                      ></v-select>
                    </v-flex>
                  </v-layout>
                </v-flex>
                <v-layout>
                  <v-flex xs12 sm9 offset-sm1>
                    <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>
969cf1f94   Neeraj Sharma   something changes...
106
107
108
              </v-card>
            </v-flex>
          </v-dialog>
76f4f9c78   Neeraj Sharma   all api add in se...
109

46db0a3b5   Neeraj Sharma   add sunbject and ...
110
111
112
113
114
115
116
117
118
119
120
121
          <!-- ****** ADD Dialog Schedule IN TIME-TABLE ******  -->
  
          <v-dialog v-model="dialogSchedule" max-width="600px">
            <v-flex xs12 sm12>
              <v-toolbar color="grey lighten-2">
                <v-spacer></v-spacer>
                <v-toolbar-title>
                  <h3>Add Schedule</h3>
                </v-toolbar-title>
                <v-spacer></v-spacer>
              </v-toolbar>
              <v-card flat>
aa63ee55a   Neeraj Sharma   fixed validation ...
122
                <v-form ref="formAddDay" v-model="validAddDay" lazy-validation>
46db0a3b5   Neeraj Sharma   add sunbject and ...
123
124
125
126
                  <v-container fluid>
                    <v-flex xs12 sm12 class="py-3">
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
aa8fc5033   Neeraj Sharma   implenment all pa...
127
128
                          <label class="right hidden-xs-only hidden-sm-only">Select Day:</label>
                          <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Day:</label>
46db0a3b5   Neeraj Sharma   add sunbject and ...
129
                        </v-flex>
f4df757fe   Neeraj Sharma   responsive vie in...
130
                        <v-flex xs12 sm5 class="pl-3">
46db0a3b5   Neeraj Sharma   add sunbject and ...
131
132
133
134
                          <v-select
                            :items="addOneDay"
                            label="Select Day"
                            v-model="schedule.selectDay"
aa63ee55a   Neeraj Sharma   fixed validation ...
135
                            :rules="selecDayRule"
46db0a3b5   Neeraj Sharma   add sunbject and ...
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
                          ></v-select>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-layout>
                      <v-flex xs12 sm8 offset-sm2>
                        <v-card-actions>
                          <v-spacer></v-spacer>
                          <v-btn round dark @click="submitSchedule">Save</v-btn>
                          <v-spacer></v-spacer>
                        </v-card-actions>
                      </v-flex>
                    </v-layout>
                  </v-container>
                </v-form>
              </v-card>
            </v-flex>
          </v-dialog>
969cf1f94   Neeraj Sharma   something changes...
154
          <!-- ****** ADD LECTURES IN TIME-TABLE ******  -->
76f4f9c78   Neeraj Sharma   all api add in se...
155

969cf1f94   Neeraj Sharma   something changes...
156
157
158
159
160
161
162
163
164
165
          <v-dialog v-model="dialogAddLecture" max-width="1000px">
            <v-flex xs12 sm12>
              <v-toolbar color="grey lighten-2">
                <v-spacer></v-spacer>
                <v-toolbar-title>
                  <h3>Add Lecture</h3>
                </v-toolbar-title>
                <v-spacer></v-spacer>
              </v-toolbar>
              <v-card flat>
1159d4f6d   Neeraj Sharma   clear form after ...
166
                <v-form ref="lectureForm" v-model="valid" lazy-validation>
969cf1f94   Neeraj Sharma   something changes...
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
                  <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-menu
                            ref="menuD"
                            :close-on-content-click="false"
                            v-model="menu5"
                            :nudge-right="40"
                            lazy
                            transition="scale-transition"
                            offset-y
                            full-width
                            max-width="290px"
                            min-width="290px"
                          >
                            <v-text-field
                              slot="activator"
                              v-model="addlectures.timeIn"
                              label="Select your Time In"
                              append-icon="access_time"
                              :rules="timeInRules"
d45ffc6fa   Neeraj Sharma   solve bugs and ad...
207
                              readonly
969cf1f94   Neeraj Sharma   something changes...
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-text-field>
                            <v-time-picker v-model="addlectures.timeIn" @change="menu5 = false"></v-time-picker>
                          </v-menu>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12 sm12>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Time Out:</label>
                        </v-flex>
                        <v-flex xs5 class="ml-3">
                          <v-menu
                            ref="menuE"
                            :close-on-content-click="false"
                            v-model="menu6"
                            :nudge-right="40"
                            lazy
                            transition="scale-transition"
                            offset-y
                            full-width
                            max-width="290px"
                            min-width="290px"
                          >
                            <v-text-field
                              slot="activator"
                              :rules="timeOutRules"
                              v-model="addlectures.timeOut"
                              label="Select your Time Out"
                              append-icon="access_time"
d45ffc6fa   Neeraj Sharma   solve bugs and ad...
238
                              readonly
969cf1f94   Neeraj Sharma   something changes...
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
                            ></v-text-field>
                            <v-time-picker v-model="addlectures.timeOut" @change="menu6 = false"></v-time-picker>
                          </v-menu>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12 sm12>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Select Teacher:</label>
                        </v-flex>
                        <v-flex xs5 class="ml-3">
                          <v-select
                            :items="addTeachers"
                            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="AddLecture">Save</v-btn>
                        </v-card-actions>
                      </v-flex>
                    </v-layout>
                  </v-container>
                </v-form>
              </v-card>
            </v-flex>
          </v-dialog>
  
          <!-- ****** EDIT PARTICULAR LECTURES TIME-TABLE ******  -->
f4df757fe   Neeraj Sharma   responsive vie in...
278
          <v-dialog v-model="dialogUpdateLectures" max-width="600px">
969cf1f94   Neeraj Sharma   something changes...
279
280
281
282
283
284
            <v-flex xs12 sm12 class>
              <v-toolbar color="grey lighten-2">
                <v-spacer></v-spacer>
                <v-toolbar-title>Edit Lecture</v-toolbar-title>
                <v-spacer></v-spacer>
              </v-toolbar>
f4df757fe   Neeraj Sharma   responsive vie in...
285
286
287
288
289
              <v-card flat class="pa-2">
                <v-flex xs12 sm12>
                  <v-layout>
                    <v-flex xs5 sm4 class="pt-4 subheading">
                      <label class="right">Subject Name:</label>
969cf1f94   Neeraj Sharma   something changes...
290
                    </v-flex>
f4df757fe   Neeraj Sharma   responsive vie in...
291
292
293
294
295
296
                    <v-flex xs7 sm6 class="ml-3">
                      <v-text-field
                        v-model="updateLectures.subjectName"
                        placeholder="fill your Subject Name"
                        type="text"
                      ></v-text-field>
969cf1f94   Neeraj Sharma   something changes...
297
                    </v-flex>
f4df757fe   Neeraj Sharma   responsive vie in...
298
299
300
301
302
303
                  </v-layout>
                </v-flex>
                <v-flex xs12 sm12>
                  <v-layout>
                    <v-flex xs5 sm4 class="pt-4 subheading">
                      <label class="right">Time In:</label>
969cf1f94   Neeraj Sharma   something changes...
304
                    </v-flex>
f4df757fe   Neeraj Sharma   responsive vie in...
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
                    <v-flex xs7 sm6 class="ml-3">
                      <v-menu
                        ref="menuC"
                        :close-on-content-click="false"
                        v-model="menu4"
                        :nudge-right="40"
                        lazy
                        transition="scale-transition"
                        offset-y
                        full-width
                        max-width="290px"
                        min-width="290px"
                      >
                        <v-text-field
                          slot="activator"
                          v-model="updateLectures.timeIn"
                          placeholder="Select your Time In"
                          append-icon="access_time"
d45ffc6fa   Neeraj Sharma   solve bugs and ad...
323
                          readonly
f4df757fe   Neeraj Sharma   responsive vie in...
324
325
326
                        ></v-text-field>
                        <v-time-picker v-model="updateLectures.timeIn" @change="menu4= false"></v-time-picker>
                      </v-menu>
969cf1f94   Neeraj Sharma   something changes...
327
                    </v-flex>
f4df757fe   Neeraj Sharma   responsive vie in...
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
                  </v-layout>
                </v-flex>
                <v-flex xs12 sm12>
                  <v-layout>
                    <v-flex xs5 sm4 class="pt-4 subheading">
                      <label class="right">Time Out:</label>
                    </v-flex>
                    <v-flex xs7 sm6 class="ml-3">
                      <v-menu
                        ref="menuB"
                        :close-on-content-click="false"
                        v-model="menu3"
                        :nudge-right="40"
                        lazy
                        transition="scale-transition"
                        offset-y
                        full-width
                        max-width="290px"
                        min-width="290px"
                      >
                        <v-text-field
                          slot="activator"
                          v-model="updateLectures.timeOut"
                          placeholder="Select your Time Out"
                          append-icon="access_time"
d45ffc6fa   Neeraj Sharma   solve bugs and ad...
353
                          readonly
f4df757fe   Neeraj Sharma   responsive vie in...
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
386
387
388
389
                        ></v-text-field>
                        <v-time-picker v-model="updateLectures.timeOut" @change="menu3 = false"></v-time-picker>
                      </v-menu>
                    </v-flex>
                  </v-layout>
                </v-flex>
                <v-flex xs12 sm12>
                  <v-layout>
                    <v-flex xs5 sm4 class="pt-4 subheading">
                      <label class="right">Select Teacher:</label>
                    </v-flex>
                    <v-flex xs7 sm6 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 sm10 offset-sm1>
                    <v-card-actions>
                      <v-btn round dark @click.native="closeUpdateLectures">Cancel</v-btn>
                      <v-spacer></v-spacer>
                      <v-btn
                        round
                        dark
                        @click="updateParticularTable(updateLectures.timeIn,updateLectures.timeOut)"
                      >Save</v-btn>
                    </v-card-actions>
                  </v-flex>
                </v-layout>
969cf1f94   Neeraj Sharma   something changes...
390
391
392
393
394
395
396
397
398
399
400
              </v-card>
            </v-flex>
          </v-dialog>
          <v-snackbar
            :timeout="timeout"
            :top="y === 'top'"
            :right="x === 'right'"
            :vertical="mode === 'vertical'"
            v-model="snackbar"
            color="success"
          >{{ text }}</v-snackbar>
76f4f9c78   Neeraj Sharma   all api add in se...
401

969cf1f94   Neeraj Sharma   something changes...
402
          <!-- ****** EXISTING-USERS TIME-TABLE ****** -->
76f4f9c78   Neeraj Sharma   all api add in se...
403

969cf1f94   Neeraj Sharma   something changes...
404
          <v-card flat>
b39d2afd2   Neeraj Sharma   responsive dashboard
405
            <v-card-actions class="hidden-xs-only hidden-sm-only">
969cf1f94   Neeraj Sharma   something changes...
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
              <v-layout>
                <label class="right mt-4 ml-5">Select Class:</label>
                <v-select
                  :items="addclass"
                  label="Select Class"
                  v-model="selectTimeTable.select"
                  item-text="classNum"
                  item-value="_id"
                  name="Select Class"
                  @change="getSections(selectTimeTable.select)"
                  class="px-4"
                  required
                ></v-select>
                <label class="right mt-4">Select Section:</label>
                <v-select
                  :items="addSection"
                  label="Select Section"
                  v-model="selectTimeTable.selectSection"
                  item-text="name"
                  item-value="_id"
                  name="Select Section"
                  class="pl-3"
                  required
                ></v-select>
              </v-layout>
              <v-spacer></v-spacer>
aa63ee55a   Neeraj Sharma   fixed validation ...
432
              <v-btn @click="findTimeTable()" round dark :loading="loadingFindData" class="left">Find</v-btn>
969cf1f94   Neeraj Sharma   something changes...
433
            </v-card-actions>
b39d2afd2   Neeraj Sharma   responsive dashboard
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
            <v-layout class="hidden-xl-only hidden-lg-only hidden-md-only">
              <v-flex xs4 sm2 class="mt-4 ml-2">
                <label>Select Class:</label>
              </v-flex>
              <v-flex xs6 sm9>
                <v-select
                  :items="addclass"
                  label="Select Class"
                  v-model="selectTimeTable.select"
                  item-text="classNum"
                  item-value="_id"
                  name="Select Class"
                  @change="getSections(selectTimeTable.select)"
                  required
                ></v-select>
              </v-flex>
            </v-layout>
            <v-layout class="hidden-xl-only hidden-lg-only hidden-md-only">
              <v-flex xs4 sm2 class="mt-4 ml-2">
                <label>Select Section:</label>
              </v-flex>
              <v-flex xs6 sm9>
                <v-select
                  :items="addSection"
                  label="Select Section"
                  v-model="selectTimeTable.selectSection"
                  item-text="name"
                  item-value="_id"
                  name="Select Section"
                  required
                ></v-select>
              </v-flex>
            </v-layout>
46db0a3b5   Neeraj Sharma   add sunbject and ...
467
            <v-layout class="hidden-xl-only hidden-lg-only hidden-md-only">
b39d2afd2   Neeraj Sharma   responsive dashboard
468
              <v-flex xs12>
46db0a3b5   Neeraj Sharma   add sunbject and ...
469
470
471
472
473
474
475
                <v-btn
                  @click="findTimeTable()"
                  round
                  dark
                  :loading="loading"
                  class="right mr-4 mb-2"
                >Find</v-btn>
b39d2afd2   Neeraj Sharma   responsive dashboard
476
477
              </v-flex>
            </v-layout>
969cf1f94   Neeraj Sharma   something changes...
478
479
480
481
482
483
484
485
486
487
488
489
490
491
          </v-card>
          <v-flex xs12>
            <v-data-table
              :headers="headers"
              :items="desserts"
              :pagination.sync="pagination"
              :search="search"
              item-key="_id"
            >
              <template slot="items" slot-scope="props">
                <tr
                  style="cursor: pointer;"
                  @click="getTimeTable(props.item), props.expanded = !props.expanded"
                >
aa8fc5033   Neeraj Sharma   implenment all pa...
492
                  <td class="text-xs-center">{{ props.index + 1}}</td>
969cf1f94   Neeraj Sharma   something changes...
493
494
495
496
                  <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>
495e4037c   Neeraj Sharma   update
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
                      <v-tooltip top>
                        <img
                          slot="activator"
                          style="cursor:pointer; width:20px; height:18px; "
                          class="mr5"
                          @click="editItem(props.item)"
                          src="/static/icon/edit1.png"
                        />
                        <span>Edit</span>
                      </v-tooltip>
                      <v-tooltip top>
                        <img
                          slot="activator"
                          style="cursor:pointer; width:20px; height:20px; "
                          class="mr5"
                          @click="deleteItem(props.item)"
                          src="/static/icon/delete1.png"
                        />
                        <span>Delete</span>
                      </v-tooltip>
                      <v-tooltip top>
                        <img
                          slot="activator"
                          style="cursor:pointer; width:20px; height:20px; "
                          src="/static/icon/add1.png"
                          @click="addSchedule(props.item._id)"
                        />
                        <span>Add</span>
                      </v-tooltip>
969cf1f94   Neeraj Sharma   something changes...
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
                    </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>
                      <td class="text-xs-left subheading table-td">
                        <b>{{ props.item.day }}</b>
                      </td>
                      <td class="table-td">
                        <b>Subject</b>
                        <br />
                        <b>Time In</b>
                        <br />
                        <b>Time Out</b>
                      </td>
                      <td v-for="list in props.item.lectures" class="table-td">
                        <b>{{ list.subjectName }}</b>
                        <img
                          style="cursor:pointer; width:20px; height:18px; "
                          class="mr-2 ml-2"
                          src="/static/icon/edit1.png"
                          @click="updateTimeTable(list, timeTableList)"
                        />
                        <img
b39d2afd2   Neeraj Sharma   responsive dashboard
558
                          style="cursor:pointer; width:20px; height:20px; "
969cf1f94   Neeraj Sharma   something changes...
559
560
561
562
563
564
565
566
567
                          src="/static/icon/delete1.png"
                          @click="deleteTimeTable(list,props.item.lectures)"
                        />
                        <br />
                        {{list.timeIn}}
                        <br />
                        {{list.timeOut}}
                      </td>
                      <td>
495e4037c   Neeraj Sharma   update
568
569
570
571
572
573
574
575
                        <v-tooltip top>
                          <v-icon
                            slot="activator"
                            color="black"
                            @click="addLecture(props.item._id, timeTableList._id)"
                          >add_circle_outline</v-icon>
                          <span>Add</span>
                        </v-tooltip>
969cf1f94   Neeraj Sharma   something changes...
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
                      </td>
                    </tr>
                  </template>
                </v-data-table>
              </template>
              <v-alert
                slot="no-results"
                :value="true"
                color="error"
                icon="warning"
              >Your search for "{{ search }}" found no results.</v-alert>
            </v-data-table>
            <br />
            <br />
          </v-flex>
        </v-tab-item>
76f4f9c78   Neeraj Sharma   all api add in se...
592

969cf1f94   Neeraj Sharma   something changes...
593
        <!-- ****** ADD MULTIPLE TIME-TABLE ****** -->
76f4f9c78   Neeraj Sharma   all api add in se...
594

969cf1f94   Neeraj Sharma   something changes...
595
596
597
598
599
600
601
602
603
604
        <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>
0551a0f15   Neeraj Sharma   implemnet functio...
605
            <v-flex xs12 sm12 class="my-5">
76f4f9c78   Neeraj Sharma   all api add in se...
606
              <v-card flat>
969cf1f94   Neeraj Sharma   something changes...
607
                <v-form ref="form" v-model="valid" lazy-validation>
0551a0f15   Neeraj Sharma   implemnet functio...
608
                  <v-container fluid class="pt-3">
969cf1f94   Neeraj Sharma   something changes...
609
610
611
                    <v-flex xs12>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
aa8fc5033   Neeraj Sharma   implenment all pa...
612
613
                          <label class="right hidden-xs-only hidden-sm-only">Select Class:</label>
                          <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label>
969cf1f94   Neeraj Sharma   something changes...
614
                        </v-flex>
aa8fc5033   Neeraj Sharma   implenment all pa...
615
                        <v-flex xs8 sm4 class="ml-3">
969cf1f94   Neeraj Sharma   something changes...
616
617
618
619
620
621
622
                          <v-select
                            :items="addclass"
                            label="Select Class"
                            v-model="timeTable.select"
                            item-text="classNum"
                            item-value="_id"
                            @change="getSections(timeTable.select)"
aa63ee55a   Neeraj Sharma   fixed validation ...
623
                            :rules="classRules"
969cf1f94   Neeraj Sharma   something changes...
624
                            required
76f4f9c78   Neeraj Sharma   all api add in se...
625
                          ></v-select>
969cf1f94   Neeraj Sharma   something changes...
626
627
628
629
630
631
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
aa8fc5033   Neeraj Sharma   implenment all pa...
632
633
                          <label class="right hidden-xs-only hidden-sm-only">Select Section:</label>
                          <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Section:</label>
969cf1f94   Neeraj Sharma   something changes...
634
                        </v-flex>
aa8fc5033   Neeraj Sharma   implenment all pa...
635
                        <v-flex sm4 xs8 class="ml-3">
969cf1f94   Neeraj Sharma   something changes...
636
637
638
639
640
641
                          <v-select
                            :items="addSection"
                            label="Select Section"
                            v-model="timeTable.selectSection"
                            item-text="name"
                            item-value="_id"
aa63ee55a   Neeraj Sharma   fixed validation ...
642
                            :rules="sectionRules"
969cf1f94   Neeraj Sharma   something changes...
643
                            required
76f4f9c78   Neeraj Sharma   all api add in se...
644
                          ></v-select>
969cf1f94   Neeraj Sharma   something changes...
645
646
647
648
649
650
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
aa8fc5033   Neeraj Sharma   implenment all pa...
651
652
                          <label class="right hidden-xs-only hidden-sm-only">Select Teacher:</label>
                          <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Teacher:</label>
969cf1f94   Neeraj Sharma   something changes...
653
                        </v-flex>
aa8fc5033   Neeraj Sharma   implenment all pa...
654
                        <v-flex xs8 sm4 class="ml-3">
969cf1f94   Neeraj Sharma   something changes...
655
656
657
658
659
660
                          <v-select
                            :items="addTeachers"
                            label="Select Teacher"
                            v-model="timeTable.selectTeacher"
                            item-text="name"
                            item-value="_id"
aa63ee55a   Neeraj Sharma   fixed validation ...
661
                            :rules="teacherRules"
969cf1f94   Neeraj Sharma   something changes...
662
663
664
665
666
667
668
669
670
671
                            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>
aa8fc5033   Neeraj Sharma   implenment all pa...
672
                        <v-flex xs8 sm4 class="ml-3">
969cf1f94   Neeraj Sharma   something changes...
673
674
675
676
                          <v-select
                            :items="addOneDay"
                            label="Select Day"
                            v-model="timeTable.selectDay"
aa63ee55a   Neeraj Sharma   fixed validation ...
677
                            :rules="dayRules"
969cf1f94   Neeraj Sharma   something changes...
678
679
680
681
682
683
684
685
686
687
                            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">
aa8fc5033   Neeraj Sharma   implenment all pa...
688
689
                          <label class="right hidden-xs-only hidden-sm-only">Subject Name:</label>
                          <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Subject:</label>
969cf1f94   Neeraj Sharma   something changes...
690
                        </v-flex>
aa8fc5033   Neeraj Sharma   implenment all pa...
691
                        <v-flex xs8 sm4 class="ml-3">
969cf1f94   Neeraj Sharma   something changes...
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
                          <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-flex xs12>
                      <v-layout>
                        <v-flex xs4 class="pt-4 subheading">
                          <label class="right">Time In:</label>
                        </v-flex>
aa8fc5033   Neeraj Sharma   implenment all pa...
707
                        <v-flex xs8 sm4 class="ml-3">
969cf1f94   Neeraj Sharma   something changes...
708
709
710
711
712
713
714
715
716
717
718
719
                          <v-menu
                            ref="menuA"
                            :close-on-content-click="false"
                            v-model="menu2"
                            :nudge-right="40"
                            :return-value.sync="timeTable.timeIn"
                            lazy
                            transition="scale-transition"
                            offset-y
                            full-width
                            max-width="290px"
                            min-width="290px"
506be6fd7   Neeraj Sharma   implemet dyamic i...
720
                          >
969cf1f94   Neeraj Sharma   something changes...
721
722
723
724
725
                            <v-text-field
                              slot="activator"
                              v-model="timeTable.timeIn"
                              label="Select your timeIn"
                              append-icon="access_time"
aa63ee55a   Neeraj Sharma   fixed validation ...
726
                              :rules="timeInRules"
d45ffc6fa   Neeraj Sharma   solve bugs and ad...
727
                              readonly
969cf1f94   Neeraj Sharma   something changes...
728
729
730
731
732
733
734
735
736
737
738
739
740
741
                            ></v-text-field>
                            <v-time-picker
                              v-model="timeTable.timeIn"
                              @change="$refs.menuA.save(timeTable.timeIn)"
                            ></v-time-picker>
                          </v-menu>
                        </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>
aa8fc5033   Neeraj Sharma   implenment all pa...
742
                        <v-flex xs8 sm4 class="ml-3">
969cf1f94   Neeraj Sharma   something changes...
743
744
745
746
747
748
749
750
751
752
753
754
                          <v-menu
                            ref="menu"
                            :close-on-content-click="false"
                            v-model="menu1"
                            :nudge-right="40"
                            :return-value.sync="timeTable.timeOut"
                            lazy
                            transition="scale-transition"
                            offset-y
                            full-width
                            max-width="290px"
                            min-width="290px"
506be6fd7   Neeraj Sharma   implemet dyamic i...
755
                          >
969cf1f94   Neeraj Sharma   something changes...
756
757
758
759
760
                            <v-text-field
                              slot="activator"
                              v-model="timeTable.timeOut"
                              label="Select your Time Out"
                              append-icon="access_time"
aa63ee55a   Neeraj Sharma   fixed validation ...
761
                              :rules="timeOutRules"
d45ffc6fa   Neeraj Sharma   solve bugs and ad...
762
                              readonly
969cf1f94   Neeraj Sharma   something changes...
763
764
765
766
767
768
769
770
771
772
                            ></v-text-field>
                            <v-time-picker
                              v-model="timeTable.timeOut"
                              @change="$refs.menu.save(timeTable.timeOut)"
                            ></v-time-picker>
                          </v-menu>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-layout>
0551a0f15   Neeraj Sharma   implemnet functio...
773
774
                      <v-flex xs12 sm12>
                        <v-layout>
495e4037c   Neeraj Sharma   update
775
                          <v-flex xs4 md4 class="ml-4">
0551a0f15   Neeraj Sharma   implemnet functio...
776
777
778
779
780
781
                            <v-btn @click="clear" round class="right" dark>clear</v-btn>
                          </v-flex>
                          <v-flex xs8 sm5 md4>
                            <v-btn @click="submit" round dark :loading="loading" class="right">Add</v-btn>
                          </v-flex>
                        </v-layout>
969cf1f94   Neeraj Sharma   something changes...
782
783
784
785
786
787
788
789
790
791
792
793
794
                      </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>
506be6fd7   Neeraj Sharma   implemet dyamic i...
795
796
  </template>
  <script>
969cf1f94   Neeraj Sharma   something changes...
797
798
  import http from "@/Services/http.js";
  import Util from "@/util";
76f4f9c78   Neeraj Sharma   all api add in se...
799

969cf1f94   Neeraj Sharma   something changes...
800
801
802
803
804
805
806
807
808
809
810
811
812
813
  export default {
    data: () => ({
      y: "top",
      x: "right",
      mode: "",
      timeout: 3000,
      text: "",
      search: "",
      snackbar: false,
      loading: false,
      showLoader: false,
      dialog: false,
      dialogAddLecture: false,
      dialogUpdateLectures: false,
46db0a3b5   Neeraj Sharma   add sunbject and ...
814
      dialogSchedule: false,
969cf1f94   Neeraj Sharma   something changes...
815
816
      dialog1: false,
      valid: true,
aa63ee55a   Neeraj Sharma   fixed validation ...
817
      validAddDay: true,
969cf1f94   Neeraj Sharma   something changes...
818
819
      isActive: true,
      newActive: false,
aa63ee55a   Neeraj Sharma   fixed validation ...
820
      loadingFindData: false,
969cf1f94   Neeraj Sharma   something changes...
821
822
823
824
      addclass: [],
      addSection: [],
      addTeachers: [],
      gender: ["Male", "Female"],
969cf1f94   Neeraj Sharma   something changes...
825
826
827
828
829
830
831
832
833
834
835
      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"],
aa63ee55a   Neeraj Sharma   fixed validation ...
836
837
838
839
840
841
      classRules: [v => !!v || "Class Name is required"],
      sectionRules: [v => !!v || "Section Name is required"],
      sectionRules: [v => !!v || "Section Name is required"],
      teacherRules: [v => !!v || "Teacher Name is required"],
      selecDayRule: [v => !!v || "Day is required"],
      dayRules: [v => !!v || "Day is required"],
b39d2afd2   Neeraj Sharma   responsive dashboard
842
      getParticulerLecture: "",
969cf1f94   Neeraj Sharma   something changes...
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
      headers: [
        {
          text: "No",
          align: "center",
          sortable: false,
          value: "No"
        },
        {
          text: "Class Name",
          value: "classData.classNum",
          sortable: false,
          align: "center"
        },
        {
          text: "Section Name",
          value: "sectionData.name",
          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"
      ],
46db0a3b5   Neeraj Sharma   add sunbject and ...
884
885
886
      schedule: {
        selectDay: ""
      },
969cf1f94   Neeraj Sharma   something changes...
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
      desserts: [],
      timeTableList: [],
      editedIndex: -1,
      selectTimeTable: {
        select: "",
        selectSection: ""
      },
      timeTable: {
        select: "",
        selectSection: "",
        selectDay: "",
        timeIn: null,
        timeOut: null,
        subjectName: "",
        selectTeacher: ""
      },
      editedItem: {
        classNum: "",
        selectSection: ""
      },
      addlectures: {
        timeIn: null,
        timeOut: null,
        subjectName: "",
        teacherId: "",
        scheduleId: "",
        timeTableId: ""
      },
      updateLectures: {
        timeIn: null,
        timeOut: null,
        subjectName: "",
        teacherId: ""
      },
      updateLecturesId: {
        lectureId: "",
        scheduleId: ""
      },
      menu1: false,
      menu2: false,
      menu3: false,
      menu4: false,
      menu5: false,
      menu6: false,
4bd94ba60   Neeraj Sharma   implement api and...
931
      scheduleDayId: ""
969cf1f94   Neeraj Sharma   something changes...
932
933
934
    }),
    methods: {
      findTimeTable() {
aa63ee55a   Neeraj Sharma   fixed validation ...
935
        this.loadingFindData = true;
969cf1f94   Neeraj Sharma   something changes...
936
937
938
939
940
941
942
943
944
        http()
          .get("/getParticularClassTimeTable", {
            params: {
              sectionId: this.selectTimeTable.selectSection,
              classId: this.selectTimeTable.select
            }
          })
          .then(response => {
            this.desserts = response.data.data;
aa63ee55a   Neeraj Sharma   fixed validation ...
945
            this.loadingFindData = false;
969cf1f94   Neeraj Sharma   something changes...
946
947
          })
          .catch(error => {
aa63ee55a   Neeraj Sharma   fixed validation ...
948
949
950
951
            this.loadingFindData = false;
            this.snackbar = true;
            this.text = error.response.data.message;
            this.text = error.response.data.statusText;
969cf1f94   Neeraj Sharma   something changes...
952
953
954
955
956
957
958
959
960
961
962
963
964
965
          });
      },
      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;
969cf1f94   Neeraj Sharma   something changes...
966
967
968
969
970
971
972
          })
          .catch(err => {
            // console.log("err====>", err);
          });
      },
      getTimeTable(item) {
        this.showLoader = true;
b39d2afd2   Neeraj Sharma   responsive dashboard
973
        this.getParticulerLecture = item._id;
aa63ee55a   Neeraj Sharma   fixed validation ...
974
975
976
        this.getTimeTableDayData();
      },
      getTimeTableDayData() {
969cf1f94   Neeraj Sharma   something changes...
977
978
979
980
        var token = this.$store.state.token;
        http()
          .get(
            "/getParticularTimeTable",
aa63ee55a   Neeraj Sharma   fixed validation ...
981
            { params: { timeTableId: this.getParticulerLecture } },
969cf1f94   Neeraj Sharma   something changes...
982
983
984
985
986
987
988
            {
              headers: { Authorization: "Bearer " + token }
            }
          )
          .then(response => {
            this.timeTableList = response.data.data;
            this.showLoader = false;
969cf1f94   Neeraj Sharma   something changes...
989
990
991
992
993
994
995
996
997
998
999
          })
          .catch(err => {
            this.showLoader = false;
            // console.log("err====>", err);
          });
      },
      pickFile() {
        this.$refs.image.click();
      },
  
      onFilePicked(e) {
969cf1f94   Neeraj Sharma   something changes...
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
        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);
969cf1f94   Neeraj Sharma   something changes...
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
          });
        } 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;
      },
      updateTimeTable(timeToUpdate, classToUpdate) {
aa63ee55a   Neeraj Sharma   fixed validation ...
1044
1045
1046
1047
1048
        // console.log(
        //   "timeToUpdate, classToUpdate",
        //   timeToUpdate._id,
        //   classToUpdate.schedule
        // );
969cf1f94   Neeraj Sharma   something changes...
1049
1050
1051
1052
1053
1054
1055
1056
        for (let i = 0; i < classToUpdate.schedule.length; i++) {
          this.updateLecturesId.scheduleId = classToUpdate.schedule[i]._id;
        }
        (this.updateLecturesId.lectureId = timeToUpdate._id),
          (this.updateLectures = timeToUpdate);
        this.dialogUpdateLectures = true;
      },
      addLecture(scheduleId, timeTableId) {
969cf1f94   Neeraj Sharma   something changes...
1057
1058
1059
1060
1061
        this.addlectures.scheduleId = scheduleId;
        this.addlectures.timeTableId = timeTableId;
        this.dialogAddLecture = true;
      },
      AddLecture() {
1159d4f6d   Neeraj Sharma   clear form after ...
1062
        if (this.$refs.lectureForm.validate()) {
b39d2afd2   Neeraj Sharma   responsive dashboard
1063
1064
1065
          http()
            .post("/addLecture", this.addlectures)
            .then(response => {
0551a0f15   Neeraj Sharma   implemnet functio...
1066
1067
              this.snackbar = true;
              this.text = "New Add Lecture successfully";
969cf1f94   Neeraj Sharma   something changes...
1068
1069
              var token = this.$store.state.token;
              http()
b39d2afd2   Neeraj Sharma   responsive dashboard
1070
1071
1072
1073
                .get(
                  "/getParticularTimeTable",
                  { params: { timeTableId: this.getParticulerLecture } },
                  {
969cf1f94   Neeraj Sharma   something changes...
1074
                    headers: { Authorization: "Bearer " + token }
b39d2afd2   Neeraj Sharma   responsive dashboard
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
                  }
                )
                .then(response => {
                  this.timeTableList = response.data.data;
                  this.showLoader = false;
                })
                .catch(err => {
                  this.showLoader = false;
                  // console.log("err====>", err);
                });
              this.closedialogLecture();
              this.clearLeactureData();
            })
            .catch(error => {
0551a0f15   Neeraj Sharma   implemnet functio...
1089
1090
1091
              this.snackbar = true;
              this.text = error.response.data.message;
              this.text = error.response.data.statusText;
b39d2afd2   Neeraj Sharma   responsive dashboard
1092
            });
1159d4f6d   Neeraj Sharma   clear form after ...
1093
        }
969cf1f94   Neeraj Sharma   something changes...
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
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
      },
      updateParticularTable() {
        let EditLecture = {
          lectureId: this.updateLecturesId.lectureId,
          scheduleId: this.updateLecturesId.scheduleId,
          updatedLecture: {
            timeIn: this.updateLectures.timeIn,
            timeOut: this.updateLectures.timeOut,
            subjectName: this.updateLectures.subjectName,
            teacherId: this.updateLectures.teacherId
          }
        };
        http()
          .put("/updateLecture", EditLecture)
          .then(response => {
            console.log("updateLecture", EditLecture);
            if ((this.snackbar = true)) {
              this.text = "Successfully Edit Update Lecture";
            }
            this.closeUpdateLectures();
          })
          .catch(error => {
            // console.log(error);
            if ((this.snackbar = true)) {
              this.text = error.response.data.message;
              this.text = error.response.data.statusText;
            }
          });
      },
      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)
0551a0f15   Neeraj Sharma   implemnet functio...
1136
1137
            this.snackbar = true;
            this.text = "Successfully delete Existing Time Table";
969cf1f94   Neeraj Sharma   something changes...
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
            this.findTimeTable();
          })
          .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;
969cf1f94   Neeraj Sharma   something changes...
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
      },
      close1() {
        this.dialog1 = false;
      },
      closedialogLecture() {
        this.dialogAddLecture = false;
      },
      closeUpdateLectures() {
        this.dialogUpdateLectures = false;
      },
      submit() {
        if (this.$refs.form.validate()) {
          let imageData = new FormData();
          imageData.append("upload", this.imageFile);
969cf1f94   Neeraj Sharma   something changes...
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
          let addTimeTable = {
            sectionId: this.timeTable.selectSection,
            classId: this.timeTable.select,
            schedule: [
              {
                day: this.timeTable.selectDay,
                lectures: [
                  {
                    timeIn: this.timeTable.timeIn,
                    timeOut: this.timeTable.timeOut,
                    subjectName: this.timeTable.subjectName,
                    teacherId: this.timeTable.selectTeacher
                  }
                ]
              }
            ]
          };
          this.loading = true;
          http()
            .post("/createTimeTable", addTimeTable)
            .then(response => {
              // console.log("addTimeTable=====>", addTimeTable);
              if ((this.snackbar = true)) {
                this.text = "New Time Table added successfully";
              }
              this.clear();
              this.loading = false;
            })
            .catch(error => {
              // console.log(error);
              if ((this.snackbar = true)) {
                this.text = error.response.data.message;
              }
              this.loading = false;
            });
        }
      },
969cf1f94   Neeraj Sharma   something changes...
1210
1211
1212
      clear() {
        this.$refs.form.reset();
      },
b39d2afd2   Neeraj Sharma   responsive dashboard
1213
      clearLeactureData() {
1159d4f6d   Neeraj Sharma   clear form after ...
1214
1215
        this.$refs.lectureForm.reset();
      },
969cf1f94   Neeraj Sharma   something changes...
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
      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
        };
        http()
          .put("/updateTimeTable", editTimeTable)
          .then(response => {
            console.log("editTimeTable", editTimeTable);
            if ((this.snackbar = true)) {
              this.text = "Successfully Edit Existing Time Table";
            }
            this.findTimeTable();
          })
          .catch(error => {
            // console.log(error);
            if ((this.snackbar = true)) {
              this.text = error.response.data.message;
            }
          });
        this.close();
      },
969cf1f94   Neeraj Sharma   something changes...
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
      deleteTimeTable(timeToDelete, deleteLectures) {
        let deleteLecture = {
          lectureId: timeToDelete._id
        };
        http()
          .delete(
            "/deleteLecture",
            confirm("Are you sure you want to delete this?") && {
              params: deleteLecture
            }
          )
          .then(response => {
            if ((this.snackbar = true)) {
d45ffc6fa   Neeraj Sharma   solve bugs and ad...
1256
              this.text = "Successfully delete Existing Time Table";
969cf1f94   Neeraj Sharma   something changes...
1257
1258
1259
1260
1261
1262
1263
1264
1265
            }
            const index = this.timeTableList.schedule.indexOf(deleteLectures);
            for (let i = 0; i < this.timeTableList.schedule.length; i++) {
              this.timeTableList.schedule[i].lectures.splice(index, 1);
            }
          })
          .catch(error => {
            console.log(error);
          });
46db0a3b5   Neeraj Sharma   add sunbject and ...
1266
1267
1268
1269
1270
1271
      },
      addSchedule(id) {
        this.scheduleDayId = id;
        this.dialogSchedule = true;
      },
      submitSchedule() {
aa63ee55a   Neeraj Sharma   fixed validation ...
1272
1273
1274
1275
1276
1277
1278
1279
1280
        if (this.$refs.formAddDay.validate()) {
          let scheduleDayData = {
            timeTableId: this.scheduleDayId,
            day: this.schedule.selectDay
          };
          http()
            .post("/addSchedule", scheduleDayData)
            .then(response => {
              this.snackbar = true;
46db0a3b5   Neeraj Sharma   add sunbject and ...
1281
              this.text = "New Schedule Day added successfully";
aa63ee55a   Neeraj Sharma   fixed validation ...
1282
1283
1284
1285
1286
1287
1288
              this.dialogSchedule = false;
              this.loading = false;
              this.getTimeTableDayData();
            })
            .catch(error => {
              // console.log(error);
              this.snackbar = true;
46db0a3b5   Neeraj Sharma   add sunbject and ...
1289
              this.text = error.response.data.message;
aa63ee55a   Neeraj Sharma   fixed validation ...
1290
1291
1292
              this.loading = false;
            });
        }
969cf1f94   Neeraj Sharma   something changes...
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
      }
    },
    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)
        })
00e4bc4e1   Neeraj Sharma   fixed auntentication
1306
1307
1308
1309
1310
1311
1312
1313
        .catch(error => {
          this.showLoader = false;
          if (error.response.status === 401) {
            this.$router.replace({ path: "/" });
            this.$store.dispatch("setToken", null);
            this.$store.dispatch("Id", null);
            this.$store.dispatch("Role", null);
          }
969cf1f94   Neeraj Sharma   something changes...
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
        });
  
      http()
        .get("/getTeachersList", {
          headers: { Authorization: "Bearer " + token }
        })
        .then(response => {
          this.addTeachers = response.data.data;
          // console.log("getClassesList=====>",this.addTeachers)
        })
00e4bc4e1   Neeraj Sharma   fixed auntentication
1324
1325
1326
1327
1328
1329
1330
1331
        .catch(error => {
          this.showLoader = false;
          if (error.response.status === 401) {
            this.$router.replace({ path: "/" });
            this.$store.dispatch("setToken", null);
            this.$store.dispatch("Id", null);
            this.$store.dispatch("Role", null);
          }
969cf1f94   Neeraj Sharma   something changes...
1332
1333
        });
    },
a17c68a03   Neeraj Sharma   implement two rou...
1334
1335
1336
1337
1338
1339
1340
1341
    created() {
      this.$root.$on("app:search", search => {
        this.search = search;
      });
    },
    beforeDestroy() {
      // dont forget to remove the listener
      this.$root.$off("app:search");
969cf1f94   Neeraj Sharma   something changes...
1342
1343
    }
  };
76f4f9c78   Neeraj Sharma   all api add in se...
1344
1345
  </script>
  <style scoped>
969cf1f94   Neeraj Sharma   something changes...
1346
  .active {
687e0b929   Neeraj Sharma   add user,attenden...
1347
    background-color: gray;
969cf1f94   Neeraj Sharma   something changes...
1348
1349
1350
1351
1352
    color: white !important;
  }
  .activebtn {
    color: black !important;
  }
76f4f9c78   Neeraj Sharma   all api add in se...
1353
  </style>