Blame view

src/pages/Library/member.vue 27 KB
687e0b929   Neeraj Sharma   add user,attenden...
1
2
3
4
5
6
7
8
9
10
  <template>
    <div>
      <v-snackbar
        :timeout="timeout"
        :top="y === 'top'"
        :right="x === 'right'"
        :vertical="mode === 'vertical'"
        v-model="snackbar"
        color="success"
      >{{ text }}</v-snackbar>
6c05a9f84   Neeraj Sharma   add functionalit ...
11
12
  
      <!-- ****** PROFILE VIEW STUDENTS LIBRARY MEMBER DEATILS ******  -->
db965de89   Amber Dev   added dialog pers...
13
      <v-dialog v-model="dialogStudents" max-width="1100px" scrollable persistent>
6c05a9f84   Neeraj Sharma   add functionalit ...
14
        <v-card>
b0e0491ab   Shikha Mishra   solve the issue o...
15
          <v-toolbar dark class="card-styles" flat>
6c05a9f84   Neeraj Sharma   add functionalit ...
16
            <v-spacer></v-spacer>
2f9211c74   Shikha Mishra   done one round of...
17
            <v-toolbar-title>View Student Profile</v-toolbar-title>
6c05a9f84   Neeraj Sharma   add functionalit ...
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
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
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
324
325
326
327
328
329
330
331
332
333
334
            <v-spacer></v-spacer>
            <v-icon @click="closeViewStudent">close</v-icon>
          </v-toolbar>
          <v-card-text style="height: 700px;">
            <v-flex align-center justify-center layout text-xs-center class="mt-3">
              <v-avatar size="160px">
                <img src="/static/icon/user.png" v-if="!editedItem.profilePicUrl" />
                <img :src="editedItem.profilePicUrl" v-else-if="editedItem.profilePicUrl" />
              </v-avatar>
            </v-flex>
            <v-container grid-list-md>
              <v-layout wrap>
                <v-flex xs12>
                  <v-layout wrap>
                    <v-flex xs12 sm6>
                      <v-layout>
                        <v-flex xs6 sm5>
                          <h5 class="right my-1">
                            <b>Full Name:</b>
                          </h5>
                        </v-flex>
                        <v-flex sm7 xs6>
                          <h5 class="my-1 left">{{ editedItem.name }}</h5>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12 sm6>
                      <v-layout>
                        <v-flex xs6 sm4>
                          <h5 class="right my-1">
                            <b>Email:</b>
                          </h5>
                        </v-flex>
                        <v-flex sm8 xs6>
                          <h5 class="my-1 left">{{ editedItem.email }}</h5>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                  </v-layout>
                  <v-layout wrap>
                    <v-flex xs12 sm6>
                      <v-layout>
                        <v-flex xs6 sm5>
                          <b>
                            <h5 class="right my-1">
                              <b>Gender:</b>
                            </h5>
                          </b>
                        </v-flex>
                        <v-flex sm7 xs6>
                          <h5 class="my-1 left">{{ editedItem.gender }}</h5>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12 sm6>
                      <v-layout>
                        <v-flex xs6 sm4>
                          <b>
                            <h5 class="right my-1">
                              <b>D.O.B:</b>
                            </h5>
                          </b>
                        </v-flex>
                        <v-flex sm7 xs6>
                          <h5 class="my-1">{{ dates(editedItem.dob) }}</h5>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                  </v-layout>
                  <v-layout wrap>
                    <v-flex xs12 sm6>
                      <v-layout>
                        <v-flex xs6 sm5>
                          <b>
                            <h5 class="right my-1">
                              <b>Blood Group:</b>
                            </h5>
                          </b>
                        </v-flex>
                        <v-flex sm7 xs6>
                          <h5 class="my-1 left">{{ editedItem.bloodGroup }}</h5>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12 sm6>
                      <v-layout>
                        <v-flex xs6 sm4>
                          <b>
                            <h5 class="right my-1">
                              <b>Allergies:</b>
                            </h5>
                          </b>
                        </v-flex>
                        <v-flex sm8 xs6>
                          <h5 class="my-1">{{ editedItem.allergies }}</h5>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                  </v-layout>
                  <v-layout wrap>
                    <v-flex xs12 sm6>
                      <v-layout>
                        <v-flex xs6 sm5>
                          <b>
                            <h5 class="right my-1">
                              <b>Height:</b>
                            </h5>
                          </b>
                        </v-flex>
                        <v-flex sm7 xs6>
                          <h5 class="my-1 left">{{ editedItem.height }}</h5>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12 sm6>
                      <v-layout>
                        <v-flex xs6 sm4>
                          <b>
                            <h5 class="right my-1">
                              <b>Weight:</b>
                            </h5>
                          </b>
                        </v-flex>
                        <v-flex sm8 xs6>
                          <h5 class="my-1">{{ editedItem.weight }}</h5>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                  </v-layout>
                  <v-layout wrap>
                    <v-flex xs12 sm6>
                      <v-layout>
                        <v-flex xs6 sm5>
                          <b>
                            <h5 class="right my-1">
                              <b>City:</b>
                            </h5>
                          </b>
                        </v-flex>
                        <v-flex sm7 xs6>
                          <h5 class="my-1 left">{{ editedItem.city }}</h5>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12 sm6>
                      <v-layout>
                        <v-flex xs6 sm4>
                          <b>
                            <h5 class="right my-1">
                              <b>State:</b>
                            </h5>
                          </b>
                        </v-flex>
                        <v-flex sm8 xs6>
                          <h5 class="my-1">{{ editedItem.state }}</h5>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                  </v-layout>
                  <v-layout wrap>
                    <v-flex xs12 sm6>
                      <v-layout>
                        <v-flex xs6 sm5>
                          <b>
                            <h5 class="right my-1">
                              <b>Pincode:</b>
                            </h5>
                          </b>
                        </v-flex>
                        <v-flex sm7 xs6>
                          <h5 class="my-1">{{ editedItem.pincode }}</h5>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12 sm5>
                      <v-layout>
                        <v-flex xs6 sm5>
                          <b>
                            <h5 class="right my-1">
                              <b>Country:</b>
                            </h5>
                          </b>
                        </v-flex>
                        <v-flex sm7 xs6>
                          <h5 class="my-1">{{ editedItem.country }}</h5>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                  </v-layout>
                  <v-layout wrap>
                    <v-flex xs12 sm6>
                      <v-layout>
                        <v-flex sm5 xs6>
                          <b>
                            <h5 class="right my-1">
                              <b>Mobile No:</b>
                            </h5>
                          </b>
                        </v-flex>
                        <v-flex sm6 xs6>
                          <h5 class="my-1">{{ editedItem.mobile }}</h5>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12 sm6>
                      <v-layout>
                        <v-flex xs6 sm4>
                          <b>
                            <h5 class="right my-1">
                              <b>Library ID :</b>
                            </h5>
                          </b>
                        </v-flex>
                        <v-flex sm8 xs6>
                          <h5 class="my-1">{{ editedItem.libraryId }}</h5>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                  </v-layout>
                  <v-layout wrap>
                    <v-flex xs12 sm5>
                      <v-layout>
                        <v-flex xs6 sm6>
                          <b>
                            <h5 class="right my-1">
                              <b>Library Fee:</b>
                            </h5>
                          </b>
                        </v-flex>
                        <v-flex sm6 xs6>
                          <h5 class="my-1">{{ editedItem.libraryFee }}</h5>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12 sm6>
                      <v-layout>
                        <v-flex xs6 sm6>
                          <b>
                            <h5 class="my-1 right">
                              <b>Academic Year:</b>
                            </h5>
                          </b>
                        </v-flex>
                        <v-flex sm5 xs6>
                          <h5 class="my-1">{{ editedItem.establishmentYear }}</h5>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                  </v-layout>
                  <v-layout wrap>
                    <v-flex xs12 sm5>
                      <v-layout>
                        <v-flex xs6 sm6>
                          <b>
                            <h5 class="my-1 right">
                              <b>Medical Notes:</b>
                            </h5>
                          </b>
                        </v-flex>
                        <v-flex sm5 xs6>
                          <h5 class="my-1">{{ editedItem.medicalNotes }}</h5>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12 sm6>
                      <v-layout>
                        <v-flex xs6 sm6>
                          <b>
                            <h5 class="right my-1">
                              <b>Roll No. :</b>
                            </h5>
                          </b>
                        </v-flex>
                        <v-flex sm6 xs8>
                          <h5 class="my-1">{{ editedItem.rollNo }}</h5>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                  </v-layout>
                  <v-layout wrap>
                    <v-flex xs12 sm5>
                      <v-layout>
                        <v-flex xs6 sm6>
                          <b>
                            <h5 class="my-1 right">
                              <b>present Address:</b>
                            </h5>
                          </b>
                        </v-flex>
                        <v-flex sm5 xs6>
                          <h5 class="my-1">{{ editedItem.presentAddress }}</h5>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                    <v-flex xs12 sm6>
                      <v-layout>
                        <v-flex xs6 sm6>
                          <b>
                            <h5 class="right my-1">
                              <b>present Address:</b>
                            </h5>
                          </b>
                        </v-flex>
                        <v-flex sm6 xs8>
                          <h5 class="my-1">{{ editedItem.permanentAddress }}</h5>
                        </v-flex>
                      </v-layout>
                    </v-flex>
                  </v-layout>
                </v-flex>
              </v-layout>
            </v-container>
          </v-card-text>
        </v-card>
      </v-dialog>
  
      <!-- Edit Student Library Member Dialog -->
db965de89   Amber Dev   added dialog pers...
335
      <v-dialog v-model="editStudentdialog" max-width="600px" scrollable persistent>
6c05a9f84   Neeraj Sharma   add functionalit ...
336
        <v-card flat>
b0e0491ab   Shikha Mishra   solve the issue o...
337
          <v-toolbar dark class="card-styles" flat>
6c05a9f84   Neeraj Sharma   add functionalit ...
338
339
340
341
342
            <v-spacer></v-spacer>
            <v-toolbar-title>
              <h3>Edit Student Profile</h3>
            </v-toolbar-title>
            <v-spacer></v-spacer>
342f9c0ca   Shikha Mishra   clear previous da...
343
            <v-icon @click="editStudentdialog = false">close</v-icon>
6c05a9f84   Neeraj Sharma   add functionalit ...
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
          </v-toolbar>
          <v-card-text style="height: 426px;">
            <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="160px">
                      <img src="/static/icon/user.png" v-if="!editedItem.profilePicUrl && !imageUrl" />
                      <img
                        :src="editedItem.profilePicUrl"
                        v-else-if="editedItem.profilePicUrl && !imageUrl"
                      />
                      <img
                        v-if="imageUrl"
                        :src="imageUrl"
                        height="150"
                        style="border-radius:50%; width:200px"
                      />
                    </v-avatar>
                  </v-flex>
                </v-layout>
                <v-layout wrap>
                  <v-flex xs12 sm12 md10>
                    <v-layout>
                      <v-flex xs4 class="pt-4 subheading">
                        <label class="right hidden-xs-only hidden-sm-only">Library ID:</label>
                        <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Library ID:</label>
                      </v-flex>
                      <v-flex xs8 class="ml-3">
                        <v-text-field
                          v-model="editedItem.libraryId"
                          placeholder="fill your Library ID"
                        ></v-text-field>
                      </v-flex>
                    </v-layout>
                  </v-flex>
                  <v-flex xs12 sm12 md10>
                    <v-layout>
                      <v-flex xs4 class="pt-4 subheading">
                        <label class="right hidden-xs-only hidden-sm-only">Library Fee:</label>
                        <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Library Fee:</label>
                      </v-flex>
                      <v-flex xs8 class="ml-3">
                        <v-text-field
                          v-model="editedItem.libraryFee"
                          placeholder="fill your Library Fee"
                        ></v-text-field>
                      </v-flex>
                    </v-layout>
                  </v-flex>
                </v-layout>
                <v-layout>
                  <v-flex xs12 sm12>
8e8d14254   Shikha Mishra   Cleared data whil...
400
                    <v-layout class="right">
6c05a9f84   Neeraj Sharma   add functionalit ...
401
                      <v-flex xs6>
8e8d14254   Shikha Mishra   Cleared data whil...
402
403
404
405
406
407
                        <v-btn
                          round
                          dark
                          class="clear-button"
                          @click.native="closeEditStudentDialog"
                        >Cancel</v-btn>
6c05a9f84   Neeraj Sharma   add functionalit ...
408
409
                      </v-flex>
                      <v-flex xs6>
8e8d14254   Shikha Mishra   Cleared data whil...
410
                        <v-btn @click="save" round dark :loading="loading" class="add-button">Save</v-btn>
6c05a9f84   Neeraj Sharma   add functionalit ...
411
412
413
414
415
416
417
418
419
420
                      </v-flex>
                    </v-layout>
                  </v-flex>
                </v-layout>
              </v-container>
            </v-form>
          </v-card-text>
        </v-card>
      </v-dialog>
      <!-- Add Student Library Member Dialog -->
db965de89   Amber Dev   added dialog pers...
421
      <v-dialog v-model="addLibrary" max-width="600px" v-if="addLibrary" persistent>
4dd422bef   Shikha Mishra   change ui of card...
422
        <v-card flat class="Card-style pa-2">
8e8d14254   Shikha Mishra   Cleared data whil...
423
424
          <v-layout>
            <v-flex xs12>
2f9211c74   Shikha Mishra   done one round of...
425
              <label class="title text-xs-center">Add Library Member</label>
8e8d14254   Shikha Mishra   Cleared data whil...
426
427
428
              <v-icon size="24" class="right" @click="closeAddLibraryModel">cancel</v-icon>
            </v-flex>
          </v-layout>
ab54b5656   Neeraj Sharma   implement library...
429
          <v-card-text>
495e4037c   Neeraj Sharma   update
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
            <v-layout wrap justify-center>
              <v-flex xs12 sm12 md10>
                <v-form ref="form" v-model="valid" lazy-validation>
                  <v-layout>
                    <v-flex xs4 class="pt-4 subheading">
                      <label class="right pr-3">Library Id:</label>
                    </v-flex>
                    <v-flex xs8>
                      <v-text-field
                        v-model="addBook.libraryId"
                        :rules="libraryIdRules"
                        type="number"
                        placeholder="fill your Library ID"
                      ></v-text-field>
                    </v-flex>
                  </v-layout>
                  <v-layout>
                    <v-flex xs4 class="pt-4 subheading">
                      <label class="right pr-3">Library Fee:</label>
                    </v-flex>
                    <v-flex xs8>
                      <v-text-field
                        v-model="addBook.libraryFee"
                        type="number"
                        :rules="libraryFeeRules"
                        placeholder="fill your Library Fee"
                      ></v-text-field>
                    </v-flex>
                  </v-layout>
8e8d14254   Shikha Mishra   Cleared data whil...
459
460
461
462
463
464
465
466
467
468
469
470
471
                  <v-layout>
                    <v-flex xs12 sm12>
                      <v-layout class="right">
                        <v-btn
                          round
                          dark
                          class="clear-button"
                          @click.native="addLibrary = false"
                        >Cancel</v-btn>
                        <v-btn round dark :loading="loading" class="add-button" @click="submit">Add</v-btn>
                      </v-layout>
                    </v-flex>
                  </v-layout>
495e4037c   Neeraj Sharma   update
472
473
474
                </v-form>
              </v-flex>
            </v-layout>
ab54b5656   Neeraj Sharma   implement library...
475
476
477
          </v-card-text>
        </v-card>
      </v-dialog>
687e0b929   Neeraj Sharma   add user,attenden...
478
479
      <!-- ****** EXISTING MEMBER TABLE ****** -->
      <v-card flat>
d5fcb1cd1   Shikha Mishra   issues resolved
480
        <!-- <h4
495e4037c   Neeraj Sharma   update
481
          class="text-xs-center pt-4 ml-2 hidden-lg-only hidden-xl-only hidden-md-only"
b0e0491ab   Shikha Mishra   solve the issue o...
482
        >Library Member</h4>-->
687e0b929   Neeraj Sharma   add user,attenden...
483
        <v-card-actions>
d5fcb1cd1   Shikha Mishra   issues resolved
484
          <!-- <h3 class="right mt-2 ml-2 hidden-sm-only hidden-xs-only">Library Member</h3> -->
687e0b929   Neeraj Sharma   add user,attenden...
485
          <v-spacer></v-spacer>
f4df757fe   Neeraj Sharma   responsive vie in...
486
          <v-flex xs12 sm4 md2>
687e0b929   Neeraj Sharma   add user,attenden...
487
488
489
490
491
            <v-select
              outline
              small
              :items="addclass"
              label="Select Class"
ab54b5656   Neeraj Sharma   implement library...
492
              v-model="selectStudents"
687e0b929   Neeraj Sharma   add user,attenden...
493
494
495
              item-text="classNum"
              item-value="_id"
              name="Select Class"
ab54b5656   Neeraj Sharma   implement library...
496
              @change="getAllStudents(selectStudents)"
687e0b929   Neeraj Sharma   add user,attenden...
497
498
499
500
501
502
              class="px-2"
              required
            ></v-select>
          </v-flex>
        </v-card-actions>
      </v-card>
d4735dce7   Shikha Mishra   show school logo ...
503
504
505
506
507
508
509
510
511
      <v-card class="transparent">
        <v-data-table
          :headers="headers"
          :items="studentData"
          :pagination.sync="pagination"
          :search="search"
        >
          <template slot="items" slot-scope="props">
            <tr class="tr">
a76a6f135   Neeraj Sharma   implelement task
512
              <td class="td td-row text-xs-center">{{ props.index + 1 }}</td>
d4735dce7   Shikha Mishra   show school logo ...
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
              <td class="td td-row text-xs-center">
                <v-avatar>
                  <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" />
                  <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" />
                </v-avatar>
              </td>
              <td class="td td-row text-xs-center">{{ props.item.name}}</td>
              <td class="td td-row text-xs-center">{{ props.item.rollNo }}</td>
              <td class="td td-row text-xs-center">{{ props.item.email }}</td>
              <td class="td td-row text-xs-center">
                <v-tooltip top>
                  <img
                    slot="activator"
                    v-if="!props.item.libraryId"
                    style="cursor:pointer; width:25px; height:18px; "
                    @click="addLibraryData(props.item)"
                    src="/static/icon/add.png"
                  />
                  <span>Add</span>
                </v-tooltip>
                <span v-if="props.item.libraryId">
                  <v-tooltip top>
                    <img
                      slot="activator"
                      style="cursor:pointer; width:25px; height:18px; "
                      class="mr5"
                      @click="profile(props.item)"
                      src="/static/icon/eye1.png"
                    />
                    <span>View</span>
                  </v-tooltip>
                  <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>
                </span>
              </td>
            </tr>
          </template>
          <v-alert
            slot="no-results"
            :value="true"
            color="error"
            icon="warning"
          >Your search for "{{ search }}" found no results.</v-alert>
        </v-data-table>
      </v-card>
687e0b929   Neeraj Sharma   add user,attenden...
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
      <div class="loader" v-if="showLoader">
        <v-progress-circular indeterminate color="white"></v-progress-circular>
      </div>
    </div>
  </template>
  
  <script>
  import http from "@/Services/http.js";
  import Util from "@/util";
  import moment from "moment";
  
  export default {
    data: () => ({
      snackbar: false,
      y: "top",
      x: "right",
      mode: "",
      timeout: 3000,
      text: "",
      showLoader: false,
      loading: false,
ab54b5656   Neeraj Sharma   implement library...
597
      addLibrary: false,
6c05a9f84   Neeraj Sharma   add functionalit ...
598
599
600
      dialogStudents: false,
      editStudentdialog: false,
      valid: true,
b0e0491ab   Shikha Mishra   solve the issue o...
601
602
      libraryIdRules: [(v) => !!v || "Library Id Fee is required"],
      libraryFeeRules: [(v) => !!v || "Library Fee is required"],
687e0b929   Neeraj Sharma   add user,attenden...
603
604
605
606
      date: null,
      search: "",
      addclass: [],
      pagination: {
b0e0491ab   Shikha Mishra   solve the issue o...
607
        rowsPerPage: 15,
687e0b929   Neeraj Sharma   add user,attenden...
608
      },
ab54b5656   Neeraj Sharma   implement library...
609
      addBook: {},
687e0b929   Neeraj Sharma   add user,attenden...
610
611
612
613
614
      imageName: "",
      imageUrl: "",
      imageFile: "",
      headers: [
        {
ab54b5656   Neeraj Sharma   implement library...
615
          text: "No",
687e0b929   Neeraj Sharma   add user,attenden...
616
617
          align: "center",
          sortable: false,
b0e0491ab   Shikha Mishra   solve the issue o...
618
          value: "index",
687e0b929   Neeraj Sharma   add user,attenden...
619
620
        },
        {
6c05a9f84   Neeraj Sharma   add functionalit ...
621
622
          text: "Photo",
          value: "uploadCover",
687e0b929   Neeraj Sharma   add user,attenden...
623
          sortable: false,
b0e0491ab   Shikha Mishra   solve the issue o...
624
          align: "center",
687e0b929   Neeraj Sharma   add user,attenden...
625
626
627
628
        },
        { text: "Name", value: "name", sortable: false, align: "center" },
        { text: "Roll No.", value: "rollNo", sortable: false, align: "center" },
        { text: "Email", value: "email", sortable: false, align: "center" },
b0e0491ab   Shikha Mishra   solve the issue o...
629
        { text: "Action", value: "", sortable: false, align: "center" },
687e0b929   Neeraj Sharma   add user,attenden...
630
      ],
ab54b5656   Neeraj Sharma   implement library...
631
      studentData: [],
6c05a9f84   Neeraj Sharma   add functionalit ...
632
      editedItem: {},
687e0b929   Neeraj Sharma   add user,attenden...
633
634
      parentId: "",
      token: "",
6c05a9f84   Neeraj Sharma   add functionalit ...
635
      selectStudents: {},
b0e0491ab   Shikha Mishra   solve the issue o...
636
      editedIndex: -1,
687e0b929   Neeraj Sharma   add user,attenden...
637
    }),
8e8d14254   Shikha Mishra   Cleared data whil...
638
639
640
641
642
643
644
    watch: {
      addLibrary: function (val) {
        if (!val) {
          this.addBook = [];
        }
      },
    },
687e0b929   Neeraj Sharma   add user,attenden...
645
    methods: {
ab54b5656   Neeraj Sharma   implement library...
646
647
648
649
      getAllStudents() {
        this.showLoader = true;
        http()
          .get("/getStudentsList", {
99cd79184   Neeraj Sharma   implement all tas...
650
651
            params: {
              classId: this.selectStudents,
b0e0491ab   Shikha Mishra   solve the issue o...
652
              schoolId: this.$store.state.schoolId,
99cd79184   Neeraj Sharma   implement all tas...
653
            },
b0e0491ab   Shikha Mishra   solve the issue o...
654
            headers: { Authorization: "Bearer " + this.token },
ab54b5656   Neeraj Sharma   implement library...
655
          })
b0e0491ab   Shikha Mishra   solve the issue o...
656
          .then((response) => {
ab54b5656   Neeraj Sharma   implement library...
657
658
659
            this.studentData = response.data.data;
            this.showLoader = false;
          })
b0e0491ab   Shikha Mishra   solve the issue o...
660
          .catch((error) => {
ab54b5656   Neeraj Sharma   implement library...
661
            // console.log("err====>", err);
6c05a9f84   Neeraj Sharma   add functionalit ...
662
663
664
665
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
00e4bc4e1   Neeraj Sharma   fixed auntentication
666
              this.$store.dispatch("Role", null);
6c05a9f84   Neeraj Sharma   add functionalit ...
667
668
669
670
671
672
673
674
675
676
677
678
            }
          });
      },
      addLibraryData(item) {
        this.addBook.studentId = item._id;
        this.addLibrary = true;
      },
      editItem(item) {
        this.editedIndex = this.studentData.indexOf(item);
        this.editedItem = Object.assign({}, item);
        this.editStudentdialog = true;
      },
b0e0491ab   Shikha Mishra   solve the issue o...
679
      dates: function (date) {
6c05a9f84   Neeraj Sharma   add functionalit ...
680
681
682
        return moment(date).format("MMMM DD, YYYY");
      },
      profile(item) {
860da881d   Shikha Mishra   comment all consoles
683
        //   console.log("item", item);
6c05a9f84   Neeraj Sharma   add functionalit ...
684
685
686
687
688
689
690
        this.editedIndex = this.studentData.indexOf(item);
        this.editedItem = Object.assign({}, item);
        this.dialogStudents = true;
      },
      deleteItem(item) {
        let deleteStudentLibraryData = {
          studentId: item._id,
b0e0491ab   Shikha Mishra   solve the issue o...
691
          libraryId: item.libraryId,
6c05a9f84   Neeraj Sharma   add functionalit ...
692
693
694
695
        };
        http()
          .put(
            "/deleteLibrary",
f4df757fe   Neeraj Sharma   responsive vie in...
696
697
698
            confirm("Are you sure you want to delete this?") &&
              deleteStudentLibraryData
          )
b0e0491ab   Shikha Mishra   solve the issue o...
699
          .then((response) => {
6c05a9f84   Neeraj Sharma   add functionalit ...
700
701
702
703
            this.snackbar = true;
            this.text = "Delete Successfully";
            this.getAllStudents();
          })
b0e0491ab   Shikha Mishra   solve the issue o...
704
          .catch((error) => {
6c05a9f84   Neeraj Sharma   add functionalit ...
705
            // console.log(error);
ab54b5656   Neeraj Sharma   implement library...
706
707
          });
      },
6c05a9f84   Neeraj Sharma   add functionalit ...
708
709
710
711
712
713
714
715
716
      close() {
        this.dialog = false;
      },
      closeEditStudentDialog() {
        this.editStudentdialog = false;
      },
      closeViewStudent() {
        this.dialogStudents = false;
      },
8e8d14254   Shikha Mishra   Cleared data whil...
717
718
719
720
721
      closeAddLibraryModel() {
        this.addLibrary = false;
        this.addclass = [];
        this.addBook = [];
      },
ab54b5656   Neeraj Sharma   implement library...
722
723
724
      submit() {
        if (this.$refs.form.validate()) {
          this.loading = true;
99cd79184   Neeraj Sharma   implement all tas...
725
          this.addBook.schoolId = this.$store.state.schoolId;
ab54b5656   Neeraj Sharma   implement library...
726
          http()
6c05a9f84   Neeraj Sharma   add functionalit ...
727
            .put("/addLibrary", this.addBook)
b0e0491ab   Shikha Mishra   solve the issue o...
728
            .then((response) => {
6c05a9f84   Neeraj Sharma   add functionalit ...
729
730
731
              this.snackbar = true;
              this.text = "New Library Member added successfully";
              this.getAllStudents();
ab54b5656   Neeraj Sharma   implement library...
732
              this.clear();
6c05a9f84   Neeraj Sharma   add functionalit ...
733
              this.addLibrary = false;
ab54b5656   Neeraj Sharma   implement library...
734
735
              this.loading = false;
            })
b0e0491ab   Shikha Mishra   solve the issue o...
736
            .catch((error) => {
ab54b5656   Neeraj Sharma   implement library...
737
              // console.log(error);
6c05a9f84   Neeraj Sharma   add functionalit ...
738
739
              this.snackbar = true;
              this.text = error.response.data.message;
ab54b5656   Neeraj Sharma   implement library...
740
741
742
743
              this.loading = false;
            });
        }
      },
6c05a9f84   Neeraj Sharma   add functionalit ...
744
745
746
747
748
749
750
      clear() {
        this.$refs.form.reset();
      },
      save() {
        this.editedItem.studentId = this.editedItem._id;
        http()
          .put("/updateLibrary", this.editedItem)
b0e0491ab   Shikha Mishra   solve the issue o...
751
          .then((response) => {
6c05a9f84   Neeraj Sharma   add functionalit ...
752
753
754
755
756
            this.snackbar = true;
            this.text = "Edit  Library Member Successfully";
            this.getAllStudents();
            this.closeEditStudentDialog();
          })
b0e0491ab   Shikha Mishra   solve the issue o...
757
          .catch((error) => {
6c05a9f84   Neeraj Sharma   add functionalit ...
758
759
760
761
            this.snackbar = true;
            this.text = error.response.data.statusText;
          });
      },
687e0b929   Neeraj Sharma   add user,attenden...
762
763
764
      getAllClass() {
        http()
          .get("/getClassesList", {
99cd79184   Neeraj Sharma   implement all tas...
765
            params: {
b0e0491ab   Shikha Mishra   solve the issue o...
766
              schoolId: this.$store.state.schoolId,
99cd79184   Neeraj Sharma   implement all tas...
767
            },
b0e0491ab   Shikha Mishra   solve the issue o...
768
            headers: { Authorization: "Bearer " + this.token },
687e0b929   Neeraj Sharma   add user,attenden...
769
          })
b0e0491ab   Shikha Mishra   solve the issue o...
770
          .then((response) => {
687e0b929   Neeraj Sharma   add user,attenden...
771
772
            this.addclass = response.data.data;
          })
b0e0491ab   Shikha Mishra   solve the issue o...
773
          .catch((err) => {
687e0b929   Neeraj Sharma   add user,attenden...
774
775
776
            // console.log("err====>", err);
            this.$router.replace({ path: "/" });
          });
b0e0491ab   Shikha Mishra   solve the issue o...
777
      },
687e0b929   Neeraj Sharma   add user,attenden...
778
779
780
781
782
783
784
    },
    mounted() {
      // this.getStudentList();
      this.token = this.$store.state.token;
      this.getAllClass();
    },
    created() {
b0e0491ab   Shikha Mishra   solve the issue o...
785
      this.$root.$on("app:search", (search) => {
687e0b929   Neeraj Sharma   add user,attenden...
786
787
788
789
790
791
        this.search = search;
      });
    },
    beforeDestroy() {
      // dont forget to remove the listener
      this.$root.$off("app:search");
b0e0491ab   Shikha Mishra   solve the issue o...
792
    },
687e0b929   Neeraj Sharma   add user,attenden...
793
794
795
796
797
798
799
800
801
802
803
  };
  </script>
  <style scoped>
  .active {
    background-color: gray;
    color: white !important;
  }
  .activebtn {
    color: black !important;
  }
  </style>