Files
firefly-iii/public/v2/js/transactions/create.js
2021-01-17 08:52:40 +01:00

2 lines
51 KiB
JavaScript
Executable File
Vendored
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(window.webpackJsonp=window.webpackJsonp||[]).push([[8],{226:function(t,e,n){var r=n(403);"string"==typeof r&&(r=[[t.i,r,""]]);var i={hmr:!0,transform:void 0,insertInto:void 0};n(25)(r,i);r.locals&&(t.exports=r.locals)},294:function(t,e,n){t.exports=n(408)},402:function(t,e,n){"use strict";n(226)},403: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),i=n(2),a=n(17),s=n(16);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(i.b)("transactions/create"),d=(u.mapState,u.mapGetters),p=(u.mapActions,u.mapMutations),f={props:["index","description"],components:{VueTypeaheadBootstrap:a.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.description=""},getACURL:function(t){return document.getElementsByTagName("base")[0].href+"api/v1/autocomplete/transactions?query="+t},lookupDescription:Object(s.debounce)((function(){var t=this;console.log("lookupDescription"),axios.get(this.getACURL(this.description)).then((function(e){t.descriptions=e.data}))}),300)}),watch:{description:function(t){console.log("Index "+this.index+": "+t)}},computed:c(c({},d(["transactionType","transactions"])),{},{selectedDescription:{get:function(){},set:function(t){this.description=t.description}}})},b=n(1),m=Object(b.a)(f,(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.description"))+"\n ")]),t._v(" "),n("vue-typeahead-bootstrap",{attrs:{inputName:"description[]",data:t.descriptions,placeholder:t.$t("firefly.description"),showOnFocus:!0,autofocus:"",minMatchingChars:3,serializer:function(t){return t.description}},on:{input:t.lookupDescription},model:{value:t.description,callback:function(e){t.description=e},expression:"description"}},[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)],1)}),[],!1,null,null,null).exports;function h(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 y(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?h(Object(n),!0).forEach((function(e){g(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):h(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 v=Object(i.b)("transactions/create"),_=(v.mapState,v.mapGetters),O=(v.mapActions,{name:"TransactionDate",props:["value","index"],methods:y({},(0,v.mapMutations)(["updateField"])),computed:y(y({},_(["transactionType","transactions"])),{},{date:{get:function(){return this.transactions[0].date},set:function(t){this.updateField({field:"date",index:this.index,value:t})}},time:{get:function(){return this.transactions[0].time},set:function(t){this.updateField({field:"time",index:this.index,value:t})}}})}),x=Object(b.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.date,expression:"date"}],ref:"date",staticClass:"form-control",attrs:{type:"date",title:t.$t("firefly.date"),disabled:t.index>0,autocomplete:"off",name:"date[]",placeholder:t.date},domProps:{value:t.date},on:{submit:function(t){t.preventDefault()},input:function(e){e.target.composing||(t.date=e.target.value)}}}),t._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:t.time,expression:"time"}],ref:"time",staticClass:"form-control",attrs:{type:"time",title:t.$t("firefly.time"),disabled:t.index>0,autocomplete:"off",name:"time[]",placeholder:t.time},domProps:{value:t.time},on:{submit:function(t){t.preventDefault()},input:function(e){e.target.composing||(t.time=e.target.value)}}})])])}),[],!1,null,"4b3b558d",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 w(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){C(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 C(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var P=Object(i.b)("transactions/create"),T=(P.mapState,P.mapGetters),k=(P.mapActions,{props:["index"],name:"TransactionBudget",data:function(){return{budgetList:[]}},created:function(){this.collectData()},methods:w(w({},(0,P.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})}}}),computed:w(w({},T(["transactionType","transactions"])),{},{budget_id:{get:function(){return this.transactions[this.index].budget_id},set:function(t){this.updateField({field:"budget_id",index:this.index,value:t})}}})}),D=Object(b.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.budget_id,expression:"budget_id"}],ref:"budget",staticClass:"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.budget_id=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)])])}),[],!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 S(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){$(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 $(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(i.b)("transactions/create"),F=(E.mapState,E.mapGetters),I=E.mapActions,L=E.mapMutations,B={name:"TransactionAccount",components:{VueTypeaheadBootstrap:a.a},props:["index","direction"],data:function(){return{query:"",accounts:[],account:"",accountTypes:[],initialSet:[]}},created:function(){this.createInitialSet()},methods:S(S(S({},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.account="",this.selectedAccount=this.defaultTransaction.source_account,this.accounts=this.initialSet},lookupAccount:Object(s.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.account)).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.account=t?t.name_with_balance:null,this.calcTransactionType();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)},sourceAllowedTypes:function(t){"source"===this.direction&&this.createInitialSet()},destinationAllowedTypes:function(t){"destination"===this.direction&&this.createInitialSet()}},computed:S(S({},F(["transactionType","transactions","defaultTransaction","sourceAllowedTypes","destinationAllowedTypes","allowedOpposingTypes"])),{},{accountKey:{get:function(){return"source"===this.direction?"source_account":"destination_account"}},selectedAccount:{get:function(){return this.transactions[this.index][this.accountKey]},set:function(t){this.updateField({field:this.accountKey,index:this.index,value:t})}}})},M=Object(b.a)(B,(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,inputName:t.direction+"[]",serializer:function(t){return t.name_with_balance},minMatchingChars:3,placeholder:t.$t("firefly."+this.direction+"_account")},on:{hit:function(e){t.selectedAccount=e},input:t.lookupAccount},model:{value:t.account,callback:function(e){t.account=e},expression:"account"}},[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)],1)}),[],!1,null,"2f4233e0",null).exports;function N(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 R(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?N(Object(n),!0).forEach((function(e){U(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):N(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function U(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var G=Object(i.b)("transactions/create"),V=(G.mapState,G.mapGetters),q=(G.mapActions,{name:"SwitchAccount",props:["index"],methods:R(R({},(0,G.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:R({},V(["transactions","transactionType"]))}),z=Object(b.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 K(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 W(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?K(Object(n),!0).forEach((function(e){J(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):K(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 X=Object(i.b)("transactions/create"),H=(X.mapState,X.mapGetters),Q=(X.mapActions,{name:"TransactionAmount",props:["index"],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:W(W({},(0,X.mapMutations)(["updateField"])),{},{updateCurrency:function(){0===this.currencyId&&(this.currencySymbol=this.currencyPreference.symbol,this.currencyId=this.currencyPreference.id)}}),computed:W(W({currencyPreference:{get:function(){return this.$store.state.currencyPreference}}},H(["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){}}})}),Y=Object(b.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"}],staticClass:"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)}}})])])}),[],!1,null,"a9ad4872",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(i.b)("transactions/create"),rt=(nt.mapState,nt.mapGetters),it=(nt.mapActions,{name:"TransactionForeignAmount",props:["index"],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){}}})}),at=Object(b.a)(it,(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"}],staticClass:"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)}}})])])}),[],!1,null,"422824c7",null).exports;function st(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?st(Object(n),!0).forEach((function(e){ct(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):st(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(i.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(b.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 bt(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){mt(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 mt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var ht=Object(i.b)("transactions/create"),yt=(ht.mapState,ht.mapGetters,ht.mapActions,{name:"TransactionCustomDates",props:["enabledDates","index"],data:function(){return{dates:{interest_date:"",book_date:"",process_date:"",due_date:"",payment_date:"",invoice_date:""}}},created:function(){},methods:bt(bt({},(0,ht.mapMutations)(["updateField"])),{},{getFieldValue:function(t){return this.dates[t]},setFieldValue:function(t,e){this.dates[e]=t.target.value,this.updateField({index:this.index,field:e,value:t.target.value})}})}),gt=Object(b.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,"7e3c4e38",null).exports;function vt(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 _t(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?vt(Object(n),!0).forEach((function(e){Ot(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vt(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Ot(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var xt=Object(i.b)("transactions/create"),jt=(xt.mapState,xt.mapGetters),wt=(xt.mapActions,xt.mapMutations),Ct={props:["index"],components:{VueTypeaheadBootstrap:a.a},name:"TransactionCategory",data:function(){return{categories:[],initialSet:[],category:""}},created:function(){var t=this;axios.get(this.getACURL("")).then((function(e){t.categories=e.data,t.initialSet=e.data}))},methods:_t(_t({},wt(["updateField"])),{},{clearCategory:function(){this.category=""},getACURL:function(t){return document.getElementsByTagName("base")[0].href+"api/v1/autocomplete/categories?query="+t},lookupCategory:Object(s.debounce)((function(){var t=this;axios.get(this.getACURL(this.category)).then((function(e){t.categories=e.data}))}),300)}),watch:{category:function(t){console.log('Watch category: "'+t+'"'),this.updateField({field:"category",index:this.index,value:t})}},computed:_t(_t({},jt(["transactionType","transactions"])),{},{selectedCategory:{get:function(){return this.categories[this.index].name},set:function(t){this.updateField({field:"category",index:this.index,value:t.name})}}})},Pt=Object(b.a)(Ct,(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,minMatchingChars:3,serializer:function(t){return t.name}},on:{hit:function(e){t.selectedCategory=e},input:t.lookupCategory},model:{value:t.category,callback:function(e){t.category=e},expression:"category"}},[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)],1)}),[],!1,null,null,null).exports;function Tt(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 kt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Tt(Object(n),!0).forEach((function(e){Dt(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Tt(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 At=Object(i.b)("transactions/create"),St=(At.mapState,At.mapGetters),$t=(At.mapActions,{props:["index"],name:"TransactionBill",data:function(){return{billList:[]}},created:function(){this.collectData()},methods:kt(kt({},(0,At.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})}}}),computed:kt(kt({},St(["transactionType","transactions"])),{},{bill_id:{get:function(){return this.transactions[this.index].bill_id},set:function(t){this.updateField({field:"bill_id",index:this.index,value:t})}}})}),Et=Object(b.a)($t,(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.bill_id,expression:"bill_id"}],ref:"bill",staticClass:"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.bill_id=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)])])}),[],!1,null,null,null).exports,Ft=n(234),It=n.n(Ft),Lt=n(48),Bt=n.n(Lt);function Mt(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 Nt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Mt(Object(n),!0).forEach((function(e){Rt(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Mt(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Rt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Ut=Object(i.b)("transactions/create"),Gt=(Ut.mapState,Ut.mapGetters,Ut.mapActions,Ut.mapMutations),Vt={name:"TransactionTags",components:{VueTagsInput:It.a},props:["value","error","index"],data:function(){return{tag:"",autocompleteItems:[],debounce:null,tags:this.value}},watch:{tag:"initItems"},methods:Nt(Nt({},Gt(["updateField"])),{},{update:function(t){this.autocompleteItems=[],this.tags=t;var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(t[n].text);this.updateField({field:"tags",index:this.index,value:e})},hasError:function(){return this.error.length>0},initItems:function(){var t=this;if(!(this.tag.length<2)){var e=document.getElementsByTagName("base")[0].href+"api/v1/autocomplete/tags?query=".concat(this.tag);clearTimeout(this.debounce),this.debounce=setTimeout((function(){Bt.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.")}))}),600)}}})},qt=(n(402),Object(b.a)(Vt,(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.tags"))+"\n ")]),t._v(" "),n("div",{staticClass:"input-group"},[n("vue-tags-input",{attrs:{"add-only-from-autocomplete":!1,"autocomplete-items":t.autocompleteItems,tags:t.tags,title:t.$t("firefly.tags"),placeholder:t.$t("firefly.tags")},on:{"tags-changed":t.update},model:{value:t.tag,callback:function(e){t.tag=e},expression:"tag"}})],1)])}),[],!1,null,null,null).exports);function zt(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 Kt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?zt(Object(n),!0).forEach((function(e){Wt(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):zt(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 Jt=Object(i.b)("transactions/create"),Xt=(Jt.mapState,Jt.mapGetters),Ht=(Jt.mapActions,{props:["index"],name:"TransactionPiggyBank",data:function(){return{piggyList:[]}},created:function(){this.collectData()},methods:Kt(Kt({},(0,Jt.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})}}}),computed:Kt(Kt({},Xt(["transactionType","transactions"])),{},{piggy_bank_id:{get:function(){return this.transactions[this.index].piggy_bank_id},set:function(t){this.updateField({field:"piggy_bank_id",index:this.index,value:t})}}})}),Qt=Object(b.a)(Ht,(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.piggy_bank_id,expression:"piggy_bank_id"}],ref:"piggy_bank_id",staticClass:"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.piggy_bank_id=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)])])}),[],!1,null,null,null).exports;function Yt(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 Zt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var te=Object(i.b)("transactions/create"),ee=(te.mapState,te.mapGetters,te.mapActions,{props:["index"],name:"TransactionInternalReference",methods:function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Yt(Object(n),!0).forEach((function(e){Zt(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Yt(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},(0,te.mapMutations)(["updateField"])),data:function(){return{internalReference:""}},watch:{internalReference:function(t){this.updateField({field:"internal_reference",index:this.index,value:t})}}}),ne=Object(b.a)(ee,(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.internalReference,expression:"internalReference"}],staticClass:"form-control",attrs:{type:"text",name:"internal_reference[]",placeholder:t.$t("firefly.internal_reference")},domProps:{value:t.internalReference},on:{input:function(e){e.target.composing||(t.internalReference=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,"4d73ba58",null).exports;function re(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 ae=Object(i.b)("transactions/create"),se=(ae.mapState,ae.mapGetters,ae.mapActions,{props:["index"],name:"TransactionExternalUrl",methods:function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?re(Object(n),!0).forEach((function(e){ie(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):re(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},(0,ae.mapMutations)(["updateField"])),data:function(){return{externalUrl:""}},watch:{externalUrl:function(t){this.updateField({field:"external_url",index:this.index,value:t})}}}),oe=Object(b.a)(se,(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.externalUrl,expression:"externalUrl"}],staticClass:"form-control",attrs:{type:"url",name:"external_url[]",placeholder:t.$t("firefly.external_url")},domProps:{value:t.externalUrl},on:{input:function(e){e.target.composing||(t.externalUrl=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,"46725506",null).exports;function ce(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 le(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var ue=Object(i.b)("transactions/create"),de=(ue.mapState,ue.mapGetters,ue.mapActions,{props:["index"],name:"TransactionNotes",methods:function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ce(Object(n),!0).forEach((function(e){le(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ce(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},(0,ue.mapMutations)(["updateField"])),data:function(){return{notes:""}},watch:{notes:function(t){this.updateField({field:"notes",index:this.index,value:t})}}}),pe=Object(b.a)(de,(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.notes,expression:"notes"}],staticClass:"form-control",attrs:{placeholder:"Notes"},domProps:{value:t.notes},on:{input:function(e){e.target.composing||(t.notes=e.target.value)}}})])])}),[],!1,null,"a677ec60",null).exports;function fe(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 be(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?fe(Object(n),!0).forEach((function(e){me(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):fe(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function me(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var he=Object(i.b)("transactions/create"),ye=(he.mapState,he.mapGetters),ge=(he.mapActions,he.mapMutations),ve={name:"Create",components:{TransactionNotes:pe,TransactionExternalUrl:oe,TransactionInternalReference:ne,TransactionPiggyBank:Qt,TransactionTags:qt,TransactionBill:Et,TransactionCategory:Pt,TransactionCustomDates:gt,TransactionForeignCurrency:pt,TransactionForeignAmount:at,TransactionAmount:Y,SwitchAccount:z,TransactionAccount:M,TransactionBudget:D,TransactionDescription:m,TransactionDate:x},created:function(){this.storeAllowedOpposingTypes(),this.storeAccountToTransaction(),this.storeCustomDateFields(),this.addTransaction()},data:function(){return{groupTitle:"",isSubmitting:!1}},computed:be({},ye(["transactionType","transactions","customDateFields"])),methods:be(be({},ge(["addTransaction","deleteTransaction","setAllowedOpposingTypes","setAccountToTransaction"])),{},{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"],i={interest_date:!1,book_date:!1,process_date:!1,due_date:!1,payment_date:!1,invoice_date:!1};for(var a in n)n.hasOwnProperty(a)&&-1!==r.indexOf(a)&&(i[a]=n[a]);t.$store.commit("transactions/create/setCustomDateFields",i)}))},storeAllowedOpposingTypes:function(){this.setAllowedOpposingTypes(window.allowedOpposingTypes)},storeAccountToTransaction:function(){this.setAccountToTransaction(window.accountToTransaction)},submitTransaction:function(){this.isSubmitting=!0;var t=this.convertData();console.log("Would have submitted:"),console.log(t),this.isSubmitting=!1},convertData:function(){var t={transactions:[]};for(var e in 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},convertSplit:function(t,e){var n,r,i,a;return{description:e.description,date:(e.date+" "+e.time).trim(),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!==(i=e.destination_account.id)&&void 0!==i?i:null,destination_name:null!==(a=e.destination_account.name)&&void 0!==a?a:null,currency_id:e.currency_id,amount:e.amount,foreign_currency_id:e.foreign_currency_id,foreign_amount:e.foreign_amount,budget_id:e.budget_id,category:e.category,bill_id:e.bill_id,tags:e.tags,piggy_bank_id:e.piggy_bank_id,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}}})},_e=Object(b.a)(ve,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[t._l(this.transactions,(function(e,r){return n("div",{staticClass:"row"},[n("div",{staticClass:"col"},[n("div",{staticClass:"card"},[n("div",{staticClass:"card-header"},[n("h3",{staticClass:"card-title"},[0===t.transactions.length?n("span",[t._v(t._s(t.$t("firefly.create_new_transaction")))]):t._e(),t._v(" "),t.transactions.length>1?n("span",[t._v(t._s(t.$t("firefly.single_split"))+" "+t._s(r+1)+" / "+t._s(t.transactions.length))]):t._e()]),t._v(" "),t.transactions.length>1?n("div",{staticClass:"card-tools"},[n("button",{staticClass:"btn btn-xs btn-danger",attrs:{type:"button"},on:{click:function(e){return t.removeTransaction(r)}}},[n("i",{staticClass:"fa fa-trash"})])]):t._e()]),t._v(" "),n("div",{staticClass:"card-body"},[n("h4",[t._v(t._s(t.$t("firefly.basic_journal_information"))+": "+t._s(e.description))]),t._v(" "),t._m(0,!0),t._v(" "),n("div",{staticClass:"row"},[n("div",{staticClass:"col"},[t._v("\n Description:\n "),n("TransactionDescription",{attrs:{description:e.description,index:r},on:{"update:description":function(n){return t.$set(e,"description",n)}}})],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:{selectedAccount:e.source_account,direction:"source",index:r}})],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:{selectedAccount:e.destination_account,direction:"destination",index:r}})],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}})],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}})],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:{date:e.date,time:e.time,index:r}})],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}})],1)]),t._v(" "),n("h4",[t._v(t._s(t.$t("firefly.transaction_journal_meta")))]),t._v(" "),n("div",{staticClass:"row"},[n("div",{staticClass:"col"},[n("TransactionBudget",{attrs:{budget_id:t.transactions[r].budget_id,index:r}}),t._v(" "),n("TransactionCategory",{attrs:{category:e.category,index:r}})],1),t._v(" "),n("div",{staticClass:"col"},[n("TransactionBill",{attrs:{bill_id:t.transactions[r].bill_id,index:r}}),t._v(" "),n("TransactionTags",{attrs:{index:r,tags:t.transactions[r].tags}}),t._v(" "),n("TransactionPiggyBank",{attrs:{index:r,piggy_bank_id:t.transactions[r].piggy_bank_id}})],1)]),t._v(" "),n("h4",[t._v(t._s(t.$t("firefly.transaction_journal_extra")))]),t._v(" "),n("div",{staticClass:"row"},[n("div",{staticClass:"col"},[n("TransactionInternalReference",{attrs:{index:r,internalReference:e.internal_reference}}),t._v(" "),n("TransactionExternalUrl",{attrs:{index:r,externalUrl:e.external_url}}),t._v(" "),n("TransactionNotes",{attrs:{index:r,notes:e.notes}})],1),t._v(" "),n("div",{staticClass:"col"},[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(" "),t._m(1,!0)])])])])])])])})),t._v(" "),n("div",{staticClass:"row"},[n("div",{staticClass:"col"},[n("button",{staticClass:"btn btn-primary",on:{click:t.addTransaction}},[t._v(t._s(t.$t("firefly.add_another_split")))])]),t._v(" "),n("div",{staticClass:"col"},[n("p",{staticClass:"float-right"},[n("button",{staticClass:"btn btn-success",attrs:{disabled:t.isSubmitting},on:{click:t.submitTransaction}},[t._v("Store transaction")]),t._v(" "),n("br")])])]),t._v(" "),t._m(2)],2)}),[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"row"},[n("div",{staticClass:"col"},[n("p",{staticClass:"d-block d-sm-none"},[t._v("XS")]),t._v(" "),n("p",{staticClass:"d-none d-sm-block d-md-none"},[t._v("SM")]),t._v(" "),n("p",{staticClass:"d-none d-md-block d-lg-none"},[t._v("MD")]),t._v(" "),n("p",{staticClass:"d-none d-lg-block d-xl-none"},[t._v("LG")]),t._v(" "),n("p",{staticClass:"d-none d-xl-block"},[t._v("XL")])])])},function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"row"},[n("div",{staticClass:"col"},[n("p",[n("em",[t._v("No transaction links")])]),t._v(" "),n("ul",{staticClass:"list-group"},[n("li",{staticClass:"list-group-item"},[n("em",[t._v("is paid by")]),t._v(" "),n("a",{attrs:{href:"#"}},[t._v("Some other transaction")]),t._v(" ("),n("span",{staticClass:"text-success"},[t._v("$ 12.34")]),t._v(")\n "),n("div",{staticClass:"btn-group btn-group-xs float-right"},[n("a",{staticClass:"btn btn-xs btn-default",attrs:{href:"#"}},[n("i",{staticClass:"far fa-edit"})]),t._v(" "),n("a",{staticClass:"btn btn-xs btn-danger",attrs:{href:"#"}},[n("i",{staticClass:"far fa-trash-alt"})])])]),t._v(" "),n("li",{staticClass:"list-group-item"},[n("em",[t._v("is paid by")]),t._v(" "),n("a",{attrs:{href:"#"}},[t._v("Some other transaction")]),t._v(" ("),n("span",{staticClass:"text-success"},[t._v("$ 12.34")]),t._v(")\n "),n("div",{staticClass:"btn-group btn-group-xs float-right"},[n("a",{staticClass:"btn btn-xs btn-default",attrs:{href:"#"}},[n("i",{staticClass:"far fa-edit"})]),t._v(" "),n("a",{staticClass:"btn btn-xs btn-danger",attrs:{href:"#"}},[n("i",{staticClass:"far fa-trash-alt"})])])])]),t._v(" "),n("div",{staticClass:"form-text"},[n("a",{staticClass:"btn btn-default",attrs:{href:"#"}},[n("i",{staticClass:"fas fa-plus"})])])])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"row"},[e("div",{staticClass:"col float-right"},[e("p",{staticClass:"text-right"},[e("small",{staticClass:"text-muted"},[this._v("Create another another another "),e("input",{attrs:{type:"checkbox"}})]),e("br"),this._v(" "),e("small",{staticClass:"text-muted"},[this._v("Return here "),e("input",{attrs:{type:"checkbox"}})]),e("br")])])])}],!1,null,"60bb5498",null).exports,Oe=n(3),xe=n.n(Oe);n(15),xe.a.config.productionTip=!1;var je=n(19),we={};new xe.a({i18n:je,store:r.a,render:function(t){return t(_e,{props:we})},beforeCreate:function(){this.$store.commit("initialiseStore"),this.$store.dispatch("updateCurrencyPreference")}}).$mount("#transactions_create")}},[[294,0,1]]]);
//# sourceMappingURL=create.js.map