/home/techb158/ileadtechnology.com/SSM/public/js/transport/route
Edit: /home/techb158/ileadtechnology.com/SSM/public/js/transport/route/assign.js (8167B)
(window.webpackJsonp=window.webpackJsonp||[]).push([[357],{sH4B:function(t,s,e){"use strict";e.r(s);var r={components:{},data:function(){return{routeAssignForm:new Form({batch_id:"",students:[]},!1),batches:[],selected_batch:null,selected_batch_detail:{},student_records:[],transport_routes:[],help_topic:""}},mounted:function(){helper.hasPermission("assign-transport-route")||(helper.notAccessibleMsg(),this.$router.push("/dashboard")),this.getPreRequisite()},methods:{hasPermission:function(t){return helper.hasPermission(t)},getPreRequisite:function(){var t=this,s=this.$loading.show();axios.get("/api/transport/route/assign/pre-requisite").then((function(e){t.batches=e.batches,t.transport_routes=e.transport_routes,s.hide()})).catch((function(t){s.hide(),helper.showErrorMsg(t)}))},getRouteName:function(t){return"route_"+t},getStoppageName:function(t){return"stoppage_"+t},getStoppages:function(t){var s=[];return t.transport_route_details.forEach((function(t){s.push({id:t.id,name:t.transport_stoppage.name})})),s},getStudent:function(){var t=this,s=this.$loading.show();axios.post("/api/transport/route/assign/fetch",{batch_id:this.routeAssignForm.batch_id}).then((function(e){t.student_records=e.student_records,t.selected_batch_detail=e.batch,t.routeAssignForm.students=[],t.student_records.forEach((function(s){var e=!s.transport_route_student,r=null,o=null;e||(r=t.transport_routes.find((function(t){return t.id==s.transport_route_student.transport_route_detail.transport_route_id}))),e||(o={id:s.transport_route_student.transport_route_detail.id,name:s.transport_route_student.transport_route_detail.transport_stoppage.name}),t.routeAssignForm.students.push({id:s.id,name:t.getStudentName(s.student),admission_number:helper.getAdmissionNumber(s.admission),roll_number:s.roll_number,no_transport:e,transport_route:r,transport_route_detail:o})})),t.routeAssignForm.students.sort((function(t,s){var e=t.name.toUpperCase(),r=s.name.toUpperCase();return e
r?1:0})),s.hide()})).catch((function(t){s.hide(),helper.showErrorMsg(t)}))},getStudentName:function(t){return helper.getStudentName(t)},getRollNumberName:function(t){return t+"_roll_number"},onBatchSelect:function(t){var s=this.$loading.show();this.routeAssignForm.batch_id=t.id,this.getStudent(),s.hide()},onBatchRemove:function(t){this.routeAssignForm.batch_id="",this.routeAssignForm.students=[],this.student_records=[]},submit:function(){var t=this,s=this.$loading.show();this.routeAssignForm.post("/api/transport/route/assign").then((function(e){toastr.success(e.message),t.routeAssignForm.batch_id="",t.selected_batch=null,t.routeAssignForm.students=[],s.hide()})).catch((function(t){s.hide(),helper.showErrorMsg(t)}))}},filters:{moment:function(t){return helper.formatDate(t)},momentDateTime:function(t){return helper.formatDateTime(t)}}},o=e("KHd+"),n=Object(o.a)(r,(function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("div",[e("div",{staticClass:"page-titles"},[e("div",{staticClass:"row"},[e("div",{staticClass:"col-12 col-sm-6"},[e("h3",{staticClass:"text-themecolor"},[t._v(t._s(t.trans("transport.assign_route")))])]),t._v(" "),e("div",{staticClass:"col-12 col-sm-6"},[e("div",{staticClass:"action-buttons pull-right"},[t.hasPermission("list-transport-route")?e("button",{directives:[{name:"tooltip",rawName:"v-tooltip",value:t.trans("transport.route"),expression:"trans('transport.route')"}],staticClass:"btn btn-info btn-sm",on:{click:function(s){return t.$router.push("/transport/route")}}},[e("i",{staticClass:"fas fa-route"}),t._v(" "),e("span",{staticClass:"d-none d-sm-inline"},[t._v(t._s(t.trans("transport.route")))])]):t._e(),t._v(" "),e("help-button",{on:{clicked:function(s){t.help_topic="transport"}}})],1)])])]),t._v(" "),e("div",{staticClass:"container-fluid"},[e("div",{staticClass:"row"},[e("div",{staticClass:"col-12"},[e("div",{staticClass:"card"},[e("div",{staticClass:"card-body p-4"},[e("form",{on:{submit:function(s){return s.preventDefault(),t.submit(s)},keydown:function(s){return t.routeAssignForm.errors.clear(s.target.name)}}},[e("div",{staticClass:"row"},[e("div",{staticClass:"col-12 col-sm-3"},[e("div",{staticClass:"form-group"},[e("label",{attrs:{for:""}},[t._v(t._s(t.trans("academic.batch")))]),t._v(" "),e("v-select",{attrs:{label:"name","group-values":"batches","group-label":"course_group","group-select":!1,name:"batch_id",id:"batch_id",options:t.batches,placeholder:t.trans("academic.select_batch")},on:{select:t.onBatchSelect,close:function(s){return t.routeAssignForm.errors.clear("batch_id")},remove:t.onBatchRemove},model:{value:t.selected_batch,callback:function(s){t.selected_batch=s},expression:"selected_batch"}},[t.batches.length?t._e():e("div",{staticClass:"multiselect__option",attrs:{slot:"afterList"},slot:"afterList"},[t._v("\n\t\t\t\t\t\t "+t._s(t.trans("general.no_option_found"))+"\n\t\t\t\t\t\t ")])]),t._v(" "),e("show-error",{attrs:{"form-name":t.routeAssignForm,"prop-name":"batch_id"}})],1)])]),t._v(" "),t.routeAssignForm.students.length?e("div",[e("div",{staticClass:"row m-b-10"},[e("div",{staticClass:"col-2"},[t._v("\n\t\t\t\t\t\t\t\t\t\t\t"+t._s(t.trans("student.admission_number_short"))+"\n\t\t\t\t\t\t \t\t")]),t._v(" "),e("div",{staticClass:"col-2"},[t._v("\n\t\t\t\t\t\t\t\t\t\t\t"+t._s(t.trans("student.name"))+"\n\t\t\t\t\t\t \t\t")]),t._v(" "),e("div",{staticClass:"col-2"}),t._v(" "),e("div",{staticClass:"col-3"}),t._v(" "),e("div",{staticClass:"col-3"})]),t._v(" "),t._l(t.routeAssignForm.students,(function(s,r){return e("div",{staticClass:"row"},[e("div",{staticClass:"col-2"},[t._v("\n\t\t\t\t\t\t\t\t\t\t\t"+t._s(s.admission_number)+"\n\t\t\t\t\t\t \t\t")]),t._v(" "),e("div",{staticClass:"col-2"},[t._v("\n\t\t\t\t\t\t\t\t\t\t\t"+t._s(s.name)+"\n\t\t\t\t\t\t \t\t")]),t._v(" "),e("div",{staticClass:"col-2"},[e("div",{staticClass:"form-group"},[e("label",{staticClass:"custom-control custom-checkbox"},[e("input",{directives:[{name:"model",rawName:"v-model",value:s.no_transport,expression:"student.no_transport"}],staticClass:"custom-control-input",attrs:{type:"checkbox",value:"1"},domProps:{checked:Array.isArray(s.no_transport)?t._i(s.no_transport,"1")>-1:s.no_transport},on:{change:function(e){var r=s.no_transport,o=e.target,n=!!o.checked;if(Array.isArray(r)){var a=t._i(r,"1");o.checked?a<0&&t.$set(s,"no_transport",r.concat(["1"])):a>-1&&t.$set(s,"no_transport",r.slice(0,a).concat(r.slice(a+1)))}else t.$set(s,"no_transport",n)}}}),t._v(" "),e("span",{staticClass:"custom-control-label"},[t._v(t._s(t.trans("transport.no_transport")))])])])]),t._v(" "),e("div",{staticClass:"col-3"},[s.no_transport?t._e():e("div",{staticClass:"form-group"},[e("v-select",{attrs:{label:"name",name:t.getRouteName(r),options:t.transport_routes,placeholder:t.trans("transport.select_route")},on:{close:function(s){t.routeAssignForm.errors.clear(t.getRouteName(r))},select:function(t){s.transport_route_detail=null}},model:{value:s.transport_route,callback:function(e){t.$set(s,"transport_route",e)},expression:"student.transport_route"}}),t._v(" "),e("show-error",{attrs:{"form-name":t.routeAssignForm,"prop-name":t.getRouteName(r)}})],1)]),t._v(" "),e("div",{staticClass:"col-3"},[s.transport_route?e("div",{staticClass:"form-group"},[e("v-select",{attrs:{label:"name",name:t.getStoppageName(r),options:t.getStoppages(s.transport_route),placeholder:t.trans("transport.select_stoppage")},on:{close:function(s){t.routeAssignForm.errors.clear(t.getStoppageName(r))}},model:{value:s.transport_route_detail,callback:function(e){t.$set(s,"transport_route_detail",e)},expression:"student.transport_route_detail"}}),t._v(" "),e("show-error",{attrs:{"form-name":t.routeAssignForm,"prop-name":t.getStoppageName(r)}})],1):t._e()])])}))],2):t._e(),t._v(" "),t.routeAssignForm.students.length?e("div",{staticClass:"form-group"},[e("button",{staticClass:"btn btn-info pull-right",attrs:{type:"submit"}},[t._v(t._s(t.trans("general.save")))])]):t._e()])])])])])]),t._v(" "),e("right-panel",{attrs:{topic:t.help_topic}})],1)}),[],!1,null,null,null);s.default=n.exports}}]);
//# sourceMappingURL=assign.js.map?id=1ecaf61b1d66860144c7