From 4efdca5643addf2a997143c3f9869d47b00757c1 Mon Sep 17 00:00:00 2001 From: Neeraj Sharma Date: Thu, 23 Jan 2020 13:02:03 +0530 Subject: [PATCH] solve bugs parent mobile number in parent and student parents --- src/pages/Parent/parents.vue | 277 ++++++++++++++++++++-------------------- src/pages/Students/students.vue | 26 ++-- 2 files changed, 154 insertions(+), 149 deletions(-) diff --git a/src/pages/Parent/parents.vue b/src/pages/Parent/parents.vue index db15fd9..448f908 100644 --- a/src/pages/Parent/parents.vue +++ b/src/pages/Parent/parents.vue @@ -47,119 +47,122 @@ >close - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + Save + + - - - - - - Save - - - - + @@ -795,6 +796,7 @@ export default { dialog: false, dialog1: false, valid: true, + validEditParent: true, isActive: true, newActive: false, AddUsercredentials: {}, @@ -806,11 +808,12 @@ export default { v => !!v || " father Cell Number is required", v => v <= 10000000000 || "Max 10 characters is required" ], - // motherNameRules: [v => !!v || " Mother Name is required"], - motherCellNoRules: [ - v => !!v || " Mother Cell Number is required", + editFatherNoRule: [ + v => !!v || " father Cell Number is required", v => v <= 10000000000 || "Max 10 characters is required" ], + + editfatherCellNo: [v => !!v || " Father Name is required"], errorMessages: "", emailRules: [ v => !!v || "E-mail is required", @@ -876,8 +879,6 @@ export default { editItem(item) { this.editedIndex = this.parentsList.indexOf(item); this.editedItem = Object.assign({}, item); - this.editedItem.fatherCellNo = this.editedItem.fatherCellNo.slice(3); - this.editedItem.motherCellNo = this.editedItem.motherCellNo.slice(3); this.dialog = true; }, profile(item) { @@ -913,32 +914,30 @@ export default { this.$refs.parentForm.reset(); }, save() { - this.editedItem.parentId = this.editedItem._id; - this.editedItem.fatherCellNo = "+91" + this.editedItem.fatherCellNo; - this.editedItem.motherCellNo = "+91" + this.editedItem.motherCellNo; - http() - .put("/updateParent", this.editedItem) - .then(response => { - this.snackbar = true; - this.color = "green"; - this.text = "Successfully Student Existing User"; - this.getParentDetails(); - this.close(); - }) - .catch(error => { - this.snackbar = true; - this.color = "error"; - this.text = error.response.data.message; - if (error.response.data.statusText) { - this.text = error.response.data.statusText; - } - }); + if (this.$refs.editParentForm.validate()) { + this.editedItem.parentId = this.editedItem._id; + http() + .put("/updateParent", this.editedItem) + .then(response => { + this.snackbar = true; + this.color = "green"; + this.text = "Successfully Student Existing User"; + this.getParentDetails(); + this.close(); + }) + .catch(error => { + this.snackbar = true; + this.color = "error"; + this.text = error.response.data.message; + if (error.response.data.statusText) { + this.text = error.response.data.statusText; + } + }); + } }, async submitParentDetails() { if (this.$refs.parentForm.validate()) { this.parentData.role = "PARENT"; - this.parentData.fatherCellNo = "+91" + this.parentData.fatherCellNo; - this.parentData.motherCellNo = "+91" + this.parentData.motherCellNo; this.loading = true; await http() .post("/createParent", this.parentData) diff --git a/src/pages/Students/students.vue b/src/pages/Students/students.vue index eec4af7..67b3b4b 100644 --- a/src/pages/Students/students.vue +++ b/src/pages/Students/students.vue @@ -1087,7 +1087,6 @@ @@ -1230,7 +1229,6 @@ v-model="parentData.motherCellNo" placeholder="fill your Mother Cell Number" type="number" - :rules="motherCellNoRules" required > @@ -1523,6 +1521,7 @@ !!v || " father Cell Number is required", v => v <= 10000000000 || "Max 10 characters is required" ], - motherCellNoRules: [ - v => !!v || " Mother Cell Number is required", - v => v <= 10000000000 || "Max 10 characters is required" - ], + mobileNoRule: [v => !!v || " Mobile Number is required"], establishmentYearRules: [v => !!v || " Academic Year is required"], errorMessages: "", countries: [], @@ -2198,7 +2194,7 @@ export default { country: this.addStudents.country, permanentAddress: this.addStudents.permanentAddress, presentAddress: this.addStudents.presentAddress, - mobile: "+91" + this.addStudents.mobile, + mobile: this.addStudents.mobile, state: this.addStudents.state, gender: this.addStudents.gender, establishmentYear: this.addStudents.establishmentYear, @@ -2254,7 +2250,7 @@ export default { country: this.editedItem.country, permanentAddress: this.editedItem.permanentAddress, presentAddress: this.editedItem.presentAddress, - mobile: "+91" + this.editedItem.mobile, + mobile: this.editedItem.mobile, state: this.editedItem.state, gender: this.editedItem.gender, establishmentYear: this.editedItem.establishmentYear, @@ -2291,8 +2287,8 @@ export default { }, submitParentDetails() { if (this.$refs.parentForm.validate()) { - this.parentData.fatherCellNo = "+91" + this.parentData.fatherCellNo; - this.parentData.motherCellNo = "+91" + this.parentData.motherCellNo; + this.parentData.fatherCellNo = this.parentData.fatherCellNo; + this.parentData.motherCellNo = this.parentData.motherCellNo; let addparentDetails = { email: this.parentData.email, fatherName: this.parentData.fatherName, @@ -2344,6 +2340,16 @@ export default { console.log("err====>", error.response.data.message); this.text = error.response.data.message; this.snackbar = true; + if (this.text === "Data not found!") { + this.showNext = false; + this.showParent = true; + this.parentData.email = ""; + this.parentData.fatherName = ""; + this.parentData.motherName = ""; + this.parentData.motherCellNo = ""; + this.parentData.fatherProfession = ""; + this.parentData.motherProfession = ""; + } this.showLoader = false; }); } -- 2.0.0