Commit 6ae46ca27be1784f6f297854797817ff173a2631
1 parent
a99e002d30
Exists in
master
and in
3 other branches
implement upload cv file of student attendence
Showing
6 changed files
with
168 additions
and
5 deletions
Show diff stats
package-lock.json
... | ... | @@ -5216,6 +5216,11 @@ |
5216 | 5216 | } |
5217 | 5217 | } |
5218 | 5218 | }, |
5219 | + "file-saver": { | |
5220 | + "version": "2.0.2", | |
5221 | + "resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.2.tgz", | |
5222 | + "integrity": "sha512-Wz3c3XQ5xroCxd1G8b7yL0Ehkf0TC9oYC6buPFkNnU9EnaPlifeAFCyCh+iewXTyFRcg0a6j3J7FmJsIhlhBdw==" | |
5223 | + }, | |
5219 | 5224 | "file-uri-to-path": { |
5220 | 5225 | "version": "1.0.0", |
5221 | 5226 | "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", |
... | ... | @@ -10188,6 +10193,11 @@ |
10188 | 10193 | "integrity": "sha512-lQe48YPsMJAig+yngZ87Lus+NF+3mtu7DVOBu6b/gHO1YpKwIj5AWjZ/TOS7i46HD/UixzWb1zeWDZfGZ3iYcg==", |
10189 | 10194 | "dev": true |
10190 | 10195 | }, |
10196 | + "papaparse": { | |
10197 | + "version": "5.1.0", | |
10198 | + "resolved": "https://registry.npmjs.org/papaparse/-/papaparse-5.1.0.tgz", | |
10199 | + "integrity": "sha512-3jEYMiCc8qN7V5ffi2BTS2mRauKxCu5AIED6DxbjnHhIm7OY7fzKYkndfPlHWaaKUDCTml5XTU6V+hiuxGlZuw==" | |
10200 | + }, | |
10191 | 10201 | "parallel-transform": { |
10192 | 10202 | "version": "1.1.0", |
10193 | 10203 | "resolved": "https://registry.npmjs.org/parallel-transform/-/parallel-transform-1.1.0.tgz", |
... | ... | @@ -15510,6 +15520,29 @@ |
15510 | 15520 | "vue-template-es2015-compiler": "^1.5.3" |
15511 | 15521 | } |
15512 | 15522 | }, |
15523 | + "vue-json-csv": { | |
15524 | + "version": "1.2.9", | |
15525 | + "resolved": "https://registry.npmjs.org/vue-json-csv/-/vue-json-csv-1.2.9.tgz", | |
15526 | + "integrity": "sha512-Z+aBIPmev3xOrJvNB8XyetxDMagIUe272pIs6zKKYUGLQemPQO9q4WpZt3YYItOgo4czQj0Jgm38V4w0etPWWQ==", | |
15527 | + "requires": { | |
15528 | + "file-saver": "^2.0.2", | |
15529 | + "lodash": "^4.17.15", | |
15530 | + "papaparse": "^5.0.2", | |
15531 | + "vue": "^2.6.10" | |
15532 | + }, | |
15533 | + "dependencies": { | |
15534 | + "lodash": { | |
15535 | + "version": "4.17.15", | |
15536 | + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", | |
15537 | + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" | |
15538 | + }, | |
15539 | + "vue": { | |
15540 | + "version": "2.6.10", | |
15541 | + "resolved": "https://registry.npmjs.org/vue/-/vue-2.6.10.tgz", | |
15542 | + "integrity": "sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ==" | |
15543 | + } | |
15544 | + } | |
15545 | + }, | |
15513 | 15546 | "vue-loader": { |
15514 | 15547 | "version": "13.7.1", |
15515 | 15548 | "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-13.7.1.tgz", | ... | ... |
package.json
src/main.js
... | ... | @@ -11,6 +11,9 @@ import colors from 'vuetify/es5/util/colors'; |
11 | 11 | import Truncate from 'lodash.truncate'; |
12 | 12 | import store from '@/store/store' |
13 | 13 | import FullCalendar from 'vue-full-calendar'; |
14 | +import JsonCSV from 'vue-json-csv' | |
15 | + | |
16 | +Vue.component('downloadCsv', JsonCSV) | |
14 | 17 | |
15 | 18 | Vue.config.productionTip = false; |
16 | 19 | Vue.use(FullCalendar); | ... | ... |
src/pages/Account/invoice.vue
... | ... | @@ -453,7 +453,7 @@ export default { |
453 | 453 | inchargeRules: [v => !!v || "Student Name is required"], |
454 | 454 | dateRules: [v => !!v || " Date is required"], |
455 | 455 | paymentStatusRules: [v => !!v || "Payment Status is required"], |
456 | - paymentMethodsRules : [v => !!v || "payment Method is required"], | |
456 | + paymentMethodsRules: [v => !!v || "payment Method is required"], | |
457 | 457 | headers: [ |
458 | 458 | { |
459 | 459 | text: "No", |
... | ... | @@ -630,6 +630,7 @@ export default { |
630 | 630 | this.$refs.form.reset(); |
631 | 631 | }, |
632 | 632 | getInvoiceList() { |
633 | + this.showLoader = true; | |
633 | 634 | http() |
634 | 635 | .get("/getInvoicesList", { |
635 | 636 | headers: { Authorization: "Bearer " + this.token } | ... | ... |
src/pages/Attendence/studentAttendence.vue
... | ... | @@ -12,10 +12,15 @@ |
12 | 12 | <!-- ****** EXISTING STUDENTS TABLE ****** --> |
13 | 13 | |
14 | 14 | <v-card flat> |
15 | - <h4 class="text-xs-center pt-4 ml-2 hidden-lg-only hidden-xl-only hidden-md-only">Student Attendence</h4> | |
15 | + <h4 | |
16 | + class="text-xs-center pt-4 ml-2 hidden-lg-only hidden-xl-only hidden-md-only" | |
17 | + >Student Attendence</h4> | |
16 | 18 | <v-card-actions> |
17 | 19 | <v-layout> |
18 | - <h3 class="right mt-2 ml-2 hidden-sm-only hidden-xs-only">Student Attendence</h3> | |
20 | + <h3 class="right mt-2 ml-2 hidden-sm-only hidden-xs-only">Student Attendence</h3> | |
21 | + <!-- <download-csv :data="json_data"> | |
22 | + <v-btn>Download Data</v-btn> | |
23 | + </download-csv>--> | |
19 | 24 | </v-layout> |
20 | 25 | <v-spacer></v-spacer> |
21 | 26 | <v-flex xs12 sm2> |
... | ... | @@ -125,6 +130,7 @@ export default { |
125 | 130 | { text: "Email", value: "email", sortable: false, align: "center" }, |
126 | 131 | { text: "Action", value: "", sortable: false, align: "center" } |
127 | 132 | ], |
133 | + // json_data: [], | |
128 | 134 | studentsList: [], |
129 | 135 | parentId: "", |
130 | 136 | token: "", |
... | ... | @@ -135,6 +141,7 @@ export default { |
135 | 141 | }), |
136 | 142 | methods: { |
137 | 143 | getSections(_id) { |
144 | + this.showLoader = true; | |
138 | 145 | var token = this.$store.state.token; |
139 | 146 | http() |
140 | 147 | .get( |
... | ... | @@ -145,11 +152,18 @@ export default { |
145 | 152 | } |
146 | 153 | ) |
147 | 154 | .then(response => { |
155 | + this.showLoader = false; | |
148 | 156 | this.studentsList = response.data.data; |
149 | 157 | console.log("getSectionsList=====>", response.data.data); |
150 | 158 | }) |
151 | 159 | .catch(err => { |
152 | 160 | // console.log("err====>", err); |
161 | + this.showLoader = false; | |
162 | + if (error.response.status === 401) { | |
163 | + this.$router.replace({ path: "/" }); | |
164 | + this.$store.dispatch("setToken", null); | |
165 | + this.$store.dispatch("Id", null); | |
166 | + } | |
153 | 167 | }); |
154 | 168 | }, |
155 | 169 | getAllClass() { |
... | ... | @@ -162,7 +176,7 @@ export default { |
162 | 176 | }) |
163 | 177 | .catch(err => { |
164 | 178 | // console.log("err====>", err); |
165 | - this.$router.replace({ path: "/" }); | |
179 | + // this.$router.replace({ path: "/" }); | |
166 | 180 | }); |
167 | 181 | } |
168 | 182 | }, | ... | ... |
src/pages/Attendence/viewStudentsAttendence.vue
1 | 1 | <template> |
2 | 2 | <v-container fluid grid-list-md> |
3 | + <v-layout row> | |
4 | + <v-dialog v-model="dialogExport" max-width="500px"> | |
5 | + <v-btn slot="activator" color="grey" class="right" dark> | |
6 | + Export | |
7 | + <v-icon dark right size="20">save_alt</v-icon> | |
8 | + </v-btn> | |
9 | + <v-card> | |
10 | + <h3 class="text-xs-center py-2 grey lighten-1 white--text">Export</h3> | |
11 | + <v-card-text> | |
12 | + <v-container grid-list-md> | |
13 | + <v-layout wrap> | |
14 | + <v-flex xs12> | |
15 | + <!-- <v-text-field label="Email" required></v-text-field> --> | |
16 | + <v-menu | |
17 | + ref="menuStartDate" | |
18 | + :close-on-content-click="false" | |
19 | + v-model="menuStartDate" | |
20 | + :nudge-right="40" | |
21 | + :return-value.sync="startDate" | |
22 | + lazy | |
23 | + transition="scale-transition" | |
24 | + offset-y | |
25 | + full-width | |
26 | + min-width="290px" | |
27 | + > | |
28 | + <v-text-field | |
29 | + slot="activator" | |
30 | + v-model="startDate" | |
31 | + label="Select Start Date" | |
32 | + prepend-icon="event" | |
33 | + readonly | |
34 | + ></v-text-field> | |
35 | + <v-date-picker v-model="startDate" @input="$refs.menuStartDate.save(startDate)"></v-date-picker> | |
36 | + </v-menu> | |
37 | + </v-flex> | |
38 | + <v-flex xs12> | |
39 | + <v-menu | |
40 | + ref="menuEndDate" | |
41 | + :close-on-content-click="false" | |
42 | + v-model="menuEndDate" | |
43 | + :nudge-right="40" | |
44 | + :return-value.sync="endDate" | |
45 | + lazy | |
46 | + transition="scale-transition" | |
47 | + offset-y | |
48 | + full-width | |
49 | + min-width="290px" | |
50 | + > | |
51 | + <v-text-field | |
52 | + slot="activator" | |
53 | + v-model="endDate" | |
54 | + label="Select End Date" | |
55 | + prepend-icon="event" | |
56 | + readonly | |
57 | + ></v-text-field> | |
58 | + <v-date-picker v-model="endDate" @input="$refs.menuEndDate.save(endDate)"></v-date-picker> | |
59 | + </v-menu> | |
60 | + </v-flex> | |
61 | + </v-layout> | |
62 | + </v-container> | |
63 | + </v-card-text> | |
64 | + <v-card-actions> | |
65 | + <v-spacer></v-spacer> | |
66 | + <v-btn color="blue darken-1" flat @click.native="dialogExport = false">Close</v-btn> | |
67 | + <download-csv :data="json_data"> | |
68 | + <v-btn color="blue darken-1" flat @click.native="exportData">Export</v-btn> | |
69 | + </download-csv> | |
70 | + </v-card-actions> | |
71 | + </v-card> | |
72 | + </v-dialog> | |
73 | + </v-layout> | |
3 | 74 | <v-layout wrap> |
4 | 75 | <v-flex xs12 sm4> |
5 | 76 | <v-card flat> |
... | ... | @@ -85,6 +156,9 @@ |
85 | 156 | </v-card> |
86 | 157 | </v-flex> |
87 | 158 | </v-layout> |
159 | + <div class="loader" v-if="showLoader"> | |
160 | + <v-progress-circular indeterminate color="white"></v-progress-circular> | |
161 | + </div> | |
88 | 162 | </v-container> |
89 | 163 | </template> |
90 | 164 | |
... | ... | @@ -98,6 +172,13 @@ export default { |
98 | 172 | data() { |
99 | 173 | return { |
100 | 174 | studentsList: [], |
175 | + json_data: [], | |
176 | + dialogExport: false, | |
177 | + startDate: "", | |
178 | + endDate: "", | |
179 | + menuEndDate: false, | |
180 | + menuStartDate: false, | |
181 | + showLoader: false, | |
101 | 182 | token: "", |
102 | 183 | year: new Date().getFullYear(), |
103 | 184 | activeDates: [], |
... | ... | @@ -115,6 +196,7 @@ export default { |
115 | 196 | return moment(date).format("MMMM DD, YYYY"); |
116 | 197 | }, |
117 | 198 | getStudentAttendence() { |
199 | + this.showLoader = true; | |
118 | 200 | http() |
119 | 201 | .get( |
120 | 202 | "/studentAttendance", |
... | ... | @@ -124,6 +206,7 @@ export default { |
124 | 206 | } |
125 | 207 | ) |
126 | 208 | .then(response => { |
209 | + this.showLoader = false; | |
127 | 210 | let array = []; |
128 | 211 | for (let i = 0; i < response.data.data.length; i++) { |
129 | 212 | if (response.data.data[i].students[0].isPresent == true) { |
... | ... | @@ -142,7 +225,12 @@ export default { |
142 | 225 | }) |
143 | 226 | .catch(err => { |
144 | 227 | console.log("err====>", err); |
145 | - // this.$router.replace({ path: '/' }); | |
228 | + this.showLoader = false; | |
229 | + if (error.response.status === 401) { | |
230 | + this.$router.replace({ path: "/" }); | |
231 | + this.$store.dispatch("setToken", null); | |
232 | + this.$store.dispatch("Id", null); | |
233 | + } | |
146 | 234 | }); |
147 | 235 | }, |
148 | 236 | getStudentData() { |
... | ... | @@ -161,6 +249,29 @@ export default { |
161 | 249 | console.log("err====>", err); |
162 | 250 | // this.$router.replace({ path: '/' }); |
163 | 251 | }); |
252 | + }, | |
253 | + exportData() { | |
254 | + http() | |
255 | + .get( | |
256 | + "/studentAttendanceByMonth", | |
257 | + { | |
258 | + params: { | |
259 | + studentId: this.$route.params.id, | |
260 | + startDate: this.startDate, | |
261 | + endDate: this.endDate | |
262 | + } | |
263 | + }, | |
264 | + { | |
265 | + headers: { Authorization: "Bearer " + this.token } | |
266 | + } | |
267 | + ) | |
268 | + .then(response => { | |
269 | + this.json_data = response.data.data; | |
270 | + }) | |
271 | + .catch(err => { | |
272 | + console.log("err====>", err); | |
273 | + // this.$router.replace({ path: '/' }); | |
274 | + }); | |
164 | 275 | } |
165 | 276 | } |
166 | 277 | }; | ... | ... |