Commit 200c2d17178e31919bdd75fe4daca8692365dc36
1 parent
4efdca5643
Exists in
master
and in
3 other branches
implement change status in student and teacher
Showing
2 changed files
with
69 additions
and
3 deletions
Show diff stats
src/pages/Students/students.vue
... | ... | @@ -940,7 +940,13 @@ |
940 | 940 | <td id="td" class="text-xs-center">{{ props.item.parentId.motherName }}</td> |
941 | 941 | <td id="td" class="text-xs-center">{{ props.item.establishmentYear }}</td> |
942 | 942 | <td id="td" class="text-xs-center">{{ props.item.mobile}}</td> |
943 | - | |
943 | + <td id="td"> | |
944 | + <v-switch | |
945 | + class="pl-3" | |
946 | + v-model="props.item.status" | |
947 | + @change="suspendStudentStatus(props.item.status,props.item._id)" | |
948 | + ></v-switch> | |
949 | + </td> | |
944 | 950 | <td class="text-xs-center"> |
945 | 951 | <span> |
946 | 952 | <v-tooltip top> |
... | ... | @@ -1931,6 +1937,12 @@ export default { |
1931 | 1937 | align: "center" |
1932 | 1938 | }, |
1933 | 1939 | { text: "Mobile No", value: "mobile", sortable: false, align: "center" }, |
1940 | + { | |
1941 | + text: "Status", | |
1942 | + value: "status", | |
1943 | + sortable: false, | |
1944 | + align: "center" | |
1945 | + }, | |
1934 | 1946 | { text: "Action", value: "", sortable: false, align: "center" } |
1935 | 1947 | ], |
1936 | 1948 | desserts: [], |
... | ... | @@ -2353,6 +2365,23 @@ export default { |
2353 | 2365 | this.showLoader = false; |
2354 | 2366 | }); |
2355 | 2367 | } |
2368 | + }, | |
2369 | + suspendStudentStatus(status, id) { | |
2370 | + let suspendStudentData = { | |
2371 | + studentId: id, | |
2372 | + status: status | |
2373 | + }; | |
2374 | + http() | |
2375 | + .put("/suspendStudentAccount", suspendStudentData) | |
2376 | + .then(response => { | |
2377 | + this.findStudents()(); | |
2378 | + this.text = response.data.message; | |
2379 | + this.snackbar = true; | |
2380 | + }) | |
2381 | + .catch(error => { | |
2382 | + // console.log(error.response.data.data); | |
2383 | + this.text = error.response.data.message; | |
2384 | + }); | |
2356 | 2385 | } |
2357 | 2386 | }, |
2358 | 2387 | mounted() { | ... | ... |
src/pages/Teachers/teachers.vue
... | ... | @@ -514,6 +514,13 @@ |
514 | 514 | <td id="td" class="text-xs-center">{{ dates(props.item.dob) }}</td> |
515 | 515 | <td id="td" class="text-xs-center">{{ dates(props.item.joinDate)}}</td> |
516 | 516 | <td id="td" class="text-xs-center">{{ props.item.mobileNo }}</td> |
517 | + <td id="td"> | |
518 | + <v-switch | |
519 | + class="pl-3" | |
520 | + v-model="props.item.status" | |
521 | + @change="suspendStatus(props.item.status,props.item._id)" | |
522 | + ></v-switch> | |
523 | + </td> | |
517 | 524 | <td class="text-xs-center"> |
518 | 525 | <span> |
519 | 526 | <v-tooltip top> |
... | ... | @@ -971,6 +978,7 @@ export default { |
971 | 978 | stateRules: [v => !!v || "State Name is required"], |
972 | 979 | joinDateRules: [v => !!v || " Join Date is required"], |
973 | 980 | errorMessages: "", |
981 | + switch1: true, | |
974 | 982 | countries: [], |
975 | 983 | headers: [ |
976 | 984 | { |
... | ... | @@ -1000,6 +1008,12 @@ export default { |
1000 | 1008 | sortable: false, |
1001 | 1009 | align: "center" |
1002 | 1010 | }, |
1011 | + { | |
1012 | + text: "Status", | |
1013 | + value: "status", | |
1014 | + sortable: false, | |
1015 | + align: "center" | |
1016 | + }, | |
1003 | 1017 | { text: "Action", value: "", sortable: false, align: "center" } |
1004 | 1018 | ], |
1005 | 1019 | desserts: [], |
... | ... | @@ -1037,7 +1051,8 @@ export default { |
1037 | 1051 | role: "TEACHER", |
1038 | 1052 | name: "", |
1039 | 1053 | email: "" |
1040 | - } | |
1054 | + }, | |
1055 | + status: "" | |
1041 | 1056 | }), |
1042 | 1057 | watch: { |
1043 | 1058 | menu(val) { |
... | ... | @@ -1245,7 +1260,7 @@ export default { |
1245 | 1260 | editTeacher.upload = imageUrl; |
1246 | 1261 | } |
1247 | 1262 | http() |
1248 | - .put("/updateTeacher", editTeacher) | |
1263 | + .put("/suspendAccount", editTeacher) | |
1249 | 1264 | .then(response => { |
1250 | 1265 | console.log("editTeacher", editTeacher); |
1251 | 1266 | this.snackbar = true; |
... | ... | @@ -1258,6 +1273,28 @@ export default { |
1258 | 1273 | console.log(error); |
1259 | 1274 | this.loading = false; |
1260 | 1275 | }); |
1276 | + }, | |
1277 | + suspendStatus(suspendStatus, id) { | |
1278 | + if (suspendStatus == true) { | |
1279 | + this.status = "ON"; | |
1280 | + } else if (suspendStatus == false) { | |
1281 | + this.status = "OFF"; | |
1282 | + } | |
1283 | + let suspendStatusData = { | |
1284 | + teacherId: id, | |
1285 | + status: suspendStatus | |
1286 | + }; | |
1287 | + http() | |
1288 | + .put("/suspendAccount", suspendStatusData) | |
1289 | + .then(response => { | |
1290 | + this.getTeacherList(); | |
1291 | + this.text = response.data.message; | |
1292 | + this.snackbar = true; | |
1293 | + }) | |
1294 | + .catch(error => { | |
1295 | + // console.log(error.response.data.data); | |
1296 | + this.text = error.response.data.message; | |
1297 | + }); | |
1261 | 1298 | } |
1262 | 1299 | }, |
1263 | 1300 | mounted() { | ... | ... |