芝麻web文件管理V1.00
编辑当前文件:/home/digitalh/panoramawholesale.com/public/js/bundle/transfer_money.26cd4ed245889bc4.js
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4914],{61670:(t,e,a)=>{a.r(e),a.d(e,{default:()=>o});var s=a(74865),n=a.n(s);const r={metaInfo:{title:"Transfer Money"},data:function(){return{isLoading:!0,SubmitProcessing:!1,serverParams:{columnFilters:{},sort:{field:"id",type:"desc"},page:1,perPage:10},totalRows:"",search:"",limit:"10",transfers:[],accounts:[],editmode:!1,transfer:{id:"",from_account_id:"",to_account_id:"",amount:"",date:(new Date).toISOString().slice(0,10)}}},computed:{columns:function(){return[{label:this.$t("date"),field:"date",tdClass:"text-left",thClass:"text-left"},{label:this.$t("From_Account"),field:"from_account",tdClass:"text-left",thClass:"text-left"},{label:this.$t("To_Account"),field:"to_account",tdClass:"text-left",thClass:"text-left"},{label:this.$t("Amount"),field:"amount",type:"decimal",tdClass:"text-left",thClass:"text-left"},{label:this.$t("Action"),field:"actions",html:!0,tdClass:"text-right",thClass:"text-right",sortable:!1}]}},methods:{updateParams:function(t){this.serverParams=Object.assign({},this.serverParams,t)},onPageChange:function(t){var e=t.currentPage;this.serverParams.page!==e&&(this.updateParams({page:e}),this.get_transfers_money(e))},onPerPageChange:function(t){var e=t.currentPerPage;this.limit!==e&&(this.limit=e,this.updateParams({page:1,perPage:e}),this.get_transfers_money(1))},selectionChanged:function(t){var e=this,a=t.selectedRows;this.selectedIds=[],a.forEach((function(t,a){e.selectedIds.push(t.id)}))},onSortChange:function(t){this.updateParams({sort:{type:t[0].type,field:t[0].field}}),this.get_transfers_money(this.serverParams.page)},onSearch:function(t){this.search=t.searchTerm,this.get_transfers_money(this.serverParams.page)},getValidationState:function(t){var e=t.dirty,a=t.validated,s=t.valid;return e||a?void 0===s?null:s:null},Submit_transfer_money:function(){var t=this;this.$refs.Create_transfer_money.validate().then((function(e){e?t.editmode?t.Update_transfers_money():t.Create_transfer_money():t.makeToast("danger",t.$t("Please_fill_the_form_correctly"),t.$t("Failed"))}))},makeToast:function(t,e,a){this.$root.$bvToast.toast(e,{title:a,variant:t,solid:!0})},New_Transfer:function(){this.reset_Form(),this.editmode=!1,this.$bvModal.show("New_Transfer")},Edit_transfer_money:function(t){this.get_transfers_money(this.serverParams.page),this.reset_Form(),this.transfer=t,this.editmode=!0,this.$bvModal.show("New_Transfer")},get_transfers_money:function(t){var e=this;n().start(),n().set(.1),axios.get("transfer_money?page="+t+"&SortField="+this.serverParams.sort.field+"&SortType="+this.serverParams.sort.type+"&search="+this.search+"&limit="+this.limit).then((function(t){e.transfers=t.data.transfers,e.accounts=t.data.accounts,e.totalRows=t.data.totalRows,n().done(),e.isLoading=!1})).catch((function(t){n().done(),setTimeout((function(){e.isLoading=!1}),500)}))},Create_transfer_money:function(){var t=this;this.transfer.from_account_id!==this.transfer.to_account_id?(this.SubmitProcessing=!0,axios.post("transfer_money",{from_account_id:this.transfer.from_account_id,to_account_id:this.transfer.to_account_id,amount:this.transfer.amount,date:this.transfer.date}).then((function(e){t.SubmitProcessing=!1,Fire.$emit("event_transfers_money"),t.makeToast("success",t.$t("Created_in_successfully"),t.$t("Success"))})).catch((function(e){t.SubmitProcessing=!1,t.makeToast("danger",e.error,t.$t("Failed"))}))):this.makeToast("danger",this.$t("Accounts_cannot_be_the_same"),this.$t("Failed"))},Update_transfers_money:function(){var t=this;this.SubmitProcessing=!0,axios.put("transfer_money/"+this.transfer.id,{from_account_id:this.transfer.from_account_id,to_account_id:this.transfer.to_account_id,amount:this.transfer.amount,date:this.transfer.date}).then((function(e){t.SubmitProcessing=!1,Fire.$emit("event_transfers_money"),t.makeToast("success",t.$t("Updated_in_successfully"),t.$t("Success"))})).catch((function(e){t.SubmitProcessing=!1,t.makeToast("danger",e.error,t.$t("Failed"))}))},reset_Form:function(){this.transfer={id:"",from_account_id:"",to_account_id:"",amount:"",date:(new Date).toISOString().slice(0,10)}},Remove_transfers_money:function(t){var e=this;this.$swal({title:this.$t("Delete.Title"),text:this.$t("Delete.Text"),type:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",cancelButtonText:this.$t("Delete.cancelButtonText"),confirmButtonText:this.$t("Delete.confirmButtonText")}).then((function(a){a.value&&axios.delete("transfer_money/"+t).then((function(){e.$swal(e.$t("Delete.Deleted"),e.$t("Deleted_in_successfully"),"success"),Fire.$emit("Event_delete_transfer")})).catch((function(){e.$swal(e.$t("Delete.Failed"),e.$t("Delete.Therewassomethingwronge"),"warning")}))}))}},created:function(){var t=this;this.get_transfers_money(1),Fire.$on("event_transfers_money",(function(){setTimeout((function(){t.get_transfers_money(t.serverParams.page),t.$bvModal.hide("New_Transfer")}),500)})),Fire.$on("Event_delete_transfer",(function(){setTimeout((function(){t.get_transfers_money(t.serverParams.page)}),500)}))}};const o=(0,a(51900).Z)(r,(function(){var t=this,e=t._self._c;return e("div",{staticClass:"main-content"},[e("breadcumb",{attrs:{page:t.$t("Transfers_Money"),folder:t.$t("Accounting")}}),t._v(" "),t.isLoading?e("div",{staticClass:"loading_page spinner spinner-primary mr-3"}):t._e(),t._v(" "),t.isLoading?t._e():e("b-card",{staticClass:"wrapper"},[e("vue-good-table",{attrs:{mode:"remote",columns:t.columns,totalRows:t.totalRows,rows:t.transfers,"search-options":{enabled:!0,placeholder:t.$t("Search_this_table")},"pagination-options":{enabled:!0,mode:"records",nextLabel:"next",prevLabel:"prev"},styleClass:"table-hover tableOne vgt-table"},on:{"on-page-change":t.onPageChange,"on-per-page-change":t.onPerPageChange,"on-sort-change":t.onSortChange,"on-search":t.onSearch},scopedSlots:t._u([{key:"table-row",fn:function(a){return["actions"==a.column.field?e("span",[e("a",{directives:[{name:"b-tooltip",rawName:"v-b-tooltip.hover",modifiers:{hover:!0}}],attrs:{title:"Edit"},on:{click:function(e){return t.Edit_transfer_money(a.row)}}},[e("i",{staticClass:"i-Edit text-25 text-success cursor-pointer"})]),t._v(" "),e("a",{directives:[{name:"b-tooltip",rawName:"v-b-tooltip.hover",modifiers:{hover:!0}}],attrs:{title:"Delete"},on:{click:function(e){return t.Remove_transfers_money(a.row.id)}}},[e("i",{staticClass:"i-Close-Window text-25 text-danger cursor-pointer"})])]):t._e()]}}],null,!1,675564425)},[e("div",{staticClass:"mt-2 mb-3",attrs:{slot:"table-actions"},slot:"table-actions"},[e("b-button",{staticClass:"btn-rounded",attrs:{variant:"btn btn-primary btn-icon m-1"},on:{click:function(e){return t.New_Transfer()}}},[e("i",{staticClass:"i-Add"}),t._v("\n "+t._s(t.$t("Add"))+"\n ")])],1)])],1),t._v(" "),e("validation-observer",{ref:"Create_transfer_money"},[e("b-modal",{attrs:{"hide-footer":"",size:"lg",id:"New_Transfer",title:t.editmode?t.$t("Edit"):t.$t("Add")}},[e("b-form",{on:{submit:function(e){return e.preventDefault(),t.Submit_transfer_money.apply(null,arguments)}}},[e("b-row",[e("b-col",{attrs:{lg:"6",md:"6",sm:"12"}},[e("validation-provider",{attrs:{name:"date",rules:{required:!0}},scopedSlots:t._u([{key:"default",fn:function(a){return[e("b-form-group",{attrs:{label:t.$t("date")+" *"}},[e("b-form-input",{attrs:{state:t.getValidationState(a),"aria-describedby":"date-feedback",type:"date"},model:{value:t.transfer.date,callback:function(e){t.$set(t.transfer,"date",e)},expression:"transfer.date"}}),t._v(" "),e("b-form-invalid-feedback",{attrs:{id:"OrderTax-feedback"}},[t._v(t._s(a.errors[0]))])],1)]}}])})],1),t._v(" "),e("b-col",{attrs:{lg:"6",md:"6",sm:"12"}},[e("validation-provider",{attrs:{name:"Amount",rules:{required:!0,regex:/^\d*\.?\d*$/}},scopedSlots:t._u([{key:"default",fn:function(a){return[e("b-form-group",{attrs:{label:t.$t("Amount")+" *"}},[e("b-form-input",{attrs:{state:t.getValidationState(a),"aria-describedby":"Amount-feedback",label:"Amount",type:"number",placeholder:t.$t("Amount")},model:{value:t.transfer.amount,callback:function(e){t.$set(t.transfer,"amount",t._n(e))},expression:"transfer.amount"}}),t._v(" "),e("b-form-invalid-feedback",{attrs:{id:"Amount-feedback"}},[t._v(t._s(a.errors[0]))])],1)]}}])})],1),t._v(" "),t.editmode?t._e():e("b-col",{attrs:{lg:"6",md:"6",sm:"12"}},[e("validation-provider",{attrs:{name:"From_Account",rules:{required:!0}},scopedSlots:t._u([{key:"default",fn:function(a){var s=a.valid,n=a.errors;return e("b-form-group",{attrs:{label:t.$t("From_Account")+" *"}},[e("v-select",{class:{"is-invalid":!!n.length},attrs:{state:!n[0]&&(!!s||null),reduce:function(t){return t.value},placeholder:t.$t("Choose_Account"),options:t.accounts.map((function(t){return{label:t.account_name,value:t.id}}))},model:{value:t.transfer.from_account_id,callback:function(e){t.$set(t.transfer,"from_account_id",e)},expression:"transfer.from_account_id"}}),t._v(" "),e("b-form-invalid-feedback",[t._v(t._s(n[0]))])],1)}}],null,!1,404020669)})],1),t._v(" "),t.editmode?t._e():e("b-col",{attrs:{lg:"6",md:"6",sm:"12"}},[e("validation-provider",{attrs:{name:"To_Account",rules:{required:!0}},scopedSlots:t._u([{key:"default",fn:function(a){var s=a.valid,n=a.errors;return e("b-form-group",{attrs:{label:t.$t("To_Account")+" *"}},[e("v-select",{class:{"is-invalid":!!n.length},attrs:{state:!n[0]&&(!!s||null),reduce:function(t){return t.value},placeholder:t.$t("Choose_Account"),options:t.accounts.map((function(t){return{label:t.account_name,value:t.id}}))},model:{value:t.transfer.to_account_id,callback:function(e){t.$set(t.transfer,"to_account_id",e)},expression:"transfer.to_account_id"}}),t._v(" "),e("b-form-invalid-feedback",[t._v(t._s(n[0]))])],1)}}],null,!1,3697038621)})],1),t._v(" "),e("b-col",{staticClass:"mt-3",attrs:{md:"12"}},[e("b-button",{attrs:{variant:"primary",type:"submit",disabled:t.SubmitProcessing}},[e("i",{staticClass:"i-Yes me-2 font-weight-bold"}),t._v(" "+t._s(t.$t("submit")))]),t._v(" "),t.SubmitProcessing?t._m(0):t._e()],1)],1)],1)],1)],1)],1)}),[function(){var t=this._self._c;return t("div",{staticClass:"typo__p"},[t("div",{staticClass:"spinner sm spinner-primary mt-3"})])}],!1,null,null,null).exports}}]);