Blame view

src/pages/Dashboard/dashboard.vue 10.6 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>
00e4bc4e1   Neeraj Sharma   fixed auntentication
59
60
61
62
63
64
                  <img
                    src="/static/schoolIcons/Class.png"
                    width="80"
                    class="iconOfDashboard"
                    alt="class"
                  />
6c05a9f84   Neeraj Sharma   add functionalit ...
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
                </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...
85
86
87
      <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...
88
            <!-- <v-toolbar-title class="white--text">Title</v-toolbar-title> -->
a17c68a03   Neeraj Sharma   implement two rou...
89
90
91
92
93
94
95
96
97
            <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...
98
99
              </v-list-tile-action>
              <v-list-tile-content>
a17c68a03   Neeraj Sharma   implement two rou...
100
                <v-list-tile-title>{{ selected.title }}</v-list-tile-title>
8bb178441   Neeraj Sharma   implemnt api in s...
101
102
              </v-list-tile-content>
            </v-list-tile>
a17c68a03   Neeraj Sharma   implement two rou...
103
104
105
106
107
108
            <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...
109
                <!-- <v-list-tile-sub-title>{{ date(selected.end) }}</v-list-tile-sub-title> -->
a17c68a03   Neeraj Sharma   implement two rou...
110
111
112
113
114
              </v-list-tile-content>
            </v-list-tile>
          </v-flex>
        </v-card>
      </v-dialog>
8bb178441   Neeraj Sharma   implemnt api in s...
115
116
117
118
119
120
121
122
123
      <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...
124
  import moment from "moment";
8bb178441   Neeraj Sharma   implemnt api in s...
125
126
  
  export default {
a17c68a03   Neeraj Sharma   implement two rou...
127
128
129
130
    data() {
      return {
        showLoader: false,
        dialog: false,
b28a5f17d   Neeraj Sharma   fixed events and ...
131
132
        HolidaysList: [],
        EventsList: [],
ceb43037a   Neeraj Sharma   fix bugs
133
        events: [],
a17c68a03   Neeraj Sharma   implement two rou...
134
135
136
137
        config: {
          eventClick: event => {
            this.selected = event;
            this.dialog = true;
8bb178441   Neeraj Sharma   implemnt api in s...
138
139
          }
        },
6c05a9f84   Neeraj Sharma   add functionalit ...
140
141
142
143
144
        selected: {},
        students: "",
        parents: "",
        teachers: "",
        classes: ""
a17c68a03   Neeraj Sharma   implement two rou...
145
146
      };
    },
6c05a9f84   Neeraj Sharma   add functionalit ...
147
148
149
150
151
152
153
154
    mounted() {
      this.token = this.$store.state.token;
      this.getData();
      this.getStudents();
      this.getTeachers();
      this.getParents();
      this.getClasses();
    },
8bb178441   Neeraj Sharma   implemnt api in s...
155
    methods: {
a17c68a03   Neeraj Sharma   implement two rou...
156
157
      date: function(date) {
        return moment(date).format("MMMM DD, YYYY  HH:mm:ss");
8bb178441   Neeraj Sharma   implemnt api in s...
158
      },
a17c68a03   Neeraj Sharma   implement two rou...
159
160
161
162
163
164
165
166
167
      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...
168
        console.log("this.selected", this.selected);
a17c68a03   Neeraj Sharma   implement two rou...
169
      },
687e0b929   Neeraj Sharma   add user,attenden...
170
171
172
      // eventDropStart: function(event) {
      //   event.editable = false;
      // },
a17c68a03   Neeraj Sharma   implement two rou...
173
174
      eventCreated(...test) {
        console.log(test);
8bb178441   Neeraj Sharma   implemnt api in s...
175
      },
687e0b929   Neeraj Sharma   add user,attenden...
176
      getData() {
db0c39244   Neeraj Sharma   implement event a...
177
178
179
180
181
182
183
        this.showLoader = true;
        var token = this.$store.state.token;
        http()
          .get("/getHolidaysList", {
            headers: { Authorization: "Bearer " + token }
          })
          .then(response => {
b28a5f17d   Neeraj Sharma   fixed events and ...
184
185
            this.HolidaysList = response.data.data;
            // this.events = response.data.data;
db0c39244   Neeraj Sharma   implement event a...
186
187
188
189
190
191
192
193
194
            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);
00e4bc4e1   Neeraj Sharma   fixed auntentication
195
              this.$store.dispatch("Role", null);
db0c39244   Neeraj Sharma   implement event a...
196
197
            }
          });
b28a5f17d   Neeraj Sharma   fixed events and ...
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
        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);
00e4bc4e1   Neeraj Sharma   fixed auntentication
216
              this.$store.dispatch("Role", null);
b28a5f17d   Neeraj Sharma   fixed events and ...
217
218
            }
          });
6c05a9f84   Neeraj Sharma   add functionalit ...
219
220
221
222
223
224
225
226
227
228
      },
      getStudents() {
        http()
          .get("/getStudentsList", {
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
            this.students = response.data.data;
            this.showLoader = false;
          })
00e4bc4e1   Neeraj Sharma   fixed auntentication
229
          .catch(error => {
6c05a9f84   Neeraj Sharma   add functionalit ...
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
            // 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;
          })
00e4bc4e1   Neeraj Sharma   fixed auntentication
248
          .catch(error => {
6c05a9f84   Neeraj Sharma   add functionalit ...
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
            // 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;
          })
00e4bc4e1   Neeraj Sharma   fixed auntentication
267
          .catch(error => {
6c05a9f84   Neeraj Sharma   add functionalit ...
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
            // 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;
          })
00e4bc4e1   Neeraj Sharma   fixed auntentication
286
          .catch(error => {
6c05a9f84   Neeraj Sharma   add functionalit ...
287
288
289
290
291
            this.showLoader = false;
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
00e4bc4e1   Neeraj Sharma   fixed auntentication
292
              this.$store.dispatch("Role", null);
6c05a9f84   Neeraj Sharma   add functionalit ...
293
294
            }
          });
8bb178441   Neeraj Sharma   implemnt api in s...
295
      }
db0c39244   Neeraj Sharma   implement event a...
296
297
298
299
300
301
302
303
304
305
306
307
      // 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...
308
309
310
    }
  };
  </script>
687e0b929   Neeraj Sharma   add user,attenden...
311

8bb178441   Neeraj Sharma   implemnt api in s...
312
  <style>
a17c68a03   Neeraj Sharma   implement two rou...
313
314
  @import "fullcalendar/dist/fullcalendar.css";
  .fc button {
d8fcf9992   Neeraj Sharma   fixed grey color ...
315
    background: grey !important;
a17c68a03   Neeraj Sharma   implement two rou...
316
317
318
319
320
321
322
323
324
325
326
327
328
329
    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 ...
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
  .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...
355
  </style>