Commit 058c4a6cfda687de3476b3813c86b1f084f365b4
1 parent
1fb26113b8
Exists in
master
and in
2 other branches
Improve the functionality of applying for the exam attendance, Hide Mpin functio…
…nality from parent screen only admin can change the Mpin of parent, Hide delete functionality from library screen only admin can delete library books, Solved issues while doing one round of testing
Showing
7 changed files
with
444 additions
and
223 deletions
Show diff stats
src/pages/Class/addclass.vue
... | ... | @@ -35,7 +35,7 @@ |
35 | 35 | <v-icon size="24" class="right" @click="profileClassDialog = false">cancel</v-icon> |
36 | 36 | </v-flex> |
37 | 37 | </v-layout> |
38 | - <v-card-text> | |
38 | + <v-card-text> | |
39 | 39 | <v-container grid-list-md> |
40 | 40 | <v-layout wrap> |
41 | 41 | <v-flex xs6 sm6> |
... | ... | @@ -127,7 +127,7 @@ |
127 | 127 | src="/static/icon/delete.png" |
128 | 128 | /> |
129 | 129 | <span>Delete</span> |
130 | - </v-tooltip> --> | |
130 | + </v-tooltip>--> | |
131 | 131 | </span> |
132 | 132 | </td> |
133 | 133 | </tr> |
... | ... | @@ -222,28 +222,28 @@ export default { |
222 | 222 | profileClassDialog: false, |
223 | 223 | valid: true, |
224 | 224 | pagination: { |
225 | - rowsPerPage: 10 | |
225 | + rowsPerPage: 10, | |
226 | 226 | }, |
227 | - nameRules: [v => !!v || " Class Name is required"], | |
227 | + nameRules: [(v) => !!v || " Class Name is required"], | |
228 | 228 | headers: [ |
229 | 229 | { |
230 | 230 | text: "No", |
231 | 231 | align: "left", |
232 | 232 | sortable: false, |
233 | - value: "No" | |
233 | + value: "No", | |
234 | 234 | }, |
235 | 235 | { text: "Class No", value: "classNum", sortable: false, align: "center" }, |
236 | 236 | |
237 | - { text: "Action", value: "", sortable: false, align: "center" } | |
237 | + { text: "Action", value: "", sortable: false, align: "center" }, | |
238 | 238 | ], |
239 | 239 | classList: [], |
240 | 240 | editedIndex: -1, |
241 | 241 | editedItem: { |
242 | - classNum: "" | |
242 | + classNum: "", | |
243 | 243 | }, |
244 | 244 | addclasses: { |
245 | - classNum: "" | |
246 | - } | |
245 | + classNum: "", | |
246 | + }, | |
247 | 247 | }), |
248 | 248 | methods: { |
249 | 249 | getClassList() { |
... | ... | @@ -251,11 +251,11 @@ export default { |
251 | 251 | var token = this.$store.state.token; |
252 | 252 | http() |
253 | 253 | .get("/getClassesList") |
254 | - .then(response => { | |
254 | + .then((response) => { | |
255 | 255 | this.classList = response.data.data; |
256 | 256 | this.showLoader = false; |
257 | 257 | }) |
258 | - .catch(error => { | |
258 | + .catch((error) => { | |
259 | 259 | this.showLoader = false; |
260 | 260 | if (error.response.status === 401) { |
261 | 261 | this.$router.replace({ path: "/" }); |
... | ... | @@ -276,22 +276,22 @@ export default { |
276 | 276 | }, |
277 | 277 | deleteItem(item) { |
278 | 278 | let deleteStudent = { |
279 | - classId: item._id | |
279 | + classId: item._id, | |
280 | 280 | }; |
281 | 281 | http() |
282 | 282 | .delete( |
283 | 283 | "/deleteClass", |
284 | 284 | confirm("Are you sure you want to delete this?") && { |
285 | - params: deleteStudent | |
285 | + params: deleteStudent, | |
286 | 286 | } |
287 | 287 | ) |
288 | - .then(response => { | |
288 | + .then((response) => { | |
289 | 289 | this.snackbar = true; |
290 | 290 | this.text = response.data.message; |
291 | 291 | this.color = "green"; |
292 | 292 | this.getClassList(); |
293 | 293 | }) |
294 | - .catch(error => { | |
294 | + .catch((error) => { | |
295 | 295 | this.snackbar = true; |
296 | 296 | this.color = "error"; |
297 | 297 | this.text = error.response.data.message; |
... | ... | @@ -306,21 +306,21 @@ export default { |
306 | 306 | submit() { |
307 | 307 | if (this.$refs.form.validate()) { |
308 | 308 | let addClass = { |
309 | - classNum: this.addclasses.classNum | |
309 | + classNum: this.addclasses.classNum, | |
310 | 310 | }; |
311 | 311 | this.loading = true; |
312 | 312 | http() |
313 | 313 | .post("/createClass", addClass) |
314 | - .then(response => { | |
314 | + .then((response) => { | |
315 | 315 | this.getClassList(); |
316 | 316 | this.snackbar = true; |
317 | 317 | this.text = response.data.message; |
318 | - this.color = "green" | |
318 | + this.color = "green"; | |
319 | 319 | this.clear(); |
320 | 320 | this.loading = false; |
321 | 321 | this.addClassDialog = false; |
322 | 322 | }) |
323 | - .catch(error => { | |
323 | + .catch((error) => { | |
324 | 324 | this.loading = false; |
325 | 325 | this.snackbar = true; |
326 | 326 | this.color = "error"; |
... | ... | @@ -334,18 +334,18 @@ export default { |
334 | 334 | save() { |
335 | 335 | let editClass = { |
336 | 336 | classId: this.editedItem._id, |
337 | - classNum: this.editedItem.classNum | |
337 | + classNum: this.editedItem.classNum, | |
338 | 338 | }; |
339 | 339 | http() |
340 | 340 | .put("/updateClass", editClass) |
341 | - .then(response => { | |
341 | + .then((response) => { | |
342 | 342 | this.snackbar = true; |
343 | 343 | this.text = response.data.message; |
344 | 344 | this.color = "green"; |
345 | 345 | this.getClassList(); |
346 | 346 | this.close(); |
347 | 347 | }) |
348 | - .catch(error => { | |
348 | + .catch((error) => { | |
349 | 349 | this.snackbar = true; |
350 | 350 | this.text = error.response.data.message; |
351 | 351 | this.color = "error"; |
... | ... | @@ -359,11 +359,11 @@ export default { |
359 | 359 | this.showSearch = false; |
360 | 360 | this.show = true; |
361 | 361 | this.search = ""; |
362 | - } | |
362 | + }, | |
363 | 363 | }, |
364 | 364 | mounted() { |
365 | 365 | this.getClassList(); |
366 | - } | |
366 | + }, | |
367 | 367 | // created() { |
368 | 368 | // this.$root.$on("app:search", search => { |
369 | 369 | // this.search = search; | ... | ... |
src/pages/Course/enrollStudents.vue
src/pages/Dashboard/dashboard.vue
... | ... | @@ -780,7 +780,6 @@ export default { |
780 | 780 | }; |
781 | 781 | }, |
782 | 782 | |
783 | - | |
784 | 783 | methods: { |
785 | 784 | test(e) { |
786 | 785 | console.log(" test - ", e); |
... | ... | @@ -918,7 +917,6 @@ export default { |
918 | 917 | if (this.$store.state.role === "PARENT") { |
919 | 918 | http() |
920 | 919 | .get("/getParticularUserDetail", { |
921 | - | |
922 | 920 | params: { |
923 | 921 | studentId: localStorage.getItem("parentStudentId"), |
924 | 922 | }, |
... | ... | @@ -982,7 +980,7 @@ export default { |
982 | 980 | // await http() |
983 | 981 | // .get("/parentStudentsList") |
984 | 982 | // .then((response) => { |
985 | - | |
983 | + | |
986 | 984 | // /* set values in local storage */ |
987 | 985 | // this.studentsData = response.data.data.students; |
988 | 986 | // this.showLoader = false; |
... | ... | @@ -1044,7 +1042,6 @@ export default { |
1044 | 1042 | }); |
1045 | 1043 | } |
1046 | 1044 | }, |
1047 | - | |
1048 | 1045 | }, |
1049 | 1046 | |
1050 | 1047 | mounted() { |
... | ... | @@ -1072,12 +1069,12 @@ export default { |
1072 | 1069 | // this.token = this.$store.state.token; |
1073 | 1070 | // await this.getparentStudents(); |
1074 | 1071 | this.studentsData = this.$store.getters.GET_STUDENTS_DATA; |
1075 | - console.log("students data - ",this.studentsData) | |
1076 | - await this.getCourses(); | |
1072 | + console.log("students data - ", this.studentsData); | |
1073 | + await this.getCourses(); | |
1077 | 1074 | await this.getAnnoucementes(); |
1078 | 1075 | } |
1079 | 1076 | this.role = this.$store.state.role; |
1080 | - | |
1077 | + | |
1081 | 1078 | await this.getStudents(); |
1082 | 1079 | await this.getTeachers(); |
1083 | 1080 | await this.getParents(); |
... | ... | @@ -1118,4 +1115,7 @@ export default { |
1118 | 1115 | a { |
1119 | 1116 | color: white; |
1120 | 1117 | } |
1118 | + | |
1119 | +#pages-dasboard { | |
1120 | +} | |
1121 | 1121 | </style> |
1122 | 1122 | \ No newline at end of file | ... | ... |
src/pages/Exam/examAttendence.vue
... | ... | @@ -84,6 +84,7 @@ |
84 | 84 | </v-toolbar> |
85 | 85 | |
86 | 86 | <v-data-table |
87 | + v-if="showData" | |
87 | 88 | :headers="headers" |
88 | 89 | :items="examData.students" |
89 | 90 | :pagination.sync="pagination" |
... | ... | @@ -94,19 +95,26 @@ |
94 | 95 | <td class="td td-row">{{ props.index + 1}}</td> |
95 | 96 | <td class="text-xs-center td td-row"> |
96 | 97 | <v-avatar size="40"> |
97 | - <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> | |
98 | - <img src="/static/icon/user.png" v-else-if="!props.item.profilePicUrl" /> | |
98 | + <img | |
99 | + :src="props.item.studentId.profilePicUrl" | |
100 | + v-if="props.item.studentId.profilePicUrl" | |
101 | + /> | |
102 | + <img src="/static/icon/user.png" v-else-if="!props.item.studentId.profilePicUrl" /> | |
99 | 103 | </v-avatar> |
100 | 104 | </td> |
101 | 105 | <td class="td td-row text-xs-center">{{ props.item.studentId.name}}</td> |
102 | 106 | <td class="td td-row text-xs-center">{{ props.item.studentId.rollNo}}</td> |
103 | 107 | <td class="td td-row text-xs-center">{{ props.item.studentId.email }}</td> |
104 | 108 | <td class="td td-row text-xs-center"> |
105 | - <v-radio-group v-model="isPresent" row readonly> | |
106 | - <v-radio | |
107 | - :value="props.item.isPresent" | |
108 | - ></v-radio> | |
109 | - </v-radio-group> | |
109 | + <!-- <v-radio-group v-model="isPresent" row> | |
110 | + <v-radio :value="props.item.isPresent"></v-radio> | |
111 | + </v-radio-group>--> | |
112 | + <v-checkbox | |
113 | + v-model="props.item.isPresent" | |
114 | + @click="markStudentAttendence(props.item)" | |
115 | + primary | |
116 | + hide-details | |
117 | + ></v-checkbox> | |
110 | 118 | </td> |
111 | 119 | </tr> |
112 | 120 | </template> |
... | ... | @@ -118,13 +126,58 @@ |
118 | 126 | >Your search for "{{ search }}" found no results.</v-alert> |
119 | 127 | </v-data-table> |
120 | 128 | |
129 | + <!-- ****** ADD Student Attendence ****** --> | |
130 | + <v-dialog v-model="changeStudentAttendenceDialog" max-width="500px"> | |
131 | + <v-card flat> | |
132 | + <v-layout class="pa-3 card-style white--text"> | |
133 | + <v-flex xs12> | |
134 | + <label class="title text-xs-center">Change Student's Attendence</label> | |
135 | + <v-icon | |
136 | + size="24" | |
137 | + class="right white--text" | |
138 | + @click="changeStudentAttendenceDialog = false" | |
139 | + >cancel</v-icon> | |
140 | + </v-flex> | |
141 | + </v-layout> | |
142 | + <v-container fluid> | |
143 | + <v-flex xs12> | |
144 | + <h3>Are you sure you want to change the attendence</h3> | |
145 | + </v-flex> | |
146 | + <v-spacer></v-spacer> | |
147 | + | |
148 | + <v-flex xs12> | |
149 | + <v-card-actions> | |
150 | + <v-spacer></v-spacer> | |
151 | + <v-btn | |
152 | + @click.native="closeStudentAttendenceDialog" | |
153 | + round | |
154 | + dark | |
155 | + class="clear-button" | |
156 | + >cancel</v-btn> | |
157 | + <v-btn | |
158 | + @click="selectParticularStudent" | |
159 | + round | |
160 | + dark | |
161 | + :loading="loading" | |
162 | + class="add-button" | |
163 | + >Yes</v-btn> | |
164 | + </v-card-actions> | |
165 | + </v-flex> | |
166 | + </v-container> | |
167 | + </v-card> | |
168 | + </v-dialog> | |
169 | + | |
121 | 170 | <!-- ****** ADD Exam Attendence ****** --> |
122 | 171 | <v-dialog v-model="addExamAttendenceDialog" max-width="800px"> |
123 | - <v-card flat class="text-xs-center pa-2"> | |
124 | - <v-layout> | |
172 | + <v-card flat> | |
173 | + <v-layout class="pa-3 card-style white--text"> | |
125 | 174 | <v-flex xs12> |
126 | 175 | <label class="title text-xs-center">Add Exam Attendence</label> |
127 | - <v-icon size="24" class="right" @click="addExamAttendenceDialog = false">cancel</v-icon> | |
176 | + <v-icon | |
177 | + size="24" | |
178 | + class="right white--text" | |
179 | + @click="addExamAttendenceDialog = false" | |
180 | + >cancel</v-icon> | |
128 | 181 | </v-flex> |
129 | 182 | </v-layout> |
130 | 183 | <v-form ref="form" v-model="valid" lazy-validation class="text-xs-center"> |
... | ... | @@ -223,14 +276,25 @@ |
223 | 276 | </v-form> |
224 | 277 | <v-flex xs12 v-show="attendeceTable" class> |
225 | 278 | <v-data-table |
226 | - :headers="headers" | |
279 | + :headers="studentheader" | |
227 | 280 | :items="studentsData" |
228 | 281 | :pagination.sync="pagination" |
229 | 282 | :search="search" |
283 | + select-all | |
284 | + v-model="selected" | |
285 | + item-key="_id" | |
230 | 286 | > |
231 | 287 | <template slot="items" slot-scope="props"> |
232 | 288 | <tr class="tr"> |
233 | - <td class="td td-row">{{ props.index + 1}}</td> | |
289 | + <!-- <td class="td td-row">{{ props.index + 1}}</td> --> | |
290 | + <td class="td td-row"> | |
291 | + <v-checkbox | |
292 | + v-model="props.item.attendence" | |
293 | + @change="markParticularStudentAttendence(props.item)" | |
294 | + primary | |
295 | + hide-details | |
296 | + ></v-checkbox> | |
297 | + </td> | |
234 | 298 | <td class="text-xs-center td td-row"> |
235 | 299 | <v-avatar size="40"> |
236 | 300 | <img :src="props.item.profilePicUrl" v-if="props.item.profilePicUrl" /> |
... | ... | @@ -240,7 +304,7 @@ |
240 | 304 | <td class="td td-row text-xs-center">{{ props.item.name}}</td> |
241 | 305 | <td class="td td-row text-xs-center">{{ props.item.rollNo}}</td> |
242 | 306 | <td class="td td-row text-xs-center">{{ props.item.email }}</td> |
243 | - <td class="td td-row text-xs-center"> | |
307 | + <!-- <td class="td td-row text-xs-center"> | |
244 | 308 | <v-radio-group v-model="props.item.attendence" :mandatory="false" row> |
245 | 309 | <v-radio |
246 | 310 | v-for="attendences in attendenceType" |
... | ... | @@ -249,7 +313,29 @@ |
249 | 313 | :value="attendences.value" |
250 | 314 | ></v-radio> |
251 | 315 | </v-radio-group> |
252 | - </td> | |
316 | + </td>--> | |
317 | + </tr> | |
318 | + </template> | |
319 | + <template slot="headers" slot-scope="props"> | |
320 | + <tr> | |
321 | + <th> | |
322 | + <v-checkbox | |
323 | + :input-value="props.all" | |
324 | + :indeterminate="props.indeterminate" | |
325 | + primary | |
326 | + hide-details | |
327 | + @click.native="selectAll" | |
328 | + ></v-checkbox> | |
329 | + </th> | |
330 | + <th | |
331 | + v-for="header in props.headers" | |
332 | + :key="header.text" | |
333 | + :class="['column sortable', pagination.descending ? 'desc' : 'asc', header.value === pagination.sortBy ? 'active' : '']" | |
334 | + @click="changeSort(header.value)" | |
335 | + > | |
336 | + <v-icon small>arrow_upward</v-icon> | |
337 | + {{ header.text }} | |
338 | + </th> | |
253 | 339 | </tr> |
254 | 340 | </template> |
255 | 341 | <v-alert |
... | ... | @@ -311,19 +397,19 @@ export default { |
311 | 397 | valid: true, |
312 | 398 | role: "", |
313 | 399 | pagination: { |
314 | - rowsPerPage: 10 | |
400 | + rowsPerPage: 10, | |
315 | 401 | }, |
316 | 402 | attendeceTable: false, |
317 | 403 | isPresent: true, |
318 | 404 | |
319 | - examRules: [v => !!v || "Exam Name is required"], | |
320 | - classRules: [v => !!v || "Class Name is required"], | |
321 | - sectionRules: [v => !!v || "section is required"], | |
322 | - subjectRules: [v => !!v || "Subject is required"], | |
323 | - timeInRules: [v => !!v || "Time In is required"], | |
324 | - timeOutRules: [v => !!v || "time Out s is required"], | |
325 | - roomRules: [v => !!v || "Room is required"], | |
326 | - examScheduleDateRules: [v => !!v || "Date is required"], | |
405 | + examRules: [(v) => !!v || "Exam Name is required"], | |
406 | + classRules: [(v) => !!v || "Class Name is required"], | |
407 | + sectionRules: [(v) => !!v || "section is required"], | |
408 | + subjectRules: [(v) => !!v || "Subject is required"], | |
409 | + timeInRules: [(v) => !!v || "Time In is required"], | |
410 | + timeOutRules: [(v) => !!v || "time Out s is required"], | |
411 | + roomRules: [(v) => !!v || "Room is required"], | |
412 | + examScheduleDateRules: [(v) => !!v || "Date is required"], | |
327 | 413 | studentsData: [], |
328 | 414 | examData: [], |
329 | 415 | students: [], |
... | ... | @@ -333,44 +419,70 @@ export default { |
333 | 419 | align: "", |
334 | 420 | text: "No", |
335 | 421 | sortable: false, |
336 | - value: "No" | |
422 | + value: "No", | |
337 | 423 | }, |
338 | 424 | { |
339 | 425 | text: "Profile Pic", |
340 | - value: "profilprofilePicUrlePicUrl", | |
426 | + value: "profilePicUrl", | |
341 | 427 | sortable: false, |
342 | - align: "center" | |
428 | + align: "center", | |
343 | 429 | }, |
344 | 430 | { |
345 | 431 | text: "Name", |
346 | 432 | value: "name", |
347 | 433 | sortable: false, |
348 | - align: "center" | |
434 | + align: "center", | |
349 | 435 | }, |
350 | 436 | { |
351 | 437 | text: "Roll No", |
352 | 438 | value: "rollNo", |
353 | 439 | sortable: false, |
354 | - align: "center" | |
440 | + align: "center", | |
355 | 441 | }, |
356 | 442 | { |
357 | 443 | text: "Email", |
358 | 444 | value: "email", |
359 | 445 | sortable: false, |
360 | - align: "center" | |
446 | + align: "center", | |
361 | 447 | }, |
362 | 448 | { |
363 | 449 | text: "Action", |
364 | - value: "", | |
450 | + value: "isPresent", | |
365 | 451 | sortable: false, |
366 | - align: "center" | |
367 | - } | |
452 | + align: "center", | |
453 | + }, | |
454 | + ], | |
455 | + studentheader: [ | |
456 | + { | |
457 | + text: "Profile Pic", | |
458 | + value: "profilePicUrl", | |
459 | + sortable: false, | |
460 | + align: "center", | |
461 | + }, | |
462 | + { | |
463 | + text: "Name", | |
464 | + value: "name", | |
465 | + sortable: false, | |
466 | + align: "center", | |
467 | + }, | |
468 | + { | |
469 | + text: "Roll No", | |
470 | + value: "rollNo", | |
471 | + sortable: false, | |
472 | + align: "center", | |
473 | + }, | |
474 | + { | |
475 | + text: "Email", | |
476 | + value: "email", | |
477 | + sortable: false, | |
478 | + align: "center", | |
479 | + }, | |
368 | 480 | ], |
369 | 481 | attendenceType: [ |
370 | 482 | { |
371 | 483 | label: "", |
372 | - value: true | |
373 | - } | |
484 | + value: true, | |
485 | + }, | |
374 | 486 | ], |
375 | 487 | classList: [], |
376 | 488 | addSection: [], |
... | ... | @@ -381,30 +493,45 @@ export default { |
381 | 493 | getAttendence: {}, |
382 | 494 | editedItem: { |
383 | 495 | sectionId: { |
384 | - name: "" | |
385 | - } | |
496 | + name: "", | |
497 | + }, | |
386 | 498 | }, |
387 | 499 | getScheduleData: {}, |
388 | 500 | ScheduleData: [], |
389 | - token: "" | |
501 | + token: "", | |
502 | + showData: false, | |
503 | + selected: [], | |
504 | + changeStudentAttendenceDialog: false, | |
505 | + closeStudentAttendenceDialog() { | |
506 | + this.changeStudentAttendenceDialog = false; | |
507 | + }, | |
508 | + selectedStudent: {}, | |
509 | + presentStudent: [], | |
510 | + absentStudent: [], | |
390 | 511 | }), |
391 | 512 | methods: { |
392 | 513 | pickFile() { |
393 | 514 | this.$refs.image.click(); |
394 | 515 | }, |
516 | + markStudentAttendence(item) { | |
517 | + this.selectedStudent = { | |
518 | + id: item.studentId._id, | |
519 | + isPresent: !item.isPresent, | |
520 | + }; | |
521 | + this.changeStudentAttendenceDialog = true; | |
522 | + }, | |
395 | 523 | getSchedulesList() { |
396 | 524 | this.showLoader = true; |
397 | 525 | http() |
398 | 526 | .get("/getSchedulesList", { |
399 | 527 | params: { classId: this.getScheduleData.classId }, |
400 | - headers: { Authorization: "Bearer " + this.token } | |
528 | + headers: { Authorization: "Bearer " + this.token }, | |
401 | 529 | }) |
402 | - .then(response => { | |
530 | + .then((response) => { | |
403 | 531 | this.ScheduleData = response.data.data; |
404 | - // console.log("this.ScheduleData", this.ScheduleData); | |
405 | 532 | this.showLoader = false; |
406 | 533 | }) |
407 | - .catch(error => { | |
534 | + .catch((error) => { | |
408 | 535 | // console.log("err====>", err); |
409 | 536 | this.showLoader = false; |
410 | 537 | this.loadingSearch = false; |
... | ... | @@ -426,27 +553,31 @@ export default { |
426 | 553 | classId: this.addAttendence.classId, |
427 | 554 | sectionId: this.addAttendence.sectionId, |
428 | 555 | subjectId: this.addAttendence.subjectId, |
429 | - students: [] | |
556 | + students: [], | |
430 | 557 | }; |
431 | - for (var j = 0; j < this.studentsData.length; j++) { | |
432 | - console.log("studentdata", this.studentsData); | |
558 | + for (var j = 0; j < this.presentStudent.length; j++) { | |
559 | + examAttendence.students.push({ | |
560 | + studentId: this.presentStudent[j], | |
561 | + isPresent: true, | |
562 | + }); | |
563 | + } | |
564 | + for (var j = 0; j < this.absentStudent.length; j++) { | |
433 | 565 | examAttendence.students.push({ |
434 | - studentId: this.studentsData[j]._id, | |
435 | - isPresent: this.studentsData[j].attendence | |
566 | + studentId: this.absentStudent[j], | |
567 | + isPresent: false, | |
436 | 568 | }); |
437 | 569 | } |
438 | - console.log("attendence", examAttendence); | |
439 | 570 | if (this.$refs.form.validate()) { |
440 | 571 | http() |
441 | 572 | .post("/createExamAttendance", examAttendence) |
442 | - .then(response => { | |
573 | + .then((response) => { | |
443 | 574 | this.snackbar = true; |
444 | 575 | this.color = "success"; |
445 | 576 | this.text = "Successfully created exam attendence"; |
446 | 577 | this.addExamAttendenceDialog = false; |
447 | 578 | // this.getExamAttendenceList(); |
448 | 579 | }) |
449 | - .catch(error => { | |
580 | + .catch((error) => { | |
450 | 581 | this.snackbar = true; |
451 | 582 | this.text = error.response.data.message; |
452 | 583 | }); |
... | ... | @@ -460,12 +591,12 @@ export default { |
460 | 591 | getClass() { |
461 | 592 | http() |
462 | 593 | .get("/getClassesList", { |
463 | - headers: { Authorization: "Bearer " + this.token } | |
594 | + headers: { Authorization: "Bearer " + this.token }, | |
464 | 595 | }) |
465 | - .then(response => { | |
596 | + .then((response) => { | |
466 | 597 | this.classList = response.data.data; |
467 | 598 | }) |
468 | - .catch(err => { | |
599 | + .catch((err) => { | |
469 | 600 | // console.log("err====>", err); |
470 | 601 | }); |
471 | 602 | }, |
... | ... | @@ -480,13 +611,13 @@ export default { |
480 | 611 | "/getSectionsList", |
481 | 612 | { params: { classId: _id } }, |
482 | 613 | { |
483 | - headers: { Authorization: "Bearer " + this.token } | |
614 | + headers: { Authorization: "Bearer " + this.token }, | |
484 | 615 | } |
485 | 616 | ) |
486 | - .then(response => { | |
617 | + .then((response) => { | |
487 | 618 | this.addSection = response.data.data; |
488 | 619 | }) |
489 | - .catch(err => {}); | |
620 | + .catch((err) => {}); | |
490 | 621 | }, |
491 | 622 | getClassSubject(_id) { |
492 | 623 | this.showLoader = true; |
... | ... | @@ -496,14 +627,14 @@ export default { |
496 | 627 | "/getParticularClass", |
497 | 628 | { params: { classId: _id } }, |
498 | 629 | { |
499 | - headers: { Authorization: "Bearer " + this.token } | |
630 | + headers: { Authorization: "Bearer " + this.token }, | |
500 | 631 | } |
501 | 632 | ) |
502 | - .then(response => { | |
633 | + .then((response) => { | |
503 | 634 | this.subjectList = response.data.data; |
504 | 635 | this.showLoader = false; |
505 | 636 | }) |
506 | - .catch(err => { | |
637 | + .catch((err) => { | |
507 | 638 | this.showLoader = false; |
508 | 639 | }); |
509 | 640 | }, |
... | ... | @@ -512,14 +643,14 @@ export default { |
512 | 643 | this.loadingSearch = true; |
513 | 644 | http() |
514 | 645 | .get("/getExamsList", { |
515 | - headers: { Authorization: "Bearer " + this.token } | |
646 | + headers: { Authorization: "Bearer " + this.token }, | |
516 | 647 | }) |
517 | - .then(response => { | |
648 | + .then((response) => { | |
518 | 649 | this.examList = response.data.data; |
519 | 650 | this.showLoader = false; |
520 | 651 | this.loadingSearch = false; |
521 | 652 | }) |
522 | - .catch(error => { | |
653 | + .catch((error) => { | |
523 | 654 | this.showLoader = false; |
524 | 655 | this.loadingSearch = false; |
525 | 656 | this.snackbar = true; |
... | ... | @@ -541,10 +672,10 @@ export default { |
541 | 672 | .get("/getStudentWithClass", { |
542 | 673 | params: { |
543 | 674 | classId: this.addAttendence.classId, |
544 | - sectionId: this.addAttendence.sectionId | |
545 | - } | |
675 | + sectionId: this.addAttendence.sectionId, | |
676 | + }, | |
546 | 677 | }) |
547 | - .then(response => { | |
678 | + .then((response) => { | |
548 | 679 | this.studentsData = response.data.data; |
549 | 680 | this.showLoader = false; |
550 | 681 | // this.addExamAttendenceDialog = false; |
... | ... | @@ -553,7 +684,7 @@ export default { |
553 | 684 | this.studentsData[i].attendence = false; |
554 | 685 | } |
555 | 686 | }) |
556 | - .catch(err => { | |
687 | + .catch((err) => { | |
557 | 688 | console.log("err====>", err); |
558 | 689 | this.showLoader = false; |
559 | 690 | }); |
... | ... | @@ -566,18 +697,106 @@ export default { |
566 | 697 | examId: this.getAttendence.examId, |
567 | 698 | classId: this.getAttendence.classId, |
568 | 699 | sectionId: this.getAttendence.sectionId, |
569 | - subjectId: this.getAttendence.subjectId | |
570 | - } | |
700 | + subjectId: this.getAttendence.subjectId, | |
701 | + }, | |
571 | 702 | }) |
572 | - .then(response => { | |
573 | - this.examData = response.data.data[0]; | |
703 | + .then((response) => { | |
704 | + this.examData = response.data.data; | |
705 | + if (this.examData.length === 0) { | |
706 | + this.showLoader = false; | |
707 | + this.snackbar = true; | |
708 | + this.text = "No Attendence found!"; | |
709 | + this.color = "error"; | |
710 | + return; | |
711 | + } | |
712 | + this.examData = this.examData[0]; | |
713 | + // if (this.examData.students.length === 0) { | |
714 | + // this.showLoader = false; | |
715 | + // this.snackbar = true; | |
716 | + // this.text = "No Students found!"; | |
717 | + // this.color = "error"; | |
718 | + // return; | |
719 | + // } | |
720 | + this.showData = true; | |
574 | 721 | this.showLoader = false; |
575 | 722 | }) |
576 | - .catch(error => { | |
723 | + .catch((error) => { | |
577 | 724 | console.log("error", error); |
578 | 725 | this.showLoader = false; |
579 | 726 | }); |
580 | 727 | }, |
728 | + markParticularStudentAttendence(selected) { | |
729 | + if (selected.attendence) { | |
730 | + this.selected.push(selected); | |
731 | + } else { | |
732 | + for (var i = 0; i < this.selected.length; i++) { | |
733 | + if (this.selected[i]._id === selected._id) { | |
734 | + this.selected.splice(i, 1); | |
735 | + break; | |
736 | + } | |
737 | + } | |
738 | + } | |
739 | + let presentIndex = this.presentStudent.indexOf(selected._id); | |
740 | + let absentIndex = this.absentStudent.push(selected._id); | |
741 | + if (presentIndex > -1) { | |
742 | + this.presentStudent.splice(presentIndex, 1); | |
743 | + this.absentStudent.push(selected._id); | |
744 | + } else { | |
745 | + if (absentIndex > -1) { | |
746 | + this.absentStudent.splice(absentIndex, 1); | |
747 | + } | |
748 | + this.presentStudent.push(selected._id); | |
749 | + } | |
750 | + }, | |
751 | + selectAll() { | |
752 | + let markAbsent = false; | |
753 | + if (this.selected.length === this.studentsData.length) markAbsent = true; | |
754 | + | |
755 | + this.presentStudent = []; | |
756 | + this.absentStudent = []; | |
757 | + this.selected = []; | |
758 | + | |
759 | + for (let i = 0; i < this.studentsData.length; i++) { | |
760 | + if (markAbsent) { | |
761 | + this.studentsData[i].attendence = false; | |
762 | + this.absentStudent.push(this.studentsData[i]._id); | |
763 | + } else { | |
764 | + this.studentsData[i].attendence = true; | |
765 | + this.presentStudent.push(this.studentsData[i]._id); | |
766 | + this.selected.push(this.studentsData[i]); | |
767 | + } | |
768 | + } | |
769 | + }, | |
770 | + selectParticularStudent(_id) { | |
771 | + var payload = { | |
772 | + examAttendanceId: this.examData._id, | |
773 | + studentId: this.selectedStudent.id, | |
774 | + isPresent: this.selectedStudent.isPresent, | |
775 | + }; | |
776 | + | |
777 | + http() | |
778 | + .put("/updateExamAttendance", payload) | |
779 | + .then((response) => { | |
780 | + this.snackbar = true; | |
781 | + this.color = "success"; | |
782 | + this.text = "Successfully change attendence"; | |
783 | + this.changeStudentAttendenceDialog = false; | |
784 | + this.selectedStudent = {}; | |
785 | + this.getExamAttendenceList(); | |
786 | + }) | |
787 | + .catch((error) => { | |
788 | + this.snackbar = true; | |
789 | + this.text = error.response.data.message; | |
790 | + }); | |
791 | + }, | |
792 | + changeSort(column) { | |
793 | + if (this.pagination.sortBy === column) { | |
794 | + this.pagination.descending = !this.pagination.descending; | |
795 | + } else { | |
796 | + this.pagination.sortBy = column; | |
797 | + this.pagination.descending = false; | |
798 | + } | |
799 | + }, | |
581 | 800 | displaySearch() { |
582 | 801 | (this.show = false), (this.showSearch = true); |
583 | 802 | }, |
... | ... | @@ -585,13 +804,13 @@ export default { |
585 | 804 | this.showSearch = false; |
586 | 805 | this.show = true; |
587 | 806 | this.search = ""; |
588 | - } | |
807 | + }, | |
589 | 808 | }, |
590 | 809 | mounted() { |
591 | 810 | this.token = this.$store.state.token; |
592 | 811 | this.getClass(); |
593 | 812 | this.getExamList(); |
594 | 813 | this.role = this.$store.state.role; |
595 | - } | |
814 | + }, | |
596 | 815 | }; |
597 | 816 | </script> |
598 | 817 | \ No newline at end of file | ... | ... |
src/pages/Library/books.vue
... | ... | @@ -215,14 +215,14 @@ |
215 | 215 | <td class="td td-row text-xs-center">{{ props.item.quantity }}</td> |
216 | 216 | <td class="td td-row text-xs-center">{{ props.item.rackNo }}</td> |
217 | 217 | <td class="td td-row text-xs-center"> |
218 | - <span | |
219 | - v-if="props.item.status === 'AVAILABLE'" | |
220 | - class="green lighten-1 pa-1 px-2 white--text paymentStatus" | |
221 | - >{{ props.item.status}}</span> | |
222 | - <span | |
223 | - v-if="props.item.status === 'UNAVAILABLE'" | |
224 | - class="red lighten-1 pa-1 px-2 white--text paymentStatus" | |
225 | - >{{ props.item.status}}</span> | |
218 | + <span | |
219 | + v-if="props.item.status === 'AVAILABLE'" | |
220 | + class="green lighten-1 pa-1 px-2 white--text paymentStatus" | |
221 | + >{{ props.item.status}}</span> | |
222 | + <span | |
223 | + v-if="props.item.status === 'UNAVAILABLE'" | |
224 | + class="red lighten-1 pa-1 px-2 white--text paymentStatus" | |
225 | + >{{ props.item.status}}</span> | |
226 | 226 | </td> |
227 | 227 | <td class="text-xs-center td td-row"> |
228 | 228 | <span> |
... | ... | @@ -235,7 +235,7 @@ |
235 | 235 | src="/static/icon/view.png" |
236 | 236 | /> |
237 | 237 | <span>View</span> |
238 | - </v-tooltip> --> | |
238 | + </v-tooltip>--> | |
239 | 239 | <v-tooltip top> |
240 | 240 | <img |
241 | 241 | slot="activator" |
... | ... | @@ -246,7 +246,7 @@ |
246 | 246 | /> |
247 | 247 | <span>Edit</span> |
248 | 248 | </v-tooltip> |
249 | - <v-tooltip top> | |
249 | + <v-tooltip top v-if="role != 'TEACHER' "> | |
250 | 250 | <img |
251 | 251 | slot="activator" |
252 | 252 | style="cursor:pointer; width:20px; height:20px; " |
... | ... | @@ -413,47 +413,47 @@ export default { |
413 | 413 | validEdit: true, |
414 | 414 | addBookDialog: false, |
415 | 415 | pagination: { |
416 | - rowsPerPage: 10 | |
416 | + rowsPerPage: 10, | |
417 | 417 | }, |
418 | - nameRules: [v => !!v || " Name is required"], | |
419 | - authorRules: [v => !!v || "Author Name Monthly"], | |
420 | - subjectRules: [v => !!v || "Subject Code is required"], | |
421 | - priceRules: [v => !!v || "Price is required"], | |
422 | - quantityRules: [v => !!v || "Quantity is required"], | |
423 | - rackNoRules: [v => !!v || "Rack No. is required"], | |
418 | + nameRules: [(v) => !!v || " Name is required"], | |
419 | + authorRules: [(v) => !!v || "Author Name Monthly"], | |
420 | + subjectRules: [(v) => !!v || "Subject Code is required"], | |
421 | + priceRules: [(v) => !!v || "Price is required"], | |
422 | + quantityRules: [(v) => !!v || "Quantity is required"], | |
423 | + rackNoRules: [(v) => !!v || "Rack No. is required"], | |
424 | 424 | |
425 | 425 | headers: [ |
426 | 426 | { |
427 | 427 | text: "No", |
428 | 428 | align: "", |
429 | 429 | sortable: false, |
430 | - value: "No" | |
430 | + value: "No", | |
431 | 431 | }, |
432 | 432 | { |
433 | 433 | text: "Name", |
434 | 434 | value: "name", |
435 | 435 | sortable: false, |
436 | - align: "center" | |
436 | + align: "center", | |
437 | 437 | }, |
438 | 438 | { text: "Authour", value: "author", sortable: false, align: "center" }, |
439 | 439 | { |
440 | 440 | text: "Subject Code", |
441 | 441 | value: "subjectCode", |
442 | 442 | sortable: false, |
443 | - align: "center" | |
443 | + align: "center", | |
444 | 444 | }, |
445 | 445 | { text: "Price", value: "price", sortable: false, align: "center" }, |
446 | 446 | { text: "Quantity", value: "quantity", sortable: false, align: "center" }, |
447 | 447 | { text: "Rack No", value: "rackNo", sortable: false, align: "center" }, |
448 | 448 | { text: "Status", value: "status", sortable: false, align: "center" }, |
449 | 449 | |
450 | - { text: "Action", value: "", sortable: false, align: "center" } | |
450 | + { text: "Action", value: "", sortable: false, align: "center" }, | |
451 | 451 | ], |
452 | 452 | bookData: [], |
453 | 453 | select: "", |
454 | 454 | token: "", |
455 | 455 | editedItem: {}, |
456 | - BooksData: {} | |
456 | + BooksData: {}, | |
457 | 457 | }), |
458 | 458 | methods: { |
459 | 459 | getBookData() { |
... | ... | @@ -461,15 +461,15 @@ export default { |
461 | 461 | http() |
462 | 462 | .get("/getBooksList", { |
463 | 463 | params: { |
464 | - schoolId: this.$store.state.schoolId | |
464 | + schoolId: this.$store.state.schoolId, | |
465 | 465 | }, |
466 | - headers: { Authorization: "Bearer " + this.token } | |
466 | + headers: { Authorization: "Bearer " + this.token }, | |
467 | 467 | }) |
468 | - .then(response => { | |
468 | + .then((response) => { | |
469 | 469 | this.bookData = response.data.data; |
470 | 470 | this.showLoader = false; |
471 | 471 | }) |
472 | - .catch(error => { | |
472 | + .catch((error) => { | |
473 | 473 | this.showLoader = false; |
474 | 474 | if (error.response.status === 401) { |
475 | 475 | this.$router.replace({ path: "/" }); |
... | ... | @@ -491,22 +491,22 @@ export default { |
491 | 491 | }, |
492 | 492 | deleteItem(item) { |
493 | 493 | let deleteStudent = { |
494 | - bookId: item._id | |
494 | + bookId: item._id, | |
495 | 495 | }; |
496 | 496 | http() |
497 | 497 | .delete( |
498 | 498 | "/deleteBook", |
499 | 499 | confirm("Are you sure you want to delete this?") && { |
500 | - params: deleteStudent | |
500 | + params: deleteStudent, | |
501 | 501 | } |
502 | 502 | ) |
503 | - .then(response => { | |
503 | + .then((response) => { | |
504 | 504 | this.snackbar = true; |
505 | 505 | this.text = response.data.message; |
506 | 506 | this.color = "green"; |
507 | 507 | this.getBookData(); |
508 | 508 | }) |
509 | - .catch(error => { | |
509 | + .catch((error) => { | |
510 | 510 | this.snackbar = true; |
511 | 511 | this.text = error.response.data.message; |
512 | 512 | this.color = "error"; |
... | ... | @@ -525,7 +525,7 @@ export default { |
525 | 525 | this.loading = true; |
526 | 526 | http() |
527 | 527 | .post("/createBook", this.BooksData) |
528 | - .then(response => { | |
528 | + .then((response) => { | |
529 | 529 | this.getBookData(); |
530 | 530 | this.snackbar = true; |
531 | 531 | this.text = response.data.message; |
... | ... | @@ -534,7 +534,7 @@ export default { |
534 | 534 | this.clear(); |
535 | 535 | this.loading = false; |
536 | 536 | }) |
537 | - .catch(error => { | |
537 | + .catch((error) => { | |
538 | 538 | this.snackbar = true; |
539 | 539 | this.text = error.response.data.message; |
540 | 540 | this.color = "error"; |
... | ... | @@ -549,14 +549,14 @@ export default { |
549 | 549 | this.editedItem.bookId = this.editedItem._id; |
550 | 550 | http() |
551 | 551 | .put("/updateBook", this.editedItem) |
552 | - .then(response => { | |
552 | + .then((response) => { | |
553 | 553 | this.snackbar = true; |
554 | 554 | this.text = response.data.message; |
555 | 555 | this.color = "green"; |
556 | 556 | this.getBookData(); |
557 | 557 | this.closeEditProfile(); |
558 | 558 | }) |
559 | - .catch(error => { | |
559 | + .catch((error) => { | |
560 | 560 | this.snackbar = true; |
561 | 561 | this.text = error.response.data.message; |
562 | 562 | this.color = "error"; |
... | ... | @@ -570,11 +570,12 @@ export default { |
570 | 570 | this.showSearch = false; |
571 | 571 | this.show = true; |
572 | 572 | this.search = ""; |
573 | - } | |
573 | + }, | |
574 | 574 | }, |
575 | 575 | mounted() { |
576 | 576 | this.token = this.$store.state.token; |
577 | 577 | this.getBookData(); |
578 | - } | |
578 | + this.role = this.$store.state.role; | |
579 | + }, | |
579 | 580 | }; |
580 | 581 | </script> | ... | ... |
src/pages/Library/eBook.vue
... | ... | @@ -180,18 +180,18 @@ |
180 | 180 | </v-layout> |
181 | 181 | </v-flex> |
182 | 182 | </v-layout> |
183 | - <v-flex xs12 sm12> | |
184 | - <v-layout> | |
185 | - <v-flex xs6 sm6> | |
186 | - <h5 class="right my-1"> | |
187 | - <b>Class:</b> | |
188 | - </h5> | |
189 | - </v-flex> | |
190 | - <v-flex sm6 xs6> | |
191 | - <h5 class="my-1 left">{{ editedItem.classId .classNum}}</h5> | |
192 | - </v-flex> | |
193 | - </v-layout> | |
194 | - </v-flex> | |
183 | + <v-flex xs12 sm12> | |
184 | + <v-layout> | |
185 | + <v-flex xs6 sm6> | |
186 | + <h5 class="right my-1"> | |
187 | + <b>Class:</b> | |
188 | + </h5> | |
189 | + </v-flex> | |
190 | + <v-flex sm6 xs6> | |
191 | + <h5 class="my-1 left">{{ editedItem.classId .classNum}}</h5> | |
192 | + </v-flex> | |
193 | + </v-layout> | |
194 | + </v-flex> | |
195 | 195 | </v-container> |
196 | 196 | </v-card> |
197 | 197 | </v-dialog> |
... | ... | @@ -270,7 +270,7 @@ |
270 | 270 | /> |
271 | 271 | <span>Edit</span> |
272 | 272 | </v-tooltip> |
273 | - <v-tooltip top> | |
273 | + <v-tooltip top v-if="role != 'TEACHER' "> | |
274 | 274 | <img |
275 | 275 | slot="activator" |
276 | 276 | style="cursor:pointer; width:20px; height:20px; " |
... | ... | @@ -459,7 +459,7 @@ export default { |
459 | 459 | addClass: [], |
460 | 460 | addSection: [], |
461 | 461 | pagination: { |
462 | - rowsPerPage: 10 | |
462 | + rowsPerPage: 10, | |
463 | 463 | }, |
464 | 464 | imageName: "", |
465 | 465 | fileName: "", |
... | ... | @@ -469,18 +469,18 @@ export default { |
469 | 469 | upload: "", |
470 | 470 | files: "", |
471 | 471 | anyFile: "", |
472 | - titleRules: [v => !!v || " Tilte is required"], | |
473 | - descriptionRules: [v => !!v || " Description is required"], | |
474 | - uploadImageRule: [v => !!v || " field is required"], | |
475 | - uploadFileRule: [v => !!v || " fied is required"], | |
476 | - uploadPrivateRule: [v => !!v || " fied is required"], | |
472 | + titleRules: [(v) => !!v || " Tilte is required"], | |
473 | + descriptionRules: [(v) => !!v || " Description is required"], | |
474 | + uploadImageRule: [(v) => !!v || " field is required"], | |
475 | + uploadFileRule: [(v) => !!v || " fied is required"], | |
476 | + uploadPrivateRule: [(v) => !!v || " fied is required"], | |
477 | 477 | |
478 | 478 | headers: [ |
479 | 479 | { |
480 | 480 | align: "left", |
481 | 481 | text: "No", |
482 | 482 | sortable: false, |
483 | - value: "No" | |
483 | + value: "No", | |
484 | 484 | }, |
485 | 485 | { text: "Photo", vaue: "fileUrl", sortable: false, align: "center" }, |
486 | 486 | { text: "Name", vaue: "name", sortable: false, align: "center" }, |
... | ... | @@ -489,27 +489,27 @@ export default { |
489 | 489 | text: "Class", |
490 | 490 | value: "classId", |
491 | 491 | sortable: false, |
492 | - align: "center" | |
492 | + align: "center", | |
493 | 493 | }, |
494 | - { text: "Action", value: "", sortable: false, align: "center" } | |
494 | + { text: "Action", value: "", sortable: false, align: "center" }, | |
495 | 495 | ], |
496 | 496 | eBookData: [], |
497 | 497 | editedIndex: -1, |
498 | 498 | addEBooks: { |
499 | - private: false | |
499 | + private: false, | |
500 | 500 | }, |
501 | 501 | editedItem: {}, |
502 | 502 | editedItem: { |
503 | 503 | classId: { |
504 | - classNum: "" | |
505 | - } | |
504 | + classNum: "", | |
505 | + }, | |
506 | 506 | }, |
507 | 507 | token: "", |
508 | 508 | uploadCover: {}, |
509 | 509 | editImageName: "", |
510 | 510 | editFiles: "", |
511 | 511 | editAnyFile: "", |
512 | - editFileName: "" | |
512 | + editFileName: "", | |
513 | 513 | }), |
514 | 514 | methods: { |
515 | 515 | editPickImage() { |
... | ... | @@ -571,13 +571,13 @@ export default { |
571 | 571 | http() |
572 | 572 | .get("/getEBooksList", { |
573 | 573 | params: { schoolId: this.$store.state.schoolId }, |
574 | - headers: { Authorization: "Bearer " + this.token } | |
574 | + headers: { Authorization: "Bearer " + this.token }, | |
575 | 575 | }) |
576 | - .then(response => { | |
576 | + .then((response) => { | |
577 | 577 | this.eBookData = response.data.data; |
578 | 578 | this.showLoader = false; |
579 | 579 | }) |
580 | - .catch(error => { | |
580 | + .catch((error) => { | |
581 | 581 | // console.log("err====>", err); |
582 | 582 | this.showLoader = false; |
583 | 583 | if (error.response.status === 401) { |
... | ... | @@ -641,21 +641,21 @@ export default { |
641 | 641 | }, |
642 | 642 | deleteItem(item) { |
643 | 643 | let deleteEBooks = { |
644 | - ebookId: item._id | |
644 | + ebookId: item._id, | |
645 | 645 | }; |
646 | 646 | http() |
647 | 647 | .delete( |
648 | 648 | "/deleteEBook", |
649 | 649 | confirm("Are you sure you want to delete this?") && { |
650 | - params: deleteEBooks | |
650 | + params: deleteEBooks, | |
651 | 651 | } |
652 | 652 | ) |
653 | - .then(response => { | |
653 | + .then((response) => { | |
654 | 654 | this.snackbar = true; |
655 | 655 | this.text = "Successfully delete Existing News"; |
656 | 656 | this.getEBooksList(); |
657 | 657 | }) |
658 | - .catch(error => { | |
658 | + .catch((error) => { | |
659 | 659 | this.snackbar = true; |
660 | 660 | this.text = error.response.data.message; |
661 | 661 | }); |
... | ... | @@ -687,11 +687,11 @@ export default { |
687 | 687 | author: this.addEBooks.author, |
688 | 688 | private: this.addEBooks.private, |
689 | 689 | uploadCover: uploadCover, |
690 | - uploadFile: uploadFile | |
690 | + uploadFile: uploadFile, | |
691 | 691 | }; |
692 | 692 | http() |
693 | 693 | .post("/createEBook", data) |
694 | - .then(response => { | |
694 | + .then((response) => { | |
695 | 695 | this.getEBooksList(); |
696 | 696 | // this.getEBooksList = []; |
697 | 697 | this.addEBookDialog = false; |
... | ... | @@ -701,7 +701,7 @@ export default { |
701 | 701 | this.loading = false; |
702 | 702 | (this.imageName = ""), (this.fileName = ""); |
703 | 703 | }) |
704 | - .catch(error => { | |
704 | + .catch((error) => { | |
705 | 705 | this.snackbar = true; |
706 | 706 | this.text = error.response.data.message; |
707 | 707 | this.color = "red"; |
... | ... | @@ -733,7 +733,7 @@ export default { |
733 | 733 | console.log("this.editedItem", this.editedItem); |
734 | 734 | http() |
735 | 735 | .put("/updateEBook", this.editedItem) |
736 | - .then(response => { | |
736 | + .then((response) => { | |
737 | 737 | this.loadingUpadte = false; |
738 | 738 | this.snackbar = true; |
739 | 739 | this.text = "Successfully Edit Existing E-Book"; |
... | ... | @@ -745,7 +745,7 @@ export default { |
745 | 745 | this.files = ""; |
746 | 746 | this.close(); |
747 | 747 | }) |
748 | - .catch(error => { | |
748 | + .catch((error) => { | |
749 | 749 | this.editLoading = false; |
750 | 750 | this.loadingUpadte = false; |
751 | 751 | this.snackbar = true; |
... | ... | @@ -756,12 +756,12 @@ export default { |
756 | 756 | getAllClass() { |
757 | 757 | http() |
758 | 758 | .get("/getClassesList", { |
759 | - headers: { Authorization: "Bearer " + this.token } | |
759 | + headers: { Authorization: "Bearer " + this.token }, | |
760 | 760 | }) |
761 | - .then(response => { | |
761 | + .then((response) => { | |
762 | 762 | this.addClass = response.data.data; |
763 | 763 | }) |
764 | - .catch(err => { | |
764 | + .catch((err) => { | |
765 | 765 | // console.log("err====>", err); |
766 | 766 | // this.$router.replace({ path: "/" }); |
767 | 767 | }); |
... | ... | @@ -773,14 +773,15 @@ export default { |
773 | 773 | this.showSearch = false; |
774 | 774 | this.show = true; |
775 | 775 | this.search = ""; |
776 | - } | |
776 | + }, | |
777 | 777 | }, |
778 | 778 | mounted() { |
779 | 779 | this.token = this.$store.state.token; |
780 | 780 | this.getEBooksList(); |
781 | 781 | this.getAllClass(); |
782 | + this.role = this.$store.state.role; | |
782 | 783 | // this.getBookData(); |
783 | 784 | // this.editItem; |
784 | - } | |
785 | + }, | |
785 | 786 | }; |
786 | 787 | </script> |
787 | 788 | \ No newline at end of file | ... | ... |
src/pages/Parent/parents.vue
... | ... | @@ -308,7 +308,7 @@ |
308 | 308 | </v-layout> |
309 | 309 | </v-card-text> |
310 | 310 | </v-card> |
311 | - </v-dialog> | |
311 | + </v-dialog> | |
312 | 312 | |
313 | 313 | <!-- ****** PROFILE VIEW Parents DEATILS ****** --> |
314 | 314 | |
... | ... | @@ -544,9 +544,10 @@ |
544 | 544 | /> |
545 | 545 | <span>Edit</span> |
546 | 546 | </v-tooltip> |
547 | - <span> | |
548 | - <i class="material-icons md-18" | |
549 | - style="cursor:pointer; width:20px; height:18px;" | |
547 | + <span v-if="role === 'ADMIN' "> | |
548 | + <i | |
549 | + class="material-icons md-18" | |
550 | + style="cursor:pointer; width:20px; height:18px;" | |
550 | 551 | @click="resetParentMPIN(props.item)" |
551 | 552 | >vpn_key</i> |
552 | 553 | </span> |
... | ... | @@ -913,67 +914,67 @@ export default { |
913 | 914 | validEditParent: true, |
914 | 915 | validParentMpin: true, |
915 | 916 | pagination: { |
916 | - rowsPerPage: 10 | |
917 | + rowsPerPage: 10, | |
917 | 918 | }, |
918 | - fatherNameRules: [v => !!v || " Father Name is required"], | |
919 | + fatherNameRules: [(v) => !!v || " Father Name is required"], | |
919 | 920 | fatheCellNoRules: [ |
920 | - v => !!v || " father Cell Number is required", | |
921 | - v => v <= 10000000000 || "Max 10 characters is required" | |
921 | + (v) => !!v || " father Cell Number is required", | |
922 | + (v) => v <= 10000000000 || "Max 10 characters is required", | |
922 | 923 | ], |
923 | 924 | password: [ |
924 | - v => !!v || "Password field is Required." | |
925 | + (v) => !!v || "Password field is Required.", | |
925 | 926 | // v => (/^(?=.*[a-z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/).test(v) && v.length >= 8 || 'Min 8 characters lower case symbol required' |
926 | 927 | ], |
927 | 928 | editFatherNoRule: [ |
928 | - v => !!v || " father Cell Number is required", | |
929 | - v => v <= 10000000000 || "Max 10 characters is required" | |
929 | + (v) => !!v || " father Cell Number is required", | |
930 | + (v) => v <= 10000000000 || "Max 10 characters is required", | |
930 | 931 | ], |
931 | 932 | |
932 | - editfatherCellNo: [v => !!v || " Father Name is required"], | |
933 | + editfatherCellNo: [(v) => !!v || " Father Name is required"], | |
933 | 934 | errorMessages: "", |
934 | 935 | emailRules: [ |
935 | - v => !!v || "E-mail is required", | |
936 | - v => | |
936 | + (v) => !!v || "E-mail is required", | |
937 | + (v) => | |
937 | 938 | /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(v) || |
938 | - "E-mail must be valid" | |
939 | + "E-mail must be valid", | |
939 | 940 | ], |
940 | 941 | mPinRules: [ |
941 | - v => !!v || "MPIN is required", | |
942 | - v => v <= 10000 || "Max 4 numbers are required" | |
942 | + (v) => !!v || "MPIN is required", | |
943 | + (v) => v <= 10000 || "Max 4 numbers are required", | |
943 | 944 | ], |
944 | 945 | headers: [ |
945 | 946 | { |
946 | 947 | text: "No", |
947 | 948 | align: "center", |
948 | 949 | sortable: false, |
949 | - value: "No" | |
950 | + value: "No", | |
950 | 951 | }, |
951 | 952 | { text: "Email", value: "email", sortable: false, align: "center" }, |
952 | 953 | { |
953 | 954 | text: "Father Name", |
954 | 955 | value: "fatherName", |
955 | 956 | sortable: false, |
956 | - align: "center" | |
957 | + align: "center", | |
957 | 958 | }, |
958 | 959 | { |
959 | 960 | text: "Father Cell No", |
960 | 961 | value: "fatherName", |
961 | 962 | sortable: false, |
962 | - align: "center" | |
963 | + align: "center", | |
963 | 964 | }, |
964 | 965 | { |
965 | 966 | text: "Mother Name", |
966 | 967 | value: "motherName", |
967 | 968 | sortable: false, |
968 | - align: "center" | |
969 | + align: "center", | |
969 | 970 | }, |
970 | 971 | { |
971 | 972 | text: "Mother Cell No", |
972 | 973 | value: "motherCellNo", |
973 | 974 | sortable: false, |
974 | - align: "center" | |
975 | + align: "center", | |
975 | 976 | }, |
976 | - { text: "Action", value: "", sortable: false, align: "center" } | |
977 | + { text: "Action", value: "", sortable: false, align: "center" }, | |
977 | 978 | ], |
978 | 979 | parentsList: [], |
979 | 980 | editedIndex: -1, |
... | ... | @@ -985,12 +986,12 @@ export default { |
985 | 986 | motherName: "", |
986 | 987 | motherCellNo: "", |
987 | 988 | email: "", |
988 | - password: "" | |
989 | + password: "", | |
989 | 990 | }, |
990 | 991 | editMpin: { |
991 | - mPin: "" | |
992 | + mPin: "", | |
992 | 993 | }, |
993 | - isFatherCellExists: false | |
994 | + isFatherCellExists: false, | |
994 | 995 | }), |
995 | 996 | watch: { |
996 | 997 | menu(val) { |
... | ... | @@ -998,7 +999,7 @@ export default { |
998 | 999 | }, |
999 | 1000 | menu1(val) { |
1000 | 1001 | val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); |
1001 | - } | |
1002 | + }, | |
1002 | 1003 | }, |
1003 | 1004 | methods: { |
1004 | 1005 | editItem(item) { |
... | ... | @@ -1032,14 +1033,14 @@ export default { |
1032 | 1033 | this.editedItem.parentId = this.editedItem._id; |
1033 | 1034 | http() |
1034 | 1035 | .put("/updateParent", this.editedItem) |
1035 | - .then(response => { | |
1036 | + .then((response) => { | |
1036 | 1037 | this.snackbar = true; |
1037 | 1038 | this.color = "green"; |
1038 | 1039 | this.text = response.data.message; |
1039 | 1040 | this.getParentDetails(); |
1040 | 1041 | this.close(); |
1041 | 1042 | }) |
1042 | - .catch(error => { | |
1043 | + .catch((error) => { | |
1043 | 1044 | this.snackbar = true; |
1044 | 1045 | this.color = "error"; |
1045 | 1046 | this.text = error.response.data.message; |
... | ... | @@ -1053,11 +1054,11 @@ export default { |
1053 | 1054 | if (this.$refs.resetParentMpinForm.validate()) { |
1054 | 1055 | var changeMpin = { |
1055 | 1056 | parentId: this.editMpin._id, |
1056 | - mPin: this.editMpin.mPin | |
1057 | + mPin: this.editMpin.mPin, | |
1057 | 1058 | }; |
1058 | 1059 | http() |
1059 | 1060 | .put("/resetMPin", changeMpin) |
1060 | - .then(response => { | |
1061 | + .then((response) => { | |
1061 | 1062 | this.snackbar = true; |
1062 | 1063 | this.color = "green"; |
1063 | 1064 | this.text = response.data.message; |
... | ... | @@ -1065,7 +1066,7 @@ export default { |
1065 | 1066 | this.resetParentMpin = false; |
1066 | 1067 | this.closeReset(); |
1067 | 1068 | }) |
1068 | - .catch(error => { | |
1069 | + .catch((error) => { | |
1069 | 1070 | this.snackbar = true; |
1070 | 1071 | this.color = "error"; |
1071 | 1072 | this.text = error.response.data.message; |
... | ... | @@ -1081,7 +1082,7 @@ export default { |
1081 | 1082 | this.loading = true; |
1082 | 1083 | await http() |
1083 | 1084 | .post("/createParent", this.parentData) |
1084 | - .then(response => { | |
1085 | + .then((response) => { | |
1085 | 1086 | this.parentId = response.data.data.id; |
1086 | 1087 | this.snackbar = true; |
1087 | 1088 | this.color = "green"; |
... | ... | @@ -1092,7 +1093,7 @@ export default { |
1092 | 1093 | this.isFatherCellExists = true; |
1093 | 1094 | this.addParentDialog = false; |
1094 | 1095 | }) |
1095 | - .catch(error => { | |
1096 | + .catch((error) => { | |
1096 | 1097 | this.snackbar = true; |
1097 | 1098 | this.color = "error"; |
1098 | 1099 | this.text = error.response.data.message; |
... | ... | @@ -1107,13 +1108,13 @@ export default { |
1107 | 1108 | http() |
1108 | 1109 | .get("getParentsList", { |
1109 | 1110 | headers: { |
1110 | - Authorization: "Bearer " + this.$store.state.token | |
1111 | - } | |
1111 | + Authorization: "Bearer " + this.$store.state.token, | |
1112 | + }, | |
1112 | 1113 | }) |
1113 | - .then(response => { | |
1114 | + .then((response) => { | |
1114 | 1115 | this.parentsList = response.data.data; |
1115 | 1116 | }) |
1116 | - .catch(error => { | |
1117 | + .catch((error) => { | |
1117 | 1118 | // console.log("err====>", error.response.data.message); |
1118 | 1119 | this.showLoader = false; |
1119 | 1120 | if (error.response.status === 401) { |
... | ... | @@ -1133,12 +1134,12 @@ export default { |
1133 | 1134 | this.showSearch = false; |
1134 | 1135 | this.show = true; |
1135 | 1136 | this.search = ""; |
1136 | - } | |
1137 | + }, | |
1137 | 1138 | }, |
1138 | 1139 | mounted() { |
1139 | 1140 | this.getParentDetails(); |
1140 | 1141 | // console.log("role", this.$store.state.role); |
1141 | 1142 | this.role = this.$store.state.role; |
1142 | - } | |
1143 | + }, | |
1143 | 1144 | }; |
1144 | 1145 | </script> |
1145 | 1146 | \ No newline at end of file | ... | ... |