Commit ab54b565692ed73b7ebdc405cd81b5a6fd2b17a2

Authored by Neeraj Sharma
1 parent 6ae46ca27b

implement library books funtionality and design

... ... @@ -77,19 +77,19 @@ const Menu = [
77 77 path: '/timeTable',
78 78 icon: '/static/schoolIcons/Time_table.png',
79 79 },
80   - // {
81   - // title: 'Library',
82   - // group: 'Library',
83   - // component: 'Library',
84   - // icon: '/static/schoolIcons/Library.png',
85   - // items: [
86   - // { name: 'libraryMember', title: ' Library Member', component: 'libraryMember', action: '', },
87   - // { name: 'Books', title: 'Books', component: 'Books', action: '', },
88   - // { name: 'Issue', title: ' Issue', component: 'Issue', action: '', },
89   - // { name: 'eBooks', title: 'E-Books', component: 'eBooks', action: '', }
  80 + {
  81 + title: 'Library',
  82 + group: 'Library',
  83 + component: 'Library',
  84 + icon: '/static/schoolIcons/Library.png',
  85 + items: [
  86 + // { name: 'libraryMember', title: ' Library Member', component: 'libraryMember', action: '', },
  87 + { name: 'Books', title: 'Books', component: 'Books', action: '', },
  88 + // { name: 'Issue', title: ' Issue', component: 'Issue', action: '', },
  89 + // { name: 'eBooks', title: 'E-Books', component: 'eBooks', action: '', }
90 90  
91   - // ]
92   - // },
  91 + ]
  92 + },
93 93 {
94 94 title: 'Notification',
95 95 path: '/notification',
... ...
src/pages/Account/invoice.vue
... ... @@ -639,7 +639,7 @@ export default {
639 639 this.invoiceList = response.data.data;
640 640 this.showLoader = false;
641 641 })
642   - .catch(err => {
  642 + .catch(error => {
643 643 // console.log("err====>", err);
644 644 this.showLoader = false;
645 645 if (error.response.status === 401) {
... ... @@ -720,11 +720,12 @@ export default {
720 720 paidAmount: ""
721 721 };
722 722 for (let i = 0; i < this.feeTypeData.length; i++) {
  723 +
723 724 // *********** AMOUNT ***********
724 725  
725 726 feeType.amount =
726 727 Number(feeType.amount) + Number(this.feeTypeData[i].amount);
727   - console.log("feeType.amount ", feeType.amount);
  728 + // console.log("feeType.amount ", feeType.amount);
728 729 this.feeType.amount = feeType.amount;
729 730 this.feeType.subTotal = feeType.amount;
730 731 this.feeTypeData[i].subTotal = this.feeTypeData[i].amount;
... ... @@ -734,12 +735,12 @@ export default {
734 735 if (this.feeTypeData[i].discount) {
735 736 feeType.discount =
736 737 Number(feeType.discount) + Number(this.feeTypeData[i].discount);
737   - console.log("feeType.discount", feeType.discount);
  738 + // console.log("feeType.discount", feeType.discount);
738 739 this.feeType.discount = feeType.discount;
739 740 feeType.subParticularTotal =
740 741 this.feeTypeData[i].amount -
741 742 (this.feeTypeData[i].amount * this.feeTypeData[i].discount) / 100;
742   - console.log("feeType.subTotal", feeType.subTotal);
  743 + // console.log("feeType.subTotal", feeType.subTotal);
743 744 this.feeTypeData[i].subTotal = feeType.subParticularTotal.toFixed(2);
744 745 }
745 746  
... ...
src/pages/Account/paymentHistory.vue
... ... @@ -26,18 +26,26 @@
26 26 <td id="td" class="text-xs-center">{{ dates(props.item.date) }}</td>
27 27 <!-- <td class="text-xs-center">
28 28 <span>
29   - <img
30   - style="cursor:pointer; width:20px; height:18px; "
31   - class="mr-5"
32   - @click="editItem(props.item)"
33   - src="/static/icon/edit1.png"
34   - />
35   - <img
36   - style="cursor:pointer;width:20px; height:20px; "
37   - class="mr-5"
38   - @click="deleteItem(props.item)"
39   - src="/static/icon/delete1.png"
40   - />
  29 + <v-tooltip top>
  30 + <img
  31 + slot="activator"
  32 + style="cursor:pointer; width:20px; height:18px; "
  33 + class="mr-5"
  34 + @click="editItem(props.item)"
  35 + src="/static/icon/edit1.png"
  36 + />
  37 + <span>Edit</span>
  38 + </v-tooltip>
  39 + <v-tooltip top>
  40 + <img
  41 + slot="activator"
  42 + style="cursor:pointer;width:20px; height:20px; "
  43 + class="mr-5"
  44 + @click="deleteItem(props.item)"
  45 + src="/static/icon/delete1.png"
  46 + />
  47 + <span>Delete</span>
  48 + </v-tooltip>
41 49 </span>
42 50 </td> -->
43 51 </template>
... ... @@ -79,8 +87,18 @@ export default {
79 87 align: "center"
80 88 },
81 89 { text: "Class", value: "class", sortable: false, align: "center" },
82   - { text: "Fee Type", value: "feeTypeName", sortable: false, align: "center" },
83   - { text: "Method", value: "paymentMethod", sortable: false, align: "center" },
  90 + {
  91 + text: "Fee Type",
  92 + value: "feeTypeName",
  93 + sortable: false,
  94 + align: "center"
  95 + },
  96 + {
  97 + text: "Method",
  98 + value: "paymentMethod",
  99 + sortable: false,
  100 + align: "center"
  101 + },
84 102 {
85 103 text: "Paid Amount",
86 104 value: "totalPaidAmount",
... ... @@ -106,7 +124,7 @@ export default {
106 124 var token = this.$store.state.token;
107 125 http()
108 126 .get("/getInvoicesList", {
109   - params:{ paymentStatus: "FULLY_PAID"},
  127 + params: { paymentStatus: "FULLY_PAID" },
110 128 headers: { Authorization: "Bearer " + token }
111 129 })
112 130 .then(response => {
... ...
src/pages/Attendence/studentAttendence.vue
... ... @@ -156,7 +156,7 @@ export default {
156 156 this.studentsList = response.data.data;
157 157 console.log("getSectionsList=====>", response.data.data);
158 158 })
159   - .catch(err => {
  159 + .catch(error => {
160 160 // console.log("err====>", err);
161 161 this.showLoader = false;
162 162 if (error.response.status === 401) {
... ...
src/pages/Attendence/viewStudentsAttendence.vue
... ... @@ -223,7 +223,7 @@ export default {
223 223 }
224 224 this.activeDates = array;
225 225 })
226   - .catch(err => {
  226 + .catch(error => {
227 227 console.log("err====>", err);
228 228 this.showLoader = false;
229 229 if (error.response.status === 401) {
... ...
src/pages/Library/books.vue
... ... @@ -43,28 +43,62 @@
43 43 <v-form>
44 44 <v-layout>
45 45 <v-flex xs4 class="pt-4 subheading">
46   - <label class="right pr-3">Books:</label>
  46 + <label class="right pr-3">Name:</label>
  47 + </v-flex>
  48 + <v-flex xs8>
  49 + <v-text-field v-model="editedItem.name" placeholder="fill your Name"></v-text-field>
  50 + </v-flex>
  51 + </v-layout>
  52 + <v-layout>
  53 + <v-flex xs4 class="pt-4 subheading">
  54 + <label class="right pr-3">Author:</label>
47 55 </v-flex>
48 56 <v-flex xs8>
49 57 <v-text-field
50   - v-model="editedItem.feeType"
51   - placeholder="fill your Fee Type"
52   - required
  58 + v-model="editedItem.author"
  59 + placeholder="fill your Author Name"
53 60 ></v-text-field>
54 61 </v-flex>
55 62 </v-layout>
56 63 <v-layout>
57 64 <v-flex xs4 class="pt-4 subheading">
58   - <label class="right pr-3">Note:</label>
  65 + <label class="right pr-2">Subject Code :</label>
59 66 </v-flex>
60 67 <v-flex xs8>
61   - <v-textarea
62   - name="input-7-1"
63   - v-model="editedItem.note"
64   - placeholder="fill your Note"
65   - multi-line
66   - required
67   - ></v-textarea>
  68 + <v-text-field
  69 + v-model="editedItem.subjectCode"
  70 + placeholder="fill your Subject Code"
  71 + ></v-text-field>
  72 + </v-flex>
  73 + </v-layout>
  74 + <v-layout>
  75 + <v-flex xs4 class="pt-4 subheading">
  76 + <label class="right pr-3">Price :</label>
  77 + </v-flex>
  78 + <v-flex xs8>
  79 + <v-text-field
  80 + v-model="editedItem.price"
  81 + placeholder="fill your Subject Code"
  82 + ></v-text-field>
  83 + </v-flex>
  84 + </v-layout>
  85 + <v-layout>
  86 + <v-flex xs4 class="pt-4 subheading">
  87 + <label class="right pr-3">Quantity:</label>
  88 + </v-flex>
  89 + <v-flex xs8>
  90 + <v-text-field
  91 + v-model="editedItem.quantity"
  92 + placeholder="fill your Quantity"
  93 + ></v-text-field>
  94 + </v-flex>
  95 + </v-layout>
  96 + <v-layout>
  97 + <v-flex xs4 class="pt-4 subheading">
  98 + <label class="right pr-3">Rack No:</label>
  99 + </v-flex>
  100 + <v-flex xs8>
  101 + <v-text-field v-model="editedItem.rackNo" placeholder="fill your Rack No"></v-text-field>
68 102 </v-flex>
69 103 </v-layout>
70 104 <v-card-actions>
... ... @@ -99,21 +133,61 @@
99 133 <v-layout>
100 134 <v-flex xs5 sm6>
101 135 <h5 class="right my-1">
102   - <b>Class Name:</b>
  136 + <b>Name:</b>
  137 + </h5>
  138 + </v-flex>
  139 + <v-flex sm6 xs8>
  140 + <h5 class="my-1">{{ editedItem.name }}</h5>
  141 + </v-flex>
  142 + </v-layout>
  143 + <v-layout>
  144 + <v-flex xs5 sm6>
  145 + <h5 class="right my-1">
  146 + <b>Author:</b>
  147 + </h5>
  148 + </v-flex>
  149 + <v-flex sm6 xs8>
  150 + <h5 class="my-1">{{ editedItem.author }}</h5>
  151 + </v-flex>
  152 + </v-layout>
  153 + <v-layout>
  154 + <v-flex xs5 sm6>
  155 + <h5 class="right my-1">
  156 + <b>Subject Code :</b>
  157 + </h5>
  158 + </v-flex>
  159 + <v-flex sm6 xs8>
  160 + <h5 class="my-1">{{ editedItem.subjectCode }}</h5>
  161 + </v-flex>
  162 + </v-layout>
  163 + <v-layout>
  164 + <v-flex xs5 sm6>
  165 + <h5 class="right my-1">
  166 + <b>Price :</b>
  167 + </h5>
  168 + </v-flex>
  169 + <v-flex sm6 xs8>
  170 + <h5 class="my-1">{{ editedItem.price }}</h5>
  171 + </v-flex>
  172 + </v-layout>
  173 + <v-layout>
  174 + <v-flex xs5 sm6>
  175 + <h5 class="right my-1">
  176 + <b>Quantity :</b>
103 177 </h5>
104 178 </v-flex>
105 179 <v-flex sm6 xs8>
106   - <h5 class="my-1">{{ editedItem.feeType }}</h5>
  180 + <h5 class="my-1">{{ editedItem.quantity}}</h5>
107 181 </v-flex>
108 182 </v-layout>
109 183 <v-layout>
110 184 <v-flex xs5 sm6>
111 185 <h5 class="right my-1">
112   - <b>Books Name:</b>
  186 + <b>Rack No :</b>
113 187 </h5>
114 188 </v-flex>
115 189 <v-flex sm6 xs8>
116   - <h5 class="my-1">{{ editedItem.note }}</h5>
  190 + <h5 class="my-1">{{ editedItem.rackNo}}</h5>
117 191 </v-flex>
118 192 </v-layout>
119 193 </v-flex>
... ... @@ -136,14 +210,19 @@
136 210  
137 211 <v-data-table
138 212 :headers="headers"
139   - :items="BooksList"
  213 + :items="bookData"
140 214 :pagination.sync="pagination"
141 215 :search="search"
142 216 >
143 217 <template slot="items" slot-scope="props">
144 218 <td id="td" class="text-xs-center">{{ props.index + 1}}</td>
145   - <td id="td" class="text-xs-center">{{ props.item.feeType }}</td>
146   - <td id="td" class="text-xs-center">{{ props.item.note }}</td>
  219 + <td id="td" class="text-xs-center">{{ props.item.name }}</td>
  220 + <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.price }}</td>
  223 + <td id="td" class="text-xs-center">{{ props.item.quantity }}</td>
  224 + <td id="td" class="text-xs-center">{{ props.item.rackNo }}</td>
  225 + <td id="td" class="text-xs-center">{{ props.item.status }}</td>
147 226 <!-- <td id="td" class="text-xs-center">{{ props.item.session}}</td> -->
148 227  
149 228 <td class="text-xs-center">
... ... @@ -238,7 +317,7 @@
238 317 ></v-text-field>
239 318 </v-flex>
240 319 </v-layout>
241   - <v-layout>
  320 + <v-layout>
242 321 <v-flex xs4 class="pt-4 subheading">
243 322 <label class="right">Price:</label>
244 323 </v-flex>
... ... @@ -251,7 +330,7 @@
251 330 ></v-text-field>
252 331 </v-flex>
253 332 </v-layout>
254   - <v-layout>
  333 + <v-layout>
255 334 <v-flex xs4 class="pt-4 subheading">
256 335 <label class="right">Quantity:</label>
257 336 </v-flex>
... ... @@ -334,7 +413,6 @@ export default {
334 413 quantityRules: [v => !!v || "Quantity is required"],
335 414 rackNoRules: [v => !!v || "Rack No. is required"],
336 415  
337   -
338 416 headers: [
339 417 {
340 418 text: "No",
... ... @@ -348,35 +426,40 @@ export default {
348 426 sortable: false,
349 427 align: "center"
350 428 },
351   - { text: "Authour", value: "note", sortable: false, align: "center" },
352   - { text: "Subject Code", value: "subjectCode", sortable: false, align: "center" },
  429 + { text: "Authour", value: "author", sortable: false, align: "center" },
  430 + {
  431 + text: "Subject Code",
  432 + value: "subjectCode",
  433 + sortable: false,
  434 + align: "center"
  435 + },
353 436 { text: "Price", value: "price", sortable: false, align: "center" },
354 437 { text: "Quantity", value: "quantity", sortable: false, align: "center" },
355 438 { text: "Rack No", value: "rackNo", sortable: false, align: "center" },
356 439 { text: "Status", value: "status", sortable: false, align: "center" },
357   -
  440 +
358 441 // { text: "Session", value: "session", sortable: false, align: "center" },
359 442 { text: "Action", value: "", sortable: false, align: "center" }
360 443 ],
361   - BooksList: [],
  444 + bookData: [],
362 445 select: "",
363 446 token: "",
364 447 editedItem: {},
365 448 BooksData: {}
366 449 }),
367 450 methods: {
368   - getFeeTypeList() {
  451 + getBookData() {
369 452 this.showLoader = true;
370 453 http()
371   - .get("/getFeesList", {
  454 + .get("/getBooksList", {
372 455 headers: { Authorization: "Bearer " + this.token }
373 456 })
374 457 .then(response => {
375   - this.feeTypeList = response.data.data;
  458 + this.bookData = response.data.data;
376 459 this.showLoader = false;
377 460 // console.log("getAllfeetypes=====>",response.data.data)
378 461 })
379   - .catch(err => {
  462 + .catch(error => {
380 463 // console.log("err====>", err);
381 464 this.showLoader = false;
382 465 if (error.response.status === 401) {
... ... @@ -387,23 +470,23 @@ export default {
387 470 });
388 471 },
389 472 editItem(item) {
390   - this.editedIndex = this.feeTypeList.indexOf(item);
  473 + this.editedIndex = this.bookData.indexOf(item);
391 474 this.editedItem = Object.assign({}, item);
392 475 console.log(this.editedItem);
393 476 this.dialog = true;
394 477 },
395 478 profile(item) {
396   - this.editedIndex = this.feeTypeList.indexOf(item);
  479 + this.editedIndex = this.bookData.indexOf(item);
397 480 this.editedItem = Object.assign({}, item);
398 481 this.dialog1 = true;
399 482 },
400 483 deleteItem(item) {
401 484 let deleteStudent = {
402   - feeId: item._id
  485 + bookId: item._id
403 486 };
404 487 http()
405 488 .delete(
406   - "/deleteFee",
  489 + "/deleteBook",
407 490 confirm("Are you sure you want to delete this?") && {
408 491 params: deleteStudent
409 492 }
... ... @@ -412,7 +495,7 @@ export default {
412 495 if ((this.snackbar = true)) {
413 496 this.text = "Successfully delete Existing feetype";
414 497 }
415   - this.getFeeTypeList();
  498 + this.getBookData();
416 499 })
417 500 .catch(error => {
418 501 // console.log(error);
... ... @@ -448,12 +531,12 @@ export default {
448 531 if (this.$refs.form.validate()) {
449 532 this.loading = true;
450 533 http()
451   - .post("/createFee", this.feeTypeData)
  534 + .post("/createBook", this.BooksData)
452 535 .then(response => {
453 536 console.log(response);
454   - this.getFeeTypeList();
  537 + this.getBookData();
455 538 if ((this.snackbar = true)) {
456   - this.text = "New feetype added successfully";
  539 + this.text = "New Book added successfully";
457 540 }
458 541  
459 542 this.clear();
... ... @@ -472,14 +555,14 @@ export default {
472 555 this.$refs.form.reset();
473 556 },
474 557 save() {
475   - this.editedItem.feeId = this.editedItem._id;
  558 + this.editedItem.bookId = this.editedItem._id;
476 559 http()
477   - .put("/updateFee", this.editedItem)
  560 + .put("/updateBook", this.editedItem)
478 561 .then(response => {
479 562 if ((this.snackbar = true)) {
480   - this.text = "Successfully Edit Existing Fee Type";
  563 + this.text = "Successfully Edit Existing Book";
481 564 }
482   - this.getFeeTypeList();
  565 + this.getBookData();
483 566 this.close();
484 567 })
485 568 .catch(error => {
... ... @@ -490,7 +573,7 @@ export default {
490 573 },
491 574 mounted() {
492 575 this.token = this.$store.state.token;
493   - this.getFeeTypeList();
  576 + this.getBookData();
494 577 },
495 578 created() {
496 579 this.$root.$on("app:search", search => {
... ...
src/pages/Library/eBook.vue
... ... @@ -155,8 +155,8 @@
155 155  
156 156 <!-- ****** PROFILE VIEW ALL NEWS DEATILS ****** -->
157 157  
158   - <v-dialog v-model="dialog1" max-width="800px">
159   - <v-card>
  158 + <v-dialog v-model="dialog1" max-width="800px" scrollable>
  159 + <v-card style="height: 700px;">
160 160 <v-toolbar color="grey lighten-2" flat>
161 161 <v-spacer></v-spacer>
162 162 <v-toolbar-title>
... ... @@ -165,70 +165,32 @@
165 165 <v-spacer></v-spacer>
166 166 <v-icon @click="close1">close</v-icon>
167 167 </v-toolbar>
168   - <v-flex align-center justify-center layout text-xs-center>
169   - <!-- <v-avatar size="50px" style="position:absolute; top:20px;">
170   - <img src="/static/icon/user.png">
171   - </v-avatar>-->
172   - <span v-for="(image,i) in editedItem.newsImageUrl" :key="i" class="mt-4 pa-2">
173   - <img :src="image.imageUrl" alt="eBooks" width="240" height="180" />
174   - </span>
175   - </v-flex>
176 168 <v-card-text>
177   - <v-container grid-list-md>
  169 + <v-container>
178 170 <v-layout wrap>
179   - <v-flex>
180   - <v-layout>
181   - <v-flex xs5 sm6>
182   - <h5 class="right my-1">
183   - <b>Title:</b>
184   - </h5>
185   - </v-flex>
186   - <v-flex sm6 xs8>
187   - <h5 class="my-1">{{ editedItem.title }}</h5>
188   - </v-flex>
189   - </v-layout>
190   - <v-layout>
191   - <v-flex xs5 sm6>
192   - <h5 class="right my-1">
193   - <b>Description:</b>
194   - </h5>
195   - </v-flex>
196   - <v-flex sm6 xs8>
197   - <h5 class="my-1">{{ editedItem.description }}</h5>
198   - </v-flex>
199   - </v-layout>
  171 + <v-flex sm12 xs12>
  172 + <iframe :src="editedItem.fileUrl" height="600" width="100%"></iframe>
200 173 </v-flex>
201 174 </v-layout>
202 175 </v-container>
203 176 </v-card-text>
204 177 </v-card>
205 178 </v-dialog>
206   -
207   - <v-snackbar
208   - :timeout="timeout"
209   - :top="y === 'top'"
210   - :right="x === 'right'"
211   - :vertical="mode === 'vertical'"
212   - v-model="snackbar"
213   - color="success"
214   - >{{ text }}</v-snackbar>
215   -
216 179 <!-- ****** EXISTING-USERS NEWS TABLE ****** -->
217 180 <v-data-table
218 181 :headers="headers"
219   - :items="desserts"
  182 + :items="eBookData"
220 183 :pagination.sync="pagination"
221 184 :search="search"
222 185 >
223 186 <template slot="items" slot-scope="props">
224 187 <td class="text-xs-center">{{ props.index + 1}}</td>
225 188 <td id="td" class="text-xs-center">
226   - <span v-for="(image,_id) in props.item.newsImageUrl" class="pa-2">
227   - <img :src="image.imageUrl" alt="newsImage" width="100" height="70" />
228   - </span>
  189 + <img :src="props.item.fileUrl" alt="newsImage" width="100" height="70" />
229 190 </td>
230   - <td id="td" class="text-xs-center">{{ props.item.title}}</td>
231   - <td id="td" class="text-xs-center">{{ props.item.description}}</td>
  191 + <td id="td" class="text-xs-center">{{ props.item.name}}</td>
  192 + <td id="td" class="text-xs-center">{{ props.item.author}}</td>
  193 + <td id="td" class="text-xs-center">{{ props.item.classId}}</td>
232 194  
233 195 <td class="text-xs-center">
234 196 <span>
... ... @@ -288,12 +250,11 @@
288 250 style="display: none"
289 251 ref="image"
290 252 accept="image/*"
291   - multiple
292   - @change="onFilePicked"
  253 + @change="onImagePicked"
293 254 />
294 255 <v-layout justify-center>
295   - <v-flex v-for="(file,index) in files" :key="index" v-if="files">
296   - <img :src="file" height="160" width="160px;" />
  256 + <v-flex v-if="files">
  257 + <img :src="files" height="160" width="160px;" />
297 258 </v-flex>
298 259 </v-layout>
299 260 <img
... ... @@ -345,52 +306,62 @@
345 306 </v-flex>
346 307 <v-flex xs4 class="ml-3">
347 308 <v-select
348   - v-model="addEBooks.class"
  309 + v-model="addEBooks.classId"
349 310 :items="addClass"
350 311 label="Select Class"
351   - name="name"
352   - type="text"
  312 + item-text="classNum"
  313 + item-value="_id"
353 314 :rules="titleRules"
354 315 required
355 316 ></v-select>
356 317 </v-flex>
357 318 </v-layout>
358 319 </v-flex>
359   - <!-- <v-flex xs12>
  320 + <v-flex xs12>
360 321 <v-layout>
361 322 <v-flex xs4 class="pt-4 subheading">
362   - <label class="right">Private:</label>
  323 + <label class="right">Upload Image:</label>
363 324 </v-flex>
364 325 <v-flex xs4 class="ml-3">
365 326 <v-text-field
366   - v-model="addEBooks.private"
367   - placeholder="fill your Private Name"
368   - name="name"
369   - type="text"
370   - :rules="titleRules"
371   - required
  327 + label="Select Image"
  328 + @click="pickImage"
  329 + v-model="imageName"
  330 + append-icon="attach_file"
  331 + multiple
372 332 ></v-text-field>
373 333 </v-flex>
374 334 </v-layout>
375   - </v-flex> -->
  335 + </v-flex>
376 336 <v-flex xs12>
377 337 <v-layout>
378 338 <v-flex xs4 class="pt-4 subheading">
379   - <label class="right">Uplaod Image:</label>
  339 + <label class="right">Upload File:</label>
380 340 </v-flex>
381 341 <v-flex xs4 class="ml-3">
  342 + <input type="file" style="display: none" ref="file" @change="onFilePicked" />
382 343 <v-text-field
383 344 label="Select Image"
384 345 @click="pickFile"
385   - v-model="imageName"
  346 + v-model="fileName"
386 347 append-icon="attach_file"
387 348 multiple
388 349 ></v-text-field>
389 350 </v-flex>
390 351 </v-layout>
391 352 </v-flex>
  353 + <v-flex xs12>
  354 + <v-layout>
  355 + <v-flex xs4 class="pt-3 subheading">
  356 + <label class="right">Private:</label>
  357 + </v-flex>
  358 + <v-flex xs4 class="ml-3">
  359 + <v-checkbox v-model="addEBooks.private"></v-checkbox>
  360 + </v-flex>
  361 + </v-layout>
  362 + </v-flex>
392 363 <v-layout>
393   - <v-flex xs12 sm6 offset-sm3>
  364 + <v-flex xs12 sm7 offset-sm2>
394 365 <v-card-actions>
395 366 <v-btn @click="clear" round dark>clear</v-btn>
396 367 <v-spacer></v-spacer>
... ... @@ -432,18 +403,20 @@ export default {
432 403 valid: true,
433 404 isActive: true,
434 405 newActive: false,
435   - addclass: [],
  406 + addClass: [],
436 407 addSection: [],
437 408 AddUsercredentials: {},
438 409 pagination: {
439 410 rowsPerPage: 15
440 411 },
441 412 imageName: "",
  413 + fileName: "",
442 414 imageUrl: "",
443 415 imageFile: "",
444 416 image: [],
445 417 upload: "",
446   - files: [],
  418 + files: "",
  419 + anyFile: "",
447 420 titleRules: [v => !!v || " Tilte is required"],
448 421 descriptionRules: [v => !!v || " Description is required"],
449 422 headers: [
... ... @@ -453,20 +426,24 @@ export default {
453 426 sortable: false,
454 427 value: "No"
455 428 },
456   - { text: "Image", vaue: "image", sortable: false, align: "center" },
457   - { text: "Title", value: "title", sortable: false, align: "center" },
  429 + { text: "Photo", vaue: "fileUrl", sortable: false, align: "center" },
  430 + { text: "Name", vaue: "name", sortable: false, align: "center" },
  431 + { text: "Author", value: "author", sortable: false, align: "center" },
458 432 {
459   - text: "Description",
460   - value: "description",
  433 + text: "Class",
  434 + value: "classId",
461 435 sortable: false,
462 436 align: "center"
463 437 },
464 438 { text: "Action", value: "", sortable: false, align: "center" }
465 439 ],
466   - desserts: [],
  440 + eBookData: [],
467 441 editedIndex: -1,
468   - addEBooks: {},
469   - editedItem: {}
  442 + addEBooks: {
  443 + private: false
  444 + },
  445 + editedItem: {},
  446 + token: ""
470 447 }),
471 448 methods: {
472 449 getSections(_id) {
... ... @@ -489,10 +466,13 @@ export default {
489 466 // this.$router.replace({ path: '/' });
490 467 });
491 468 },
492   - pickFile() {
  469 + pickImage() {
493 470 this.$refs.image.click();
494 471 },
495   - onFilePicked(e) {
  472 + pickFile() {
  473 + this.$refs.file.click();
  474 + },
  475 + onImagePicked(e) {
496 476 // console.log(e)
497 477 const files = e.target.files;
498 478 /** fetch Image Name **/
... ... @@ -501,66 +481,69 @@ export default {
501 481 if (this.imageName.lastIndexOf(".") <= 0) {
502 482 return;
503 483 }
504   - this.files = [];
505   - // console.log("files", this.files);
506 484 /** Select many image and showing many image add to news card **/
507   - const test = Array.from(files).forEach((file, idx) => {
508   - const fr = new FileReader();
509   - const getResult = new Promise(resolve => {
510   - fr.onload = e => {
511   - this.files.push(
512   - // id: idx,
513   - e.target.result
514   - );
515   - };
516   - });
517   - fr.readAsDataURL(file);
518   - return getResult.then(file => {
519   - return file;
520   - });
521   - });
522 485 const fr = new FileReader();
523 486 fr.readAsDataURL(files[0]);
524 487 fr.addEventListener("load", () => {
525   - this.imageFile = files; // this is an image file that can be sent to server...
526   - // console.log("uploadImage=======>", this.imageFile );
  488 + this.files = fr.result;
  489 + console.log("uploadImagethis.files=======>", this.files);
527 490 });
528 491 } else {
529 492 this.imageName = "";
530 493 this.imageFile = "";
  494 + this.files = "";
531 495 this.imageUrl = "";
532 496 }
533 497 },
534   - getNewsList() {
  498 + getBooksList() {
535 499 this.showLoader = true;
536   - var token = this.$store.state.token;
537 500 http()
538   - .get("/getNewsList", {
539   - headers: { Authorization: "Bearer " + token }
  501 + .get("/getEBooksList", {
  502 + headers: { Authorization: "Bearer " + this.token }
540 503 })
541 504 .then(response => {
542   - this.desserts = response.data.data;
  505 + this.eBookData = response.data.data;
543 506 this.showLoader = false;
544   - // console.log("getNewsList=====>",this.desserts)
  507 + console.log("getNewsList=====>", response.data.data);
545 508 })
546 509 .catch(err => {
547 510 // console.log("err====>", err);
548 511 this.showLoader = false;
549   - if (error.response.status === 401) {
550   - this.$router.replace({ path: "/" });
551   - this.$store.dispatch("setToken", null);
552   - this.$store.dispatch("Id", null);
553   - }
  512 + // if (error.response.status === 401) {
  513 + // this.$router.replace({ path: "/" });
  514 + // this.$store.dispatch("setToken", null);
  515 + // this.$store.dispatch("Id", null);
  516 + // }
  517 + });
  518 + },
  519 + onFilePicked(e) {
  520 + // console.log(e)
  521 + const files = e.target.files;
  522 + /** fetch Image Name **/
  523 + if (files[0] !== undefined) {
  524 + this.fileName = files[0].name;
  525 + if (this.fileName.lastIndexOf(".") <= 0) {
  526 + return;
  527 + }
  528 + const fr = new FileReader();
  529 + fr.readAsDataURL(files[0]);
  530 + fr.addEventListener("load", () => {
  531 + this.anyFile = fr.result;
  532 + // console.log(" this.anyFile Url", this.anyFile )
554 533 });
  534 + } else {
  535 + this.anyFile = "";
  536 + this.fileName = "";
  537 + }
555 538 },
556 539 editItem(item) {
557 540 this.files = [];
558   - this.editedIndex = this.desserts.indexOf(item);
  541 + this.editedIndex = this.eBookData.indexOf(item);
559 542 this.editedItem = Object.assign({}, item);
560 543 this.dialog = true;
561 544 },
562 545 profile(item) {
563   - this.editedIndex = this.desserts.indexOf(item);
  546 + this.editedIndex = this.eBookData.indexOf(item);
564 547 this.editedItem = Object.assign({}, item);
565 548 this.dialog1 = true;
566 549 },
... ... @@ -632,28 +615,24 @@ export default {
632 615 submit() {
633 616 this.loading = true;
634 617 if (this.$refs.form.validate()) {
635   - let newsData = {
636   - title: this.addNews.title,
637   - description: this.addNews.description
638   - };
639 618 if (this.files) {
640   - var ary = [];
641   - var imageData = [];
642   - ary = this.files;
643   - for (let i = 0; i < ary.length; i++) {
644   - const [baseUrl, imageUrl] = ary[i].split(/,/);
645   - imageData.push(imageUrl);
646   - newsData.upload = imageData;
647   - }
  619 + const [baseUrl, imageUrl] = this.files.split(/,/);
  620 + this.addEBooks.uploadCover = imageUrl;
  621 + // console.log("anyFile.split(/,/)", this.addEBooks.uploadCover);
  622 + }
  623 + if (this.anyFile) {
  624 + const [baseUrl, fileUrl] = this.anyFile.split(/,/);
  625 + this.addEBooks.uploadFile = fileUrl;
  626 + // console.log("anyFile.split(/,/)", this.addEBooks.uploadFile);
648 627 }
649 628 http()
650   - .post("/createNews", newsData)
  629 + .post("/createEBook", this.addEBooks)
651 630 .then(response => {
652   - console.log(newsData);
653 631 if ((this.snackbar = true)) {
654   - this.text = "New News added successfully";
  632 + this.text = "New E-Book added successfully";
655 633 }
656   - this.getNewsList();
  634 + this.addEBooks.uploadCover = "";
  635 + // this.getNewsList();
657 636 this.loading = false;
658 637 this.clear();
659 638 })
... ... @@ -668,11 +647,6 @@ export default {
668 647 this.$refs.form.reset();
669 648 },
670 649 save() {
671   - let editNews = {
672   - title: this.editedItem.title,
673   - description: this.editedItem.description,
674   - newsId: this.editedItem._id
675   - };
676 650 if (this.files) {
677 651 var ary = [];
678 652 var imageData = [];
... ... @@ -680,9 +654,13 @@ export default {
680 654 for (let i = 0; i < ary.length; i++) {
681 655 const [baseUrl, imageUrl] = ary[i].split(/,/);
682 656 imageData.push(imageUrl);
683   - editNews.upload = imageData;
  657 + this.editedItem.uploadCover = imageData;
684 658 }
685 659 }
  660 + if (this.anyFile) {
  661 + const [baseUrl, fileUrl] = this.anyFile.split(/,/);
  662 + console.log("anyFile.split(/,/)", fileUrl);
  663 + }
686 664 http()
687 665 .put("/updateNews", editNews)
688 666 .then(response => {
... ... @@ -696,11 +674,26 @@ export default {
696 674 .catch(error => {
697 675 // console.log(error);
698 676 });
  677 + },
  678 + getAllClass() {
  679 + http()
  680 + .get("/getClassesList", {
  681 + headers: { Authorization: "Bearer " + this.token }
  682 + })
  683 + .then(response => {
  684 + this.addClass = response.data.data;
  685 + })
  686 + .catch(err => {
  687 + // console.log("err====>", err);
  688 + // this.$router.replace({ path: "/" });
  689 + });
699 690 }
700 691 },
701 692 mounted() {
702   - this.getNewsList();
703   - this.editItem;
  693 + this.token = this.$store.state.token;
  694 + this.getBooksList();
  695 + this.getAllClass();
  696 + // this.editItem;
704 697 },
705 698 created() {
706 699 this.$root.$on("app:search", search => {
... ...
src/pages/Library/member.vue
... ... @@ -8,7 +8,52 @@
8 8 v-model="snackbar"
9 9 color="success"
10 10 >{{ text }}</v-snackbar>
11   -
  11 + <!-- Add Library Dialog -->
  12 + <v-dialog v-model="addLibrary" max-width="600px">
  13 + <v-toolbar color="grey lighten-2">
  14 + <v-spacer></v-spacer>
  15 + <v-toolbar-title>
  16 + <h3>Library Member</h3>
  17 + </v-toolbar-title>
  18 + <v-spacer></v-spacer>
  19 + </v-toolbar>
  20 + <v-card>
  21 + <v-card-text>
  22 + <v-container>
  23 + <v-layout wrap justify-center>
  24 + <v-flex xs12 sm9>
  25 + <v-form>
  26 + <v-layout>
  27 + <v-flex xs4 class="pt-4 subheading">
  28 + <label class="right pr-3">Library Id:</label>
  29 + </v-flex>
  30 + <v-flex xs8>
  31 + <v-text-field v-model="addBook.libraryId" placeholder="fill your Library ID"></v-text-field>
  32 + </v-flex>
  33 + </v-layout>
  34 + <v-layout>
  35 + <v-flex xs4 class="pt-4 subheading">
  36 + <label class="right pr-3">Library Fee:</label>
  37 + </v-flex>
  38 + <v-flex xs8>
  39 + <v-text-field
  40 + v-model="addBook.libraryFee"
  41 + placeholder="fill your Library Fee"
  42 + ></v-text-field>
  43 + </v-flex>
  44 + </v-layout>
  45 + <v-card-actions>
  46 + <v-btn round dark @click.native="close">Cancel</v-btn>
  47 + <v-spacer></v-spacer>
  48 + <v-btn round dark @click="submit">Add Member</v-btn>
  49 + </v-card-actions>
  50 + </v-form>
  51 + </v-flex>
  52 + </v-layout>
  53 + </v-container>
  54 + </v-card-text>
  55 + </v-card>
  56 + </v-dialog>
12 57 <!-- ****** EXISTING MEMBER TABLE ****** -->
13 58 <v-card flat>
14 59 <v-card-actions>
... ... @@ -25,11 +70,11 @@
25 70 small
26 71 :items="addclass"
27 72 label="Select Class"
28   - v-model="selectStudents.select"
  73 + v-model="selectStudents"
29 74 item-text="classNum"
30 75 item-value="_id"
31 76 name="Select Class"
32   - @change="getSections(selectStudents.select)"
  77 + @change="getAllStudents(selectStudents)"
33 78 class="px-2"
34 79 required
35 80 ></v-select>
... ... @@ -38,12 +83,12 @@
38 83 </v-card>
39 84 <v-data-table
40 85 :headers="headers"
41   - :items="desserts"
  86 + :items="studentData"
42 87 :pagination.sync="pagination"
43 88 :search="search"
44 89 >
45 90 <template slot="items" slot-scope="props">
46   - <td id="td" class="text-xs-center">{{ props.item.rollNo}}</td>
  91 + <td id="td" class="text-xs-center">{{ props.index}}</td>
47 92 <td id="td" class="text-xs-center">
48 93 <v-avatar>
49 94 <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" />
... ... @@ -51,15 +96,22 @@
51 96 </v-avatar>
52 97 </td>
53 98 <td id="td" class="text-xs-center">{{ props.item.name}}</td>
  99 + <td id="td" class="text-xs-center">{{ props.item.rollNo }}</td>
54 100 <td id="td" class="text-xs-center">{{ props.item.email }}</td>
55   - <td id="td" class="text-xs-center">{{ dates(props.item.dob) }}</td>
56   - <td id="td" class="text-xs-center">{{ props.item.gender }}</td>
57   - <td id="td" class="text-xs-center">{{ props.item.parentId.fatherName }}</td>
58   - <td id="td" class="text-xs-center">{{ props.item.parentId.motherName }}</td>
59   - <td id="td" class="text-xs-center">{{ props.item.establishmentYear }}</td>
60   - <td id="td" class="text-xs-center">{{ props.item.mobile}}</td>
  101 + <!-- <td id="td" class="text-xs-center">{{ dates(props.item.dob) }}</td> -->
  102 + <!-- <td id="td" class="text-xs-center">{{ props.item.gender }}</td> -->
  103 + <!-- <td id="td" class="text-xs-center">{{ props.item.parentId.fatherName }}</td> -->
  104 + <!-- <td id="td" class="text-xs-center">{{ props.item.parentId.motherName }}</td> -->
  105 + <!-- <td id="td" class="text-xs-center">{{ props.item.establishmentYear }}</td> -->
  106 + <!-- <td id="td" class="text-xs-center">{{ props.item.mobile}}</td> -->
61 107  
62 108 <td class="text-xs-center">
  109 + <img
  110 + style="cursor:pointer; width:25px; height:18px; "
  111 + class="mr-5"
  112 + @click="addLibrary = true"
  113 + src="/static/icon/add.png"
  114 + />
63 115 <span>
64 116 <img
65 117 style="cursor:pointer; width:25px; height:18px; "
... ... @@ -110,22 +162,23 @@ export default {
110 162 text: "",
111 163 showLoader: false,
112 164 loading: false,
  165 + addLibrary: false,
113 166 date: null,
114 167 search: "",
115 168 addclass: [],
116 169 pagination: {
117 170 rowsPerPage: 15
118 171 },
119   - imageData: {},
  172 + addBook: {},
120 173 imageName: "",
121 174 imageUrl: "",
122 175 imageFile: "",
123 176 headers: [
124 177 {
125   - text: "Roll No.",
  178 + text: "No",
126 179 align: "center",
127 180 sortable: false,
128   - value: "rollNo"
  181 + value: "index"
129 182 },
130 183 {
131 184 text: "Profile Pic",
... ... @@ -138,53 +191,28 @@ export default {
138 191 { text: "Email", value: "email", sortable: false, align: "center" },
139 192 { text: "Action", value: "", sortable: false, align: "center" }
140 193 ],
141   - desserts: [],
  194 + studentData: [],
142 195 parentId: "",
143 196 token: "",
144   - selectStudents: {
145   - select: "",
146   - selectSection: ""
147   - }
  197 + selectStudents: {}
148 198 }),
149 199 methods: {
150   - // findStudents() {
151   - // this.showLoader = true;
152   - // http()
153   - // .get("/getStudentWithClass", {
154   - // params: {
155   - // classId: this.selectStudents.select,
156   - // sectionId: this.selectStudents.selectSection
157   - // }
158   - // })
159   - // .then(response => {
160   - // this.desserts = response.data.data;
161   - // this.showLoader = false;
162   - // console.log("getSectionsList=====>", this.addSection);
163   - // })
164   - // .catch(err => {
165   - // console.log("err====>", err);
166   - // this.showLoader = false;
167   - // });
168   - // },
169   - // getSections(_id) {
170   - // var token = this.$store.state.token;
171   - // http()
172   - // .get(
173   - // "/getSectionsList",
174   - // { params: { classId: _id } },
175   - // {
176   - // headers: { Authorization: "Bearer " + token }
177   - // }
178   - // )
179   - // .then(response => {
180   - // this.addSection = response.data.data;
181   - // console.log("getSectionsList=====>", this.addSection);
182   - // })
183   - // .catch(err => {
184   - // // console.log("err====>", err);
185   - // // this.$router.replace({ path: '/' });
186   - // });
187   - // },
  200 + getAllStudents() {
  201 + this.showLoader = true;
  202 + http()
  203 + .get("/getStudentsList", {
  204 + params: { classId: this.selectStudents },
  205 + headers: { Authorization: "Bearer " + this.token }
  206 + })
  207 + .then(response => {
  208 + this.studentData = response.data.data;
  209 + this.showLoader = false;
  210 + })
  211 + .catch(err => {
  212 + // console.log("err====>", err);
  213 + // this.$router.replace({ path: "/" });
  214 + });
  215 + },
188 216 // getSection(_id) {
189 217 // var token = this.$store.state.token;
190 218 // http()
... ... @@ -322,58 +350,29 @@ export default {
322 350 // close1() {
323 351 // this.dialog1 = false;
324 352 // },
325   - // submit() {
326   - // if (this.$refs.form.validate()) {
327   - // let addStudent = {
328   - // parentId: this.parentId,
329   - // name: this.addStudents.name,
330   - // email: this.addStudents.email,
331   - // role: this.addStudents.role,
332   - // dob: this.addStudents.date,
333   - // city: this.addStudents.city,
334   - // pincode: this.addStudents.pincode,
335   - // country: this.addStudents.country,
336   - // permanentAddress: this.addStudents.permanentAddress,
337   - // presentAddress: this.addStudents.presentAddress,
338   - // mobile: this.addStudents.mobile,
339   - // state: this.addStudents.state,
340   - // gender: this.addStudents.gender,
341   - // establishmentYear: this.addStudents.establishmentYear,
342   - // classId: this.addStudents.select,
343   - // sectionId: this.addStudents.selectSection,
344   - // bloodGroup: this.addStudents.bloodGroup,
345   - // allergies: this.addStudents.allergies,
346   - // medicalNotes: this.addStudents.medicalNotes,
347   - // height: this.addStudents.height,
348   - // weight: this.addStudents.weight,
349   - // rollNo: this.addStudents.rollNo
350   - // };
351   - // if (this.imageUrl) {
352   - // var str = this.imageUrl;
353   - // const [baseUrl, imageUrl] = str.split(/,/);
354   - // addStudent.upload = imageUrl;
355   - // }
356   - // this.loading = true;
357   - // http()
358   - // .post("/createStudent", addStudent)
359   - // .then(response => {
360   - // console.log(addStudent);
361   - // if ((this.snackbar = true)) {
362   - // this.text = "New Student added successfully";
363   - // }
364   - // // this.getStudentList();
365   - // this.clear();
366   - // this.loading = false;
367   - // })
368   - // .catch(error => {
369   - // // console.log(error);
370   - // if ((this.snackbar = true)) {
371   - // this.text = error.response.data.message;
372   - // }
373   - // this.loading = false;
374   - // });
375   - // }
376   - // },
  353 + submit() {
  354 + if (this.$refs.form.validate()) {
  355 + this.loading = true;
  356 + http()
  357 + .post("/addBook", this.addBook)
  358 + .then(response => {
  359 + // console.log(addStudent);
  360 + // if ((this.snackbar = true)) {
  361 + // this.text = "New Student added successfully";
  362 + // }
  363 + // this.getStudentList();
  364 + this.clear();
  365 + this.loading = false;
  366 + })
  367 + .catch(error => {
  368 + // console.log(error);
  369 + if ((this.snackbar = true)) {
  370 + this.text = error.response.data.message;
  371 + }
  372 + this.loading = false;
  373 + });
  374 + }
  375 + },
377 376 // clear() {
378 377 // this.$refs.form.reset();
379 378 // },
... ...