/home/techb158/ileadtechnology.com/SSM/public/js/finance/fee/allocation
Edit: /home/techb158/ileadtechnology.com/SSM/public/js/finance/fee/allocation/create.js (15069B)
(window.webpackJsonp=window.webpackJsonp||[]).push([[215],{"26kk":function(e,t,a){"use strict";a.r(t);var n={components:{feeAllocationForm:a("iJtO").a},data:function(){return{ruuid:this.$route.params.uuid}},mounted:function(){helper.hasPermission("create-fee-allocation")||(helper.notAccessibleMsg(),this.$router.push("/dashboard"))}},o=a("KHd+"),s=Object(o.a)(n,(function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",[a("div",{staticClass:"page-titles"},[a("div",{staticClass:"row"},[a("div",{staticClass:"col-12 col-sm-6"},[a("h3",{staticClass:"text-themecolor"},[e._v(e._s(e.trans("finance.add_new_fee_allocation")))])]),e._v(" "),a("div",{staticClass:"col-12 col-sm-6"},[a("div",{staticClass:"action-buttons pull-right"},[a("button",{staticClass:"btn btn-info btn-sm",on:{click:function(t){return e.$router.push("/finance/fee/allocation")}}},[a("i",{staticClass:"fas fa-list"}),e._v(" "),a("span",{staticClass:"d-none d-sm-inline"},[e._v(e._s(e.trans("finance.fee_allocation")))])])])])])]),e._v(" "),a("div",{staticClass:"container-fluid"},[a("div",{staticClass:"card card-form"},[a("div",{staticClass:"card-body p-t-20"},[a("fee-allocation-form",{attrs:{ruuid:e.ruuid}})],1)])])])}),[],!1,null,null,null);t.default=s.exports},iJtO:function(e,t,a){"use strict";var n={components:{},props:["uuid","ruuid"],data:function(){return{batches:[],fee_groups:[],fee_heads:[],transport_fees:[],late_fee_frequencies:[],selected_batch:null,feeAllocationForm:new Form({is_course_fee:!1,batch_id:"",fee_groups:[]}),fee_allocation:null}},mounted:function(){this.getPreRequisite()},methods:{getPreRequisite:function(){var e=this,t=this.$loading.show();axios.get("/api/fee/allocation/pre-requisite").then((function(a){e.batches=a.batches,e.fee_groups=a.fee_groups,e.fee_heads=a.fee_heads,e.transport_fees=a.transport_fees,e.late_fee_frequencies=a.late_fee_frequencies,e.fee_groups.forEach((function(t){e.feeAllocationForm.fee_groups.push({fee_group_id:t.id,fee_group_name:t.name,has_transport:t.options?t.options.has_transport:0,installments:[]}),e.uuid||e.ruuid||e.addInstallment(t.id)})),(e.uuid||e.ruuid)&&e.getFeeAllocation(),t.hide()})).catch((function(e){t.hide(),helper.showErrorMsg(e)}))},addInstallment:function(e){var t=this.feeAllocationForm.fee_groups.find((function(t){return t.fee_group_id==e})),a=this.addFeeHead(e);t.installments.push({uuid:this.$uuid.v4(),due_date:"",title:"",fee_heads:a,late_fee_applicable:!1,late_fee_frequency:"1",late_fee:"",selected_transport_fee:null,transport_fee_id:""})},addFeeHead:function(e){var t=[];return this.fee_heads.forEach((function(a){a.fee_group_id==e&&t.push({id:a.id,amount:"",name:a.name,is_optional:!1})})),t},confirmDeleteInstallment:function(e,t){var a=this;return function(n){return a.deleteInstallment(e,t)}},deleteInstallment:function(e,t){this.feeAllocationForm.fee_groups.find((function(t){return t.fee_group_id==e})).installments.splice(t,1)},getTitleName:function(e,t){return e+"_"+t+"_title"},getDueDateName:function(e,t){return e+"_"+t+"_due_date"},getFeeName:function(e,t,a){return e+"_"+t+"_"+a+"_fee"},getLateFeeFrequencyName:function(e,t){return e+"_"+t+"_late_fee_frequency"},getLateFeeName:function(e,t){return e+"_"+t+"_late_fee"},getTransportFeeName:function(e,t){return e+"_"+t+"_transport_fee"},getFeeAllocation:function(){var e=this,t=this.$loading.show();axios.get("/api/fee/allocation/"+(this.ruuid||this.uuid)).then((function(a){e.fee_allocation=a,a.paid_count&&!e.ruuid&&(toastr.error(i18n.finance.cannot_modify_fee_allocation),t.hide(),e.$router.push("/finance/fee/allocation")),e.ruuid||(e.selected_batch={name:a.batch.course.name+" "+a.batch.name,id:a.batch_id},e.feeAllocationForm.batch_id=a.batch_id),e.feeAllocationForm.fee_groups.forEach((function(t){a.fee_allocation_groups.find((function(e){return e.fee_group_id===t.fee_group_id})).fee_installments.forEach((function(a){var n=e.addFeeHead(t.fee_group_id);a.fee_installment_details.forEach((function(e){var t=n.find((function(t){return t.id===e.fee_head_id}));t.amount=e.amount?e.amount:"",t.is_optional=e.is_optional?1:0})),t.installments.push({uuid:a.uuid,due_date:a.due_date,title:a.title,fee_heads:n,late_fee_applicable:a.late_fee_applicable,late_fee_frequency:a.late_fee_frequency,late_fee:a.late_fee,transport_fee_id:a.transport_fee_id,selected_transport_fee:a.transport_fee_id?{id:a.transport_fee_id,name:a.transport_fee.name}:null})}))})),t.hide()})).catch((function(e){t.hide(),helper.showErrorMsg(e)}))},proceed:function(){this.uuid?this.update():this.store()},store:function(){var e=this,t=this.$loading.show();this.feeAllocationForm.post("/api/fee/allocation").then((function(a){toastr.success(a.message),t.hide(),e.$router.push("/finance/fee/allocation")})).catch((function(e){t.hide(),helper.showErrorMsg(e)}))},update:function(){var e=this,t=this.$loading.show();this.feeAllocationForm.patch("/api/fee/allocation/"+this.uuid).then((function(a){toastr.success(a.message),t.hide(),e.$router.push("/finance/fee/allocation")})).catch((function(e){t.hide(),helper.showErrorMsg(e)}))},onBatchSelect:function(e){this.feeAllocationForm.batch_id=e.id},onTransportFeeSelect:function(e,t){var a=t.split("_"),n=a[0],o=a[1];this.feeAllocationForm.fee_groups.find((function(e){return e.fee_group_id==n})).installments[o].transport_fee_id=e.id}}},o=a("KHd+"),s=Object(o.a)(n,(function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",[a("form",{on:{submit:function(t){return t.preventDefault(),e.proceed(t)},keydown:function(t){return e.feeAllocationForm.errors.clear(t.target.name)}}},[e.uuid?e._e():a("div",{staticClass:"row"},[a("div",{staticClass:"col-12 col-sm-4"},[a("div",{staticClass:"form-group"},[a("label",{attrs:{for:""}},[e._v(e._s(e.trans("academic.batch")))]),e._v(" "),a("v-select",{attrs:{label:"name","group-values":"batches","group-label":"course_group","group-select":!1,name:"batch_id",id:"batch_id",options:e.batches,placeholder:e.trans("academic.select_batch")},on:{select:e.onBatchSelect,close:function(t){return e.feeAllocationForm.errors.clear("batch_id")},remove:function(t){e.feeAllocationForm.batch_id=""}},model:{value:e.selected_batch,callback:function(t){e.selected_batch=t},expression:"selected_batch"}},[e.batches.length?e._e():a("div",{staticClass:"multiselect__option",attrs:{slot:"afterList"},slot:"afterList"},[e._v("\n "+e._s(e.trans("general.no_option_found"))+"\n ")])]),e._v(" "),a("show-error",{attrs:{"form-name":e.feeAllocationForm,"prop-name":"batch_id"}})],1)]),e._v(" "),e.uuid?e._e():a("div",{staticClass:"col-12 col-sm-4"},[a("div",{staticClass:"form-group"},[a("div",[e._v(e._s(e.trans("finance.is_course_fee")))]),e._v(" "),a("switches",{staticClass:"m-t-20",attrs:{theme:"bootstrap",color:"success"},model:{value:e.feeAllocationForm.is_course_fee,callback:function(t){e.$set(e.feeAllocationForm,"is_course_fee",t)},expression:"feeAllocationForm.is_course_fee"}}),e._v(" "),a("show-error",{attrs:{"form-name":e.feeAllocationForm,"prop-name":"is_course_fee"}})],1)])]),e._v(" "),e.fee_allocation&&!e.ruuid?[e.fee_allocation.course_id?a("h4",[e._v(e._s(e.fee_allocation.course.name))]):a("h4",{staticClass:"card-title"},[e._v(e._s(e.fee_allocation.batch.course.name+" "+e.fee_allocation.batch.name))]),e._v(" "),a("br")]:e._e(),e._v(" "),e.feeAllocationForm.batch_id||e.ruuid?[e._l(e.feeAllocationForm.fee_groups,(function(t){return a("div",{staticClass:"m-b-20 p-4"},[a("h4",[e._v(e._s(t.fee_group_name))]),e._v(" "),t.installments.length?a("div",{staticStyle:{padding:"0px"}},e._l(t.installments,(function(n,o){return a("fieldset",[a("legend",[e._v("\n \t "+e._s(e.trans("finance.fee_installment"))+" - "+e._s(o+1)+" \n \t "),a("span",{directives:[{name:"confirm",rawName:"v-confirm",value:{ok:e.confirmDeleteInstallment(t.fee_group_id,o)},expression:"{ok: confirmDeleteInstallment(fee_group.fee_group_id,index)}"},{name:"tooltip",rawName:"v-tooltip",value:e.trans("finance.delete_fee_installment"),expression:"trans('finance.delete_fee_installment')"}],key:t.fee_group_id+"_"+o,staticClass:"has-error m-l-10 ",staticStyle:{cursor:"pointer"}},[a("i",{staticClass:"fa fa-times-circle"})])]),e._v(" "),a("div",{staticClass:"row",staticStyle:{padding:"0 20px"}},[a("div",{staticClass:"col-12 col-sm-6"},[a("div",{staticClass:"row"},[a("div",{staticClass:"col-12 col-sm-6"},[a("div",{staticClass:"form-group"},[a("label",{attrs:{for:""}},[e._v(e._s(e.trans("finance.fee_installment_title")))]),e._v(" "),a("input",{directives:[{name:"model",rawName:"v-model",value:n.title,expression:"installment.title"}],staticClass:"form-control",attrs:{type:"text",name:e.getTitleName(t.fee_group_id,o),placeholder:e.trans("finance.fee_installment_title")},domProps:{value:n.title},on:{input:function(t){t.target.composing||e.$set(n,"title",t.target.value)}}}),e._v(" "),a("show-error",{attrs:{"form-name":e.feeAllocationForm,"prop-name":e.getTitleName(t.fee_group_id,o)}})],1)]),e._v(" "),a("div",{staticClass:"col-12 col-sm-6"},[a("div",{staticClass:"form-group"},[a("label",{attrs:{for:""}},[e._v(e._s(e.trans("finance.fee_installment_due_date")))]),e._v(" "),a("datepicker",{attrs:{bootstrapStyling:!0,placeholder:e.trans("finance.fee_installment_due_date"),name:e.getDueDateName(t.fee_group_id,o)},on:{selected:function(a){e.feeAllocationForm.errors.clear(e.getDueDateName(t.fee_group_id,o))}},model:{value:n.due_date,callback:function(t){e.$set(n,"due_date",t)},expression:"installment.due_date"}}),e._v(" "),a("show-error",{attrs:{"form-name":e.feeAllocationForm,"prop-name":e.getDueDateName(t.fee_group_id,o)}})],1)]),e._v(" "),a("div",{staticClass:"col-12 col-sm-4"},[a("div",{staticClass:"form-group"},[a("label",{attrs:{for:""}},[e._v(e._s(e.trans("finance.late_fee_applicable")))]),e._v(" "),a("br"),e._v(" "),a("switches",{staticClass:"m-l-20",attrs:{theme:"bootstrap",color:"success"},model:{value:n.late_fee_applicable,callback:function(t){e.$set(n,"late_fee_applicable",t)},expression:"installment.late_fee_applicable"}})],1)]),e._v(" "),n.late_fee_applicable?a("div",{staticClass:"col-12 col-sm-4"},[a("div",{staticClass:"form-group"},[a("label",{attrs:{for:""}},[e._v(e._s(e.trans("finance.late_fee_frequency")))]),e._v(" "),a("select",{directives:[{name:"model",rawName:"v-model",value:n.late_fee_frequency,expression:"installment.late_fee_frequency"}],staticClass:"custom-select col-12",attrs:{name:e.getLateFeeFrequencyName(t.fee_group_id,o)},on:{change:function(t){var a=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.$set(n,"late_fee_frequency",t.target.multiple?a:a[0])}}},e._l(e.late_fee_frequencies,(function(t){return a("option",{domProps:{value:t.value}},[e._v("\n "+e._s(t.text)+"\n ")])})),0),e._v(" "),a("show-error",{attrs:{"form-name":e.feeAllocationForm,"prop-name":e.getLateFeeFrequencyName(t.fee_group_id,o)}})],1)]):e._e(),e._v(" "),n.late_fee_applicable?a("div",{staticClass:"col-12 col-sm-4"},[a("div",{staticClass:"form-group"},[a("label",{attrs:{for:""}},[e._v(e._s(e.trans("finance.late_fee")))]),e._v(" "),a("input",{directives:[{name:"model",rawName:"v-model",value:n.late_fee,expression:"installment.late_fee"}],staticClass:"form-control",attrs:{type:"text",name:e.getLateFeeName(t.fee_group_id,o),placeholder:e.trans("finance.late_fee")},domProps:{value:n.late_fee},on:{input:function(t){t.target.composing||e.$set(n,"late_fee",t.target.value)}}}),e._v(" "),a("show-error",{attrs:{"form-name":e.feeAllocationForm,"prop-name":e.getLateFeeName(t.fee_group_id,o)}})],1)]):e._e()])]),e._v(" "),a("div",{staticClass:"col-12 col-sm-6"},[a("div",{staticClass:"row"},[e._l(n.fee_heads,(function(n){return a("div",{staticClass:"col-12 col-sm-6"},[a("div",{staticClass:"form-group"},[a("label",{attrs:{for:""}},[e._v(e._s(n.name))]),e._v(" "),a("div",{staticClass:"input-group mb-3"},[a("input",{directives:[{name:"model",rawName:"v-model",value:n.amount,expression:"fee_head.amount"}],staticClass:"form-control",attrs:{type:"text",name:e.getFeeName(t.fee_group_id,o,n.id),placeholder:e.trans("finance.fee_installment_amount")},domProps:{value:n.amount},on:{input:function(t){t.target.composing||e.$set(n,"amount",t.target.value)}}}),e._v(" "),a("div",{staticClass:"input-group-append"},[a("div",{staticClass:"input-group-text"},[a("input",{directives:[{name:"model",rawName:"v-model",value:n.is_optional,expression:"fee_head.is_optional"},{name:"tooltip",rawName:"v-tooltip",value:e.trans("finance.fee_is_optional"),expression:"trans('finance.fee_is_optional')"}],attrs:{type:"checkbox"},domProps:{checked:Array.isArray(n.is_optional)?e._i(n.is_optional,null)>-1:n.is_optional},on:{change:function(t){var a=n.is_optional,o=t.target,s=!!o.checked;if(Array.isArray(a)){var i=e._i(a,null);o.checked?i<0&&e.$set(n,"is_optional",a.concat([null])):i>-1&&e.$set(n,"is_optional",a.slice(0,i).concat(a.slice(i+1)))}else e.$set(n,"is_optional",s)}}})])])]),e._v(" "),a("show-error",{attrs:{"form-name":e.feeAllocationForm,"prop-name":e.getFeeName(t.fee_group_id,o,n.id)}})],1)])})),e._v(" "),t.has_transport?a("div",{staticClass:"col-12 col-sm-6"},[a("div",{staticClass:"form-group"},[a("label",{attrs:{for:""}},[e._v(e._s(e.trans("transport.transport")))]),e._v(" "),a("v-select",{attrs:{label:"name",name:e.getTransportFeeName(t.fee_group_id,o),id:e.getTransportFeeName(t.fee_group_id,o),options:e.transport_fees,placeholder:e.trans("general.select_one")},on:{select:e.onTransportFeeSelect,close:function(e){},remove:function(e){n.transport_fee_id=""}},model:{value:n.selected_transport_fee,callback:function(t){e.$set(n,"selected_transport_fee",t)},expression:"installment.selected_transport_fee"}},[e.transport_fees.length?e._e():a("div",{staticClass:"multiselect__option",attrs:{slot:"afterList"},slot:"afterList"},[e._v("\n "+e._s(e.trans("general.no_option_found"))+"\n ")])]),e._v(" "),a("show-error",{attrs:{"form-name":e.feeAllocationForm,"prop-name":e.getTransportFeeName(t.fee_group_id,o)}})],1)]):e._e()],2)])])])})),0):e._e(),e._v(" "),a("button",{staticClass:"btn btn-info btn-sm pull-right",attrs:{type:"button"},on:{click:function(a){return e.addInstallment(t.fee_group_id)}}},[e._v(e._s(e.trans("finance.add_fee_installment")))]),e._v(" "),a("div",{staticClass:"clearfix"})])})),e._v(" "),a("div",{staticClass:"card-footer text-right"},[a("router-link",{directives:[{name:"show",rawName:"v-show",value:e.uuid,expression:"uuid"}],staticClass:"btn btn-danger waves-effect waves-light ",attrs:{to:"/finance/fee/allocation"}},[e._v(e._s(e.trans("general.cancel")))]),e._v(" "),a("button",{staticClass:"btn btn-info waves-effect waves-light",attrs:{type:"submit"}},[e._v(e._s(e.trans("general.save")))])],1)]:e._e()],2)])}),[],!1,null,null,null);t.a=s.exports}}]);
//# sourceMappingURL=create.js.map?id=a16881d9883186816eec