Blame view

src/pages/Report/idCard.vue 30.1 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 xs12 sm12 lg10 class="ml-2">
7c435b5bb   Shikha Mishra   added icard repor...
11
12
                    <v-autocomplete
                      v-model="getReport.role"
a55b7fca2   Neeraj Sharma   complete design a...
13
                      label="Select Type"
7c435b5bb   Shikha Mishra   added icard repor...
14
15
                      :items="getRoles"
                      item-text="name"
d84fa5db2   Amber Dev   bugs in report id
16
                      return-object
7c435b5bb   Shikha Mishra   added icard repor...
17
18
19
20
21
22
                      @change="getRoleInputs(getReport.role)"
                      required
                    ></v-autocomplete>
                  </v-flex>
                </v-layout>
              </v-flex>
d84fa5db2   Amber Dev   bugs in report id
23
              <!-- SELECT CLASS -->
5ddc6bb04   Neeraj Sharma   complete design a...
24
              <v-flex xs12 sm12 lg4 v-if="showClass">
7c435b5bb   Shikha Mishra   added icard repor...
25
                <v-layout>
5ddc6bb04   Neeraj Sharma   complete design a...
26
                  <v-flex xs12 sm12 lg10 class="ml-2">
7c435b5bb   Shikha Mishra   added icard repor...
27
28
29
30
31
32
                    <v-select
                      v-model="getReport.classId"
                      label="Select Class"
                      :items="classList"
                      item-text="classNum"
                      item-value="_id"
7c435b5bb   Shikha Mishra   added icard repor...
33
34
35
36
37
38
                      @change="getSections(getReport.classId)"
                      required
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
d84fa5db2   Amber Dev   bugs in report id
39
              <!-- SELECT SECTION -->
5ddc6bb04   Neeraj Sharma   complete design a...
40
              <v-flex xs12 sm12 lg4 v-if="showSections">
7c435b5bb   Shikha Mishra   added icard repor...
41
                <v-layout>
5ddc6bb04   Neeraj Sharma   complete design a...
42
                  <v-flex xs12 sm12 lg10 class="ml-2">
7c435b5bb   Shikha Mishra   added icard repor...
43
44
45
46
47
48
49
50
                    <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...
51
52
53
54
55
                      required
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
d84fa5db2   Amber Dev   bugs in report id
56
              <!-- SELECT STUDENT -->
5ddc6bb04   Neeraj Sharma   complete design a...
57
              <v-flex xs12 sm12 lg4 v-if="showStudents">
7c435b5bb   Shikha Mishra   added icard repor...
58
                <v-layout>
5ddc6bb04   Neeraj Sharma   complete design a...
59
                  <v-flex xs12 sm12 lg10 class="ml-2">
7c435b5bb   Shikha Mishra   added icard repor...
60
                    <v-select
11d037abe   Neeraj Sharma   commit code
61
                      :items="getSelectUserData"
7c435b5bb   Shikha Mishra   added icard repor...
62
63
64
65
                      label="Select Student"
                      v-model="getReport._id"
                      item-text="name"
                      item-value="_id"
7c435b5bb   Shikha Mishra   added icard repor...
66
67
68
69
70
                      required
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
5ddc6bb04   Neeraj Sharma   complete design a...
71
              <v-flex xs12 sm12 lg4 v-if="showTeacher">
7c435b5bb   Shikha Mishra   added icard repor...
72
                <v-layout>
5ddc6bb04   Neeraj Sharma   complete design a...
73
                  <v-flex xs12 sm12 lg10 class="ml-2">
7c435b5bb   Shikha Mishra   added icard repor...
74
75
76
                    <v-select
                      v-model="getReport._id"
                      label="Select Teacher"
11d037abe   Neeraj Sharma   commit code
77
                      :items="getSelectUserData"
7c435b5bb   Shikha Mishra   added icard repor...
78
79
                      item-text="name"
                      item-value="_id"
7c435b5bb   Shikha Mishra   added icard repor...
80
81
82
83
84
                      required
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
5ddc6bb04   Neeraj Sharma   complete design a...
85
              <v-flex xs12 sm12 lg4 v-if="showAdmin">
7c435b5bb   Shikha Mishra   added icard repor...
86
                <v-layout>
5ddc6bb04   Neeraj Sharma   complete design a...
87
                  <v-flex xs12 sm12 lg10 class="ml-2">
7c435b5bb   Shikha Mishra   added icard repor...
88
89
90
                    <v-select
                      v-model="getReport._id"
                      label="Select Admin"
11d037abe   Neeraj Sharma   commit code
91
                      :items="getSelectUserData"
7c435b5bb   Shikha Mishra   added icard repor...
92
93
                      item-text="name"
                      item-value="_id"
7c435b5bb   Shikha Mishra   added icard repor...
94
95
96
97
98
                      required
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
5ddc6bb04   Neeraj Sharma   complete design a...
99
              <v-flex xs12 sm12 lg4 v-if="showAccountant">
7c435b5bb   Shikha Mishra   added icard repor...
100
                <v-layout>
5ddc6bb04   Neeraj Sharma   complete design a...
101
                  <v-flex xs12 sm12 lg10 class="ml-2">
7c435b5bb   Shikha Mishra   added icard repor...
102
103
104
                    <v-select
                      v-model="getReport._id"
                      label="Select Accountant"
11d037abe   Neeraj Sharma   commit code
105
                      :items="getSelectUserData"
7c435b5bb   Shikha Mishra   added icard repor...
106
107
                      item-text="name"
                      item-value="_id"
7c435b5bb   Shikha Mishra   added icard repor...
108
109
110
111
112
                      required
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
5ddc6bb04   Neeraj Sharma   complete design a...
113
              <v-flex xs12 sm12 lg4 v-if="showLibrarian">
7c435b5bb   Shikha Mishra   added icard repor...
114
                <v-layout>
5ddc6bb04   Neeraj Sharma   complete design a...
115
                  <v-flex xs12 sm12 lg10 class="ml-2">
7c435b5bb   Shikha Mishra   added icard repor...
116
117
118
                    <v-select
                      v-model="getReport._id"
                      label="Select Librarian"
11d037abe   Neeraj Sharma   commit code
119
                      :items="getSelectUserData "
7c435b5bb   Shikha Mishra   added icard repor...
120
121
                      item-text="name"
                      item-value="_id"
7c435b5bb   Shikha Mishra   added icard repor...
122
123
124
125
126
                      required
                    ></v-select>
                  </v-flex>
                </v-layout>
              </v-flex>
5ddc6bb04   Neeraj Sharma   complete design a...
127
              <v-flex xs12 sm12 lg4>
7c435b5bb   Shikha Mishra   added icard repor...
128
                <v-layout>
5ddc6bb04   Neeraj Sharma   complete design a...
129
                  <v-flex xs12 sm12 lg10 class="ml-2">
7c435b5bb   Shikha Mishra   added icard repor...
130
                    <v-autocomplete
a55b7fca2   Neeraj Sharma   complete design a...
131
                      label="Select View Type"
7c435b5bb   Shikha Mishra   added icard repor...
132
                      type="text"
7c435b5bb   Shikha Mishra   added icard repor...
133
134
135
136
                      :items="typeList"
                      v-model="getReport.form"
                      item-text="name"
                      item-value="value"
a55b7fca2   Neeraj Sharma   complete design a...
137
                      :rules="typeRules"
ecf8cdfdd   Neeraj Sharma   create design of ...
138
                      @change="getReportType(getReport.form)"
7c435b5bb   Shikha Mishra   added icard repor...
139
140
141
142
143
                      required
                    ></v-autocomplete>
                  </v-flex>
                </v-layout>
              </v-flex>
5ddc6bb04   Neeraj Sharma   complete design a...
144
              <v-flex xs12 sm12 lg4>
7c435b5bb   Shikha Mishra   added icard repor...
145
146
147
148
149
                <v-btn
                  @click="getCards"
                  round
                  dark
                  :loading="loading"
0fa3b3a79   Neeraj Sharma   add loader after ...
150
                  class="open-dialog-button mt-3"
7c435b5bb   Shikha Mishra   added icard repor...
151
152
153
154
155
156
                >Get Report</v-btn>
              </v-flex>
            </v-layout>
          </v-flex>
        </v-form>
      </v-card>
ecf8cdfdd   Neeraj Sharma   create design of ...
157
      <div>
7c435b5bb   Shikha Mishra   added icard repor...
158
159
160
161
162
163
164
165
166
167
168
        <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 ...
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
            </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"
                        />
9b444e5c3   Neeraj Sharma   add logo in login...
213
214
215
216
217
218
219
220
221
                        <img
                          src="/static/default_thumb.png"
                          v-if="!getCard.schoolLogoUrl"
                          alt="schoollogo"
                          style="
                           width: 110px;
                           margin-top:10px;
                           overflow:hidden"
                        />
ecf8cdfdd   Neeraj Sharma   create design of ...
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
                        <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 ...
250
251
                            letter-spacing: 4px;
                            margin-bottom:14px;"
ecf8cdfdd   Neeraj Sharma   create design of ...
252
253
                        >
                          <b>{{ getCard.name}}</b>
7c435b5bb   Shikha Mishra   added icard repor...
254
                        </p>
ecf8cdfdd   Neeraj Sharma   create design of ...
255
                        <p
0fa3b3a79   Neeraj Sharma   add loader after ...
256
257
258
259
                          style="color: #302653;
                            font-size:14px;
                            letter-spacing: 4px;
                            margin-bottom:14px;"
ecf8cdfdd   Neeraj Sharma   create design of ...
260
261
                        >
                          <b>{{ getCard.gender}}</b>
7c435b5bb   Shikha Mishra   added icard repor...
262
                        </p>
ecf8cdfdd   Neeraj Sharma   create design of ...
263
264
                        <p
                          v-if="getCard.classId"
0fa3b3a79   Neeraj Sharma   add loader after ...
265
266
267
268
                          style="color: #302653;
                            font-size:24px;
                            letter-spacing: 4px;
                            margin-bottom:14px;"
ecf8cdfdd   Neeraj Sharma   create design of ...
269
270
271
                        >{{ getCard.classId.classNum }}</p>
                        <p
                          v-if="getCard.classId"
0fa3b3a79   Neeraj Sharma   add loader after ...
272
273
274
275
                          style="color: #302653;
                            font-size:24px;
                            letter-spacing: 4px;
                            margin-bottom:14px;"
ecf8cdfdd   Neeraj Sharma   create design of ...
276
277
278
                        >{{ getCard.sectionId.name }}</p>
                        <p
                          v-if="getCard.rollNo"
0fa3b3a79   Neeraj Sharma   add loader after ...
279
280
281
282
                          style="color: #302653;
                             font-size:24px;
                            letter-spacing: 2px;
                            margin-bottom:10px;"
ecf8cdfdd   Neeraj Sharma   create design of ...
283
284
285
                        >Roll: {{ getCard.rollNo }}</p>
                        <p
                          v-if="getCard.joinDate"
0fa3b3a79   Neeraj Sharma   add loader after ...
286
287
288
                          style="color: #302653;
                            margin-bottom:10px;
                            font-size:16px;
ecf8cdfdd   Neeraj Sharma   create design of ...
289
290
291
292
                            letter-spacing: 2px;"
                        >{{ dates(getCard.joinDate) }}</p>
                        <p
                          v-if="getCard.joiningDate"
0fa3b3a79   Neeraj Sharma   add loader after ...
293
294
295
                          style="color: #302653;
                            margin-bottom:10px;
                            font-size:16px;
ecf8cdfdd   Neeraj Sharma   create design of ...
296
297
298
299
                            letter-spacing: 2px;"
                        >{{ dates(getCard.joiningDate) }}</p>
                        <p
                          v-if="getCard.phone"
0fa3b3a79   Neeraj Sharma   add loader after ...
300
301
302
                          style="color: #302653;
                            margin-bottom:10px;
                            font-size:16px;
ecf8cdfdd   Neeraj Sharma   create design of ...
303
304
305
306
307
308
309
                            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 ...
310
311
                          letter-spacing: 5px;
                          margin-bottom:10px;"
ecf8cdfdd   Neeraj Sharma   create design of ...
312
313
314
                        >
                          <span v-if="getCard.mobile">{{ getCard.mobile}}</span>
                          <span v-if="getCard.mobileNo">{{ getCard.mobileNo }}</span>
7c435b5bb   Shikha Mishra   added icard repor...
315
                        </p>
ecf8cdfdd   Neeraj Sharma   create design of ...
316
317
318
319
320
                        <p
                          style="
                          font-size: 17px;
                          font-weight: 100;
                          color: rgb(48, 38, 83);
0fa3b3a79   Neeraj Sharma   add loader after ...
321
322
                          letter-spacing: 4px;
                          margin-bottom:14px;"
ecf8cdfdd   Neeraj Sharma   create design of ...
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
                        >{{ 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"
                        />
ecf8cdfdd   Neeraj Sharma   create design of ...
349
350
                        <p
                          v-if="getCard.schoolLogoUrl"
0fa3b3a79   Neeraj Sharma   add loader after ...
351
352
353
354
                          style="color: #302653;
                            font-size:24px;
                            letter-spacing: 4px;
                            margin-bottom:14px;"
ecf8cdfdd   Neeraj Sharma   create design of ...
355
356
                        >
                          <b>{{ getCard.name}}</b>
7c435b5bb   Shikha Mishra   added icard repor...
357
                        </p>
a55b7fca2   Neeraj Sharma   complete design a...
358

ecf8cdfdd   Neeraj Sharma   create design of ...
359
360
361
362
363
364
                        <p
                          v-if="getCard.city"
                          style="
                          font-size: 17px;
                          font-weight: 100;
                          color: rgb(48, 38, 83);
0fa3b3a79   Neeraj Sharma   add loader after ...
365
366
                          letter-spacing: 4px;
                          margin-bottom:14px;"
ecf8cdfdd   Neeraj Sharma   create design of ...
367
368
369
370
371
372
                        >{{ getCard.city}}</p>
                        <p
                          style="
                          font-size: 17px;
                          font-weight: 100;
                          color: rgb(48, 38, 83);
0fa3b3a79   Neeraj Sharma   add loader after ...
373
374
                          letter-spacing: 4px;
                          margin-bottom:14px;"
ecf8cdfdd   Neeraj Sharma   create design of ...
375
376
377
378
379
380
                        >
                          {{ getCard.address }}
                          {{ getCard.presentAddress }}
                          <span
                            v-if="getCard.state"
                          >({{ getCard.state }})</span>
7c435b5bb   Shikha Mishra   added icard repor...
381
                        </p>
ecf8cdfdd   Neeraj Sharma   create design of ...
382
383
384
385
386
387
                        <p
                          v-if="getCard.establishmentYear"
                          style="
                          font-size: 17px;
                          font-weight: 100;
                          color: rgb(48, 38, 83);
0fa3b3a79   Neeraj Sharma   add loader after ...
388
389
                          letter-spacing: 4px;
                          margin-bottom:14px;"
ecf8cdfdd   Neeraj Sharma   create design of ...
390
391
392
393
                        >{{ getCard.establishmentYear }}</p>
                      </v-flex>
                    </v-layout>
                    <!-- bottom-right-side-image -->
37cb39130   Shikha Mishra   change the ui of ...
394
                    <img
ecf8cdfdd   Neeraj Sharma   create design of ...
395
396
397
398
399
400
                      src="static/icon/shape2.png"
                      alt="shape2"
                      style="bottom: 0;
                        position: absolute;
                        right: 0;
                        width: 110px;"
37cb39130   Shikha Mishra   change the ui of ...
401
                    />
37cb39130   Shikha Mishra   change the ui of ...
402
403
                  </div>
                </div>
36883961f   Shikha Mishra   set ui of icard r...
404
              </v-layout>
ecf8cdfdd   Neeraj Sharma   create design of ...
405
            </v-container>
7c435b5bb   Shikha Mishra   added icard repor...
406
407
408
          </v-flex>
        </v-layout>
      </div>
ecf8cdfdd   Neeraj Sharma   create design of ...
409
410
411
412
413
414
415
416
      <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...
417
418
419
      <div class="loader" v-if="showLoader">
        <v-progress-circular indeterminate color="white"></v-progress-circular>
      </div>
7c435b5bb   Shikha Mishra   added icard repor...
420
421
422
423
424
425
    </v-container>
  </template>
  
  <script>
  import http from "@/Services/http.js";
  import moment from "moment";
d84fa5db2   Amber Dev   bugs in report id
426
  var qs = require("qs");
7c435b5bb   Shikha Mishra   added icard repor...
427
428
429
  
  export default {
    data: () => ({
5ddc6bb04   Neeraj Sharma   complete design a...
430
      showLoader: false,
7c435b5bb   Shikha Mishra   added icard repor...
431
432
433
      valid: true,
      report: {},
      userData: {},
ecf8cdfdd   Neeraj Sharma   create design of ...
434
435
436
437
438
439
440
      snackbar: false,
      color: "",
      y: "top",
      x: "right",
      mode: "",
      timeout: 10000,
      text: "",
7c435b5bb   Shikha Mishra   added icard repor...
441
442
443
444
445
446
447
448
449
450
      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 ...
451
      hidebackprintIdCard: false,
ecf8cdfdd   Neeraj Sharma   create design of ...
452
453
      showStudents: false,
      showSections: false,
7c435b5bb   Shikha Mishra   added icard repor...
454
455
456
457
      getRoles: [],
      classList: [],
      getCard: [],
      addSection: [],
11d037abe   Neeraj Sharma   commit code
458
459
460
461
      // getStudentsList:
      // teacherList: [],
      getSelectUserData: [],
      // Users: [],
ecf8cdfdd   Neeraj Sharma   create design of ...
462
      getReport: {},
d84fa5db2   Amber Dev   bugs in report id
463
      typeRules: [(v) => !!v || "Type is required"],
7c435b5bb   Shikha Mishra   added icard repor...
464
465
466
      typeList: [
        {
          name: "Front Part",
d84fa5db2   Amber Dev   bugs in report id
467
          value: "frontPart",
7c435b5bb   Shikha Mishra   added icard repor...
468
469
470
        },
        {
          name: "Back Part",
d84fa5db2   Amber Dev   bugs in report id
471
472
          value: "backPart",
        },
7c435b5bb   Shikha Mishra   added icard repor...
473
      ],
d84fa5db2   Amber Dev   bugs in report id
474
      backgroundList: ["Yes", "No"],
7c435b5bb   Shikha Mishra   added icard repor...
475
476
477
478
479
480
481
482
483
    }),
  
    mounted() {
      this.token = this.$store.state.token;
      this.getUserData();
      this.getRole();
    },
  
    methods: {
d84fa5db2   Amber Dev   bugs in report id
484
      dates: function (date) {
ecf8cdfdd   Neeraj Sharma   create design of ...
485
486
487
488
        return moment(date).format("MMMM DD, YYYY");
        return date;
      },
      getReportType() {
7c435b5bb   Shikha Mishra   added icard repor...
489
490
491
492
493
494
495
496
497
498
        if (this.getReport.form === "frontPart") {
          this.frontPart = true;
          this.backPart = false;
        }
        if (this.getReport.form === "backPart") {
          this.frontPart = false;
          this.backPart = true;
        }
      },
      getRoleInputs(role) {
11d037abe   Neeraj Sharma   commit code
499
        // console.log("role", role);
ecf8cdfdd   Neeraj Sharma   create design of ...
500
501
502
        this.showReport = false;
        this.getReport._id = "";
        this.getCard = "";
d84fa5db2   Amber Dev   bugs in report id
503
        if (role.name === "STUDENT") {
7c435b5bb   Shikha Mishra   added icard repor...
504
505
          // console.log("role", role);
          this.showClass = true;
ecf8cdfdd   Neeraj Sharma   create design of ...
506
507
508
509
510
511
          this.showTeacher = false;
          this.showAdmin = false;
          this.showAccountant = false;
          this.showLibrarian = false;
          this.showStudents = false;
          this.showSections = false;
7c435b5bb   Shikha Mishra   added icard repor...
512
513
          this.getClass();
        }
d84fa5db2   Amber Dev   bugs in report id
514
        if (role.name === "TEACHER") {
7c435b5bb   Shikha Mishra   added icard repor...
515
          this.showTeacher = true;
ecf8cdfdd   Neeraj Sharma   create design of ...
516
517
518
519
520
521
          this.showClass = false;
          this.showAdmin = false;
          this.showAccountant = false;
          this.showLibrarian = false;
          this.showStudents = false;
          this.showSections = false;
7c435b5bb   Shikha Mishra   added icard repor...
522
523
          this.getTeacherList();
        }
d84fa5db2   Amber Dev   bugs in report id
524
        if (role.name === "ADMIN") {
7c435b5bb   Shikha Mishra   added icard repor...
525
          this.showAdmin = true;
ecf8cdfdd   Neeraj Sharma   create design of ...
526
527
528
529
530
531
          this.showTeacher = false;
          this.showClass = false;
          this.showAccountant = false;
          this.showLibrarian = false;
          this.showStudents = false;
          this.showSections = false;
7c435b5bb   Shikha Mishra   added icard repor...
532
533
          this.getUserData();
        }
d84fa5db2   Amber Dev   bugs in report id
534
        if (role.name === "ACCOUNTANT") {
7c435b5bb   Shikha Mishra   added icard repor...
535
          this.showAccountant = true;
ecf8cdfdd   Neeraj Sharma   create design of ...
536
537
538
539
540
541
          this.showAdmin = false;
          this.showTeacher = false;
          this.showClass = false;
          this.showLibrarian = false;
          this.showStudents = false;
          this.showSections = false;
d84fa5db2   Amber Dev   bugs in report id
542
          this.getUsersList(role.role);
7c435b5bb   Shikha Mishra   added icard repor...
543
        }
d84fa5db2   Amber Dev   bugs in report id
544
        if (role.name === "LIBRARIAN") {
7c435b5bb   Shikha Mishra   added icard repor...
545
          this.showLibrarian = true;
ecf8cdfdd   Neeraj Sharma   create design of ...
546
547
548
549
550
551
          this.showAccountant = false;
          this.showAdmin = false;
          this.showTeacher = false;
          this.showClass = false;
          this.showStudents = false;
          this.showSections = false;
d84fa5db2   Amber Dev   bugs in report id
552
          this.getUsersList(role.role);
7c435b5bb   Shikha Mishra   added icard repor...
553
554
555
556
557
558
559
560
        }
      },
  
      prindIDCardReport() {
        // Pass the element id here
        this.$htmlToPaper("printMe");
      },
      getUserData() {
11d037abe   Neeraj Sharma   commit code
561
        this.getSelectUserData = [];
5ddc6bb04   Neeraj Sharma   complete design a...
562
        this.showLoader = true;
7c435b5bb   Shikha Mishra   added icard repor...
563
564
        http()
          .get("/getParticularUserDetail")
d84fa5db2   Amber Dev   bugs in report id
565
          .then((response) => {
11d037abe   Neeraj Sharma   commit code
566
567
            let mergeObj = {
              name: "Select All",
d84fa5db2   Amber Dev   bugs in report id
568
              id: "Select All",
11d037abe   Neeraj Sharma   commit code
569
570
571
572
            };
            this.getSelectUserData.push(mergeObj);
            let getUserDetails = response.data.data;
            this.getSelectUserData.push(getUserDetails);
5ddc6bb04   Neeraj Sharma   complete design a...
573
            this.showLoader = false;
7c435b5bb   Shikha Mishra   added icard repor...
574
575
            // this.adminList = response.data.data;
          })
d84fa5db2   Amber Dev   bugs in report id
576
          .catch((error) => {
5ddc6bb04   Neeraj Sharma   complete design a...
577
            this.showLoader = false;
ecf8cdfdd   Neeraj Sharma   create design of ...
578
579
580
581
582
            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...
583
584
585
586
587
588
          });
      },
      getRole() {
        this.showLoader = true;
        http()
          .get("/getRolesList", {
d84fa5db2   Amber Dev   bugs in report id
589
            headers: { Authorization: "Bearer " + this.token },
7c435b5bb   Shikha Mishra   added icard repor...
590
          })
d84fa5db2   Amber Dev   bugs in report id
591
          .then((response) => {
ecf8cdfdd   Neeraj Sharma   create design of ...
592
593
            var getRoles = [];
            getRoles = response.data.data;
ecf8cdfdd   Neeraj Sharma   create design of ...
594
            for (let i = 0; i < getRoles.length; i++) {
d84fa5db2   Amber Dev   bugs in report id
595
596
597
598
              if (
                getRoles[i].name != "SUPERADMIN" &&
                getRoles[i].name != "PARENT"
              ) {
ecf8cdfdd   Neeraj Sharma   create design of ...
599
600
                this.getRoles.push(getRoles[i]);
              }
36883961f   Shikha Mishra   set ui of icard r...
601
            }
7c435b5bb   Shikha Mishra   added icard repor...
602
603
            this.showLoader = false;
          })
d84fa5db2   Amber Dev   bugs in report id
604
          .catch((error) => {
7c435b5bb   Shikha Mishra   added icard repor...
605
            this.showLoader = false;
ecf8cdfdd   Neeraj Sharma   create design of ...
606
607
608
609
610
611
            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...
612
613
614
          });
      },
      getClass() {
11d037abe   Neeraj Sharma   commit code
615
        // console.log("get classes");
7c435b5bb   Shikha Mishra   added icard repor...
616
617
618
        this.showLoader = true;
        http()
          .get("/getClassesList", {
d84fa5db2   Amber Dev   bugs in report id
619
            headers: { Authorization: "Bearer " + this.token },
7c435b5bb   Shikha Mishra   added icard repor...
620
          })
d84fa5db2   Amber Dev   bugs in report id
621
          .then((response) => {
7c435b5bb   Shikha Mishra   added icard repor...
622
623
624
            this.classList = response.data.data;
            this.showLoader = false;
          })
d84fa5db2   Amber Dev   bugs in report id
625
          .catch((error) => {
7c435b5bb   Shikha Mishra   added icard repor...
626
627
628
629
630
631
632
633
634
635
636
            this.showLoader = false;
            // console.log("err====>", err);
          });
      },
      getSections(_id) {
        this.showLoader = true;
        http()
          .get(
            "/getSectionsList",
            { params: { classId: _id } },
            {
d84fa5db2   Amber Dev   bugs in report id
637
              headers: { Authorization: "Bearer " + this.token },
7c435b5bb   Shikha Mishra   added icard repor...
638
639
            }
          )
d84fa5db2   Amber Dev   bugs in report id
640
          .then((response) => {
7c435b5bb   Shikha Mishra   added icard repor...
641
            this.addSection = response.data.data;
ecf8cdfdd   Neeraj Sharma   create design of ...
642
            this.showSections = true;
7c435b5bb   Shikha Mishra   added icard repor...
643
644
            this.showLoader = false;
          })
d84fa5db2   Amber Dev   bugs in report id
645
          .catch((err) => {
7c435b5bb   Shikha Mishra   added icard repor...
646
647
648
649
650
            this.showLoader = false;
            // console.log("err====>", err);
          });
      },
      getStudents() {
11d037abe   Neeraj Sharma   commit code
651
        this.getSelectUserData = [];
7c435b5bb   Shikha Mishra   added icard repor...
652
653
654
655
656
        this.showLoader = true;
        http()
          .get("/getStudentWithClass", {
            params: {
              classId: this.getReport.classId,
d84fa5db2   Amber Dev   bugs in report id
657
658
              sectionId: this.getReport.sectionId,
            },
7c435b5bb   Shikha Mishra   added icard repor...
659
          })
d84fa5db2   Amber Dev   bugs in report id
660
          .then((response) => {
11d037abe   Neeraj Sharma   commit code
661
662
            response.data.data.unshift({
              name: "Select All",
d84fa5db2   Amber Dev   bugs in report id
663
              _id: "Select All",
11d037abe   Neeraj Sharma   commit code
664
665
            });
            this.getSelectUserData = response.data.data;
ecf8cdfdd   Neeraj Sharma   create design of ...
666
            this.showStudents = true;
7c435b5bb   Shikha Mishra   added icard repor...
667
668
            this.showLoader = false;
          })
d84fa5db2   Amber Dev   bugs in report id
669
          .catch((error) => {
7c435b5bb   Shikha Mishra   added icard repor...
670
671
672
673
674
            console.log("err====>", error);
            this.showLoader = false;
          });
      },
      getCards() {
11d037abe   Neeraj Sharma   commit code
675
676
677
678
        console.log("this.getSelectUserData", this.getSelectUserData);
        var getSelectUserId = [];
        for (let i = 0; i < this.getSelectUserData.length; i++) {
          console.log("this.getReport._id", this.getReport._id);
d84fa5db2   Amber Dev   bugs in report id
679
680
          /* if the selected user id mathches any id in the original user data then push it in 
          array, this way only one id will be pushed */
11d037abe   Neeraj Sharma   commit code
681
          if (this.getReport._id === this.getSelectUserData[i]._id) {
11d037abe   Neeraj Sharma   commit code
682
            getSelectUserId.push(this.getSelectUserData[i]._id);
d84fa5db2   Amber Dev   bugs in report id
683
684
685
          } /* else if select all option is selected then all ids will be pushed */ else if (
            this.getReport._id == "Select All"
          ) {
11d037abe   Neeraj Sharma   commit code
686
            getSelectUserId.push(this.getSelectUserData[i]._id);
d84fa5db2   Amber Dev   bugs in report id
687
688
689
690
691
            if (
              getSelectUserId[0] == undefined ||
              getSelectUserId[0] == "Select All"
            ) {
              getSelectUserId.shift();
11d037abe   Neeraj Sharma   commit code
692
693
694
            }
          }
        }
d84fa5db2   Amber Dev   bugs in report id
695

a55b7fca2   Neeraj Sharma   complete design a...
696
        if (this.$refs.form.validate()) {
fe0d05d29   Neeraj Sharma   complete design a...
697
          this.showLoader = true;
d84fa5db2   Amber Dev   bugs in report id
698
699
700
          // var strigified = JSON.stringify(getSelectUserId) 
          // var profileId = [];
          // profileId = getSelectUserId;
a55b7fca2   Neeraj Sharma   complete design a...
701
702
703
          http()
            .get("/getIdCardDetail", {
              headers: {
d84fa5db2   Amber Dev   bugs in report id
704
                Authorization: "Bearer " + this.token,
a55b7fca2   Neeraj Sharma   complete design a...
705
              },
d84fa5db2   Amber Dev   bugs in report id
706
707
708
709
710
711
712
713
              params: { profileId: getSelectUserId, role: this.getReport.role.role, },
              paramsSerializer: (params) => {
                return qs.stringify(params);
              },
              // params: {
              //   profileId: strigified,
              //   role: this.getReport.role.role,
              // },
a55b7fca2   Neeraj Sharma   complete design a...
714
            })
d84fa5db2   Amber Dev   bugs in report id
715
            .then((response) => {
a55b7fca2   Neeraj Sharma   complete design a...
716
717
718
719
720
721
722
              this.getCard = "";
              var data = response.data.data;
              if (
                Object.keys(data.adminData).length != 0 &&
                data.adminData.constructor === Object
              ) {
                this.getCard = response.data.data.adminData;
11d037abe   Neeraj Sharma   commit code
723
                // console.log("this.getCard ", this.getCard);
a55b7fca2   Neeraj Sharma   complete design a...
724
725
726
727
728
729
              }
              if (
                Object.keys(data.teachersData).length != 0 &&
                data.teachersData.constructor === Object
              ) {
                this.getCard = response.data.data.teachersData;
11d037abe   Neeraj Sharma   commit code
730
                // console.log("this.getCard--teachersData ", this.getCard);
a55b7fca2   Neeraj Sharma   complete design a...
731
732
733
734
735
736
              }
              if (
                Object.keys(data.studentData).length != 0 &&
                data.studentData.constructor === Object
              ) {
                this.getCard = response.data.data.studentData;
11d037abe   Neeraj Sharma   commit code
737
                // console.log("this.getCard--studentData ", this.getCard);
a55b7fca2   Neeraj Sharma   complete design a...
738
739
740
741
742
743
              }
              if (
                Object.keys(data.usersData).length != 0 &&
                data.usersData.constructor === Object
              ) {
                this.getCard = response.data.data.usersData;
11d037abe   Neeraj Sharma   commit code
744
                // console.log("this.getCard--usersData   ", this.getCard);
a55b7fca2   Neeraj Sharma   complete design a...
745
746
747
748
749
              }
              // console.log("this.getCard--all ", response.data.data);
              this.showLoader = false;
              this.showReport = true;
            })
d84fa5db2   Amber Dev   bugs in report id
750
            .catch((error) => {
a55b7fca2   Neeraj Sharma   complete design a...
751
              this.showLoader = false;
11d037abe   Neeraj Sharma   commit code
752
              // console.log("error", error.response.data.errors);
a55b7fca2   Neeraj Sharma   complete design a...
753
754
755
756
757
758
759
              if (error.response.data.errors) {
                this.snackbar = true;
                this.text = " Field is required";
                this.color = "error";
              }
            });
        }
7c435b5bb   Shikha Mishra   added icard repor...
760
761
      },
      getTeacherList() {
11d037abe   Neeraj Sharma   commit code
762
        this.getSelectUserData = [];
7c435b5bb   Shikha Mishra   added icard repor...
763
764
765
766
        this.showLoader = true;
        var token = this.$store.state.token;
        http()
          .get("/getTeachersList", {
d84fa5db2   Amber Dev   bugs in report id
767
            headers: { Authorization: "Bearer " + token },
7c435b5bb   Shikha Mishra   added icard repor...
768
          })
d84fa5db2   Amber Dev   bugs in report id
769
          .then((response) => {
11d037abe   Neeraj Sharma   commit code
770
771
            response.data.data.unshift({
              name: "Select All",
d84fa5db2   Amber Dev   bugs in report id
772
              _id: "Select All",
11d037abe   Neeraj Sharma   commit code
773
774
            });
            this.getSelectUserData = response.data.data;
7c435b5bb   Shikha Mishra   added icard repor...
775
776
            this.showLoader = false;
          })
d84fa5db2   Amber Dev   bugs in report id
777
          .catch((error) => {
7c435b5bb   Shikha Mishra   added icard repor...
778
779
780
781
782
783
784
785
            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) {
11d037abe   Neeraj Sharma   commit code
787
        this.getSelectUserData = [];
7c435b5bb   Shikha Mishra   added icard repor...
788
789
790
        this.showLoader = true;
        var token = this.$store.state.token;
        http()
a55b7fca2   Neeraj Sharma   complete design a...
791
          .get("/getUsersList?role=" + role, {
d84fa5db2   Amber Dev   bugs in report id
792
            headers: { Authorization: "Bearer " + token },
7c435b5bb   Shikha Mishra   added icard repor...
793
          })
d84fa5db2   Amber Dev   bugs in report id
794
          .then((response) => {
11d037abe   Neeraj Sharma   commit code
795
796
            response.data.data.unshift({
              name: "Select All",
d84fa5db2   Amber Dev   bugs in report id
797
              _id: "Select All",
11d037abe   Neeraj Sharma   commit code
798
799
            });
            this.getSelectUserData = response.data.data;
7c435b5bb   Shikha Mishra   added icard repor...
800
801
            this.showLoader = false;
          })
d84fa5db2   Amber Dev   bugs in report id
802
          .catch((error) => {
7c435b5bb   Shikha Mishra   added icard repor...
803
804
805
806
807
808
809
810
811
812
813
814
            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: {
d84fa5db2   Amber Dev   bugs in report id
815
816
              Authorization: "Bearer " + this.$store.state.token,
            },
7c435b5bb   Shikha Mishra   added icard repor...
817
          })
d84fa5db2   Amber Dev   bugs in report id
818
          .then((response) => {
7c435b5bb   Shikha Mishra   added icard repor...
819
820
            this.parentsList = response.data.data;
          })
d84fa5db2   Amber Dev   bugs in report id
821
          .catch((error) => {
7c435b5bb   Shikha Mishra   added icard repor...
822
823
824
825
826
827
828
829
830
            // 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);
            }
          });
d84fa5db2   Amber Dev   bugs in report id
831
832
      },
    },
7c435b5bb   Shikha Mishra   added icard repor...
833
834
835
836
837
838
839
840
841
842
843
844
845
  };
  </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...
846
847
848
849
850
851
852
853
  .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...
854
855
856
857
  .idcardreport1 {
    text-align: center;
    margin-left: 35%;
  }
7c435b5bb   Shikha Mishra   added icard repor...
858
859
  .icard-front {
    margin: 3px;
36883961f   Shikha Mishra   set ui of icard r...
860
    float: left;
37cb39130   Shikha Mishra   change the ui of ...
861
    padding: 10px;
37cb39130   Shikha Mishra   change the ui of ...
862
    text-align: center;
ecf8cdfdd   Neeraj Sharma   create design of ...
863
864
865
866
    height: 520px;
    width: 520px;
    background: #fff;
    border: 1px solid lightgray;
37cb39130   Shikha Mishra   change the ui of ...
867
868
869
870
871
  }
  .print-data {
    margin: 3px;
    float: left;
    /* border: 1px solid #000; */
7c435b5bb   Shikha Mishra   added icard repor...
872
    padding: 10px;
37cb39130   Shikha Mishra   change the ui of ...
873
    /* width: 55%; */
7c435b5bb   Shikha Mishra   added icard repor...
874
    text-align: center;
37cb39130   Shikha Mishra   change the ui of ...
875
876
    height: 95%;
  }
cc7844a9d   Shikha Mishra   improve print pat...
877
878
879
  .rightside {
    float: right !important;
  }
36883961f   Shikha Mishra   set ui of icard r...
880
  .icard-front h2 {
37cb39130   Shikha Mishra   change the ui of ...
881
882
883
884
885
886
887
888
889
890
891
892
893
    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...
894
895
  }
  .icard-front img {
37cb39130   Shikha Mishra   change the ui of ...
896
897
898
899
900
901
902
903
904
905
    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...
906
907
908
    width: 50px;
    height: 50px;
    margin-bottom: 5px;
37cb39130   Shikha Mishra   change the ui of ...
909
910
    margin-top: 5px;
    border: 1px solid #ddd;
7c435b5bb   Shikha Mishra   added icard repor...
911
912
  }
  .icard-data {
36883961f   Shikha Mishra   set ui of icard r...
913
    /* font-family: Arial; */
7c435b5bb   Shikha Mishra   added icard repor...
914
915
916
917
918
919
920
921
    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 ...
922
923
924
925
926
927
928
929
930
931
    /* 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...
932
    padding: 10px;
7c435b5bb   Shikha Mishra   added icard repor...
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
  }
  .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 ...
948
  /* .icard-back p {
7c435b5bb   Shikha Mishra   added icard repor...
949
950
951
952
    font-size: 15px;
    color: #000;
    font-weight: 500px;
    line-height: 17px;
37cb39130   Shikha Mishra   change the ui of ...
953
  } */
7c435b5bb   Shikha Mishra   added icard repor...
954
955
956
957
958
  .school-address {
    /* width: 40%; */
    font-weight: 500px;
    color: #000;
  }
cc7844a9d   Shikha Mishra   improve print pat...
959
960
961
962
963
  .address {
    font-weight: 500px;
    color: #000;
    text-align: center;
  }
7c435b5bb   Shikha Mishra   added icard repor...
964
965
966
967
968
969
970
971
972
973
974
  .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 ...
975
    margin-top: 15px;
7c435b5bb   Shikha Mishra   added icard repor...
976
977
978
979
  }
  .session {
    float: right;
    width: 70%;
37cb39130   Shikha Mishra   change the ui of ...
980
    margin-top: 15px;
7c435b5bb   Shikha Mishra   added icard repor...
981
982
983
984
985
986
987
988
989
990
991
992
  }
  @media screen and (max-width: 360px) {
    .icard-front {
      width: 316px;
      height: 418px;
      float: inherit;
    }
    .icard-back {
      float: left;
    }
  }
  </style>