Blame view

src/pages/Attendence/userAttendence.vue 5.04 KB
687e0b929   Neeraj Sharma   add user,attenden...
1
2
3
4
5
  <template>
    <v-app id="pages-dasboard">
      <!-- ****** EXISTING-USER TABLE DATA****** -->
      <v-card flat>
        <v-card-actions>
d5fcb1cd1   Shikha Mishra   issues resolved
6
          <!-- <v-layout>
687e0b929   Neeraj Sharma   add user,attenden...
7
            <h4 class="right mt-2 ml-2">User Attendence</h4>
860da881d   Shikha Mishra   comment all consoles
8
          </v-layout>-->
687e0b929   Neeraj Sharma   add user,attenden...
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
          <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.joiningDate)}}</td>
          <td id="td" class="text-xs-center">{{ props.item.phone }}</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"
              />
              <!-- <img
                style="cursor:pointer; width:20px; height:18px; "
                class="mr-5"
                @click="editItem(props.item)"
                src="/static/icon/edit1.png"
              />
              <img
                style="cursor:pointer;width:20px; height:20px; "
                class="mr-5"
                @click="deleteItem(props.item)"
                src="/static/icon/delete1.png"
860da881d   Shikha Mishra   comment all consoles
50
              />-->
687e0b929   Neeraj Sharma   add user,attenden...
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
            </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 moment from "moment";
  
  export default {
    data: () => ({
      showLoader: false,
      search: "",
      pagination: {
860da881d   Shikha Mishra   comment all consoles
76
        rowsPerPage: 15,
687e0b929   Neeraj Sharma   add user,attenden...
77
78
79
80
81
82
      },
      headers: [
        {
          text: "No",
          align: "center",
          sortable: false,
860da881d   Shikha Mishra   comment all consoles
83
          value: "No",
687e0b929   Neeraj Sharma   add user,attenden...
84
85
86
87
88
        },
        {
          text: "Profile Pic",
          value: "profilePicUrl",
          sortable: false,
860da881d   Shikha Mishra   comment all consoles
89
          align: "center",
687e0b929   Neeraj Sharma   add user,attenden...
90
91
92
93
94
95
96
97
        },
        { 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: "Joining Date",
          value: "joiningDate",
          sortable: false,
860da881d   Shikha Mishra   comment all consoles
98
          align: "center",
687e0b929   Neeraj Sharma   add user,attenden...
99
100
101
102
103
        },
        {
          text: "Phone",
          value: "phone",
          sortable: false,
860da881d   Shikha Mishra   comment all consoles
104
          align: "center",
687e0b929   Neeraj Sharma   add user,attenden...
105
        },
860da881d   Shikha Mishra   comment all consoles
106
        { text: "Action", value: "", sortable: false, align: "center" },
687e0b929   Neeraj Sharma   add user,attenden...
107
      ],
860da881d   Shikha Mishra   comment all consoles
108
      desserts: [],
687e0b929   Neeraj Sharma   add user,attenden...
109
110
    }),
    methods: {
860da881d   Shikha Mishra   comment all consoles
111
      dates: function (date) {
687e0b929   Neeraj Sharma   add user,attenden...
112
113
114
115
116
117
118
        return moment(date).format("MMMM DD, YYYY");
      },
      getUsersList() {
        this.showLoader = true;
        var token = this.$store.state.token;
        http()
          .get("/getUsersList", {
860da881d   Shikha Mishra   comment all consoles
119
            headers: { Authorization: "Bearer " + token },
687e0b929   Neeraj Sharma   add user,attenden...
120
          })
860da881d   Shikha Mishra   comment all consoles
121
          .then((response) => {
687e0b929   Neeraj Sharma   add user,attenden...
122
123
            this.desserts = response.data.data;
            this.showLoader = false;
860da881d   Shikha Mishra   comment all consoles
124
            //   console.log("UserList=====>", this.desserts);
687e0b929   Neeraj Sharma   add user,attenden...
125
          })
860da881d   Shikha Mishra   comment all consoles
126
          .catch((error) => {
687e0b929   Neeraj Sharma   add user,attenden...
127
128
129
130
131
132
133
134
135
136
137
138
139
            this.showLoader = false;
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
            }
          });
      },
      getRole() {
        this.showLoader = true;
        var token = this.$store.state.token;
        http()
          .get("/getRolesList", {
860da881d   Shikha Mishra   comment all consoles
140
            headers: { Authorization: "Bearer " + token },
687e0b929   Neeraj Sharma   add user,attenden...
141
          })
860da881d   Shikha Mishra   comment all consoles
142
          .then((response) => {
687e0b929   Neeraj Sharma   add user,attenden...
143
144
145
146
            this.userRole = response.data.data;
            this.showLoader = false;
            // console.log("UserList=====>",this.desserts)
          })
860da881d   Shikha Mishra   comment all consoles
147
          .catch((error) => {
687e0b929   Neeraj Sharma   add user,attenden...
148
149
150
151
152
153
154
            this.showLoader = false;
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
            }
          });
860da881d   Shikha Mishra   comment all consoles
155
      },
687e0b929   Neeraj Sharma   add user,attenden...
156
157
158
159
160
161
    },
    mounted() {
      this.getUsersList();
      this.getRole();
    },
    created() {
860da881d   Shikha Mishra   comment all consoles
162
      this.$root.$on("app:search", (search) => {
687e0b929   Neeraj Sharma   add user,attenden...
163
164
165
166
167
168
        this.search = search;
      });
    },
    beforeDestroy() {
      // dont forget to remove the listener
      this.$root.$off("app:search");
860da881d   Shikha Mishra   comment all consoles
169
    },
687e0b929   Neeraj Sharma   add user,attenden...
170
171
172
173
174
175
176
177
178
179
180
  };
  </script>
  <style scoped>
  .active {
    background-color: gray;
    color: white !important;
  }
  .activebtn {
    color: black !important;
  }
  </style>