(self.webpackChunk=self.webpackChunk||[]).push([[847],{232:(t,e,a)=>{"use strict";a.r(e);var n=a(7760),s=a.n(n),i=a(7152),o=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=i.Z,window.uiv=o,s().use(vuei18n),s().use(o),window.Vue=s()},8923:(t,e,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 i(t){var e=t.getFullYear(),a=t.getMonth();++a<10&&(a="0"+a);var n=t.getDate();n<10&&(n="0"+n);var s=t.getHours();s<10&&(s="0"+s);var i=t.getMinutes();i<10&&(i="0"+i);var o=t.getSeconds();o<10&&(o="0"+o);var r=-t.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="-"),e+"-"+a+"-"+n+"T"+s+":"+i+":"+o+u+c+":"+l}a.d(e,{kQ:()=>n,f$:()=>s,u6:()=>i})},9899:(t,e,a)=>{"use strict";a.d(e,{Z:()=>h});var n=a(7760),s=a.n(n),i=a(629),o=a(8923),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,o.f$)(),defaultErrors:(0,o.kQ)()}},getters:{transactions:function(t){return t.transactions},groupTitle:function(t){return t.groupTitle},transactionType:function(t){return t.transactionType},accountToTransaction:function(t){return t.accountToTransaction},defaultTransaction:function(t){return t.defaultTransaction},sourceAllowedTypes:function(t){return t.sourceAllowedTypes},destinationAllowedTypes:function(t){return t.destinationAllowedTypes},allowedOpposingTypes:function(t){return t.allowedOpposingTypes},customDateFields:function(t){return t.customDateFields}},actions:{},mutations:{addTransaction:function(t){var e=r(t.defaultTransaction);e.errors=r(t.defaultErrors),t.transactions.push(e)},resetErrors:function(t,e){t.transactions[e.index].errors=r(t.defaultErrors)},resetTransactions:function(t){t.transactions=[]},setGroupTitle:function(t,e){t.groupTitle=e.groupTitle},setCustomDateFields:function(t,e){t.customDateFields=e},deleteTransaction:function(t,e){t.transactions.splice(e.index,1),t.transactions.length},setTransactionType:function(t,e){t.transactionType=e},setAllowedOpposingTypes:function(t,e){t.allowedOpposingTypes=e},setAccountToTransaction:function(t,e){t.accountToTransaction=e},updateField:function(t,e){t.transactions[e.index][e.field]=e.value},setTransactionError:function(t,e){t.transactions[e.index].errors[e.field]=e.errors},setDestinationAllowedTypes:function(t,e){t.destinationAllowedTypes=e},setSourceAllowedTypes:function(t,e){t.sourceAllowedTypes=e}}};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(t){return t.start},end:function(t){return t.end},defaultStart:function(t){return t.defaultStart},defaultEnd:function(t){return t.defaultEnd},viewRange:function(t){return t.viewRange}},actions:{initialiseStore:function(t){"default"===t.state.viewRange&&axios.get("./api/v1/preferences/viewRange").then((function(e){var a=e.data.data.attributes.data;t.commit("setViewRange",a),t.dispatch("setDatesFromViewRange")})).catch((function(e){t.commit("setViewRange","1M"),t.dispatch("setDatesFromViewRange")}))},setDatesFromViewRange:function(t){if(localStorage.viewRangeStart&&t.commit("setStart",new Date(localStorage.viewRangeStart)),localStorage.viewRangeEnd&&t.commit("setEnd",new Date(localStorage.viewRangeEnd)),localStorage.viewRangeDefaultStart&&t.commit("setDefaultStart",new Date(localStorage.viewRangeDefaultStart)),localStorage.viewRangeDefaultEnd&&t.commit("setDefaultEnd",new Date(localStorage.viewRangeDefaultEnd)),null===t.getters.end||null===t.getters.start){var e,a;switch(t.getters.viewRange){case"1D":e=new Date,a=new Date(e.getTime()),e.setHours(0,0,0,0),a.setHours(23,59,59,999);break;case"1W":e=new Date,a=new Date(e.getTime());var n=e.getDate()-e.getDay()+(0===e.getDay()?-6:1);e.setDate(n),e.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":e=new Date,(e=new Date(e.getFullYear(),e.getMonth(),1)).setHours(0,0,0,0),(a=new Date(e.getFullYear(),e.getMonth()+1,0)).setHours(23,59,59,999);break;case"3M":e=new Date,a=new Date;var i=Math.floor((e.getMonth()+3)/3)-1;(e=new Date(e.getFullYear(),[0,3,6,9][i],1)).setHours(0,0,0,0),a=new Date(a.getFullYear(),[2,5,8,11][i],1),(a=new Date(a.getFullYear(),a.getMonth()+1,0)).setHours(23,59,59,999);break;case"6M":e=new Date,a=new Date;var o=e.getMonth()<=5?0:1;(e=new Date(e.getFullYear(),[0,6][o],1)).setHours(0,0,0,0),a=new Date(a.getFullYear(),[5,11][o],1),(a=new Date(a.getFullYear(),a.getMonth()+1,0)).setHours(23,59,59,999);break;case"1Y":e=new Date,a=new Date,e=new Date(e.getFullYear(),0,1),a=new Date(a.getFullYear(),11,31),e.setHours(0,0,0,0),a.setHours(23,59,59,999)}t.commit("setStart",e),t.commit("setEnd",a),t.commit("setDefaultStart",e),t.commit("setDefaultEnd",a)}}},mutations:{setStart:function(t,e){t.start=e,window.localStorage.setItem("viewRangeStart",e)},setEnd:function(t,e){t.end=e,window.localStorage.setItem("viewRangeEnd",e)},setDefaultStart:function(t,e){t.defaultStart=e,window.localStorage.setItem("viewRangeDefaultStart",e)},setDefaultEnd:function(t,e){t.defaultEnd=e,window.localStorage.setItem("viewRangeDefaultEnd",e)},setViewRange:function(t,e){t.viewRange=e}}};var d=function(){return{listPageSize:33}},_={initialiseStore:function(t){localStorage.listPageSize&&(d.listPageSize=localStorage.listPageSize,t.commit("setListPageSize",{length:localStorage.listPageSize})),localStorage.listPageSize||axios.get("./api/v1/preferences/listPageSize").then((function(e){t.commit("setListPageSize",{length:parseInt(e.data.data.attributes.data)})}))}};const p={namespaced:!0,state:d,getters:{listPageSize:function(t){return t.listPageSize}},actions:_,mutations:{setListPageSize:function(t,e){var a=parseInt(e.length);0!==a&&(t.listPageSize=a)}}};const g={namespaced:!0,state:function(){return{orderMode:!1,activeFilter:1}},getters:{orderMode:function(t){return t.orderMode},activeFilter:function(t){return t.activeFilter}},actions:{},mutations:{setOrderMode:function(t,e){t.orderMode=e},setActiveFilter:function(t,e){t.activeFilter=e}}};s().use(i.ZP);const h=new i.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(t,e){t.currencyPreference=e.payload},initialiseStore:function(t){if(localStorage.locale)t.locale=localStorage.locale;else{var e=document.head.querySelector('meta[name="locale"]');e&&(t.locale=e.content,localStorage.locale=e.content)}}},getters:{currencyCode:function(t){return t.currencyPreference.code},currencyPreference:function(t){return t.currencyPreference},currencyId:function(t){return t.currencyPreference.id},locale:function(t){return t.locale}},actions:{updateCurrencyPreference:function(t){localStorage.currencyPreference?t.commit("setCurrencyPreference",{payload:JSON.parse(localStorage.currencyPreference)}):axios.get("./api/v1/currencies/default").then((function(e){var a={id:parseInt(e.data.data.id),name:e.data.data.attributes.name,symbol:e.data.data.attributes.symbol,code:e.data.data.attributes.code,decimal_places:parseInt(e.data.data.attributes.decimal_places)};localStorage.currencyPreference=JSON.stringify(a),t.commit("setCurrencyPreference",{payload:a})})).catch((function(e){console.error(e),t.commit("setCurrencyPreference",{payload:{id:1,name:"Euro",symbol:"€",code:"EUR",decimal_places:2}})}))}}})},157:(t,e,a)=>{t.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)}})},843:(t,e,a)=>{"use strict";var n=a(9899),s=a(3324),i=a(7661),o=a(3044),r=a(5524),c=a(8923);function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var u=a(3465);const d={name:"Edit",created:function(){var t=window.location.pathname.split("/");this.groupId=parseInt(t[t.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:i.Z,SplitForm:o.Z,TransactionGroupTitle:r.Z},watch:{submittedTransaction:function(){this.finalizeSubmit()},submittedLinks:function(){this.finalizeSubmit()},submittedAttachments:function(){this.finalizeSubmit()}},methods:{getTransactionGroup:function(){var t=this;axios.get("./api/v1/transactions/"+this.groupId).then((function(e){t.parseTransactionGroup(e.data)})).catch((function(t){}))},parseTransactionGroup:function(t){var e=t.data.attributes,a=e.transactions.reverse();for(var n in this.groupTitle=e.group_title,this.originalGroupTitle=e.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(t,e){var a;0===t&&(this.transactionType=e.type.charAt(0).toUpperCase()+e.type.slice(1),this.sourceAllowedTypes=[e.source_type],this.destinationAllowedTypes=[e.destination_type],this.date=new Date(e.date),this.time=new Date(e.date),this.originalDate=new Date(e.date),this.originalTime=new Date(e.date));var n=(0,c.f$)();return n.description=e.description,n.transaction_journal_id=parseInt(e.transaction_journal_id),n.source_account_id=e.source_id,n.source_account_name=e.source_name,n.source_account_type=e.source_type,n.destination_account_id=e.destination_id,n.destination_account_name=e.destination_name,n.destination_account_type=e.destination_type,n.amount=e.amount,n.currency_id=e.currency_id,n.foreign_amount=e.foreign_amount,n.foreign_currency_id=e.foreign_currency_id,n.category=e.category_name,n.budget_id=e.budget_id,n.bill_id=null!==(a=e.bill_id)&&void 0!==a?a:0,n.tags=e.tags,n.interest_date=e.interest_date?e.interest_date.substr(0,10):"",n.book_date=e.book_date?e.book_date.substr(0,10):"",n.process_date=e.process_date?e.process_date.substr(0,10):"",n.due_date=e.due_date?e.due_date.substr(0,10):"",n.payment_date=e.payment_date?e.payment_date.substr(0,10):"",n.invoice_date=e.invoice_date?e.invoice_date.substr(0,10):"",n.internal_reference=e.internal_reference,n.external_url=e.external_uri,n.external_id=e.external_id,n.notes=e.notes,n.location={zoom_level:e.zoom_level,longitude:e.longitude,latitude:e.latitude},n.zoom_level=e.zoom_level,n.longitude=e.longitude,n.latitude=e.latitude,n.errors=(0,c.kQ)(),n},parseLinks:function(t,e){var a=this;axios.get("./api/v1/transaction-journals/"+t+"/links").then((function(n){var s=n.data.data;for(var i in s)s.hasOwnProperty(i)&&/^0$|^[1-9]\d*$/.test(i)&&i<=4294967294&&a.parseLink(s[i],t,e)}))},parseLink:function(t,e,a){var n=this,s=[],i=parseInt(t.attributes.inward_id),o="inward";i===e&&(i=parseInt(t.attributes.outward_id),o="outward"),s.push(new Promise((function(n){n({link:t,journalId:e,opposingId:i,index:a,direction:o})}))),s.push(axios.get("./api/v1/transaction-journals/"+i)),s.push(axios.get("./api/v1/transaction_links/"+t.attributes.link_type_id)),Promise.all(s).then((function(e){var a=e[1].data.data.attributes.transactions,s=e[0].opposingId,i={};for(var o in a)a.hasOwnProperty(o)&&/^0$|^[1-9]\d*$/.test(o)&&o<=4294967294&&a[o].transaction_journal_id===s&&(i=a[o]);var r=e[0].index,c=e[0].direction,l=e[2].data.data.id,u={id:t.id,link_type_id:l+"-"+c,transaction_group_id:e[1].data.data.id,transaction_journal_id:i.transaction_journal_id,description:i.description,type:i.type,currency_code:i.currency_code,amount:i.amount};n.transactions[r].links.push(u),n.originalTransactions[r].links.push(u)}))},getAllowedOpposingTypes:function(){var t=this;axios.get("./api/v1/configuration/firefly.allowed_opposing_types").then((function(e){t.allowedOpposingTypes=e.data.data.value}))},getCustomFields:function(){var t=this;axios.get("./api/v1/preferences/transaction_journal_optional_fields").then((function(e){t.customFields=e.data.data.attributes.data}))},uploadedAttachment:function(t){console.log("event: uploadedAttachment"),console.log(t)},storeLocation:function(t){this.transactions[t.index].zoom_level=t.zoomLevel,this.transactions[t.index].longitude=t.lng,this.transactions[t.index].latitude=t.lat},storeAccountValue:function(t){var e=t.direction,a=t.index;this.transactions[a][e+"_account_id"]=t.id,this.transactions[a][e+"_account_type"]=t.type,this.transactions[a][e+"_account_name"]=t.name},storeDate:function(t){this.date=t.date},storeTime:function(t){this.time=t.time},storeField:function(t){var e=t.field;"category"===e&&(e="category_name"),this.transactions[t.index][e]=t.value},removeTransaction:function(t){this.transactions.splice(t.index,1),this.originalTransactions=[]},storeGroupTitle:function(t){this.groupTitle=t},selectedAttachments:function(t){for(var e in this.transactions)this.transactions.hasOwnProperty(e)&&/^0$|^[1-9]\d*$/.test(e)&&e<=4294967294&&parseInt(this.transactions[e].transaction_journal_id)===parseInt(t)&&(this.transactions[e].selectedAttachments=!0)},addTransaction:function(){var t=(0,c.f$)();t.errors=(0,c.kQ)(),this.transactions.push(t)},submitTransaction:function(){var t={transactions:[]},e=!1,a=!1,n=!1;this.groupTitle!==this.originalGroupTitle&&(t.group_title=this.groupTitle,e=!0);var s=this.originalTransactions.length;for(var i in this.transactions)if(this.transactions.hasOwnProperty(i)&&/^0$|^[1-9]\d*$/.test(i)&&i<=4294967294){var o=this.transactions[i],r=this.originalTransactions.hasOwnProperty(i)?this.originalTransactions[i]:{},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 _)if(_.hasOwnProperty(p)&&/^0$|^[1-9]\d*$/.test(p)&&p<=4294967294){var g=_[p];o[g]!==r[g]&&(d[g]=o[g],e=!0)}if(0!==o.piggy_bank_id&&(d.piggy_bank_id=o.piggy_bank_id,e=!0),JSON.stringify(o.tags)!==JSON.stringify(r.tags)){if(d.tags=[],0!==o.tags.length)for(var h in o.tags)if(o.tags.hasOwnProperty(h)&&/^0$|^[1-9]\d*$/.test(h)&&h<=4294967294){var m=o.tags[h];"object"===l(m)&&null!==m&&d.tags.push(m.text),"string"==typeof m&&d.tags.push(m)}e=!0}this.compareLinks(o.links)!==this.compareLinks(r.links)&&(a=!0),void 0!==o.selectedAttachments&&!0===o.selectedAttachments&&(n=!0);var f="invalid";if(this.date.toISOString()!==this.originalDate.toISOString()||this.time.toISOString()!==this.originalTime.toISOString()){console.log("Date and/or time is changed"),e=!0;var y=this.date;y.setHours(this.time.getHours()),y.setMinutes(this.time.getMinutes()),y.setSeconds(this.time.getSeconds()),f=(0,c.u6)(y),d.date=f}(0===Object.keys(d).length&&s>1||0!==Object.keys(d).length)&&(d.transaction_journal_id=r.transaction_journal_id,t.transactions.push(u(d)),e=!0)}console.log("submitTransaction"),console.log("shouldUpload : "+n),console.log("shouldLinks : "+a),console.log("shouldSubmit : "+e),e&&this.submitUpdate(t,a,n),e||(this.submittedTransaction=!0),a||(this.submittedLinks=!0),n||(this.submittedAttachments=!0),!e&&a&&this.submitTransactionLinks(),console.log("Done with submit methd.")},compareLinks:function(t){var e=[];for(var a in t)t.hasOwnProperty(a)&&/^0$|^[1-9]\d*$/.test(a)&&a<=4294967294&&e.push({amount:t[a].amount,currency_code:t[a].currency_code,description:t[a].description,link_type_id:t[a].link_type_id,transaction_group_id:t[a].transaction_group_id,type:t[a].type});return JSON.stringify(e)},submitUpdate:function(t,e,a){var n=this;console.log("submitUpdate"),this.inError=!1;var s="./api/v1/transactions/"+this.groupId;console.log(t),axios.put(s,t).then((function(t){console.log("Response is OK!"),n.submittedTransaction=!0,e&&(console.log("Need to update links."),n.submitTransactionLinks()),e||console.log("No need to update links."),n.returnedGroupId=parseInt(t.data.data.id),n.returnedGroupTitle=null===t.data.data.attributes.group_title?t.data.data.attributes.transactions[0].description:t.data.data.attributes.group_title})).catch((function(t){console.log("error :("),console.log(t.response.data),n.enableSubmit=!0,n.submittedTransaction=!0,n.submittedAttachments=!0,n.submittedLinks=!0,n.inError=!0,n.parseErrors(t.response.data)}))},parseErrors:function(t){for(var e in this.transactions)this.transactions.hasOwnProperty(e)&&/^0$|^[1-9]\d*$/.test(e)&&e<=4294967294&&this.resetErrors({index:e});var a,n,s;for(var i in this.successMessage="",this.errorMessage=this.$t("firefly.errors_submission"),void 0===t.errors&&(this.successMessage="",this.errorMessage=t.message),t.errors)if(t.errors.hasOwnProperty(i)){if("group_title"===i){this.groupTitleErrors=t.errors[i];continue}if("group_title"!==i)switch(n=parseInt(i.split(".")[1]),s=i.split(".")[2]){case"amount":case"description":case"date":case"tags":a={index:n,field:s,errors:t.errors[i]},this.setTransactionError(a);break;case"budget_id":a={index:n,field:"budget",errors:t.errors[i]},this.setTransactionError(a);break;case"bill_id":a={index:n,field:"bill",errors:t.errors[i]},this.setTransactionError(a);break;case"piggy_bank_id":a={index:n,field:"piggy_bank",errors:t.errors[i]},this.setTransactionError(a);break;case"category_name":a={index:n,field:"category",errors:t.errors[i]},this.setTransactionError(a);break;case"source_name":case"source_id":a={index:n,field:"source",errors:t.errors[i]},this.setTransactionError(a);break;case"destination_name":case"destination_id":a={index:n,field:"destination",errors:t.errors[i]},this.setTransactionError(a);break;case"foreign_amount":case"foreign_currency":a={index:n,field:"foreign_amount",errors:t.errors[i]},this.setTransactionError(a)}this.transactions[n]}},setTransactionError:function(t){this.transactions[t.index].errors[t.field]=t.errors},resetErrors:function(t){this.transactions[t.index].errors=u((0,c.kQ)())},deleteOriginalLinks:function(t){for(var e in console.log(t.links),t.links)if(t.links.hasOwnProperty(e)&&/^0$|^[1-9]\d*$/.test(e)&&e<=4294967294){var a="/api/v1/transaction_links/"+t.links[e].id;axios.delete(a).then((function(t){}))}},submitTransactionLinks:function(){var t=0,e=[];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]:{},i=this.compareLinks(n.links),o=this.compareLinks(s.links);if(i!==o)for(var r in"[]"!==o&&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),t++,e.push(axios.post("./api/v1/transaction_links",l).then((function(t){})))}}0!==t?Promise.all(e).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 t,e;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!==(t=window.previousURL)&&void 0!==t?t:"/")+"?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!==(e=window.previousURL)&&void 0!==e?e:"/")+"?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 _=(0,a(1900).Z)(d,(function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",[a("Alert",{attrs:{message:t.errorMessage,type:"danger"}}),t._v(" "),a("Alert",{attrs:{message:t.successMessage,type:"success"}}),t._v(" "),a("Alert",{attrs:{message:t.warningMessage,type:"warning"}}),t._v(" "),a("SplitPills",{attrs:{transactions:t.transactions}}),t._v(" "),a("div",{staticClass:"tab-content"},t._l(this.transactions,(function(e,n){return a("SplitForm",{key:n,attrs:{count:t.transactions.length,transaction:e,"allowed-opposing-types":t.allowedOpposingTypes,"custom-fields":t.customFields,date:t.date,time:t.time,index:n,"transaction-type":t.transactionType,"destination-allowed-types":t.destinationAllowedTypes,"source-allowed-types":t.sourceAllowedTypes,"allow-switch":!1,"submitted-transaction":t.submittedTransaction},on:{"uploaded-attachments":function(e){return t.uploadedAttachment(e)},"set-marker-location":function(e){return t.storeLocation(e)},"set-account":function(e){return t.storeAccountValue(e)},"set-date":function(e){return t.storeDate(e)},"set-time":function(e){return t.storeTime(e)},"set-field":function(e){return t.storeField(e)},"remove-transaction":function(e){return t.removeTransaction(e)},"selected-attachments":function(e){return t.selectedAttachments(e)}}})})),1),t._v(" "),a("div",{staticClass:"row"},[a("div",{staticClass:"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12"},[t.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(e){return t.storeGroupTitle(e)}},model:{value:this.groupTitle,callback:function(e){t.$set(this,"groupTitle",e)},expression:"this.groupTitle"}})],1)])])]):t._e()]),t._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"},[t._v("\n  \n ")]),t._v(" "),a("button",{staticClass:"btn btn-outline-primary btn-block",on:{click:t.addTransaction}},[a("i",{staticClass:"far fa-clone"}),t._v(" "+t._s(t.$t("firefly.add_another_split"))+"\n ")])]),t._v(" "),a("div",{staticClass:"col"},[a("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[t._v("\n  \n ")]),t._v(" "),a("button",{staticClass:"btn btn-info btn-block",attrs:{disabled:!t.enableSubmit},on:{click:t.submitTransaction}},[t.enableSubmit?a("span",[a("i",{staticClass:"far fa-save"}),t._v(" "+t._s(t.$t("firefly.update_transaction")))]):t._e(),t._v(" "),t.enableSubmit?t._e():a("span",[a("i",{staticClass:"fas fa-spinner fa-spin"})])])])]),t._v(" "),a("div",{staticClass:"row"},[a("div",{staticClass:"col"},[t._v("\n  \n ")]),t._v(" "),a("div",{staticClass:"col"},[a("div",{staticClass:"form-check"},[a("input",{directives:[{name:"model",rawName:"v-model",value:t.stayHere,expression:"stayHere"}],staticClass:"form-check-input",attrs:{id:"stayHere",type:"checkbox"},domProps:{checked:Array.isArray(t.stayHere)?t._i(t.stayHere,null)>-1:t.stayHere},on:{change:function(e){var a=t.stayHere,n=e.target,s=!!n.checked;if(Array.isArray(a)){var i=t._i(a,null);n.checked?i<0&&(t.stayHere=a.concat([null])):i>-1&&(t.stayHere=a.slice(0,i).concat(a.slice(i+1)))}else t.stayHere=s}}}),t._v(" "),a("label",{staticClass:"form-check-label",attrs:{for:"stayHere"}},[a("span",{staticClass:"small"},[t._v(t._s(t.$t("firefly.after_update_create_another")))])])])])])])])])])],1)}),[],!1,null,"17cb1c2b",null).exports;var p=a(7760),g=a.n(p);a(232),g().config.productionTip=!1;var h=a(157),m={};new(g())({i18n:h,store:n.Z,render:function(t){return t(_,{props:m})},beforeCreate:function(){this.$store.commit("initialiseStore"),this.$store.dispatch("updateCurrencyPreference")}}).$mount("#transactions_edit")},6665:(t,e,a)=>{"use strict";a.r(e),a.d(e,{default:()=>r});var n=a(4015),s=a.n(n),i=a(3645),o=a.n(i)()(s());o.push([t.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\n