Blame view

src/pages/Attendence/studentAttendence.vue 5.79 KB
687e0b929   Neeraj Sharma   add user,attenden...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
  <template>
    <div>
      <v-snackbar
        :timeout="timeout"
        :top="y === 'top'"
        :right="x === 'right'"
        :vertical="mode === 'vertical'"
        v-model="snackbar"
        color="success"
      >{{ text }}</v-snackbar>
  
      <!-- ****** EXISTING STUDENTS TABLE ****** -->
  
      <v-card flat>
6ae46ca27   Neeraj Sharma   implement upload ...
15
16
17
        <h4
          class="text-xs-center pt-4 ml-2 hidden-lg-only hidden-xl-only hidden-md-only"
        >Student Attendence</h4>
687e0b929   Neeraj Sharma   add user,attenden...
18
19
        <v-card-actions>
          <v-layout>
6ae46ca27   Neeraj Sharma   implement upload ...
20
21
22
23
            <h3 class="right mt-2 ml-2 hidden-sm-only hidden-xs-only">Student Attendence</h3>
            <!-- <download-csv :data="json_data">
              <v-btn>Download Data</v-btn>
            </download-csv>-->
687e0b929   Neeraj Sharma   add user,attenden...
24
25
          </v-layout>
          <v-spacer></v-spacer>
f4df757fe   Neeraj Sharma   responsive vie in...
26
          <v-flex xs12 sm4 md2>
687e0b929   Neeraj Sharma   add user,attenden...
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
            <v-select
              outline
              small
              :items="addclass"
              label="Select Class"
              v-model="selectStudents.select"
              item-text="classNum"
              item-value="_id"
              name="Select Class"
              @change="getSections(selectStudents.select)"
              class="px-2"
              required
            ></v-select>
          </v-flex>
        </v-card-actions>
      </v-card>
      <v-data-table
        :headers="headers"
        :items="studentsList"
        :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.rollNo}}</td>
          <td id="td" class="text-xs-center">{{ props.item.email }}</td>
          <td class="text-xs-center">
            <router-link :to="{ name:'ViewStudentsAttendence',params: { id:props.item._id } }">
495e4037c   Neeraj Sharma   update
62
63
64
65
66
67
68
69
70
71
72
              <v-tooltip top>
                <img
                  slot="activator"
                  style="cursor:pointer; width:20px; height:18px; "
                  class="mr-5"
                  src="/static/icon/edit1.png"
                />
                <span>Edit</span>
              </v-tooltip>
            </router-link>
            <v-tooltip top>
687e0b929   Neeraj Sharma   add user,attenden...
73
              <img
495e4037c   Neeraj Sharma   update
74
75
76
77
78
                slot="activator"
                style="cursor:pointer; width:20px; height:20px; "
                class="mr5"
                @click="deleteItem(props.item)"
                src="/static/icon/delete1.png"
687e0b929   Neeraj Sharma   add user,attenden...
79
              />
495e4037c   Neeraj Sharma   update
80
81
              <span>Delete</span>
            </v-tooltip>
687e0b929   Neeraj Sharma   add user,attenden...
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
            <!-- </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>
    </div>
  </template>
  
  <script>
  import http from "@/Services/http.js";
c8a795168   Neeraj Sharma   iplement pdf down...
100
  // import Util from "@/util";
687e0b929   Neeraj Sharma   add user,attenden...
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
  import moment from "moment";
  
  export default {
    data: () => ({
      snackbar: false,
      y: "top",
      x: "right",
      mode: "",
      timeout: 3000,
      text: "",
      showLoader: false,
      loading: false,
      date: null,
      search: "",
      addclass: [],
      pagination: {
        rowsPerPage: 15
      },
      imageData: {},
      imageName: "",
      imageUrl: "",
      imageFile: "",
      headers: [
        {
          text: "No",
          align: "center",
          sortable: false,
          value: "index"
        },
        {
          text: "Profile Pic",
          value: "profilprofilePicUrlePicUrl",
          sortable: false,
          align: "center"
        },
        { text: "Name", value: "name", sortable: false, align: "center" },
        { text: "Roll No", value: "rollNo", sortable: false, align: "center" },
        { text: "Email", value: "email", sortable: false, align: "center" },
        { text: "Action", value: "", sortable: false, align: "center" }
      ],
6ae46ca27   Neeraj Sharma   implement upload ...
141
      // json_data: [],
687e0b929   Neeraj Sharma   add user,attenden...
142
143
144
145
146
147
148
149
150
151
      studentsList: [],
      parentId: "",
      token: "",
      selectStudents: {
        select: "",
        selectSection: ""
      }
    }),
    methods: {
      getSections(_id) {
6ae46ca27   Neeraj Sharma   implement upload ...
152
        this.showLoader = true;
687e0b929   Neeraj Sharma   add user,attenden...
153
154
155
156
157
158
159
160
161
162
        var token = this.$store.state.token;
        http()
          .get(
            "/getStudentsList",
            { params: { classId: _id } },
            {
              headers: { Authorization: "Bearer " + token }
            }
          )
          .then(response => {
6ae46ca27   Neeraj Sharma   implement upload ...
163
            this.showLoader = false;
687e0b929   Neeraj Sharma   add user,attenden...
164
165
166
            this.studentsList = response.data.data;
            console.log("getSectionsList=====>", response.data.data);
          })
ab54b5656   Neeraj Sharma   implement library...
167
          .catch(error => {
687e0b929   Neeraj Sharma   add user,attenden...
168
            // console.log("err====>", err);
6ae46ca27   Neeraj Sharma   implement upload ...
169
170
171
172
173
174
            this.showLoader = false;
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
            }
687e0b929   Neeraj Sharma   add user,attenden...
175
176
177
178
179
180
181
182
183
184
185
186
          });
      },
      getAllClass() {
        http()
          .get("/getClassesList", {
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
            this.addclass = response.data.data;
          })
          .catch(err => {
            // console.log("err====>", err);
6ae46ca27   Neeraj Sharma   implement upload ...
187
            // this.$router.replace({ path: "/" });
687e0b929   Neeraj Sharma   add user,attenden...
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
          });
      }
    },
    mounted() {
      // this.getStudentList();
      this.token = this.$store.state.token;
      this.getAllClass();
    },
    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>