Blame view

src/pages/Attendence/teacherAttendence.vue 3.97 KB
687e0b929   Neeraj Sharma   add user,attenden...
1
2
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
  <template>
    <v-app id="pages-dasboard">
      <!-- ****** EXISTING-Teachers TABLE DATA****** -->
      <v-card flat>
        <v-card-actions>
          <v-layout>
            <h4 class="right mt-2 ml-2">Teacher Attendence</h4>
          </v-layout>
          <v-spacer></v-spacer>
        </v-card-actions>
      </v-card>
      <v-data-table
        :headers="headers"
        :items="desserts"
        :pagination.sync="pagination"
        :search="search"
      >
        <template slot="items" slot-scope="props">
          <td id="td" class="text-xs-center">{{ props.index + 1}}</td>
          <td id="td" class="text-xs-center">
            <v-avatar>
              <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" />
              <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" />
            </v-avatar>
          </td>
          <td id="td" class="text-xs-center">{{ props.item.name}}</td>
          <td id="td" class="text-xs-center">{{ props.item.email }}</td>
          <td id="td" class="text-xs-center">{{ dates(props.item.dob) }}</td>
          <td id="td" class="text-xs-center">{{ dates(props.item.joinDate)}}</td>
          <td id="td" class="text-xs-center">{{ props.item.mobileNo }}</td>
          <td class="text-xs-center">
            <span>
              <img
                style="cursor:pointer; width:25px; height:18px; "
                class="mr-5"
                @click="profile(props.item)"
                src="/static/icon/eye1.png"
              />
            </span>
          </td>
        </template>
        <v-alert
          slot="no-results"
          :value="true"
          color="error"
          icon="warning"
        >Your search for "{{ search }}" found no results.</v-alert>
      </v-data-table>
      <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";
  import moment from "moment";
  
  export default {
    data: () => ({
      showLoader: false,
      search: "",
      pagination: {
        rowsPerPage: 15
      },
      headers: [
        {
          text: "No",
          align: "center",
          sortable: false,
          value: "No"
        },
        {
          text: "Profile Pic",
          value: "profilePicUrl",
          sortable: false,
          align: "center"
        },
        { text: "Name", value: "name", sortable: false, align: "center" },
        { text: "Email", value: "email", sortable: false, align: "center" },
        { text: "DOB", value: "dob", sortable: false, align: "center" },
        {
          text: "Join Date",
          value: "joinDate",
          sortable: false,
          align: "center"
        },
        {
          text: "Mobile No",
          value: "mobileNo",
          sortable: false,
          align: "center"
        },
        { text: "Action", value: "", sortable: false, align: "center" }
      ],
      desserts: []
    }),
    methods: {
      dates: function(date) {
        return moment(date).format("MMMM DD, YYYY");
      },
      getTeacherList() {
        this.showLoader = true;
        var token = this.$store.state.token;
        http()
          .get("/getTeachersList", {
            headers: { Authorization: "Bearer " + token }
          })
          .then(response => {
            this.desserts = response.data.data;
            this.showLoader = false;
            // console.log("getTeacherList=====>",this.desserts)
          })
          .catch(error => {
            this.showLoader = false;
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
            }
          });
      }
    },
    mounted() {
      this.getTeacherList();
    },
    created() {
      this.$root.$on("app:search", search => {
        this.search = search;
      });
    },
    beforeDestroy() {
      // dont forget to remove the listener
      this.$root.$off("app:search");
    }
  };
  </script>
  <style scoped>
  .active {
    background-color: gray;
    color: white !important;
  }
  .activebtn {
    color: black !important;
  }
  </style>