Commit b8690bbc9ef4e8c9c32d070942ea9e1797811e49
1 parent
7140ae6bf7
Exists in
master
and in
3 other branches
implement create issue in library
Showing
4 changed files
with
145 additions
and
128 deletions
Show diff stats
src/Services/http.js
... | ... | @@ -3,7 +3,7 @@ import store from '@/store/store' |
3 | 3 | |
4 | 4 | export default () => { |
5 | 5 | return axios.create({ |
6 | - // baseURL: 'http://192.168.4.220:3002/v1', | |
6 | + // baseURL: 'http://192.168.2.221:3002/v1',/ | |
7 | 7 | baseURL: 'http://13.234.251.173:8001/v1', |
8 | 8 | headers: { |
9 | 9 | Authorization: `Bearer ${store.state.token}` | ... | ... |
src/pages/Library/books.vue
... | ... | @@ -62,7 +62,7 @@ |
62 | 62 | </v-layout> |
63 | 63 | <v-layout> |
64 | 64 | <v-flex xs4 class="pt-4 subheading"> |
65 | - <label class="right pr-2">Subject Code :</label> | |
65 | + <label class="right pr-2">Subject Code:</label> | |
66 | 66 | </v-flex> |
67 | 67 | <v-flex xs8> |
68 | 68 | <v-text-field |
... | ... | @@ -89,6 +89,7 @@ |
89 | 89 | <v-flex xs8> |
90 | 90 | <v-text-field |
91 | 91 | v-model="editedItem.quantity" |
92 | + type="number" | |
92 | 93 | placeholder="fill your Quantity" |
93 | 94 | ></v-text-field> |
94 | 95 | </v-flex> |
... | ... | @@ -218,7 +219,7 @@ |
218 | 219 | <td id="td" class="text-xs-center">{{ props.index + 1}}</td> |
219 | 220 | <td id="td" class="text-xs-center">{{ props.item.name }}</td> |
220 | 221 | <td id="td" class="text-xs-center">{{ props.item.author }}</td> |
221 | - <td id="td" class="text-xs-center">{{ props.item.subjectCode }}</td> | |
222 | + <td id="td" class="text-xs-center">{{ props.item.subjectCode }}</td> | |
222 | 223 | <td id="td" class="text-xs-center">{{ props.item.price }}</td> |
223 | 224 | <td id="td" class="text-xs-center">{{ props.item.quantity }}</td> |
224 | 225 | <td id="td" class="text-xs-center">{{ props.item.rackNo }}</td> |
... | ... | @@ -282,7 +283,7 @@ |
282 | 283 | <v-flex xs6 class="ml-3"> |
283 | 284 | <v-text-field |
284 | 285 | v-model="BooksData.name" |
285 | - placeholder="fill your Fee Type" | |
286 | + placeholder="fill your Name" | |
286 | 287 | type="text" |
287 | 288 | :rules="nameRules" |
288 | 289 | required |
... | ... | @@ -402,7 +403,6 @@ export default { |
402 | 403 | validEdit: true, |
403 | 404 | isActive: true, |
404 | 405 | newActive: false, |
405 | - AddUsercredentials: {}, | |
406 | 406 | pagination: { |
407 | 407 | rowsPerPage: 15 |
408 | 408 | }, |
... | ... | @@ -493,7 +493,7 @@ export default { |
493 | 493 | ) |
494 | 494 | .then(response => { |
495 | 495 | if ((this.snackbar = true)) { |
496 | - this.text = "Successfully delete Existing feetype"; | |
496 | + this.text = "Successfully delete Existing Delete Student "; | |
497 | 497 | } |
498 | 498 | this.getBookData(); |
499 | 499 | }) |
... | ... | @@ -528,6 +528,7 @@ export default { |
528 | 528 | this.dialog2 = false; |
529 | 529 | }, |
530 | 530 | submit() { |
531 | + this.BooksData.quantity = Number(this.BooksData.quantity); | |
531 | 532 | if (this.$refs.form.validate()) { |
532 | 533 | this.loading = true; |
533 | 534 | http() | ... | ... |
src/pages/Library/eBook.vue
... | ... | @@ -270,7 +270,7 @@ |
270 | 270 | </v-data-table> |
271 | 271 | </v-tab-item> |
272 | 272 | |
273 | - <!-- ****** ADD MULTIPLE NEWS ****** --> | |
273 | + <!-- ****** ADD MULTIPLE E-BOOK ****** --> | |
274 | 274 | |
275 | 275 | <v-tab-item> |
276 | 276 | <v-container> |
... | ... | @@ -702,6 +702,7 @@ export default { |
702 | 702 | this.token = this.$store.state.token; |
703 | 703 | this.getEBooksList(); |
704 | 704 | this.getAllClass(); |
705 | + this.getBookData(); | |
705 | 706 | // this.editItem; |
706 | 707 | }, |
707 | 708 | created() { | ... | ... |
src/pages/Library/issue.vue
... | ... | @@ -17,7 +17,7 @@ |
17 | 17 | class="subheading" |
18 | 18 | >Add Issue</v-tab> |
19 | 19 | |
20 | - <!-- ****** EDITS ALL NEWS DETAILS ****** --> | |
20 | + <!-- ****** EDIT ISSUE ****** --> | |
21 | 21 | |
22 | 22 | <v-tab-item> |
23 | 23 | <v-snackbar |
... | ... | @@ -212,14 +212,19 @@ |
212 | 212 | color="success" |
213 | 213 | >{{ text }}</v-snackbar> |
214 | 214 | |
215 | - <!-- ****** EXISTING-USERS NEWS TABLE ****** --> | |
215 | + <!-- ****** EXISTING ISSUE TABLE****** --> | |
216 | 216 | <v-card> |
217 | 217 | <v-layout> |
218 | 218 | <v-flex lg1 xs4 md4 xl1 class="hidden-xs-only"> |
219 | 219 | <label class="right pt-4">Library ID:</label> |
220 | 220 | </v-flex> |
221 | 221 | <v-flex lg2 md3 xs7> |
222 | - <v-text-field class="pl-3" @keyup.enter="searchLibrary" v-model="libraryId" placeholder="fill your library Id"></v-text-field> | |
222 | + <v-text-field | |
223 | + class="pl-3" | |
224 | + @keyup.enter="searchLibrary" | |
225 | + v-model="libraryId" | |
226 | + placeholder="fill your library Id" | |
227 | + ></v-text-field> | |
223 | 228 | </v-flex> |
224 | 229 | <v-flex lg9 md3 xs5> |
225 | 230 | <v-btn |
... | ... | @@ -248,11 +253,6 @@ |
248 | 253 | > |
249 | 254 | <template slot="items" slot-scope="props"> |
250 | 255 | <td class="text-xs-center">{{ props.index + 1}}</td> |
251 | - <!-- <td id="td" class="text-xs-center"> | |
252 | - <span v-for="(image,_id) in props.item.newsImageUrl" class="pa-2"> | |
253 | - <img :src="image.imageUrl" alt="newsImage" width="100" height="70" /> | |
254 | - </span> | |
255 | - </td>--> | |
256 | 256 | <td id="td" class="text-xs-center">{{ props.item.title}}</td> |
257 | 257 | <td id="td" class="text-xs-center">{{ props.item.description}}</td> |
258 | 258 | |
... | ... | @@ -288,7 +288,7 @@ |
288 | 288 | </v-data-table> |
289 | 289 | </v-tab-item> |
290 | 290 | |
291 | - <!-- ****** ADD MULTIPLE NEWS ****** --> | |
291 | + <!-- ****** ADD Issue ****** --> | |
292 | 292 | |
293 | 293 | <v-tab-item> |
294 | 294 | <v-container> |
... | ... | @@ -298,38 +298,12 @@ |
298 | 298 | :right="x === 'right'" |
299 | 299 | :vertical="mode === 'vertical'" |
300 | 300 | v-model="snackbar" |
301 | - color="success" | |
301 | + :color="color" | |
302 | 302 | >{{ text }}</v-snackbar> |
303 | 303 | <v-flex xs12 sm12 class="my-4"> |
304 | 304 | <v-card flat> |
305 | 305 | <v-form ref="form" v-model="valid" lazy-validation> |
306 | 306 | <v-container fluid> |
307 | - <!-- <v-layout> | |
308 | - <v-flex | |
309 | - xs12 | |
310 | - class="text-xs-center text-sm-center text-md-center text-lg-center my-4 mr-4" | |
311 | - > | |
312 | - <input | |
313 | - type="file" | |
314 | - style="display: none" | |
315 | - ref="image" | |
316 | - accept="image/*" | |
317 | - multiple | |
318 | - @change="onFilePicked" | |
319 | - /> | |
320 | - <v-layout justify-center> | |
321 | - <v-flex v-for="(file,index) in files" :key="index" v-if="files"> | |
322 | - <img :src="file" height="160" width="160px;" /> | |
323 | - </v-flex> | |
324 | - </v-layout> | |
325 | - <img | |
326 | - src="/static/icon/user.png" | |
327 | - v-if="files ==''" | |
328 | - height="140" | |
329 | - width="180px;" | |
330 | - /> | |
331 | - </v-flex> | |
332 | - </v-layout>--> | |
333 | 307 | <v-flex xs12> |
334 | 308 | <v-layout> |
335 | 309 | <v-flex xs4 class="pt-4 subheading"> |
... | ... | @@ -337,7 +311,7 @@ |
337 | 311 | </v-flex> |
338 | 312 | <v-flex xs4 class="ml-3"> |
339 | 313 | <v-text-field |
340 | - v-model="addIssue.libraryID" | |
314 | + v-model="libraryID" | |
341 | 315 | placeholder="fill your Library ID" |
342 | 316 | :rules="libraryIDRules" |
343 | 317 | required |
... | ... | @@ -351,12 +325,16 @@ |
351 | 325 | <label class="right">Book:</label> |
352 | 326 | </v-flex> |
353 | 327 | <v-flex xs4 class="ml-3"> |
354 | - <v-text-field | |
355 | - placeholder="fill your Description" | |
328 | + <v-select | |
329 | + label="Select Book Name" | |
356 | 330 | :rules="bookRules" |
357 | - v-model="addIssue.book" | |
331 | + :items="books" | |
332 | + item-text="name" | |
333 | + item-value="_id" | |
334 | + v-model="bookId" | |
335 | + @change="getParticularBookData(bookId)" | |
358 | 336 | required |
359 | - ></v-text-field> | |
337 | + ></v-select> | |
360 | 338 | </v-flex> |
361 | 339 | </v-layout> |
362 | 340 | </v-flex> |
... | ... | @@ -397,7 +375,7 @@ |
397 | 375 | <v-text-field |
398 | 376 | placeholder="fill your Serial No" |
399 | 377 | :rules="authorRules" |
400 | - v-model="addIssue.serialNo" | |
378 | + v-model="serialNo" | |
401 | 379 | ></v-text-field> |
402 | 380 | </v-flex> |
403 | 381 | </v-layout> |
... | ... | @@ -405,13 +383,43 @@ |
405 | 383 | <v-flex xs12> |
406 | 384 | <v-layout> |
407 | 385 | <v-flex xs4 class="pt-4 subheading"> |
386 | + <label class="right">Serial No:</label> | |
387 | + </v-flex> | |
388 | + <v-flex xs4 class="ml-3"> | |
389 | + <v-menu | |
390 | + ref="menu2" | |
391 | + :close-on-content-click="false" | |
392 | + v-model="menu2" | |
393 | + :nudge-right="40" | |
394 | + :return-value.sync="date" | |
395 | + lazy | |
396 | + transition="scale-transition" | |
397 | + offset-y | |
398 | + full-width | |
399 | + min-width="290px" | |
400 | + > | |
401 | + <v-text-field | |
402 | + slot="activator" | |
403 | + v-model="date" | |
404 | + label="Picker without buttons" | |
405 | + append-icon="event" | |
406 | + readonly | |
407 | + ></v-text-field> | |
408 | + <v-date-picker v-model="date" @input="$refs.menu2.save(date)"></v-date-picker> | |
409 | + </v-menu> | |
410 | + </v-flex> | |
411 | + </v-layout> | |
412 | + </v-flex> | |
413 | + <v-flex xs12> | |
414 | + <v-layout> | |
415 | + <v-flex xs4 class="pt-4 subheading"> | |
408 | 416 | <label class="right">Note:</label> |
409 | 417 | </v-flex> |
410 | 418 | <v-flex xs4 class="ml-3"> |
411 | 419 | <v-text-field |
412 | 420 | placeholder="fill your Note" |
413 | 421 | :rules="noteRules" |
414 | - v-model="addIssue.note" | |
422 | + v-model="note" | |
415 | 423 | ></v-text-field> |
416 | 424 | </v-flex> |
417 | 425 | </v-layout> |
... | ... | @@ -421,7 +429,7 @@ |
421 | 429 | <v-card-actions> |
422 | 430 | <v-btn @click="clear" round dark>clear</v-btn> |
423 | 431 | <v-spacer></v-spacer> |
424 | - <v-btn @click="submit" round dark :loading="loading">Add</v-btn> | |
432 | + <v-btn @click="submit" round dark :loading="loading" :disabled="disable">Add</v-btn> | |
425 | 433 | </v-card-actions> |
426 | 434 | </v-flex> |
427 | 435 | </v-layout> |
... | ... | @@ -445,10 +453,13 @@ import Util from "@/util"; |
445 | 453 | export default { |
446 | 454 | data: () => ({ |
447 | 455 | snackbar: false, |
456 | + date: null, | |
457 | + menu2: false, | |
458 | + color: "", | |
448 | 459 | y: "top", |
449 | 460 | x: "right", |
450 | 461 | mode: "", |
451 | - timeout: 3000, | |
462 | + timeout: 10000, | |
452 | 463 | text: "", |
453 | 464 | libraryId: "", |
454 | 465 | loading: false, |
... | ... | @@ -492,18 +503,24 @@ export default { |
492 | 503 | ], |
493 | 504 | desserts: [], |
494 | 505 | addIssue: {}, |
495 | - editedItem: {} | |
506 | + bookId: "", | |
507 | + libraryID: "", | |
508 | + serialNo: "", | |
509 | + note: "", | |
510 | + editedItem: {}, | |
511 | + books: [], | |
512 | + token: "", | |
513 | + disable: false | |
496 | 514 | }), |
497 | 515 | methods: { |
498 | 516 | getSections(_id) { |
499 | 517 | console.log("_id", _id); |
500 | - var token = this.$store.state.token; | |
501 | 518 | http() |
502 | 519 | .get( |
503 | 520 | "/getSectionsList", |
504 | 521 | { params: { classId: _id } }, |
505 | 522 | { |
506 | - headers: { Authorization: "Bearer " + token } | |
523 | + headers: { Authorization: "Bearer " + this.token } | |
507 | 524 | } |
508 | 525 | ) |
509 | 526 | .then(response => { |
... | ... | @@ -518,45 +535,6 @@ export default { |
518 | 535 | pickFile() { |
519 | 536 | this.$refs.image.click(); |
520 | 537 | }, |
521 | - // onFilePicked(e) { | |
522 | - // // console.log(e) | |
523 | - // const files = e.target.files; | |
524 | - // /** fetch Image Name **/ | |
525 | - // if (files[0] !== undefined) { | |
526 | - // this.imageName = files[0].name; | |
527 | - // if (this.imageName.lastIndexOf(".") <= 0) { | |
528 | - // return; | |
529 | - // } | |
530 | - // this.files = []; | |
531 | - // // console.log("files", this.files); | |
532 | - // /** Select many image and showing many image add to news card **/ | |
533 | - // const test = Array.from(files).forEach((file, idx) => { | |
534 | - // const fr = new FileReader(); | |
535 | - // const getResult = new Promise(resolve => { | |
536 | - // fr.onload = e => { | |
537 | - // this.files.push( | |
538 | - // // id: idx, | |
539 | - // e.target.result | |
540 | - // ); | |
541 | - // }; | |
542 | - // }); | |
543 | - // fr.readAsDataURL(file); | |
544 | - // return getResult.then(file => { | |
545 | - // return file; | |
546 | - // }); | |
547 | - // }); | |
548 | - // const fr = new FileReader(); | |
549 | - // fr.readAsDataURL(files[0]); | |
550 | - // fr.addEventListener("load", () => { | |
551 | - // this.imageFile = files; // this is an image file that can be sent to server... | |
552 | - // // console.log("uploadImage=======>", this.imageFile ); | |
553 | - // }); | |
554 | - // } else { | |
555 | - // this.imageName = ""; | |
556 | - // this.imageFile = ""; | |
557 | - // this.imageUrl = ""; | |
558 | - // } | |
559 | - // }, | |
560 | 538 | searchLibrary() { |
561 | 539 | this.showLoader = true; |
562 | 540 | this.loadingSearch = true; |
... | ... | @@ -623,25 +601,6 @@ export default { |
623 | 601 | // console.log(error); |
624 | 602 | }); |
625 | 603 | }, |
626 | - // deleteImage(issueId) { | |
627 | - // console.log(imageId, issueId); | |
628 | - // let deleteImages = { | |
629 | - // issueId: issueId, | |
630 | - // }; | |
631 | - // http() | |
632 | - // .put("/deleteImages", deleteImages) | |
633 | - // .then(response => { | |
634 | - // console.log("deleteIssue", deleteImages); | |
635 | - // if ((this.snackbar = true)) { | |
636 | - // this.text = "Image deleted Successfully"; | |
637 | - // } | |
638 | - // this.getIssueList(); | |
639 | - // this.close(); | |
640 | - // }) | |
641 | - // .catch(error => { | |
642 | - // console.log(error); | |
643 | - // }); | |
644 | - // }, | |
645 | 604 | activeTab(type) { |
646 | 605 | switch (type) { |
647 | 606 | case "existing": |
... | ... | @@ -667,21 +626,33 @@ export default { |
667 | 626 | }, |
668 | 627 | submit() { |
669 | 628 | this.loading = true; |
670 | - http() | |
671 | - .post("/createIssue") | |
672 | - .then(response => { | |
673 | - if ((this.snackbar = true)) { | |
674 | - this.text = "New Issue added successfully"; | |
675 | - } | |
676 | - this.getIssueList(); | |
677 | - this.loading = false; | |
678 | - this.clear(); | |
679 | - }) | |
680 | - .catch(error => { | |
681 | - if ((this.snackbar = true)) { | |
682 | - this.text = error.response.data.message; | |
683 | - } | |
684 | - }); | |
629 | + // if (this.$refs.form.validate()){ | |
630 | + // let createBook = { | |
631 | + // bookId: this.bookId, | |
632 | + // author: this.addIssue.author, | |
633 | + // subjectCode: this.addIssue.subjectCode, | |
634 | + // libraryId: this.libraryID, | |
635 | + // serialNumber: this.serialNo, | |
636 | + // note: this.note, | |
637 | + // dueDate: this.date | |
638 | + // }; | |
639 | + // console.log("====================", createBook); | |
640 | + // http() | |
641 | + // .post("/createBookIssue", createBook) | |
642 | + // .then(response => { | |
643 | + // this.snackbar = true; | |
644 | + // this.text = "New Issue added successfully"; | |
645 | + // // this.getIssueList(); | |
646 | + // this.color = "succses"; | |
647 | + // this.loading = false; | |
648 | + // this.clear(); | |
649 | + // }) | |
650 | + // .catch(error => { | |
651 | + // if ((this.snackbar = true)) { | |
652 | + // this.text = error.response.data.message; | |
653 | + // } | |
654 | + // }); | |
655 | + // } | |
685 | 656 | }, |
686 | 657 | clear() { |
687 | 658 | this.$refs.form.reset(); |
... | ... | @@ -700,10 +671,54 @@ export default { |
700 | 671 | .catch(error => { |
701 | 672 | // console.log(error); |
702 | 673 | }); |
674 | + }, | |
675 | + getBookData() { | |
676 | + this.showLoader = true; | |
677 | + http() | |
678 | + .get("/getBooksList", { | |
679 | + headers: { Authorization: "Bearer " + this.token } | |
680 | + }) | |
681 | + .then(response => { | |
682 | + this.books = response.data.data; | |
683 | + this.showLoader = false; | |
684 | + // console.log("getAllfeetypes=====>",response.data.data) | |
685 | + }) | |
686 | + .catch(error => { | |
687 | + // console.log("err====>", err); | |
688 | + this.showLoader = false; | |
689 | + // if (error.response.status === 401) { | |
690 | + // this.$router.replace({ path: "/" }); | |
691 | + // this.$store.dispatch("setToken", null); | |
692 | + // this.$store.dispatch("Id", null); | |
693 | + // } | |
694 | + }); | |
695 | + }, | |
696 | + getParticularBookData(books) { | |
697 | + console.log("books", books); | |
698 | + for (let i = 0; i < this.books.length; i++) { | |
699 | + if (books == this.books[i]._id) { | |
700 | + console.log("books", this.books[i].remaining); | |
701 | + if (this.books[i].remaining <= 0) { | |
702 | + this.snackbar = true; | |
703 | + this.text = "Book is unavailable"; | |
704 | + this.color = "red"; | |
705 | + this.disable = true; | |
706 | + } else if (this.books[i].remaining > 0) { | |
707 | + this.disable = false; | |
708 | + } | |
709 | + this.addIssue = { | |
710 | + author: this.books[i].author, | |
711 | + subjectCode: this.books[i].subjectCode | |
712 | + }; | |
713 | + } | |
714 | + } | |
715 | + this.addIssue.boojk = books; | |
703 | 716 | } |
704 | 717 | }, |
705 | 718 | mounted() { |
706 | 719 | // this.getIssueList(); |
720 | + this.token = this.$store.state.token; | |
721 | + this.getBookData(); | |
707 | 722 | }, |
708 | 723 | created() { |
709 | 724 | this.$root.$on("app:search", search => { | ... | ... |