(self.webpackChunk=self.webpackChunk||[]).push([[847],{232:(e,t,a)=>{"use strict";a.r(t);var n=a(7760),s=a.n(n),o=a(7152),i=a(4605);window.$=window.jQuery=a(9755),window.axios=a(9669),window.axios.defaults.headers.common["X-Requested-With"]="XMLHttpRequest";var r=document.head.querySelector('meta[name="csrf-token"]');r?window.axios.defaults.headers.common["X-CSRF-TOKEN"]=r.content:console.error("CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token");var c=document.head.querySelector('meta[name="locale"]');localStorage.locale=c?c.content:"en_US",a(6891),a(3734),a(7632),a(5432),window.vuei18n=o.Z,window.uiv=i,s().use(vuei18n),s().use(i),window.Vue=s()},9899:(e,t,a)=>{"use strict";a.d(t,{Z:()=>m});var n=a(7760),s=a.n(n),o=a(629),i=a(4478),r=a(3465);const c={namespaced:!0,state:function(){return{transactionType:"any",groupTitle:"",transactions:[],customDateFields:{interest_date:!1,book_date:!1,process_date:!1,due_date:!1,payment_date:!1,invoice_date:!1},defaultTransaction:(0,i.f$)(),defaultErrors:(0,i.kQ)()}},getters:{transactions:function(e){return e.transactions},groupTitle:function(e){return e.groupTitle},transactionType:function(e){return e.transactionType},accountToTransaction:function(e){return e.accountToTransaction},defaultTransaction:function(e){return e.defaultTransaction},sourceAllowedTypes:function(e){return e.sourceAllowedTypes},destinationAllowedTypes:function(e){return e.destinationAllowedTypes},allowedOpposingTypes:function(e){return e.allowedOpposingTypes},customDateFields:function(e){return e.customDateFields}},actions:{},mutations:{addTransaction:function(e){var t=r(e.defaultTransaction);t.errors=r(e.defaultErrors),e.transactions.push(t)},resetErrors:function(e,t){e.transactions[t.index].errors=r(e.defaultErrors)},resetTransactions:function(e){e.transactions=[]},setGroupTitle:function(e,t){e.groupTitle=t.groupTitle},setCustomDateFields:function(e,t){e.customDateFields=t},deleteTransaction:function(e,t){e.transactions.splice(t.index,1),e.transactions.length},setTransactionType:function(e,t){e.transactionType=t},setAllowedOpposingTypes:function(e,t){e.allowedOpposingTypes=t},setAccountToTransaction:function(e,t){e.accountToTransaction=t},updateField:function(e,t){e.transactions[t.index][t.field]=t.value},setTransactionError:function(e,t){e.transactions[t.index].errors[t.field]=t.errors},setDestinationAllowedTypes:function(e,t){e.destinationAllowedTypes=t},setSourceAllowedTypes:function(e,t){e.sourceAllowedTypes=t}}};const l={namespaced:!0,state:function(){return{}},getters:{},actions:{},mutations:{}};const u={namespaced:!0,state:function(){return{viewRange:"default",start:null,end:null,defaultStart:null,defaultEnd:null}},getters:{start:function(e){return e.start},end:function(e){return e.end},defaultStart:function(e){return e.defaultStart},defaultEnd:function(e){return e.defaultEnd},viewRange:function(e){return e.viewRange}},actions:{initialiseStore:function(e){"default"===e.state.viewRange&&axios.get("./api/v1/preferences/viewRange").then((function(t){var a=t.data.data.attributes.data;e.commit("setViewRange",a),e.dispatch("setDatesFromViewRange")})).catch((function(t){e.commit("setViewRange","1M"),e.dispatch("setDatesFromViewRange")}))},setDatesFromViewRange:function(e){if(localStorage.viewRangeStart&&e.commit("setStart",new Date(localStorage.viewRangeStart)),localStorage.viewRangeEnd&&e.commit("setEnd",new Date(localStorage.viewRangeEnd)),localStorage.viewRangeDefaultStart&&e.commit("setDefaultStart",new Date(localStorage.viewRangeDefaultStart)),localStorage.viewRangeDefaultEnd&&e.commit("setDefaultEnd",new Date(localStorage.viewRangeDefaultEnd)),null===e.getters.end||null===e.getters.start){var t,a;switch(e.getters.viewRange){case"1D":t=new Date,a=new Date(t.getTime()),t.setHours(0,0,0,0),a.setHours(23,59,59,999);break;case"1W":t=new Date,a=new Date(t.getTime());var n=t.getDate()-t.getDay()+(0===t.getDay()?-6:1);t.setDate(n),t.setHours(0,0,0,0);var s=a.getDate()-(a.getDay()-1)+6;a.setDate(s),a.setHours(23,59,59,999);break;case"1M":t=new Date,(t=new Date(t.getFullYear(),t.getMonth(),1)).setHours(0,0,0,0),(a=new Date(t.getFullYear(),t.getMonth()+1,0)).setHours(23,59,59,999);break;case"3M":t=new Date,a=new Date;var o=Math.floor((t.getMonth()+3)/3)-1;(t=new Date(t.getFullYear(),[0,3,6,9][o],1)).setHours(0,0,0,0),a=new Date(a.getFullYear(),[2,5,8,11][o],1),(a=new Date(a.getFullYear(),a.getMonth()+1,0)).setHours(23,59,59,999);break;case"6M":t=new Date,a=new Date;var i=t.getMonth()<=5?0:1;(t=new Date(t.getFullYear(),[0,6][i],1)).setHours(0,0,0,0),a=new Date(a.getFullYear(),[5,11][i],1),(a=new Date(a.getFullYear(),a.getMonth()+1,0)).setHours(23,59,59,999);break;case"1Y":t=new Date,a=new Date,t=new Date(t.getFullYear(),0,1),a=new Date(a.getFullYear(),11,31),t.setHours(0,0,0,0),a.setHours(23,59,59,999)}e.commit("setStart",t),e.commit("setEnd",a),e.commit("setDefaultStart",t),e.commit("setDefaultEnd",a)}}},mutations:{setStart:function(e,t){e.start=t,window.localStorage.setItem("viewRangeStart",t)},setEnd:function(e,t){e.end=t,window.localStorage.setItem("viewRangeEnd",t)},setDefaultStart:function(e,t){e.defaultStart=t,window.localStorage.setItem("viewRangeDefaultStart",t)},setDefaultEnd:function(e,t){e.defaultEnd=t,window.localStorage.setItem("viewRangeDefaultEnd",t)},setViewRange:function(e,t){e.viewRange=t}}};var _=function(){return{listPageSize:33}},d={initialiseStore:function(e){localStorage.listPageSize&&(_.listPageSize=localStorage.listPageSize,e.commit("setListPageSize",{length:localStorage.listPageSize})),localStorage.listPageSize||axios.get("./api/v1/preferences/listPageSize").then((function(t){e.commit("setListPageSize",{length:parseInt(t.data.data.attributes.data)})}))}};const p={namespaced:!0,state:_,getters:{listPageSize:function(e){return e.listPageSize}},actions:d,mutations:{setListPageSize:function(e,t){var a=parseInt(t.length);0!==a&&(e.listPageSize=a)}}};const g={namespaced:!0,state:function(){return{orderMode:!1,activeFilter:1}},getters:{orderMode:function(e){return e.orderMode},activeFilter:function(e){return e.activeFilter}},actions:{},mutations:{setOrderMode:function(e,t){e.orderMode=t},setActiveFilter:function(e,t){e.activeFilter=t}}};s().use(o.ZP);const m=new o.ZP.Store({namespaced:!0,modules:{root:p,transactions:{namespaced:!0,modules:{create:c,edit:l}},accounts:{namespaced:!0,modules:{index:g}},dashboard:{namespaced:!0,modules:{index:u}}},strict:false,plugins:[],state:{currencyPreference:{},locale:"en-US",listPageSize:50},mutations:{setCurrencyPreference:function(e,t){e.currencyPreference=t.payload},initialiseStore:function(e){if(localStorage.locale)e.locale=localStorage.locale;else{var t=document.head.querySelector('meta[name="locale"]');t&&(e.locale=t.content,localStorage.locale=t.content)}}},getters:{currencyCode:function(e){return e.currencyPreference.code},currencyPreference:function(e){return e.currencyPreference},currencyId:function(e){return e.currencyPreference.id},locale:function(e){return e.locale}},actions:{updateCurrencyPreference:function(e){localStorage.currencyPreference?e.commit("setCurrencyPreference",{payload:JSON.parse(localStorage.currencyPreference)}):axios.get("./api/v1/currencies/default").then((function(t){var a={id:parseInt(t.data.data.id),name:t.data.data.attributes.name,symbol:t.data.data.attributes.symbol,code:t.data.data.attributes.code,decimal_places:parseInt(t.data.data.attributes.decimal_places)};localStorage.currencyPreference=JSON.stringify(a),e.commit("setCurrencyPreference",{payload:a})})).catch((function(t){console.error(t),e.commit("setCurrencyPreference",{payload:{id:1,name:"Euro",symbol:"€",code:"EUR",decimal_places:2}})}))}}})},157:(e,t,a)=>{e.exports=new vuei18n({locale:document.documentElement.lang,fallbackLocale:"en",messages:{bg:a(7154),cs:a(6407),de:a(4726),en:a(3340),"en-us":a(3340),"en-gb":a(6318),es:a(5394),el:a(3636),fr:a(2551),hu:a(995),it:a(9112),nl:a(4671),nb:a(9085),pl:a(6238),fi:a(7868),"pt-br":a(6586),"pt-pt":a(8664),ro:a(1102),ru:a(753),"zh-tw":a(1715),"zh-cn":a(4556),sk:a(7049),sv:a(7921),vi:a(1497)}})},9762:(e,t,a)=>{"use strict";var n=a(9899),s=a(3324),o=a(7661),i=a(1980),r=a(5524),c=a(4478);function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var u=a(3465);const _={name:"Edit",created:function(){var e=window.location.pathname.split("/");this.groupId=parseInt(e[e.length-1]),this.getTransactionGroup(),this.getAllowedOpposingTypes(),this.getCustomFields()},data:function(){return{successMessage:"",errorMessage:"",warningMessage:"",transactions:[],originalTransactions:[],groupTitle:"",originalGroupTitle:"",transactionType:"any",groupId:0,groupTitleErrors:[],customFields:{},returnedGroupId:0,returnedGroupTitle:"",date:new Date,time:new Date,originalDate:new Date,originalTime:new Date,submittedTransaction:!1,submittedLinks:!1,submittedAttachments:!1,inError:!1,allowedOpposingTypes:{},destinationAllowedTypes:[],sourceAllowedTypes:[],enableSubmit:!0,stayHere:!1}},components:{Alert:s.Z,SplitPills:o.Z,SplitForm:i.Z,TransactionGroupTitle:r.Z},watch:{submittedTransaction:function(){this.finalizeSubmit()},submittedLinks:function(){this.finalizeSubmit()},submittedAttachments:function(){this.finalizeSubmit()}},methods:{getTransactionGroup:function(){var e=this;axios.get("./api/v1/transactions/"+this.groupId).then((function(t){e.parseTransactionGroup(t.data)})).catch((function(e){}))},parseTransactionGroup:function(e){var t=e.data.attributes,a=t.transactions.reverse();for(var n in this.groupTitle=t.group_title,this.originalGroupTitle=t.group_title,a)if(a.hasOwnProperty(n)&&/^0$|^[1-9]\d*$/.test(n)&&n<=4294967294){var s=this.parseTransaction(parseInt(n),a[n]);this.transactions.push(s),this.originalTransactions.push(u(s)),this.parseLinks(parseInt(s.transaction_journal_id),parseInt(n))}},parseTransaction:function(e,t){var a;0===e&&(this.transactionType=t.type.charAt(0).toUpperCase()+t.type.slice(1),this.sourceAllowedTypes=[t.source_type],this.destinationAllowedTypes=[t.destination_type],this.date=new Date(t.date),this.time=new Date(t.date),this.originalDate=new Date(t.date),this.originalTime=new Date(t.date));var n=(0,c.f$)();return n.description=t.description,n.transaction_journal_id=parseInt(t.transaction_journal_id),n.source_account_id=t.source_id,n.source_account_name=t.source_name,n.source_account_type=t.source_type,n.destination_account_id=t.destination_id,n.destination_account_name=t.destination_name,n.destination_account_type=t.destination_type,n.amount=t.amount,n.currency_id=t.currency_id,n.foreign_amount=t.foreign_amount,n.foreign_currency_id=t.foreign_currency_id,n.category=t.category_name,n.budget_id=t.budget_id,n.bill_id=null!==(a=t.bill_id)&&void 0!==a?a:0,n.tags=t.tags,n.interest_date=t.interest_date?t.interest_date.substr(0,10):"",n.book_date=t.book_date?t.book_date.substr(0,10):"",n.process_date=t.process_date?t.process_date.substr(0,10):"",n.due_date=t.due_date?t.due_date.substr(0,10):"",n.payment_date=t.payment_date?t.payment_date.substr(0,10):"",n.invoice_date=t.invoice_date?t.invoice_date.substr(0,10):"",n.internal_reference=t.internal_reference,n.external_url=t.external_uri,n.external_id=t.external_id,n.notes=t.notes,n.location={zoom_level:t.zoom_level,longitude:t.longitude,latitude:t.latitude},n.zoom_level=t.zoom_level,n.longitude=t.longitude,n.latitude=t.latitude,n.errors=(0,c.kQ)(),n},parseLinks:function(e,t){var a=this;axios.get("./api/v1/transaction-journals/"+e+"/links").then((function(n){var s=n.data.data;for(var o in s)s.hasOwnProperty(o)&&/^0$|^[1-9]\d*$/.test(o)&&o<=4294967294&&a.parseLink(s[o],e,t)}))},parseLink:function(e,t,a){var n=this,s=[],o=parseInt(e.attributes.inward_id),i="inward";o===t&&(o=parseInt(e.attributes.outward_id),i="outward"),s.push(new Promise((function(n){n({link:e,journalId:t,opposingId:o,index:a,direction:i})}))),s.push(axios.get("./api/v1/transaction-journals/"+o)),s.push(axios.get("./api/v1/transaction_links/"+e.attributes.link_type_id)),Promise.all(s).then((function(t){var a=t[1].data.data.attributes.transactions,s=t[0].opposingId,o={};for(var i in a)a.hasOwnProperty(i)&&/^0$|^[1-9]\d*$/.test(i)&&i<=4294967294&&a[i].transaction_journal_id===s&&(o=a[i]);var r=t[0].index,c=t[0].direction,l=t[2].data.data.id,u={id:e.id,link_type_id:l+"-"+c,transaction_group_id:t[1].data.data.id,transaction_journal_id:o.transaction_journal_id,description:o.description,type:o.type,currency_code:o.currency_code,amount:o.amount};n.transactions[r].links.push(u),n.originalTransactions[r].links.push(u)}))},getAllowedOpposingTypes:function(){var e=this;axios.get("./api/v1/configuration/firefly.allowed_opposing_types").then((function(t){e.allowedOpposingTypes=t.data.data.value}))},getCustomFields:function(){var e=this;axios.get("./api/v1/preferences/transaction_journal_optional_fields").then((function(t){e.customFields=t.data.data.attributes.data}))},uploadedAttachment:function(e){console.log("event: uploadedAttachment"),console.log(e)},storeLocation:function(e){this.transactions[e.index].zoom_level=e.zoomLevel,this.transactions[e.index].longitude=e.lng,this.transactions[e.index].latitude=e.lat},storeAccountValue:function(e){var t=e.direction,a=e.index;this.transactions[a][t+"_account_id"]=e.id,this.transactions[a][t+"_account_type"]=e.type,this.transactions[a][t+"_account_name"]=e.name},storeDate:function(e){this.date=e.date},storeTime:function(e){this.time=e.time},storeField:function(e){var t=e.field;"category"===t&&(t="category_name"),this.transactions[e.index][t]=e.value},removeTransaction:function(e){this.transactions.splice(e.index,1),this.originalTransactions=[]},storeGroupTitle:function(e){this.groupTitle=e},selectedAttachments:function(e){for(var t in this.transactions)this.transactions.hasOwnProperty(t)&&/^0$|^[1-9]\d*$/.test(t)&&t<=4294967294&&parseInt(this.transactions[t].transaction_journal_id)===parseInt(e)&&(this.transactions[t].selectedAttachments=!0)},addTransaction:function(){var e=(0,c.f$)();e.errors=(0,c.kQ)(),this.transactions.push(e)},submitTransaction:function(){var e={transactions:[]},t=!1,a=!1,n=!1;this.groupTitle!==this.originalGroupTitle&&(e.group_title=this.groupTitle,t=!0);this.originalTransactions.length;var s=this.transactions.length;for(var o in console.log("Found "+this.transactions.length+" split(s)."),s>1&&void 0===e.group_title&&(null===this.originalGroupTitle||""===this.originalGroupTitle)&&(e.group_title=this.transactions[0].description),this.transactions)if(this.transactions.hasOwnProperty(o)&&/^0$|^[1-9]\d*$/.test(o)&&o<=4294967294){var i=this.transactions[o],r=this.originalTransactions.hasOwnProperty(o)?this.originalTransactions[o]:{},_={},d=["description","source_account_id","source_account_name","destination_account_id","destination_account_name","amount","foreign_amount","foreign_currency_id","category_name","budget_id","bill_id","interest_date","book_date","due_date","payment_date","invoice_date","external_url","internal_reference","external_id","notes","zoom_level","longitude","latitude"];for(var p in o>0&&(_.type=this.transactionType.toLowerCase(),"Deposit"!==this.transactionType&&"Transfer"!==this.transactionType||(i.destination_account_name=this.originalTransactions[0].destination_account_name,i.destination_account_id=this.originalTransactions[0].destination_account_id),"Withdrawal"!==this.transactionType&&"Transfer"!==this.transactionType||(i.source_account_name=this.originalTransactions[0].source_account_name,i.source_account_id=this.originalTransactions[0].source_account_id),console.log("Will overrule accounts for split "+o)),d)if(d.hasOwnProperty(p)&&/^0$|^[1-9]\d*$/.test(p)&&p<=4294967294){var g=d[p],m=g;if(null===i[g]&&void 0===r[g])continue;if(i[g]!==r[g]){if("foreign_amount"===m&&""===i[g])continue;if("foreign_currency_id"===m&&0===i[g])continue;"source_account_id"===m&&(m="source_id"),"source_account_name"===m&&(m="source_name"),"destination_account_id"===m&&(m="destination_id"),"destination_account_name"===m&&(m="destination_name"),_[m]=i[g],t=!0}}if(0!==i.piggy_bank_id&&(_.piggy_bank_id=i.piggy_bank_id,t=!0),JSON.stringify(i.tags)!==JSON.stringify(r.tags)){if(_.tags=[],0!==i.tags.length)for(var h in i.tags)if(i.tags.hasOwnProperty(h)&&/^0$|^[1-9]\d*$/.test(h)&&h<=4294967294){var y=i.tags[h];"object"===l(y)&&null!==y&&_.tags.push(y.text),"string"==typeof y&&_.tags.push(y)}t=!0}this.compareLinks(i.links)!==this.compareLinks(r.links)&&(a=!0),void 0!==i.selectedAttachments&&!0===i.selectedAttachments&&(n=!0);var b="invalid";if(this.date.toISOString()!==this.originalDate.toISOString()||this.time.toISOString()!==this.originalTime.toISOString()){console.log("Date and/or time is changed"),t=!0;var f=this.date;f.setHours(this.time.getHours()),f.setMinutes(this.time.getMinutes()),f.setSeconds(this.time.getSeconds()),b=(0,c.u6)(f),_.date=b}if(console.log("Now at index "+o),console.log(Object.keys(_).length),0===Object.keys(_).length&&s>1)console.log("Will submit just the ID!"),_.transaction_journal_id=r.transaction_journal_id,e.transactions.push(u(_)),t=!0;else if(0!==Object.keys(_).length){var v;_.transaction_journal_id=null!==(v=r.transaction_journal_id)&&void 0!==v?v:0,e.transactions.push(u(_)),t=!0}}console.log("submitTransaction"),console.log("shouldUpload : "+n),console.log("shouldLinks : "+a),console.log("shouldSubmit : "+t),t&&this.submitUpdate(e,a,n),t||(this.submittedTransaction=!0),a||(this.submittedLinks=!0),n||(this.submittedAttachments=!0),!t&&a&&this.submitTransactionLinks(),console.log("Done with submit methd.")},compareLinks:function(e){var t=[];for(var a in e)e.hasOwnProperty(a)&&/^0$|^[1-9]\d*$/.test(a)&&a<=4294967294&&t.push({amount:e[a].amount,currency_code:e[a].currency_code,description:e[a].description,link_type_id:e[a].link_type_id,transaction_group_id:e[a].transaction_group_id,type:e[a].type});return JSON.stringify(t)},submitUpdate:function(e,t,a){var n=this;console.log("submitUpdate"),this.inError=!1;var s="./api/v1/transactions/"+this.groupId;console.log(JSON.stringify(e)),console.log(e),axios.put(s,e).then((function(e){console.log("Response is OK!"),n.submittedTransaction=!0,t&&(console.log("Need to update links."),n.submitTransactionLinks()),t||console.log("No need to update links."),n.returnedGroupId=parseInt(e.data.data.id),n.returnedGroupTitle=null===e.data.data.attributes.group_title?e.data.data.attributes.transactions[0].description:e.data.data.attributes.group_title})).catch((function(e){console.log("error :("),console.log(e.response.data),n.enableSubmit=!0,n.submittedTransaction=!0,n.submittedAttachments=!0,n.submittedLinks=!0,n.inError=!0,n.parseErrors(e.response.data)}))},parseErrors:function(e){for(var t in this.transactions)this.transactions.hasOwnProperty(t)&&/^0$|^[1-9]\d*$/.test(t)&&t<=4294967294&&this.resetErrors({index:t});var a,n,s;for(var o in this.successMessage="",this.errorMessage=this.$t("firefly.errors_submission"),void 0===e.errors&&(this.successMessage="",this.errorMessage=e.message),e.errors)if(e.errors.hasOwnProperty(o)){if("group_title"===o){this.groupTitleErrors=e.errors[o];continue}if("group_title"!==o)switch(n=parseInt(o.split(".")[1]),s=o.split(".")[2]){case"amount":case"description":case"date":case"tags":a={index:n,field:s,errors:e.errors[o]},this.setTransactionError(a);break;case"budget_id":a={index:n,field:"budget",errors:e.errors[o]},this.setTransactionError(a);break;case"bill_id":a={index:n,field:"bill",errors:e.errors[o]},this.setTransactionError(a);break;case"piggy_bank_id":a={index:n,field:"piggy_bank",errors:e.errors[o]},this.setTransactionError(a);break;case"category_name":a={index:n,field:"category",errors:e.errors[o]},this.setTransactionError(a);break;case"source_name":case"source_id":a={index:n,field:"source",errors:e.errors[o]},this.setTransactionError(a);break;case"destination_name":case"destination_id":a={index:n,field:"destination",errors:e.errors[o]},this.setTransactionError(a);break;case"foreign_amount":case"foreign_currency":a={index:n,field:"foreign_amount",errors:e.errors[o]},this.setTransactionError(a)}this.transactions[n]}},setTransactionError:function(e){this.transactions[e.index].errors[e.field]=e.errors},resetErrors:function(e){this.transactions[e.index].errors=u((0,c.kQ)())},deleteOriginalLinks:function(e){for(var t in console.log(e.links),e.links)if(e.links.hasOwnProperty(t)&&/^0$|^[1-9]\d*$/.test(t)&&t<=4294967294){var a="/api/v1/transaction_links/"+e.links[t].id;axios.delete(a).then((function(e){}))}},submitTransactionLinks:function(){var e=0,t=[];for(var a in console.log("submitTransactionLinks()"),this.transactions)if(this.transactions.hasOwnProperty(a)&&/^0$|^[1-9]\d*$/.test(a)&&a<=4294967294){var n=this.transactions[a],s=this.originalTransactions.hasOwnProperty(a)?this.originalTransactions[a]:{},o=this.compareLinks(n.links),i=this.compareLinks(s.links);if(o!==i)for(var r in"[]"!==i&&this.deleteOriginalLinks(s),console.log("links are different!"),n.links)if(n.links.hasOwnProperty(r)&&/^0$|^[1-9]\d*$/.test(r)&&r<=4294967294){var c=n.links[r],l={inward_id:n.transaction_journal_id,outward_id:n.transaction_journal_id,link_type_id:"something"},u=c.link_type_id.split("-");l.link_type_id=u[0],"inward"===u[1]&&(l.inward_id=c.transaction_journal_id),"outward"===u[1]&&(l.outward_id=c.transaction_journal_id),console.log(l),e++,t.push(axios.post("./api/v1/transaction_links",l).then((function(e){})))}}0!==e?Promise.all(t).then((function(){this.submittedLinks=!0})):this.submittedLinks=!0},finalizeSubmit:function(){if(console.log("now in finalizeSubmit()"),console.log("submittedTransaction : "+this.submittedTransaction),console.log("submittedLinks : "+this.submittedLinks),console.log("submittedAttachments : "+this.submittedAttachments),this.submittedTransaction&&this.submittedAttachments&&this.submittedLinks){var e,t;if(console.log("all true"),console.log("inError = "+this.inError),console.log("stayHere = "+this.stayHere),console.log("returnedGroupId = "+this.returnedGroupId),!0===this.stayHere&&!1===this.inError&&0===this.returnedGroupId&&(console.log("no error + no changes + no redirect"),this.errorMessage="",this.successMessage="",this.warningMessage=this.$t("firefly.transaction_updated_no_changes",{ID:this.returnedGroupId,title:this.returnedGroupTitle})),!1===this.stayHere&&!1===this.inError&&0===this.returnedGroupId)console.log("no error + no changes + redirect"),window.location.href=(null!==(e=window.previousURL)&&void 0!==e?e:"/")+"?transaction_group_id="+this.groupId+"&message=no_change";if(!0===this.stayHere&&!1===this.inError&&0!==this.returnedGroupId&&(console.log("no error + changes + redirect"),this.errorMessage="",this.warningMessage="",this.successMessage=this.$t("firefly.transaction_updated_link",{ID:this.returnedGroupId,title:this.returnedGroupTitle})),!1===this.stayHere&&!1===this.inError&&0!==this.returnedGroupId)console.log("no error + changes + redirect"),window.location.href=(null!==(t=window.previousURL)&&void 0!==t?t:"/")+"?transaction_group_id="+this.groupId+"&message=updated";for(var a in console.log("end of the line"),this.enableSubmit=!0,this.submittedTransaction=!1,this.submittedLinks=!1,this.submittedAttachments=!1,this.inError=!1,this.transactions)this.transactions.hasOwnProperty(a)&&/^0$|^[1-9]\d*$/.test(a)&&a<=4294967294&&this.transactions.hasOwnProperty(a)}}}};const d=(0,a(1900).Z)(_,(function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",[a("Alert",{attrs:{message:e.errorMessage,type:"danger"}}),e._v(" "),a("Alert",{attrs:{message:e.successMessage,type:"success"}}),e._v(" "),a("Alert",{attrs:{message:e.warningMessage,type:"warning"}}),e._v(" "),a("form",{on:{submit:e.submitTransaction}},[a("SplitPills",{attrs:{transactions:e.transactions}}),e._v(" "),a("div",{staticClass:"tab-content"},e._l(this.transactions,(function(t,n){return a("SplitForm",{key:n,attrs:{count:e.transactions.length,transaction:t,"allowed-opposing-types":e.allowedOpposingTypes,"custom-fields":e.customFields,date:e.date,time:e.time,index:n,"transaction-type":e.transactionType,"destination-allowed-types":e.destinationAllowedTypes,"source-allowed-types":e.sourceAllowedTypes,"allow-switch":!1,"submitted-transaction":e.submittedTransaction},on:{"uploaded-attachments":function(t){return e.uploadedAttachment(t)},"set-marker-location":function(t){return e.storeLocation(t)},"set-account":function(t){return e.storeAccountValue(t)},"set-date":function(t){return e.storeDate(t)},"set-time":function(t){return e.storeTime(t)},"set-field":function(t){return e.storeField(t)},"remove-transaction":function(t){return e.removeTransaction(t)},"selected-attachments":function(t){return e.selectedAttachments(t)}}})})),1),e._v(" "),a("div",{staticClass:"row"},[a("div",{staticClass:"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12"},[e.transactions.length>1?a("div",{staticClass:"card"},[a("div",{staticClass:"card-body"},[a("div",{staticClass:"row"},[a("div",{staticClass:"col"},[a("TransactionGroupTitle",{attrs:{errors:this.groupTitleErrors},on:{"set-group-title":function(t){return e.storeGroupTitle(t)}},model:{value:this.groupTitle,callback:function(t){e.$set(this,"groupTitle",t)},expression:"this.groupTitle"}})],1)])])]):e._e()]),e._v(" "),a("div",{staticClass:"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12"},[a("div",{staticClass:"card"},[a("div",{staticClass:"card-body"},[a("div",{staticClass:"row"},[a("div",{staticClass:"col"},[a("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[e._v("\n \n ")]),e._v(" "),a("button",{staticClass:"btn btn-outline-primary btn-block",on:{click:e.addTransaction}},[a("i",{staticClass:"far fa-clone"}),e._v(" "+e._s(e.$t("firefly.add_another_split"))+"\n ")])]),e._v(" "),a("div",{staticClass:"col"},[a("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[e._v("\n \n ")]),e._v(" "),a("button",{staticClass:"btn btn-info btn-block",attrs:{disabled:!e.enableSubmit},on:{click:e.submitTransaction}},[e.enableSubmit?a("span",[a("i",{staticClass:"far fa-save"}),e._v(" "+e._s(e.$t("firefly.update_transaction")))]):e._e(),e._v(" "),e.enableSubmit?e._e():a("span",[a("i",{staticClass:"fas fa-spinner fa-spin"})])])])]),e._v(" "),a("div",{staticClass:"row"},[a("div",{staticClass:"col"},[e._v("\n \n ")]),e._v(" "),a("div",{staticClass:"col"},[a("div",{staticClass:"form-check"},[a("input",{directives:[{name:"model",rawName:"v-model",value:e.stayHere,expression:"stayHere"}],staticClass:"form-check-input",attrs:{id:"stayHere",type:"checkbox"},domProps:{checked:Array.isArray(e.stayHere)?e._i(e.stayHere,null)>-1:e.stayHere},on:{change:function(t){var a=e.stayHere,n=t.target,s=!!n.checked;if(Array.isArray(a)){var o=e._i(a,null);n.checked?o<0&&(e.stayHere=a.concat([null])):o>-1&&(e.stayHere=a.slice(0,o).concat(a.slice(o+1)))}else e.stayHere=s}}}),e._v(" "),a("label",{staticClass:"form-check-label",attrs:{for:"stayHere"}},[a("span",{staticClass:"small"},[e._v(e._s(e.$t("firefly.after_update_create_another")))])])])])])])])])])],1)],1)}),[],!1,null,"a988810a",null).exports;var p=a(7760),g=a.n(p);a(232),g().config.productionTip=!1;var m=a(157),h={};new(g())({i18n:m,store:n.Z,render:function(e){return e(d,{props:h})},beforeCreate:function(){this.$store.commit("initialiseStore"),this.$store.dispatch("updateCurrencyPreference")}}).$mount("#transactions_edit")},4478:(e,t,a)=>{"use strict";function n(){return{description:[],amount:[],source:[],destination:[],currency:[],foreign_currency:[],foreign_amount:[],date:[],custom_dates:[],budget:[],category:[],bill:[],tags:[],piggy_bank:[],internal_reference:[],external_url:[],notes:[],location:[]}}function s(){return{description:"",transaction_journal_id:0,source_account_id:null,source_account_name:null,source_account_type:null,source_account_currency_id:null,source_account_currency_code:null,source_account_currency_symbol:null,destination_account_id:null,destination_account_name:null,destination_account_type:null,destination_account_currency_id:null,destination_account_currency_code:null,destination_account_currency_symbol:null,source_account:{id:0,name:"",name_with_balance:"",type:"",currency_id:0,currency_name:"",currency_code:"",currency_decimal_places:2},destination_account:{id:0,name:"",type:"",currency_id:0,currency_name:"",currency_code:"",currency_decimal_places:2},amount:"",currency_id:0,foreign_amount:"",foreign_currency_id:0,category:null,budget_id:0,bill_id:0,piggy_bank_id:0,tags:[],interest_date:null,book_date:null,process_date:null,due_date:null,payment_date:null,invoice_date:null,internal_reference:null,external_url:null,external_id:null,notes:null,links:[],attachments:[],zoom_level:null,longitude:null,latitude:null,errors:{}}}function o(e){var t=e.getFullYear(),a=e.getMonth();++a<10&&(a="0"+a);var n=e.getDate();n<10&&(n="0"+n);var s=e.getHours();s<10&&(s="0"+s);var o=e.getMinutes();o<10&&(o="0"+o);var i=e.getSeconds();i<10&&(i="0"+i);var r=-e.getTimezoneOffset(),c=Math.abs(Math.floor(r/60)),l=Math.abs(r)-60*c;c<10&&(c="0"+c),l<10&&(l="0"+l);var u="+";return r<0&&(u="-"),t+"-"+a+"-"+n+"T"+s+":"+o+":"+i+u+c+":"+l}a.d(t,{kQ:()=>n,f$:()=>s,u6:()=>o})},6665:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>r});var n=a(4015),s=a.n(n),o=a(3645),i=a.n(o)()(s());i.push([e.id,".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}","",{version:3,sources:["webpack://./src/components/transactions/TransactionTags.vue"],names:[],mappings:"AA2HA,gBAEA,wBAAA,CACA,aAEA,CAEA,0BANA,UAAA,CAGA,oBAOA,CAJA,UAEA,cAEA,CAEA,kBACA,cACA",sourcesContent:['\x3c!--\n - TransactionTags.vue\n - Copyright (c) 2021 james@firefly-iii.org\n -\n - This file is part of Firefly III (https://github.com/firefly-iii).\n -\n - This program is free software: you can redistribute it and/or modify\n - it under the terms of the GNU Affero General Public License as\n - published by the Free Software Foundation, either version 3 of the\n - License, or (at your option) any later version.\n -\n - This program is distributed in the hope that it will be useful,\n - but WITHOUT ANY WARRANTY; without even the implied warranty of\n - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n - GNU Affero General Public License for more details.\n -\n - You should have received a copy of the GNU Affero General Public License\n - along with this program. If not, see .\n --\x3e\n\n\n