Blame view
src/pages/Library/issue.vue
28.2 KB
687e0b929
|
1 |
<template> |
68d742034
|
2 3 |
<v-container fluid class="body-color"> <!-- ****** EDIT ISSUE ****** --> |
db965de89
|
4 |
<v-dialog v-model="editIssueDialog" max-width="600px" scrollable persistent> |
68d742034
|
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
<v-card flat class="card-style pa-2" dark> <v-layout> <v-flex xs12> <label class="title text-xs-center">Edit Issue</label> <v-icon size="24" class="right" @click="editIssueDialog = false">cancel</v-icon> </v-flex> </v-layout> <v-card-text> <v-form ref="form"> <v-container fluid> <v-layout wrap> <v-flex xs12 sm12> <v-layout> <v-flex xs4 class="pt-4 subheading"> <label class="right">Library Id:</label> </v-flex> <v-flex xs7 class="ml-3"> <v-text-field v-model="editedItem.libraryId" placeholder="fill your Library Id" name="name" type="text" |
a76a6f135
|
27 |
disabled |
68d742034
|
28 29 30 31 32 33 34 35 36 37 |
></v-text-field> </v-flex> </v-layout> </v-flex> <v-flex xs12 sm12> <v-layout> <v-flex xs4 class="pt-4 subheading"> <label class="right">Book:</label> </v-flex> <v-flex xs7 class="ml-3"> |
109a6218c
|
38 39 40 41 42 43 44 45 |
<v-select v-model="editedItem.bookId" label="Select Book Name" :rules="bookRules" :items="books" item-text="name" item-value="_id" ></v-select> |
68d742034
|
46 47 48 49 |
</v-flex> </v-layout> </v-flex> <v-flex xs12 sm12> |
61ab1167f
|
50 |
<v-layout> |
68d742034
|
51 52 |
<v-flex xs4 class="pt-4 subheading"> <label class="right">Author:</label> |
687e0b929
|
53 |
</v-flex> |
68d742034
|
54 55 56 57 58 59 |
<v-flex xs7 class="ml-3"> <v-text-field placeholder="fill your Author Name" v-model="editedItem.author" type="text" ></v-text-field> |
687e0b929
|
60 |
</v-flex> |
68d742034
|
61 62 63 64 65 66 |
</v-layout> </v-flex> <v-flex xs12 sm12> <v-layout> <v-flex xs4 class="pt-4 subheading"> <label class="right">Subject Code:</label> |
61ab1167f
|
67 |
</v-flex> |
68d742034
|
68 69 70 71 72 73 |
<v-flex xs7 class="ml-3"> <v-text-field placeholder="fill your Subject Codes" v-model="editedItem.subjectCode" type="text" ></v-text-field> |
61ab1167f
|
74 |
</v-flex> |
68d742034
|
75 76 77 78 79 80 81 82 83 84 85 86 87 |
</v-layout> </v-flex> <v-flex xs12 sm12> <v-layout> <v-flex xs4 class="pt-4 subheading"> <label class="right">Serial Number:</label> </v-flex> <v-flex xs7 class="ml-3"> <v-text-field placeholder="fill your Serial Number" v-model="editedItem.serialNumber" type="text" ></v-text-field> |
687e0b929
|
88 |
</v-flex> |
68d742034
|
89 90 91 92 93 94 |
</v-layout> </v-flex> <v-flex xs12 sm12> <v-layout> <v-flex xs4 class="pt-4 subheading"> <label class="right">due Date:</label> |
687e0b929
|
95 |
</v-flex> |
68d742034
|
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
<v-flex xs7 class="ml-3"> <v-menu ref="menu1" :close-on-content-click="false" v-model="menu1" :nudge-right="40" :return-value.sync="menu1" lazy transition="scale-transition" offset-y full-width min-width="290px" > <v-text-field slot="activator" v-model="editedItem.dueDate" label="Select Due Date" append-icon="event" readonly ></v-text-field> <v-date-picker v-model="editedItem.dueDate" @input="menu1 = false"></v-date-picker> </v-menu> |
61ab1167f
|
118 |
</v-flex> |
687e0b929
|
119 |
</v-layout> |
68d742034
|
120 121 |
</v-flex> <v-flex xs12 sm12> |
687e0b929
|
122 |
<v-layout> |
68d742034
|
123 124 125 126 127 128 129 130 131 |
<v-flex xs4 class="pt-4 subheading"> <label class="right">Note:</label> </v-flex> <v-flex xs7 class="ml-3"> <v-text-field placeholder="fill your Serial Number" v-model="editedItem.note" type="text" ></v-text-field> |
687e0b929
|
132 133 |
</v-flex> </v-layout> |
68d742034
|
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
</v-flex> </v-layout> <v-layout> <v-flex xs12> <v-card-actions> <v-spacer></v-spacer> <v-btn round dark @click="save" class="add-button">Save</v-btn> </v-card-actions> </v-flex> </v-layout> </v-container> </v-form> </v-card-text> </v-card> </v-dialog> |
687e0b929
|
149 |
|
68d742034
|
150 |
<!-- ****** PROFILE VIEW PARTICULAR ISSUE DATA ****** --> |
687e0b929
|
151 |
|
db965de89
|
152 |
<v-dialog v-model="viewIssueDialog" max-width="500px" persistent> |
68d742034
|
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
<v-card flat class="card-style pa-3" dark> <v-layout> <v-flex xs12> <label class="title text-xs-center">View Issue</label> <v-icon size="24" class="right" @click="viewIssueDialog = false">cancel</v-icon> </v-flex> </v-layout> <v-card-text> <v-container grid-list-md> <v-layout wrap> <v-flex> <v-layout> <v-flex xs5 sm6> <h5 class="right my-1"> <b>Book:</b> </h5> </v-flex> <v-flex sm6 xs8> <h5 class="my-1">{{ editedItem.name }}</h5> |
687e0b929
|
172 173 |
</v-flex> </v-layout> |
68d742034
|
174 175 176 177 178 |
<v-layout> <v-flex xs5 sm6> <h5 class="right my-1"> <b>Serial Number:</b> </h5> |
687e0b929
|
179 |
</v-flex> |
68d742034
|
180 181 |
<v-flex sm6 xs8> <h5 class="my-1">{{ editedItem.serialNumber }}</h5> |
687e0b929
|
182 |
</v-flex> |
68d742034
|
183 184 185 186 187 188 |
</v-layout> <v-layout> <v-flex xs5 sm6> <h5 class="right my-1"> <b>Issue date:</b> </h5> |
687e0b929
|
189 |
</v-flex> |
68d742034
|
190 191 |
<v-flex sm6 xs8> <h5 class="my-1">{{ dates(editedItem.creted) }}</h5> |
687e0b929
|
192 |
</v-flex> |
68d742034
|
193 194 195 196 197 198 |
</v-layout> <v-layout> <v-flex xs5 sm6> <h5 class="right my-1"> <b>Due date:</b> </h5> |
687e0b929
|
199 |
</v-flex> |
68d742034
|
200 201 |
<v-flex sm6 xs8> <h5 class="my-1">{{ dates(editedItem.dueDate) }}</h5> |
b8690bbc9
|
202 |
</v-flex> |
68d742034
|
203 204 205 206 207 208 |
</v-layout> <v-layout> <v-flex xs5 sm6> <h5 class="right my-1"> <b>Status:</b> </h5> |
687e0b929
|
209 |
</v-flex> |
68d742034
|
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
<v-flex sm6 xs8> <h5 class="my-1">{{ editedItem.status }}</h5> </v-flex> </v-layout> </v-flex> </v-layout> </v-container> </v-card-text> </v-card> </v-dialog> <!-- ****** EXISTING ISSUE TABLE****** --> <!-- <v-card> <v-layout> <v-flex lg1 xs4 md4 xl1 class="hidden-xs-only"> <label class="right pt-4">Library ID:</label> </v-flex> <v-flex lg2 md3 xs7> <v-text-field class="pl-3" @keyup.enter="getIssueList" v-model="libraryId" placeholder="fill your library Id" ></v-text-field> </v-flex> <v-flex lg9 md3 xs5> <v-btn round class="black mt-1 right hidden-xs-only" @click="getIssueList" :loading="loadingSearch" dark >Search</v-btn> <v-btn round class="black mt-4 right hidden-sm-only hidden-xl-only hidden-md-only hidden-lg-only" :loading="loadingSearch" @click="getIssueList" small dark >Search</v-btn> </v-flex> </v-layout> </v-card>--> <v-toolbar color="transparent" flat> <v-btn fab dark class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" small @click="addIssueDialog = true" > <v-icon dark>add</v-icon> </v-btn> <v-btn round class="open-dialog-button hidden-sm-only hidden-xs-only" dark @click="addIssueDialog = true" > <v-icon class="white--text pr-1" size="20">add</v-icon>Add Issue </v-btn> <v-flex lg2 md3 xs7> <v-text-field class="pl-3" @keyup.enter="getIssueList" v-model="libraryId" placeholder="fill your library Id" ></v-text-field> </v-flex> <v-spacer></v-spacer> <v-btn round class="add-button mt-1 right hidden-xs-only" @click="getIssueList" :loading="loadingSearch" dark >Search</v-btn> <v-btn round class="add-button mt-4 right hidden-sm-only hidden-xl-only hidden-md-only hidden-lg-only" :loading="loadingSearch" @click="getIssueList" small dark >Search</v-btn> <v-card-title class="body-1" v-show="show"> <v-btn icon large flat @click="displaySearch"> <v-avatar size="27"> |
aa310d61a
|
299 |
<img src="/static/icon/search.png" alt="icon" /> |
68d742034
|
300 301 302 |
</v-avatar> </v-btn> </v-card-title> |
612b79bb4
|
303 |
<v-flex xs8 sm8 md3 lg2 v-if="showSearch"> |
68d742034
|
304 |
<v-layout> |
8e8d14254
|
305 306 307 308 309 310 311 |
<v-text-field autofocus v-model="search" label="Search" prepend-inner-icon="search" color="primary" ></v-text-field> |
68d742034
|
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 |
<v-icon @click="closeSearch" color="error">close</v-icon> </v-layout> </v-flex> </v-toolbar> <v-data-table :headers="headers" :items="desserts" :pagination.sync="pagination" :search="search" > <template slot="items" slot-scope="props" v-if="props.item.isReturn != true"> <tr class="tr"> <td class="td td-row">{{ props.index + 1}}</td> <td class="text-xs-center td td-row">{{ props.item.bookId.name}}</td> <td class="text-xs-center td td-row">{{ props.item.serialNumber}}</td> <td class="text-xs-center td td-row">{{ dates(props.item.created) }}</td> <td class="text-xs-center td td-row">{{ dates(props.item.dueDate) }}</td> <td class="text-xs-center td td-row"> <span v-if="props.item.bookId.status === 'AVAILABLE'" class="green lighten-1 pa-1 px-2 white--text paymentStatus" >{{ props.item.bookId.status}}</span> <span v-if="props.item.bookId.status === 'UNAVAILABLE'" class="red lighten-1 pa-1 px-2 white--text paymentStatus" >{{ props.item.bookId.status}}</span> </td> <td class="text-xs-center td td-row"> <span> <v-tooltip top> <img slot="activator" style="cursor:pointer; width:25px; height:25px; " class="mr-3" @click="profile(props.item)" |
aa310d61a
|
347 |
src="/static/icon/view.png" |
68d742034
|
348 349 350 351 352 353 354 355 356 |
/> <span>View</span> </v-tooltip> <v-tooltip top> <img slot="activator" style="cursor:pointer; width:20px; height:18px; " class="mr-3" @click="editItem(props.item)" |
aa310d61a
|
357 |
src="/static/icon/edit.png" |
68d742034
|
358 359 360 361 362 363 364 365 |
/> <span>Edit</span> </v-tooltip> <v-tooltip top> <img slot="activator" style="cursor:pointer; width:20px; height:20px; " @click="deleteItem(props.item)" |
aa310d61a
|
366 |
src="/static/icon/delete.png" |
68d742034
|
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 |
/> <span>Delete</span> </v-tooltip> </span> </td> </tr> </template> <v-alert slot="no-results" :value="true" color="error" icon="warning" >Your search for "{{ search }}" found no results.</v-alert> </v-data-table> <!-- ****** ADD Issue ****** --> |
db965de89
|
383 |
<v-dialog v-model="addIssueDialog" max-width="600px" v-if="addIssueDialog" persistent> |
68d742034
|
384 385 386 387 |
<v-card flat class="card-style pa-2" dark> <v-layout> <v-flex xs12> <label class="title text-xs-center">Add Issue</label> |
8e8d14254
|
388 |
<v-icon size="24" class="right" @click="closeAddIssueModel">cancel</v-icon> |
687e0b929
|
389 |
</v-flex> |
68d742034
|
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 |
</v-layout> <v-form ref="form" v-model="valid" lazy-validation> <v-container fluid> <v-flex xs12> <v-layout> <v-flex xs4 class="pt-4 subheading"> <label class="right">Library ID:</label> </v-flex> <v-flex xs7 class="ml-3"> <v-text-field v-model="libraryID" placeholder="fill your Library ID" :rules="libraryIDRules" required ></v-text-field> </v-flex> </v-layout> </v-flex> <v-flex xs12> <v-layout> <v-flex xs4 class="pt-4 subheading"> <label class="right">Book:</label> </v-flex> <v-flex xs7 class="ml-3"> <v-select label="Select Book Name" :rules="bookRules" :items="books" item-text="name" item-value="_id" v-model="bookId" @change="getParticularBookData(bookId)" required ></v-select> </v-flex> </v-layout> </v-flex> <v-flex xs12> <v-layout> <v-flex xs4 class="pt-4 subheading"> <label class="right">Author:</label> </v-flex> <v-flex xs7 class="ml-3"> <v-text-field placeholder="fill your Author" :rules="authorRules" v-model="addIssue.author" ></v-text-field> </v-flex> </v-layout> </v-flex> <v-flex xs12> <v-layout> <v-flex xs4 class="pt-4 subheading"> <label class="right">Subject Code:</label> </v-flex> <v-flex xs7 class="ml-3"> <v-text-field placeholder="fill your Subject Code" :rules="subjectCodeRules" v-model="addIssue.subjectCode" ></v-text-field> </v-flex> </v-layout> </v-flex> <v-flex xs12> <v-layout> <v-flex xs4 class="pt-4 subheading"> <label class="right">Serial No:</label> </v-flex> <v-flex xs7 class="ml-3"> <v-text-field placeholder="fill your Serial No" :rules="authorRules" v-model="serialNo" ></v-text-field> </v-flex> </v-layout> </v-flex> <v-flex xs12> <v-layout> <v-flex xs4 class="pt-4 subheading"> <label class="right">Due Date:</label> </v-flex> <v-flex xs7 class="ml-3"> <v-menu ref="menu2" :close-on-content-click="false" v-model="menu2" :nudge-right="40" :return-value.sync="date" lazy transition="scale-transition" offset-y full-width min-width="290px" > <v-text-field slot="activator" v-model="date" label="Select Due Date" append-icon="event" :rules="dueDateRule" readonly ></v-text-field> <v-date-picker v-model="date" @input="$refs.menu2.save(date)"></v-date-picker> </v-menu> </v-flex> </v-layout> </v-flex> <v-flex xs12> <v-layout> <v-flex xs4 class="pt-4 subheading"> <label class="right">Note:</label> </v-flex> <v-flex xs7 class="ml-3"> |
0cb974fde
|
506 |
<v-text-field placeholder="fill your Note" v-model="note"></v-text-field> |
68d742034
|
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 |
</v-flex> </v-layout> </v-flex> <v-layout> <v-flex xs12> <v-card-actions> <v-spacer></v-spacer> <v-btn @click="clear" round dark class="clear-button">clear</v-btn> <v-btn @click="submit" round dark :loading="loading" class="add-button" :disabled="disable" >Add</v-btn> </v-card-actions> </v-flex> </v-layout> </v-container> </v-form> </v-card> </v-dialog> |
687e0b929
|
530 531 532 |
<div class="loader" v-if="showLoader"> <v-progress-circular indeterminate color="white"></v-progress-circular> </div> |
68d742034
|
533 534 535 536 537 538 539 540 541 |
<v-snackbar :timeout="timeout" :top="y === 'top'" :right="x === 'right'" :vertical="mode === 'vertical'" v-model="snackbar" :color="color" >{{ text }}</v-snackbar> </v-container> |
687e0b929
|
542 543 544 545 |
</template> <script> import http from "@/Services/http.js"; |
61ab1167f
|
546 |
import moment from "moment"; |
687e0b929
|
547 548 549 550 |
export default { data: () => ({ snackbar: false, |
b8690bbc9
|
551 |
date: null, |
61ab1167f
|
552 |
menu1: false, |
b8690bbc9
|
553 554 |
menu2: false, color: "", |
68d742034
|
555 556 |
show: true, showSearch: false, |
61ab1167f
|
557 |
dueDate: null, |
687e0b929
|
558 559 560 |
y: "top", x: "right", mode: "", |
b8690bbc9
|
561 |
timeout: 10000, |
687e0b929
|
562 |
text: "", |
6c05a9f84
|
563 |
libraryId: "", |
687e0b929
|
564 |
loading: false, |
6c05a9f84
|
565 |
loadingSearch: false, |
687e0b929
|
566 567 |
date: null, search: "", |
68d742034
|
568 569 |
addIssueDialog: false, viewIssueDialog: false, |
687e0b929
|
570 |
showLoader: false, |
68d742034
|
571 |
editIssueDialog: false, |
687e0b929
|
572 573 574 575 576 577 |
dialog1: false, valid: true, isActive: true, newActive: false, addclass: [], addSection: [], |
687e0b929
|
578 |
pagination: { |
8e8d14254
|
579 |
rowsPerPage: 10, |
687e0b929
|
580 |
}, |
8e8d14254
|
581 582 583 584 585 586 587 |
libraryIDRules: [(v) => !!v || " Library ID is required"], bookRules: [(v) => !!v || " book Name is required"], authorRules: [(v) => !!v || "Author Name is required"], subjectCodeRules: [(v) => !!v || "Subject Code is required"], authorRules: [(v) => !!v || "Author is required"], noteRules: [(v) => !!v || "Note is required"], dueDateRule: [(v) => !!v || "Due Date is required"], |
687e0b929
|
588 589 590 591 592 |
headers: [ { align: "justify-center", text: "No", sortable: false, |
8e8d14254
|
593 |
value: "No", |
687e0b929
|
594 |
}, |
61ab1167f
|
595 |
{ text: "Book", vaue: "name", sortable: false, align: "center" }, |
687e0b929
|
596 |
{ |
61ab1167f
|
597 598 599 |
text: "Serial Number", value: "serialNumber", sortable: false, |
8e8d14254
|
600 |
align: "center", |
61ab1167f
|
601 602 603 604 605 |
}, { text: "Issue Date", value: "created", sortable: false, |
8e8d14254
|
606 |
align: "center", |
61ab1167f
|
607 608 609 610 611 |
}, { text: "Due Date", value: "dueDate", sortable: false, |
8e8d14254
|
612 |
align: "center", |
61ab1167f
|
613 614 615 616 |
}, { text: "Status", value: "status", |
687e0b929
|
617 |
sortable: false, |
8e8d14254
|
618 |
align: "center", |
687e0b929
|
619 |
}, |
8e8d14254
|
620 |
{ text: "Action", value: "", sortable: false, align: "center" }, |
687e0b929
|
621 622 623 |
], desserts: [], addIssue: {}, |
b8690bbc9
|
624 625 626 627 628 629 630 |
bookId: "", libraryID: "", serialNo: "", note: "", editedItem: {}, books: [], token: "", |
8e8d14254
|
631 |
disable: false, |
687e0b929
|
632 |
}), |
8e8d14254
|
633 634 635 636 637 638 639 640 641 642 643 644 645 |
watch: { addIssueDialog: function (val) { if (!val) { this.addIssue = []; this.libraryID = ""; this.bookId = ""; this.serialNo = ""; this.menu2 = false; this.date = null; this.note = ""; } }, }, |
687e0b929
|
646 |
methods: { |
8e8d14254
|
647 |
dates: function (date) { |
61ab1167f
|
648 |
return moment(date).format("MMMM DD, YYYY"); |
687e0b929
|
649 650 651 652 |
}, pickFile() { this.$refs.image.click(); }, |
61ab1167f
|
653 |
getIssueList() { |
687e0b929
|
654 |
this.showLoader = true; |
6c05a9f84
|
655 |
this.loadingSearch = true; |
a76a6f135
|
656 657 658 |
if (this.libraryID) { this.libraryId = this.libraryID; } |
687e0b929
|
659 |
http() |
6c05a9f84
|
660 |
.get( |
61ab1167f
|
661 |
"/getBooksIssueList", |
6c05a9f84
|
662 |
{ |
99cd79184
|
663 664 |
params: { libraryId: this.libraryId, |
8e8d14254
|
665 666 |
schoolId: this.$store.state.schoolId, }, |
6c05a9f84
|
667 668 |
}, { |
8e8d14254
|
669 |
headers: { Authorization: "Bearer " + this.token }, |
6c05a9f84
|
670 671 |
} ) |
8e8d14254
|
672 |
.then((response) => { |
61ab1167f
|
673 |
this.desserts = response.data.data; |
687e0b929
|
674 |
this.showLoader = false; |
6c05a9f84
|
675 |
this.loadingSearch = false; |
687e0b929
|
676 |
}) |
8e8d14254
|
677 |
.catch((error) => { |
687e0b929
|
678 |
this.showLoader = false; |
6c05a9f84
|
679 680 681 |
this.loadingSearch = false; this.snackbar = true; this.text = error.response.data.message; |
687e0b929
|
682 683 684 685 |
if (error.response.status === 401) { this.$router.replace({ path: "/" }); this.$store.dispatch("setToken", null); this.$store.dispatch("Id", null); |
00e4bc4e1
|
686 |
this.$store.dispatch("Role", null); |
687e0b929
|
687 688 689 690 691 692 |
} }); }, editItem(item) { this.editedIndex = this.desserts.indexOf(item); this.editedItem = Object.assign({}, item); |
61ab1167f
|
693 694 695 696 697 698 |
this.editedItem.name = item.bookId.name; this.editedItem.status = item.bookId.status; this.editedItem.dueDate = this.editedItem.dueDate != undefined ? (this.editedItem.dueDate = this.editedItem.dueDate.substring(0, 10)) : (this.editedItem.dueDate = ""); |
68d742034
|
699 |
this.editIssueDialog = true; |
687e0b929
|
700 701 702 703 |
}, profile(item) { this.editedIndex = this.desserts.indexOf(item); this.editedItem = Object.assign({}, item); |
61ab1167f
|
704 705 |
this.editedItem.name = item.bookId.name; this.editedItem.status = item.bookId.status; |
68d742034
|
706 |
this.viewIssueDialog = true; |
687e0b929
|
707 |
}, |
109a6218c
|
708 709 |
deleteItem(item) { let deleteParticularIssue = { |
8e8d14254
|
710 |
bookIssueId: item._id, |
109a6218c
|
711 712 713 714 715 |
}; http() .delete( "/deleteBookIssue", confirm("Are you sure you want to delete this?") && { |
8e8d14254
|
716 |
params: deleteParticularIssue, |
109a6218c
|
717 718 |
} ) |
8e8d14254
|
719 |
.then((response) => { |
109a6218c
|
720 721 722 723 724 725 726 727 728 729 730 731 732 733 |
this.snackbar = true; this.text = "Delete Successfully"; this.getIssueList(); if (this.libraryID) { this.libraryId = this.libraryID; } if (this.libraryId) { this.libraryId = this.libraryId; } this.snackbar = true; this.text = response.data.message; this.color = "green"; this.loading = false; }) |
8e8d14254
|
734 |
.catch((error) => { |
109a6218c
|
735 736 737 738 739 740 |
// console.log(error); this.snackbar = true; this.text = error.response.data.message; this.color = "red"; }); }, |
61ab1167f
|
741 742 |
returnBook(item) { let returnBook = { |
8e8d14254
|
743 |
bookIssueId: item._id, |
687e0b929
|
744 745 |
}; http() |
61ab1167f
|
746 747 748 |
.put( "/returnBook", confirm("Are you sure you want to return this?") && returnBook |
687e0b929
|
749 |
) |
8e8d14254
|
750 |
.then((response) => { |
61ab1167f
|
751 752 |
this.snackbar = true; this.text = "Successfully return Issue a Book "; |
687e0b929
|
753 754 |
this.getIssueList(); }) |
8e8d14254
|
755 |
.catch((error) => {}); |
687e0b929
|
756 757 |
}, close() { |
68d742034
|
758 |
this.editIssueDialog = false; |
687e0b929
|
759 760 |
}, close1() { |
68d742034
|
761 |
this.viewIssueDialog = false; |
687e0b929
|
762 |
}, |
8e8d14254
|
763 764 765 766 767 768 769 770 771 772 773 |
closeAddIssueModel() { this.addIssueDialog = false; this.desserts = []; this.addIssue = []; this.libraryID = ""; this.bookId = ""; this.serialNo = ""; this.menu2 = false; this.date = null; this.note = ""; }, |
687e0b929
|
774 |
submit() { |
61ab1167f
|
775 776 777 778 779 780 781 782 |
if (this.$refs.form.validate()) { let createBook = { bookId: this.bookId, author: this.addIssue.author, subjectCode: this.addIssue.subjectCode, libraryId: this.libraryID, serialNumber: this.serialNo, note: this.note, |
99cd79184
|
783 |
dueDate: this.date, |
8e8d14254
|
784 |
schoolId: this.$store.state.schoolId, |
61ab1167f
|
785 |
}; |
4d1fcaddc
|
786 |
this.loading = true; |
61ab1167f
|
787 |
http() |
a76a6f135
|
788 |
.post("/createBookIssue", createBook) |
8e8d14254
|
789 |
.then((response) => { |
a76a6f135
|
790 |
this.getIssueList(); |
61ab1167f
|
791 |
this.snackbar = true; |
68d742034
|
792 |
this.text = response.data.message; |
a76a6f135
|
793 |
this.addIssueDialog = false; |
68d742034
|
794 |
this.color = "green"; |
61ab1167f
|
795 796 797 |
this.loading = false; this.clear(); }) |
8e8d14254
|
798 |
.catch((error) => { |
4d1fcaddc
|
799 800 801 |
this.snackbar = true; this.text = error.response.data.message; this.color = "red"; |
68d742034
|
802 |
this.loading = false; |
61ab1167f
|
803 804 |
}); } |
687e0b929
|
805 806 807 |
}, clear() { this.$refs.form.reset(); |
61ab1167f
|
808 |
this.disable = false; |
687e0b929
|
809 810 |
}, save() { |
61ab1167f
|
811 |
this.editedItem.bookIssueId = this.editedItem._id; |
d10c26632
|
812 |
this.editedItem.bookId = this.editedItem.bookId._id; |
687e0b929
|
813 |
http() |
61ab1167f
|
814 |
.put("/updateBookIssue", this.editedItem) |
8e8d14254
|
815 |
.then((response) => { |
a76a6f135
|
816 |
this.editIssueDialog = false; |
61ab1167f
|
817 818 819 |
this.snackbar = true; this.text = "Successfully Edit Issue a Book"; this.color = "green"; |
687e0b929
|
820 821 822 |
this.getIssueList(); this.close(); }) |
8e8d14254
|
823 |
.catch((error) => { |
68d742034
|
824 825 826 |
this.snackbar = true; this.text = error.response.data.message; this.color = "red"; |
687e0b929
|
827 |
}); |
b8690bbc9
|
828 829 830 831 832 |
}, getBookData() { this.showLoader = true; http() .get("/getBooksList", { |
99cd79184
|
833 |
params: { |
8e8d14254
|
834 |
schoolId: this.$store.state.schoolId, |
99cd79184
|
835 |
}, |
8e8d14254
|
836 |
headers: { Authorization: "Bearer " + this.token }, |
b8690bbc9
|
837 |
}) |
8e8d14254
|
838 |
.then((response) => { |
b8690bbc9
|
839 840 |
this.books = response.data.data; this.showLoader = false; |
b8690bbc9
|
841 |
}) |
8e8d14254
|
842 |
.catch((error) => { |
b8690bbc9
|
843 |
this.showLoader = false; |
0551a0f15
|
844 845 846 847 848 |
if (error.response.status === 401) { this.$router.replace({ path: "/" }); this.$store.dispatch("setToken", null); this.$store.dispatch("Id", null); } |
b8690bbc9
|
849 850 851 |
}); }, getParticularBookData(books) { |
b8690bbc9
|
852 853 |
for (let i = 0; i < this.books.length; i++) { if (books == this.books[i]._id) { |
b8690bbc9
|
854 855 856 857 858 859 860 861 862 863 |
if (this.books[i].remaining <= 0) { this.snackbar = true; this.text = "Book is unavailable"; this.color = "red"; this.disable = true; } else if (this.books[i].remaining > 0) { this.disable = false; } this.addIssue = { author: this.books[i].author, |
8e8d14254
|
864 |
subjectCode: this.books[i].subjectCode, |
b8690bbc9
|
865 866 867 868 |
}; } } this.addIssue.boojk = books; |
68d742034
|
869 870 871 872 873 874 875 876 |
}, displaySearch() { (this.show = false), (this.showSearch = true); }, closeSearch() { this.showSearch = false; this.show = true; this.search = ""; |
8e8d14254
|
877 |
}, |
687e0b929
|
878 879 |
}, mounted() { |
b8690bbc9
|
880 881 |
this.token = this.$store.state.token; this.getBookData(); |
8e8d14254
|
882 |
}, |
687e0b929
|
883 884 885 886 887 888 889 890 891 892 893 |
}; </script> <style scoped> .active { background-color: gray; color: white !important; } .activebtn { color: black !important; } </style> |