From 058c4a6cfda687de3476b3813c86b1f084f365b4 Mon Sep 17 00:00:00 2001 From: Shikha Mishra Date: Wed, 12 Aug 2020 12:56:18 +0530 Subject: [PATCH] Improve the functionality of applying for the exam attendance, Hide Mpin functionality 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 --- src/pages/Class/addclass.vue | 48 ++--- src/pages/Course/enrollStudents.vue | 1 - src/pages/Dashboard/dashboard.vue | 14 +- src/pages/Exam/examAttendence.vue | 363 +++++++++++++++++++++++++++++------- src/pages/Library/books.vue | 73 ++++---- src/pages/Library/eBook.vue | 87 ++++----- src/pages/Parent/parents.vue | 81 ++++---- 7 files changed, 444 insertions(+), 223 deletions(-) diff --git a/src/pages/Class/addclass.vue b/src/pages/Class/addclass.vue index d3e8fdf..6423603 100644 --- a/src/pages/Class/addclass.vue +++ b/src/pages/Class/addclass.vue @@ -35,7 +35,7 @@ cancel - + @@ -127,7 +127,7 @@ src="/static/icon/delete.png" /> Delete - --> + --> @@ -222,28 +222,28 @@ export default { profileClassDialog: false, valid: true, pagination: { - rowsPerPage: 10 + rowsPerPage: 10, }, - nameRules: [v => !!v || " Class Name is required"], + nameRules: [(v) => !!v || " Class Name is required"], headers: [ { text: "No", align: "left", sortable: false, - value: "No" + value: "No", }, { text: "Class No", value: "classNum", sortable: false, align: "center" }, - { text: "Action", value: "", sortable: false, align: "center" } + { text: "Action", value: "", sortable: false, align: "center" }, ], classList: [], editedIndex: -1, editedItem: { - classNum: "" + classNum: "", }, addclasses: { - classNum: "" - } + classNum: "", + }, }), methods: { getClassList() { @@ -251,11 +251,11 @@ export default { var token = this.$store.state.token; http() .get("/getClassesList") - .then(response => { + .then((response) => { this.classList = response.data.data; this.showLoader = false; }) - .catch(error => { + .catch((error) => { this.showLoader = false; if (error.response.status === 401) { this.$router.replace({ path: "/" }); @@ -276,22 +276,22 @@ export default { }, deleteItem(item) { let deleteStudent = { - classId: item._id + classId: item._id, }; http() .delete( "/deleteClass", confirm("Are you sure you want to delete this?") && { - params: deleteStudent + params: deleteStudent, } ) - .then(response => { + .then((response) => { this.snackbar = true; this.text = response.data.message; this.color = "green"; this.getClassList(); }) - .catch(error => { + .catch((error) => { this.snackbar = true; this.color = "error"; this.text = error.response.data.message; @@ -306,21 +306,21 @@ export default { submit() { if (this.$refs.form.validate()) { let addClass = { - classNum: this.addclasses.classNum + classNum: this.addclasses.classNum, }; this.loading = true; http() .post("/createClass", addClass) - .then(response => { + .then((response) => { this.getClassList(); this.snackbar = true; this.text = response.data.message; - this.color = "green" + this.color = "green"; this.clear(); this.loading = false; this.addClassDialog = false; }) - .catch(error => { + .catch((error) => { this.loading = false; this.snackbar = true; this.color = "error"; @@ -334,18 +334,18 @@ export default { save() { let editClass = { classId: this.editedItem._id, - classNum: this.editedItem.classNum + classNum: this.editedItem.classNum, }; http() .put("/updateClass", editClass) - .then(response => { + .then((response) => { this.snackbar = true; this.text = response.data.message; this.color = "green"; this.getClassList(); this.close(); }) - .catch(error => { + .catch((error) => { this.snackbar = true; this.text = error.response.data.message; this.color = "error"; @@ -359,11 +359,11 @@ export default { this.showSearch = false; this.show = true; this.search = ""; - } + }, }, mounted() { this.getClassList(); - } + }, // created() { // this.$root.$on("app:search", search => { // this.search = search; diff --git a/src/pages/Course/enrollStudents.vue b/src/pages/Course/enrollStudents.vue index b9c9c75..90f81ff 100644 --- a/src/pages/Course/enrollStudents.vue +++ b/src/pages/Course/enrollStudents.vue @@ -314,7 +314,6 @@ export default { }, selectParticularStudent(selected) { - // console.log("selected", selected); let selectedStudentsArray = []; selectedStudentsArray.push({ studentId: selected._id }); diff --git a/src/pages/Dashboard/dashboard.vue b/src/pages/Dashboard/dashboard.vue index 2905b66..e410521 100644 --- a/src/pages/Dashboard/dashboard.vue +++ b/src/pages/Dashboard/dashboard.vue @@ -780,7 +780,6 @@ export default { }; }, - methods: { test(e) { console.log(" test - ", e); @@ -918,7 +917,6 @@ export default { if (this.$store.state.role === "PARENT") { http() .get("/getParticularUserDetail", { - params: { studentId: localStorage.getItem("parentStudentId"), }, @@ -982,7 +980,7 @@ export default { // await http() // .get("/parentStudentsList") // .then((response) => { - + // /* set values in local storage */ // this.studentsData = response.data.data.students; // this.showLoader = false; @@ -1044,7 +1042,6 @@ export default { }); } }, - }, mounted() { @@ -1072,12 +1069,12 @@ export default { // this.token = this.$store.state.token; // await this.getparentStudents(); this.studentsData = this.$store.getters.GET_STUDENTS_DATA; - console.log("students data - ",this.studentsData) - await this.getCourses(); + console.log("students data - ", this.studentsData); + await this.getCourses(); await this.getAnnoucementes(); } this.role = this.$store.state.role; - + await this.getStudents(); await this.getTeachers(); await this.getParents(); @@ -1118,4 +1115,7 @@ export default { a { color: white; } + +#pages-dasboard { +} \ No newline at end of file diff --git a/src/pages/Exam/examAttendence.vue b/src/pages/Exam/examAttendence.vue index b251ae9..e3dd669 100644 --- a/src/pages/Exam/examAttendence.vue +++ b/src/pages/Exam/examAttendence.vue @@ -84,6 +84,7 @@ {{ props.index + 1}} - - + + {{ props.item.studentId.name}} {{ props.item.studentId.rollNo}} {{ props.item.studentId.email }} - - - + + @@ -118,13 +126,58 @@ >Your search for "{{ search }}" found no results. + + + + + + + cancel + + + + +

Are you sure you want to change the attendence

+
+ + + + + + cancel + Yes + + +
+
+
+ - - + + - cancel + cancel @@ -223,14 +276,25 @@ + !!v || "Exam Name is required"], - classRules: [v => !!v || "Class Name is required"], - sectionRules: [v => !!v || "section is required"], - subjectRules: [v => !!v || "Subject is required"], - timeInRules: [v => !!v || "Time In is required"], - timeOutRules: [v => !!v || "time Out s is required"], - roomRules: [v => !!v || "Room is required"], - examScheduleDateRules: [v => !!v || "Date is required"], + examRules: [(v) => !!v || "Exam Name is required"], + classRules: [(v) => !!v || "Class Name is required"], + sectionRules: [(v) => !!v || "section is required"], + subjectRules: [(v) => !!v || "Subject is required"], + timeInRules: [(v) => !!v || "Time In is required"], + timeOutRules: [(v) => !!v || "time Out s is required"], + roomRules: [(v) => !!v || "Room is required"], + examScheduleDateRules: [(v) => !!v || "Date is required"], studentsData: [], examData: [], students: [], @@ -333,44 +419,70 @@ export default { align: "", text: "No", sortable: false, - value: "No" + value: "No", }, { text: "Profile Pic", - value: "profilprofilePicUrlePicUrl", + value: "profilePicUrl", sortable: false, - align: "center" + align: "center", }, { text: "Name", value: "name", sortable: false, - align: "center" + align: "center", }, { text: "Roll No", value: "rollNo", sortable: false, - align: "center" + align: "center", }, { text: "Email", value: "email", sortable: false, - align: "center" + align: "center", }, { text: "Action", - value: "", + value: "isPresent", sortable: false, - align: "center" - } + align: "center", + }, + ], + studentheader: [ + { + text: "Profile Pic", + value: "profilePicUrl", + 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", + }, ], attendenceType: [ { label: "", - value: true - } + value: true, + }, ], classList: [], addSection: [], @@ -381,30 +493,45 @@ export default { getAttendence: {}, editedItem: { sectionId: { - name: "" - } + name: "", + }, }, getScheduleData: {}, ScheduleData: [], - token: "" + token: "", + showData: false, + selected: [], + changeStudentAttendenceDialog: false, + closeStudentAttendenceDialog() { + this.changeStudentAttendenceDialog = false; + }, + selectedStudent: {}, + presentStudent: [], + absentStudent: [], }), methods: { pickFile() { this.$refs.image.click(); }, + markStudentAttendence(item) { + this.selectedStudent = { + id: item.studentId._id, + isPresent: !item.isPresent, + }; + this.changeStudentAttendenceDialog = true; + }, getSchedulesList() { this.showLoader = true; http() .get("/getSchedulesList", { params: { classId: this.getScheduleData.classId }, - headers: { Authorization: "Bearer " + this.token } + headers: { Authorization: "Bearer " + this.token }, }) - .then(response => { + .then((response) => { this.ScheduleData = response.data.data; - // console.log("this.ScheduleData", this.ScheduleData); this.showLoader = false; }) - .catch(error => { + .catch((error) => { // console.log("err====>", err); this.showLoader = false; this.loadingSearch = false; @@ -426,27 +553,31 @@ export default { classId: this.addAttendence.classId, sectionId: this.addAttendence.sectionId, subjectId: this.addAttendence.subjectId, - students: [] + students: [], }; - for (var j = 0; j < this.studentsData.length; j++) { - console.log("studentdata", this.studentsData); + for (var j = 0; j < this.presentStudent.length; j++) { + examAttendence.students.push({ + studentId: this.presentStudent[j], + isPresent: true, + }); + } + for (var j = 0; j < this.absentStudent.length; j++) { examAttendence.students.push({ - studentId: this.studentsData[j]._id, - isPresent: this.studentsData[j].attendence + studentId: this.absentStudent[j], + isPresent: false, }); } - console.log("attendence", examAttendence); if (this.$refs.form.validate()) { http() .post("/createExamAttendance", examAttendence) - .then(response => { + .then((response) => { this.snackbar = true; this.color = "success"; this.text = "Successfully created exam attendence"; this.addExamAttendenceDialog = false; // this.getExamAttendenceList(); }) - .catch(error => { + .catch((error) => { this.snackbar = true; this.text = error.response.data.message; }); @@ -460,12 +591,12 @@ export default { getClass() { http() .get("/getClassesList", { - headers: { Authorization: "Bearer " + this.token } + headers: { Authorization: "Bearer " + this.token }, }) - .then(response => { + .then((response) => { this.classList = response.data.data; }) - .catch(err => { + .catch((err) => { // console.log("err====>", err); }); }, @@ -480,13 +611,13 @@ export default { "/getSectionsList", { params: { classId: _id } }, { - headers: { Authorization: "Bearer " + this.token } + headers: { Authorization: "Bearer " + this.token }, } ) - .then(response => { + .then((response) => { this.addSection = response.data.data; }) - .catch(err => {}); + .catch((err) => {}); }, getClassSubject(_id) { this.showLoader = true; @@ -496,14 +627,14 @@ export default { "/getParticularClass", { params: { classId: _id } }, { - headers: { Authorization: "Bearer " + this.token } + headers: { Authorization: "Bearer " + this.token }, } ) - .then(response => { + .then((response) => { this.subjectList = response.data.data; this.showLoader = false; }) - .catch(err => { + .catch((err) => { this.showLoader = false; }); }, @@ -512,14 +643,14 @@ export default { this.loadingSearch = true; http() .get("/getExamsList", { - headers: { Authorization: "Bearer " + this.token } + headers: { Authorization: "Bearer " + this.token }, }) - .then(response => { + .then((response) => { this.examList = response.data.data; this.showLoader = false; this.loadingSearch = false; }) - .catch(error => { + .catch((error) => { this.showLoader = false; this.loadingSearch = false; this.snackbar = true; @@ -541,10 +672,10 @@ export default { .get("/getStudentWithClass", { params: { classId: this.addAttendence.classId, - sectionId: this.addAttendence.sectionId - } + sectionId: this.addAttendence.sectionId, + }, }) - .then(response => { + .then((response) => { this.studentsData = response.data.data; this.showLoader = false; // this.addExamAttendenceDialog = false; @@ -553,7 +684,7 @@ export default { this.studentsData[i].attendence = false; } }) - .catch(err => { + .catch((err) => { console.log("err====>", err); this.showLoader = false; }); @@ -566,18 +697,106 @@ export default { examId: this.getAttendence.examId, classId: this.getAttendence.classId, sectionId: this.getAttendence.sectionId, - subjectId: this.getAttendence.subjectId - } + subjectId: this.getAttendence.subjectId, + }, }) - .then(response => { - this.examData = response.data.data[0]; + .then((response) => { + this.examData = response.data.data; + if (this.examData.length === 0) { + this.showLoader = false; + this.snackbar = true; + this.text = "No Attendence found!"; + this.color = "error"; + return; + } + this.examData = this.examData[0]; + // if (this.examData.students.length === 0) { + // this.showLoader = false; + // this.snackbar = true; + // this.text = "No Students found!"; + // this.color = "error"; + // return; + // } + this.showData = true; this.showLoader = false; }) - .catch(error => { + .catch((error) => { console.log("error", error); this.showLoader = false; }); }, + markParticularStudentAttendence(selected) { + if (selected.attendence) { + this.selected.push(selected); + } else { + for (var i = 0; i < this.selected.length; i++) { + if (this.selected[i]._id === selected._id) { + this.selected.splice(i, 1); + break; + } + } + } + let presentIndex = this.presentStudent.indexOf(selected._id); + let absentIndex = this.absentStudent.push(selected._id); + if (presentIndex > -1) { + this.presentStudent.splice(presentIndex, 1); + this.absentStudent.push(selected._id); + } else { + if (absentIndex > -1) { + this.absentStudent.splice(absentIndex, 1); + } + this.presentStudent.push(selected._id); + } + }, + selectAll() { + let markAbsent = false; + if (this.selected.length === this.studentsData.length) markAbsent = true; + + this.presentStudent = []; + this.absentStudent = []; + this.selected = []; + + for (let i = 0; i < this.studentsData.length; i++) { + if (markAbsent) { + this.studentsData[i].attendence = false; + this.absentStudent.push(this.studentsData[i]._id); + } else { + this.studentsData[i].attendence = true; + this.presentStudent.push(this.studentsData[i]._id); + this.selected.push(this.studentsData[i]); + } + } + }, + selectParticularStudent(_id) { + var payload = { + examAttendanceId: this.examData._id, + studentId: this.selectedStudent.id, + isPresent: this.selectedStudent.isPresent, + }; + + http() + .put("/updateExamAttendance", payload) + .then((response) => { + this.snackbar = true; + this.color = "success"; + this.text = "Successfully change attendence"; + this.changeStudentAttendenceDialog = false; + this.selectedStudent = {}; + this.getExamAttendenceList(); + }) + .catch((error) => { + this.snackbar = true; + this.text = error.response.data.message; + }); + }, + changeSort(column) { + if (this.pagination.sortBy === column) { + this.pagination.descending = !this.pagination.descending; + } else { + this.pagination.sortBy = column; + this.pagination.descending = false; + } + }, displaySearch() { (this.show = false), (this.showSearch = true); }, @@ -585,13 +804,13 @@ export default { this.showSearch = false; this.show = true; this.search = ""; - } + }, }, mounted() { this.token = this.$store.state.token; this.getClass(); this.getExamList(); this.role = this.$store.state.role; - } + }, }; \ No newline at end of file diff --git a/src/pages/Library/books.vue b/src/pages/Library/books.vue index 7a4e752..3308ac5 100644 --- a/src/pages/Library/books.vue +++ b/src/pages/Library/books.vue @@ -215,14 +215,14 @@ {{ props.item.quantity }} {{ props.item.rackNo }} - {{ props.item.status}} - {{ props.item.status}} + {{ props.item.status}} + {{ props.item.status}} @@ -235,7 +235,7 @@ src="/static/icon/view.png" /> View - --> + --> Edit - + !!v || " Name is required"], - authorRules: [v => !!v || "Author Name Monthly"], - subjectRules: [v => !!v || "Subject Code is required"], - priceRules: [v => !!v || "Price is required"], - quantityRules: [v => !!v || "Quantity is required"], - rackNoRules: [v => !!v || "Rack No. is required"], + nameRules: [(v) => !!v || " Name is required"], + authorRules: [(v) => !!v || "Author Name Monthly"], + subjectRules: [(v) => !!v || "Subject Code is required"], + priceRules: [(v) => !!v || "Price is required"], + quantityRules: [(v) => !!v || "Quantity is required"], + rackNoRules: [(v) => !!v || "Rack No. is required"], headers: [ { text: "No", align: "", sortable: false, - value: "No" + value: "No", }, { text: "Name", value: "name", sortable: false, - align: "center" + align: "center", }, { text: "Authour", value: "author", sortable: false, align: "center" }, { text: "Subject Code", value: "subjectCode", sortable: false, - align: "center" + align: "center", }, { text: "Price", value: "price", sortable: false, align: "center" }, { text: "Quantity", value: "quantity", sortable: false, align: "center" }, { text: "Rack No", value: "rackNo", sortable: false, align: "center" }, { text: "Status", value: "status", sortable: false, align: "center" }, - { text: "Action", value: "", sortable: false, align: "center" } + { text: "Action", value: "", sortable: false, align: "center" }, ], bookData: [], select: "", token: "", editedItem: {}, - BooksData: {} + BooksData: {}, }), methods: { getBookData() { @@ -461,15 +461,15 @@ export default { http() .get("/getBooksList", { params: { - schoolId: this.$store.state.schoolId + schoolId: this.$store.state.schoolId, }, - headers: { Authorization: "Bearer " + this.token } + headers: { Authorization: "Bearer " + this.token }, }) - .then(response => { + .then((response) => { this.bookData = response.data.data; this.showLoader = false; }) - .catch(error => { + .catch((error) => { this.showLoader = false; if (error.response.status === 401) { this.$router.replace({ path: "/" }); @@ -491,22 +491,22 @@ export default { }, deleteItem(item) { let deleteStudent = { - bookId: item._id + bookId: item._id, }; http() .delete( "/deleteBook", confirm("Are you sure you want to delete this?") && { - params: deleteStudent + params: deleteStudent, } ) - .then(response => { + .then((response) => { this.snackbar = true; this.text = response.data.message; this.color = "green"; this.getBookData(); }) - .catch(error => { + .catch((error) => { this.snackbar = true; this.text = error.response.data.message; this.color = "error"; @@ -525,7 +525,7 @@ export default { this.loading = true; http() .post("/createBook", this.BooksData) - .then(response => { + .then((response) => { this.getBookData(); this.snackbar = true; this.text = response.data.message; @@ -534,7 +534,7 @@ export default { this.clear(); this.loading = false; }) - .catch(error => { + .catch((error) => { this.snackbar = true; this.text = error.response.data.message; this.color = "error"; @@ -549,14 +549,14 @@ export default { this.editedItem.bookId = this.editedItem._id; http() .put("/updateBook", this.editedItem) - .then(response => { + .then((response) => { this.snackbar = true; this.text = response.data.message; this.color = "green"; this.getBookData(); this.closeEditProfile(); }) - .catch(error => { + .catch((error) => { this.snackbar = true; this.text = error.response.data.message; this.color = "error"; @@ -570,11 +570,12 @@ export default { this.showSearch = false; this.show = true; this.search = ""; - } + }, }, mounted() { this.token = this.$store.state.token; this.getBookData(); - } + this.role = this.$store.state.role; + }, }; diff --git a/src/pages/Library/eBook.vue b/src/pages/Library/eBook.vue index 6140791..a7e73e8 100644 --- a/src/pages/Library/eBook.vue +++ b/src/pages/Library/eBook.vue @@ -180,18 +180,18 @@
- - - -
- Class: -
-
- -
{{ editedItem.classId .classNum}}
-
-
-
+ + + +
+ Class: +
+
+ +
{{ editedItem.classId .classNum}}
+
+
+
@@ -270,7 +270,7 @@ /> Edit - + !!v || " Tilte is required"], - descriptionRules: [v => !!v || " Description is required"], - uploadImageRule: [v => !!v || " field is required"], - uploadFileRule: [v => !!v || " fied is required"], - uploadPrivateRule: [v => !!v || " fied is required"], + titleRules: [(v) => !!v || " Tilte is required"], + descriptionRules: [(v) => !!v || " Description is required"], + uploadImageRule: [(v) => !!v || " field is required"], + uploadFileRule: [(v) => !!v || " fied is required"], + uploadPrivateRule: [(v) => !!v || " fied is required"], headers: [ { align: "left", text: "No", sortable: false, - value: "No" + value: "No", }, { text: "Photo", vaue: "fileUrl", sortable: false, align: "center" }, { text: "Name", vaue: "name", sortable: false, align: "center" }, @@ -489,27 +489,27 @@ export default { text: "Class", value: "classId", sortable: false, - align: "center" + align: "center", }, - { text: "Action", value: "", sortable: false, align: "center" } + { text: "Action", value: "", sortable: false, align: "center" }, ], eBookData: [], editedIndex: -1, addEBooks: { - private: false + private: false, }, editedItem: {}, editedItem: { classId: { - classNum: "" - } + classNum: "", + }, }, token: "", uploadCover: {}, editImageName: "", editFiles: "", editAnyFile: "", - editFileName: "" + editFileName: "", }), methods: { editPickImage() { @@ -571,13 +571,13 @@ export default { http() .get("/getEBooksList", { params: { schoolId: this.$store.state.schoolId }, - headers: { Authorization: "Bearer " + this.token } + headers: { Authorization: "Bearer " + this.token }, }) - .then(response => { + .then((response) => { this.eBookData = response.data.data; this.showLoader = false; }) - .catch(error => { + .catch((error) => { // console.log("err====>", err); this.showLoader = false; if (error.response.status === 401) { @@ -641,21 +641,21 @@ export default { }, deleteItem(item) { let deleteEBooks = { - ebookId: item._id + ebookId: item._id, }; http() .delete( "/deleteEBook", confirm("Are you sure you want to delete this?") && { - params: deleteEBooks + params: deleteEBooks, } ) - .then(response => { + .then((response) => { this.snackbar = true; this.text = "Successfully delete Existing News"; this.getEBooksList(); }) - .catch(error => { + .catch((error) => { this.snackbar = true; this.text = error.response.data.message; }); @@ -687,11 +687,11 @@ export default { author: this.addEBooks.author, private: this.addEBooks.private, uploadCover: uploadCover, - uploadFile: uploadFile + uploadFile: uploadFile, }; http() .post("/createEBook", data) - .then(response => { + .then((response) => { this.getEBooksList(); // this.getEBooksList = []; this.addEBookDialog = false; @@ -701,7 +701,7 @@ export default { this.loading = false; (this.imageName = ""), (this.fileName = ""); }) - .catch(error => { + .catch((error) => { this.snackbar = true; this.text = error.response.data.message; this.color = "red"; @@ -733,7 +733,7 @@ export default { console.log("this.editedItem", this.editedItem); http() .put("/updateEBook", this.editedItem) - .then(response => { + .then((response) => { this.loadingUpadte = false; this.snackbar = true; this.text = "Successfully Edit Existing E-Book"; @@ -745,7 +745,7 @@ export default { this.files = ""; this.close(); }) - .catch(error => { + .catch((error) => { this.editLoading = false; this.loadingUpadte = false; this.snackbar = true; @@ -756,12 +756,12 @@ export default { getAllClass() { http() .get("/getClassesList", { - headers: { Authorization: "Bearer " + this.token } + headers: { Authorization: "Bearer " + this.token }, }) - .then(response => { + .then((response) => { this.addClass = response.data.data; }) - .catch(err => { + .catch((err) => { // console.log("err====>", err); // this.$router.replace({ path: "/" }); }); @@ -773,14 +773,15 @@ export default { this.showSearch = false; this.show = true; this.search = ""; - } + }, }, mounted() { this.token = this.$store.state.token; this.getEBooksList(); this.getAllClass(); + this.role = this.$store.state.role; // this.getBookData(); // this.editItem; - } + }, }; \ No newline at end of file diff --git a/src/pages/Parent/parents.vue b/src/pages/Parent/parents.vue index 42463c8..2a6f108 100644 --- a/src/pages/Parent/parents.vue +++ b/src/pages/Parent/parents.vue @@ -308,7 +308,7 @@
- + @@ -544,9 +544,10 @@ /> Edit - - + vpn_key @@ -913,67 +914,67 @@ export default { validEditParent: true, validParentMpin: true, pagination: { - rowsPerPage: 10 + rowsPerPage: 10, }, - fatherNameRules: [v => !!v || " Father Name is required"], + fatherNameRules: [(v) => !!v || " Father Name is required"], fatheCellNoRules: [ - v => !!v || " father Cell Number is required", - v => v <= 10000000000 || "Max 10 characters is required" + (v) => !!v || " father Cell Number is required", + (v) => v <= 10000000000 || "Max 10 characters is required", ], password: [ - v => !!v || "Password field is Required." + (v) => !!v || "Password field is Required.", // v => (/^(?=.*[a-z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/).test(v) && v.length >= 8 || 'Min 8 characters lower case symbol required' ], editFatherNoRule: [ - v => !!v || " father Cell Number is required", - v => v <= 10000000000 || "Max 10 characters is required" + (v) => !!v || " father Cell Number is required", + (v) => v <= 10000000000 || "Max 10 characters is required", ], - editfatherCellNo: [v => !!v || " Father Name is required"], + editfatherCellNo: [(v) => !!v || " Father Name is required"], errorMessages: "", emailRules: [ - v => !!v || "E-mail is required", - v => + (v) => !!v || "E-mail is required", + (v) => /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(v) || - "E-mail must be valid" + "E-mail must be valid", ], mPinRules: [ - v => !!v || "MPIN is required", - v => v <= 10000 || "Max 4 numbers are required" + (v) => !!v || "MPIN is required", + (v) => v <= 10000 || "Max 4 numbers are required", ], headers: [ { text: "No", align: "center", sortable: false, - value: "No" + value: "No", }, { text: "Email", value: "email", sortable: false, align: "center" }, { text: "Father Name", value: "fatherName", sortable: false, - align: "center" + align: "center", }, { text: "Father Cell No", value: "fatherName", sortable: false, - align: "center" + align: "center", }, { text: "Mother Name", value: "motherName", sortable: false, - align: "center" + align: "center", }, { text: "Mother Cell No", value: "motherCellNo", sortable: false, - align: "center" + align: "center", }, - { text: "Action", value: "", sortable: false, align: "center" } + { text: "Action", value: "", sortable: false, align: "center" }, ], parentsList: [], editedIndex: -1, @@ -985,12 +986,12 @@ export default { motherName: "", motherCellNo: "", email: "", - password: "" + password: "", }, editMpin: { - mPin: "" + mPin: "", }, - isFatherCellExists: false + isFatherCellExists: false, }), watch: { menu(val) { @@ -998,7 +999,7 @@ export default { }, menu1(val) { val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR")); - } + }, }, methods: { editItem(item) { @@ -1032,14 +1033,14 @@ export default { this.editedItem.parentId = this.editedItem._id; http() .put("/updateParent", this.editedItem) - .then(response => { + .then((response) => { this.snackbar = true; this.color = "green"; this.text = response.data.message; this.getParentDetails(); this.close(); }) - .catch(error => { + .catch((error) => { this.snackbar = true; this.color = "error"; this.text = error.response.data.message; @@ -1053,11 +1054,11 @@ export default { if (this.$refs.resetParentMpinForm.validate()) { var changeMpin = { parentId: this.editMpin._id, - mPin: this.editMpin.mPin + mPin: this.editMpin.mPin, }; http() .put("/resetMPin", changeMpin) - .then(response => { + .then((response) => { this.snackbar = true; this.color = "green"; this.text = response.data.message; @@ -1065,7 +1066,7 @@ export default { this.resetParentMpin = false; this.closeReset(); }) - .catch(error => { + .catch((error) => { this.snackbar = true; this.color = "error"; this.text = error.response.data.message; @@ -1081,7 +1082,7 @@ export default { this.loading = true; await http() .post("/createParent", this.parentData) - .then(response => { + .then((response) => { this.parentId = response.data.data.id; this.snackbar = true; this.color = "green"; @@ -1092,7 +1093,7 @@ export default { this.isFatherCellExists = true; this.addParentDialog = false; }) - .catch(error => { + .catch((error) => { this.snackbar = true; this.color = "error"; this.text = error.response.data.message; @@ -1107,13 +1108,13 @@ export default { http() .get("getParentsList", { headers: { - Authorization: "Bearer " + this.$store.state.token - } + Authorization: "Bearer " + this.$store.state.token, + }, }) - .then(response => { + .then((response) => { this.parentsList = response.data.data; }) - .catch(error => { + .catch((error) => { // console.log("err====>", error.response.data.message); this.showLoader = false; if (error.response.status === 401) { @@ -1133,12 +1134,12 @@ export default { this.showSearch = false; this.show = true; this.search = ""; - } + }, }, mounted() { this.getParentDetails(); // console.log("role", this.$store.state.role); this.role = this.$store.state.role; - } + }, }; \ No newline at end of file -- 2.0.0