mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-24 22:48:18 +00:00
2 lines
76 KiB
JavaScript
Executable File
Vendored
2 lines
76 KiB
JavaScript
Executable File
Vendored
(window.webpackJsonp=window.webpackJsonp||[]).push([[8],{226:function(t,e,n){var r=n(404);"string"==typeof r&&(r=[[t.i,r,""]]);var a={hmr:!0,transform:void 0,insertInto:void 0};n(25)(r,a);r.locals&&(t.exports=r.locals)},295:function(t,e,n){t.exports=n(408)},403:function(t,e,n){"use strict";n(226)},404:function(t,e,n){(t.exports=n(24)(!1)).push([t.i,".vue-tags-input{max-width:100%!important;display:block}.ti-input,.vue-tags-input{width:100%;border-radius:.25rem}.ti-input{max-width:100%}.ti-new-tag-input{font-size:1rem}",""])},408:function(t,e,n){"use strict";n.r(e);var r=n(23),a=n(2),s=n(11),i=n(10);function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function c(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(Object(n),!0).forEach((function(e){l(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function l(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var u=Object(a.b)("transactions/create"),d=(u.mapState,u.mapGetters),p=(u.mapActions,u.mapMutations),f={props:["index","value","errors"],components:{VueTypeaheadBootstrap:s.a},name:"TransactionDescription",data:function(){return{descriptions:[],initialSet:[]}},created:function(){var t=this;axios.get(this.getACURL("")).then((function(e){t.descriptions=e.data,t.initialSet=e.data}))},methods:c(c({},p(["updateField"])),{},{clearDescription:function(){this.value=""},getACURL:function(t){return document.getElementsByTagName("base")[0].href+"api/v1/autocomplete/transactions?query="+t},lookupDescription:Object(i.debounce)((function(){var t=this;axios.get(this.getACURL(this.value)).then((function(e){t.descriptions=e.data}))}),300)}),watch:{value:function(t){this.updateField({field:"description",index:this.index,value:t})}},computed:c({},d(["transactionType","transactions"]))},h=n(1),v=Object(h.a)(f,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"form-group"},[n("vue-typeahead-bootstrap",{attrs:{inputName:"description[]",data:t.descriptions,placeholder:t.$t("firefly.description"),showOnFocus:!0,autofocus:"",inputClass:t.errors.length>0?"is-invalid":"",minMatchingChars:3,serializer:function(t){return t.description}},on:{input:t.lookupDescription},model:{value:t.value,callback:function(e){t.value=e},expression:"value"}},[n("template",{slot:"append"},[n("div",{staticClass:"input-group-append"},[n("button",{staticClass:"btn btn-outline-secondary",attrs:{type:"button"},on:{click:t.clearDescription}},[n("i",{staticClass:"far fa-trash-alt"})])])])],2),t._v(" "),t.errors.length>0?n("span",t._l(t.errors,(function(e){return n("span",{staticClass:"text-danger small"},[t._v(t._s(e)),n("br")])})),0):t._e()],1)}),[],!1,null,null,null).exports;function m(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function b(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?m(Object(n),!0).forEach((function(e){_(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function _(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var y=Object(a.b)("transactions/create"),g=(y.mapState,y.mapGetters),O=(y.mapActions,{props:["index","errors"],name:"TransactionDate",methods:b({},(0,y.mapMutations)(["updateField","setDate"])),computed:b(b({},g(["transactionType","date","transactions"])),{},{localDate:{get:function(){return this.date instanceof Date&&!isNaN(this.date)?this.date.toISOString().split("T")[0]:""},set:function(t){var e=new Date(t),n=new Date(this.date.getTime());n.setFullYear(e.getFullYear()),n.setMonth(e.getMonth()),n.setDate(e.getDate()),this.setDate({date:n})}},localTime:{get:function(){return this.date instanceof Date&&!isNaN(this.date)?("0"+this.date.getHours()).slice(-2)+":"+("0"+this.date.getMinutes()).slice(-2)+":"+("0"+this.date.getSeconds()).slice(-2):""},set:function(t){var e=new Date(this.date.getTime()),n=t.split(":");e.setHours(parseInt(n[0])),e.setMinutes(parseInt(n[1])),e.setSeconds(parseInt(n[2])),this.setDate({date:e})}}})}),x=Object(h.a)(O,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"form-group"},[n("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[t._v("\n "+t._s(t.$t("firefly.date_and_time"))+"\n ")]),t._v(" "),n("div",{staticClass:"input-group"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.localDate,expression:"localDate"}],ref:"date",class:t.errors.length>0?"form-control is-invalid":"form-control",attrs:{type:"date",title:t.$t("firefly.date"),disabled:t.index>0,autocomplete:"off",name:"date[]",placeholder:t.localDate},domProps:{value:t.localDate},on:{input:function(e){e.target.composing||(t.localDate=e.target.value)}}}),t._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:t.localTime,expression:"localTime"}],ref:"time",class:t.errors.length>0?"form-control is-invalid":"form-control",attrs:{type:"time",title:t.$t("firefly.time"),disabled:t.index>0,autocomplete:"off",name:"time[]",placeholder:t.localTime},domProps:{value:t.localTime},on:{input:function(e){e.target.composing||(t.localTime=e.target.value)}}})]),t._v(" "),t.errors.length>0?n("span",t._l(t.errors,(function(e){return n("span",{staticClass:"text-danger small"},[t._v(t._s(e)),n("br")])})),0):t._e()])}),[],!1,null,null,null).exports;function w(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function C(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?w(Object(n),!0).forEach((function(e){j(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function j(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var T=Object(a.b)("transactions/create"),P=(T.mapState,T.mapGetters),k=(T.mapActions,{props:["index","value","errors"],name:"TransactionBudget",data:function(){return{budgetList:[]}},created:function(){this.collectData()},methods:C(C({},(0,T.mapMutations)(["updateField"])),{},{collectData:function(){this.budgetList.push({id:0,name:this.$t("firefly.no_budget")}),this.getBudgets()},getBudgets:function(){var t=this;axios.get("./api/v1/budgets").then((function(e){t.parseBudgets(e.data)}))},parseBudgets:function(t){for(var e in t.data)if(t.data.hasOwnProperty(e)&&/^0$|^[1-9]\d*$/.test(e)&&e<=4294967294){var n=t.data[e];this.budgetList.push({id:parseInt(n.id),name:n.attributes.name})}}}),watch:{value:function(t){this.updateField({field:"budget_id",index:this.index,value:t})}},computed:C({},P(["transactionType","transactions"]))}),$=Object(h.a)(k,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"form-group"},[n("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[t._v("\n "+t._s(t.$t("firefly.budget"))+"\n ")]),t._v(" "),n("div",{staticClass:"input-group"},[n("select",{directives:[{name:"model",rawName:"v-model",value:t.value,expression:"value"}],ref:"budget",class:t.errors.length>0?"form-control is-invalid":"form-control",attrs:{title:t.$t("firefly.budget"),autocomplete:"off",name:"budget_id[]"},on:{submit:function(t){t.preventDefault()},change:function(e){var n=Array.prototype.filter.call(e.target.options,(function(t){return t.selected})).map((function(t){return"_value"in t?t._value:t.value}));t.value=e.target.multiple?n:n[0]}}},t._l(this.budgetList,(function(e){return n("option",{attrs:{label:e.name},domProps:{value:e.id}},[t._v(t._s(e.name))])})),0)]),t._v(" "),t.errors.length>0?n("span",t._l(t.errors,(function(e){return n("span",{staticClass:"text-danger small"},[t._v(t._s(e)),n("br")])})),0):t._e()])}),[],!1,null,null,null).exports;function A(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function D(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?A(Object(n),!0).forEach((function(e){S(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):A(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function S(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var E=Object(a.b)("transactions/create"),F=(E.mapState,E.mapGetters),I=E.mapActions,L=E.mapMutations,M={name:"TransactionAccount",components:{VueTypeaheadBootstrap:s.a},props:["index","direction","value","errors"],data:function(){return{query:"",accounts:[],accountTypes:[],initialSet:[],selectedAccount:{}}},created:function(){this.createInitialSet()},methods:D(D(D({},L(["updateField","setDestinationAllowedTypes","setSourceAllowedTypes"])),I(["calcTransactionType"])),{},{getACURL:function(t,e){return document.getElementsByTagName("base")[0].href+"api/v1/autocomplete/accounts?types="+t.join(",")+"&query="+e},clearAccount:function(){this.accounts=this.initialSet,this.value={name:""}},lookupAccount:Object(i.debounce)((function(){var t=this;0===this.accountTypes.length&&(this.accountTypes="source"===this.direction?this.sourceAllowedTypes:this.destinationAllowedTypes),axios.get(this.getACURL(this.accountTypes,this.value.name)).then((function(e){t.accounts=e.data}))}),300),createInitialSet:function(){var t=this,e=this.sourceAllowedTypes;"destination"===this.direction&&(e=this.destinationAllowedTypes),axios.get(this.getACURL(e,"")).then((function(e){t.accounts=e.data,t.initialSet=e.data}))}}),watch:{selectedAccount:function(t){this.value=t,this.value.name=this.value.name_with_balance},value:function(t){this.updateField({field:this.accountKey,index:this.index,value:t});var e=[],n=t.type?t.type:"no_type";void 0!==this.allowedOpposingTypes[this.direction]&&void 0!==this.allowedOpposingTypes[this.direction][n]&&(e=this.allowedOpposingTypes[this.direction][n]),"source"===this.direction&&this.setDestinationAllowedTypes(e),"destination"===this.direction&&this.setSourceAllowedTypes(e),this.calcTransactionType()}},computed:D(D({},F(["transactionType","transactions","defaultTransaction","sourceAllowedTypes","destinationAllowedTypes","allowedOpposingTypes"])),{},{accountKey:{get:function(){return"source"===this.direction?"source_account":"destination_account"}}})},N=Object(h.a)(M,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"form-group"},[n("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[t._v("\n "+t._s(t.$t("firefly."+this.direction+"_account"))+"\n ")]),t._v(" "),n("vue-typeahead-bootstrap",{attrs:{data:t.accounts,showOnFocus:!0,inputClass:t.errors.length>0?"is-invalid":"",inputName:t.direction+"[]",serializer:function(t){return t.name_with_balance},minMatchingChars:3,placeholder:t.$t("firefly."+this.direction+"_account")},on:{input:t.lookupAccount,hit:function(e){t.selectedAccount=e}},model:{value:t.value.name,callback:function(e){t.$set(t.value,"name",e)},expression:"value.name"}},[n("template",{slot:"append"},[n("div",{staticClass:"input-group-append"},[n("button",{staticClass:"btn btn-outline-secondary",attrs:{type:"button"},on:{click:t.clearAccount}},[n("i",{staticClass:"far fa-trash-alt"})])])])],2),t._v(" "),t.errors.length>0?n("span",t._l(t.errors,(function(e){return n("span",{staticClass:"text-danger small"},[t._v(t._s(e)),n("br")])})),0):t._e()],1)}),[],!1,null,"528f81f4",null).exports;function R(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function B(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?R(Object(n),!0).forEach((function(e){G(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):R(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function G(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var U=Object(a.b)("transactions/create"),V=(U.mapState,U.mapGetters),q=(U.mapActions,{name:"SwitchAccount",props:["index"],methods:B(B({},(0,U.mapMutations)(["updateField"])),{},{switchAccounts:function(){var t=this.transactions[this.index].source_account,e=this.transactions[this.index].destination_account;this.updateField({field:"source_account",index:this.index,value:e}),this.updateField({field:"destination_account",index:this.index,value:t})}}),computed:B({},V(["transactions","transactionType"]))}),z=Object(h.a)(q,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"form-group"},[n("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},["any"!==this.transactionType?n("span",{staticClass:"text-muted"},[t._v("\n "+t._s(t.$t("firefly."+this.transactionType))+"\n ")]):t._e(),t._v(" "),"any"===this.transactionType?n("span",{staticClass:"text-muted"},[t._v(" ")]):t._e()]),t._v(" "),n("div",{staticClass:"btn-group d-flex"},[n("button",{staticClass:"btn btn-light",on:{click:t.switchAccounts}},[t._v("↔")])])])}),[],!1,null,"7fc33f88",null).exports;function J(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function H(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?J(Object(n),!0).forEach((function(e){W(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):J(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function W(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Y=Object(a.b)("transactions/create"),K=(Y.mapState,Y.mapGetters),Q=(Y.mapActions,{name:"TransactionAmount",props:["index","errors"],data:function(){return{currencySymbol:""}},watch:{transactionType:function(t){switch(t){case"Transfer":case"Withdrawal":return this.currencyId=this.transactions[this.index].source_account.currency_id,void(this.currencySymbol=this.transactions[this.index].source_account.currency_symbol);case"Deposit":return this.currencyId=this.transactions[this.index].destination_account.currency_id,void(this.currencySymbol=this.transactions[this.index].destination_account.currency_symbol)}},destinationAllowedTypes:function(t){void 0!==this.transactions[this.index].source_account.type&&-1!==["Asset account","Loan","Debt","Mortgage"].indexOf(this.transactions[this.index].source_account.type)&&(this.currencyId=this.transactions[this.index].source_account.currency_id,this.currencySymbol=this.transactions[this.index].source_account.currency_symbol)},sourceAllowedTypes:function(t){void 0!==this.transactions[this.index].destination_account.type&&"Transfer"!==this.transactionType&&-1!==["Asset account","Loan","Debt","Mortgage"].indexOf(this.transactions[this.index].destination_account.type)&&(this.currencyId=this.transactions[this.index].destination_account.currency_id,this.currencySymbol=this.transactions[this.index].destination_account.currency_symbol)}},created:function(){this.updateCurrency()},methods:H(H({},(0,Y.mapMutations)(["updateField"])),{},{updateCurrency:function(){0===this.currencyId&&(this.currencySymbol=this.currencyPreference.symbol,this.currencyId=this.currencyPreference.id)}}),computed:H(H({currencyPreference:{get:function(){return this.$store.state.currencyPreference}}},K(["transactionType","transactions","destinationAllowedTypes","sourceAllowedTypes"])),{},{amount:{get:function(){return this.transactions[this.index].amount},set:function(t){this.updateField({field:"amount",index:this.index,value:t})}},currencyId:{get:function(){return this.transactions[this.index].currency_id},set:function(t){this.updateField({field:"currency_id",index:this.index,value:t})}},selectedTransactionType:{get:function(){return this.transactionType},set:function(t){}}})}),X=Object(h.a)(Q,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"form-group"},[n("div",{staticClass:"text-xs"},[t._v(t._s(t.$t("firefly.amount")))]),t._v(" "),n("div",{staticClass:"input-group"},[n("div",{staticClass:"input-group-prepend"},[n("div",{staticClass:"input-group-text"},[t._v(t._s(t.currencySymbol))])]),t._v(" "),n("input",{attrs:{type:"hidden",name:"currency_id[]"},domProps:{value:t.currencyId}}),t._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:t.amount,expression:"amount"}],class:t.errors.length>0?"form-control is-invalid":"form-control",attrs:{title:t.$t("firefly.amount"),autocomplete:"off",name:"amount[]",type:"number",placeholder:t.$t("firefly.amount")},domProps:{value:t.amount},on:{input:function(e){e.target.composing||(t.amount=e.target.value)}}})]),t._v(" "),t.errors.length>0?n("span",t._l(t.errors,(function(e){return n("span",{staticClass:"text-danger small"},[t._v(t._s(e)),n("br")])})),0):t._e()])}),[],!1,null,"4003e1ea",null).exports;function Z(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function tt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Z(Object(n),!0).forEach((function(e){et(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Z(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function et(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var nt=Object(a.b)("transactions/create"),rt=(nt.mapState,nt.mapGetters),at=(nt.mapActions,{name:"TransactionForeignAmount",props:["index","errors"],data:function(){return{currencySymbol:"",allCurrencies:[],selectableCurrencies:[]}},watch:{transactionType:function(t){},destinationAllowedTypes:function(t){},sourceAllowedTypes:function(t){}},created:function(){},methods:tt({},(0,nt.mapMutations)(["updateField"])),computed:tt(tt({currencyPreference:{get:function(){return this.$store.state.currencyPreference}}},rt(["transactionType","transactions","destinationAllowedTypes","sourceAllowedTypes"])),{},{amount:{get:function(){return this.transactions[this.index].foreign_amount},set:function(t){this.updateField({field:"foreign_amount",index:this.index,value:t})}},currencyId:{get:function(){return this.transactions[this.index].foreign_currency_id},set:function(t){this.updateField({field:"foreign_currency_id",index:this.index,value:t})}},selectedTransactionType:{get:function(){return this.transactionType},set:function(t){}}})}),st=Object(h.a)(at,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"form-group"},[n("input",{attrs:{type:"hidden",name:"foreign_currency_id[]"},domProps:{value:t.currencyId}}),t._v(" "),n("div",{staticClass:"text-xs"},[t._v(t._s(t.$t("form.foreign_amount")))]),t._v(" "),n("div",{staticClass:"input-group"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.amount,expression:"amount"}],class:t.errors.length>0?"form-control is-invalid":"form-control",attrs:{title:t.$t("form.foreign_amount"),autocomplete:"off",disabled:0===t.currencyId,name:"foreign_amount[]",type:"number",placeholder:t.$t("form.foreign_amount")},domProps:{value:t.amount},on:{input:function(e){e.target.composing||(t.amount=e.target.value)}}})]),t._v(" "),t.errors.length>0?n("span",t._l(t.errors,(function(e){return n("span",{staticClass:"text-danger small"},[t._v(t._s(e)),n("br")])})),0):t._e()])}),[],!1,null,"39931bed",null).exports;function it(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ot(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?it(Object(n),!0).forEach((function(e){ct(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):it(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function ct(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var lt=Object(a.b)("transactions/create"),ut=(lt.mapState,lt.mapGetters),dt=(lt.mapActions,{name:"TransactionForeignCurrency",props:["index"],data:function(){return{allCurrencies:[],selectableCurrencies:[],lockedCurrency:0,selectIsVisible:!0}},watch:{transactionType:function(t){this.lockedCurrency=0,"Transfer"===t&&(this.currencyId=this.transactions[this.index].destination_account.currency_id,this.currencySymbol=this.transactions[this.index].destination_account.currency_symbol,this.lockedCurrency=this.currencyId),this.filterCurrencies(),this.checkVisibility()},destinationAllowedTypes:function(t){this.lockedCurrency=0,"Transfer"===this.transactionType&&(this.currencyId=this.transactions[this.index].destination_account.currency_id,this.currencySymbol=this.transactions[this.index].destination_account.currency_symbol,this.lockedCurrency=this.currencyId),this.filterCurrencies(),this.checkVisibility()},sourceAllowedTypes:function(t){this.lockedCurrency=0,"Transfer"===this.transactionType&&(this.currencyId=this.transactions[this.index].destination_account.currency_id,this.currencySymbol=this.transactions[this.index].destination_account.currency_symbol,this.lockedCurrency=this.currencyId),this.filterCurrencies(),this.checkVisibility()}},created:function(){this.getAllCurrencies()},methods:ot(ot({},(0,lt.mapMutations)(["updateField"])),{},{checkVisibility:function(){var t=this.transactions[this.index].source_account.currency_id,e=this.transactions[this.index].destination_account.currency_id;this.selectIsVisible=!0,t===e&&0!==t&&"Transfer"===this.transactionType&&(this.selectIsVisible=!1,this.currencyId=0)},getAllCurrencies:function(){var t=this;axios.get("./api/v1/autocomplete/currencies").then((function(e){t.allCurrencies=e.data,t.filterCurrencies()}))},filterCurrencies:function(){if(0===this.lockedCurrency){for(var t in this.selectableCurrencies=[{id:0,name:this.$t("firefly.no_currency")}],this.allCurrencies)if(this.allCurrencies.hasOwnProperty(t)&&/^0$|^[1-9]\d*$/.test(t)&&t<=4294967294){var e=this.allCurrencies[t];this.transactions[this.index].currency_id!==e.id&&this.selectableCurrencies.push(e),this.transactions[this.index].currency_id===e.id&&this.currencyId===e.id&&(this.currencyId=0)}}else for(var n in this.allCurrencies)if(this.allCurrencies.hasOwnProperty(n)&&/^0$|^[1-9]\d*$/.test(n)&&n<=4294967294){var r=this.allCurrencies[n];r.id===this.lockedCurrency&&(this.selectableCurrencies=[r],this.currencyId=r.id)}}}),computed:ot(ot({currencyPreference:{get:function(){return this.$store.state.currencyPreference}}},ut(["transactionType","transactions","destinationAllowedTypes","sourceAllowedTypes"])),{},{currencyId:{get:function(){return this.transactions[this.index].foreign_currency_id},set:function(t){this.updateField({field:"foreign_currency_id",index:this.index,value:t})}},normalCurrencyId:{get:function(){return this.transactions[this.index].currency_id}}})}),pt=Object(h.a)(dt,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.selectIsVisible?n("div",{staticClass:"form-group"},[n("div",{staticClass:"text-xs"},[t._v(" ")]),t._v(" "),n("div",{staticClass:"input-group"},[n("select",{directives:[{name:"model",rawName:"v-model",value:t.currencyId,expression:"currencyId"}],staticClass:"form-control",attrs:{name:"foreign_currency_id[]"},on:{change:function(e){var n=Array.prototype.filter.call(e.target.options,(function(t){return t.selected})).map((function(t){return"_value"in t?t._value:t.value}));t.currencyId=e.target.multiple?n:n[0]}}},t._l(t.selectableCurrencies,(function(e){return n("option",{attrs:{label:e.name},domProps:{value:e.id}},[t._v(t._s(e.name))])})),0)])]):t._e()}),[],!1,null,"7008e22e",null).exports;function ft(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ht(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ft(Object(n),!0).forEach((function(e){vt(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ft(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function vt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var mt=Object(a.b)("transactions/create"),bt=(mt.mapState,mt.mapGetters),_t=(mt.mapActions,mt.mapMutations),yt={name:"TransactionCustomDates",props:["enabledDates","index","errors"],methods:ht(ht(ht({},bt(["transactions"])),_t(["updateField"])),{},{getFieldValue:function(t){var e;return null!==(e=this.transactions()[parseInt(this.index)][t])&&void 0!==e?e:""},setFieldValue:function(t,e){this.updateField({index:this.index,field:e,value:t.target.value})}})},gt=Object(h.a)(yt,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",t._l(t.enabledDates,(function(e,r){return n("div",{staticClass:"form-group"},[e?n("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[t._v("\n "+t._s(t.$t("form."+r))+"\n ")]):t._e(),t._v(" "),e?n("div",{staticClass:"input-group"},[n("input",{ref:r,refInFor:!0,staticClass:"form-control",attrs:{type:"date",title:t.$t("form."+r),autocomplete:"off",name:r+"[]",placeholder:t.$t("form."+r)},domProps:{value:t.getFieldValue(r)},on:{change:function(e){return t.setFieldValue(e,r)},submit:function(t){t.preventDefault()}}})]):t._e()])})),0)}),[],!1,null,"4d30715b",null).exports;function Ot(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function xt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Ot(Object(n),!0).forEach((function(e){wt(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ot(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function wt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Ct=Object(a.b)("transactions/create"),jt=(Ct.mapState,Ct.mapGetters),Tt=(Ct.mapActions,Ct.mapMutations),Pt={props:["value","index","errors"],components:{VueTypeaheadBootstrap:s.a},name:"TransactionCategory",data:function(){return{categories:[],initialSet:[]}},created:function(){var t=this;axios.get(this.getACURL("")).then((function(e){t.categories=e.data,t.initialSet=e.data}))},methods:xt(xt({},Tt(["updateField"])),{},{clearCategory:function(){this.value=null},getACURL:function(t){return document.getElementsByTagName("base")[0].href+"api/v1/autocomplete/categories?query="+t},lookupCategory:Object(i.debounce)((function(){var t=this;axios.get(this.getACURL(this.value)).then((function(e){t.categories=e.data}))}),300)}),watch:{value:function(t){this.updateField({field:"category",index:this.index,value:t})}},computed:xt(xt({},jt(["transactionType","transactions"])),{},{selectedCategory:{get:function(){return this.categories[this.index].name},set:function(t){this.value=t.name}}})},kt=Object(h.a)(Pt,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"form-group"},[n("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[t._v("\n "+t._s(t.$t("firefly.category"))+"\n ")]),t._v(" "),n("vue-typeahead-bootstrap",{attrs:{inputName:"category[]",data:t.categories,placeholder:t.$t("firefly.category"),showOnFocus:!0,inputClass:t.errors.length>0?"is-invalid":"",minMatchingChars:3,serializer:function(t){return t.name}},on:{hit:function(e){t.selectedCategory=e},input:t.lookupCategory},model:{value:t.value,callback:function(e){t.value=e},expression:"value"}},[n("template",{slot:"append"},[n("div",{staticClass:"input-group-append"},[n("button",{staticClass:"btn btn-outline-secondary",attrs:{type:"button"},on:{click:t.clearCategory}},[n("i",{staticClass:"far fa-trash-alt"})])])])],2),t._v(" "),t.errors.length>0?n("span",t._l(t.errors,(function(e){return n("span",{staticClass:"text-danger small"},[t._v(t._s(e)),n("br")])})),0):t._e()],1)}),[],!1,null,null,null).exports;function $t(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function At(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?$t(Object(n),!0).forEach((function(e){Dt(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$t(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Dt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var St=Object(a.b)("transactions/create"),Et=(St.mapState,St.mapGetters),Ft=(St.mapActions,{props:["value","index","errors"],name:"TransactionBill",data:function(){return{billList:[]}},created:function(){this.collectData()},methods:At(At({},(0,St.mapMutations)(["updateField"])),{},{collectData:function(){this.billList.push({id:0,name:this.$t("firefly.no_bill")}),this.getBills()},getBills:function(){var t=this;axios.get("./api/v1/bills").then((function(e){t.parseBills(e.data)}))},parseBills:function(t){for(var e in t.data)if(t.data.hasOwnProperty(e)&&/^0$|^[1-9]\d*$/.test(e)&&e<=4294967294){var n=t.data[e];this.billList.push({id:parseInt(n.id),name:n.attributes.name})}}}),watch:{value:function(t){this.updateField({field:"bill_id",index:this.index,value:t})}},computed:At({},Et(["transactionType","transactions"]))}),It=Object(h.a)(Ft,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"form-group"},[n("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[t._v("\n "+t._s(t.$t("firefly.bill"))+"\n ")]),t._v(" "),n("div",{staticClass:"input-group"},[n("select",{directives:[{name:"model",rawName:"v-model",value:t.value,expression:"value"}],ref:"bill",class:t.errors.length>0?"form-control is-invalid":"form-control",attrs:{title:t.$t("firefly.bill"),autocomplete:"off",name:"bill_id[]"},on:{submit:function(t){t.preventDefault()},change:function(e){var n=Array.prototype.filter.call(e.target.options,(function(t){return t.selected})).map((function(t){return"_value"in t?t._value:t.value}));t.value=e.target.multiple?n:n[0]}}},t._l(this.billList,(function(e){return n("option",{attrs:{label:e.name},domProps:{value:e.id}},[t._v(t._s(e.name))])})),0)]),t._v(" "),t.errors.length>0?n("span",t._l(t.errors,(function(e){return n("span",{staticClass:"text-danger small"},[t._v(t._s(e)),n("br")])})),0):t._e()])}),[],!1,null,null,null).exports,Lt=n(234),Mt=n.n(Lt),Nt=n(48),Rt=n.n(Nt);function Bt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Gt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Bt(Object(n),!0).forEach((function(e){Ut(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Bt(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Ut(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Vt=Object(a.b)("transactions/create"),qt=(Vt.mapState,Vt.mapGetters,Vt.mapActions,Vt.mapMutations),zt={name:"TransactionTags",components:{VueTagsInput:Mt.a},props:["value","index","errors"],data:function(){return{autocompleteItems:[],debounce:null,tags:[],currentTag:"",updateTags:!0}},watch:{currentTag:"initItems",value:function(t){this.updateField({field:"tags",index:this.index,value:t}),this.updateTags=!1,this.tags=t},tags:function(t){if(this.updateTags){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push({text:t[n].text});this.value=e}this.updateTags=!0}},methods:Gt(Gt({},qt(["updateField"])),{},{initItems:function(){var t=this;if(!(this.currentTag.length<2)){var e=document.getElementsByTagName("base")[0].href+"api/v1/autocomplete/tags?query=".concat(this.currentTag);clearTimeout(this.debounce),this.debounce=setTimeout((function(){Rt.a.get(e).then((function(e){t.autocompleteItems=e.data.map((function(t){return{text:t.tag}}))})).catch((function(){return console.warn("Oh. Something went wrong loading tags.")}))}),300)}}})},Jt=(n(403),Object(h.a)(zt,(function(){var t=this,e=this,n=e.$createElement,r=e._self._c||n;return r("div",{staticClass:"form-group"},[r("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[e._v("\n "+e._s(e.$t("firefly.tags"))+"\n ")]),e._v(" "),r("div",{staticClass:"input-group"},[r("vue-tags-input",{attrs:{"add-only-from-autocomplete":!1,"autocomplete-items":e.autocompleteItems,tags:e.tags,title:e.$t("firefly.tags"),placeholder:e.$t("firefly.tags")},on:{"tags-changed":function(e){return t.tags=e}},model:{value:e.currentTag,callback:function(t){e.currentTag=t},expression:"currentTag"}})],1),e._v(" "),e.errors.length>0?r("span",e._l(e.errors,(function(t){return r("span",{staticClass:"text-danger small"},[e._v(e._s(t)),r("br")])})),0):e._e()])}),[],!1,null,null,null).exports);function Ht(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Wt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Ht(Object(n),!0).forEach((function(e){Yt(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ht(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Yt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Kt=Object(a.b)("transactions/create"),Qt=(Kt.mapState,Kt.mapGetters),Xt=(Kt.mapActions,{props:["index","value","errors"],name:"TransactionPiggyBank",data:function(){return{piggyList:[]}},created:function(){this.collectData()},methods:Wt(Wt({},(0,Kt.mapMutations)(["updateField"])),{},{collectData:function(){this.piggyList.push({id:0,name_with_balance:this.$t("firefly.no_piggy_bank")}),this.getPiggies()},getPiggies:function(){var t=this;axios.get("./api/v1/autocomplete/piggy-banks-with-balance").then((function(e){t.parsePiggies(e.data)}))},parsePiggies:function(t){for(var e in t)if(t.hasOwnProperty(e)&&/^0$|^[1-9]\d*$/.test(e)&&e<=4294967294){var n=t[e];this.piggyList.push({id:parseInt(n.id),name_with_balance:n.name_with_balance})}}}),watch:{value:function(t){this.updateField({field:"piggy_bank_id",index:this.index,value:t})}},computed:Wt({},Qt(["transactionType","transactions"]))}),Zt=Object(h.a)(Xt,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"form-group"},[n("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[t._v("\n "+t._s(t.$t("firefly.piggy_bank"))+"\n ")]),t._v(" "),n("div",{staticClass:"input-group"},[n("select",{directives:[{name:"model",rawName:"v-model",value:t.value,expression:"value"}],ref:"piggy_bank_id",class:t.errors.length>0?"form-control is-invalid":"form-control",attrs:{title:t.$t("firefly.piggy_bank"),autocomplete:"off",name:"piggy_bank_id[]"},on:{submit:function(t){t.preventDefault()},change:function(e){var n=Array.prototype.filter.call(e.target.options,(function(t){return t.selected})).map((function(t){return"_value"in t?t._value:t.value}));t.value=e.target.multiple?n:n[0]}}},t._l(this.piggyList,(function(e){return n("option",{attrs:{label:e.name_with_balance},domProps:{value:e.id}},[t._v(t._s(e.name_with_balance))])})),0)]),t._v(" "),t.errors.length>0?n("span",t._l(t.errors,(function(e){return n("span",{staticClass:"text-danger small"},[t._v(t._s(e)),n("br")])})),0):t._e()])}),[],!1,null,null,null).exports;function te(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ee(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var ne=Object(a.b)("transactions/create"),re=(ne.mapState,ne.mapGetters,ne.mapActions,{props:["index","value","errors"],name:"TransactionInternalReference",methods:function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?te(Object(n),!0).forEach((function(e){ee(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},(0,ne.mapMutations)(["updateField"])),watch:{value:function(t){this.updateField({field:"internal_reference",index:this.index,value:t})}}}),ae=Object(h.a)(re,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"form-group"},[n("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[t._v("\n "+t._s(t.$t("firefly.internal_reference"))+"\n ")]),t._v(" "),n("div",{staticClass:"input-group"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.value,expression:"value"}],class:t.errors.length>0?"form-control is-invalid":"form-control",attrs:{type:"text",name:"internal_reference[]",placeholder:t.$t("firefly.internal_reference")},domProps:{value:t.value},on:{input:function(e){e.target.composing||(t.value=e.target.value)}}}),t._v(" "),t._m(0)])])}),[function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"input-group-append"},[e("button",{staticClass:"btn btn-outline-secondary",attrs:{type:"button"}},[e("i",{staticClass:"far fa-trash-alt"})])])}],!1,null,"ce9f5a82",null).exports;function se(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ie(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var oe=Object(a.b)("transactions/create"),ce=(oe.mapState,oe.mapGetters,oe.mapActions,{props:["index","value","errors"],name:"TransactionExternalUrl",methods:function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?se(Object(n),!0).forEach((function(e){ie(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):se(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},(0,oe.mapMutations)(["updateField"])),watch:{value:function(t){this.updateField({field:"external_url",index:this.index,value:t})}}}),le=Object(h.a)(ce,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"form-group"},[n("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[t._v("\n "+t._s(t.$t("firefly.external_url"))+"\n ")]),t._v(" "),n("div",{staticClass:"input-group"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.value,expression:"value"}],class:t.errors.length>0?"form-control is-invalid":"form-control",attrs:{type:"url",name:"external_url[]",placeholder:t.$t("firefly.external_url")},domProps:{value:t.value},on:{input:function(e){e.target.composing||(t.value=e.target.value)}}}),t._v(" "),t._m(0)])])}),[function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"input-group-append"},[e("button",{staticClass:"btn btn-outline-secondary",attrs:{type:"button"}},[e("i",{staticClass:"far fa-trash-alt"})])])}],!1,null,"8b7a9952",null).exports;function ue(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function de(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var pe=Object(a.b)("transactions/create"),fe=(pe.mapState,pe.mapGetters,pe.mapActions,{props:["index","value","errors"],name:"TransactionNotes",methods:function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ue(Object(n),!0).forEach((function(e){de(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ue(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},(0,pe.mapMutations)(["updateField"])),watch:{value:function(t){this.updateField({field:"notes",index:this.index,value:t})}}}),he=Object(h.a)(fe,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"form-group"},[n("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[t._v("\n "+t._s(t.$t("firefly.notes"))+"\n ")]),t._v(" "),n("div",{staticClass:"input-group"},[n("textarea",{directives:[{name:"model",rawName:"v-model",value:t.value,expression:"value"}],class:t.errors.length>0?"form-control is-invalid":"form-control",attrs:{placeholder:t.$t("firefly.notes")},domProps:{value:t.value},on:{input:function(e){e.target.composing||(t.value=e.target.value)}}})])])}),[],!1,null,"5f8039da",null).exports,ve={props:["index","value","errors"],name:"TransactionLinks",data:function(){return{searchResults:[],include:[],locale:"en-US",linkTypes:[],query:"",searching:!1}},created:function(){var t;this.locale=null!==(t=localStorage.locale)&&void 0!==t?t:"en-US",this.getLinkTypes()},watch:{value:function(t){}},methods:{getTextForLinkType:function(t){var e=t.split("-");for(var n in this.linkTypes)if(this.linkTypes.hasOwnProperty(n)&&/^0$|^[1-9]\d*$/.test(n)&&n<=4294967294){var r=this.linkTypes[n];if(e[0]===r.id&&e[1]===r.direction)return r.type}return"text for #"+t},selectTransaction:function(t){for(var e in this.searchResults)if(this.searchResults.hasOwnProperty(e)&&/^0$|^[1-9]\d*$/.test(e)&&e<=4294967294){var n=this.searchResults[e];n.selected&&this.addToSelected(n),n.selected||this.removeFromSelected(n)}},selectLinkType:function(t){for(var e in this.searchResults)if(this.searchResults.hasOwnProperty(e)&&/^0$|^[1-9]\d*$/.test(e)&&e<=4294967294){var n=this.searchResults[e];this.updateSelected(n.transaction_journal_id,n.link_type_id)}},updateSelected:function(t,e){for(var n in this.value)if(this.value.hasOwnProperty(n)&&/^0$|^[1-9]\d*$/.test(n)&&n<=4294967294){var r=this.value[n];parseInt(r.transaction_journal_id)===t&&(this.value[n].link_type_id=e)}},addToSelected:function(t){void 0===this.value.find((function(e){return e.transaction_journal_id===t.transaction_journal_id}))&&this.value.push(t)},removeFromSelected:function(t){for(var e in this.value){if(this.value.hasOwnProperty(e)&&/^0$|^[1-9]\d*$/.test(e)&&e<=4294967294)this.value[e].transaction_journal_id===t.transaction_journal_id&&this.value.splice(parseInt(e),1)}},getLinkTypes:function(){var t=this;axios.get("./api/v1/link_types").then((function(e){t.parseLinkTypes(e.data)}))},parseLinkTypes:function(t){for(var e in t.data)if(t.data.hasOwnProperty(e)&&/^0$|^[1-9]\d*$/.test(e)&&e<=4294967294){var n=t.data[e],r={id:n.id,type:n.attributes.inward,direction:"inward"},a={id:n.id,type:n.attributes.outward,direction:"outward"};r.type===a.type&&(r.type=r.type+" (←)",a.type=a.type+" (→)"),this.linkTypes.push(r),this.linkTypes.push(a)}},search:function(){var t=this;this.searching=!0,this.searchResults=[];var e="./api/v1/search/transactions?limit=10&query="+this.query;axios.get(e).then((function(e){t.parseSearch(e.data)}))},parseSearch:function(t){for(var e in t.data)if(t.data.hasOwnProperty(e)&&/^0$|^[1-9]\d*$/.test(e)&&e<=4294967294)for(var n in t.data[e].attributes.transactions)if(t.data[e].attributes.transactions.hasOwnProperty(n)&&/^0$|^[1-9]\d*$/.test(n)&&n<=4294967294){var r=t.data[e].attributes.transactions[n];r.transaction_group_id=parseInt(t.data[e].id),r.selected=this.isJournalSelected(r.transaction_journal_id),r.link_type_id=this.getJournalLinkType(r.transaction_journal_id),r.link_type_text="",this.searchResults.push(r)}this.searching=!1},getJournalLinkType:function(t){for(var e in this.value)if(this.value.hasOwnProperty(e)&&/^0$|^[1-9]\d*$/.test(e)&&e<=4294967294){var n=this.value[e];if(n.transaction_journal_id===t)return n.link_type_id}return"1-inward"},isJournalSelected:function(t){for(var e in this.value){if(this.value.hasOwnProperty(e)&&/^0$|^[1-9]\d*$/.test(e)&&e<=4294967294)if(this.value[e].transaction_journal_id===t)return!0}return!1}}},me=Object(h.a)(ve,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("div",{staticClass:"form-group"},[n("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[t._v("\n "+t._s(t.$t("firefly.journal_links"))+"\n ")]),t._v(" "),n("div",{staticClass:"row"},[n("div",{staticClass:"col"},[0===t.value.length?n("p",[t._m(0)]):t._e(),t._v(" "),t.value.length>0?n("ul",{staticClass:"list-group"},t._l(t.value,(function(e){return n("li",{staticClass:"list-group-item"},[n("em",[t._v(t._s(t.getTextForLinkType(e.link_type_id)))]),t._v(" "),n("a",{attrs:{href:"./transaction/show/"+e.transaction_group_id}},[t._v(t._s(e.description))]),t._v(" "),"withdrawal"===e.type?n("span",[t._v("\n ("),n("span",{staticClass:"text-danger"},[t._v(t._s(Intl.NumberFormat(t.locale,{style:"currency",currency:e.currency_code}).format(-1*parseFloat(e.amount))))]),t._v(")\n ")]):t._e(),t._v(" "),"deposit"===e.type?n("span",[t._v("\n ("),n("span",{staticClass:"text-success"},[t._v(t._s(Intl.NumberFormat(t.locale,{style:"currency",currency:e.currency_code}).format(parseFloat(e.amount))))]),t._v(")\n ")]):t._e(),t._v(" "),"transfer"===e.type?n("span",[t._v("\n ("),n("span",{staticClass:"text-info"},[t._v(t._s(Intl.NumberFormat(t.locale,{style:"currency",currency:e.currency_code}).format(parseFloat(e.amount))))]),t._v(")\n ")]):t._e(),t._v(" "),t._m(1,!0)])})),0):t._e(),t._v(" "),t.value.length>0?n("div",{staticClass:"form-text"},[t._m(2)]):t._e()])])]),t._v(" "),n("div",{staticClass:"modal",attrs:{tabindex:"-1",id:"linkModal"}},[n("div",{staticClass:"modal-dialog modal-lg"},[n("div",{staticClass:"modal-content"},[t._m(3),t._v(" "),n("div",{staticClass:"modal-body"},[n("div",{staticClass:"container-fluid"},[t._m(4),t._v(" "),n("div",{staticClass:"row"},[n("div",{staticClass:"col"},[n("form",{on:{submit:function(e){return e.preventDefault(),t.search(e)}}},[n("div",{staticClass:"input-group"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.query,expression:"query"}],staticClass:"form-control",attrs:{autocomplete:"off",maxlength:"255",type:"text",name:"search",id:"query",placeholder:"Search query"},domProps:{value:t.query},on:{input:function(e){e.target.composing||(t.query=e.target.value)}}}),t._v(" "),t._m(5)])])])]),t._v(" "),n("div",{staticClass:"row"},[n("div",{staticClass:"col"},[t.searching?n("span",[n("i",{staticClass:"fas fa-spinner fa-spin"})]):t._e(),t._v(" "),t.searchResults.length>0?n("h4",[t._v("Search results")]):t._e(),t._v(" "),t.searchResults.length>0?n("table",{staticClass:"table table-sm"},[t._m(6),t._v(" "),n("tbody",t._l(t.searchResults,(function(e){return n("tr",[n("td",[n("input",{directives:[{name:"model",rawName:"v-model",value:e.selected,expression:"result.selected"}],staticClass:"form-control",attrs:{type:"checkbox"},domProps:{checked:Array.isArray(e.selected)?t._i(e.selected,null)>-1:e.selected},on:{change:[function(n){var r=e.selected,a=n.target,s=!!a.checked;if(Array.isArray(r)){var i=t._i(r,null);a.checked?i<0&&t.$set(e,"selected",r.concat([null])):i>-1&&t.$set(e,"selected",r.slice(0,i).concat(r.slice(i+1)))}else t.$set(e,"selected",s)},function(e){return t.selectTransaction(e)}]}})]),t._v(" "),n("td",[n("select",{directives:[{name:"model",rawName:"v-model",value:e.link_type_id,expression:"result.link_type_id"}],staticClass:"form-control",on:{change:[function(n){var r=Array.prototype.filter.call(n.target.options,(function(t){return t.selected})).map((function(t){return"_value"in t?t._value:t.value}));t.$set(e,"link_type_id",n.target.multiple?r:r[0])},function(e){return t.selectLinkType(e)}]}},t._l(t.linkTypes,(function(e){return n("option",{attrs:{label:e.type},domProps:{value:e.id+"-"+e.direction}},[t._v(t._s(e.type)+"\n ")])})),0)]),t._v(" "),n("td",[n("a",{attrs:{href:"./transactions/show/"+e.transaction_group_id}},[t._v(t._s(e.description))]),t._v(" "),"withdrawal"===e.type?n("span",[t._v("\n ("),n("span",{staticClass:"text-danger"},[t._v(t._s(Intl.NumberFormat(t.locale,{style:"currency",currency:e.currency_code}).format(-1*parseFloat(e.amount))))]),t._v(")\n ")]):t._e(),t._v(" "),"deposit"===e.type?n("span",[t._v("\n ("),n("span",{staticClass:"text-success"},[t._v(t._s(Intl.NumberFormat(t.locale,{style:"currency",currency:e.currency_code}).format(parseFloat(e.amount))))]),t._v(")\n ")]):t._e(),t._v(" "),"transfer"===e.type?n("span",[t._v("\n ("),n("span",{staticClass:"text-info"},[t._v(t._s(Intl.NumberFormat(t.locale,{style:"currency",currency:e.currency_code}).format(parseFloat(e.amount))))]),t._v(")\n ")]):t._e(),t._v(" "),n("br"),t._v(" "),n("em",[n("a",{attrs:{href:"./accounts/show/"+e.source_id}},[t._v(t._s(e.source_name))]),t._v("\n →\n "),n("a",{attrs:{href:"./accounts/show/"+e.destination_id}},[t._v(t._s(e.destination_name))])])])])})),0)]):t._e()])])])]),t._v(" "),t._m(7)])])])])}),[function(){var t=this.$createElement,e=this._self._c||t;return e("button",{staticClass:"btn btn-default btn-xs",attrs:{"data-toggle":"modal","data-target":"#linkModal"}},[e("i",{staticClass:"fas fa-plus"}),this._v(" Add transaction link")])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"btn-group btn-group-xs float-right"},[e("a",{staticClass:"btn btn-xs btn-default",attrs:{href:"#"}},[e("i",{staticClass:"far fa-edit"})]),this._v(" "),e("a",{staticClass:"btn btn-xs btn-danger",attrs:{href:"#"}},[e("i",{staticClass:"far fa-trash-alt"})])])},function(){var t=this.$createElement,e=this._self._c||t;return e("button",{staticClass:"btn btn-default",attrs:{"data-toggle":"modal","data-target":"#linkModal"}},[e("i",{staticClass:"fas fa-plus"})])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"modal-header"},[e("h5",{staticClass:"modal-title"},[this._v("Transaction thing dialog.")]),this._v(" "),e("button",{staticClass:"close",attrs:{type:"button","data-dismiss":"modal","aria-label":"Close"}},[e("span",{attrs:{"aria-hidden":"true"}},[this._v("×")])])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"row"},[e("div",{staticClass:"col"},[e("p",[this._v("\n Use this form to search for transactions you wish to link to this one. When in doubt, use "),e("code",[this._v("id:*")]),this._v(" where the ID is the number from\n the URL.\n ")])])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"input-group-append"},[e("button",{staticClass:"btn btn-default",attrs:{type:"submit"}},[e("i",{staticClass:"fas fa-search"}),this._v(" Search")])])},function(){var t=this.$createElement,e=this._self._c||t;return e("thead",[e("tr",[e("th",{staticStyle:{width:"33%"},attrs:{colspan:"2"}},[this._v("Include?")]),this._v(" "),e("th",[this._v("Transaction")])])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"modal-footer"},[e("button",{staticClass:"btn btn-secondary",attrs:{type:"button","data-dismiss":"modal"}},[this._v("Close")])])}],!1,null,null,null).exports,be={name:"TransactionAttachments",props:["transaction_journal_id"],watch:{transaction_journal_id:function(t){0!==t&&this.doUpload()}},methods:{doUpload:function(){var t=this;for(var e in this.$refs.att.files)this.$refs.att.files.hasOwnProperty(e)&&/^0$|^[1-9]\d*$/.test(e)&&e<=4294967294&&function(){var n=t.$refs.att.files[e],r=new FileReader,a=t;r.onloadend=function(t){if(t.target.readyState===FileReader.DONE){var e={filename:n.name,attachable_type:"TransactionJournal",attachable_id:a.transaction_journal_id};axios.post("./api/v1/attachments",e).then((function(e){var n="./api/v1/attachments/"+e.data.data.id+"/upload";axios.post(n,new Blob([t.target.result])).then((function(t){a.$emit("uploaded-attachments")}))}))}},r.readAsArrayBuffer(n)}();0===this.$refs.att.files.length&&this.$emit("uploaded-attachments",this.transaction_journal_id)}}},_e=Object(h.a)(be,(function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"form-group"},[e("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[this._v("\n "+this._s(this.$t("firefly.attachments"))+"\n ")]),this._v(" "),e("div",{staticClass:"input-group"},[e("input",{ref:"att",staticClass:"form-control",attrs:{type:"file",multiple:"",name:"attachments[]"}})])])}),[],!1,null,"f8d170e2",null).exports;function ye(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ge(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ye(Object(n),!0).forEach((function(e){Oe(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ye(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Oe(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var xe=Object(a.b)("transactions/create"),we=(xe.mapState,xe.mapGetters),Ce=(xe.mapActions,xe.mapMutations),je={props:["value","errors"],name:"TransactionGroupTitle",components:{VueTypeaheadBootstrap:s.a},data:function(){return{descriptions:[],initialSet:[]}},created:function(){var t=this;axios.get(this.getACURL("")).then((function(e){t.descriptions=e.data,t.initialSet=e.data}))},watch:{value:function(t){this.setGroupTitle({groupTitle:t})}},methods:ge(ge(ge({},Ce(["setGroupTitle"])),we(["groupTitle"])),{},{clearDescription:function(){this.setGroupTitle({groupTitle:""}),this.value=""},getACURL:function(t){return document.getElementsByTagName("base")[0].href+"api/v1/autocomplete/transactions?query="+t},lookupDescription:Object(i.debounce)((function(){var t=this;axios.get(this.getACURL(this.value)).then((function(e){t.descriptions=e.data}))}),300)})},Te=Object(h.a)(je,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"form-group"},[n("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[t._v("\n "+t._s(t.$t("firefly.split_transaction_title"))+"\n ")]),t._v(" "),n("vue-typeahead-bootstrap",{attrs:{inputName:"group_title",data:t.descriptions,placeholder:t.$t("firefly.split_transaction_title"),showOnFocus:!0,minMatchingChars:3,serializer:function(t){return t.description},inputClass:t.errors.length>0?"is-invalid":""},on:{input:t.lookupDescription},model:{value:t.value,callback:function(e){t.value=e},expression:"value"}},[n("template",{slot:"append"},[n("div",{staticClass:"input-group-append"},[n("button",{staticClass:"btn btn-outline-secondary",attrs:{type:"button"},on:{click:t.clearDescription}},[n("i",{staticClass:"far fa-trash-alt"})])])])],2),t._v(" "),t.errors.length>0?n("span",t._l(t.errors,(function(e){return n("span",{staticClass:"text-danger small"},[t._v(t._s(e)),n("br")])})),0):t._e()],1)}),[],!1,null,"a36ef926",null).exports;function Pe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ke(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Pe(Object(n),!0).forEach((function(e){$e(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Pe(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function $e(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Ae=Object(a.b)("transactions/create"),De=(Ae.mapState,Ae.mapGetters),Se=(Ae.mapActions,Ae.mapMutations),Ee={name:"Create",components:{TransactionAttachments:_e,TransactionNotes:he,TransactionExternalUrl:le,TransactionGroupTitle:Te,TransactionInternalReference:ae,TransactionPiggyBank:Zt,TransactionTags:Jt,TransactionLinks:me,TransactionBill:It,TransactionCategory:kt,TransactionCustomDates:gt,TransactionForeignCurrency:pt,TransactionForeignAmount:st,TransactionAmount:X,SwitchAccount:z,TransactionAccount:N,TransactionBudget:$,TransactionDescription:v,TransactionDate:x},created:function(){this.storeAllowedOpposingTypes(),this.storeAccountToTransaction(),this.storeCustomDateFields(),this.addTransaction()},data:function(){return{linkSearchResults:[],errorMessage:"",successMessage:"",isSubmitting:!1,isSubmittingTransaction:!1,isSubmittingLinks:!1,isSubmittingAttachments:!1,submitted:!1,submittedTransaction:!1,submittedLinks:!1,submittedAttachments:!1,submittedAttCount:0,groupTitleErrors:[],groupId:0,groupTitle:"",createAnother:!1,resetFormAfter:!1}},computed:ke({},De(["transactionType","transactions","customDateFields","date","groupTitle"])),watch:{submittedTransaction:function(){this.finalizeSubmit()},submittedLinks:function(){this.finalizeSubmit()},submittedAttachments:function(){this.finalizeSubmit()}},methods:ke(ke({},Se(["addTransaction","deleteTransaction","setAllowedOpposingTypes","setAccountToTransaction","setTransactionError","resetErrors","updateField","resetTransactions"])),{},{removeTransaction:function(t){this.$store.commit("transactions/create/deleteTransaction",{index:t})},storeCustomDateFields:function(){var t=this;axios.get("./api/v1/preferences/transaction_journal_optional_fields").then((function(e){var n=e.data.data.attributes.data,r=["interest_date","book_date","process_date","due_date","payment_date","invoice_date"],a={interest_date:!1,book_date:!1,process_date:!1,due_date:!1,payment_date:!1,invoice_date:!1};for(var s in n)n.hasOwnProperty(s)&&-1!==r.indexOf(s)&&(a[s]=n[s]);t.$store.commit("transactions/create/setCustomDateFields",a)}))},finalizeSubmit:function(){var t=this;if(this.submittedTransaction&&this.submittedAttachments&&this.submittedLinks&&!1===this.submitted){if(this.submitted=!0,this.isSubmitting=!1,!1===this.createAnother)return void(window.location.href=window.previousURL+"?transaction_group_id="+this.groupId+"&message=created");this.successMessage=this.$t("firefly.transaction_stored_link",{ID:this.groupId,title:this.groupTitle}),this.resetFormAfter&&(this.submitted=!1,this.resetTransactions(),setTimeout((function(){return t.addTransaction()}),50))}},storeAllowedOpposingTypes:function(){this.setAllowedOpposingTypes(window.allowedOpposingTypes)},storeAccountToTransaction:function(){this.setAccountToTransaction(window.accountToTransaction)},submitTransaction:function(){var t=this;this.isSubmitting=!0,this.isSubmittingTransaction=!0,this.isSubmittingLinks=!0,this.isSubmittingAttachments=!0;var e=this.convertData();axios.post("./api/v1/transactions",e).then((function(n){t.isSubmittingTransaction=!1,t.submittedTransaction=!0,t.submitTransactionLinks(e,n),t.submitAttachments(e,n),t.groupId=parseInt(n.data.data.id),t.groupTitle=null===n.data.data.attributes.group_title?n.data.data.attributes.transactions[0].description:n.data.data.attributes.group_title})).catch((function(e){t.parseErrors(e.response.data)}))},submitAttachments:function(t,e){this.isSubmittingAttachments=!0;var n=e.data.data.attributes.transactions;for(var r in t.transactions)t.transactions.hasOwnProperty(r)&&/^0$|^[1-9]\d*$/.test(r)&&r<=4294967294&&n.hasOwnProperty(r)&&this.updateField({index:r,field:"transaction_journal_id",value:n[0].transaction_journal_id})},uploadedAttachment:function(){this.submittedAttCount++,this.submittedAttCount===this.transactions.length&&(this.submittedAttachments=!0,this.isSubmittingAttachments=!1)},submitTransactionLinks:function(t,e){this.isSubmittingLinks=!0,this.submittedLinks=!1;var n=[],r=e.data.data.attributes.transactions,a=0;for(var s in t.transactions)if(t.transactions.hasOwnProperty(s)&&/^0$|^[1-9]\d*$/.test(s)&&s<=4294967294){var i=t.transactions[s];if(r.hasOwnProperty(s)){var o=r[s];for(var c in i.links)if(i.links.hasOwnProperty(c)&&/^0$|^[1-9]\d*$/.test(c)&&c<=4294967294){var l=i.links[c];a++,0===l.outward_id&&(l.outward_id=o.transaction_journal_id),0===l.inward_id&&(l.inward_id=o.transaction_journal_id),n.push(axios.post("./api/v1/transaction_links",l).then((function(t){})))}}}0===a&&(this.isSubmittingLinks=!1,this.submittedLinks=!0),Promise.all(n).then((function(){this.isSubmittingLinks=!1,this.submittedLinks=!0}))},parseErrors:function(t){for(var e in this.transactions)this.resetErrors({index:e});var n,r;for(var a in this.successMessage=null,this.errorMessage=this.$t("firefly.errors_submission"),void 0===t.errors&&(this.successMessage=null,this.errorMessage=t.message),t.errors)if(t.errors.hasOwnProperty(a)){if("group_title"===a){this.groupTitleErrors=t.errors[a];continue}if("group_title"!==a){n=parseInt(a.split(".")[1]);var s=void 0;switch(r=a.split(".")[2]){case"amount":case"description":case"date":case"tags":s={index:n,field:r,errors:t.errors[a]},this.setTransactionError(s);break;case"budget_id":s={index:n,field:"budget",errors:t.errors[a]},this.setTransactionError(s);break;case"bill_id":s={index:n,field:"bill",errors:t.errors[a]},this.setTransactionError(s);break;case"piggy_bank_id":s={index:n,field:"piggy_bank",errors:t.errors[a]},this.setTransactionError(s);break;case"category_name":s={index:n,field:"category",errors:t.errors[a]},this.setTransactionError(s);break;case"source_name":case"source_id":s={index:n,field:"source",errors:t.errors[a]},this.setTransactionError(s);break;case"destination_name":case"destination_id":s={index:n,field:"destination",errors:t.errors[a]},this.setTransactionError(s);break;case"foreign_amount":case"foreign_currency":s={index:n,field:"foreign_amount",errors:t.errors[a]},this.setTransactionError(s)}}this.transactions[n]}this.isSubmittingTransaction=!1,this.submittedTransaction=!0,this.isSubmitting=!1},convertData:function(){var t={transactions:[]};for(var e in this.groupTitle.length>0&&(t.group_title=this.groupTitle),this.transactions)this.transactions.hasOwnProperty(e)&&/^0$|^[1-9]\d*$/.test(e)&&e<=4294967294&&t.transactions.push(this.convertSplit(e,this.transactions[e]));return t.transactions.length>1&&(t.group_title=t.transactions[0].description),t},convertSplit:function(t,e){var n,r,a,s,i="invalid";this.date instanceof Date&&!isNaN(this.date)&&(i=this.toW3CString(this.date));var o,c,l,u={description:e.description,date:i,type:this.transactionType,source_id:null!==(n=e.source_account.id)&&void 0!==n?n:null,source_name:null!==(r=e.source_account.name)&&void 0!==r?r:null,destination_id:null!==(a=e.destination_account.id)&&void 0!==a?a:null,destination_name:null!==(s=e.destination_account.name)&&void 0!==s?s:null,currency_id:e.currency_id,amount:e.amount,budget_id:e.budget_id,category_name:e.category,tags:e.tags,interest_date:e.interest_date,book_date:e.book_date,process_date:e.process_date,due_date:e.due_date,payment_date:e.payment_date,invoice_date:e.invoice_date,internal_reference:e.internal_reference,external_url:e.external_url,notes:e.notes,external_id:e.external_id,order:0,reconciled:!1};0!==e.piggy_bank_id&&(u.piggy_bank_id=e.piggy_bank_id),0!==e.bill_id&&(u.bill_id=e.bill_id),0!==e.foreign_currency_id&&(u.foreign_currency_id=e.foreign_currency_id),""!==e.foreign_amount&&(u.foreign_amount=e.foreign_amount),o=this.transactionType?this.transactionType.toLowerCase():"any",c=this.transactions[0].source_account.type,l=this.transactions[0].destination_account.type,"any"===o&&["asset","Asset account","Loan","Debt","Mortgage"].includes(c)&&(o="withdrawal"),"any"===o&&["asset","Asset account","Loan","Debt","Mortgage"].includes(l)&&(o="deposit"),u.type=o;var d=[];for(var p in e.links)if(e.links.hasOwnProperty(p)&&/^0$|^[1-9]\d*$/.test(p)&&p<=4294967294){var f=e.links[p],h=f.link_type_id.split("-"),v="outward"===h[1]?0:parseInt(f.transaction_journal_id),m="inward"===h[1]?0:parseInt(f.transaction_journal_id),b={link_type_id:parseInt(h[0]),inward_id:v,outward_id:m};d.push(b)}return u.links=d,u},toW3CString:function(t){var e=t.getFullYear(),n=t.getMonth();++n<10&&(n="0"+n);var r=t.getDate();r<10&&(r="0"+r);var a=t.getHours();a<10&&(a="0"+a);var s=t.getMinutes();s<10&&(s="0"+s);var i=t.getSeconds();i<10&&(i="0"+i);var o=-t.getTimezoneOffset(),c=Math.abs(Math.floor(o/60)),l=Math.abs(o)-60*c;c<10&&(c="0"+c),l<10&&(l="0"+l);var u="+";return o<0&&(u="-"),e+"-"+n+"-"+r+"T"+a+":"+s+":"+i+u+c+":"+l}})},Fe=Object(h.a)(Ee,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[t.errorMessage.length>0?n("div",{staticClass:"alert alert-danger alert-dismissible"},[n("button",{staticClass:"close",attrs:{type:"button","data-dismiss":"alert","aria-hidden":"true"}},[t._v("×")]),t._v(" "),n("h5",[n("i",{staticClass:"icon fas fa-ban"}),t._v(" "+t._s(t.$t("firefly.flash_error")))]),t._v("\n "+t._s(t.errorMessage)+"\n ")]):t._e(),t._v(" "),t.successMessage.length>0?n("div",{staticClass:"alert alert-success alert-dismissible"},[n("button",{staticClass:"close",attrs:{type:"button","data-dismiss":"alert","aria-hidden":"true"}},[t._v("×")]),t._v(" "),n("h5",[n("i",{staticClass:"icon fas fa-thumbs-up"}),t._v(" "+t._s(t.$t("firefly.flash_success")))]),t._v(" "),n("span",{domProps:{innerHTML:t._s(t.successMessage)}})]):t._e(),t._v(" "),t.transactions.length>1?n("div",{staticClass:"row"},[n("div",{staticClass:"col"},[n("ul",{staticClass:"nav nav-pills ml-auto p-2"},t._l(this.transactions,(function(e,r){return n("li",{staticClass:"nav-item"},[n("a",{class:"nav-link"+(0===r?" active":""),attrs:{href:"#split_"+r,"data-toggle":"tab"}},[""!==e.description?n("span",[t._v(t._s(e.description))]):t._e(),t._v(" "),""===e.description?n("span",[t._v("Split "+t._s(r+1))]):t._e()])])})),0)])]):t._e(),t._v(" "),n("div",{staticClass:"tab-content"},t._l(this.transactions,(function(e,r){return n("div",{class:"tab-pane"+(0===r?" active":""),attrs:{id:"split_"+r}},[n("div",{staticClass:"row"},[n("div",{staticClass:"col"},[n("div",{staticClass:"card"},[n("div",{staticClass:"card-header"},[n("h3",{staticClass:"card-title"},[t._v("\n "+t._s(t.$t("firefly.basic_journal_information"))+"\n "),t.transactions.length>1?n("span",[t._v("("+t._s(r+1)+" / "+t._s(t.transactions.length)+") ")]):t._e()])]),t._v(" "),n("div",{staticClass:"card-body"},[n("div",{staticClass:"row"},[n("div",{staticClass:"col"},[n("TransactionDescription",{attrs:{index:r,errors:e.errors.description},model:{value:e.description,callback:function(n){t.$set(e,"description",n)},expression:"transaction.description"}})],1)]),t._v(" "),n("div",{staticClass:"row"},[n("div",{staticClass:"col-xl-5 col-lg-5 col-md-10 col-sm-12 col-xs-12"},[n("TransactionAccount",{attrs:{direction:"source",index:r,errors:e.errors.source},model:{value:e.source_account,callback:function(n){t.$set(e,"source_account",n)},expression:"transaction.source_account"}})],1),t._v(" "),n("div",{staticClass:"col-xl-2 col-lg-2 col-md-2 col-sm-12 text-center d-none d-sm-block"},[n("SwitchAccount",{attrs:{index:r}})],1),t._v(" "),n("div",{staticClass:"col-xl-5 col-lg-5 col-md-12 col-sm-12 col-xs-12"},[n("TransactionAccount",{attrs:{direction:"destination",index:r,errors:e.errors.destination},model:{value:e.destination_account,callback:function(n){t.$set(e,"destination_account",n)},expression:"transaction.destination_account"}})],1)]),t._v(" "),n("div",{staticClass:"row"},[n("div",{staticClass:"col-xl-5 col-lg-5 col-md-10 col-sm-12 col-xs-12"},[n("TransactionAmount",{attrs:{index:r,errors:e.errors.amount}})],1),t._v(" "),n("div",{staticClass:"col-xl-2 col-lg-2 col-md-2 col-sm-12 text-center d-none d-sm-block"},[n("TransactionForeignCurrency",{attrs:{index:r}})],1),t._v(" "),n("div",{staticClass:"col-xl-5 col-lg-5 col-md-12 col-sm-12 col-xs-12"},[n("TransactionForeignAmount",{attrs:{index:r,errors:e.errors.foreign_amount}})],1)]),t._v(" "),n("div",{staticClass:"row"},[n("div",{staticClass:"col-xl-5 col-lg-5 col-md-12 col-sm-12 col-xs-12"},[n("TransactionDate",{attrs:{index:r,errors:e.errors.date}})],1),t._v(" "),n("div",{staticClass:"col-xl-5 col-lg-5 col-md-12 col-sm-12 col-xs-12 offset-xl-2 offset-lg-2"},[n("TransactionCustomDates",{attrs:{index:r,"enabled-dates":t.customDateFields,errors:e.errors.custom_dates}})],1)])])])])]),t._v(" "),n("div",{staticClass:"row"},[n("div",{staticClass:"col"},[n("div",{staticClass:"card"},[n("div",{staticClass:"card-header"},[n("h3",{staticClass:"card-title"},[t._v("\n "+t._s(t.$t("firefly.transaction_journal_meta"))+"\n "),t.transactions.length>1?n("span",[t._v("("+t._s(r+1)+" / "+t._s(t.transactions.length)+") ")]):t._e()])]),t._v(" "),n("div",{staticClass:"card-body"},[n("div",{staticClass:"row"},[n("div",{staticClass:"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12"},[n("TransactionBudget",{attrs:{index:r,errors:e.errors.budget},model:{value:e.budget_id,callback:function(n){t.$set(e,"budget_id",n)},expression:"transaction.budget_id"}}),t._v(" "),n("TransactionCategory",{attrs:{index:r,errors:e.errors.category},model:{value:e.category,callback:function(n){t.$set(e,"category",n)},expression:"transaction.category"}})],1),t._v(" "),n("div",{staticClass:"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12"},[n("TransactionBill",{attrs:{index:r,errors:e.errors.bill},model:{value:e.bill_id,callback:function(n){t.$set(e,"bill_id",n)},expression:"transaction.bill_id"}}),t._v(" "),n("TransactionTags",{attrs:{index:r,errors:e.errors.tags},model:{value:e.tags,callback:function(n){t.$set(e,"tags",n)},expression:"transaction.tags"}}),t._v(" "),n("TransactionPiggyBank",{attrs:{index:r,errors:e.errors.piggy_bank},model:{value:e.piggy_bank_id,callback:function(n){t.$set(e,"piggy_bank_id",n)},expression:"transaction.piggy_bank_id"}})],1)])])])])]),t._v(" "),n("div",{staticClass:"row"},[n("div",{staticClass:"col"},[n("div",{staticClass:"card"},[n("div",{staticClass:"card-header"},[n("h3",{staticClass:"card-title"},[t._v("\n "+t._s(t.$t("firefly.transaction_journal_meta"))+"\n "),t.transactions.length>1?n("span",[t._v("("+t._s(r+1)+" / "+t._s(t.transactions.length)+") ")]):t._e()])]),t._v(" "),n("div",{staticClass:"card-body"},[n("div",{staticClass:"row"},[n("div",{staticClass:"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12"},[n("TransactionInternalReference",{attrs:{index:r,errors:e.errors.internal_reference},model:{value:e.internal_reference,callback:function(n){t.$set(e,"internal_reference",n)},expression:"transaction.internal_reference"}}),t._v(" "),n("TransactionExternalUrl",{attrs:{index:r,errors:e.errors.external_url},model:{value:e.external_url,callback:function(n){t.$set(e,"external_url",n)},expression:"transaction.external_url"}}),t._v(" "),n("TransactionNotes",{attrs:{index:r,errors:e.errors.notes},model:{value:e.notes,callback:function(n){t.$set(e,"notes",n)},expression:"transaction.notes"}})],1),t._v(" "),n("div",{staticClass:"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12"},[n("TransactionAttachments",{ref:"attachments",refInFor:!0,attrs:{index:r,transaction_journal_id:e.transaction_journal_id,submitted_transaction:t.submittedTransaction},on:{"uploaded-attachments":function(e){return t.uploadedAttachment(e)}},model:{value:e.attachments,callback:function(n){t.$set(e,"attachments",n)},expression:"transaction.attachments"}}),t._v(" "),n("TransactionLinks",{attrs:{index:r},model:{value:e.links,callback:function(n){t.$set(e,"links",n)},expression:"transaction.links"}})],1)])])])])])])})),0),t._v(" "),n("div",{staticClass:"row"},[n("div",{staticClass:"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12"},[t.transactions.length>1?n("div",{staticClass:"card"},[n("div",{staticClass:"card-body"},[n("div",{staticClass:"row"},[n("div",{staticClass:"col"},[n("TransactionGroupTitle",{attrs:{errors:this.groupTitleErrors},model:{value:this.groupTitle,callback:function(e){t.$set(this,"groupTitle",e)},expression:"this.groupTitle"}})],1)])])]):t._e()]),t._v(" "),n("div",{staticClass:"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12"},[n("div",{staticClass:"card"},[n("div",{staticClass:"card-body"},[n("div",{staticClass:"row"},[n("div",{staticClass:"col"},[n("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[t._v("\n \n ")]),t._v(" "),n("button",{staticClass:"btn btn-outline-primary btn-block",on:{click:t.addTransaction}},[n("i",{staticClass:"far fa-clone"}),t._v(" "+t._s(t.$t("firefly.add_another_split"))+"\n ")])]),t._v(" "),n("div",{staticClass:"col"},[n("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[t._v("\n \n ")]),t._v(" "),n("button",{staticClass:"btn btn-success btn-block",attrs:{disabled:t.isSubmitting&&!t.submitted},on:{click:t.submitTransaction}},[t.isSubmitting?t._e():n("span",[n("i",{staticClass:"far fa-save"}),t._v(" "+t._s(t.$t("firefly.store_transaction")))]),t._v(" "),t.isSubmitting&&!t.submitted?n("span",[n("i",{staticClass:"fas fa-spinner fa-spin"})]):t._e()])])]),t._v(" "),n("div",{staticClass:"row"},[n("div",{staticClass:"col"},[t._v("\n \n ")]),t._v(" "),n("div",{staticClass:"col"},[n("div",{staticClass:"form-check"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.createAnother,expression:"createAnother"}],staticClass:"form-check-input",attrs:{type:"checkbox",id:"createAnother"},domProps:{checked:Array.isArray(t.createAnother)?t._i(t.createAnother,null)>-1:t.createAnother},on:{change:function(e){var n=t.createAnother,r=e.target,a=!!r.checked;if(Array.isArray(n)){var s=t._i(n,null);r.checked?s<0&&(t.createAnother=n.concat([null])):s>-1&&(t.createAnother=n.slice(0,s).concat(n.slice(s+1)))}else t.createAnother=a}}}),t._v(" "),n("label",{staticClass:"form-check-label",attrs:{for:"createAnother"}},[n("span",{staticClass:"small"},[t._v(t._s(t.$t("firefly.create_another")))])])]),t._v(" "),n("div",{staticClass:"form-check"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.resetFormAfter,expression:"resetFormAfter"}],staticClass:"form-check-input",attrs:{type:"checkbox",id:"resetFormAfter",disabled:!t.createAnother},domProps:{checked:Array.isArray(t.resetFormAfter)?t._i(t.resetFormAfter,null)>-1:t.resetFormAfter},on:{change:function(e){var n=t.resetFormAfter,r=e.target,a=!!r.checked;if(Array.isArray(n)){var s=t._i(n,null);r.checked?s<0&&(t.resetFormAfter=n.concat([null])):s>-1&&(t.resetFormAfter=n.slice(0,s).concat(n.slice(s+1)))}else t.resetFormAfter=a}}}),t._v(" "),n("label",{staticClass:"form-check-label",attrs:{for:"resetFormAfter"}},[n("span",{staticClass:"small"},[t._v(t._s(t.$t("firefly.reset_after")))])])])])])])])])])])}),[],!1,null,"f384bb7c",null).exports,Ie=n(3),Le=n.n(Ie);n(17),Le.a.config.productionTip=!1;var Me=n(19),Ne={};new Le.a({i18n:Me,store:r.a,render:function(t){return t(Fe,{props:Ne})},beforeCreate:function(){this.$store.commit("initialiseStore"),this.$store.dispatch("updateCurrencyPreference")}}).$mount("#transactions_create")}},[[295,0,1]]]);
|
||
//# sourceMappingURL=create.js.map
|