text: (window.webpackJsonp=window.webpackJsonp||[]).push([[25],{bEAM:function(t,a,e){"use strict";e.r(a);var s=e("+SZM"),i=e("4QaF"),r={components:{Layout:s.a,"title-bar":i.a},props:{allStudents:Array,allTeachers:Array,students:Array},data:function(){return{compoName:"FBS Student",loader:!1,addEdit:"",student_id:"",form:{teacher_id:"",student_id:""}}},mounted:function(){this.$nextTick((function(){selectActiveMenu(),$(".zero-configuration").DataTable({aaSorting:[]})}))},methods:{deleteStudent:function(t){var a=this;this.$swal({title:"Delete Student?",text:"You can't revert your action",type:"success",showCancelButton:!0,confirmButtonText:"Yes, Delete it!",cancelButtonText:"No, Cancel!",showCloseButton:!0,showLoaderOnConfirm:!0}).then((function(e){e.value?axios.get("/student/delete/"+t).then((function(t){toastr.success(t.data.success,"Success"),a.$inertia.visit("students")})).catch((function(t){toastr.error(t.response.data.error,"Error")})):a.$swal("Cancelled","Your file is still intact","info")}))},assign:function(){var t=this;this.loader=!0,axios.post("/assign/teacher",this.form).then((function(a){toastr.success(a.data.success,"Success"),$("#assignTeacherModal").modal("hide"),t.$inertia.visit("students"),t.loader=!1})).catch((function(a){t.loader=!1,toastr.error(a.response.data.message,"Error")}))},submit:function(){var t=this;this.loader=!0,axios.get("/member/move/"+this.student_id).then((function(a){toastr.success(a.data.success,"Success"),$("#addStudentModal").modal("hide"),t.$inertia.visit("students"),t.loader=!1})).catch((function(a){t.loader=!1,toastr.error(a.response.data.message,"Error")}))},clearRec:function(){this.addEdit="Add",this.form={}},currentRec:function(t){this.form.student_id=t}}},o=e("KHd+"),n=Object(o.a)(r,(function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("div",[e("layout",[e("title-bar",{attrs:{name:t.compoName}}),t._v(" "),e("div",{staticClass:"row",attrs:{id:"slide-in"}},[e("div",{staticClass:"col-12 "},[e("div",{staticClass:"card"},[e("div",{staticClass:"card-content"},[e("div",{staticClass:"card-body card-dashboard mb-2"},[e("div",{staticClass:"pull-right"},[e("button",{staticClass:"btn btn-primary",attrs:{"data-toggle":"modal","data-target":"#addStudentModal"},on:{click:function(a){return t.clearRec()}}},[e("i",{staticClass:"feather icon-user"}),t._v(" Add Student\n                                ")])]),t._v(" "),e("h4",{staticClass:"card-title"},[t._v("Students")]),t._v(" "),e("div",{staticClass:"table-responsive mt-2"},[e("table",{staticClass:"table table-hover zero-configuration"},[e("thead",[e("tr",[e("th",[t._v("S/N")]),t._v(" "),e("th",[t._v("Student Id")]),t._v(" "),e("th",[t._v("Student Name")]),t._v(" "),e("th",[t._v("Student Email")]),t._v(" "),e("th",[t._v("Student Phone Number")]),t._v(" "),e("th",[t._v("Status")]),t._v(" "),e("th",[t._v("Date Added")]),t._v(" "),t.is("super-admin")?e("th",[t._v("Action")]):t._e()])]),t._v(" "),e("tbody",t._l(t.students,(function(a,s){return e("tr",{key:a.id},[e("td",[t._v(t._s(s+1)+" ")]),t._v(" "),e("td",[t._v(t._s(a.student_id))]),t._v(" "),e("td",[t._v(t._s(a.user.name))]),t._v(" "),e("td",[t._v(t._s(a.user.email))]),t._v(" "),e("td",[t._v(t._s(a.user.phone))]),t._v(" "),e("td",[t._v(t._s(a.status))]),t._v(" "),e("td",[t._v(t._s(a.created_at))]),t._v(" "),t.is("super-admin")?e("td",[a.teachers.length>0?e("button",{staticClass:"btn btn-success btn-rounded btn-sm",attrs:{"data-target":"#assignTeacherModal","data-toggle":"modal"},on:{click:function(e){return t.currentRec(a.id)}}},[t._v("Re-Assign Teacher")]):e("button",{staticClass:"btn btn-success btn-rounded btn-sm",attrs:{"data-target":"#assignTeacherModal","data-toggle":"modal"},on:{click:function(e){return t.currentRec(a.id)}}},[t._v("Assign Teacher")])]):t._e(),t._v(" "),t.is("super-admin")?e("td",[e("button",{staticClass:"btn btn-info btn-rounded btn-sm",on:{click:function(e){return t.deleteStudent(a.user.id)}}},[e("i",{staticClass:"feather icon-delete"})])]):t._e()])})),0)])])])])])])]),t._v(" "),e("div",{staticClass:"modal fade text-left",attrs:{id:"assignTeacherModal",tabindex:"-1",role:"dialog","aria-labelledby":"myModalLabel","aria-hidden":"true"}},[e("div",{staticClass:"modal-dialog modal-dialog-centered modal-dialog-scrollable",attrs:{role:"document"}},[e("div",{staticClass:"modal-content"},[e("div",{staticClass:"modal-header"},[e("h4",{staticClass:"modal-title",attrs:{id:"myModalLabel33"}},[t._v("Assign Teacher ")]),t._v(" "),e("button",{staticClass:"close",attrs:{type:"button","data-dismiss":"modal","aria-label":"Close"}},[e("span",{attrs:{"aria-hidden":"true"}},[t._v("×")])])]),t._v(" "),e("form",{staticClass:"form form-vertical",attrs:{method:"POST",action:"#"},on:{submit:function(a){return a.preventDefault(),t.assign(a)}}},[e("div",{staticClass:"modal-body m-1"},[e("div",{staticClass:"row"},[e("div",{staticClass:"form-group col-12"},[e("label",{attrs:{for:"first-name-icon"}},[t._v("Teachers")]),t._v(" "),e("select",{directives:[{name:"model",rawName:"v-model",value:t.form.teacher_id,expression:"form.teacher_id"}],staticClass:"form-control",attrs:{required:""},on:{change:function(a){var e=Array.prototype.filter.call(a.target.options,(function(t){return t.selected})).map((function(t){return"_value"in t?t._value:t.value}));t.$set(t.form,"teacher_id",a.target.multiple?e:e[0])}}},[e("option",{attrs:{value:""}},[t._v("Select Teacher")]),t._v(" "),t._l(t.allTeachers,(function(a){return e("option",{key:a.id,domProps:{value:a.id}},[t._v(t._s(a.user.name))])}))],2),t._v(" "),e("div",{staticClass:"position-relative has-icon-left"},[e("div",{staticClass:"form-control-position"},[e("i",{staticClass:"feather icon-user"})])])])])]),t._v(" "),e("div",{staticClass:"modal-footer"},[e("button",{staticClass:"btn btn-primary mr-1  waves-effect waves-light",attrs:{type:"submit"}},[t.loader?e("i",{staticClass:"fa fa-circle-o-notch fa-spin mr-3"}):t._e(),t._v("Assign")])])])])])]),t._v(" "),e("div",{staticClass:"modal fade text-left",attrs:{id:"addStudentModal",tabindex:"-1",role:"dialog","aria-labelledby":"myModalLabel33","aria-hidden":"true"}},[e("div",{staticClass:"modal-dialog modal-dialog-centered modal-dialog-scrollable",attrs:{role:"document"}},[e("div",{staticClass:"modal-content"},[e("div",{staticClass:"modal-header"},[e("h4",{staticClass:"modal-title",attrs:{id:"myModalLabel33"}},[t._v(t._s(t.addEdit)+" Student ")]),t._v(" "),e("button",{staticClass:"close",attrs:{type:"button","data-dismiss":"modal","aria-label":"Close"}},[e("span",{attrs:{"aria-hidden":"true"}},[t._v("×")])])]),t._v(" "),e("form",{staticClass:"form form-vertical",attrs:{method:"POST",action:"#"},on:{submit:function(a){return a.preventDefault(),t.submit(a)}}},[e("div",{staticClass:"modal-body m-1"},[e("div",{staticClass:"row"},[e("div",{staticClass:"form-group col-12"},[e("label",{attrs:{for:"first-name-icon"}},[t._v("Students")]),t._v(" "),e("select",{directives:[{name:"model",rawName:"v-model",value:t.student_id,expression:"student_id"}],staticClass:"form-control",attrs:{required:""},on:{change:function(a){var e=Array.prototype.filter.call(a.target.options,(function(t){return t.selected})).map((function(t){return"_value"in t?t._value:t.value}));t.student_id=a.target.multiple?e:e[0]}}},[e("option",{attrs:{value:""}},[t._v("Select Student")]),t._v(" "),t._l(t.allStudents,(function(a){return e("option",{key:a.user.id,domProps:{value:a.user.id}},[t._v(t._s(a.user.name))])}))],2),t._v(" "),e("div",{staticClass:"position-relative has-icon-left"},[e("div",{staticClass:"form-control-position"},[e("i",{staticClass:"feather icon-user"})])])])])]),t._v(" "),e("div",{staticClass:"modal-footer"},[e("button",{staticClass:"btn btn-primary mr-1  waves-effect waves-light",attrs:{type:"submit"}},[t.loader?e("i",{staticClass:"fa fa-circle-o-notch fa-spin mr-3"}):t._e(),t._v("Add")])])])])])])],1)],1)}),[],!1,null,null,null);a.default=n.exports}}]);