Commit 79006bdcb182b0fd7cc46cfa3ffbd793408c68bd

Authored by Neeraj Sharma
1 parent 7235931554

uplaod images all cetageory & implement design

... ... @@ -40,6 +40,7 @@ import AppDrawer from '@/components/pageHeader/AppDrawer';
40 40 import AppToolbar from '@/components/pageHeader/AppToolbar';
41 41 import menu from '@/api/menu';
42 42 import AppEvents from './event';
  43 +
43 44 export default {
44 45 components: {
45 46 AppDrawer,
... ...
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.2.221:3002/v1',
  6 + // baseURL:'http://192.168.4.220:3002/v1',
7 7 baseURL:'http://139.59.58.160:8001/v1',
8 8 headers: {
9 9 Authorization: `Bearer ${store.state.token}`
... ...
src/pages/Class/addclass.vue
... ... @@ -211,12 +211,7 @@
211 211 <v-card flat>
212 212 <v-container fluid fill-height>
213 213 <v-layout align-center>
214   - <v-flex xs12>
215   - <v-flex offset-xs5>
216   - <v-avatar size="55px">
217   - <img src="/static/icon/user.png">
218   - </v-avatar>
219   - </v-flex>
  214 + <v-flex xs12 class="mt-4">
220 215 <v-form ref="form" v-model="valid" lazy-validation>
221 216 <v-layout>
222 217 <v-flex xs4 class="pt-4 subheading">
... ... @@ -236,9 +231,9 @@
236 231 <v-layout>
237 232 <v-flex xs12 sm9 offset-sm2>
238 233 <v-card-actions>
239   - <v-btn @click="clear" round dark>clear</v-btn>
240 234 <v-spacer></v-spacer>
241 235 <v-btn @click="submit" round dark :loading="loading">Add</v-btn>
  236 + <v-spacer></v-spacer>
242 237 </v-card-actions>
243 238 </v-flex>
244 239 </v-layout>
... ...
src/pages/News/news.vue
... ... @@ -73,83 +73,42 @@
73 73 v-model="snackbar"
74 74 color="success"
75 75 >{{ text }}</v-snackbar>
76   - <v-dialog v-model="dialog" max-width="1000px">
77   - <v-flex xs12 sm12>
78   - <v-toolbar class="grey lighten-2">
  76 + <v-dialog v-model="dialog" max-width="1000px" scrollable>
  77 + <v-card flat>
  78 + <v-toolbar class="grey lighten-2" flat>
79 79 <v-spacer></v-spacer>
80 80 <v-toolbar-title > <h3>Edit News</h3></v-toolbar-title>
81 81 <v-spacer></v-spacer>
82   - </v-toolbar>
83   - <v-card flat>
  82 + </v-toolbar>
  83 + <v-card-text style="height:600px;">
84 84 <v-form ref="form">
85 85 <v-container fluid>
86   - <v-layout>
87   - <!-- <v-flex
  86 + <v-layout row>
  87 + <v-flex
88 88 xs12
89   - class="text-xs-center text-sm-center text-md-center text-lg-center mr-4"
  89 + class="text-xs-center text-sm-center text-md-center text-lg-center my-4 mr-4"
90 90 >
91   - <v-avatar size="150px">
92   - <img src="/static/icon/user.png" v-if="!editedItem.newsImageUrl">
93   - <span v-for = "image in editedItem.newsImageUrl">
94   - <img :src="image" alt="newsImage" v-if="editedItem.newsImageUrl">
95   - </span>
96   - </v-avatar> -->
97 91 <input
98   - type = "file"
99   - style="display: none"
  92 + type="file"
  93 + style = "display: none"
100 94 ref="image"
101 95 accept="image/*"
  96 + multiple
102 97 @change="onFilePicked"
103 98 >
104   - <v-flex align-center justify-center layout text-xs-center >
105   - <!-- <v-avatar size="50px" style="position:absolute; top:20px;">
106   - <img src="/static/icon/user.png">
107   - </v-avatar> -->
108   - <span v-for = "image in editedItem.newsImageUrl" class="mt-4 pa-2">
109   - <img :src="image" alt="News" width="240" height="180">
110   - </span>
111   - </v-flex>
112   - <!-- </v-flex> -->
113   - </v-layout>
114   - <v-layout>
115   - <v-flex xs12 sm12>
116   - <v-layout>
117   - <v-flex xs4 class="pt-4 subheading">
118   - <label class="right">Select Class:</label>
119   - </v-flex>
120   - <v-flex xs5 class="ml-3">
121   - <v-select
122   - :items="addclass"
123   - label="Select Class"
124   - v-model="editedItem.select"
125   - item-text="classNum"
126   - item-value="_id"
127   - name="Select Class"
128   - @change="getSections(editedItem.select)"
129   - required
130   - ></v-select>
131   - </v-flex>
132   - </v-layout>
133   - </v-flex>
134   - <v-flex xs12 sm12>
135   - <v-layout>
136   - <v-flex xs4 class="pt-4 subheading">
137   - <label class="right">Select Section:</label>
138   - </v-flex>
139   - <v-flex xs5 class="ml-3">
140   - <v-select
141   - :items="addSection"
142   - label="Select Section"
143   - v-model="editedItem.selectSection"
144   - item-text="name"
145   - item-value="_id"
146   - name="Select Section"
147   - required
148   - ></v-select>
149   - </v-flex>
150   - </v-layout>
  99 + <v-layout justify-center>
  100 + <v-flex xs3 v-for="image in editedItem.newsImageUrl" :key="image" v-if="editedItem.newsImageUrl" class="profile-image-wrapper">
  101 + <img :src="image.imageUrl" height="160" width="160" alt="News" class="pa-2">
  102 + <v-icon class="red edit-profile-icon" dark @click="deleteImage(image._id,editedItem._id)">close</v-icon>
  103 + </v-flex>
  104 + <v-flex v-for="(file, index) in files" :key="index" v-if="files" v-else-if="editedItem.newsImageUrl">
  105 + <img :src="file" height="160" width="160" class="pa-2">
  106 + </v-flex>
  107 + </v-layout>
  108 + <img src="/static/icon/user.png" v-if="editedItem.newsImageUrl ==''" height="160" width="160" alt="News">
151 109 </v-flex>
152 110 </v-layout>
  111 + <!-- </v-layout> -->
153 112 <v-layout>
154 113 <v-flex xs12 sm12>
155 114 <v-layout>
... ... @@ -186,7 +145,7 @@
186 145 <v-flex xs12>
187 146 <v-layout>
188 147 <v-flex xs4 class="pt-4 subheading">
189   - <label class="right">Uplaod Image:</label>
  148 + <label class="right">Add New Images:</label>
190 149 </v-flex>
191 150 <v-flex xs5 class="ml-3">
192 151 <v-text-field
... ... @@ -211,26 +170,26 @@
211 170 </v-layout>
212 171 </v-container>
213 172 </v-form>
  173 + </v-card-text>
214 174 </v-card>
215   - </v-flex>
216 175 </v-dialog>
217 176  
218 177 <!-- ****** PROFILE VIEW ALL NEWS DEATILS ****** -->
219 178  
220 179 <v-dialog v-model="dialog1" max-width="800px">
221   - <v-toolbar color="grey lighten-2">
  180 + <v-card>
  181 + <v-toolbar color="grey lighten-2" flat>
222 182 <v-spacer></v-spacer>
223 183 <v-toolbar-title><h3>News</h3></v-toolbar-title>
224 184 <v-spacer></v-spacer>
225 185 <v-icon @click="close1">close</v-icon>
226   - </v-toolbar>
227   - <v-card>
  186 + </v-toolbar>
228 187 <v-flex align-center justify-center layout text-xs-center >
229 188 <!-- <v-avatar size="50px" style="position:absolute; top:20px;">
230 189 <img src="/static/icon/user.png">
231 190 </v-avatar> -->
232   - <span v-for = "image in editedItem.newsImageUrl" class="mt-4 pa-2">
233   - <img :src="image" alt="News" width="240" height="180">
  191 + <span v-for="(image,id) in editedItem.newsImageUrl" :key="id" class="mt-4 pa-2">
  192 + <img :src="image.imageUrl" alt="News" width="240" height="180">
234 193 </span>
235 194 </v-flex>
236 195 <v-card-text>
... ... @@ -280,9 +239,7 @@
280 239 <td class="text-xs-center">{{ props.index}}</td>
281 240 <td id="td"class="text-xs-center">
282 241 <span v-for = "image in props.item.newsImageUrl" class="pa-2">
283   - <!-- <v-avatar size = "70"> -->
284   - <img :src="image" alt="newsImage" width="100" height="70">
285   - <!-- </v-avatar> -->
  242 + <img :src="image.imageUrl" alt="newsImage" width="100" height="70">
286 243 </span>
287 244 </td>
288 245 <td id="td" class="text-xs-center">{{ props.item.title}}</td>
... ... @@ -338,7 +295,7 @@
338 295 <v-container fluid>
339 296 <v-layout>
340 297 <v-flex
341   - xs6 offset-sm3
  298 + xs12
342 299 class="text-xs-center text-sm-center text-md-center text-lg-center my-4 mr-4"
343 300 >
344 301 <input
... ... @@ -349,13 +306,12 @@
349 306 multiple
350 307 @change="onFilePicked"
351 308 >
352   - <v-layout>
353   - <v-flex v-for="(file, index) in files" :key="index">
354   - <v-avatar size="140">
355   - <img :src = "file.url" height="200" width="320px;">
356   - </v-avatar>
  309 + <v-layout justify-center>
  310 + <v-flex v-for="(file, index) in files" :key="index" v-if="files">
  311 + <img :src="file" height="160" width="160px;">
357 312 </v-flex>
358 313 </v-layout>
  314 + <img src="/static/icon/user.png" v-if="files ==''" height="140" width="180px;">
359 315 </v-flex>
360 316 </v-layout>
361 317 <v-flex xs12>
... ... @@ -549,16 +505,16 @@ export default {
549 505 return;
550 506 }
551 507 this.files = [];
552   - console.log("files", this.files);
  508 + // console.log("files", this.files);
553 509 /** Select many image and showing many image add to news card **/
554 510 const test = Array.from(files).forEach((file, idx) => {
555 511 const fr = new FileReader();
556 512 const getResult = new Promise(resolve => {
557 513 fr.onload = e => {
558   - this.files.push({
559   - id: idx,
560   - url: e.target.result
561   - });
  514 + this.files.push(
  515 + // id: idx,
  516 + e.target.result
  517 + );
562 518 };
563 519 });
564 520 fr.readAsDataURL(file);
... ... @@ -570,7 +526,7 @@ export default {
570 526 fr.readAsDataURL(files[0]);
571 527 fr.addEventListener("load", () => {
572 528 this.imageFile = files; // this is an image file that can be sent to server...
573   - console.log("uploadImage=======>", this.imageFile );
  529 + // console.log("uploadImage=======>", this.imageFile );
574 530 });
575 531 } else {
576 532 this.imageName = "";
... ... @@ -628,6 +584,25 @@ export default {
628 584 // console.log(error);
629 585 });
630 586 },
  587 + deleteImage(imageId, newsId){
  588 + console.log(imageId, newsId)
  589 + let deleteImages = {
  590 + newsId: newsId,
  591 + imageId: imageId
  592 + };
  593 + http()
  594 + .put("/deleteImages", deleteImages)
  595 + .then(response => {
  596 + console.log("deleteNews",deleteImages)
  597 + if ((this.snackbar = true)) {
  598 + this.text = "Image deleted Successfully";
  599 + }
  600 + this.getNewsList();
  601 + })
  602 + .catch(error => {
  603 + console.log(error);
  604 + });
  605 + },
631 606 activeTab(type) {
632 607 switch (type) {
633 608 case "existing":
... ... @@ -655,15 +630,19 @@ export default {
655 630 console.log("===========>",this.image)
656 631 this.loading = true;
657 632 if (this.$refs.form.validate()) {
658   - let newsData = new FormData();
659   - for( var i = 0; i < this.imageFile.length; i++ ){
660   - let file = this.imageFile[i];
661   - newsData.append("upload", file );
  633 + // let newsData = new FormData();
  634 + // for( var i = 0; i < this.imageFile.length; i++ ){
  635 + // let file = this.imageFile[i];
  636 + // newsData.append("upload", file );
  637 + // }
  638 + // newsData.append("title",this.addNews.title);
  639 + // newsData.append("description",this.addNews.description);
  640 + // console.log("newsDataData",newsData);
  641 + let newsData ={
  642 + title:this.addNews.title,
  643 + description:this.addNews.description,
  644 + upload:this.files
662 645 }
663   - newsData.append("title",this.addNews.title);
664   - newsData.append("description",this.addNews.description);
665   - console.log("newsDataData",newsData);
666   -
667 646 http()
668 647 .post("/createNews", newsData)
669 648 .then(response => {
... ... @@ -688,13 +667,18 @@ export default {
688 667 this.$refs.form.reset();
689 668 },
690 669 save() {
691   - let newsData = new FormData();
692   - for( var i = 0; i < this.imageFile.length; i++ ){
693   - let file = this.imageFile[i];
694   - newsData.append("upload", file );
695   - }
696   - newsData.append("title",this.editedItem.title);
697   - newsData.append("description",this.editedItem.description);
  670 + // let imageData = new FormData();
  671 + // for( var i = 0; i < this.imageFile.length; i++ ){
  672 + // let file = this.imageFile[i];
  673 + // imageData.append("upload", file );
  674 + // }
  675 + // console.log(imageData)
  676 + let editNews = {
  677 + title:this.editedItem.title,
  678 + description:this.editedItem.description,
  679 + newsId:this.editedItem._id,
  680 + upload:this.files
  681 + }
698 682 http()
699 683 .put("/updateNews", editNews)
700 684 .then(response => {
... ... @@ -703,11 +687,11 @@ export default {
703 687 this.text = "Successfully Edit Existing News";
704 688 }
705 689 this.getNewsList();
  690 + this.close();
706 691 })
707 692 .catch(error => {
708 693 // console.log(error);
709 694 });
710   - this.close();
711 695 },
712 696 handleDrawerToggle() {
713 697 window.getApp.$emit("APP_DRAWER_TOGGLED");
... ... @@ -829,6 +813,23 @@ h4 {
829 813 .list{
830 814 padding: 0 0px !important;
831 815 }
  816 +.profile-image-wrapper {
  817 + position: relative;
  818 + }
  819 + .edit-profile-icon {
  820 + position: absolute;
  821 + right: 15px;
  822 + top: 15px;
  823 + cursor: pointer;
  824 + }
  825 + .profile-image-wrapper > .edit-profile-icon {
  826 + right: 10%;
  827 + top: 0%;
  828 + margin-top: 8px;
  829 + border-radius: 50%;
  830 + padding: 7px;
  831 + font-size: 20px;
  832 +}
832 833 @media screen and (max-width: 769px) {
833 834 .top {
834 835 margin-top: 0 !important;
... ...
src/pages/Section/section.vue
... ... @@ -240,12 +240,7 @@
240 240 <v-card flat>
241 241 <v-container fluid fill-height>
242 242 <v-layout align-center>
243   - <v-flex xs12>
244   - <v-flex offset-xs5>
245   - <v-avatar size="55px">
246   - <img src="/static/icon/user.png">
247   - </v-avatar>
248   - </v-flex>
  243 + <v-flex xs12 class="mt-4">
249 244 <v-form ref="form" v-model="valid" lazy-validation>
250 245 <v-layout>
251 246 <v-flex xs4 class="pt-4 subheading">
... ...
src/pages/Students/students.vue
... ... @@ -72,14 +72,14 @@
72 72 v-model="snackbar"
73 73 color="success"
74 74 >{{ text }}</v-snackbar>
75   - <v-dialog v-model="dialog" max-width="1300px">
76   - <v-flex xs12 sm12 class="">
77   - <v-toolbar color="grey lighten-2">
  75 + <v-dialog v-model="dialog" max-width="1300px" scrollable>
  76 + <v-card flat>
  77 + <v-toolbar color="grey lighten-2" flat>
78 78 <v-spacer></v-spacer>
79 79 <v-toolbar-title><h3>Edit Student Profile</h3></v-toolbar-title>
80 80 <v-spacer></v-spacer>
81 81 </v-toolbar>
82   - <v-card flat>
  82 + <v-card-text style="height: 800px;">
83 83 <v-form ref="form">
84 84 <v-container fluid>
85 85 <v-layout>
... ... @@ -87,8 +87,16 @@
87 87 xs12
88 88 class="text-xs-center text-sm-center text-md-center text-lg-center mr-4"
89 89 >
90   - <v-avatar size="100px">
91   - <img src="/static/icon/user.png" v-if="!imageUrl">
  90 + <v-avatar size="160px">
  91 + <img src="/static/icon/user.png" v-if="!editedItem.profilePicUrl">
  92 + <img :src="editedItem.profilePicUrl" v-else-if="editedItem.profilePicUrl && !imageUrl">
  93 + <img
  94 +
  95 + v-if="imageUrl"
  96 + :src="imageUrl"
  97 + height="150"
  98 + style="border-radius:50%; width:200px"
  99 + >
92 100 </v-avatar>
93 101 <input
94 102 type="file"
... ... @@ -97,12 +105,6 @@
97 105 accept="image/*"
98 106 @change="onFilePicked"
99 107 >
100   - <img
101   - :src="imageData.imageUrl"
102   - height="150"
103   - v-if="imageUrl"
104   - style="border-radius:50%; width:200px"
105   - >
106 108 </v-flex>
107 109 </v-layout>
108 110 <v-layout>
... ... @@ -391,7 +393,6 @@
391 393 </v-flex>
392 394 </v-layout>
393 395 </v-flex>
394   -
395 396 <v-flex xs12 sm4>
396 397 <v-layout>
397 398 <v-flex xs4 class="pt-4 subheading">
... ... @@ -402,7 +403,7 @@
402 403 label="Select Image"
403 404 @click="pickFile"
404 405 v-model="imageName"
405   - prepend-icon="attach_file"
  406 + append-icon="attach_file"
406 407 ></v-text-field>
407 408 </v-flex>
408 409 </v-layout>
... ... @@ -412,7 +413,7 @@
412 413 <v-flex xs4 class="pt-4 subheading">
413 414 <label class="right">Present Address:</label>
414 415 </v-flex>
415   - <v-flex xs8 class="ml-3">
  416 + <v-flex xs8 class="ml-2">
416 417 <v-text-field
417 418 v-model="editedItem.presentAddress"
418 419 placeholder="fill Your present Address"
... ... @@ -422,54 +423,57 @@
422 423 </v-layout>
423 424 </v-flex>
424 425 </v-layout>
  426 + <v-layout>
  427 + <v-flex xs12>
425 428 <v-layout>
426   - <v-flex xs3 class="pt-4 subheading">
427   - <label>Permanent Address:</label>
  429 + <v-flex xs1 class="pt-4 subheading" style="flex-basis: 13.333333% !important; max-width: 13.333333% !important;">
  430 + <label class="right">Permanent Address:</label>
428 431 </v-flex>
429   - <v-flex xs9>
430   - <v-text-field
431   - name="input-4-3"
  432 + <v-flex xs11 class="ml-2">
  433 + <v-textarea
  434 + rows="1"
432 435 v-model="editedItem.permanentAddress"
433 436 placeholder="fill Your Permanent Address"
434 437 required
435   - ></v-text-field>
  438 + ></v-textarea>
436 439 </v-flex>
437 440 </v-layout>
  441 + </v-flex>
  442 + </v-layout>
438 443 <v-layout>
439 444 <v-flex xs12 sm12>
440 445 <v-card-actions>
441 446 <v-btn round dark @click.native="close">Cancel</v-btn>
442 447 <v-spacer></v-spacer>
443 448 <v-btn round dark @click="save">Save</v-btn>
444   - </v-card-actions>
  449 + </v-card-actions>
445 450 </v-flex>
446   - </v-layout>
447   - </v-container>
448   - </v-form>
  451 + </v-layout>
  452 + </v-container>
  453 + </v-form>
  454 + </v-card-text>
449 455 </v-card>
450   - </v-flex>
451 456 </v-dialog>
452 457  
453 458 <!-- ****** PROFILE VIEW STUDENTS DEATILS ****** -->
454   - <v-dialog v-model="dialog1" max-width="600px">
455   - <v-toolbar color="grey lighten-2">
456   - <v-spacer></v-spacer>
457   - <v-toolbar-title>Student Profile</v-toolbar-title>
458   - <v-spacer></v-spacer>
459   - <v-icon @click="close1">close</v-icon>
460   - </v-toolbar>
  459 + <v-dialog v-model="dialog1" max-width="600px" scrollable>
461 460 <v-card>
462   - <v-flex align-center justify-center layout text-xs-center>
463   - <v-avatar size="50px" style="position:absolute; top:20px;">
464   - <img src="/static/icon/user.png">
  461 + <v-toolbar color="grey lighten-2" flat>
  462 + <v-spacer></v-spacer>
  463 + <v-toolbar-title>Student Profile</v-toolbar-title>
  464 + <v-spacer></v-spacer>
  465 + <v-icon @click="close1">close</v-icon>
  466 + </v-toolbar>
  467 + <v-card-text style="height: 760px;">
  468 + <v-flex align-center justify-center layout text-xs-center class="mt-3">
  469 + <v-avatar size="160px">
  470 + <img src="/static/icon/user.png" v-if="!editedItem.profilePicUrl">
  471 + <img :src="editedItem.profilePicUrl" v-else-if="editedItem.profilePicUrl">
465 472 </v-avatar>
466 473 </v-flex>
467   - <v-card-text>
468 474 <v-container grid-list-md>
469 475 <v-layout wrap>
470   - <v-flex>
471   - <br>
472   - <br>
  476 + <v-flex>
473 477 <v-layout>
474 478 <v-flex xs5 sm6>
475 479 <h5 class="right my-1">Full Name:</h5>
... ... @@ -622,12 +626,12 @@
622 626 <v-select
623 627 :items="addclass"
624 628 label="Select Class"
625   - v-model="addStudents.select"
  629 + v-model="selectStudents.select"
626 630 item-text="classNum"
627 631 item-value="_id"
628 632 name="Select Class"
629 633 :rules="classRules"
630   - @change="getSections(addStudents.select)"
  634 + @change="getSections(selectStudents.select)"
631 635 class="px-4"
632 636 required
633 637 ></v-select>
... ... @@ -635,7 +639,7 @@
635 639 <v-select
636 640 :items="addSection"
637 641 label="Select Section"
638   - v-model="addStudents.selectSection"
  642 + v-model="selectStudents.selectSection"
639 643 item-text="name"
640 644 item-value="_id"
641 645 name="Select Section"
... ... @@ -656,6 +660,10 @@
656 660 >
657 661 <template slot="items" slot-scope="props">
658 662 <td id="td" class="text-xs-center">{{ props.index}}</td>
  663 + <td id="td" class="text-xs-center">
  664 + <v-avatar><img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl">
  665 + <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl">
  666 + </v-avatar></td>
659 667 <td id="td" class="text-xs-center">{{ props.item.name}}</td>
660 668 <td id="td" class="text-xs-center">{{ props.item.email }}</td>
661 669 <td id="td" class="text-xs-center">{{ dates(props.item.dob) }}</td>
... ... @@ -751,7 +759,7 @@
751 759 item-value="_id"
752 760 name="Select Class"
753 761 :rules="classRules"
754   - @change="getSections(addStudents.select)"
  762 + @change="getSection(addStudents.select)"
755 763 required
756 764 ></v-select>
757 765 </v-flex>
... ... @@ -1390,6 +1398,7 @@ export default {
1390 1398 sortable: false,
1391 1399 value: "No"
1392 1400 },
  1401 + { text: "Profile Pic", value: "profilePicUrl", sortable: false, align: "center" },
1393 1402 { text: "Name", value: "name", sortable: false, align: "center" },
1394 1403 { text: "Email", value: "email", sortable: false, align: "center" },
1395 1404 { text: "Dob", value: "dob", sortable: false, align: "center" },
... ... @@ -1423,6 +1432,10 @@ export default {
1423 1432 selectSection: "",
1424 1433 establishmentYear: new Date().getFullYear()
1425 1434 },
  1435 + selectStudents: {
  1436 + elect: "",
  1437 + selectSection: "",
  1438 + },
1426 1439 editedItem: {
1427 1440 role: "STUDENT",
1428 1441 name: "",
... ... @@ -1481,7 +1494,7 @@ export default {
1481 1494 http()
1482 1495 .get(
1483 1496 "/getStudentWithClass",
1484   - { params: { classId: this.addStudents.select,sectionId: this.addStudents.selectSection,} }
  1497 + { params: { classId: this.selectStudents.select,sectionId: this.selectStudents.selectSection,} }
1485 1498 )
1486 1499 .then(response => {
1487 1500 this.desserts = response.data.data;
... ... @@ -1512,6 +1525,25 @@ export default {
1512 1525 // this.$router.replace({ path: '/' });
1513 1526 });
1514 1527 },
  1528 + getSection(_id) {
  1529 + var token = this.$store.state.token;
  1530 + http()
  1531 + .get(
  1532 + "/getSectionsList",
  1533 + { params: { classId: _id } },
  1534 + {
  1535 + headers: { Authorization: "Bearer " + token }
  1536 + }
  1537 + )
  1538 + .then(response => {
  1539 + this.addSection = response.data.data;
  1540 + console.log("getSectionsList=====>", this.addSection);
  1541 + })
  1542 + .catch(err => {
  1543 + // console.log("err====>", err);
  1544 + // this.$router.replace({ path: '/' });
  1545 + });
  1546 + },
1515 1547 pickFile() {
1516 1548 this.$refs.image.click();
1517 1549 },
... ... @@ -1627,9 +1659,6 @@ export default {
1627 1659 // },
1628 1660 submit() {
1629 1661 if (this.$refs.form.validate()) {
1630   - let imageData = new FormData();
1631   - imageData.append("upload", this.imageFile);
1632   - console.log(imageData);
1633 1662 let addStudent = {
1634 1663 name: this.addStudents.name,
1635 1664 email: this.addStudents.email,
... ... @@ -1650,8 +1679,7 @@ export default {
1650 1679 establishmentYear: this.addStudents.establishmentYear,
1651 1680 classId: this.addStudents.select,
1652 1681 sectionId: this.addStudents.selectSection,
1653   - imageData
1654   - // upload:this.imageFile
  1682 + upload:this.imageUrl
1655 1683 };
1656 1684 this.loading = true;
1657 1685 http()
... ... @@ -1680,9 +1708,6 @@ export default {
1680 1708 this.$refs.form.reset();
1681 1709 },
1682 1710 save() {
1683   - let imageData = new FormData();
1684   - imageData.append("upload", this.imageFile);
1685   - console.log(imageData);
1686 1711 let editStudent = {
1687 1712 studentId:this.editedItem._id,
1688 1713 name: this.editedItem.name,
... ... @@ -1704,7 +1729,7 @@ export default {
1704 1729 establishmentYear: this.editedItem.establishmentYear,
1705 1730 classId: this.editedItem.select,
1706 1731 sectionId: this.editedItem.selectSection,
1707   - imageData
  1732 + upload:this.imageUrl
1708 1733 };
1709 1734 http()
1710 1735 .put("/updateStudent", editStudent)
... ...
src/pages/Teachers/teachers.vue
... ... @@ -70,14 +70,14 @@
70 70 v-model="snackbar"
71 71 color="success"
72 72 >{{ text }}</v-snackbar>
73   - <v-dialog v-model="dialog" max-width="1100px">
74   - <v-flex xs12 sm12 class="my-4">
75   - <v-toolbar color="grey lighten-2">
  73 + <v-dialog v-model="dialog" max-width="1100px" scrollable>
  74 + <v-card flat>
  75 + <v-toolbar color="grey lighten-2" flat>
76 76 <v-spacer></v-spacer>
77 77 <v-toolbar-title>Edit Teacher Profile</v-toolbar-title>
78 78 <v-spacer></v-spacer>
79   - </v-toolbar>
80   - <v-card flat>
  79 + </v-toolbar>
  80 + <v-card-text style="height: 800px;">
81 81 <v-form ref="form">
82 82 <v-container fluid>
83 83 <v-layout>
... ... @@ -85,8 +85,16 @@
85 85 xs12
86 86 class="text-xs-center text-sm-center text-md-center text-lg-center my-4 mr-4"
87 87 >
88   - <v-avatar size="100px">
89   - <img src="/static/icon/user.png" v-if="!imageUrl">
  88 + <v-avatar size="160px">
  89 + <img src="/static/icon/user.png" v-if="!editedItem.profilePicUrl">
  90 + <img :src="editedItem.profilePicUrl" v-else-if="editedItem.profilePicUrl && !imageUrl">
  91 + <img
  92 +
  93 + v-if="imageUrl"
  94 + :src="imageUrl"
  95 + height="150"
  96 + style="border-radius:50%; width:200px"
  97 + >
90 98 </v-avatar>
91 99 <input
92 100 type="file"
... ... @@ -95,12 +103,6 @@
95 103 accept="image/*"
96 104 @change="onFilePicked"
97 105 >
98   - <img
99   - v-if="imageUrl"
100   - :src="imageUrl"
101   - height="150"
102   - style="border-radius:50%; width:200px"
103   - >
104 106 </v-flex>
105 107 </v-layout>
106 108 <v-layout>
... ... @@ -348,31 +350,30 @@
348 350 </v-layout>
349 351 </v-container>
350 352 </v-form>
  353 + </v-card-text>
351 354 </v-card>
352   - </v-flex>
353 355 </v-dialog>
354 356  
355 357 <!-- ****** PROFILE VIEW TEACHERS DETAILS ****** -->
356 358  
357   - <v-dialog v-model="dialog1" max-width="600px">
358   - <v-toolbar color="grey lighten-2">
  359 + <v-dialog v-model="dialog1" max-width="600px" scrollable>
  360 + <v-card>
  361 + <v-toolbar color="grey lighten-2" flat>
359 362 <v-spacer></v-spacer>
360 363 <v-toolbar-title><h3>Teacher Profile</h3></v-toolbar-title>
361 364 <v-spacer></v-spacer>
362 365 <v-icon @click="close1">close</v-icon>
363 366 </v-toolbar>
364   - <v-card>
365   - <v-flex align-center justify-center layout text-xs-center>
366   - <v-avatar size="50px" style="position:absolute; top:20px;">
367   - <img src="/static/icon/user.png">
368   - </v-avatar>
369   - </v-flex>
370   - <v-card-text>
  367 + <v-card-text style="height: 700px;">
371 368 <v-container grid-list-md>
372 369 <v-layout wrap>
373 370 <v-flex>
374   - <br>
375   - <br>
  371 + <v-flex align-center justify-center layout text-xs-center>
  372 + <v-avatar size="160px">
  373 + <img src="/static/icon/user.png" v-if="!editedItem.profilePicUrl">
  374 + <img :src="editedItem.profilePicUrl" v-else-if="editedItem.profilePicUrl">
  375 + </v-avatar>
  376 + </v-flex>
376 377 <v-layout>
377 378 <v-flex xs5 sm6>
378 379 <h5 class="right my-1">Full Name:</h5>
... ... @@ -485,6 +486,10 @@
485 486 >
486 487 <template slot="items" slot-scope="props">
487 488 <td id="td" class="text-xs-center">{{ props.index}}</td>
  489 + <td id="td" class="text-xs-center">
  490 + <v-avatar><img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl">
  491 + <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl">
  492 + </v-avatar></td>
488 493 <td id="td" class="text-xs-center">{{ props.item.name}}</td>
489 494 <td id="td" class="text-xs-center">{{ props.item.email }}</td>
490 495 <td id="td" class="text-xs-center">{{ dates(props.item.dob) }}</td>
... ... @@ -545,13 +550,6 @@
545 550 <v-avatar size="100px">
546 551 <img src="/static/icon/user.png" v-if="!imageUrl">
547 552 </v-avatar>
548   - <!-- <input
549   - type="file"
550   - style="display: none"
551   - ref="image"
552   - accept="image/*"
553   - @change="onFilePicked"
554   - > -->
555 553 <img
556 554 :src="imageUrl"
557 555 height="150"
... ... @@ -1104,6 +1102,7 @@ export default {
1104 1102 sortable: false,
1105 1103 value: "No"
1106 1104 },
  1105 + { text: "Profile Pic", value: "profilePicUrl", sortable: false, align: "center" },
1107 1106 { text: "Name", value: "name", sortable: false, align: "center" },
1108 1107 { text: "Email", value: "email", sortable: false, align: "center" },
1109 1108 { text: "DOB", value: "dob", sortable: false, align: "center" },
... ... @@ -1200,7 +1199,7 @@ export default {
1200 1199 this.imageFile = files[0]; // this is an image file that can be sent to server...
1201 1200 // this.imageData.imageUrl = URL.createObjectURL(this.imageFile);
1202 1201 // console.log("upload=======>", this.imageData.imageUrl);
1203   - console.log("imageFile", this.imageFile);
  1202 + console.log("imageFile", this.imageUrl );
1204 1203 });
1205 1204 } else {
1206 1205 this.imageName = "";
... ... @@ -1293,9 +1292,9 @@ export default {
1293 1292 // },
1294 1293 submit() {
1295 1294 if (this.$refs.form.validate()) {
1296   - let images = new FormData();
1297   - images.append("upload", this.imageFile);
1298   - console.log(images);
  1295 + // let images = new FormData();
  1296 + // images.append("upload",this.imageUrl);
  1297 + // console.log(images);
1299 1298 // var form_data = new FormData();
1300 1299 // for (var key in addTeacher) {
1301 1300 // if (key === 'upload') {
... ... @@ -1304,7 +1303,7 @@ export default {
1304 1303 // form_data.append(key, addTeacher[key])
1305 1304 // }
1306 1305 // }
1307   - console.log("images",images)
  1306 + // console.log("images",images)
1308 1307 let addTeacher = {
1309 1308 name: this.addTeachers.name,
1310 1309 email: this.addTeachers.email,
... ... @@ -1318,7 +1317,7 @@ export default {
1318 1317 mobileNo: this.addTeachers.mobileNo,
1319 1318 state: this.addTeachers.state,
1320 1319 joinDate: this.addTeachers.joinDate,
1321   - images
  1320 + upload:this.imageUrl
1322 1321 // upload:this.imageFile
1323 1322 };
1324 1323 // console.log("addTeacher============>", addTeacher);
... ... @@ -1364,7 +1363,7 @@ export default {
1364 1363 mobileNo: this.editedItem.mobileNo,
1365 1364 state: this.editedItem.state,
1366 1365 joinDate: this.editedItem.joinDate,
1367   - // imageData,
  1366 + upload:this.imageUrl
1368 1367 };
1369 1368 http()
1370 1369 .put("/updateTeacher", editTeacher)
... ...