Commit 593420b06fb0cdde6d71bb9af52a23cc832c6f6c

Authored by Neeraj Sharma
1 parent 4bd94ba603

implement design & add,edit and delete eventapi of EVENT

src/components/pageHeader/AppToolbar.vue
... ... @@ -5,7 +5,7 @@
5 5 </v-toolbar-title>
6 6  
7 7 <!-- ****** SEARCH ALL EXISTING STUDENTS ****** -->
8   - <v-flex xs7 sm3 class="userSearch" v-if="$route.name != 'Dashboard'">
  8 + <v-flex xs7 sm3 class="userSearch" v-if="$route.name != 'Dashboard' && $route.name != 'changepassword'">
9 9 <v-text-field
10 10 flat
11 11 append-icon="search"
... ...
src/pages/Authentication/changepassword.vue
1 1 <template>
2 2 <v-app id="login">
3   - <app-toolbar class="app--toolbar"></app-toolbar>
4 3 <v-container fluid fill-height>
5 4 <v-layout>
6 5 <v-flex xs12 sm8 md8 lg5 offset-sm2 offset-lg3 class="mt-5">
... ... @@ -55,12 +54,8 @@
55 54 </template>
56 55 <script>
57 56 import http from "@/Services/http.js";
58   -import AppToolbar from "@/components/pageHeader/AppToolbar";
59 57  
60 58 export default {
61   - components: {
62   - AppToolbar
63   - },
64 59 data() {
65 60 return {
66 61 snackbar: false,
... ...
src/pages/Event/event.vue
... ... @@ -47,8 +47,8 @@
47 47 >
48 48 <v-avatar size="100px">
49 49 <img src="/static/icon/user.png" />
50   - </v-avatar> -->
51   - <!-- <input
  50 + </v-avatar>-->
  51 + <!-- <input
52 52 type="file"
53 53 style="display: none"
54 54 ref="image"
... ... @@ -60,7 +60,7 @@
60 60 height="150"
61 61 v-if="imageUrl"
62 62 style="border-radius:50%; width:200px"
63   - />-->
  63 + />-->
64 64 <!-- </v-flex> -->
65 65 </v-layout>
66 66 <v-flex xs12 sm12>
... ... @@ -83,30 +83,30 @@
83 83 <v-flex xs4 class="pt-4 subheading">
84 84 <label class="right">Date:</label>
85 85 </v-flex>
86   - <v-flex xs5 class="ml-3">
87   - <v-menu
88   - ref="menu"
89   - :close-on-content-click="false"
90   - v-model="menu"
91   - :nudge-right="40"
92   - lazy
93   - transition="scale-transition"
94   - offset-y
95   - full-width
96   - min-width="290px"
97   - >
98   - <v-text-field
99   - slot="activator"
100   - :rules="dateRules"
101   - v-model="editedItem.joinDate"
102   - placeholder="Select date"
103   - ></v-text-field>
104   - <v-date-picker
105   - ref="picker"
106   - v-model="editedItem.joinDate"
107   - @input="menu = false"
108   - ></v-date-picker>
109   - </v-menu>
  86 + <v-flex xs5 class="ml-3">
  87 + <v-menu
  88 + ref="menu"
  89 + :close-on-content-click="false"
  90 + v-model="menu"
  91 + :nudge-right="40"
  92 + lazy
  93 + transition="scale-transition"
  94 + offset-y
  95 + full-width
  96 + min-width="290px"
  97 + >
  98 + <v-text-field
  99 + slot="activator"
  100 + :rules="dateRules"
  101 + v-model="editedItem.dateOfEvent"
  102 + placeholder="Select date"
  103 + ></v-text-field>
  104 + <v-date-picker
  105 + ref="picker"
  106 + v-model="editedItem.dateOfEvent"
  107 + @input="menu = false"
  108 + ></v-date-picker>
  109 + </v-menu>
110 110 </v-flex>
111 111 </v-layout>
112 112 </v-flex>
... ... @@ -155,7 +155,7 @@
155 155 <v-avatar size="50px" style="position:absolute; top:20px;">
156 156 <img src="/static/icon/user.png" />
157 157 </v-avatar>
158   - </v-flex> -->
  158 + </v-flex>-->
159 159 <v-card-text>
160 160 <v-container grid-list-md>
161 161 <v-layout wrap>
... ... @@ -173,7 +173,7 @@
173 173 <h5 class="right my-1">Date:</h5>
174 174 </v-flex>
175 175 <v-flex sm6 xs8>
176   - <h5 class="my-1">{{ editedItem.title }}</h5>
  176 + <h5 class="my-1">{{ dates(editedItem.dateOfEvent) }}</h5>
177 177 </v-flex>
178 178 </v-layout>
179 179 <v-layout>
... ... @@ -210,6 +210,7 @@
210 210 <template slot="items" slot-scope="props">
211 211 <td id="td" class="text-xs-center">{{ props.index}}</td>
212 212 <td id="td" class="text-xs-center">{{ props.item.title}}</td>
  213 + <td id="td" class="text-xs-center">{{ dates(props.item.dateOfEvent)}}</td>
213 214 <td id="td" class="text-xs-center">{{ props.item.description}}</td>
214 215  
215 216 <td id="td" class="text-xs-center">
... ... @@ -267,8 +268,8 @@
267 268 >
268 269 <v-avatar size="100px">
269 270 <img src="/static/icon/user.png" />
270   - </v-avatar> -->
271   - <!-- <input
  271 + </v-avatar>-->
  272 + <!-- <input
272 273 type="file"
273 274 style="display: none"
274 275 ref="image"
... ... @@ -280,7 +281,7 @@
280 281 height="150"
281 282 v-if="imageUrl"
282 283 style="border-radius:50%; width:200px"
283   - />-->
  284 + />-->
284 285 <!-- </v-flex> -->
285 286 </v-layout>
286 287 <v-flex xs12>
... ... @@ -299,35 +300,35 @@
299 300 </v-flex>
300 301 </v-layout>
301 302 </v-flex>
302   - <v-flex xs12>
  303 + <v-flex xs12>
303 304 <v-layout>
304 305 <v-flex xs4 class="pt-4 subheading">
305 306 <label class="right">date:</label>
306 307 </v-flex>
307 308 <v-flex xs4 class="ml-3">
308   - <v-menu
309   - ref="menu1"
310   - :close-on-content-click="false"
311   - v-model="menu1"
312   - :nudge-right="40"
313   - lazy
314   - transition="scale-transition"
315   - offset-y
316   - full-width
317   - min-width="290px"
318   - >
319   - <v-text-field
320   - slot="activator"
321   - :rules="dateRules"
322   - v-model="addEvent.joinDate"
323   - placeholder="Select date"
324   - ></v-text-field>
325   - <v-date-picker
326   - ref="picker"
327   - v-model="addEvent.joinDate"
328   - @input="menu1 = false"
329   - ></v-date-picker>
330   - </v-menu>
  309 + <v-menu
  310 + ref="menu1"
  311 + :close-on-content-click="false"
  312 + v-model="menu1"
  313 + :nudge-right="40"
  314 + lazy
  315 + transition="scale-transition"
  316 + offset-y
  317 + full-width
  318 + min-width="290px"
  319 + >
  320 + <v-text-field
  321 + slot="activator"
  322 + :rules="dateRules"
  323 + v-model="addEvent.dateOfEvent"
  324 + placeholder="Select date"
  325 + ></v-text-field>
  326 + <v-date-picker
  327 + ref="picker"
  328 + v-model="addEvent.dateOfEvent"
  329 + @input="menu1 = false"
  330 + ></v-date-picker>
  331 + </v-menu>
331 332 </v-flex>
332 333 </v-layout>
333 334 </v-flex>
... ... @@ -372,6 +373,7 @@
372 373 <script>
373 374 import http from "@/Services/http.js";
374 375 import Util from "@/util";
  376 +import moment from "moment";
375 377  
376 378 export default {
377 379 data: () => ({
... ... @@ -453,11 +455,14 @@ export default {
453 455 // this.imageUrl = "";
454 456 // }
455 457 // },
  458 + dates: function(date) {
  459 + return moment(date).format("MMMM DD, YYYY");
  460 + },
456 461 getEvents() {
457 462 // this.showLoader = true;
458 463 var token = this.$store.state.token;
459 464 http()
460   - .get("/getNotificationsList", {
  465 + .get("/getSchoolEventsList", {
461 466 headers: { Authorization: "Bearer " + token }
462 467 })
463 468 .then(response => {
... ... @@ -477,6 +482,7 @@ export default {
477 482 editItem(item) {
478 483 this.editedIndex = this.desserts.indexOf(item);
479 484 this.editedItem = Object.assign({}, item);
  485 + this.editedItem.schoolEventId = item._id
480 486 this.dialog = true;
481 487 },
482 488 profile(item) {
... ... @@ -487,17 +493,16 @@ export default {
487 493  
488 494 deleteItem(item) {
489 495 let deleteEvent = {
490   - notificationId: item._id
  496 + schoolEventId: item._id
491 497 };
492 498 http()
493 499 .delete(
494   - "/deleteNotification",
  500 + "/deleteSchoolEvent",
495 501 confirm("Are you sure you want to delete this?") && {
496   - params: deleteNotification
  502 + params: deleteEvent
497 503 }
498 504 )
499 505 .then(response => {
500   - // console.log("deleteNotification",deleteNotification)
501 506 if ((this.snackbar = true)) {
502 507 this.text = response.data.message;
503 508 }
... ... @@ -532,29 +537,18 @@ export default {
532 537 },
533 538 submit() {
534 539 if (this.$refs.form.validate()) {
535   - // let imageData = new FormData();
536   - // imageData.append("upload", this.imageFile);
537   - // console.log(imageData);
538   - // let create = {
539   - // title: this.addNotification.title,
540   - // description: this.addNotification.description
541   - // // imageData
542   - // };
543   - // console.log(create);
544 540 this.loading = true;
545 541 http()
546   - .post("/createNotification", this.addEvent)
  542 + .post("/createSchoolEvent", this.addEvent)
547 543 .then(response => {
548   - console.log(create);
549 544 if ((this.snackbar = true)) {
550   - this.text = "New Notification added successfully";
  545 + this.text = response.data.message;
551 546 }
552 547 this.getEvents();
553 548 this.clear();
554 549 this.loading = false;
555 550 })
556 551 .catch(error => {
557   - // console.log(error);
558 552 if ((this.snackbar = true)) {
559 553 this.text = error.response.data.message;
560 554 }
... ... @@ -566,28 +560,17 @@ export default {
566 560 this.$refs.form.reset();
567 561 },
568 562 save() {
569   - // let imageData = new FormData();
570   - // imageData.append("upload", this.imageFile);
571   - // console.log(imageData);
572   - // let editNotification = {
573   - // notificationId: this.editedItem._id,
574   - // title: this.editedItem.title,
575   - // description: this.editedItem.description
576   - // // imageData
577   - // };
578 563 http()
579   - .put("/updateNotification", this.editedItem)
  564 + .put("/updateSchoolEvent", this.editedItem)
580 565 .then(response => {
581   - // console.log("editNotification",editNotification);
582   - if ((this.snackbar = true)) {
583   - this.text = "Successfully Edit Notification";
584   - }
  566 + this.snackbar = true;
  567 + this.text = response.data.message;
585 568 this.getEvents();
  569 + this.close();
586 570 })
587 571 .catch(error => {
588 572 // console.log(error);
589 573 });
590   - this.close();
591 574 }
592 575 },
593 576 mounted() {
... ...