Blame view

src/pages/Report/idCard.vue 30.3 KB
7c435b5bb   Shikha Mishra   added icard repor...
1
2
  <template>
    <v-container fluid class="body-color">
ecf8cdfdd   Neeraj Sharma   create design of ...
3
      <!-- **** Id Card Select options **** -->
7c435b5bb   Shikha Mishra   added icard repor...
4
5
6
7
      <v-card flat class="elevation-0 transparent">
        <v-form ref="form" v-model="valid" lazy-validation>
          <v-flex xs12 sm12 lg12>
            <v-layout wrap>
5ddc6bb04   Neeraj Sharma   complete design a...
8
              <v-flex xs12 sm12 lg4>
7c435b5bb   Shikha Mishra   added icard repor...
9
                <v-layout>
5ddc6bb04   Neeraj Sharma   complete design a...
10
                  <!-- <v-flex xs3 sm12 lg4 class="subheading mt-4">
7c435b5bb   Shikha Mishra   added icard repor...
11
                    <label class="right">Id Card For:</label>
a55b7fca2   Neeraj Sharma   complete design a...
12
                  </v-flex>-->
5ddc6bb04   Neeraj Sharma   complete design a...
13
                  <v-flex xs12 sm12 lg10 class="ml-2">
7c435b5bb   Shikha Mishra   added icard repor...
14
15
                    <v-autocomplete
                      v-model="getReport.role"
a55b7fca2   Neeraj Sharma   complete design a...
16
                      label="Select Type"
7c435b5bb   Shikha Mishra   added icard repor...
17
18
19
                      :items="getRoles"
                      item-text="name"
                      item-value="role"
7c435b5bb   Shikha Mishra   added icard repor...
20
21
22
23
24
25
                      @change="getRoleInputs(getReport.role)"
                      required
                    ></v-autocomplete>
                  </v-flex>
                </v-layout>
              </v-flex>
5ddc6bb04   Neeraj Sharma   complete design a...
26
              <v-flex xs12 sm12 lg4 v-if="showClass">
7c435b5bb   Shikha Mishra   added icard repor...
27
                <v-layout>
5ddc6bb04   Neeraj Sharma   complete design a...
28
                  <!-- <v-flex xs3 sm12 lg2 class="subheading mt-4">
7c435b5bb   Shikha Mishra   added icard repor...
29
                    <label class="right">Class:</label>
a55b7fca2   Neeraj Sharma   complete design a...
30
                  </v-flex>-->
5ddc6bb04   Neeraj Sharma   complete design a...
31
                  <v-flex xs12 sm12 lg10 class="ml-2">
7c435b5bb   Shikha Mishra   added icard repor...
32
33
34
35
36
37
                    <v-select
                      v-model="getReport.classId"
                      label="Select Class"
                      :items="classList"
                      item-text="classNum"
                      item-value="_id"
7c435b5bb   Shikha Mishra   added icard repor...
38
39
40
41
42
43
                      @change="getSections(getReport.classId)"
                      required
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
5ddc6bb04   Neeraj Sharma   complete design a...
44
              <v-flex xs12 sm12 lg4 v-if="showSections">
7c435b5bb   Shikha Mishra   added icard repor...
45
                <v-layout>
5ddc6bb04   Neeraj Sharma   complete design a...
46
                  <!-- <v-flex xs3 sm12 lg2 class="subheading mt-4">
7c435b5bb   Shikha Mishra   added icard repor...
47
                    <label class="right">Section:</label>
a55b7fca2   Neeraj Sharma   complete design a...
48
                  </v-flex>-->
5ddc6bb04   Neeraj Sharma   complete design a...
49
                  <v-flex xs12 sm12 lg10 class="ml-2">
7c435b5bb   Shikha Mishra   added icard repor...
50
51
52
53
54
55
56
57
                    <v-select
                      :items="addSection"
                      label="Select Section"
                      v-model="getReport.sectionId"
                      item-text="name"
                      item-value="_id"
                      name="Select Section"
                      @change="getStudents"
7c435b5bb   Shikha Mishra   added icard repor...
58
59
60
61
62
                      required
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
5ddc6bb04   Neeraj Sharma   complete design a...
63
              <v-flex xs12 sm12 lg4 v-if="showStudents">
7c435b5bb   Shikha Mishra   added icard repor...
64
                <v-layout>
5ddc6bb04   Neeraj Sharma   complete design a...
65
                  <!-- <v-flex xs3 sm12 lg4 class="subheading mt-4">
7c435b5bb   Shikha Mishra   added icard repor...
66
                    <label class="right">Student:</label>
a55b7fca2   Neeraj Sharma   complete design a...
67
                  </v-flex>-->
5ddc6bb04   Neeraj Sharma   complete design a...
68
                  <v-flex xs12 sm12 lg10 class="ml-2">
7c435b5bb   Shikha Mishra   added icard repor...
69
70
71
72
73
74
                    <v-select
                      :items="getStudentsList"
                      label="Select Student"
                      v-model="getReport._id"
                      item-text="name"
                      item-value="_id"
7c435b5bb   Shikha Mishra   added icard repor...
75
76
77
78
79
                      required
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
5ddc6bb04   Neeraj Sharma   complete design a...
80
              <v-flex xs12 sm12 lg4 v-if="showTeacher">
7c435b5bb   Shikha Mishra   added icard repor...
81
                <v-layout>
5ddc6bb04   Neeraj Sharma   complete design a...
82
                  <!-- <v-flex xs3 sm12 lg2 class="subheading mt-4">
7c435b5bb   Shikha Mishra   added icard repor...
83
                    <label class="right">Teacher:</label>
a55b7fca2   Neeraj Sharma   complete design a...
84
                  </v-flex>-->
5ddc6bb04   Neeraj Sharma   complete design a...
85
                  <v-flex xs12 sm12 lg10 class="ml-2">
7c435b5bb   Shikha Mishra   added icard repor...
86
87
88
89
90
91
                    <v-select
                      v-model="getReport._id"
                      label="Select Teacher"
                      :items="teacherList"
                      item-text="name"
                      item-value="_id"
7c435b5bb   Shikha Mishra   added icard repor...
92
93
94
95
96
                      required
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
5ddc6bb04   Neeraj Sharma   complete design a...
97
              <v-flex xs12 sm12 lg4 v-if="showAdmin">
7c435b5bb   Shikha Mishra   added icard repor...
98
                <v-layout>
5ddc6bb04   Neeraj Sharma   complete design a...
99
                  <!-- <v-flex xs3 sm12 lg2 class="subheading mt-4">
7c435b5bb   Shikha Mishra   added icard repor...
100
                    <label class="right">Admin:</label>
a55b7fca2   Neeraj Sharma   complete design a...
101
                  </v-flex>-->
5ddc6bb04   Neeraj Sharma   complete design a...
102
                  <v-flex xs12 sm12 lg10 class="ml-2">
7c435b5bb   Shikha Mishra   added icard repor...
103
104
105
106
107
108
                    <v-select
                      v-model="getReport._id"
                      label="Select Admin"
                      :items="userData"
                      item-text="name"
                      item-value="_id"
7c435b5bb   Shikha Mishra   added icard repor...
109
110
111
112
113
                      required
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
5ddc6bb04   Neeraj Sharma   complete design a...
114
              <v-flex xs12 sm12 lg4 v-if="showAccountant">
7c435b5bb   Shikha Mishra   added icard repor...
115
                <v-layout>
5ddc6bb04   Neeraj Sharma   complete design a...
116
                  <!-- <v-flex xs3 sm12 lg2 class="subheading mt-4">
7c435b5bb   Shikha Mishra   added icard repor...
117
                    <label class="right">Accountant:</label>
a55b7fca2   Neeraj Sharma   complete design a...
118
                  </v-flex>-->
5ddc6bb04   Neeraj Sharma   complete design a...
119
                  <v-flex xs12 sm12 lg10 class="ml-2">
7c435b5bb   Shikha Mishra   added icard repor...
120
121
122
123
124
125
                    <v-select
                      v-model="getReport._id"
                      label="Select Accountant"
                      :items="Users"
                      item-text="name"
                      item-value="_id"
7c435b5bb   Shikha Mishra   added icard repor...
126
127
128
129
130
                      required
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
5ddc6bb04   Neeraj Sharma   complete design a...
131
              <v-flex xs12 sm12 lg4 v-if="showLibrarian">
7c435b5bb   Shikha Mishra   added icard repor...
132
                <v-layout>
5ddc6bb04   Neeraj Sharma   complete design a...
133
                  <!-- <v-flex xs3 sm12 lg2 class="subheading mt-4">
7c435b5bb   Shikha Mishra   added icard repor...
134
                    <label class="right">Librarian:</label>
a55b7fca2   Neeraj Sharma   complete design a...
135
                  </v-flex>-->
5ddc6bb04   Neeraj Sharma   complete design a...
136
                  <v-flex xs12 sm12 lg10 class="ml-2">
7c435b5bb   Shikha Mishra   added icard repor...
137
138
139
140
141
142
                    <v-select
                      v-model="getReport._id"
                      label="Select Librarian"
                      :items="Users"
                      item-text="name"
                      item-value="_id"
7c435b5bb   Shikha Mishra   added icard repor...
143
144
145
146
147
                      required
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
5ddc6bb04   Neeraj Sharma   complete design a...
148
              <v-flex xs12 sm12 lg4>
7c435b5bb   Shikha Mishra   added icard repor...
149
                <v-layout>
a55b7fca2   Neeraj Sharma   complete design a...
150
                  <!-- <v-flex xs4 sm4 lg2 class="subheading mt-4">
7c435b5bb   Shikha Mishra   added icard repor...
151
                    <label class="right">Type:</label>
a55b7fca2   Neeraj Sharma   complete design a...
152
                  </v-flex>-->
5ddc6bb04   Neeraj Sharma   complete design a...
153
                  <v-flex xs12 sm12 lg10 class="ml-2">
7c435b5bb   Shikha Mishra   added icard repor...
154
                    <v-autocomplete
a55b7fca2   Neeraj Sharma   complete design a...
155
                      label="Select View Type"
7c435b5bb   Shikha Mishra   added icard repor...
156
                      type="text"
7c435b5bb   Shikha Mishra   added icard repor...
157
158
159
160
                      :items="typeList"
                      v-model="getReport.form"
                      item-text="name"
                      item-value="value"
a55b7fca2   Neeraj Sharma   complete design a...
161
                      :rules="typeRules"
ecf8cdfdd   Neeraj Sharma   create design of ...
162
                      @change="getReportType(getReport.form)"
7c435b5bb   Shikha Mishra   added icard repor...
163
164
165
166
167
                      required
                    ></v-autocomplete>
                  </v-flex>
                </v-layout>
              </v-flex>
5ddc6bb04   Neeraj Sharma   complete design a...
168
              <v-flex xs12 sm12 lg4>
7c435b5bb   Shikha Mishra   added icard repor...
169
170
171
172
173
                <v-btn
                  @click="getCards"
                  round
                  dark
                  :loading="loading"
0fa3b3a79   Neeraj Sharma   add loader after ...
174
                  class="open-dialog-button mt-3"
7c435b5bb   Shikha Mishra   added icard repor...
175
176
177
178
179
180
                >Get Report</v-btn>
              </v-flex>
            </v-layout>
          </v-flex>
        </v-form>
      </v-card>
ecf8cdfdd   Neeraj Sharma   create design of ...
181
      <div>
7c435b5bb   Shikha Mishra   added icard repor...
182
183
184
185
186
187
188
189
190
191
192
        <v-layout v-show="showReport">
          <v-flex xs12>
            <v-card class="transparent elevation-0">
              <v-layout>
                <v-flex xs12>
                  <v-btn class="open-dialog-button right" round dark @click="prindIDCardReport()">
                    Print
                    <v-icon right dark>print</v-icon>
                  </v-btn>
                </v-flex>
              </v-layout>
ecf8cdfdd   Neeraj Sharma   create design of ...
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
            </v-card>
            <v-container grid-list-md id="printMe">
              <v-layout class="col-sm-12">
                <div
                  style="font-family: arial;
                    max-width: 794px;
                    max-height: 1123px;
                    margin-left: auto;
                    margin-right: auto;
                    -webkit-print-color-adjust: exact;"
                >
                  <div
                    style="
                       float: left;
                       height: 520px;
                       width: 520px;
                       background: #fff;
                       border: 1px solid lightgray;
                       position:relative;"
                  >
                    <!-- bottom-right-side-image -->
                    <img
                      src="/static/icon/shape1.png"
                      alt="shape"
                      style="position:absolute;width: 90px;"
                    />
                    <!-- Front Side -->
                    <v-layout
                      style="
                       text-align: center;
                       margin-top: 50px;"
                      v-if="frontPart"
                    >
                      <v-flex xs12>
                        <!-- school Logo Url -->
                        <img
                          v-if="getCard.schoolLogoUrl"
                          :src="getCard.schoolLogoUrl"
                          alt="schoollogo"
                          style="
                           width: 110px;
                           margin-top:10px;
                           overflow:hidden"
                        />
                        <v-layout style="margin:auto">
                          <!-- profile url -->
                          <img
                            v-if="getCard.profilePicUrl"
                            :src="getCard.profilePicUrl"
                            alt="profileImage"
                            style=";
                            width: 110px;
                            margin:10px auto;
                            width: 110px;
                            margin: 10px auto;
                            border: 3px solid #323232;
                            border-radius: 12px;"
                          />
                          <img
                            style=";
                          width: 110px;
                          margin:10px auto;
                          width: 110px;
                          margin: 10px auto;"
                            alt="dummy"
                            src="/static/icon/user.png"
                            v-if="!getCard.profilePicUrl && getCard.role != '2'"
                          />
                        </v-layout>
  
                        <p
                          style="color: #302653;font-size:24px;
0fa3b3a79   Neeraj Sharma   add loader after ...
265
266
                            letter-spacing: 4px;
                            margin-bottom:14px;"
ecf8cdfdd   Neeraj Sharma   create design of ...
267
268
                        >
                          <b>{{ getCard.name}}</b>
7c435b5bb   Shikha Mishra   added icard repor...
269
                        </p>
ecf8cdfdd   Neeraj Sharma   create design of ...
270
                        <p
0fa3b3a79   Neeraj Sharma   add loader after ...
271
272
273
274
                          style="color: #302653;
                            font-size:14px;
                            letter-spacing: 4px;
                            margin-bottom:14px;"
ecf8cdfdd   Neeraj Sharma   create design of ...
275
276
                        >
                          <b>{{ getCard.gender}}</b>
7c435b5bb   Shikha Mishra   added icard repor...
277
                        </p>
ecf8cdfdd   Neeraj Sharma   create design of ...
278
279
                        <p
                          v-if="getCard.classId"
0fa3b3a79   Neeraj Sharma   add loader after ...
280
281
282
283
                          style="color: #302653;
                            font-size:24px;
                            letter-spacing: 4px;
                            margin-bottom:14px;"
ecf8cdfdd   Neeraj Sharma   create design of ...
284
285
286
                        >{{ getCard.classId.classNum }}</p>
                        <p
                          v-if="getCard.classId"
0fa3b3a79   Neeraj Sharma   add loader after ...
287
288
289
290
                          style="color: #302653;
                            font-size:24px;
                            letter-spacing: 4px;
                            margin-bottom:14px;"
ecf8cdfdd   Neeraj Sharma   create design of ...
291
292
293
                        >{{ getCard.sectionId.name }}</p>
                        <p
                          v-if="getCard.rollNo"
0fa3b3a79   Neeraj Sharma   add loader after ...
294
295
296
297
                          style="color: #302653;
                             font-size:24px;
                            letter-spacing: 2px;
                            margin-bottom:10px;"
ecf8cdfdd   Neeraj Sharma   create design of ...
298
299
300
                        >Roll: {{ getCard.rollNo }}</p>
                        <p
                          v-if="getCard.joinDate"
0fa3b3a79   Neeraj Sharma   add loader after ...
301
302
303
                          style="color: #302653;
                            margin-bottom:10px;
                            font-size:16px;
ecf8cdfdd   Neeraj Sharma   create design of ...
304
305
306
307
                            letter-spacing: 2px;"
                        >{{ dates(getCard.joinDate) }}</p>
                        <p
                          v-if="getCard.joiningDate"
0fa3b3a79   Neeraj Sharma   add loader after ...
308
309
310
                          style="color: #302653;
                            margin-bottom:10px;
                            font-size:16px;
ecf8cdfdd   Neeraj Sharma   create design of ...
311
312
313
314
                            letter-spacing: 2px;"
                        >{{ dates(getCard.joiningDate) }}</p>
                        <p
                          v-if="getCard.phone"
0fa3b3a79   Neeraj Sharma   add loader after ...
315
316
317
                          style="color: #302653;
                            margin-bottom:10px;
                            font-size:16px;
ecf8cdfdd   Neeraj Sharma   create design of ...
318
319
320
321
322
323
324
                            letter-spacing: 2px;"
                        >{{ getCard.phone }}</p>
                        <p
                          style="
                          font-size: 19px;
                          font-weight: 100;
                          color: rgb(48, 38, 83);
0fa3b3a79   Neeraj Sharma   add loader after ...
325
326
                          letter-spacing: 5px;
                          margin-bottom:10px;"
ecf8cdfdd   Neeraj Sharma   create design of ...
327
328
329
                        >
                          <span v-if="getCard.mobile">{{ getCard.mobile}}</span>
                          <span v-if="getCard.mobileNo">{{ getCard.mobileNo }}</span>
7c435b5bb   Shikha Mishra   added icard repor...
330
                        </p>
ecf8cdfdd   Neeraj Sharma   create design of ...
331
332
333
334
335
336
337
338
339
340
341
342
                        <!-- <p
                          style="
                          font-size: 17px;
                          font-weight: 100;
                          color: rgb(48, 38, 83);
                          letter-spacing: 4px;"
                        >{{ getCard.address}}</p>-->
                        <p
                          style="
                          font-size: 17px;
                          font-weight: 100;
                          color: rgb(48, 38, 83);
0fa3b3a79   Neeraj Sharma   add loader after ...
343
344
                          letter-spacing: 4px;
                          margin-bottom:14px;"
ecf8cdfdd   Neeraj Sharma   create design of ...
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
                        >{{ getCard.email}}</p>
                      </v-flex>
                    </v-layout>
                    <!-- back side -->
                    <v-layout style="
                       text-align: center;" v-if="backPart">
                      <v-flex xs12>
                        <!-- school Logo Url -->
                        <img
                          v-if="getCard.schoolLogoUrl"
                          :src="getCard.schoolLogoUrl"
                          alt="schoollogo"
                          style="
                           width: 110px;
                           margin-top:10px;
                           overflow:hidden"
                        />
                        <img
                          v-if="getCard.schoolId"
                          :src="getCard.schoolId.schoolLogoUrl"
                          alt="schoollogo"
                          style="
                           width: 110px;
                           margin-top:10px;
                           overflow:hidden"
                        />
                        <!-- <v-layout style="margin:auto">
                          <img
                            v-if="getCard.profilePicUrl"
                            :src="getCard.profilePicUrl"
                            alt="profileImage"
                            style=";
                            width: 110px;
                            margin:10px auto;
                            width: 110px;
                            margin: 10px auto;
                            border: 3px solid #323232;
                            border-radius: 12px;"
                          />
                        </v-layout>-->
                        <p
                          v-if="getCard.schoolLogoUrl"
0fa3b3a79   Neeraj Sharma   add loader after ...
387
388
389
390
                          style="color: #302653;
                            font-size:24px;
                            letter-spacing: 4px;
                            margin-bottom:14px;"
ecf8cdfdd   Neeraj Sharma   create design of ...
391
392
                        >
                          <b>{{ getCard.name}}</b>
7c435b5bb   Shikha Mishra   added icard repor...
393
                        </p>
a55b7fca2   Neeraj Sharma   complete design a...
394

ecf8cdfdd   Neeraj Sharma   create design of ...
395
396
397
398
399
400
                        <p
                          v-if="getCard.city"
                          style="
                          font-size: 17px;
                          font-weight: 100;
                          color: rgb(48, 38, 83);
0fa3b3a79   Neeraj Sharma   add loader after ...
401
402
                          letter-spacing: 4px;
                          margin-bottom:14px;"
ecf8cdfdd   Neeraj Sharma   create design of ...
403
404
405
406
407
408
                        >{{ getCard.city}}</p>
                        <p
                          style="
                          font-size: 17px;
                          font-weight: 100;
                          color: rgb(48, 38, 83);
0fa3b3a79   Neeraj Sharma   add loader after ...
409
410
                          letter-spacing: 4px;
                          margin-bottom:14px;"
ecf8cdfdd   Neeraj Sharma   create design of ...
411
412
413
414
415
416
                        >
                          {{ getCard.address }}
                          {{ getCard.presentAddress }}
                          <span
                            v-if="getCard.state"
                          >({{ getCard.state }})</span>
7c435b5bb   Shikha Mishra   added icard repor...
417
                        </p>
ecf8cdfdd   Neeraj Sharma   create design of ...
418
419
420
421
422
423
                        <p
                          v-if="getCard.establishmentYear"
                          style="
                          font-size: 17px;
                          font-weight: 100;
                          color: rgb(48, 38, 83);
0fa3b3a79   Neeraj Sharma   add loader after ...
424
425
                          letter-spacing: 4px;
                          margin-bottom:14px;"
ecf8cdfdd   Neeraj Sharma   create design of ...
426
427
428
429
                        >{{ getCard.establishmentYear }}</p>
                      </v-flex>
                    </v-layout>
                    <!-- bottom-right-side-image -->
37cb39130   Shikha Mishra   change the ui of ...
430
                    <img
ecf8cdfdd   Neeraj Sharma   create design of ...
431
432
433
434
435
436
                      src="static/icon/shape2.png"
                      alt="shape2"
                      style="bottom: 0;
                        position: absolute;
                        right: 0;
                        width: 110px;"
37cb39130   Shikha Mishra   change the ui of ...
437
                    />
37cb39130   Shikha Mishra   change the ui of ...
438
439
                  </div>
                </div>
36883961f   Shikha Mishra   set ui of icard r...
440
              </v-layout>
ecf8cdfdd   Neeraj Sharma   create design of ...
441
            </v-container>
7c435b5bb   Shikha Mishra   added icard repor...
442
443
444
          </v-flex>
        </v-layout>
      </div>
ecf8cdfdd   Neeraj Sharma   create design of ...
445
446
447
448
449
450
451
452
      <v-snackbar
        :timeout="timeout"
        :top="y === 'top'"
        :right="x === 'right'"
        :vertical="mode === 'vertical'"
        v-model="snackbar"
        :color="color"
      >{{ text }}</v-snackbar>
5ddc6bb04   Neeraj Sharma   complete design a...
453
454
455
      <div class="loader" v-if="showLoader">
        <v-progress-circular indeterminate color="white"></v-progress-circular>
      </div>
7c435b5bb   Shikha Mishra   added icard repor...
456
457
458
459
460
461
462
463
464
    </v-container>
  </template>
  
  <script>
  import http from "@/Services/http.js";
  import moment from "moment";
  
  export default {
    data: () => ({
5ddc6bb04   Neeraj Sharma   complete design a...
465
      showLoader: false,
7c435b5bb   Shikha Mishra   added icard repor...
466
467
468
      valid: true,
      report: {},
      userData: {},
ecf8cdfdd   Neeraj Sharma   create design of ...
469
470
471
472
473
474
475
      snackbar: false,
      color: "",
      y: "top",
      x: "right",
      mode: "",
      timeout: 10000,
      text: "",
7c435b5bb   Shikha Mishra   added icard repor...
476
477
478
479
480
481
482
483
484
485
      loading: false,
      showReport: false,
      frontPart: false,
      backPart: false,
      showClass: false,
      showTeacher: false,
      showAdmin: false,
      showAccountant: false,
      showLibrarian: false,
      hideprintIdCard: false,
37cb39130   Shikha Mishra   change the ui of ...
486
      hidebackprintIdCard: false,
ecf8cdfdd   Neeraj Sharma   create design of ...
487
488
      showStudents: false,
      showSections: false,
7c435b5bb   Shikha Mishra   added icard repor...
489
490
491
492
493
494
495
496
      getRoles: [],
      classList: [],
      getCard: [],
      addSection: [],
      getStudentsList: [],
      teacherList: [],
      userData: [],
      Users: [],
ecf8cdfdd   Neeraj Sharma   create design of ...
497
498
499
500
501
502
503
504
505
      getReport: {},
      // cardRules: [v => !!v || "Id-Card Field is required"],
      // classRules: [v => !!v || "Class Field is required"],
      // sectionRules: [v => !!v || "Section Field is required"],
      // studentRules: [v => !!v || "Student Field is required"],
      // teacherRules: [v => !!v || "Teacher Field is required"],
      // adminRules: [v => !!v || "Admin Field is required"],
      // accountantRules: [v => !!v || "Accountant Field is required"],
      // librarianRules: [v => !!v || "Librarian Field is required"],
7c435b5bb   Shikha Mishra   added icard repor...
506

a55b7fca2   Neeraj Sharma   complete design a...
507
      typeRules: [v => !!v || "Type is required"],
ecf8cdfdd   Neeraj Sharma   create design of ...
508
      // backgroundRules: [v => !!v || "Background is required"],
7c435b5bb   Shikha Mishra   added icard repor...
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
      typeList: [
        {
          name: "Front Part",
          value: "frontPart"
        },
        {
          name: "Back Part",
          value: "backPart"
        }
      ],
      backgroundList: ["Yes", "No"]
    }),
  
    mounted() {
      this.token = this.$store.state.token;
      this.getUserData();
      this.getRole();
    },
  
    methods: {
ecf8cdfdd   Neeraj Sharma   create design of ...
529
530
531
532
533
      dates: function(date) {
        return moment(date).format("MMMM DD, YYYY");
        return date;
      },
      getReportType() {
7c435b5bb   Shikha Mishra   added icard repor...
534
535
536
537
538
539
540
541
542
543
        if (this.getReport.form === "frontPart") {
          this.frontPart = true;
          this.backPart = false;
        }
        if (this.getReport.form === "backPart") {
          this.frontPart = false;
          this.backPart = true;
        }
      },
      getRoleInputs(role) {
ecf8cdfdd   Neeraj Sharma   create design of ...
544
545
546
547
        console.log("role", role);
        this.showReport = false;
        this.getReport._id = "";
        this.getCard = "";
7c435b5bb   Shikha Mishra   added icard repor...
548
549
550
        if (role === 4) {
          // console.log("role", role);
          this.showClass = true;
ecf8cdfdd   Neeraj Sharma   create design of ...
551
552
553
554
555
556
          this.showTeacher = false;
          this.showAdmin = false;
          this.showAccountant = false;
          this.showLibrarian = false;
          this.showStudents = false;
          this.showSections = false;
7c435b5bb   Shikha Mishra   added icard repor...
557
558
559
560
          this.getClass();
        }
        if (role === 3) {
          this.showTeacher = true;
ecf8cdfdd   Neeraj Sharma   create design of ...
561
562
563
564
565
566
          this.showClass = false;
          this.showAdmin = false;
          this.showAccountant = false;
          this.showLibrarian = false;
          this.showStudents = false;
          this.showSections = false;
7c435b5bb   Shikha Mishra   added icard repor...
567
568
569
570
          this.getTeacherList();
        }
        if (role === 2) {
          this.showAdmin = true;
ecf8cdfdd   Neeraj Sharma   create design of ...
571
572
573
574
575
576
          this.showTeacher = false;
          this.showClass = false;
          this.showAccountant = false;
          this.showLibrarian = false;
          this.showStudents = false;
          this.showSections = false;
7c435b5bb   Shikha Mishra   added icard repor...
577
578
579
580
          this.getUserData();
        }
        if (role === 6) {
          this.showAccountant = true;
ecf8cdfdd   Neeraj Sharma   create design of ...
581
582
583
584
585
586
          this.showAdmin = false;
          this.showTeacher = false;
          this.showClass = false;
          this.showLibrarian = false;
          this.showStudents = false;
          this.showSections = false;
a55b7fca2   Neeraj Sharma   complete design a...
587
          this.getUsersList(role);
7c435b5bb   Shikha Mishra   added icard repor...
588
589
590
        }
        if (role === 7) {
          this.showLibrarian = true;
ecf8cdfdd   Neeraj Sharma   create design of ...
591
592
593
594
595
596
          this.showAccountant = false;
          this.showAdmin = false;
          this.showTeacher = false;
          this.showClass = false;
          this.showStudents = false;
          this.showSections = false;
a55b7fca2   Neeraj Sharma   complete design a...
597
          this.getUsersList(role);
7c435b5bb   Shikha Mishra   added icard repor...
598
599
600
601
602
603
604
605
        }
      },
  
      prindIDCardReport() {
        // Pass the element id here
        this.$htmlToPaper("printMe");
      },
      getUserData() {
5ddc6bb04   Neeraj Sharma   complete design a...
606
        this.showLoader = true;
7c435b5bb   Shikha Mishra   added icard repor...
607
608
609
610
        http()
          .get("/getParticularUserDetail")
          .then(response => {
            this.userData = response.data.data;
5ddc6bb04   Neeraj Sharma   complete design a...
611
            this.showLoader = false;
7c435b5bb   Shikha Mishra   added icard repor...
612
613
614
            // this.adminList = response.data.data;
          })
          .catch(error => {
5ddc6bb04   Neeraj Sharma   complete design a...
615
            this.showLoader = false;
ecf8cdfdd   Neeraj Sharma   create design of ...
616
617
618
619
620
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
            }
7c435b5bb   Shikha Mishra   added icard repor...
621
622
623
624
625
626
627
628
629
          });
      },
      getRole() {
        this.showLoader = true;
        http()
          .get("/getRolesList", {
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
ecf8cdfdd   Neeraj Sharma   create design of ...
630
631
632
633
634
635
636
637
638
            var getRoles = [];
            getRoles = response.data.data;
            // if (getRoles[0].role !== 1) {
            //   getRoles = response.data.data;
            // }
            for (let i = 0; i < getRoles.length; i++) {
              if (getRoles[i].role != "1" && getRoles[i].role != "5") {
                this.getRoles.push(getRoles[i]);
              }
36883961f   Shikha Mishra   set ui of icard r...
639
            }
7c435b5bb   Shikha Mishra   added icard repor...
640
641
642
643
            this.showLoader = false;
          })
          .catch(error => {
            this.showLoader = false;
ecf8cdfdd   Neeraj Sharma   create design of ...
644
645
646
647
648
649
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
              this.$store.dispatch("Role", null);
            }
7c435b5bb   Shikha Mishra   added icard repor...
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
          });
      },
      getClass() {
        console.log("get classes");
        this.showLoader = true;
        http()
          .get("/getClassesList", {
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
            this.classList = response.data.data;
            this.showLoader = false;
          })
          .catch(error => {
            this.showLoader = false;
            // console.log("err====>", err);
          });
      },
      getSections(_id) {
        this.showLoader = true;
        http()
          .get(
            "/getSectionsList",
            { params: { classId: _id } },
            {
              headers: { Authorization: "Bearer " + this.token }
            }
          )
          .then(response => {
            this.addSection = response.data.data;
ecf8cdfdd   Neeraj Sharma   create design of ...
680
            this.showSections = true;
7c435b5bb   Shikha Mishra   added icard repor...
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
            this.showLoader = false;
          })
          .catch(err => {
            this.showLoader = false;
            // console.log("err====>", err);
          });
      },
      getStudents() {
        this.showLoader = true;
        http()
          .get("/getStudentWithClass", {
            params: {
              classId: this.getReport.classId,
              sectionId: this.getReport.sectionId
            }
          })
          .then(response => {
            this.getStudentsList = response.data.data;
ecf8cdfdd   Neeraj Sharma   create design of ...
699
            this.showStudents = true;
7c435b5bb   Shikha Mishra   added icard repor...
700
701
702
703
704
705
706
707
            this.showLoader = false;
          })
          .catch(error => {
            console.log("err====>", error);
            this.showLoader = false;
          });
      },
      getCards() {
a55b7fca2   Neeraj Sharma   complete design a...
708
        if (this.$refs.form.validate()) {
fe0d05d29   Neeraj Sharma   complete design a...
709
          this.showLoader = true;
a55b7fca2   Neeraj Sharma   complete design a...
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
          http()
            .get("/getIdCardDetail", {
              headers: {
                Authorization: "Bearer " + this.token
              },
              params: {
                profileId: this.getReport._id,
                role: this.getReport.role
              }
            })
            .then(response => {
              this.getCard = "";
              var data = response.data.data;
              if (
                Object.keys(data.adminData).length != 0 &&
                data.adminData.constructor === Object
              ) {
                this.getCard = response.data.data.adminData;
                console.log("this.getCard ", this.getCard);
              }
              if (
                Object.keys(data.teachersData).length != 0 &&
                data.teachersData.constructor === Object
              ) {
                this.getCard = response.data.data.teachersData;
                console.log("this.getCard--teachersData ", this.getCard);
              }
              if (
                Object.keys(data.studentData).length != 0 &&
                data.studentData.constructor === Object
              ) {
                this.getCard = response.data.data.studentData;
                console.log("this.getCard--studentData ", this.getCard);
              }
              if (
                Object.keys(data.usersData).length != 0 &&
                data.usersData.constructor === Object
              ) {
                this.getCard = response.data.data.usersData;
                console.log("this.getCard--usersData   ", this.getCard);
              }
              // console.log("this.getCard--all ", response.data.data);
              this.showLoader = false;
              this.showReport = true;
            })
            .catch(error => {
              this.showLoader = false;
              console.log("error", error.response.data.errors);
              if (error.response.data.errors) {
                this.snackbar = true;
                this.text = " Field is required";
                this.color = "error";
              }
            });
        }
7c435b5bb   Shikha Mishra   added icard repor...
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
      },
      getTeacherList() {
        this.showLoader = true;
        var token = this.$store.state.token;
        http()
          .get("/getTeachersList", {
            headers: { Authorization: "Bearer " + token }
          })
          .then(response => {
            this.teacherList = response.data.data;
            this.showLoader = false;
          })
          .catch(error => {
            this.showLoader = false;
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
            }
          });
      },
a55b7fca2   Neeraj Sharma   complete design a...
786
      getUsersList(role) {
7c435b5bb   Shikha Mishra   added icard repor...
787
788
789
        this.showLoader = true;
        var token = this.$store.state.token;
        http()
a55b7fca2   Neeraj Sharma   complete design a...
790
          .get("/getUsersList?role=" + role, {
7c435b5bb   Shikha Mishra   added icard repor...
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
            headers: { Authorization: "Bearer " + token }
          })
          .then(response => {
            this.Users = response.data.data;
            this.showLoader = false;
          })
          .catch(error => {
            this.showLoader = false;
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
            }
          });
      },
      getParentDetails() {
        http()
          .get("getParentsList", {
            headers: {
              Authorization: "Bearer " + this.$store.state.token
            }
          })
          .then(response => {
            this.parentsList = response.data.data;
          })
          .catch(error => {
            // console.log("err====>", error.response.data.message);
            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);
            }
          });
      }
    }
  };
  </script>
  
  <style scoped>
  .Data {
    width: 100%;
    float: left;
    margin-bottom: 0px;
    padding: 0 15px;
    font-size: 14px;
    margin-top: 5px;
    text-align: justify;
  }
36883961f   Shikha Mishra   set ui of icard r...
841
842
843
844
845
846
847
848
  .idcardreport {
    font-family: arial;
    max-width: 794px;
    max-height: 1123px;
    margin-left: auto;
    margin-right: auto;
    -webkit-print-color-adjust: exact;
  }
cc7844a9d   Shikha Mishra   improve print pat...
849
850
851
852
  .idcardreport1 {
    text-align: center;
    margin-left: 35%;
  }
7c435b5bb   Shikha Mishra   added icard repor...
853
854
  .icard-front {
    margin: 3px;
36883961f   Shikha Mishra   set ui of icard r...
855
    float: left;
37cb39130   Shikha Mishra   change the ui of ...
856
    padding: 10px;
37cb39130   Shikha Mishra   change the ui of ...
857
    text-align: center;
ecf8cdfdd   Neeraj Sharma   create design of ...
858
859
860
861
    height: 520px;
    width: 520px;
    background: #fff;
    border: 1px solid lightgray;
37cb39130   Shikha Mishra   change the ui of ...
862
863
864
865
866
  }
  .print-data {
    margin: 3px;
    float: left;
    /* border: 1px solid #000; */
7c435b5bb   Shikha Mishra   added icard repor...
867
    padding: 10px;
37cb39130   Shikha Mishra   change the ui of ...
868
    /* width: 55%; */
7c435b5bb   Shikha Mishra   added icard repor...
869
    text-align: center;
37cb39130   Shikha Mishra   change the ui of ...
870
871
    height: 95%;
  }
cc7844a9d   Shikha Mishra   improve print pat...
872
873
874
  .rightside {
    float: right !important;
  }
36883961f   Shikha Mishra   set ui of icard r...
875
  .icard-front h2 {
37cb39130   Shikha Mishra   change the ui of ...
876
877
878
879
880
881
882
883
884
885
886
887
888
    font-size: 30px;
  }
  .icard-back h2 {
    font-size: 30px;
  }
  .print-data h2 {
    font-size: 30px;
    text-align: center;
  }
  .print-data img {
    width: 70px;
    height: 70px;
    margin-bottom: 5px;
7c435b5bb   Shikha Mishra   added icard repor...
889
890
  }
  .icard-front img {
37cb39130   Shikha Mishra   change the ui of ...
891
892
893
894
895
896
897
898
899
900
    width: 70px;
    height: 70px;
    margin-bottom: 5px;
  }
  .icard-back img {
    width: 50px;
    height: 50px;
    margin-bottom: 5px;
  }
  .icard-img {
7c435b5bb   Shikha Mishra   added icard repor...
901
902
903
    width: 50px;
    height: 50px;
    margin-bottom: 5px;
37cb39130   Shikha Mishra   change the ui of ...
904
905
    margin-top: 5px;
    border: 1px solid #ddd;
7c435b5bb   Shikha Mishra   added icard repor...
906
907
  }
  .icard-data {
36883961f   Shikha Mishra   set ui of icard r...
908
    /* font-family: Arial; */
7c435b5bb   Shikha Mishra   added icard repor...
909
910
911
912
913
914
915
916
    max-width: 794px;
    max-height: 1123px;
    margin-left: auto;
    margin-right: auto;
    -webkit-print-color-adjust: exact;
  }
  .icard-back {
    margin: 3px;
37cb39130   Shikha Mishra   change the ui of ...
917
918
919
920
921
922
923
924
925
926
    /* float: left; */
    /* border: 1px solid #000; */
    padding: 10px;
    /* width: 55%; */
    text-align: center;
    /* height: 95%; */
    /* margin-top: 35%; */
  }
  .back-icard {
    margin: 3px;
7c435b5bb   Shikha Mishra   added icard repor...
927
    padding: 10px;
7c435b5bb   Shikha Mishra   added icard repor...
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
  }
  .icard-back h3 {
    background-color: #000;
    color: #fff;
    font-size: 13px;
    padding: 5px 0px;
    margin: 5px;
    margin-top: 13px;
  }
  .icard-back h5 {
    font-size: 11px;
    color: #000;
    font-weight: bold;
    padding: 5px 0px;
  }
37cb39130   Shikha Mishra   change the ui of ...
943
  /* .icard-back p {
7c435b5bb   Shikha Mishra   added icard repor...
944
945
946
947
    font-size: 15px;
    color: #000;
    font-weight: 500px;
    line-height: 17px;
37cb39130   Shikha Mishra   change the ui of ...
948
  } */
7c435b5bb   Shikha Mishra   added icard repor...
949
950
951
952
953
  .school-address {
    /* width: 40%; */
    font-weight: 500px;
    color: #000;
  }
cc7844a9d   Shikha Mishra   improve print pat...
954
955
956
957
958
  .address {
    font-weight: 500px;
    color: #000;
    text-align: center;
  }
7c435b5bb   Shikha Mishra   added icard repor...
959
960
961
962
963
964
965
966
967
968
969
  .icard-bottom {
    padding-top: 5px;
    text-align: center;
  }
  .qrcode {
    float: left;
    width: 50%;
  }
  .qrcode img {
    width: 60px;
    height: 60px;
37cb39130   Shikha Mishra   change the ui of ...
970
    margin-top: 15px;
7c435b5bb   Shikha Mishra   added icard repor...
971
972
973
974
  }
  .session {
    float: right;
    width: 70%;
37cb39130   Shikha Mishra   change the ui of ...
975
    margin-top: 15px;
7c435b5bb   Shikha Mishra   added icard repor...
976
977
978
979
980
981
982
983
984
985
986
987
  }
  @media screen and (max-width: 360px) {
    .icard-front {
      width: 316px;
      height: 418px;
      float: inherit;
    }
    .icard-back {
      float: left;
    }
  }
  </style>