Commit 4efdca5643addf2a997143c3f9869d47b00757c1

Authored by Neeraj Sharma
1 parent 35c05b9600

solve bugs parent mobile number in parent and student parents

src/pages/Parent/parents.vue
... ... @@ -47,119 +47,122 @@
47 47 >close</v-icon>
48 48 </v-toolbar>
49 49 <v-card-text style="height: 600px;" class="hidden-xs-only hidden-sm-only">
50   - <v-flex xs12>
51   - <v-layout>
52   - <v-flex xs3 sm4 class="pt-4 subheading">
53   - <label class="right">Email ID:</label>
54   - </v-flex>
55   - <v-flex xs8 sm6 class="ml-3">
56   - <v-text-field
57   - placeholder="fill your email"
58   - v-model="editedItem.email"
59   - type="text"
60   - name="email"
61   - required
62   - ></v-text-field>
63   - </v-flex>
64   - </v-layout>
65   - </v-flex>
66   - <v-flex xs12>
67   - <v-layout>
68   - <v-flex xs3 sm4 class="pt-4 subheading">
69   - <label class="right">Father Name:</label>
70   - </v-flex>
71   - <v-flex xs8 sm6 class="ml-3">
72   - <v-text-field
73   - v-model="editedItem.fatherName"
74   - placeholder="fill your father Name"
75   - required
76   - ></v-text-field>
77   - </v-flex>
78   - </v-layout>
79   - </v-flex>
80   - <v-flex xs12>
81   - <v-layout>
82   - <v-flex xs3 sm4 class="pt-4 subheading">
83   - <label class="right">Father Cell No:</label>
84   - </v-flex>
85   - <v-flex xs8 sm6 class="ml-3">
86   - <v-text-field
87   - v-model="editedItem.fatherCellNo"
88   - placeholder="fill your father Cell Number"
89   - type="number"
90   - required
91   - ></v-text-field>
92   - </v-flex>
93   - </v-layout>
94   - </v-flex>
95   - <v-flex xs12>
96   - <v-layout>
97   - <v-flex xs3 sm4 class="pt-4 subheading">
98   - <label class="right">Father Profession:</label>
99   - </v-flex>
100   - <v-flex xs8 sm6 class="ml-3">
101   - <v-text-field
102   - v-model="editedItem.fatherProfession"
103   - placeholder="fill your father Profession"
104   - required
105   - ></v-text-field>
106   - </v-flex>
107   - </v-layout>
108   - </v-flex>
109   - <v-flex xs12>
110   - <v-layout>
111   - <v-flex xs3 sm4 class="pt-4 subheading">
112   - <label class="right">Mother Name:</label>
113   - </v-flex>
114   - <v-flex xs8 sm6 class="ml-3">
115   - <v-text-field
116   - v-model="editedItem.motherName"
117   - placeholder="fill your Mother Name"
118   - type="text"
119   - required
120   - ></v-text-field>
121   - </v-flex>
122   - </v-layout>
123   - </v-flex>
124   - <v-flex xs12>
125   - <v-layout>
126   - <v-flex xs3 sm4 class="pt-4 subheading">
127   - <label class="right">Mother Cell No:</label>
128   - </v-flex>
129   - <v-flex xs8 sm6 class="ml-3">
130   - <v-text-field
131   - v-model="editedItem.motherCellNo"
132   - placeholder="fill your Mother Cell Number"
133   - type="number"
134   - required
135   - ></v-text-field>
136   - </v-flex>
137   - </v-layout>
138   - </v-flex>
139   - <v-flex xs12>
  50 + <v-form ref="editParentForm" v-model="validEditParent" lazy-validation>
  51 + <v-flex xs12>
  52 + <v-layout>
  53 + <v-flex xs3 sm4 class="pt-4 subheading">
  54 + <label class="right">Email ID:</label>
  55 + </v-flex>
  56 + <v-flex xs8 sm6 class="ml-3">
  57 + <v-text-field
  58 + placeholder="fill your email"
  59 + v-model="editedItem.email"
  60 + type="text"
  61 + name="email"
  62 + required
  63 + ></v-text-field>
  64 + </v-flex>
  65 + </v-layout>
  66 + </v-flex>
  67 + <v-flex xs12>
  68 + <v-layout>
  69 + <v-flex xs3 sm4 class="pt-4 subheading">
  70 + <label class="right">Father Name:</label>
  71 + </v-flex>
  72 + <v-flex xs8 sm6 class="ml-3">
  73 + <v-text-field
  74 + v-model="editedItem.fatherName"
  75 + placeholder="fill your father Name"
  76 + required
  77 + ></v-text-field>
  78 + </v-flex>
  79 + </v-layout>
  80 + </v-flex>
  81 + <v-flex xs12>
  82 + <v-layout>
  83 + <v-flex xs3 sm4 class="pt-4 subheading">
  84 + <label class="right">Father Cell No:</label>
  85 + </v-flex>
  86 + <v-flex xs8 sm6 class="ml-3">
  87 + <v-text-field
  88 + v-model="editedItem.fatherCellNo"
  89 + placeholder="fill your father Cell Number"
  90 + :rules="editFatherNoRule"
  91 + type="number"
  92 + required
  93 + ></v-text-field>
  94 + </v-flex>
  95 + </v-layout>
  96 + </v-flex>
  97 + <v-flex xs12>
  98 + <v-layout>
  99 + <v-flex xs3 sm4 class="pt-4 subheading">
  100 + <label class="right">Father Profession:</label>
  101 + </v-flex>
  102 + <v-flex xs8 sm6 class="ml-3">
  103 + <v-text-field
  104 + v-model="editedItem.fatherProfession"
  105 + placeholder="fill your father Profession"
  106 + required
  107 + ></v-text-field>
  108 + </v-flex>
  109 + </v-layout>
  110 + </v-flex>
  111 + <v-flex xs12>
  112 + <v-layout>
  113 + <v-flex xs3 sm4 class="pt-4 subheading">
  114 + <label class="right">Mother Name:</label>
  115 + </v-flex>
  116 + <v-flex xs8 sm6 class="ml-3">
  117 + <v-text-field
  118 + v-model="editedItem.motherName"
  119 + placeholder="fill your Mother Name"
  120 + type="text"
  121 + required
  122 + ></v-text-field>
  123 + </v-flex>
  124 + </v-layout>
  125 + </v-flex>
  126 + <v-flex xs12>
  127 + <v-layout>
  128 + <v-flex xs3 sm4 class="pt-4 subheading">
  129 + <label class="right">Mother Cell No:</label>
  130 + </v-flex>
  131 + <v-flex xs8 sm6 class="ml-3">
  132 + <v-text-field
  133 + v-model="editedItem.motherCellNo"
  134 + placeholder="fill your Mother Cell Number"
  135 + type="number"
  136 + required
  137 + ></v-text-field>
  138 + </v-flex>
  139 + </v-layout>
  140 + </v-flex>
  141 + <v-flex xs12>
  142 + <v-layout>
  143 + <v-flex xs3 sm4 class="pt-4 subheading">
  144 + <label class="right">Mother Profession:</label>
  145 + </v-flex>
  146 + <v-flex xs8 sm6 class="ml-3">
  147 + <v-text-field
  148 + v-model="editedItem.motherProfession"
  149 + placeholder="fill your Mother Profession"
  150 + type="text"
  151 + required
  152 + ></v-text-field>
  153 + </v-flex>
  154 + </v-layout>
  155 + </v-flex>
140 156 <v-layout>
141   - <v-flex xs3 sm4 class="pt-4 subheading">
142   - <label class="right">Mother Profession:</label>
143   - </v-flex>
144   - <v-flex xs8 sm6 class="ml-3">
145   - <v-text-field
146   - v-model="editedItem.motherProfession"
147   - placeholder="fill your Mother Profession"
148   - type="text"
149   - required
150   - ></v-text-field>
  157 + <v-flex xs12 sm12>
  158 + <v-card-actions>
  159 + <v-spacer></v-spacer>
  160 + <v-btn round dark @click="save">Save</v-btn>
  161 + <v-spacer></v-spacer>
  162 + </v-card-actions>
151 163 </v-flex>
152 164 </v-layout>
153   - </v-flex>
154   - <v-layout>
155   - <v-flex xs12 sm12>
156   - <v-card-actions>
157   - <v-spacer></v-spacer>
158   - <v-btn round dark @click="save">Save</v-btn>
159   - <v-spacer></v-spacer>
160   - </v-card-actions>
161   - </v-flex>
162   - </v-layout>
  165 + </v-form>
163 166 </v-card-text>
164 167 <v-card-text
165 168 style="height: 600px;"
... ... @@ -578,7 +581,6 @@
578 581 <v-text-field
579 582 v-model="parentData.motherCellNo"
580 583 placeholder="fill your Mother Cell Number"
581   - :rules="motherCellNoRules"
582 584 counter="10"
583 585 type="number"
584 586 required
... ... @@ -712,7 +714,6 @@
712 714 <v-text-field
713 715 v-model="parentData.motherCellNo"
714 716 placeholder="fill your Mother Cell Number"
715   - :rules="motherCellNoRules"
716 717 type="number"
717 718 required
718 719 ></v-text-field>
... ... @@ -795,6 +796,7 @@ export default {
795 796 dialog: false,
796 797 dialog1: false,
797 798 valid: true,
  799 + validEditParent: true,
798 800 isActive: true,
799 801 newActive: false,
800 802 AddUsercredentials: {},
... ... @@ -806,11 +808,12 @@ export default {
806 808 v => !!v || " father Cell Number is required",
807 809 v => v <= 10000000000 || "Max 10 characters is required"
808 810 ],
809   - // motherNameRules: [v => !!v || " Mother Name is required"],
810   - motherCellNoRules: [
811   - v => !!v || " Mother Cell Number is required",
  811 + editFatherNoRule: [
  812 + v => !!v || " father Cell Number is required",
812 813 v => v <= 10000000000 || "Max 10 characters is required"
813 814 ],
  815 +
  816 + editfatherCellNo: [v => !!v || " Father Name is required"],
814 817 errorMessages: "",
815 818 emailRules: [
816 819 v => !!v || "E-mail is required",
... ... @@ -876,8 +879,6 @@ export default {
876 879 editItem(item) {
877 880 this.editedIndex = this.parentsList.indexOf(item);
878 881 this.editedItem = Object.assign({}, item);
879   - this.editedItem.fatherCellNo = this.editedItem.fatherCellNo.slice(3);
880   - this.editedItem.motherCellNo = this.editedItem.motherCellNo.slice(3);
881 882 this.dialog = true;
882 883 },
883 884 profile(item) {
... ... @@ -913,32 +914,30 @@ export default {
913 914 this.$refs.parentForm.reset();
914 915 },
915 916 save() {
916   - this.editedItem.parentId = this.editedItem._id;
917   - this.editedItem.fatherCellNo = "+91" + this.editedItem.fatherCellNo;
918   - this.editedItem.motherCellNo = "+91" + this.editedItem.motherCellNo;
919   - http()
920   - .put("/updateParent", this.editedItem)
921   - .then(response => {
922   - this.snackbar = true;
923   - this.color = "green";
924   - this.text = "Successfully Student Existing User";
925   - this.getParentDetails();
926   - this.close();
927   - })
928   - .catch(error => {
929   - this.snackbar = true;
930   - this.color = "error";
931   - this.text = error.response.data.message;
932   - if (error.response.data.statusText) {
933   - this.text = error.response.data.statusText;
934   - }
935   - });
  917 + if (this.$refs.editParentForm.validate()) {
  918 + this.editedItem.parentId = this.editedItem._id;
  919 + http()
  920 + .put("/updateParent", this.editedItem)
  921 + .then(response => {
  922 + this.snackbar = true;
  923 + this.color = "green";
  924 + this.text = "Successfully Student Existing User";
  925 + this.getParentDetails();
  926 + this.close();
  927 + })
  928 + .catch(error => {
  929 + this.snackbar = true;
  930 + this.color = "error";
  931 + this.text = error.response.data.message;
  932 + if (error.response.data.statusText) {
  933 + this.text = error.response.data.statusText;
  934 + }
  935 + });
  936 + }
936 937 },
937 938 async submitParentDetails() {
938 939 if (this.$refs.parentForm.validate()) {
939 940 this.parentData.role = "PARENT";
940   - this.parentData.fatherCellNo = "+91" + this.parentData.fatherCellNo;
941   - this.parentData.motherCellNo = "+91" + this.parentData.motherCellNo;
942 941 this.loading = true;
943 942 await http()
944 943 .post("/createParent", this.parentData)
... ...
src/pages/Students/students.vue
... ... @@ -1087,7 +1087,6 @@
1087 1087 <v-text-field
1088 1088 v-model="parentData.motherCellNo"
1089 1089 placeholder="fill your Mother Cell Number"
1090   - :rules="motherCellNoRules"
1091 1090 type="number"
1092 1091 required
1093 1092 ></v-text-field>
... ... @@ -1230,7 +1229,6 @@
1230 1229 v-model="parentData.motherCellNo"
1231 1230 placeholder="fill your Mother Cell Number"
1232 1231 type="number"
1233   - :rules="motherCellNoRules"
1234 1232 required
1235 1233 ></v-text-field>
1236 1234 </v-flex>
... ... @@ -1523,6 +1521,7 @@
1523 1521 <v-text-field
1524 1522 v-model="addStudents.mobile"
1525 1523 placeholder="fill your MobileNo"
  1524 + :rules="mobileNoRule"
1526 1525 name="mobileNo"
1527 1526 type="number"
1528 1527 required
... ... @@ -1892,10 +1891,7 @@ export default {
1892 1891 v => !!v || " father Cell Number is required",
1893 1892 v => v <= 10000000000 || "Max 10 characters is required"
1894 1893 ],
1895   - motherCellNoRules: [
1896   - v => !!v || " Mother Cell Number is required",
1897   - v => v <= 10000000000 || "Max 10 characters is required"
1898   - ],
  1894 + mobileNoRule: [v => !!v || " Mobile Number is required"],
1899 1895 establishmentYearRules: [v => !!v || " Academic Year is required"],
1900 1896 errorMessages: "",
1901 1897 countries: [],
... ... @@ -2198,7 +2194,7 @@ export default {
2198 2194 country: this.addStudents.country,
2199 2195 permanentAddress: this.addStudents.permanentAddress,
2200 2196 presentAddress: this.addStudents.presentAddress,
2201   - mobile: "+91" + this.addStudents.mobile,
  2197 + mobile: this.addStudents.mobile,
2202 2198 state: this.addStudents.state,
2203 2199 gender: this.addStudents.gender,
2204 2200 establishmentYear: this.addStudents.establishmentYear,
... ... @@ -2254,7 +2250,7 @@ export default {
2254 2250 country: this.editedItem.country,
2255 2251 permanentAddress: this.editedItem.permanentAddress,
2256 2252 presentAddress: this.editedItem.presentAddress,
2257   - mobile: "+91" + this.editedItem.mobile,
  2253 + mobile: this.editedItem.mobile,
2258 2254 state: this.editedItem.state,
2259 2255 gender: this.editedItem.gender,
2260 2256 establishmentYear: this.editedItem.establishmentYear,
... ... @@ -2291,8 +2287,8 @@ export default {
2291 2287 },
2292 2288 submitParentDetails() {
2293 2289 if (this.$refs.parentForm.validate()) {
2294   - this.parentData.fatherCellNo = "+91" + this.parentData.fatherCellNo;
2295   - this.parentData.motherCellNo = "+91" + this.parentData.motherCellNo;
  2290 + this.parentData.fatherCellNo = this.parentData.fatherCellNo;
  2291 + this.parentData.motherCellNo = this.parentData.motherCellNo;
2296 2292 let addparentDetails = {
2297 2293 email: this.parentData.email,
2298 2294 fatherName: this.parentData.fatherName,
... ... @@ -2344,6 +2340,16 @@ export default {
2344 2340 console.log("err====>", error.response.data.message);
2345 2341 this.text = error.response.data.message;
2346 2342 this.snackbar = true;
  2343 + if (this.text === "Data not found!") {
  2344 + this.showNext = false;
  2345 + this.showParent = true;
  2346 + this.parentData.email = "";
  2347 + this.parentData.fatherName = "";
  2348 + this.parentData.motherName = "";
  2349 + this.parentData.motherCellNo = "";
  2350 + this.parentData.fatherProfession = "";
  2351 + this.parentData.motherProfession = "";
  2352 + }
2347 2353 this.showLoader = false;
2348 2354 });
2349 2355 }
... ...