Blame view
src/pages/Dashboard/dashboard.vue
4.65 KB
a17c68a03
|
1 2 |
<template> <v-app id="pages-dasboard"> |
687e0b929
|
3 4 5 6 7 8 9 |
<full-calendar ref="calendar" defaultView="month" droppable="false" :events="events" :config="config" ></full-calendar> |
a17c68a03
|
10 11 12 |
<v-dialog v-model="dialog" max-width="500"> <v-card color="grey lighten-4" flat> <v-toolbar dark color="fixcolors"> |
bf5ab636b
|
13 |
<!-- <v-toolbar-title class="white--text">Title</v-toolbar-title> --> |
a17c68a03
|
14 15 16 17 18 19 20 21 22 |
<v-spacer></v-spacer> <v-btn icon @click="dialog= false"> <v-icon>close</v-icon> </v-btn> </v-toolbar> <v-flex class="py-4"> <v-list-tile> <v-list-tile-action> <v-icon>edit</v-icon> |
8bb178441
|
23 24 |
</v-list-tile-action> <v-list-tile-content> |
a17c68a03
|
25 |
<v-list-tile-title>{{ selected.title }}</v-list-tile-title> |
8bb178441
|
26 27 |
</v-list-tile-content> </v-list-tile> |
a17c68a03
|
28 29 30 31 32 33 |
<v-list-tile> <v-list-tile-action> <v-icon>access_time</v-icon> </v-list-tile-action> <v-list-tile-content> <v-list-tile-title>{{ date(selected.start)}}</v-list-tile-title> |
db0c39244
|
34 |
<!-- <v-list-tile-sub-title>{{ date(selected.end) }}</v-list-tile-sub-title> --> |
a17c68a03
|
35 36 37 38 39 |
</v-list-tile-content> </v-list-tile> </v-flex> </v-card> </v-dialog> |
8bb178441
|
40 41 42 43 44 45 46 47 48 |
<div class="loader" v-if="showLoader"> <v-progress-circular indeterminate color="white"></v-progress-circular> </div> </v-app> </template> <script> import http from "@/Services/http.js"; import Util from "@/util"; |
a17c68a03
|
49 |
import moment from "moment"; |
8bb178441
|
50 51 |
export default { |
a17c68a03
|
52 53 54 55 |
data() { return { showLoader: false, dialog: false, |
b28a5f17d
|
56 57 |
HolidaysList: [], EventsList: [], |
ceb43037a
|
58 |
events: [], |
a17c68a03
|
59 60 61 62 |
config: { eventClick: event => { this.selected = event; this.dialog = true; |
8bb178441
|
63 64 |
} }, |
db0c39244
|
65 |
selected: {} |
a17c68a03
|
66 67 |
}; }, |
8bb178441
|
68 |
methods: { |
a17c68a03
|
69 70 |
date: function(date) { return moment(date).format("MMMM DD, YYYY HH:mm:ss"); |
8bb178441
|
71 |
}, |
a17c68a03
|
72 73 74 75 76 77 78 79 80 |
refreshEvents() { this.$refs.calendar.$emit("refetch-events"); }, removeEvent() { this.$refs.calendar.$emit("remove-event", this.selected); this.selected = {}; }, eventSelected(event) { this.selected = event; |
db0c39244
|
81 |
console.log("this.selected", this.selected); |
a17c68a03
|
82 |
}, |
687e0b929
|
83 84 85 |
// eventDropStart: function(event) { // event.editable = false; // }, |
a17c68a03
|
86 87 |
eventCreated(...test) { console.log(test); |
8bb178441
|
88 |
}, |
687e0b929
|
89 |
getData() { |
db0c39244
|
90 91 92 93 94 95 96 |
this.showLoader = true; var token = this.$store.state.token; http() .get("/getHolidaysList", { headers: { Authorization: "Bearer " + token } }) .then(response => { |
b28a5f17d
|
97 98 |
this.HolidaysList = response.data.data; // this.events = response.data.data; |
db0c39244
|
99 100 101 102 103 104 105 106 107 108 109 |
this.showLoader = false; }) .catch(err => { // console.log("err====>", err); this.showLoader = false; if (error.response.status === 401) { this.$router.replace({ path: "/" }); this.$store.dispatch("setToken", null); this.$store.dispatch("Id", null); } }); |
b28a5f17d
|
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
var token = this.$store.state.token; http() .get("/getSchoolEventsList", { headers: { Authorization: "Bearer " + token } }) .then(response => { this.EventsList = response.data.data; let allData = []; allData = this.HolidaysList.concat(this.EventsList); this.events = allData; this.showLoader = false; }) .catch(error => { // console.log("err====>", err); this.showLoader = false; if (error.response.status === 401) { this.$router.replace({ path: "/" }); this.$store.dispatch("setToken", null); this.$store.dispatch("Id", null); } }); |
8bb178441
|
131 |
} |
db0c39244
|
132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
// eventSources() { // const self = this; // return [ // { // events(start, end, timezone, callback) { // setTimeout(() => { // callback(self.events.filter(() => Math.random() > 0.5)); // }, 1000); // } // } // ]; // } }, mounted() { |
687e0b929
|
146 |
this.getData(); |
8bb178441
|
147 148 149 |
} }; </script> |
687e0b929
|
150 |
|
8bb178441
|
151 |
<style> |
a17c68a03
|
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
@import "fullcalendar/dist/fullcalendar.css"; .fc button { background: #39b982 !important; border: none; border-radius: 4px; color: white; padding: 6px 32px; text-align: center; text-decoration: none; display: inline-block; font-size: 18px; margin: 8px 2px !important; cursor: pointer; -webkit-transition-duration: 0.4s; transition-duration: 0.4s; box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); } |
a17c68a03
|
169 |
</style> |