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