Blame view
src/pages/Attendence/studentAttendence.vue
5.88 KB
687e0b929
|
1 |
<template> |
68d742034
|
2 |
<v-container fluid class="body-color"> |
687e0b929
|
3 4 5 6 7 8 9 10 |
<v-snackbar :timeout="timeout" :top="y === 'top'" :right="x === 'right'" :vertical="mode === 'vertical'" v-model="snackbar" color="success" >{{ text }}</v-snackbar> |
68d742034
|
11 12 |
<!-- ****** ATTENDENCE STUDENTS TABLE ****** --> <!-- <download-csv :data="json_data"> |
6ae46ca27
|
13 |
<v-btn>Download Data</v-btn> |
68d742034
|
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
</download-csv>--> <v-toolbar color="transparent" flat> <v-spacer></v-spacer> <v-flex xs12 sm4 md2> <v-select 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-title class="body-1" v-show="show"> <v-btn icon large flat @click="displaySearch"> <v-avatar size="27"> |
aa310d61a
|
34 |
<img src="/static/icon/search.png" alt="icon" /> |
68d742034
|
35 36 37 38 39 40 41 |
</v-avatar> </v-btn> </v-card-title> <v-flex xs8 sm8 md3 lg2 v-show="showSearch"> <v-layout> <v-text-field v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> <v-icon @click="closeSearch" color="error">close</v-icon> |
687e0b929
|
42 |
</v-layout> |
68d742034
|
43 44 |
</v-flex> </v-toolbar> |
687e0b929
|
45 46 47 48 49 50 51 |
<v-data-table :headers="headers" :items="studentsList" :pagination.sync="pagination" :search="search" > <template slot="items" slot-scope="props"> |
68d742034
|
52 53 54 55 56 57 58 59 60 61 62 63 |
<tr class="tr"> <td class="td td-row">{{ props.index + 1}}</td> <td class="text-xs-center td td-row"> <v-avatar size="40"> <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 class="text-xs-center td td-row">{{ props.item.name}}</td> <td class="text-xs-center td td-row">{{ props.item.rollNo}}</td> <td class="text-xs-center td td-row">{{ props.item.email }}</td> <td class="text-xs-center td td-row"> |
2fe1115d8
|
64 |
<router-link :to="{ name:'View Students Attendence',params: { id:props.item._id } }"> |
68d742034
|
65 66 67 68 69 |
<v-tooltip top> <img slot="activator" style="cursor:pointer; width:20px; height:25px; " class="mr-3" |
aa310d61a
|
70 |
src="/static/icon/view.png" |
68d742034
|
71 |
/> |
67a276510
|
72 |
<span>View</span> |
68d742034
|
73 74 |
</v-tooltip> </router-link> |
495e4037c
|
75 76 77 |
<v-tooltip top> <img slot="activator" |
68d742034
|
78 79 80 |
style="cursor:pointer; width:20px; height:20px; " @click="deleteItem(props.item)" class="mr-3" |
aa310d61a
|
81 |
src="/static/icon/delete.png" |
495e4037c
|
82 |
/> |
68d742034
|
83 |
<span>Delete</span> |
495e4037c
|
84 |
</v-tooltip> |
68d742034
|
85 86 |
</td> </tr> |
687e0b929
|
87 88 89 90 91 92 93 94 95 96 97 |
</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> |
68d742034
|
98 |
</v-container> |
687e0b929
|
99 100 101 102 |
</template> <script> import http from "@/Services/http.js"; |
687e0b929
|
103 104 105 106 107 108 109 110 111 112 |
import moment from "moment"; export default { data: () => ({ snackbar: false, y: "top", x: "right", mode: "", timeout: 3000, text: "", |
68d742034
|
113 114 |
show: true, showSearch: false, |
687e0b929
|
115 116 117 118 119 120 |
showLoader: false, loading: false, date: null, search: "", addclass: [], pagination: { |
68d742034
|
121 |
rowsPerPage: 10 |
687e0b929
|
122 123 124 125 126 127 128 129 |
}, imageData: {}, imageName: "", imageUrl: "", imageFile: "", headers: [ { text: "No", |
68d742034
|
130 |
align: "", |
687e0b929
|
131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
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
|
145 |
// json_data: [], |
687e0b929
|
146 147 148 149 150 151 152 153 154 155 |
studentsList: [], parentId: "", token: "", selectStudents: { select: "", selectSection: "" } }), methods: { getSections(_id) { |
6ae46ca27
|
156 |
this.showLoader = true; |
687e0b929
|
157 158 159 160 161 162 163 164 165 166 |
var token = this.$store.state.token; http() .get( "/getStudentsList", { params: { classId: _id } }, { headers: { Authorization: "Bearer " + token } } ) .then(response => { |
6ae46ca27
|
167 |
this.showLoader = false; |
687e0b929
|
168 |
this.studentsList = response.data.data; |
687e0b929
|
169 |
}) |
ab54b5656
|
170 |
.catch(error => { |
6ae46ca27
|
171 172 173 174 175 176 |
this.showLoader = false; if (error.response.status === 401) { this.$router.replace({ path: "/" }); this.$store.dispatch("setToken", null); this.$store.dispatch("Id", null); } |
687e0b929
|
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; }) |
68d742034
|
187 |
.catch(error => { |
687e0b929
|
188 |
// console.log("err====>", err); |
6ae46ca27
|
189 |
// this.$router.replace({ path: "/" }); |
687e0b929
|
190 |
}); |
68d742034
|
191 192 193 194 195 196 197 198 |
}, displaySearch() { (this.show = false), (this.showSearch = true); }, closeSearch() { this.showSearch = false; this.show = true; this.search = ""; |
687e0b929
|
199 200 201 202 203 204 |
} }, mounted() { // this.getStudentList(); this.token = this.$store.state.token; this.getAllClass(); |
687e0b929
|
205 206 |
} }; |
68d742034
|
207 |
</script> |