(window.webpackJsonp=window.webpackJsonp||[]).push([[51],{521:function(t,e,a){"use strict";a.r(e);var n={data:function(){return{id:"",name:"",start_month:"",end_month:"",months:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],errors:[],loaded:0,token:localStorage.getItem("token")}},mounted:function(){var t=this.$route.params;null!=t.id&&""!=t.id?this.getInfo(t.id):this.loaded=1},methods:{getInfo:function(t){var e=this;axios.create({baseURL:this.apiBaseUrl,headers:{Authorization:"Bearer "+this.token,Accept:"application/json"}}).get("get-fees-installment-info/"+t).then((function(t){var a=t.data.data;e.id=a.id,e.name=a.name,e.start_month=a.start_month,e.end_month=a.end_month,e.loaded=1,$(".select2").each((function(){$(this).trigger("change")}))}))},addData:function(){var t=this,e={name:this.name,start_month:this.start_month,end_month:this.end_month};this.loaded=0,axios.create({baseURL:this.apiBaseUrl,headers:{Authorization:"Bearer "+this.token,Accept:"application/json"}}).post("add-fees-installment",e).then((function(e){e.data.status?t.$router.push({name:"fees-installment"}).then((function(e){t.loaded=1,t.$toast.success("Record saved.")})).catch((function(e){t.loaded=1,console.log(e)})):(t.loaded=1,t.errors=e.data.errors)})).catch((function(e){t.loaded=1,console.log(e)}))},updateData:function(){var t=this,e={id:this.id,name:this.name,start_month:this.start_month,end_month:this.end_month};this.loaded=0,axios.create({baseURL:this.apiBaseUrl,headers:{Authorization:"Bearer "+this.token,Accept:"application/json"}}).post("update-fees-installment",e).then((function(e){e.data.status?t.$router.push({name:"fees-installment"}).then((function(e){t.loaded=1,t.$toast.success("Record saved.")})).catch((function(e){t.loaded=1,console.log(e)})):(t.loaded=1,t.errors=e.data.errors)})).catch((function(e){t.loaded=1}))}}},s=a(0),o=Object(s.a)(n,(function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"dashboard-content-one"},[a("div",{staticClass:"breadcrumbs-area"},[a("div",{staticClass:"float-right"},[a("router-link",{staticClass:"fw-btn-fill btn-gradient-yellow text-white",attrs:{to:{name:"fees-installment"}}},[t._v("View Fees Installment")])],1),t._v(" "),a("h3",[t._v(t._s(t.id?"Edit":"Add")+" Fees Installment")]),t._v(" "),a("ul",[a("li",[a("router-link",{attrs:{to:{name:"dashboard"}}},[t._v("Dashboard")])],1),t._v(" "),a("li",[a("router-link",{attrs:{to:{name:"FeeMaster"}}},[t._v("Fees Management")])],1),t._v(" "),a("li",[a("router-link",{attrs:{to:{name:"fees-installment"}}},[t._v("Fees Installment")])],1),t._v(" "),a("li",[t._v(t._s(t.id?"Edit":"Add")+" Fees Installment")])])]),t._v(" "),a("div",{staticClass:"card height-auto"},[a("div",{staticClass:"card-body"},[t.loaded?t._e():a("div",{staticClass:"text-center"},[a("b-spinner")],1),t._v(" "),t.loaded?a("div",[a("div",{staticClass:"heading-layout1"},[a("div",{staticClass:"item-title"},[a("h3",[t._v(t._s(t.id?"Edit":"Add New")+" Fees Installment")])])]),t._v(" "),a("form",{staticClass:"new-added-form",on:{submit:function(e){e.preventDefault(),t.id?t.updateData():t.addData()}}},[t.errors.length?a("div",{staticClass:"alert alert-danger"},[a("ul",{staticClass:"mb-0"},t._l(t.errors,(function(e,n){return a("li",{key:n},[t._v("\n                "+t._s(e)+"\n              ")])})),0)]):t._e(),t._v(" "),a("input",{directives:[{name:"model",rawName:"v-model",value:t.id,expression:"id"}],attrs:{type:"hidden",value:""},domProps:{value:t.id},on:{input:function(e){e.target.composing||(t.id=e.target.value)}}}),t._v(" "),a("div",{staticClass:"row"},[a("div",{staticClass:"col-xl-3 col-lg-6 col-12 form-group"},[a("label",[t._v("Name *")]),t._v(" "),a("input",{directives:[{name:"model",rawName:"v-model",value:t.name,expression:"name"}],staticClass:"form-control",attrs:{type:"text",placeholder:"",value:"",required:""},domProps:{value:t.name},on:{input:function(e){e.target.composing||(t.name=e.target.value)}}})]),t._v(" "),a("div",{staticClass:"col-xl-3 col-lg-6 col-12 form-group"},[a("label",[t._v("Start Month *")]),t._v(" "),a("select",{directives:[{name:"model",rawName:"v-model",value:t.start_month,expression:"start_month"}],staticClass:"form-control",attrs:{required:""},on:{change:function(e){var a=Array.prototype.filter.call(e.target.options,(function(t){return t.selected})).map((function(t){return"_value"in t?t._value:t.value}));t.start_month=e.target.multiple?a:a[0]}}},[a("option",{attrs:{value:""}},[t._v("Select Month")]),t._v(" "),t._l(t.months,(function(e){return a("option",{key:e,domProps:{value:e}},[t._v("\n                  "+t._s(e)+"\n                ")])}))],2)]),t._v(" "),a("div",{staticClass:"col-xl-3 col-lg-6 col-12 form-group"},[a("label",[t._v("End Month *")]),t._v(" "),a("select",{directives:[{name:"model",rawName:"v-model",value:t.end_month,expression:"end_month"}],staticClass:"form-control",attrs:{required:""},on:{change:function(e){var a=Array.prototype.filter.call(e.target.options,(function(t){return t.selected})).map((function(t){return"_value"in t?t._value:t.value}));t.end_month=e.target.multiple?a:a[0]}}},[a("option",{attrs:{value:""}},[t._v("Select Month")]),t._v(" "),t._l(t.months,(function(e){return a("option",{key:e,domProps:{value:e}},[t._v("\n                  "+t._s(e)+"\n                ")])}))],2)])]),t._v(" "),a("div",{staticClass:"row"},[a("div",{staticClass:"col-12 form-group mg-t-8"},[a("button",{staticClass:"btn-fill-lg btn-gradient-yellow btn-hover-bluedark",attrs:{type:"submit"}},[t._v("\n                "+t._s(t.id?"Update":"Save")+"\n              ")]),t._v(" "),a("button",{staticClass:"btn-fill-lg bg-blue-dark btn-hover-yellow",attrs:{type:"reset"}},[t._v("\n                Reset\n              ")])])])])]):t._e()])])])}),[],!1,null,null,null);e.default=o.exports}}]);