Commit 58fac10b48fff8ab206989d9febe5653ab63c943
1 parent
90bec8782d
Exists in
master
and in
2 other branches
set enroll teacher functionallity, improve icard and admit card issue
Showing
3 changed files
with
146 additions
and
94 deletions
Show diff stats
src/pages/AssignTeachers.vue
... | ... | @@ -6,7 +6,7 @@ |
6 | 6 | </div> |
7 | 7 | |
8 | 8 | <!-- SNACKBAR --> |
9 | - <v-snackbar | |
9 | + <!-- <v-snackbar | |
10 | 10 | :timeout="timeout" |
11 | 11 | :top="y === 'top'" |
12 | 12 | :right="x === 'right'" |
... | ... | @@ -17,7 +17,7 @@ |
17 | 17 | {{ text }} |
18 | 18 | <v-spacer></v-spacer> |
19 | 19 | <v-btn flat text @click="snackbar = false">X</v-btn> |
20 | - </v-snackbar> | |
20 | + </v-snackbar>--> | |
21 | 21 | |
22 | 22 | <!-- DIALOG ENROLL TEACHER --> |
23 | 23 | <v-dialog v-model="dialogEnrollTeacher" max-width="600px" scrollable persistent> |
... | ... | @@ -56,38 +56,33 @@ |
56 | 56 | </v-dialog> |
57 | 57 | |
58 | 58 | <v-toolbar color="transparent" flat> |
59 | - <v-card-actions> | |
60 | - <v-layout row wrap> | |
61 | - <!-- SELECT CLASS --> | |
62 | - <v-flex xs12 sm6> | |
63 | - <v-select | |
64 | - :items="classesList" | |
65 | - label="Select Class" | |
66 | - v-model="classId" | |
67 | - item-text="classNum" | |
68 | - item-value="_id" | |
69 | - name="Select Class" | |
70 | - :rules="classRules" | |
71 | - required | |
72 | - @change="populateCourses(classId)" | |
73 | - class="ml-2" | |
74 | - ></v-select> | |
75 | - </v-flex> | |
76 | - <!-- SELECT COURSE --> | |
77 | - <v-flex xs12 sm6> | |
78 | - <v-select | |
79 | - :items="courseData" | |
80 | - label="Select Course" | |
81 | - v-model="courseId" | |
82 | - item-text="courseName" | |
83 | - item-value="_id" | |
84 | - required | |
85 | - class="ml-2" | |
86 | - @change="getTeachersList()" | |
87 | - ></v-select> | |
88 | - </v-flex> | |
89 | - </v-layout> | |
90 | - </v-card-actions> | |
59 | + <v-spacer></v-spacer> | |
60 | + <v-flex xs12 sm4 md2> | |
61 | + <v-select | |
62 | + small | |
63 | + :items="classesList" | |
64 | + label="Select Class" | |
65 | + v-model="getReport.classId" | |
66 | + item-text="classNum" | |
67 | + item-value="_id" | |
68 | + name="Select Class" | |
69 | + @change="getCourses(getReport.classId)" | |
70 | + class="mr-2" | |
71 | + required | |
72 | + ></v-select> | |
73 | + </v-flex> | |
74 | + <v-flex xs12 sm4 md2> | |
75 | + <v-select | |
76 | + :items="courseData" | |
77 | + label="Select Course" | |
78 | + v-model="getReport.courseId" | |
79 | + item-text="courseName" | |
80 | + item-value="_id" | |
81 | + required | |
82 | + class="ml-2" | |
83 | + @change=" getTeacherTable(getReport.classId)" | |
84 | + ></v-select> | |
85 | + </v-flex> | |
91 | 86 | </v-toolbar> |
92 | 87 | |
93 | 88 | <!-- LIST OF TEACHERS --> |
... | ... | @@ -118,13 +113,13 @@ |
118 | 113 | <template slot="headers" slot-scope="props"> |
119 | 114 | <tr> |
120 | 115 | <th> |
121 | - <v-checkbox | |
116 | + <!-- <v-checkbox | |
122 | 117 | :input-value="props.all" |
123 | 118 | :indeterminate="props.indeterminate" |
124 | 119 | primary |
125 | 120 | hide-details |
126 | 121 | @click.native="toggleAll" |
127 | - ></v-checkbox> | |
122 | + ></v-checkbox>--> | |
128 | 123 | </th> |
129 | 124 | <th |
130 | 125 | v-for="header in props.headers" |
... | ... | @@ -222,6 +217,7 @@ export default { |
222 | 217 | align: "center", |
223 | 218 | }, |
224 | 219 | ], |
220 | + getReport: {}, | |
225 | 221 | selected: [], |
226 | 222 | teachers: [], |
227 | 223 | // courseData: [], |
... | ... | @@ -242,9 +238,9 @@ export default { |
242 | 238 | }), |
243 | 239 | |
244 | 240 | methods: { |
245 | - async populateCourses() { | |
246 | - let response = await this.getCourseesList({ classId: this.classId }); | |
247 | - }, | |
241 | + // async populateCourses() { | |
242 | + // let response = await this.getCourseesList({ classId: getReport.classId }); | |
243 | + // }, | |
248 | 244 | enrollTeacher(selected) { |
249 | 245 | let selectedTeachersArray = []; |
250 | 246 | selectedTeachersArray.push({ teacherId: selected._id }); |
... | ... | @@ -256,22 +252,24 @@ export default { |
256 | 252 | break; |
257 | 253 | } |
258 | 254 | } |
259 | - | |
260 | 255 | if (selected.enroll === true) { |
261 | 256 | if (!isExists) this.selected.push(selected); |
262 | 257 | var payload = { |
263 | - courseId: this.courseId, | |
264 | - teacherId: selectedTeachersArray, | |
258 | + courseId: this.getReport.courseId, | |
259 | + teacherId: selected._id, | |
265 | 260 | }; |
266 | 261 | http() |
267 | 262 | .put("/assignTeacherToCourse", payload) |
268 | 263 | .then((response) => { |
264 | + console.log("===response===", response); | |
269 | 265 | this.snackbar = true; |
266 | + this.color = "success"; | |
270 | 267 | this.text = response.data.message; |
271 | 268 | this.getParticularCourse("noSnackbar"); |
272 | 269 | }) |
273 | 270 | .catch((error) => { |
274 | 271 | this.snackbar = true; |
272 | + this.color = "error"; | |
275 | 273 | this.text = error.response.data.message; |
276 | 274 | }); |
277 | 275 | } |
... | ... | @@ -280,14 +278,15 @@ export default { |
280 | 278 | selected.enroll != undefined && |
281 | 279 | selected.enroll != null |
282 | 280 | ) { |
283 | - var payloadDeleteStudents = { | |
284 | - courseId: this.courseId, | |
285 | - teacherId: selected.enrollId, | |
281 | + var payloadDeleteTeacher = { | |
282 | + courseId: this.getReport.courseId, | |
283 | + assignedId: selected.enrollId, | |
286 | 284 | }; |
287 | 285 | http() |
288 | - .put("/deleteStudents", payloadDeleteStudents) | |
286 | + .put("/removeTeacherToCourse", payloadDeleteTeacher) | |
289 | 287 | .then((response) => { |
290 | 288 | this.snackbar = true; |
289 | + this.color = "success"; | |
291 | 290 | this.text = response.data.message; |
292 | 291 | this.getParticularCourse(); |
293 | 292 | }) |
... | ... | @@ -300,7 +299,7 @@ export default { |
300 | 299 | |
301 | 300 | toggleAll() { |
302 | 301 | let withdraw = false; |
303 | - if (this.selected.length === this.studentsData.length) withdraw = true; | |
302 | + if (this.selected.length === this.teachersList.length) withdraw = true; | |
304 | 303 | |
305 | 304 | if (withdraw) { |
306 | 305 | var payload = { |
... | ... | @@ -313,8 +312,8 @@ export default { |
313 | 312 | this.snackbar = true; |
314 | 313 | this.text = response.data.message; |
315 | 314 | this.selected = []; |
316 | - for (let i = 0; i < this.studentsData.length; i++) { | |
317 | - this.studentsData[i].enroll = false; | |
315 | + for (let i = 0; i < this.teachersList.length; i++) { | |
316 | + this.teachersList[i].enroll = false; | |
318 | 317 | } |
319 | 318 | this.getParticularCourse(); |
320 | 319 | }) |
... | ... | @@ -324,7 +323,7 @@ export default { |
324 | 323 | }); |
325 | 324 | } else { |
326 | 325 | let selectedTeachersArray = []; |
327 | - for (let item of this.studentsData) { | |
326 | + for (let item of this.teachersList) { | |
328 | 327 | if (item.enroll === false || !item.enroll) { |
329 | 328 | selectedTeachersArray.push({ teacherId: item._id }); |
330 | 329 | } |
... | ... | @@ -339,8 +338,8 @@ export default { |
339 | 338 | .then((response) => { |
340 | 339 | this.snackbar = true; |
341 | 340 | this.text = response.data.message; |
342 | - for (let i = 0; i < this.studentsData.length; i++) { | |
343 | - this.studentsData[i].enroll = true; | |
341 | + for (let i = 0; i < this.teachersList.length; i++) { | |
342 | + this.teachersList[i].enroll = true; | |
344 | 343 | } |
345 | 344 | this.getParticularCourse(); |
346 | 345 | }) |
... | ... | @@ -350,23 +349,82 @@ export default { |
350 | 349 | }); |
351 | 350 | } |
352 | 351 | }, |
353 | - // getCourses() { | |
354 | - // this.showLoader = true; | |
355 | - // http() | |
356 | - // .get("/getCourseesList", { | |
357 | - // params: { | |
358 | - // classId: this.selectStudents.select, | |
359 | - // }, | |
360 | - // }) | |
361 | - // .then((response) => { | |
362 | - // this.courseData = response.data.data; | |
363 | - // this.showLoader = false; | |
364 | - // }) | |
365 | - // .catch((err) => { | |
366 | - // console.log("err====>", err); | |
367 | - // this.showLoader = false; | |
368 | - // }); | |
369 | - // }, | |
352 | + getTeacherTable(id) { | |
353 | + // console.log("id", this.getReport.courseId); | |
354 | + this.getTeachersList("noSnackbar"); | |
355 | + }, | |
356 | + getTeachersList(message) { | |
357 | + this.showLoader = true; | |
358 | + http() | |
359 | + .get("/getTeachersList", { | |
360 | + params: { | |
361 | + classId: this.getReport.classId, | |
362 | + }, | |
363 | + }) | |
364 | + .then((response) => { | |
365 | + this.teachersList = response.data.data; | |
366 | + this.showLoader = false; | |
367 | + // this.addStudentAttendenceDialog = false; | |
368 | + var attendence = ""; | |
369 | + for (let i = 0; i < this.teachersList.length; i++) { | |
370 | + this.teachersList[i].attendence = true; | |
371 | + } | |
372 | + this.getParticularCourse(message); | |
373 | + }) | |
374 | + .catch((error) => { | |
375 | + console.log("err====>", error); | |
376 | + this.showLoader = false; | |
377 | + }); | |
378 | + }, | |
379 | + getParticularCourse(message) { | |
380 | + this.selected = []; | |
381 | + var payload = { | |
382 | + courseId: this.getReport.courseId, | |
383 | + }; | |
384 | + http() | |
385 | + .get("/getParticularCourse", { | |
386 | + params: payload, | |
387 | + }) | |
388 | + .then((response) => { | |
389 | + for (let i = 0; i < response.data.data.assignedTeacher.length; i++) { | |
390 | + var teacherId = {}; | |
391 | + teacherId = response.data.data.assignedTeacher[i]; | |
392 | + for (let j = 0; j < this.teachersList.length; j++) { | |
393 | + if (teacherId.teacherId == this.teachersList[j]._id) { | |
394 | + this.teachersList[j].enroll = true; | |
395 | + this.teachersList[j].enrollId = teacherId._id; | |
396 | + this.selected.push(this.teachersList[j]); | |
397 | + break; | |
398 | + } | |
399 | + } | |
400 | + } | |
401 | + if (message != "noSnackbar") { | |
402 | + this.snackbar = true; | |
403 | + this.text = response.data.message; | |
404 | + } | |
405 | + }) | |
406 | + .catch((error) => { | |
407 | + this.snackbar = true; | |
408 | + this.text = error.response.data.message; | |
409 | + }); | |
410 | + }, | |
411 | + getCourses(classId) { | |
412 | + this.showLoader = true; | |
413 | + http() | |
414 | + .get("/getCourseesList", { | |
415 | + params: { | |
416 | + classId: classId, | |
417 | + }, | |
418 | + }) | |
419 | + .then((response) => { | |
420 | + this.courseData = response.data.data; | |
421 | + this.showLoader = false; | |
422 | + }) | |
423 | + .catch((err) => { | |
424 | + console.log("err====>", err); | |
425 | + this.showLoader = false; | |
426 | + }); | |
427 | + }, | |
370 | 428 | // getSections(_id) { |
371 | 429 | // var token = this.$store.state.token; |
372 | 430 | // this.showLoader = true; | ... | ... |
src/pages/Report/admitCard.vue
... | ... | @@ -114,9 +114,9 @@ |
114 | 114 | <!-- ADMIT CARDS --> |
115 | 115 | <div id="printMe" v-if="frontPart"> |
116 | 116 | <v-card |
117 | - v-for="(student,index) in getScheduleList.studentData" | |
118 | - :key="index" | |
119 | - class="mt-3" | |
117 | + v-for="(student,index) in getScheduleList.studentData" | |
118 | + :key="index" | |
119 | + class="mt-3" | |
120 | 120 | style=" |
121 | 121 | page-break-after: always; |
122 | 122 | background-color: #fff; |
... | ... | @@ -128,8 +128,7 @@ |
128 | 128 | webkit-box-shadow: 0px 0px 0px 0px rgba(0,0,0,0.2), 0px 0px 0px 0px rgba(0,0,0,0.14), 0px 0px 0px 0px rgba(0,0,0,0.12) !important; |
129 | 129 | box-shadow: 0px 0px 0px 0px rgba(0,0,0,0.2), 0px 0px 0px 0px rgba(0,0,0,0.14), 0px 0px 0px 0px rgba(0,0,0,0.12) !important;" |
130 | 130 | > |
131 | - | |
132 | - <v-layout style="border-bottom: 1px solid #ddd;margin: 8px; auto" > | |
131 | + <v-layout style="border-bottom: 1px solid #ddd;margin: 8px; auto"> | |
133 | 132 | <v-flex xs3 style="margin-bottom:0px"> |
134 | 133 | <img |
135 | 134 | :src="userData.schoolLogoUrl" |
... | ... | @@ -158,12 +157,7 @@ |
158 | 157 | </div> |
159 | 158 | </v-flex> |
160 | 159 | <v-flex xs4 style="text-align:center;margin-bottom:0px"> |
161 | - | |
162 | - <img | |
163 | - src="/static/icon/user.png" | |
164 | - v-if="!student.profilePicUrl" | |
165 | - width="80" | |
166 | - /> | |
160 | + <img src="/static/icon/user.png" v-if="!student.profilePicUrl" width="80" /> | |
167 | 161 | <img |
168 | 162 | :src="student.profilePicUrl" |
169 | 163 | onerror="this.src='/static/icon/user.png';" |
... | ... | @@ -546,15 +540,15 @@ export default { |
546 | 540 | } else { |
547 | 541 | studentId.push(this.getReport.studentId); |
548 | 542 | } |
549 | - console.log("this.getReport.studentId - ", studentId); | |
543 | + // console.log("this.getReport.studentId - ", studentId); | |
544 | + var admitPayload = { | |
545 | + examId: this.getReport.examId, | |
546 | + classId: this.getReport.classId, | |
547 | + sectionId: this.getReport.sectionId, | |
548 | + studentId: studentId, | |
549 | + }; | |
550 | 550 | http() |
551 | - .get("/getScheduleForParticularStudent", { | |
552 | - params: { | |
553 | - examId: this.getReport.examId, | |
554 | - classId: this.getReport.classId, | |
555 | - sectionId: this.getReport.sectionId, | |
556 | - studentId: studentId, | |
557 | - }, | |
551 | + .put("/getScheduleForParticularStudent", admitPayload, { | |
558 | 552 | paramsSerializer: (params) => { |
559 | 553 | return qs.stringify(params); |
560 | 554 | }, |
... | ... | @@ -562,7 +556,7 @@ export default { |
562 | 556 | .then((response) => { |
563 | 557 | this.showTable = true; |
564 | 558 | this.getScheduleList = response.data.data; |
565 | - console.log(" getScheduleList - ",this.getScheduleList) | |
559 | + console.log(" getScheduleList - ", this.getScheduleList); | |
566 | 560 | // this.schoolData = response.data.data.studentData.schoolId; |
567 | 561 | if (response.data.data.scheduleData.length === 0) { |
568 | 562 | this.showLoader = false; | ... | ... |
src/pages/Report/idCard.vue
... | ... | @@ -705,15 +705,15 @@ export default { |
705 | 705 | // var strigified = JSON.stringify(getSelectUserId) |
706 | 706 | // var profileId = []; |
707 | 707 | // profileId = getSelectUserId; |
708 | + var idcardPayload = { | |
709 | + profileId: getSelectUserId, | |
710 | + role: this.getReport.role.role, | |
711 | + }; | |
708 | 712 | http() |
709 | - .get("/getIdCardDetail", { | |
713 | + .put("/getIdCardDetail", idcardPayload, { | |
710 | 714 | headers: { |
711 | 715 | Authorization: "Bearer " + this.token, |
712 | 716 | }, |
713 | - params: { | |
714 | - profileId: getSelectUserId, | |
715 | - role: this.getReport.role.role, | |
716 | - }, | |
717 | 717 | paramsSerializer: (params) => { |
718 | 718 | return qs.stringify(params); |
719 | 719 | }, | ... | ... |