Commit b28a5f17df1ca6741182ddec90e3bb58676bebec

Authored by Neeraj Sharma
1 parent 231cd3e7ea

fixed events and holidays api in calender dashbaord

src/pages/Dashboard/dashboard.vue
1 1 <template>
2 2 <v-app id="pages-dasboard">
3   - <v-tabs icons-and-text centered>
4   - <v-tabs-slider color="green"></v-tabs-slider>
5   - <v-tab href="#tab-1">
6   - Events
7   - <v-icon>event</v-icon>
8   - </v-tab>
9   - <v-tab href="#tab-2">
10   - Holidays
11   - <v-icon>star</v-icon>
12   - </v-tab>
13   - <v-tab-item id="tab-1">
14   - <v-card flat>
15   - <full-calendar ref="calendar" :events="events" :config="config"></full-calendar>
16   - </v-card>
17   - </v-tab-item>
18   - <v-tab-item id="tab-2">
19   - <v-card flat>
20   - <full-calendar ref="calendar" :events="eventHoliday" :config="config"></full-calendar>
21   - </v-card>
22   - </v-tab-item>
23   - </v-tabs>
  3 + <full-calendar ref="calendar" :events="events" :config="config"></full-calendar>
24 4 <v-dialog v-model="dialog" max-width="500">
25 5 <v-card color="grey lighten-4" flat>
26 6 <v-toolbar dark color="fixcolors">
... ... @@ -68,8 +48,9 @@ export default {
68 48 return {
69 49 showLoader: false,
70 50 dialog: false,
  51 + HolidaysList: [],
  52 + EventsList: [],
71 53 events: [],
72   - eventHoliday: [],
73 54 config: {
74 55 eventClick: event => {
75 56 this.selected = event;
... ... @@ -97,35 +78,6 @@ export default {
97 78 eventCreated(...test) {
98 79 console.log(test);
99 80 },
100   - // getEvents() {
101   - // this.showLoader = true;
102   - // var token = this.$store.state.token;
103   - // http()
104   - // .get("/getSchoolEventsList", {
105   - // headers: { Authorization: "Bearer " + token }
106   - // })
107   - // .then(response => {
108   - // for(var i=0; i<response.data.data.length;i++){
109   - // console.log(response.data.data[i])
110   - // this.events = [
111   - // {
112   - // title:response.data.data[i].title,
113   - // start:response.data.data[i].dateOfEvent
114   - // }
115   - // ]
116   - // }
117   - // this.showLoader = false;
118   - // })
119   - // .catch(err => {
120   - // // console.log("err====>", err);
121   - // this.showLoader = false;
122   - // if (error.response.status === 401) {
123   - // this.$router.replace({ path: "/" });
124   - // this.$store.dispatch("setToken", null);
125   - // this.$store.dispatch("Id", null);
126   - // }
127   - // });
128   - // }
129 81 getHolidays() {
130 82 this.showLoader = true;
131 83 var token = this.$store.state.token;
... ... @@ -134,7 +86,8 @@ export default {
134 86 headers: { Authorization: "Bearer " + token }
135 87 })
136 88 .then(response => {
137   - this.eventHoliday = response.data.data;
  89 + this.HolidaysList = response.data.data;
  90 + // this.events = response.data.data;
138 91 this.showLoader = false;
139 92 })
140 93 .catch(err => {
... ... @@ -146,6 +99,29 @@ export default {
146 99 this.$store.dispatch("Id", null);
147 100 }
148 101 });
  102 + // },
  103 + // getEvents() {
  104 + var token = this.$store.state.token;
  105 + http()
  106 + .get("/getSchoolEventsList", {
  107 + headers: { Authorization: "Bearer " + token }
  108 + })
  109 + .then(response => {
  110 + this.EventsList = response.data.data;
  111 + let allData = [];
  112 + allData = this.HolidaysList.concat(this.EventsList);
  113 + this.events = allData;
  114 + this.showLoader = false;
  115 + })
  116 + .catch(error => {
  117 + // console.log("err====>", err);
  118 + this.showLoader = false;
  119 + if (error.response.status === 401) {
  120 + this.$router.replace({ path: "/" });
  121 + this.$store.dispatch("setToken", null);
  122 + this.$store.dispatch("Id", null);
  123 + }
  124 + });
149 125 }
150 126 // eventSources() {
151 127 // const self = this;
... ... @@ -162,24 +138,6 @@ export default {
162 138 },
163 139 mounted() {
164 140 // this.getEvents();
165   - var token = this.$store.state.token;
166   - http()
167   - .get("/getSchoolEventsList", {
168   - headers: { Authorization: "Bearer " + token }
169   - })
170   - .then(response => {
171   - this.events = response.data.data;
172   - this.showLoader = false;
173   - })
174   - .catch(error => {
175   - // console.log("err====>", err);
176   - this.showLoader = false;
177   - if (error.response.status === 401) {
178   - this.$router.replace({ path: "/" });
179   - this.$store.dispatch("setToken", null);
180   - this.$store.dispatch("Id", null);
181   - }
182   - });
183 141 this.getHolidays();
184 142 }
185 143 };
... ... @@ -215,10 +173,7 @@ export default {
215 173 margin: 0 15px;
216 174 min-width: 120px;
217 175 }
218   -.primary {
219   - background-color: #aaa !important;
220   - border-color: #aaa !important;
221   -}
  176 +
222 177 h4 {
223 178 background-repeat: no-repeat;
224 179 padding: 8px;
... ... @@ -275,13 +230,6 @@ h4 {
275 230 #dialog {
276 231 height: 550px;
277 232 }
278   -.active {
279   - background-color: black;
280   - color: white !important;
281   -}
282   -.activebtn {
283   - color: black !important;
284   -}
285 233 #flex {
286 234 height: 300px;
287 235 }
... ...
src/pages/Event/event.vue
... ... @@ -102,6 +102,7 @@
102 102 placeholder="Select date"
103 103 ></v-text-field>
104 104 <v-date-picker
  105 + color="info"
105 106 ref="picker"
106 107 v-model="editedItem.dateOfEvent"
107 108 @input="$refs.menu.save(editedItem.dateOfEvent)"
... ... @@ -157,7 +158,9 @@
157 158 <v-flex>
158 159 <v-layout>
159 160 <v-flex xs5 sm6>
160   - <h5 class="right my-1"><b>Title:</b></h5>
  161 + <h5 class="right my-1">
  162 + <b>Title:</b>
  163 + </h5>
161 164 </v-flex>
162 165 <v-flex sm6 xs8>
163 166 <h5 class="my-1">{{ editedItem.title }}</h5>
... ... @@ -165,7 +168,9 @@
165 168 </v-layout>
166 169 <v-layout>
167 170 <v-flex xs5 sm6>
168   - <h5 class="right my-1"><b>Date:</b></h5>
  171 + <h5 class="right my-1">
  172 + <b>Date:</b>
  173 + </h5>
169 174 </v-flex>
170 175 <v-flex sm6 xs8>
171 176 <h5 class="my-1">{{ dates(editedItem.dateOfEvent) }}</h5>
... ... @@ -173,7 +178,9 @@
173 178 </v-layout>
174 179 <v-layout>
175 180 <v-flex xs5 sm6>
176   - <h5 class="right my-1"><b>Description:</b></h5>
  181 + <h5 class="right my-1">
  182 + <b>Description:</b>
  183 + </h5>
177 184 </v-flex>
178 185 <v-flex sm6 xs8>
179 186 <h5 class="my-1">{{ editedItem.description }}</h5>
... ... @@ -298,7 +305,7 @@
298 305 <v-flex xs12>
299 306 <v-layout>
300 307 <v-flex xs4 class="pt-4 subheading">
301   - <label class="right">date:</label>
  308 + <label class="right">Date:</label>
302 309 </v-flex>
303 310 <v-flex xs4 class="ml-3">
304 311 <v-menu
... ... @@ -307,6 +314,7 @@
307 314 v-model="menu1"
308 315 :nudge-right="40"
309 316 :return-value.sync="addEvent.dateOfEvent"
  317 + app
310 318 lazy
311 319 transition="scale-transition"
312 320 offset-y
... ... @@ -317,12 +325,14 @@
317 325 slot="activator"
318 326 :rules="dateRules"
319 327 v-model="addEvent.dateOfEvent"
  328 + append-icon="event"
320 329 placeholder="Select date"
321 330 ></v-text-field>
322 331 <v-date-picker
  332 + color="info"
323 333 v-model="addEvent.dateOfEvent"
324   - @input="$refs.menu1.save(addEvent.dateOfEvent)">
325   - </v-date-picker>
  334 + @input="$refs.menu1.save(addEvent.dateOfEvent)"
  335 + ></v-date-picker>
326 336 </v-menu>
327 337 </v-flex>
328 338 </v-layout>
... ...
src/pages/Holiday/holiday.vue
... ... @@ -82,6 +82,7 @@
82 82 ></v-text-field>
83 83 <v-date-picker
84 84 ref="picker"
  85 + color="info"
85 86 v-model="editedItem.dateOfHoliday"
86 87 @input="menu = false"
87 88 ></v-date-picker>
... ... @@ -259,6 +260,7 @@
259 260 ></v-text-field>
260 261 <v-date-picker
261 262 ref="picker"
  263 + color="info"
262 264 v-model="addHoliday.dateOfHoliday"
263 265 @input="$refs.menu1.save(addHoliday.dateOfHoliday)"
264 266 ></v-date-picker>
... ...