Blame view

src/pages/Dashboard/dashboard.vue 10.4 KB
a17c68a03   Neeraj Sharma   implement two rou...
1
2
  <template>
    <v-app id="pages-dasboard">
6c05a9f84   Neeraj Sharma   add functionalit ...
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
      <v-container fluid grid-list-xl>
        <!-- <v-card flat class="dashCard"> -->
        <v-layout row wrap class="pt-3">
          <!-- ***** Total Students ***** -->
          <v-flex xs12 class="pt-2">
            <v-layout row wrap>
              <v-flex xs12 sm12 lg3 md4>
                <v-card width="90" height="90" class="ml-3 pa-1 white iconCard" dark>
                  <img
                    src="/static/schoolIcons/Students.png"
                    class="iconOfDashboard"
                    width="80"
                    alt="Students"
                  />
                </v-card>
                <v-card class="pa-3" style="margin-top: -44px;">
                  <div class="body-2 grey--text text-xs-right">Students</div>
                  <br />
                  <h3 class="headline text-xs-right pb-4">{{ students.length }}</h3>
                </v-card>
              </v-flex>
              <!-- ***** Total Parents ***** -->
              <v-flex xs12 sm12 lg3 md4>
                <v-card width="90" height="90" class="ml-3 pa-1 white agentIcon" dark>
                  <img
                    src="/static/schoolIcons/Parents.png"
                    width="80"
                    class="iconOfDashboard"
                    alt="Parents"
                  />
                </v-card>
                <v-card class="pa-3" style="margin-top: -44px;">
                  <div class="body-2 grey--text text-xs-right">Parents</div>
                  <br />
                  <h3 class="headline text-xs-right pb-4">{{ parents.length }}</h3>
                </v-card>
              </v-flex>
              <!-- ***** Total Teachers***** -->
              <v-flex xs12 sm12 lg3 md4>
                <v-card width="90" height="90" class="ml-3 pa-1 white farmerIcon" dark>
                  <img
                    src="/static/schoolIcons/Teachers.png"
                    width="80"
                    class="iconOfDashboard"
                    alt="Teachers"
                  />
                </v-card>
                <v-card class="pa-3" style="margin-top: -44px;">
                  <div class="body-2 grey--text text-xs-right">Teachers</div>
                  <br />
                  <h3 class="headline text-xs-right pb-4">{{ teachers.length }}</h3>
                </v-card>
              </v-flex>
              <!-- ***** Total Class***** -->
              <v-flex xs12 sm12 lg3 md4>
                <v-card width="90" height="90" class="ml-3 pa-1 white khasraIcon" dark>
f4df757fe   Neeraj Sharma   responsive vie in...
59
                  <img src="/static/schoolIcons/Class.png" width="80" class="iconOfDashboard" alt="class" />
6c05a9f84   Neeraj Sharma   add functionalit ...
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
                </v-card>
                <v-card class="pa-3" style="margin-top: -44px;">
                  <div class="body-2 grey--text text-xs-right">Class</div>
                  <br />
                  <h3 class="headline text-xs-right pb-4">{{ classes.length}}</h3>
                </v-card>
              </v-flex>
            </v-layout>
          </v-flex>
        </v-layout>
        <v-card class="pt-4 mt-3" flat>
          <full-calendar
            ref="calendar"
            defaultView="month"
            droppable="false"
            :events="events"
            :config="config"
          ></full-calendar>
        </v-card>
      </v-container>
a17c68a03   Neeraj Sharma   implement two rou...
80
81
82
      <v-dialog v-model="dialog" max-width="500">
        <v-card color="grey lighten-4" flat>
          <v-toolbar dark color="fixcolors">
bf5ab636b   Neeraj Sharma   fixed bugs scroll...
83
            <!-- <v-toolbar-title class="white--text">Title</v-toolbar-title> -->
a17c68a03   Neeraj Sharma   implement two rou...
84
85
86
87
88
89
90
91
92
            <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   Neeraj Sharma   implemnt api in s...
93
94
              </v-list-tile-action>
              <v-list-tile-content>
a17c68a03   Neeraj Sharma   implement two rou...
95
                <v-list-tile-title>{{ selected.title }}</v-list-tile-title>
8bb178441   Neeraj Sharma   implemnt api in s...
96
97
              </v-list-tile-content>
            </v-list-tile>
a17c68a03   Neeraj Sharma   implement two rou...
98
99
100
101
102
103
            <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   Neeraj Sharma   implement event a...
104
                <!-- <v-list-tile-sub-title>{{ date(selected.end) }}</v-list-tile-sub-title> -->
a17c68a03   Neeraj Sharma   implement two rou...
105
106
107
108
109
              </v-list-tile-content>
            </v-list-tile>
          </v-flex>
        </v-card>
      </v-dialog>
8bb178441   Neeraj Sharma   implemnt api in s...
110
111
112
113
114
115
116
117
118
      <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   Neeraj Sharma   implement two rou...
119
  import moment from "moment";
8bb178441   Neeraj Sharma   implemnt api in s...
120
121
  
  export default {
a17c68a03   Neeraj Sharma   implement two rou...
122
123
124
125
    data() {
      return {
        showLoader: false,
        dialog: false,
b28a5f17d   Neeraj Sharma   fixed events and ...
126
127
        HolidaysList: [],
        EventsList: [],
ceb43037a   Neeraj Sharma   fix bugs
128
        events: [],
a17c68a03   Neeraj Sharma   implement two rou...
129
130
131
132
        config: {
          eventClick: event => {
            this.selected = event;
            this.dialog = true;
8bb178441   Neeraj Sharma   implemnt api in s...
133
134
          }
        },
6c05a9f84   Neeraj Sharma   add functionalit ...
135
136
137
138
139
        selected: {},
        students: "",
        parents: "",
        teachers: "",
        classes: ""
a17c68a03   Neeraj Sharma   implement two rou...
140
141
      };
    },
6c05a9f84   Neeraj Sharma   add functionalit ...
142
143
144
145
146
147
148
149
    mounted() {
      this.token = this.$store.state.token;
      this.getData();
      this.getStudents();
      this.getTeachers();
      this.getParents();
      this.getClasses();
    },
8bb178441   Neeraj Sharma   implemnt api in s...
150
    methods: {
a17c68a03   Neeraj Sharma   implement two rou...
151
152
      date: function(date) {
        return moment(date).format("MMMM DD, YYYY  HH:mm:ss");
8bb178441   Neeraj Sharma   implemnt api in s...
153
      },
a17c68a03   Neeraj Sharma   implement two rou...
154
155
156
157
158
159
160
161
162
      refreshEvents() {
        this.$refs.calendar.$emit("refetch-events");
      },
      removeEvent() {
        this.$refs.calendar.$emit("remove-event", this.selected);
        this.selected = {};
      },
      eventSelected(event) {
        this.selected = event;
db0c39244   Neeraj Sharma   implement event a...
163
        console.log("this.selected", this.selected);
a17c68a03   Neeraj Sharma   implement two rou...
164
      },
687e0b929   Neeraj Sharma   add user,attenden...
165
166
167
      // eventDropStart: function(event) {
      //   event.editable = false;
      // },
a17c68a03   Neeraj Sharma   implement two rou...
168
169
      eventCreated(...test) {
        console.log(test);
8bb178441   Neeraj Sharma   implemnt api in s...
170
      },
687e0b929   Neeraj Sharma   add user,attenden...
171
      getData() {
db0c39244   Neeraj Sharma   implement event a...
172
173
174
175
176
177
178
        this.showLoader = true;
        var token = this.$store.state.token;
        http()
          .get("/getHolidaysList", {
            headers: { Authorization: "Bearer " + token }
          })
          .then(response => {
b28a5f17d   Neeraj Sharma   fixed events and ...
179
180
            this.HolidaysList = response.data.data;
            // this.events = response.data.data;
db0c39244   Neeraj Sharma   implement event a...
181
182
183
184
185
186
187
188
189
190
191
            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   Neeraj Sharma   fixed events and ...
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
        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);
            }
          });
6c05a9f84   Neeraj Sharma   add functionalit ...
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
      },
      getStudents() {
        http()
          .get("/getStudentsList", {
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
            this.students = response.data.data;
            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);
            }
          });
      },
      getParents() {
        http()
          .get("/getParentsList", {
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
            this.parents = response.data.data;
            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);
            }
          });
      },
      getTeachers() {
        http()
          .get("/getTeachersList", {
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
            this.teachers = response.data.data;
            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);
            }
          });
      },
      getClasses() {
        http()
          .get("/getClassesList", {
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
            this.classes = response.data.data;
            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);
            }
          });
8bb178441   Neeraj Sharma   implemnt api in s...
288
      }
db0c39244   Neeraj Sharma   implement event a...
289
290
291
292
293
294
295
296
297
298
299
300
      // eventSources() {
      //   const self = this;
      //   return [
      //     {
      //       events(start, end, timezone, callback) {
      //         setTimeout(() => {
      //           callback(self.events.filter(() => Math.random() > 0.5));
      //         }, 1000);
      //       }
      //     }
      //   ];
      // }
8bb178441   Neeraj Sharma   implemnt api in s...
301
302
303
    }
  };
  </script>
687e0b929   Neeraj Sharma   add user,attenden...
304

8bb178441   Neeraj Sharma   implemnt api in s...
305
  <style>
a17c68a03   Neeraj Sharma   implement two rou...
306
307
  @import "fullcalendar/dist/fullcalendar.css";
  .fc button {
d8fcf9992   Neeraj Sharma   fixed grey color ...
308
    background: grey !important;
a17c68a03   Neeraj Sharma   implement two rou...
309
310
311
312
313
314
315
316
317
318
319
320
321
322
    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);
  }
6c05a9f84   Neeraj Sharma   add functionalit ...
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
  .iconCard {
    position: relative !important;
    border-radius: 4px;
    z-index: 1;
  }
  .agentIcon {
    position: relative !important;
    border-radius: 4px;
    z-index: 1;
  }
  .farmerIcon {
    position: relative !important;
    border-radius: 4px;
    z-index: 1;
  }
  .khasraIcon {
    position: relative !important;
    border-radius: 4px;
    z-index: 1;
  }
  .maleFarmerIcon {
    position: relative !important;
    border-radius: 4px;
    z-index: 1;
  }
a17c68a03   Neeraj Sharma   implement two rou...
348
  </style>