Blame view
src/pages/Report/idCard.vue
30.7 KB
7c435b5bb
|
1 2 |
<template> <v-container fluid class="body-color"> |
ecf8cdfdd
|
3 |
<!-- **** Id Card Select options **** --> |
7c435b5bb
|
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
|
8 |
<v-flex xs12 sm12 lg4> |
7c435b5bb
|
9 |
<v-layout> |
5ddc6bb04
|
10 |
<v-flex xs12 sm12 lg10 class="ml-2"> |
7c435b5bb
|
11 12 |
<v-autocomplete v-model="getReport.role" |
a55b7fca2
|
13 |
label="Select Type" |
7c435b5bb
|
14 15 |
:items="getRoles" item-text="name" |
d84fa5db2
|
16 |
return-object |
7c435b5bb
|
17 18 19 20 21 22 |
@change="getRoleInputs(getReport.role)" required ></v-autocomplete> </v-flex> </v-layout> </v-flex> |
d84fa5db2
|
23 |
<!-- SELECT CLASS --> |
5ddc6bb04
|
24 |
<v-flex xs12 sm12 lg4 v-if="showClass"> |
7c435b5bb
|
25 |
<v-layout> |
5ddc6bb04
|
26 |
<v-flex xs12 sm12 lg10 class="ml-2"> |
7c435b5bb
|
27 28 29 30 31 32 |
<v-select v-model="getReport.classId" label="Select Class" :items="classList" item-text="classNum" item-value="_id" |
7c435b5bb
|
33 34 35 36 37 38 |
@change="getSections(getReport.classId)" required ></v-select> </v-flex> </v-layout> </v-flex> |
d84fa5db2
|
39 |
<!-- SELECT SECTION --> |
5ddc6bb04
|
40 |
<v-flex xs12 sm12 lg4 v-if="showSections"> |
7c435b5bb
|
41 |
<v-layout> |
5ddc6bb04
|
42 |
<v-flex xs12 sm12 lg10 class="ml-2"> |
7c435b5bb
|
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
|
51 52 53 54 55 |
required ></v-select> </v-flex> </v-layout> </v-flex> |
d84fa5db2
|
56 |
<!-- SELECT STUDENT --> |
5ddc6bb04
|
57 |
<v-flex xs12 sm12 lg4 v-if="showStudents"> |
7c435b5bb
|
58 |
<v-layout> |
5ddc6bb04
|
59 |
<v-flex xs12 sm12 lg10 class="ml-2"> |
7c435b5bb
|
60 |
<v-select |
11d037abe
|
61 |
:items="getSelectUserData" |
7c435b5bb
|
62 63 64 65 |
label="Select Student" v-model="getReport._id" item-text="name" item-value="_id" |
7c435b5bb
|
66 67 68 69 70 |
required ></v-select> </v-flex> </v-layout> </v-flex> |
5ddc6bb04
|
71 |
<v-flex xs12 sm12 lg4 v-if="showTeacher"> |
7c435b5bb
|
72 |
<v-layout> |
5ddc6bb04
|
73 |
<v-flex xs12 sm12 lg10 class="ml-2"> |
7c435b5bb
|
74 75 76 |
<v-select v-model="getReport._id" label="Select Teacher" |
11d037abe
|
77 |
:items="getSelectUserData" |
7c435b5bb
|
78 79 |
item-text="name" item-value="_id" |
7c435b5bb
|
80 81 82 83 84 |
required ></v-select> </v-flex> </v-layout> </v-flex> |
5ddc6bb04
|
85 |
<v-flex xs12 sm12 lg4 v-if="showAdmin"> |
7c435b5bb
|
86 |
<v-layout> |
5ddc6bb04
|
87 |
<v-flex xs12 sm12 lg10 class="ml-2"> |
7c435b5bb
|
88 89 90 |
<v-select v-model="getReport._id" label="Select Admin" |
11d037abe
|
91 |
:items="getSelectUserData" |
7c435b5bb
|
92 93 |
item-text="name" item-value="_id" |
7c435b5bb
|
94 95 96 97 98 |
required ></v-select> </v-flex> </v-layout> </v-flex> |
5ddc6bb04
|
99 |
<v-flex xs12 sm12 lg4 v-if="showAccountant"> |
7c435b5bb
|
100 |
<v-layout> |
5ddc6bb04
|
101 |
<v-flex xs12 sm12 lg10 class="ml-2"> |
7c435b5bb
|
102 103 104 |
<v-select v-model="getReport._id" label="Select Accountant" |
11d037abe
|
105 |
:items="getSelectUserData" |
7c435b5bb
|
106 107 |
item-text="name" item-value="_id" |
7c435b5bb
|
108 109 110 111 112 |
required ></v-select> </v-flex> </v-layout> </v-flex> |
5ddc6bb04
|
113 |
<v-flex xs12 sm12 lg4 v-if="showLibrarian"> |
7c435b5bb
|
114 |
<v-layout> |
5ddc6bb04
|
115 |
<v-flex xs12 sm12 lg10 class="ml-2"> |
7c435b5bb
|
116 117 118 |
<v-select v-model="getReport._id" label="Select Librarian" |
11d037abe
|
119 |
:items="getSelectUserData " |
7c435b5bb
|
120 121 |
item-text="name" item-value="_id" |
7c435b5bb
|
122 123 124 125 126 |
required ></v-select> </v-flex> </v-layout> </v-flex> |
5ddc6bb04
|
127 |
<v-flex xs12 sm12 lg4> |
7c435b5bb
|
128 |
<v-layout> |
5ddc6bb04
|
129 |
<v-flex xs12 sm12 lg10 class="ml-2"> |
7c435b5bb
|
130 |
<v-autocomplete |
a55b7fca2
|
131 |
label="Select View Type" |
7c435b5bb
|
132 |
type="text" |
7c435b5bb
|
133 |
:items="typeList" |
b8258078b
|
134 |
v-model="getReport.viewType" |
7c435b5bb
|
135 136 |
item-text="name" item-value="value" |
a55b7fca2
|
137 |
:rules="typeRules" |
b8258078b
|
138 |
@change="getReportType(getReport.viewType)" |
7c435b5bb
|
139 140 141 142 143 |
required ></v-autocomplete> </v-flex> </v-layout> </v-flex> |
5ddc6bb04
|
144 |
<v-flex xs12 sm12 lg4> |
7c435b5bb
|
145 146 147 148 149 |
<v-btn @click="getCards" round dark :loading="loading" |
0fa3b3a79
|
150 |
class="open-dialog-button mt-3" |
7c435b5bb
|
151 152 153 154 155 156 |
>Get Report</v-btn> </v-flex> </v-layout> </v-flex> </v-form> </v-card> |
ecf8cdfdd
|
157 |
<div> |
7c435b5bb
|
158 159 160 |
<v-layout v-show="showReport"> <v-flex xs12> <v-card class="transparent elevation-0"> |
20fba3a75
|
161 |
<!-- print button --> |
7c435b5bb
|
162 163 164 165 166 167 168 169 |
<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
|
170 |
</v-card> |
a690a86fb
|
171 172 173 |
<v-layout row wrap id="printMe" justify-center> <div v-for="(getCard,index) in getCard" |
b001726a1
|
174 |
:key="index" |
a690a86fb
|
175 176 177 178 179 180 |
style="page-break-after: always; width:100%;margin:14px auto;background:transparent;" > <v-container grid-list-md> <v-layout class="col-sm-12"> <div style="font-family: arial; |
ecf8cdfdd
|
181 182 183 184 185 |
max-width: 794px; max-height: 1123px; margin-left: auto; margin-right: auto; -webkit-print-color-adjust: exact;" |
a690a86fb
|
186 187 188 |
> <div style=" |
ecf8cdfdd
|
189 |
float: left; |
b001726a1
|
190 |
|
ecf8cdfdd
|
191 192 193 194 |
width: 520px; background: #fff; border: 1px solid lightgray; position:relative;" |
a690a86fb
|
195 196 197 198 199 200 201 202 203 204 |
> <!-- bottom-right-side-image --> <img src="/static/icon/shape1.png" alt="shape" style="position:absolute;width: 90px;" /> <!-- Front Side --> <v-layout style=" |
ecf8cdfdd
|
205 |
text-align: center; |
b001726a1
|
206 |
" |
a690a86fb
|
207 208 209 210 211 212 213 214 215 |
v-if="frontPart" > <v-flex xs12> <!-- school Logo Url --> <img v-if="getCard.schoolLogoUrl" :src="getCard.schoolLogoUrl" alt="schoollogo" style=" |
ecf8cdfdd
|
216 217 218 |
width: 110px; margin-top:10px; overflow:hidden" |
a690a86fb
|
219 220 221 222 223 224 |
/> <img src="/static/default_thumb.png" v-if="!getCard.schoolLogoUrl" alt="schoollogo" style=" |
9b444e5c3
|
225 226 227 |
width: 110px; margin-top:10px; overflow:hidden" |
a690a86fb
|
228 229 230 231 232 233 234 235 |
/> <v-layout style="margin:auto"> <!-- profile url --> <img v-if="getCard.profilePicUrl" :src="getCard.profilePicUrl" alt="profileImage" style="; |
ecf8cdfdd
|
236 237 238 239 240 241 |
width: 110px; margin:10px auto; width: 110px; margin: 10px auto; border: 3px solid #323232; border-radius: 12px;" |
a690a86fb
|
242 243 244 |
/> <img style=" |
ecf8cdfdd
|
245 246 247 248 |
width: 110px; margin:10px auto; width: 110px; margin: 10px auto;" |
a690a86fb
|
249 250 251 252 253 |
alt="dummy" src="/static/icon/user.png" v-if="!getCard.profilePicUrl && getCard.role != '2'" /> </v-layout> |
ecf8cdfdd
|
254 |
|
a690a86fb
|
255 256 |
<p style="color: #302653;font-size:24px; |
0fa3b3a79
|
257 258 |
letter-spacing: 4px; margin-bottom:14px;" |
a690a86fb
|
259 260 261 262 263 |
> <b>{{ getCard.name}}</b> </p> <p style="color: #302653; |
0fa3b3a79
|
264 265 266 |
font-size:14px; letter-spacing: 4px; margin-bottom:14px;" |
a690a86fb
|
267 268 269 270 271 272 |
> <b>{{ getCard.gender}}</b> </p> <p v-if="getCard.classId" style="color: #302653; |
0fa3b3a79
|
273 274 275 |
font-size:24px; letter-spacing: 4px; margin-bottom:14px;" |
a690a86fb
|
276 277 278 279 |
>{{ getCard.classId.classNum }}</p> <p v-if="getCard.classId" style="color: #302653; |
0fa3b3a79
|
280 281 282 |
font-size:24px; letter-spacing: 4px; margin-bottom:14px;" |
a690a86fb
|
283 284 285 286 |
>{{ getCard.sectionId.name }}</p> <p v-if="getCard.rollNo" style="color: #302653; |
0fa3b3a79
|
287 288 289 |
font-size:24px; letter-spacing: 2px; margin-bottom:10px;" |
a690a86fb
|
290 291 292 293 |
>Roll: {{ getCard.rollNo }}</p> <p v-if="getCard.joinDate" style="color: #302653; |
0fa3b3a79
|
294 295 |
margin-bottom:10px; font-size:16px; |
ecf8cdfdd
|
296 |
letter-spacing: 2px;" |
a690a86fb
|
297 298 299 300 |
>{{ dates(getCard.joinDate) }}</p> <p v-if="getCard.joiningDate" style="color: #302653; |
0fa3b3a79
|
301 302 |
margin-bottom:10px; font-size:16px; |
ecf8cdfdd
|
303 |
letter-spacing: 2px;" |
a690a86fb
|
304 305 306 307 |
>{{ dates(getCard.joiningDate) }}</p> <p v-if="getCard.phone" style="color: #302653; |
0fa3b3a79
|
308 309 |
margin-bottom:10px; font-size:16px; |
ecf8cdfdd
|
310 |
letter-spacing: 2px;" |
a690a86fb
|
311 312 313 |
>{{ getCard.phone }}</p> <p style=" |
ecf8cdfdd
|
314 315 316 |
font-size: 19px; font-weight: 100; color: rgb(48, 38, 83); |
0fa3b3a79
|
317 318 |
letter-spacing: 5px; margin-bottom:10px;" |
a690a86fb
|
319 320 321 322 323 324 |
> <span v-if="getCard.mobile">{{ getCard.mobile}}</span> <span v-if="getCard.mobileNo">{{ getCard.mobileNo }}</span> </p> <p style=" |
ecf8cdfdd
|
325 326 327 |
font-size: 17px; font-weight: 100; color: rgb(48, 38, 83); |
0fa3b3a79
|
328 329 |
letter-spacing: 4px; margin-bottom:14px;" |
a690a86fb
|
330 331 332 333 334 |
>{{ getCard.email}}</p> </v-flex> </v-layout> <!-- back side --> <v-layout style=" |
ecf8cdfdd
|
335 |
text-align: center;" v-if="backPart"> |
a690a86fb
|
336 337 338 339 340 341 342 |
<v-flex xs12> <!-- school Logo Url --> <img v-if="getCard.schoolLogoUrl" :src="getCard.schoolLogoUrl" alt="schoollogo" style=" |
ecf8cdfdd
|
343 344 345 |
width: 110px; margin-top:10px; overflow:hidden" |
a690a86fb
|
346 347 348 349 350 351 |
/> <img v-if="getCard.schoolId" :src="getCard.schoolId.schoolLogoUrl" alt="schoollogo" style=" |
ecf8cdfdd
|
352 353 354 |
width: 110px; margin-top:10px; overflow:hidden" |
a690a86fb
|
355 356 357 358 |
/> <p v-if="getCard.schoolLogoUrl" style="color: #302653; |
0fa3b3a79
|
359 360 361 |
font-size:24px; letter-spacing: 4px; margin-bottom:14px;" |
a690a86fb
|
362 363 364 |
> <b>{{ getCard.name}}</b> </p> |
a55b7fca2
|
365 |
|
a690a86fb
|
366 367 368 |
<p v-if="getCard.city" style=" |
ecf8cdfdd
|
369 370 371 |
font-size: 17px; font-weight: 100; color: rgb(48, 38, 83); |
0fa3b3a79
|
372 373 |
letter-spacing: 4px; margin-bottom:14px;" |
a690a86fb
|
374 375 376 |
>{{ getCard.city}}</p> <p style=" |
ecf8cdfdd
|
377 378 379 |
font-size: 17px; font-weight: 100; color: rgb(48, 38, 83); |
0fa3b3a79
|
380 381 |
letter-spacing: 4px; margin-bottom:14px;" |
a690a86fb
|
382 383 384 385 386 387 388 389 390 391 |
> {{ getCard.address }} {{ getCard.presentAddress }} <span v-if="getCard.state" >({{ getCard.state }})</span> </p> <p v-if="getCard.establishmentYear" style=" |
ecf8cdfdd
|
392 393 394 |
font-size: 17px; font-weight: 100; color: rgb(48, 38, 83); |
0fa3b3a79
|
395 396 |
letter-spacing: 4px; margin-bottom:14px;" |
a690a86fb
|
397 398 399 400 401 402 403 404 |
>{{ getCard.establishmentYear }}</p> </v-flex> </v-layout> <!-- bottom-right-side-image --> <img src="static/icon/shape2.png" alt="shape2" style="bottom: 0; |
ecf8cdfdd
|
405 406 407 |
position: absolute; right: 0; width: 110px;" |
a690a86fb
|
408 409 |
/> </div> |
1c422f1bf
|
410 |
</div> |
a690a86fb
|
411 412 413 |
</v-layout> </v-container> </div> |
7c44528bc
|
414 |
</v-layout> |
7c435b5bb
|
415 416 417 |
</v-flex> </v-layout> </div> |
ecf8cdfdd
|
418 419 420 421 422 423 424 425 |
<v-snackbar :timeout="timeout" :top="y === 'top'" :right="x === 'right'" :vertical="mode === 'vertical'" v-model="snackbar" :color="color" >{{ text }}</v-snackbar> |
5ddc6bb04
|
426 427 428 |
<div class="loader" v-if="showLoader"> <v-progress-circular indeterminate color="white"></v-progress-circular> </div> |
7c435b5bb
|
429 430 431 432 433 434 |
</v-container> </template> <script> import http from "@/Services/http.js"; import moment from "moment"; |
d84fa5db2
|
435 |
var qs = require("qs"); |
7c435b5bb
|
436 437 438 |
export default { data: () => ({ |
5ddc6bb04
|
439 |
showLoader: false, |
7c435b5bb
|
440 441 442 |
valid: true, report: {}, userData: {}, |
ecf8cdfdd
|
443 444 445 446 447 448 449 |
snackbar: false, color: "", y: "top", x: "right", mode: "", timeout: 10000, text: "", |
7c435b5bb
|
450 451 452 453 454 455 456 457 458 459 |
loading: false, showReport: false, frontPart: false, backPart: false, showClass: false, showTeacher: false, showAdmin: false, showAccountant: false, showLibrarian: false, hideprintIdCard: false, |
37cb39130
|
460 |
hidebackprintIdCard: false, |
ecf8cdfdd
|
461 462 |
showStudents: false, showSections: false, |
7c435b5bb
|
463 464 465 466 |
getRoles: [], classList: [], getCard: [], addSection: [], |
11d037abe
|
467 468 469 470 |
// getStudentsList: // teacherList: [], getSelectUserData: [], // Users: [], |
ecf8cdfdd
|
471 |
getReport: {}, |
d84fa5db2
|
472 |
typeRules: [(v) => !!v || "Type is required"], |
7c435b5bb
|
473 474 475 |
typeList: [ { name: "Front Part", |
d84fa5db2
|
476 |
value: "frontPart", |
7c435b5bb
|
477 478 479 |
}, { name: "Back Part", |
d84fa5db2
|
480 481 |
value: "backPart", }, |
7c435b5bb
|
482 |
], |
d84fa5db2
|
483 |
backgroundList: ["Yes", "No"], |
7c435b5bb
|
484 485 486 487 488 489 490 491 492 |
}), mounted() { this.token = this.$store.state.token; this.getUserData(); this.getRole(); }, methods: { |
d84fa5db2
|
493 |
dates: function (date) { |
ecf8cdfdd
|
494 495 496 497 |
return moment(date).format("MMMM DD, YYYY"); return date; }, getReportType() { |
b8258078b
|
498 |
if (this.getReport.viewType === "frontPart") { |
7c435b5bb
|
499 500 501 |
this.frontPart = true; this.backPart = false; } |
b8258078b
|
502 |
if (this.getReport.viewType === "backPart") { |
7c435b5bb
|
503 504 505 506 507 |
this.frontPart = false; this.backPart = true; } }, getRoleInputs(role) { |
11d037abe
|
508 |
// console.log("role", role); |
ecf8cdfdd
|
509 510 511 |
this.showReport = false; this.getReport._id = ""; this.getCard = ""; |
b8258078b
|
512 513 514 515 516 517 |
this.classList = []; this.addSection = []; this.getReport.classId = ""; this.getReport.sectionId = ""; this.getReport._id = ""; this.getSelectUserData = []; |
d84fa5db2
|
518 |
if (role.name === "STUDENT") { |
7c435b5bb
|
519 520 |
// console.log("role", role); this.showClass = true; |
ecf8cdfdd
|
521 522 523 524 525 526 |
this.showTeacher = false; this.showAdmin = false; this.showAccountant = false; this.showLibrarian = false; this.showStudents = false; this.showSections = false; |
7c435b5bb
|
527 528 |
this.getClass(); } |
d84fa5db2
|
529 |
if (role.name === "TEACHER") { |
7c435b5bb
|
530 |
this.showTeacher = true; |
ecf8cdfdd
|
531 532 533 534 535 536 |
this.showClass = false; this.showAdmin = false; this.showAccountant = false; this.showLibrarian = false; this.showStudents = false; this.showSections = false; |
7c435b5bb
|
537 538 |
this.getTeacherList(); } |
d84fa5db2
|
539 |
if (role.name === "ADMIN") { |
7c435b5bb
|
540 |
this.showAdmin = true; |
ecf8cdfdd
|
541 542 543 544 545 546 |
this.showTeacher = false; this.showClass = false; this.showAccountant = false; this.showLibrarian = false; this.showStudents = false; this.showSections = false; |
20fba3a75
|
547 |
this.getUsersList(role.role); |
7c435b5bb
|
548 |
} |
d84fa5db2
|
549 |
if (role.name === "ACCOUNTANT") { |
7c435b5bb
|
550 |
this.showAccountant = true; |
ecf8cdfdd
|
551 552 553 554 555 556 |
this.showAdmin = false; this.showTeacher = false; this.showClass = false; this.showLibrarian = false; this.showStudents = false; this.showSections = false; |
d84fa5db2
|
557 |
this.getUsersList(role.role); |
7c435b5bb
|
558 |
} |
d84fa5db2
|
559 |
if (role.name === "LIBRARIAN") { |
7c435b5bb
|
560 |
this.showLibrarian = true; |
ecf8cdfdd
|
561 562 563 564 565 566 |
this.showAccountant = false; this.showAdmin = false; this.showTeacher = false; this.showClass = false; this.showStudents = false; this.showSections = false; |
d84fa5db2
|
567 |
this.getUsersList(role.role); |
7c435b5bb
|
568 569 570 571 572 |
} }, prindIDCardReport() { // Pass the element id here |
a690a86fb
|
573 |
this.$htmlToPaper("printMe"); |
7c435b5bb
|
574 575 |
}, getUserData() { |
11d037abe
|
576 |
this.getSelectUserData = []; |
5ddc6bb04
|
577 |
this.showLoader = true; |
7c435b5bb
|
578 579 |
http() .get("/getParticularUserDetail") |
d84fa5db2
|
580 |
.then((response) => { |
11d037abe
|
581 582 |
let mergeObj = { name: "Select All", |
d84fa5db2
|
583 |
id: "Select All", |
11d037abe
|
584 585 586 587 |
}; this.getSelectUserData.push(mergeObj); let getUserDetails = response.data.data; this.getSelectUserData.push(getUserDetails); |
5ddc6bb04
|
588 |
this.showLoader = false; |
7c435b5bb
|
589 590 |
// this.adminList = response.data.data; }) |
d84fa5db2
|
591 |
.catch((error) => { |
5ddc6bb04
|
592 |
this.showLoader = false; |
ecf8cdfdd
|
593 594 595 596 597 |
if (error.response.status === 401) { this.$router.replace({ path: "/" }); this.$store.dispatch("setToken", null); this.$store.dispatch("Id", null); } |
7c435b5bb
|
598 599 600 601 602 603 |
}); }, getRole() { this.showLoader = true; http() .get("/getRolesList", { |
d84fa5db2
|
604 |
headers: { Authorization: "Bearer " + this.token }, |
7c435b5bb
|
605 |
}) |
d84fa5db2
|
606 |
.then((response) => { |
ecf8cdfdd
|
607 608 |
var getRoles = []; getRoles = response.data.data; |
ecf8cdfdd
|
609 |
for (let i = 0; i < getRoles.length; i++) { |
d84fa5db2
|
610 611 612 613 |
if ( getRoles[i].name != "SUPERADMIN" && getRoles[i].name != "PARENT" ) { |
ecf8cdfdd
|
614 615 |
this.getRoles.push(getRoles[i]); } |
36883961f
|
616 |
} |
7c435b5bb
|
617 618 |
this.showLoader = false; }) |
d84fa5db2
|
619 |
.catch((error) => { |
7c435b5bb
|
620 |
this.showLoader = false; |
ecf8cdfdd
|
621 622 623 624 625 626 |
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
|
627 628 629 |
}); }, getClass() { |
11d037abe
|
630 |
// console.log("get classes"); |
7c435b5bb
|
631 632 633 |
this.showLoader = true; http() .get("/getClassesList", { |
d84fa5db2
|
634 |
headers: { Authorization: "Bearer " + this.token }, |
7c435b5bb
|
635 |
}) |
d84fa5db2
|
636 |
.then((response) => { |
7c435b5bb
|
637 638 639 |
this.classList = response.data.data; this.showLoader = false; }) |
d84fa5db2
|
640 |
.catch((error) => { |
7c435b5bb
|
641 642 643 644 645 646 647 648 649 650 651 |
this.showLoader = false; // console.log("err====>", err); }); }, getSections(_id) { this.showLoader = true; http() .get( "/getSectionsList", { params: { classId: _id } }, { |
d84fa5db2
|
652 |
headers: { Authorization: "Bearer " + this.token }, |
7c435b5bb
|
653 654 |
} ) |
d84fa5db2
|
655 |
.then((response) => { |
7c435b5bb
|
656 |
this.addSection = response.data.data; |
ecf8cdfdd
|
657 |
this.showSections = true; |
7c435b5bb
|
658 659 |
this.showLoader = false; }) |
d84fa5db2
|
660 |
.catch((err) => { |
7c435b5bb
|
661 662 663 664 665 |
this.showLoader = false; // console.log("err====>", err); }); }, getStudents() { |
11d037abe
|
666 |
this.getSelectUserData = []; |
7c435b5bb
|
667 668 669 670 671 |
this.showLoader = true; http() .get("/getStudentWithClass", { params: { classId: this.getReport.classId, |
d84fa5db2
|
672 673 |
sectionId: this.getReport.sectionId, }, |
7c435b5bb
|
674 |
}) |
d84fa5db2
|
675 |
.then((response) => { |
11d037abe
|
676 677 |
response.data.data.unshift({ name: "Select All", |
d84fa5db2
|
678 |
_id: "Select All", |
11d037abe
|
679 680 |
}); this.getSelectUserData = response.data.data; |
ecf8cdfdd
|
681 |
this.showStudents = true; |
7c435b5bb
|
682 683 |
this.showLoader = false; }) |
d84fa5db2
|
684 |
.catch((error) => { |
7c435b5bb
|
685 686 687 688 689 |
console.log("err====>", error); this.showLoader = false; }); }, getCards() { |
11d037abe
|
690 691 |
var getSelectUserId = []; for (let i = 0; i < this.getSelectUserData.length; i++) { |
d84fa5db2
|
692 693 |
/* 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
|
694 |
if (this.getReport._id === this.getSelectUserData[i]._id) { |
11d037abe
|
695 |
getSelectUserId.push(this.getSelectUserData[i]._id); |
d84fa5db2
|
696 697 698 |
} /* else if select all option is selected then all ids will be pushed */ else if ( this.getReport._id == "Select All" ) { |
11d037abe
|
699 |
getSelectUserId.push(this.getSelectUserData[i]._id); |
d84fa5db2
|
700 701 702 703 704 |
if ( getSelectUserId[0] == undefined || getSelectUserId[0] == "Select All" ) { getSelectUserId.shift(); |
11d037abe
|
705 706 707 |
} } } |
d84fa5db2
|
708 |
|
a55b7fca2
|
709 |
if (this.$refs.form.validate()) { |
fe0d05d29
|
710 |
this.showLoader = true; |
20fba3a75
|
711 |
// var strigified = JSON.stringify(getSelectUserId) |
d84fa5db2
|
712 713 |
// var profileId = []; // profileId = getSelectUserId; |
58fac10b4
|
714 715 716 717 |
var idcardPayload = { profileId: getSelectUserId, role: this.getReport.role.role, }; |
a55b7fca2
|
718 |
http() |
58fac10b4
|
719 |
.put("/getIdCardDetail", idcardPayload, { |
a55b7fca2
|
720 |
headers: { |
d84fa5db2
|
721 |
Authorization: "Bearer " + this.token, |
a55b7fca2
|
722 |
}, |
d84fa5db2
|
723 724 725 726 727 728 729 |
paramsSerializer: (params) => { return qs.stringify(params); }, // params: { // profileId: strigified, // role: this.getReport.role.role, // }, |
a55b7fca2
|
730 |
}) |
d84fa5db2
|
731 |
.then((response) => { |
a55b7fca2
|
732 |
this.getCard = ""; |
1c422f1bf
|
733 |
|
a55b7fca2
|
734 |
var data = response.data.data; |
1c422f1bf
|
735 |
|
20fba3a75
|
736 |
if (data.adminData && data.adminData.length != 0) { |
a55b7fca2
|
737 |
this.getCard = response.data.data.adminData; |
11d037abe
|
738 |
// console.log("this.getCard ", this.getCard); |
a55b7fca2
|
739 |
} |
20fba3a75
|
740 |
if (data.teachersData && data.teachersData.length != 0) { |
a55b7fca2
|
741 |
this.getCard = response.data.data.teachersData; |
a55b7fca2
|
742 |
} |
20fba3a75
|
743 |
if (data.studentData && data.studentData.length != 0) { |
a55b7fca2
|
744 |
this.getCard = response.data.data.studentData; |
11d037abe
|
745 |
// console.log("this.getCard--studentData ", this.getCard); |
a55b7fca2
|
746 |
} |
20fba3a75
|
747 |
if (data.usersData && data.usersData.length != 0) { |
a55b7fca2
|
748 |
this.getCard = response.data.data.usersData; |
11d037abe
|
749 |
// console.log("this.getCard--usersData ", this.getCard); |
a55b7fca2
|
750 751 752 753 754 |
} // console.log("this.getCard--all ", response.data.data); this.showLoader = false; this.showReport = true; }) |
d84fa5db2
|
755 |
.catch((error) => { |
a55b7fca2
|
756 |
this.showLoader = false; |
11d037abe
|
757 |
// console.log("error", error.response.data.errors); |
20fba3a75
|
758 759 760 761 762 |
// if (error.response.data.errors) { // this.snackbar = true; // this.text = " Field is required"; // this.color = "error"; // } |
a55b7fca2
|
763 764 |
}); } |
7c435b5bb
|
765 766 |
}, getTeacherList() { |
11d037abe
|
767 |
this.getSelectUserData = []; |
7c435b5bb
|
768 769 770 771 |
this.showLoader = true; var token = this.$store.state.token; http() .get("/getTeachersList", { |
d84fa5db2
|
772 |
headers: { Authorization: "Bearer " + token }, |
7c435b5bb
|
773 |
}) |
d84fa5db2
|
774 |
.then((response) => { |
11d037abe
|
775 776 |
response.data.data.unshift({ name: "Select All", |
d84fa5db2
|
777 |
_id: "Select All", |
11d037abe
|
778 779 |
}); this.getSelectUserData = response.data.data; |
7c435b5bb
|
780 781 |
this.showLoader = false; }) |
d84fa5db2
|
782 |
.catch((error) => { |
7c435b5bb
|
783 784 785 786 787 788 789 790 |
this.showLoader = false; if (error.response.status === 401) { this.$router.replace({ path: "/" }); this.$store.dispatch("setToken", null); this.$store.dispatch("Id", null); } }); }, |
a55b7fca2
|
791 |
getUsersList(role) { |
11d037abe
|
792 |
this.getSelectUserData = []; |
7c435b5bb
|
793 794 795 |
this.showLoader = true; var token = this.$store.state.token; http() |
a55b7fca2
|
796 |
.get("/getUsersList?role=" + role, { |
d84fa5db2
|
797 |
headers: { Authorization: "Bearer " + token }, |
7c435b5bb
|
798 |
}) |
d84fa5db2
|
799 |
.then((response) => { |
11d037abe
|
800 801 |
response.data.data.unshift({ name: "Select All", |
d84fa5db2
|
802 |
_id: "Select All", |
11d037abe
|
803 804 |
}); this.getSelectUserData = response.data.data; |
7c435b5bb
|
805 806 |
this.showLoader = false; }) |
d84fa5db2
|
807 |
.catch((error) => { |
7c435b5bb
|
808 809 810 811 812 813 814 815 816 817 818 819 |
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
|
820 821 |
Authorization: "Bearer " + this.$store.state.token, }, |
7c435b5bb
|
822 |
}) |
d84fa5db2
|
823 |
.then((response) => { |
7c435b5bb
|
824 825 |
this.parentsList = response.data.data; }) |
d84fa5db2
|
826 |
.catch((error) => { |
7c435b5bb
|
827 828 829 830 831 832 833 834 835 |
// 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
|
836 837 |
}, }, |
7c435b5bb
|
838 839 840 841 842 843 844 845 846 847 848 849 850 |
}; </script> <style scoped> .Data { width: 100%; float: left; margin-bottom: 0px; padding: 0 15px; font-size: 14px; margin-top: 5px; text-align: justify; } |
36883961f
|
851 852 853 854 855 856 857 858 |
.idcardreport { font-family: arial; max-width: 794px; max-height: 1123px; margin-left: auto; margin-right: auto; -webkit-print-color-adjust: exact; } |
cc7844a9d
|
859 860 861 862 |
.idcardreport1 { text-align: center; margin-left: 35%; } |
7c435b5bb
|
863 864 |
.icard-front { margin: 3px; |
36883961f
|
865 |
float: left; |
37cb39130
|
866 |
padding: 10px; |
37cb39130
|
867 |
text-align: center; |
b001726a1
|
868 |
/* height: 520px; */ |
ecf8cdfdd
|
869 870 871 |
width: 520px; background: #fff; border: 1px solid lightgray; |
37cb39130
|
872 873 874 875 876 |
} .print-data { margin: 3px; float: left; /* border: 1px solid #000; */ |
7c435b5bb
|
877 |
padding: 10px; |
37cb39130
|
878 |
/* width: 55%; */ |
7c435b5bb
|
879 |
text-align: center; |
37cb39130
|
880 881 |
height: 95%; } |
cc7844a9d
|
882 883 884 |
.rightside { float: right !important; } |
36883961f
|
885 |
.icard-front h2 { |
37cb39130
|
886 887 888 889 890 891 892 893 894 895 896 897 898 |
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
|
899 900 |
} .icard-front img { |
37cb39130
|
901 902 903 904 905 906 907 908 909 910 |
width: 70px; height: 70px; margin-bottom: 5px; } .icard-back img { width: 50px; height: 50px; margin-bottom: 5px; } .icard-img { |
7c435b5bb
|
911 912 913 |
width: 50px; height: 50px; margin-bottom: 5px; |
37cb39130
|
914 915 |
margin-top: 5px; border: 1px solid #ddd; |
7c435b5bb
|
916 917 |
} .icard-data { |
36883961f
|
918 |
/* font-family: Arial; */ |
7c435b5bb
|
919 920 921 922 923 924 925 926 |
max-width: 794px; max-height: 1123px; margin-left: auto; margin-right: auto; -webkit-print-color-adjust: exact; } .icard-back { margin: 3px; |
37cb39130
|
927 928 929 930 931 932 933 934 935 936 |
/* float: left; */ /* border: 1px solid #000; */ padding: 10px; /* width: 55%; */ text-align: center; /* height: 95%; */ /* margin-top: 35%; */ } .back-icard { margin: 3px; |
7c435b5bb
|
937 |
padding: 10px; |
7c435b5bb
|
938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 |
} .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
|
953 |
/* .icard-back p { |
7c435b5bb
|
954 955 956 957 |
font-size: 15px; color: #000; font-weight: 500px; line-height: 17px; |
37cb39130
|
958 |
} */ |
7c435b5bb
|
959 960 961 962 963 |
.school-address { /* width: 40%; */ font-weight: 500px; color: #000; } |
cc7844a9d
|
964 965 966 967 968 |
.address { font-weight: 500px; color: #000; text-align: center; } |
7c435b5bb
|
969 970 971 972 973 974 975 976 977 978 979 |
.icard-bottom { padding-top: 5px; text-align: center; } .qrcode { float: left; width: 50%; } .qrcode img { width: 60px; height: 60px; |
37cb39130
|
980 |
margin-top: 15px; |
7c435b5bb
|
981 982 983 984 |
} .session { float: right; width: 70%; |
37cb39130
|
985 |
margin-top: 15px; |
7c435b5bb
|
986 |
} |
7c44528bc
|
987 |
|
7c435b5bb
|
988 989 990 991 992 993 994 995 996 997 998 |
@media screen and (max-width: 360px) { .icard-front { width: 316px; height: 418px; float: inherit; } .icard-back { float: left; } } </style> |