Skip to content

Firefly III: a personal finances manager

Regenerate frontend.

James Cole22b376da7193
diff --git a/frontend/yarn.lock b/frontend/yarn.lock
index 6a1d6cc214..fb41cc0b66 100644
--- a/frontend/yarn.lock
+++ b/frontend/yarn.lock
@@ -3948,9 +3948,9 @@ fsevents@~2.3.1:
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
fullcalendar@^5.5.1:
- version "5.5.1"
- resolved "https://registry.yarnpkg.com/fullcalendar/-/fullcalendar-5.5.1.tgz#f72a5828473b012d80b558ff80ccb606d07e4baf"
- integrity sha512-QNo4RPm7uvboCkqFEANH0dvYidwlsDzQ4ErMHZjNwLnFOqm+StkIW1K5w82fEyOvznItwyAigrdkSCh2ZUd0JQ==
+ version "5.6.0"
+ resolved "https://registry.yarnpkg.com/fullcalendar/-/fullcalendar-5.6.0.tgz#d840a43a27f2ff856af313c84a627ac8b3238d8f"
+ integrity sha512-7wk/QVrjMkh5c4cKo8Lk6QdOAp833beBmlltmPPEphPA1b+g4PPeQjnihBU4JHPi6Du2rAu0H2cE+gTXEebKjA==
function-bind@^1.1.1:
version "1.1.1"
diff --git a/public/v2/js/transactions/create.js b/public/v2/js/transactions/create.js
index 129d8dae70..a0725a6189 100755
--- a/public/v2/js/transactions/create.js
+++ b/public/v2/js/transactions/create.js
@@ -1,2 +1,2 @@
-(window.webpackJsonp=window.webpackJsonp||[]).push([[8],{335:function(t,e,i){t.exports=i(461)},461:function(t,e,i){"use strict";i.r(e);var n=i(30),s=i(14),a=i(68),r=i(46),o=i(69),c=i(66),d=i(29);function u(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function l(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?u(Object(i),!0).forEach((function(e){p(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):u(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function p(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var h=Object(s.b)("transactions/create"),_=(h.mapState,h.mapGetters),f=(h.mapActions,h.mapMutations),m={name:"Create",components:{SplitForm:c.a,Alert:a.a,SplitPills:r.a,TransactionGroupTitle:o.a},created:function(){this.getAllowedOpposingTypes(),this.getAccountToTransaction(),this.getCustomFields(),this.addTransaction()},data:function(){return{errorMessage:"",successMessage:"",customFields:{},enableSubmit:!0,createAnother:!1,resetFormAfter:!1,submittedTransaction:!1,submittedLinks:!1,submittedAttachments:!1,inError:!1,submittedAttCount:{},groupTitleErrors:[],returnedGroupId:0,returnedGroupTitle:"",accountToTransaction:{},allowedOpposingTypes:{},defaultSourceAllowedTypes:["Asset account","Loan","Debt","Mortgage","Revenue account"],defaultDestinationAllowedTypes:["Asset account","Loan","Debt","Mortgage","Expense account"],sourceAllowedTypes:["Asset account","Loan","Debt","Mortgage","Revenue account"],destinationAllowedTypes:["Asset account","Loan","Debt","Mortgage","Expense account"],date:new Date,time:new Date}},computed:l({},_(["transactionType","transactions","groupTitle"])),watch:{submittedTransaction:function(){this.finalizeSubmit()},submittedLinks:function(){this.finalizeSubmit()},submittedAttachments:function(){this.finalizeSubmit()}},methods:l(l({},f(["setGroupTitle","addTransaction","deleteTransaction","setTransactionError","setTransactionType","resetErrors","updateField","resetTransactions"])),{},{removeTransaction:function(t){this.$store.commit("transactions/create/deleteTransaction",t)},finalizeSubmit:function(){var t=this;if(this.submittedTransaction&&this.submittedAttachments&&this.submittedLinks){var e;if(!1===this.createAnother&&!1===this.inError)return void(window.location.href=(null!==(e=window.previousURL)&&void 0!==e?e:"/")+"?transaction_group_id="+this.returnedGroupId+"&message=created");for(var i in!1===this.inError&&(this.errorMessage="",this.successMessage=this.$t("firefly.transaction_stored_link",{ID:this.returnedGroupId,title:this.returnedGroupTitle})),this.enableSubmit=!0,this.submittedTransaction=!1,this.submittedLinks=!1,this.submittedAttachments=!1,this.inError=!1,this.transactions)this.transactions.hasOwnProperty(i)&&/^0$|^[1-9]\d*$/.test(i)&&i<=4294967294&&this.transactions.hasOwnProperty(i)&&this.updateField({index:i,field:"transaction_journal_id",value:0});this.submittedAttCount=[],this.resetFormAfter&&(this.resetTransactions(),setTimeout((function(){return t.addTransaction()}),50))}},submitTransaction:function(){var t=this;this.enableSubmit=!1;var e=this.convertData();axios.post("./api/v1/transactions",e).then((function(i){t.submittedTransaction=!0,t.submitTransactionLinks(e,i),t.submitAttachments(e,i),t.returnedGroupId=parseInt(i.data.data.id),t.returnedGroupTitle=null===i.data.data.attributes.group_title?i.data.data.attributes.transactions[0].description:i.data.data.attributes.group_title})).catch((function(e){t.enableSubmit=!0,t.submittedTransaction=!0,t.submittedAttachments=!0,t.submittedLinks=!0,t.inError=!0,t.parseErrors(e.response.data)}))},submitAttachments:function(t,e){var i=e.data.data.attributes.transactions;for(var n in t.transactions)t.transactions.hasOwnProperty(n)&&/^0$|^[1-9]\d*$/.test(n)&&n<=4294967294&&i.hasOwnProperty(n)&&this.updateField({index:n,field:"transaction_journal_id",value:i[n].transaction_journal_id})},uploadedAttachment:function(t){var e="str"+t;this.submittedAttCount[e]=1,Object.keys(this.submittedAttCount).length===this.transactions.length&&(this.submittedAttachments=!0)},storeLocation:function(t){var e=t.hasMarker?t.zoomLevel:null,i=t.hasMarker?t.lat:null,n=t.hasMarker?t.lng:null;this.updateField({index:t.index,field:"zoom_level",value:e}),this.updateField({index:t.index,field:"latitude",value:i}),this.updateField({index:t.index,field:"longitude",value:n})},storeAccountValue:function(t){this.updateField({index:t.index,field:t.direction+"_account_id",value:t.id}),this.updateField({index:t.index,field:t.direction+"_account_type",value:t.type}),this.updateField({index:t.index,field:t.direction+"_account_name",value:t.name}),this.updateField({index:t.index,field:t.direction+"_account_currency_id",value:t.currency_id}),this.updateField({index:t.index,field:t.direction+"_account_currency_code",value:t.currency_code}),this.updateField({index:t.index,field:t.direction+"_account_currency_symbol",value:t.currency_symbol}),this.calculateTransactionType(t.index)},storeField:function(t){this.updateField(t)},storeDate:function(t){this.date=t.date},storeTime:function(t){this.time=t.time},storeGroupTitle:function(t){this.setGroupTitle({groupTitle:t})},calculateTransactionType:function(t){if(0===t){var e=this.transactions[0].source_account_type,i=this.transactions[0].destination_account_type;if(null===e||null===i)return void this.setTransactionType("any");if(""===e||""===i)return void this.setTransactionType("any");var n=this.accountToTransaction[e];if(void 0!==n){var s=n[i];if(void 0!==n[i])return void this.setTransactionType(s)}"Asset account"!==e&&this.updateField({index:0,field:"destination_account_id",value:null}),"Asset account"!==i&&this.updateField({index:0,field:"source_account_id",value:null}),this.setTransactionType("any")}},submitTransactionLinks:function(t,e){var i=[],n=e.data.data.attributes.transactions,s=0;for(var a in t.transactions)if(t.transactions.hasOwnProperty(a)&&/^0$|^[1-9]\d*$/.test(a)&&a<=4294967294){var r=t.transactions[a];if(n.hasOwnProperty(a)){var o=n[a];for(var c in r.links)if(r.links.hasOwnProperty(c)&&/^0$|^[1-9]\d*$/.test(c)&&c<=4294967294){var d=r.links[c];s++,0===d.outward_id&&(d.outward_id=o.transaction_journal_id),0===d.inward_id&&(d.inward_id=o.transaction_journal_id),i.push(axios.post("./api/v1/transaction_links",d).then((function(t){})))}}}0!==s?Promise.all(i).then((function(){this.submittedLinks=!0})):this.submittedLinks=!0},parseErrors:function(t){for(var e in this.transactions)this.resetErrors({index:e});var i,n,s;for(var a 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(a)){if("group_title"===a){this.groupTitleErrors=t.errors[a];continue}if("group_title"!==a)switch(n=parseInt(a.split(".")[1]),s=a.split(".")[2]){case"amount":case"description":case"date":case"tags":i={index:n,field:s,errors:t.errors[a]},this.setTransactionError(i);break;case"budget_id":i={index:n,field:"budget",errors:t.errors[a]},this.setTransactionError(i);break;case"bill_id":i={index:n,field:"bill",errors:t.errors[a]},this.setTransactionError(i);break;case"piggy_bank_id":i={index:n,field:"piggy_bank",errors:t.errors[a]},this.setTransactionError(i);break;case"category_name":i={index:n,field:"category",errors:t.errors[a]},this.setTransactionError(i);break;case"source_name":case"source_id":i={index:n,field:"source",errors:t.errors[a]},this.setTransactionError(i);break;case"destination_name":case"destination_id":i={index:n,field:"destination",errors:t.errors[a]},this.setTransactionError(i);break;case"foreign_amount":case"foreign_currency":i={index:n,field:"foreign_amount",errors:t.errors[a]},this.setTransactionError(i)}this.transactions[n]}},convertData:function(){var t={transactions:[]};for(var e in this.groupTitle.length>0&&(t.group_title=this.groupTitle),this.transactions)this.transactions.hasOwnProperty(e)&&/^0$|^[1-9]\d*$/.test(e)&&e<=4294967294&&t.transactions.push(this.convertSplit(e,this.transactions[e]));return t.transactions.length>1&&""!==t.transactions[0].description&&(t.group_title=t.transactions[0].description),t.transactions.length>1&&(t=this.synchronizeAccounts(t)),t},synchronizeAccounts:function(t){for(var e in t.transactions)t.transactions.hasOwnProperty(e)&&/^0$|^[1-9]\d*$/.test(e)&&e<=4294967294&&("Transfer"===this.transactionType&&(t.transactions[e].source_name=null,t.transactions[e].destination_name=null,e>0&&(t.transactions[e].source_id=t.transactions[0].source_id,t.transactions[e].destination_id=t.transactions[0].destination_id)),"Deposit"===this.transactionType&&(t.transactions[e].destination_name=null,e>0&&(t.transactions[e].destination_id=t.transactions[0].destination_id)),"Withdrawal"===this.transactionType&&(t.transactions[e].source_name=null,e>0&&(t.transactions[e].source_id=t.transactions[0].source_id)));return t},switchAccounts:function(t){var e=this.transactions[t].source_account_id,i=this.transactions[t].source_account_name,n=this.transactions[t].source_account_type,s=this.transactions[t].destination_account_id,a=this.transactions[t].destination_account_name,r=this.transactions[t].destination_account_type;this.updateField({index:0,field:"source_account_id",value:s}),this.updateField({index:0,field:"source_account_name",value:a}),this.updateField({index:0,field:"source_account_type",value:r}),this.updateField({index:0,field:"destination_account_id",value:e}),this.updateField({index:0,field:"destination_account_name",value:i}),this.updateField({index:0,field:"destination_account_type",value:n}),this.calculateTransactionType(0)},convertSplit:function(t,e){var i,n,s,a,r="invalid";if(this.time instanceof Date&&!isNaN(this.time)&&this.date instanceof Date&&!isNaN(this.date)){var o=new Date(this.date);o.setHours(this.time.getHours()),o.setMinutes(this.time.getMinutes()),o.setSeconds(this.time.getSeconds()),r=Object(d.c)(o)}var c,u,l,p={description:e.description,date:r,type:this.transactionType,source_id:null!==(i=e.source_account_id)&&void 0!==i?i:null,source_name:null!==(n=e.source_account_name)&&void 0!==n?n:null,destination_id:null!==(s=e.destination_account_id)&&void 0!==s?s:null,destination_name:null!==(a=e.destination_account_name)&&void 0!==a?a:null,currency_id:e.currency_id,amount:e.amount,budget_id:e.budget_id,category_name:e.category,tags:e.tags,interest_date:e.interest_date,book_date:e.book_date,process_date:e.process_date,due_date:e.due_date,payment_date:e.payment_date,invoice_date:e.invoice_date,internal_reference:e.internal_reference,external_url:e.external_url,notes:e.notes,external_id:e.external_id,zoom_level:e.zoom_level,longitude:e.longitude,latitude:e.latitude,order:0,reconciled:!1};0!==e.piggy_bank_id&&(p.piggy_bank_id=e.piggy_bank_id),0!==e.bill_id&&(p.bill_id=e.bill_id),0!==e.foreign_currency_id&&""!==e.foreign_amount&&(p.foreign_currency_id=e.foreign_currency_id),""!==e.foreign_amount&&(p.foreign_amount=e.foreign_amount),c=this.transactionType?this.transactionType.toLowerCase():"any",u=this.transactions[0].source_account_type,l=this.transactions[0].destination_account_type,p.currency_id=e.source_account_currency_id,"any"===c&&["asset","Asset account","Loan","Debt","Mortgage"].includes(u)&&(c="withdrawal"),"any"===c&&["asset","Asset account","Loan","Debt","Mortgage"].includes(l)&&(c="deposit",p.currency_id=e.destination_account_currency_id),p.type=c;var h=[];for(var _ in e.links)if(e.links.hasOwnProperty(_)&&/^0$|^[1-9]\d*$/.test(_)&&_<=4294967294){var f=e.links[_],m=f.link_type_id.split("-"),v="outward"===m[1]?0:parseInt(f.transaction_journal_id),y="inward"===m[1]?0:parseInt(f.transaction_journal_id),b={link_type_id:parseInt(m[0]),inward_id:v,outward_id:y};h.push(b)}return p.links=h,p},getAllowedOpposingTypes:function(){var t=this;axios.get("./api/v1/configuration/firefly.allowed_opposing_types").then((function(e){t.allowedOpposingTypes=e.data.data.value}))},getAccountToTransaction:function(){var t=this;axios.get("./api/v1/configuration/firefly.account_to_transaction").then((function(e){t.accountToTransaction=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}))},setDestinationAllowedTypes:function(t){0!==t.length?this.destinationAllowedTypes=t:this.destinationAllowedTypes=this.defaultDestinationAllowedTypes},setSourceAllowedTypes:function(t){0!==t.length?this.sourceAllowedTypes=t:this.sourceAllowedTypes=this.defaultSourceAllowedTypes}})},v=i(4),y=Object(v.a)(m,(function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",[i("alert",{attrs:{message:t.errorMessage,type:"danger"}}),t._v(" "),i("alert",{attrs:{message:t.successMessage,type:"success"}}),t._v(" "),i("SplitPills",{attrs:{transactions:t.transactions}}),t._v(" "),i("div",{staticClass:"tab-content"},t._l(this.transactions,(function(e,n){return i("SplitForm",{key:n,attrs:{"allowed-opposing-types":t.allowedOpposingTypes,count:t.transactions.length,"custom-fields":t.customFields,date:t.date,"destination-allowed-types":t.destinationAllowedTypes,index:n,"source-allowed-types":t.sourceAllowedTypes,"submitted-transaction":t.submittedTransaction,time:t.time,transaction:e,"transaction-type":t.transactionType},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)},"switch-accounts":function(e){return t.switchAccounts(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)},"set-dest-types":function(e){return t.setDestinationAllowedTypes(e)},"set-src-types":function(e){return t.setSourceAllowedTypes(e)}}})})),1),t._v(" "),i("div",{staticClass:"row"},[i("div",{staticClass:"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12"},[t.transactions.length>1?i("div",{staticClass:"card"},[i("div",{staticClass:"card-body"},[i("div",{staticClass:"row"},[i("div",{staticClass:"col"},[i("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(" "),i("div",{staticClass:"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12"},[i("div",{staticClass:"card card-primary"},[i("div",{staticClass:"card-body"},[i("div",{staticClass:"row"},[i("div",{staticClass:"col"},[i("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[t._v("\n  \n ")]),t._v(" "),i("button",{staticClass:"btn btn-outline-primary btn-block",on:{click:t.addTransaction}},[i("i",{staticClass:"far fa-clone"}),t._v(" "+t._s(t.$t("firefly.add_another_split"))+"\n ")])]),t._v(" "),i("div",{staticClass:"col"},[i("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[t._v("\n  \n ")]),t._v(" "),i("button",{staticClass:"btn btn-success btn-block",attrs:{disabled:!t.enableSubmit},on:{click:t.submitTransaction}},[t.enableSubmit?i("span",[i("i",{staticClass:"far fa-save"}),t._v(" "+t._s(t.$t("firefly.store_transaction")))]):t._e(),t._v(" "),t.enableSubmit?t._e():i("span",[i("i",{staticClass:"fas fa-spinner fa-spin"})])])])]),t._v(" "),i("div",{staticClass:"row"},[i("div",{staticClass:"col"},[t._v("\n  \n ")]),t._v(" "),i("div",{staticClass:"col"},[i("div",{staticClass:"form-check"},[i("input",{directives:[{name:"model",rawName:"v-model",value:t.createAnother,expression:"createAnother"}],staticClass:"form-check-input",attrs:{id:"createAnother",type:"checkbox"},domProps:{checked:Array.isArray(t.createAnother)?t._i(t.createAnother,null)>-1:t.createAnother},on:{change:function(e){var i=t.createAnother,n=e.target,s=!!n.checked;if(Array.isArray(i)){var a=t._i(i,null);n.checked?a<0&&(t.createAnother=i.concat([null])):a>-1&&(t.createAnother=i.slice(0,a).concat(i.slice(a+1)))}else t.createAnother=s}}}),t._v(" "),i("label",{staticClass:"form-check-label",attrs:{for:"createAnother"}},[i("span",{staticClass:"small"},[t._v(t._s(t.$t("firefly.create_another")))])])]),t._v(" "),i("div",{staticClass:"form-check"},[i("input",{directives:[{name:"model",rawName:"v-model",value:t.resetFormAfter,expression:"resetFormAfter"}],staticClass:"form-check-input",attrs:{id:"resetFormAfter",disabled:!t.createAnother,type:"checkbox"},domProps:{checked:Array.isArray(t.resetFormAfter)?t._i(t.resetFormAfter,null)>-1:t.resetFormAfter},on:{change:function(e){var i=t.resetFormAfter,n=e.target,s=!!n.checked;if(Array.isArray(i)){var a=t._i(i,null);n.checked?a<0&&(t.resetFormAfter=i.concat([null])):a>-1&&(t.resetFormAfter=i.slice(0,a).concat(i.slice(a+1)))}else t.resetFormAfter=s}}}),t._v(" "),i("label",{staticClass:"form-check-label",attrs:{for:"resetFormAfter"}},[i("span",{staticClass:"small"},[t._v(t._s(t.$t("firefly.reset_after")))])])])])])])])])])],1)}),[],!1,null,"1b78c213",null).exports,b=i(8),g=i.n(b);i(41),g.a.config.productionTip=!1;var T=i(43),A={};new g.a({i18n:T,store:n.a,render:function(t){return t(y,{props:A})},beforeCreate:function(){this.$store.commit("initialiseStore"),this.$store.dispatch("updateCurrencyPreference")}}).$mount("#transactions_create")}},[[335,0,1]]]);
+(window.webpackJsonp=window.webpackJsonp||[]).push([[8],{335:function(t,e,n){t.exports=n(461)},461:function(t,e,n){"use strict";n.r(e);var i=n(30),s=n(14),a=n(68),r=n(46),o=n(69),c=n(66),d=n(29);function u(t){return(u="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)}function l(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function p(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach((function(e){h(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function h(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var _=Object(s.b)("transactions/create"),f=(_.mapState,_.mapGetters),m=(_.mapActions,_.mapMutations),y={name:"Create",components:{SplitForm:c.a,Alert:a.a,SplitPills:r.a,TransactionGroupTitle:o.a},created:function(){this.getAllowedOpposingTypes(),this.getAccountToTransaction(),this.getCustomFields(),this.addTransaction()},data:function(){return{errorMessage:"",successMessage:"",customFields:{},enableSubmit:!0,createAnother:!1,resetFormAfter:!1,submittedTransaction:!1,submittedLinks:!1,submittedAttachments:!1,inError:!1,submittedAttCount:{},groupTitleErrors:[],returnedGroupId:0,returnedGroupTitle:"",accountToTransaction:{},allowedOpposingTypes:{},defaultSourceAllowedTypes:["Asset account","Loan","Debt","Mortgage","Revenue account"],defaultDestinationAllowedTypes:["Asset account","Loan","Debt","Mortgage","Expense account"],sourceAllowedTypes:["Asset account","Loan","Debt","Mortgage","Revenue account"],destinationAllowedTypes:["Asset account","Loan","Debt","Mortgage","Expense account"],date:new Date,time:new Date}},computed:p({},f(["transactionType","transactions","groupTitle"])),watch:{submittedTransaction:function(){this.finalizeSubmit()},submittedLinks:function(){this.finalizeSubmit()},submittedAttachments:function(){this.finalizeSubmit()}},methods:p(p({},m(["setGroupTitle","addTransaction","deleteTransaction","setTransactionError","setTransactionType","resetErrors","updateField","resetTransactions"])),{},{removeTransaction:function(t){this.$store.commit("transactions/create/deleteTransaction",t)},finalizeSubmit:function(){var t=this;if(this.submittedTransaction&&this.submittedAttachments&&this.submittedLinks){var e;if(!1===this.createAnother&&!1===this.inError)return void(window.location.href=(null!==(e=window.previousURL)&&void 0!==e?e:"/")+"?transaction_group_id="+this.returnedGroupId+"&message=created");for(var n in!1===this.inError&&(this.errorMessage="",this.successMessage=this.$t("firefly.transaction_stored_link",{ID:this.returnedGroupId,title:this.returnedGroupTitle})),this.enableSubmit=!0,this.submittedTransaction=!1,this.submittedLinks=!1,this.submittedAttachments=!1,this.inError=!1,this.transactions)this.transactions.hasOwnProperty(n)&&/^0$|^[1-9]\d*$/.test(n)&&n<=4294967294&&this.transactions.hasOwnProperty(n)&&this.updateField({index:n,field:"transaction_journal_id",value:0});this.submittedAttCount=[],this.resetFormAfter&&(this.resetTransactions(),setTimeout((function(){return t.addTransaction()}),50))}},submitTransaction:function(){var t=this;this.enableSubmit=!1;var e=this.convertData();axios.post("./api/v1/transactions",e).then((function(n){t.submittedTransaction=!0,t.submitTransactionLinks(e,n),t.submitAttachments(e,n),t.returnedGroupId=parseInt(n.data.data.id),t.returnedGroupTitle=null===n.data.data.attributes.group_title?n.data.data.attributes.transactions[0].description:n.data.data.attributes.group_title})).catch((function(e){t.enableSubmit=!0,t.submittedTransaction=!0,t.submittedAttachments=!0,t.submittedLinks=!0,t.inError=!0,t.parseErrors(e.response.data)}))},submitAttachments:function(t,e){var n=e.data.data.attributes.transactions;for(var i in t.transactions)t.transactions.hasOwnProperty(i)&&/^0$|^[1-9]\d*$/.test(i)&&i<=4294967294&&n.hasOwnProperty(i)&&this.updateField({index:i,field:"transaction_journal_id",value:n[i].transaction_journal_id})},uploadedAttachment:function(t){var e="str"+t;this.submittedAttCount[e]=1,Object.keys(this.submittedAttCount).length===this.transactions.length&&(this.submittedAttachments=!0)},storeLocation:function(t){var e=t.hasMarker?t.zoomLevel:null,n=t.hasMarker?t.lat:null,i=t.hasMarker?t.lng:null;this.updateField({index:t.index,field:"zoom_level",value:e}),this.updateField({index:t.index,field:"latitude",value:n}),this.updateField({index:t.index,field:"longitude",value:i})},storeAccountValue:function(t){this.updateField({index:t.index,field:t.direction+"_account_id",value:t.id}),this.updateField({index:t.index,field:t.direction+"_account_type",value:t.type}),this.updateField({index:t.index,field:t.direction+"_account_name",value:t.name}),this.updateField({index:t.index,field:t.direction+"_account_currency_id",value:t.currency_id}),this.updateField({index:t.index,field:t.direction+"_account_currency_code",value:t.currency_code}),this.updateField({index:t.index,field:t.direction+"_account_currency_symbol",value:t.currency_symbol}),this.calculateTransactionType(t.index)},storeField:function(t){this.updateField(t)},storeDate:function(t){this.date=t.date},storeTime:function(t){this.time=t.time},storeGroupTitle:function(t){this.setGroupTitle({groupTitle:t})},calculateTransactionType:function(t){if(0===t){var e=this.transactions[0].source_account_type,n=this.transactions[0].destination_account_type;if(null===e||null===n)return void this.setTransactionType("any");if(""===e||""===n)return void this.setTransactionType("any");var i=this.accountToTransaction[e];if(void 0!==i){var s=i[n];if(void 0!==i[n])return void this.setTransactionType(s)}"Asset account"!==e&&this.updateField({index:0,field:"destination_account_id",value:null}),"Asset account"!==n&&this.updateField({index:0,field:"source_account_id",value:null}),this.setTransactionType("any")}},submitTransactionLinks:function(t,e){var n=[],i=e.data.data.attributes.transactions,s=0;for(var a in t.transactions)if(t.transactions.hasOwnProperty(a)&&/^0$|^[1-9]\d*$/.test(a)&&a<=4294967294){var r=t.transactions[a];if(i.hasOwnProperty(a)){var o=i[a];for(var c in r.links)if(r.links.hasOwnProperty(c)&&/^0$|^[1-9]\d*$/.test(c)&&c<=4294967294){var d=r.links[c];s++,0===d.outward_id&&(d.outward_id=o.transaction_journal_id),0===d.inward_id&&(d.inward_id=o.transaction_journal_id),n.push(axios.post("./api/v1/transaction_links",d).then((function(t){})))}}}0!==s?Promise.all(n).then((function(){this.submittedLinks=!0})):this.submittedLinks=!0},parseErrors:function(t){for(var e in this.transactions)this.resetErrors({index:e});var n,i,s;for(var a 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(a)){if("group_title"===a){this.groupTitleErrors=t.errors[a];continue}if("group_title"!==a)switch(i=parseInt(a.split(".")[1]),s=a.split(".")[2]){case"amount":case"description":case"date":case"tags":n={index:i,field:s,errors:t.errors[a]},this.setTransactionError(n);break;case"budget_id":n={index:i,field:"budget",errors:t.errors[a]},this.setTransactionError(n);break;case"bill_id":n={index:i,field:"bill",errors:t.errors[a]},this.setTransactionError(n);break;case"piggy_bank_id":n={index:i,field:"piggy_bank",errors:t.errors[a]},this.setTransactionError(n);break;case"category_name":n={index:i,field:"category",errors:t.errors[a]},this.setTransactionError(n);break;case"source_name":case"source_id":n={index:i,field:"source",errors:t.errors[a]},this.setTransactionError(n);break;case"destination_name":case"destination_id":n={index:i,field:"destination",errors:t.errors[a]},this.setTransactionError(n);break;case"foreign_amount":case"foreign_currency":n={index:i,field:"foreign_amount",errors:t.errors[a]},this.setTransactionError(n)}this.transactions[i]}},convertData:function(){var t={transactions:[]};for(var e in this.groupTitle.length>0&&(t.group_title=this.groupTitle),this.transactions)this.transactions.hasOwnProperty(e)&&/^0$|^[1-9]\d*$/.test(e)&&e<=4294967294&&t.transactions.push(this.convertSplit(e,this.transactions[e]));return t.transactions.length>1&&""!==t.transactions[0].description&&(t.group_title=t.transactions[0].description),t.transactions.length>1&&(t=this.synchronizeAccounts(t)),t},synchronizeAccounts:function(t){for(var e in t.transactions)t.transactions.hasOwnProperty(e)&&/^0$|^[1-9]\d*$/.test(e)&&e<=4294967294&&("Transfer"===this.transactionType&&(t.transactions[e].source_name=null,t.transactions[e].destination_name=null,e>0&&(t.transactions[e].source_id=t.transactions[0].source_id,t.transactions[e].destination_id=t.transactions[0].destination_id)),"Deposit"===this.transactionType&&(t.transactions[e].destination_name=null,e>0&&(t.transactions[e].destination_id=t.transactions[0].destination_id)),"Withdrawal"===this.transactionType&&(t.transactions[e].source_name=null,e>0&&(t.transactions[e].source_id=t.transactions[0].source_id)));return t},switchAccounts:function(t){var e=this.transactions[t].source_account_id,n=this.transactions[t].source_account_name,i=this.transactions[t].source_account_type,s=this.transactions[t].destination_account_id,a=this.transactions[t].destination_account_name,r=this.transactions[t].destination_account_type;this.updateField({index:0,field:"source_account_id",value:s}),this.updateField({index:0,field:"source_account_name",value:a}),this.updateField({index:0,field:"source_account_type",value:r}),this.updateField({index:0,field:"destination_account_id",value:e}),this.updateField({index:0,field:"destination_account_name",value:n}),this.updateField({index:0,field:"destination_account_type",value:i}),this.calculateTransactionType(0)},convertSplit:function(t,e){var n,i,s,a,r="invalid";if(this.time instanceof Date&&!isNaN(this.time)&&this.date instanceof Date&&!isNaN(this.date)){var o=new Date(this.date);o.setHours(this.time.getHours()),o.setMinutes(this.time.getMinutes()),o.setSeconds(this.time.getSeconds()),r=Object(d.c)(o)}var c,l,p,h={description:e.description,date:r,type:this.transactionType,source_id:null!==(n=e.source_account_id)&&void 0!==n?n:null,source_name:null!==(i=e.source_account_name)&&void 0!==i?i:null,destination_id:null!==(s=e.destination_account_id)&&void 0!==s?s:null,destination_name:null!==(a=e.destination_account_name)&&void 0!==a?a:null,currency_id:e.currency_id,amount:e.amount,budget_id:e.budget_id,category_name:e.category,interest_date:e.interest_date,book_date:e.book_date,process_date:e.process_date,due_date:e.due_date,payment_date:e.payment_date,invoice_date:e.invoice_date,internal_reference:e.internal_reference,external_url:e.external_url,notes:e.notes,external_id:e.external_id,zoom_level:e.zoom_level,longitude:e.longitude,latitude:e.latitude,tags:[],order:0,reconciled:!1};if(0!==e.tags.length)for(var _ in e.tags)if(e.tags.hasOwnProperty(_)&&/^0$|^[1-9]\d*$/.test(_)&&_<=4294967294){var f=e.tags[_];"object"===u(f)&&null!==f&&h.tags.push(f.text),"string"==typeof f&&h.tags.push(f)}0!==e.piggy_bank_id&&(h.piggy_bank_id=e.piggy_bank_id),0!==e.bill_id&&(h.bill_id=e.bill_id),0!==e.foreign_currency_id&&""!==e.foreign_amount&&(h.foreign_currency_id=e.foreign_currency_id),""!==e.foreign_amount&&(h.foreign_amount=e.foreign_amount),c=this.transactionType?this.transactionType.toLowerCase():"any",l=this.transactions[0].source_account_type,p=this.transactions[0].destination_account_type,h.currency_id=e.source_account_currency_id,"any"===c&&["asset","Asset account","Loan","Debt","Mortgage"].includes(l)&&(c="withdrawal"),"any"===c&&["asset","Asset account","Loan","Debt","Mortgage"].includes(p)&&(c="deposit",h.currency_id=e.destination_account_currency_id),h.type=c;var m=[];for(var y in e.links)if(e.links.hasOwnProperty(y)&&/^0$|^[1-9]\d*$/.test(y)&&y<=4294967294){var v=e.links[y],b=v.link_type_id.split("-"),g="outward"===b[1]?0:parseInt(v.transaction_journal_id),T="inward"===b[1]?0:parseInt(v.transaction_journal_id),A={link_type_id:parseInt(b[0]),inward_id:g,outward_id:T};m.push(A)}return h.links=m,h},getAllowedOpposingTypes:function(){var t=this;axios.get("./api/v1/configuration/firefly.allowed_opposing_types").then((function(e){t.allowedOpposingTypes=e.data.data.value}))},getAccountToTransaction:function(){var t=this;axios.get("./api/v1/configuration/firefly.account_to_transaction").then((function(e){t.accountToTransaction=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}))},setDestinationAllowedTypes:function(t){0!==t.length?this.destinationAllowedTypes=t:this.destinationAllowedTypes=this.defaultDestinationAllowedTypes},setSourceAllowedTypes:function(t){0!==t.length?this.sourceAllowedTypes=t:this.sourceAllowedTypes=this.defaultSourceAllowedTypes}})},v=n(4),b=Object(v.a)(y,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("alert",{attrs:{message:t.errorMessage,type:"danger"}}),t._v(" "),n("alert",{attrs:{message:t.successMessage,type:"success"}}),t._v(" "),n("SplitPills",{attrs:{transactions:t.transactions}}),t._v(" "),n("div",{staticClass:"tab-content"},t._l(this.transactions,(function(e,i){return n("SplitForm",{key:i,attrs:{"allowed-opposing-types":t.allowedOpposingTypes,count:t.transactions.length,"custom-fields":t.customFields,date:t.date,"destination-allowed-types":t.destinationAllowedTypes,index:i,"source-allowed-types":t.sourceAllowedTypes,"submitted-transaction":t.submittedTransaction,time:t.time,transaction:e,"transaction-type":t.transactionType},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)},"switch-accounts":function(e){return t.switchAccounts(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)},"set-dest-types":function(e){return t.setDestinationAllowedTypes(e)},"set-src-types":function(e){return t.setSourceAllowedTypes(e)}}})})),1),t._v(" "),n("div",{staticClass:"row"},[n("div",{staticClass:"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12"},[t.transactions.length>1?n("div",{staticClass:"card"},[n("div",{staticClass:"card-body"},[n("div",{staticClass:"row"},[n("div",{staticClass:"col"},[n("TransactionGroupTitle",{attrs:{errors:this.groupTitleErrors},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(" "),n("div",{staticClass:"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12"},[n("div",{staticClass:"card card-primary"},[n("div",{staticClass:"card-body"},[n("div",{staticClass:"row"},[n("div",{staticClass:"col"},[n("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[t._v("\n  \n ")]),t._v(" "),n("button",{staticClass:"btn btn-outline-primary btn-block",on:{click:t.addTransaction}},[n("i",{staticClass:"far fa-clone"}),t._v(" "+t._s(t.$t("firefly.add_another_split"))+"\n ")])]),t._v(" "),n("div",{staticClass:"col"},[n("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[t._v("\n  \n ")]),t._v(" "),n("button",{staticClass:"btn btn-success btn-block",attrs:{disabled:!t.enableSubmit},on:{click:t.submitTransaction}},[t.enableSubmit?n("span",[n("i",{staticClass:"far fa-save"}),t._v(" "+t._s(t.$t("firefly.store_transaction")))]):t._e(),t._v(" "),t.enableSubmit?t._e():n("span",[n("i",{staticClass:"fas fa-spinner fa-spin"})])])])]),t._v(" "),n("div",{staticClass:"row"},[n("div",{staticClass:"col"},[t._v("\n  \n ")]),t._v(" "),n("div",{staticClass:"col"},[n("div",{staticClass:"form-check"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.createAnother,expression:"createAnother"}],staticClass:"form-check-input",attrs:{id:"createAnother",type:"checkbox"},domProps:{checked:Array.isArray(t.createAnother)?t._i(t.createAnother,null)>-1:t.createAnother},on:{change:function(e){var n=t.createAnother,i=e.target,s=!!i.checked;if(Array.isArray(n)){var a=t._i(n,null);i.checked?a<0&&(t.createAnother=n.concat([null])):a>-1&&(t.createAnother=n.slice(0,a).concat(n.slice(a+1)))}else t.createAnother=s}}}),t._v(" "),n("label",{staticClass:"form-check-label",attrs:{for:"createAnother"}},[n("span",{staticClass:"small"},[t._v(t._s(t.$t("firefly.create_another")))])])]),t._v(" "),n("div",{staticClass:"form-check"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.resetFormAfter,expression:"resetFormAfter"}],staticClass:"form-check-input",attrs:{id:"resetFormAfter",disabled:!t.createAnother,type:"checkbox"},domProps:{checked:Array.isArray(t.resetFormAfter)?t._i(t.resetFormAfter,null)>-1:t.resetFormAfter},on:{change:function(e){var n=t.resetFormAfter,i=e.target,s=!!i.checked;if(Array.isArray(n)){var a=t._i(n,null);i.checked?a<0&&(t.resetFormAfter=n.concat([null])):a>-1&&(t.resetFormAfter=n.slice(0,a).concat(n.slice(a+1)))}else t.resetFormAfter=s}}}),t._v(" "),n("label",{staticClass:"form-check-label",attrs:{for:"resetFormAfter"}},[n("span",{staticClass:"small"},[t._v(t._s(t.$t("firefly.reset_after")))])])])])])])])])])],1)}),[],!1,null,"6df98ad4",null).exports,g=n(8),T=n.n(g);n(41),T.a.config.productionTip=!1;var A=n(43),w={};new T.a({i18n:A,store:i.a,render:function(t){return t(b,{props:w})},beforeCreate:function(){this.$store.commit("initialiseStore"),this.$store.dispatch("updateCurrencyPreference")}}).$mount("#transactions_create")}},[[335,0,1]]]);
//# sourceMappingURL=create.js.map
\ No newline at end of file
diff --git a/public/v2/js/transactions/create.js.map b/public/v2/js/transactions/create.js.map
index b7bded5963..62df5e3a09 100755
--- a/public/v2/js/transactions/create.js.map
+++ b/public/v2/js/transactions/create.js.map
@@ -1 +1 @@
-{"version":3,"sources":["webpack:///src/components/transactions/Create.vue","webpack:///./src/components/transactions/Create.vue?0a62","webpack:///./src/components/transactions/Create.vue","webpack:///./src/components/transactions/Create.vue?8d0e","webpack:///./src/pages/transactions/create.js"],"names":["name","components","SplitForm","Alert","SplitPills","TransactionGroupTitle","created","this","getAllowedOpposingTypes","getAccountToTransaction","getCustomFields","addTransaction","data","errorMessage","successMessage","customFields","enableSubmit","createAnother","resetFormAfter","submittedTransaction","submittedLinks","submittedAttachments","inError","submittedAttCount","groupTitleErrors","returnedGroupId","returnedGroupTitle","accountToTransaction","allowedOpposingTypes","defaultSourceAllowedTypes","defaultDestinationAllowedTypes","sourceAllowedTypes","destinationAllowedTypes","date","Date","time","computed","watch","finalizeSubmit","methods","removeTransaction","$store","commit","payload","window","location","href","$t","transactions","hasOwnProperty","i","test","updateField","resetTransactions","setTimeout","submitTransaction","axios","post","submitAttachments","result","uploadedAttachment","key","length","storeLocation","storeAccountValue","calculateTransactionType","index","storeField","storeDate","storeTime","storeGroupTitle","setGroupTitle","source","dest","setTransactionType","expectedDestinationTypes","transactionType","submitTransactionLinks","submitted","links","ii","total","currentLink","outward_id","received","transaction_journal_id","inward_id","promises","push","then","Promise","all","parseErrors","resetErrors","errors","message","transactionIndex","parseInt","split","fieldName","setTransactionError","convertData","groupTitle","group_title","convertSplit","description","synchronizeAccounts","source_name","destination_name","source_id","destination_id","switchAccounts","theDate","setHours","getHours","setMinutes","getMinutes","setSeconds","getSeconds","dateStr","array","type","currency_id","amount","budget_id","category_name","category","tags","interest_date","book_date","process_date","due_date","payment_date","invoice_date","internal_reference","external_url","notes","external_id","zoom_level","longitude","latitude","order","reconciled","piggy_bank_id","currentSplit","bill_id","foreign_currency_id","foreign_amount","toLowerCase","firstSource","source_account_type","firstDestination","destination_account_type","source_account_currency_id","includes","destination_account_currency_id","link_type_id","linkTypeParts","inwardId","outwardId","newLink","get","setDestinationAllowedTypes","value","setSourceAllowedTypes","_vm","_h","$createElement","_c","_self","attrs","_v","staticClass","_l","transaction","on","$event","model","callback","$$v","$set","expression","_e","_s","directives","rawName","domProps","Array","isArray","_i","$$a","$$el","target","$$c","checked","$$i","concat","slice","require","Vue","config","productionTip","i18n","props","store","render","createElement","Create","beforeCreate","dispatch","$mount"],"mappings":"g4BA2HA,sC,EAAA,S,EAAA,e,EAAA,W,EAAA,cC3HsM,ED6HtM,CACEA,KAAM,SACNC,WAAY,CACVC,UAAJ,IACIC,MAAJ,IACIC,WAAJ,IACIC,sBAAJ,KAKEC,QAXF,WAYIC,KAAKC,0BACLD,KAAKE,0BACLF,KAAKG,kBACLH,KAAKI,kBAEPC,KAjBF,WAkBI,MAAO,CAELC,aAAc,GACdC,eAAgB,GAGhBC,aAAc,GAGdC,cAAc,EACdC,eAAe,EACfC,gBAAgB,EAGhBC,sBAAsB,EACtBC,gBAAgB,EAChBC,sBAAsB,EAGtBC,SAAS,EAKTC,kBAAmB,GAGnBC,iBAAkB,GAGlBC,gBAAiB,EACjBC,mBAAoB,GAGpBC,qBAAsB,GACtBC,qBAAsB,GACtBC,0BAA2B,CAAC,gBAAiB,OAAQ,OAAQ,WAAY,mBACzEC,+BAAgC,CAAC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AAOC,IAAIF,EAAKG,QAAuB,GAAGP,MAAMC,QAAQE,GAAK,CAAC,IAAaK,EAAI9B,EAAIwB,GAAGC,EAAhB,MAA4BC,EAAKG,QAASC,EAAI,IAAI9B,EAAInJ,eAAe4K,EAAIM,OAAO,CAAhF,QAA6FD,GAAK,IAAI9B,EAAInJ,eAAe4K,EAAIO,MAAM,EAAEF,GAAKC,OAAON,EAAIO,MAAMF,EAAI,UAAW9B,EAAInJ,eAAe+K,MAAS5B,EAAIM,GAAG,KAAKH,EAAG,QAAQ,CAACI,YAAY,mBAAmBF,MAAM,CAAC,IAAM,mBAAmB,CAACF,EAAG,OAAO,CAACI,YAAY,SAAS,CAACP,EAAIM,GAAGN,EAAIkB,GAAGlB,EAAItH,GAAG,4CAA4C,KACl+J,IDUpB,EACA,KACA,WACA,M,wBEUFuJ,EAAQ,IAERC,IAAIC,OAAOC,eAAgB,EAE3B,IAAIC,EAAOJ,EAAQ,IAEfK,EAAQ,GACZ,IAAIJ,IAAI,CACIG,OACAE,UACAC,OAHJ,SAGWC,GACH,OAAOA,EAAcC,EAAQ,CAACJ,MAAOA,KAEzCK,aANJ,WAOQzM,KAAKkC,OAAOC,OAAO,mBACnBnC,KAAKkC,OAAOwK,SAAS,+BAE1BC,OAAO,0B","file":"/public/js/transactions/create.js","sourcesContent":["<!--\n - Create.vue\n - Copyright (c) 2020 [email protected]\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 <https://www.gnu.org/licenses/>.\n -->\n\n<template>\n <div>\n <alert :message=\"errorMessage\" type=\"danger\"/>\n <alert :message=\"successMessage\" type=\"success\"/>\n <SplitPills :transactions=\"transactions\"/>\n <div class=\"tab-content\">\n <SplitForm\n v-for=\"(transaction, index) in this.transactions\"\n v-bind:key=\"index\"\n :allowed-opposing-types=\"allowedOpposingTypes\"\n :count=\"transactions.length\"\n :custom-fields=\"customFields\"\n :date=\"date\"\n :destination-allowed-types=\"destinationAllowedTypes\"\n :index=\"index\"\n :source-allowed-types=\"sourceAllowedTypes\"\n :submitted-transaction=\"submittedTransaction\"\n :time=\"time\"\n :transaction=\"transaction\"\n :transaction-type=\"transactionType\"\n v-on:uploaded-attachments=\"uploadedAttachment($event)\"\n v-on:set-marker-location=\"storeLocation($event)\"\n v-on:set-account=\"storeAccountValue($event)\"\n v-on:switch-accounts=\"switchAccounts($event)\"\n v-on:set-date=\"storeDate($event)\"\n v-on:set-time=\"storeTime($event)\"\n v-on:set-field=\"storeField($event)\"\n v-on:remove-transaction=\"removeTransaction($event)\"\n v-on:set-dest-types=\"setDestinationAllowedTypes($event)\"\n v-on:set-src-types=\"setSourceAllowedTypes($event)\"\n\n />\n </div>\n\n <div class=\"row\">\n <!-- group title -->\n <div class=\"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12\">\n <div v-if=\"transactions.length > 1\" class=\"card\">\n <div class=\"card-body\">\n <div class=\"row\">\n <div class=\"col\">\n <TransactionGroupTitle v-model=\"this.groupTitle\" :errors=\"this.groupTitleErrors\" v-on:set-group-title=\"storeGroupTitle($event)\"/>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12\">\n <!-- buttons -->\n <div class=\"card card-primary\">\n <div class=\"card-body\">\n <div class=\"row\">\n <div class=\"col\">\n <div class=\"text-xs d-none d-lg-block d-xl-block\">\n &nbsp;\n </div>\n <button class=\"btn btn-outline-primary btn-block\" @click=\"addTransaction\"><i class=\"far fa-clone\"></i> {{ $t('firefly.add_another_split') }}\n </button>\n </div>\n <div class=\"col\">\n <div class=\"text-xs d-none d-lg-block d-xl-block\">\n &nbsp;\n </div>\n <button :disabled=\"!enableSubmit\" class=\"btn btn-success btn-block\" @click=\"submitTransaction\">\n <span v-if=\"enableSubmit\"><i class=\"far fa-save\"></i> {{ $t('firefly.store_transaction') }}</span>\n <span v-if=\"!enableSubmit\"><i class=\"fas fa-spinner fa-spin\"></i></span>\n </button>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col\">\n &nbsp;\n </div>\n <div class=\"col\">\n <div class=\"form-check\">\n <input id=\"createAnother\" v-model=\"createAnother\" class=\"form-check-input\" type=\"checkbox\">\n <label class=\"form-check-label\" for=\"createAnother\">\n <span class=\"small\">{{ $t('firefly.create_another') }}</span>\n </label>\n </div>\n <div class=\"form-check\">\n <input id=\"resetFormAfter\" v-model=\"resetFormAfter\" :disabled=\"!createAnother\" class=\"form-check-input\" type=\"checkbox\">\n <label class=\"form-check-label\" for=\"resetFormAfter\">\n <span class=\"small\">{{ $t('firefly.reset_after') }}</span>\n </label>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<script>\nimport {createNamespacedHelpers} from 'vuex'\nimport Alert from '../partials/Alert';\nimport SplitPills from \"./SplitPills\";\nimport TransactionGroupTitle from \"./TransactionGroupTitle\";\nimport SplitForm from \"./SplitForm\";\nimport {toW3CString} from '../shared/transactions';\n\nconst {mapState, mapGetters, mapActions, mapMutations} = createNamespacedHelpers('transactions/create')\n\nexport default {\n name: \"Create\",\n components: {\n SplitForm,\n Alert,\n SplitPills,\n TransactionGroupTitle,\n },\n /**\n * Grab some stuff from the API, add the first transaction.\n */\n created() {\n this.getAllowedOpposingTypes();\n this.getAccountToTransaction();\n this.getCustomFields();\n this.addTransaction();\n },\n data() {\n return {\n // error or success message\n errorMessage: '',\n successMessage: '',\n\n // custom fields to show, useful for components:\n customFields: {},\n\n // states for the form (makes sense right)\n enableSubmit: true,\n createAnother: false,\n resetFormAfter: false,\n\n // things the process is done working on (3 phases):\n submittedTransaction: false,\n submittedLinks: false,\n submittedAttachments: false,\n\n // transaction was actually submitted?\n inError: false,\n\n // number of uploaded attachments\n // its an object because we count per transaction journal (which can have multiple attachments)\n // and array doesn't work right.\n submittedAttCount: {},\n\n // errors in the group title:\n groupTitleErrors: [],\n\n // group ID + title once submitted:\n returnedGroupId: 0,\n returnedGroupTitle: '',\n\n // meta data for accounts\n accountToTransaction: {},\n allowedOpposingTypes: {},\n defaultSourceAllowedTypes: ['Asset account', 'Loan', 'Debt', 'Mortgage', 'Revenue account'],\n defaultDestinationAllowedTypes: ['Asset account', 'Loan', 'Debt', 'Mortgage', 'Expense account'],\n sourceAllowedTypes: ['Asset account', 'Loan', 'Debt', 'Mortgage', 'Revenue account'],\n destinationAllowedTypes: ['Asset account', 'Loan', 'Debt', 'Mortgage', 'Expense account'],\n\n // date and time not in the store because it was buggy\n date: new Date,\n time: new Date,\n }\n },\n computed: {\n /**\n * Grabbed from the store.\n */\n ...mapGetters([\n 'transactionType',\n 'transactions',\n 'groupTitle'\n ])\n },\n watch: {\n submittedTransaction: function () {\n // see finalizeSubmit()\n this.finalizeSubmit();\n },\n submittedLinks: function () {\n // see finalizeSubmit()\n this.finalizeSubmit();\n },\n submittedAttachments: function () {\n // see finalizeSubmit()\n this.finalizeSubmit();\n }\n },\n methods: {\n /**\n * Store related mutators used by this component.\n */\n ...mapMutations(\n [\n 'setGroupTitle',\n 'addTransaction',\n 'deleteTransaction',\n 'setTransactionError',\n 'setTransactionType',\n 'resetErrors',\n 'updateField',\n 'resetTransactions',\n ],\n ),\n /**\n * Removes a split from the array.\n */\n removeTransaction: function (payload) {\n // console.log('Triggered to remove transaction ' + payload.index);\n this.$store.commit('transactions/create/deleteTransaction', payload);\n },\n /**\n * Submitting a transaction consists of 3 steps: submitting the transaction, uploading attachments\n * and creating links. Only once all three steps are executed may the message be shown or the user be\n * forwarded.\n */\n finalizeSubmit() {\n // console.log('finalizeSubmit (' + this.submittedTransaction + ', ' + this.submittedAttachments + ', ' + this.submittedLinks + ')');\n if (this.submittedTransaction && this.submittedAttachments && this.submittedLinks) {\n // console.log('all true');\n // console.log('createAnother = ' + this.createAnother);\n // console.log('inError = ' + this.inError);\n if (false === this.createAnother && false === this.inError) {\n // console.log('redirect');\n window.location.href = (window.previousURL ?? '/') + '?transaction_group_id=' + this.returnedGroupId + '&message=created';\n return;\n }\n\n if (false === this.inError) {\n // show message:\n this.errorMessage = '';\n this.successMessage = this.$t('firefly.transaction_stored_link', {ID: this.returnedGroupId, title: this.returnedGroupTitle});\n }\n\n // enable flags:\n this.enableSubmit = true;\n this.submittedTransaction = false;\n this.submittedLinks = false;\n this.submittedAttachments = false;\n this.inError = false;\n\n\n // reset attachments (always do this)\n for (let i in this.transactions) {\n if (this.transactions.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n if (this.transactions.hasOwnProperty(i)) {\n // console.log('Reset attachment #' + i);\n this.updateField({index: i, field: 'transaction_journal_id', value: 0});\n }\n }\n }\n this.submittedAttCount = [];\n\n // reset the form:\n if (this.resetFormAfter) {\n this.resetTransactions();\n // do a short time out?\n setTimeout(() => this.addTransaction(), 50);\n }\n // console.log('Done with finalizeSubmit!');\n // return;\n }\n // console.log('Did nothing in finalizeSubmit');\n },\n /**\n * Actually submit the transaction to Firefly III. This is a fairly complex beast of a thing because multiple things\n * need to happen in the right order.\n */\n submitTransaction: function () {\n // console.log('submitTransaction()');\n // disable the submit button:\n this.enableSubmit = false;\n\n // convert the data so its ready to be submitted:\n const url = './api/v1/transactions';\n const data = this.convertData();\n\n // console.log('Will submit:');\n // console.log(data);\n\n // POST the transaction.\n axios.post(url, data)\n .then(response => {\n // console.log('Response is OK!');\n // report the transaction is submitted.\n this.submittedTransaction = true;\n\n // submit links and attachments (can only be done when the transaction is created)\n this.submitTransactionLinks(data, response);\n this.submitAttachments(data, response);\n\n // meanwhile, store the ID and the title in some easy to access variables.\n this.returnedGroupId = parseInt(response.data.data.id);\n this.returnedGroupTitle = null === response.data.data.attributes.group_title ? response.data.data.attributes.transactions[0].description : response.data.data.attributes.group_title;\n // console.log('Group title is now \"' + this.groupTitle + '\"');\n })\n .catch(error => {\n // oh noes Firefly III has something to bitch about.\n this.enableSubmit = true;\n // console.log('enable submit = true');\n // report the transaction is submitted.\n this.submittedTransaction = true;\n // also report attachments and links are submitted:\n this.submittedAttachments = true;\n this.submittedLinks = true;\n\n // but report an error because error:\n this.inError = true;\n this.parseErrors(error.response.data);\n });\n },\n\n /**\n * Submitting transactions means we will give each TransactionAttachment component\n * the ID of the transaction journal (so it works for multiple splits). Each component\n * will then start uploading their transactions (so its a separated concern) and report\n * back to the \"uploadedAttachment\" function below via an event emitter.\n *\n * The ID is set via the store.\n */\n submitAttachments: function (data, response) {\n // console.log('submitAttachments()');\n let result = response.data.data.attributes.transactions\n for (let i in data.transactions) {\n if (data.transactions.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n if (result.hasOwnProperty(i)) {\n // console.log('updateField(' + i + ', transaction_journal_id, ' + result[i].transaction_journal_id + ')');\n this.updateField({index: i, field: 'transaction_journal_id', value: result[i].transaction_journal_id});\n }\n }\n }\n },\n /**\n * When a attachment component is done uploading it ends up here. We create an object where we count how many\n * attachment components have reported back they're done uploading. Of course if they have nothing to upload\n * they will be pretty fast in reporting they're done.\n *\n * Once the number of components matches the number of splits we know all attachments have been uploaded.\n */\n uploadedAttachment: function (journalId) {\n // console.log('Triggered uploadedAttachment(' + journalId + ')');\n let key = 'str' + journalId;\n this.submittedAttCount[key] = 1;\n let count = Object.keys(this.submittedAttCount).length;\n // console.log('Count is now ' + count);\n // console.log('Length is ' + this.transactions.length);\n if (count === this.transactions.length) {\n // mark the attachments as stored:\n this.submittedAttachments = true;\n // console.log('Got them all!');\n }\n },\n /**\n * Responds to changed location.\n */\n storeLocation: function (payload) {\n let zoomLevel = payload.hasMarker ? payload.zoomLevel : null;\n let lat = payload.hasMarker ? payload.lat : null;\n let lng = payload.hasMarker ? payload.lng : null;\n this.updateField({index: payload.index, field: 'zoom_level', value: zoomLevel});\n this.updateField({index: payload.index, field: 'latitude', value: lat});\n this.updateField({index: payload.index, field: 'longitude', value: lng});\n },\n /**\n * Responds to changed account.\n */\n storeAccountValue: function (payload) {\n this.updateField({index: payload.index, field: payload.direction + '_account_id', value: payload.id});\n this.updateField({index: payload.index, field: payload.direction + '_account_type', value: payload.type});\n this.updateField({index: payload.index, field: payload.direction + '_account_name', value: payload.name});\n\n this.updateField({index: payload.index, field: payload.direction + '_account_currency_id', value: payload.currency_id});\n this.updateField({index: payload.index, field: payload.direction + '_account_currency_code', value: payload.currency_code});\n this.updateField({index: payload.index, field: payload.direction + '_account_currency_symbol', value: payload.currency_symbol});\n\n this.calculateTransactionType(payload.index);\n },\n storeField: function (payload) {\n this.updateField(payload);\n },\n storeDate: function (payload) {\n this.date = payload.date;\n },\n storeTime: function (payload) {\n this.time = payload.time;\n },\n storeGroupTitle: function (value) {\n // console.log('set group title: ' + value);\n this.setGroupTitle({groupTitle: value});\n },\n\n /**\n * Calculate the transaction type based on what's currently in the store.\n */\n calculateTransactionType: function (index) {\n //console.log('calculateTransactionType(' + index + ')');\n if (0 === index) {\n let source = this.transactions[0].source_account_type;\n let dest = this.transactions[0].destination_account_type;\n if (null === source || null === dest) {\n //console.log('transactionType any');\n this.setTransactionType('any');\n //this.$store.commit('setTransactionType', 'any');\n //console.log('calculateTransactionType: either type is NULL so no dice.');\n return;\n }\n if ('' === source || '' === dest) {\n //console.log('transactionType any');\n this.setTransactionType('any');\n //this.$store.commit('setTransactionType', 'any');\n //console.log('calculateTransactionType: either type is empty so no dice.');\n return;\n }\n // ok so type is set on both:\n let expectedDestinationTypes = this.accountToTransaction[source];\n if ('undefined' !== typeof expectedDestinationTypes) {\n let transactionType = expectedDestinationTypes[dest];\n if ('undefined' !== typeof expectedDestinationTypes[dest]) {\n //console.log('Found a type: ' + transactionType);\n this.setTransactionType(transactionType);\n //this.$store.commit('setTransactionType', transactionType);\n //console.log('calculateTransactionType: ' + source + ' --> ' + dest + ' = ' + transactionType);\n return;\n }\n }\n //console.log('Found no type for ' + source + ' --> ' + dest);\n if ('Asset account' !== source) {\n //console.log('Drop ID from destination.');\n this.updateField({index: 0, field: 'destination_account_id', value: null});\n //console.log('calculateTransactionType: drop ID from destination.');\n // source.id =null\n // context.commit('updateField', {field: 'source_account',index: })\n // context.state.transactions[0].source_account.id = null;\n }\n if ('Asset account' !== dest) {\n //console.log('Drop ID from source.');\n this.updateField({index: 0, field: 'source_account_id', value: null});\n //console.log('calculateTransactionType: drop ID from source.');\n //context.state.transactions[0].destination_account.id = null;\n }\n //console.log('calculateTransactionType: fallback, type to any.');\n this.setTransactionType('any');\n //this.$store.commit('setTransactionType', 'any');\n }\n },\n /**\n * Submit transaction links.\n */\n submitTransactionLinks(data, response) {\n //console.log('submitTransactionLinks()');\n let promises = [];\n let result = response.data.data.attributes.transactions;\n let total = 0;\n for (let i in data.transactions) {\n if (data.transactions.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n let submitted = data.transactions[i];\n if (result.hasOwnProperty(i)) {\n // found matching created transaction.\n let received = result[i];\n // grab ID from received, loop \"submitted\" transaction links\n for (let ii in submitted.links) {\n if (submitted.links.hasOwnProperty(ii) && /^0$|^[1-9]\\d*$/.test(ii) && ii <= 4294967294) {\n let currentLink = submitted.links[ii];\n total++;\n if (0 === currentLink.outward_id) {\n currentLink.outward_id = received.transaction_journal_id;\n }\n if (0 === currentLink.inward_id) {\n currentLink.inward_id = received.transaction_journal_id;\n }\n // submit transaction link:\n promises.push(axios.post('./api/v1/transaction_links', currentLink).then(response => {\n // TODO error handling.\n }));\n }\n }\n }\n }\n }\n if (0 === total) {\n this.submittedLinks = true;\n return;\n }\n Promise.all(promises).then(function () {\n this.submittedLinks = true;\n });\n },\n\n parseErrors: function (errors) {\n for (let i in this.transactions) {\n this.resetErrors({index: i});\n }\n this.successMessage = '';\n this.errorMessage = this.$t('firefly.errors_submission');\n if (typeof errors.errors === 'undefined') {\n this.successMessage = '';\n this.errorMessage = errors.message;\n }\n\n let payload;\n //payload = {index: 0, field: 'description', errors: ['Test error index 0']};\n //this.setTransactionError(payload);\n\n //payload = {index: 1, field: 'description', errors: ['Test error index 1']};\n //this.setTransactionError(payload);\n\n let transactionIndex;\n let fieldName;\n\n // fairly basic way of exploding the error array.\n for (const key in errors.errors) {\n // console.log('Error index: \"' + key + '\"');\n if (errors.errors.hasOwnProperty(key)) {\n if (key === 'group_title') {\n this.groupTitleErrors = errors.errors[key];\n continue;\n }\n if (key !== 'group_title') {\n // lol dumbest way to explode \"transactions.0.something\" ever.\n transactionIndex = parseInt(key.split('.')[1]);\n\n fieldName = key.split('.')[2];\n\n // set error in this object thing.\n // console.log('The errors in key \"' + key + '\" are');\n // console.log(errors.errors[key]);\n switch (fieldName) {\n case 'amount':\n case 'description':\n case 'date':\n case 'tags':\n payload = {index: transactionIndex, field: fieldName, errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'budget_id':\n payload = {index: transactionIndex, field: 'budget', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'bill_id':\n payload = {index: transactionIndex, field: 'bill', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'piggy_bank_id':\n payload = {index: transactionIndex, field: 'piggy_bank', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'category_name':\n payload = {index: transactionIndex, field: 'category', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'source_name':\n case 'source_id':\n payload = {index: transactionIndex, field: 'source', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'destination_name':\n case 'destination_id':\n payload = {index: transactionIndex, field: 'destination', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'foreign_amount':\n case 'foreign_currency':\n payload = {index: transactionIndex, field: 'foreign_amount', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n }\n }\n // unique some things\n if (typeof this.transactions[transactionIndex] !== 'undefined') {\n //this.transactions[transactionIndex].errors.source = Array.from(new Set(this.transactions[transactionIndex].errors.source));\n //this.transactions[transactionIndex].errors.destination = Array.from(new Set(this.transactions[transactionIndex].errors.destination));\n }\n\n }\n }\n },\n\n /**\n *\n */\n convertData: function () {\n //console.log('now in convertData');\n let data = {\n 'transactions': []\n };\n //console.log('Group title is: \"' + this.groupTitle + '\"');\n if (this.groupTitle.length > 0) {\n data.group_title = this.groupTitle;\n }\n\n for (let i in this.transactions) {\n if (this.transactions.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n data.transactions.push(this.convertSplit(i, this.transactions[i]));\n }\n }\n if (data.transactions.length > 1 && '' !== data.transactions[0].description) {\n data.group_title = data.transactions[0].description;\n }\n\n // depending on the transaction type for this thing, we need to\n // make sure other splits match the data we submit.\n if (data.transactions.length > 1) {\n // console.log('This is a split!');\n data = this.synchronizeAccounts(data);\n }\n\n return data;\n },\n synchronizeAccounts: function (data) {\n // console.log('synchronizeAccounts: ' + this.transactionType);\n // make sure all splits have whatever is in split 0.\n // since its a transfer we can drop the name and use ID's only.\n for (let i in data.transactions) {\n if (data.transactions.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n // console.log('now at ' + i);\n\n // for transfers, overrule both the source and the destination:\n if ('Transfer' === this.transactionType) {\n data.transactions[i].source_name = null;\n data.transactions[i].destination_name = null;\n if (i > 0) {\n data.transactions[i].source_id = data.transactions[0].source_id;\n data.transactions[i].destination_id = data.transactions[0].destination_id;\n }\n }\n // for deposits, overrule the destination and ignore the rest.\n if ('Deposit' === this.transactionType) {\n data.transactions[i].destination_name = null;\n if (i > 0) {\n data.transactions[i].destination_id = data.transactions[0].destination_id;\n }\n }\n\n // for withdrawals, overrule the source and ignore the rest.\n if ('Withdrawal' === this.transactionType) {\n data.transactions[i].source_name = null;\n if (i > 0) {\n data.transactions[i].source_id = data.transactions[0].source_id;\n }\n }\n }\n }\n return data;\n\n },\n\n switchAccounts: function (index) {\n // console.log('user wants to switch Accounts');\n let origSourceId = this.transactions[index].source_account_id;\n let origSourceName = this.transactions[index].source_account_name;\n let origSourceType = this.transactions[index].source_account_type;\n\n let origDestId = this.transactions[index].destination_account_id;\n let origDestName = this.transactions[index].destination_account_name;\n let origDestType = this.transactions[index].destination_account_type;\n\n this.updateField({index: 0, field: 'source_account_id', value: origDestId});\n this.updateField({index: 0, field: 'source_account_name', value: origDestName});\n this.updateField({index: 0, field: 'source_account_type', value: origDestType});\n\n this.updateField({index: 0, field: 'destination_account_id', value: origSourceId});\n this.updateField({index: 0, field: 'destination_account_name', value: origSourceName});\n this.updateField({index: 0, field: 'destination_account_type', value: origSourceType});\n this.calculateTransactionType(0);\n },\n\n\n /**\n *\n * @param key\n * @param array\n */\n convertSplit: function (key, array) {\n let dateStr = 'invalid';\n if (\n this.time instanceof Date && !isNaN(this.time) &&\n this.date instanceof Date && !isNaN(this.date)\n ) {\n let theDate = new Date(this.date);\n // update time in date object.\n theDate.setHours(this.time.getHours());\n theDate.setMinutes(this.time.getMinutes());\n theDate.setSeconds(this.time.getSeconds());\n dateStr = toW3CString(theDate);\n }\n\n // console.log('dateStr = ' + dateStr);\n\n let currentSplit = {\n // basic\n description: array.description,\n date: dateStr,\n type: this.transactionType,\n\n // account\n source_id: array.source_account_id ?? null,\n source_name: array.source_account_name ?? null,\n destination_id: array.destination_account_id ?? null,\n destination_name: array.destination_account_name ?? null,\n\n // amount:\n currency_id: array.currency_id,\n amount: array.amount,\n\n // meta data\n budget_id: array.budget_id,\n category_name: array.category,\n tags: array.tags,\n\n // optional date fields (6x):\n interest_date: array.interest_date,\n book_date: array.book_date,\n process_date: array.process_date,\n due_date: array.due_date,\n payment_date: array.payment_date,\n invoice_date: array.invoice_date,\n\n // other optional fields:\n internal_reference: array.internal_reference,\n external_url: array.external_url,\n notes: array.notes,\n external_id: array.external_id,\n\n // location:\n zoom_level: array.zoom_level,\n longitude: array.longitude,\n latitude: array.latitude,\n\n // from thing:\n order: 0,\n reconciled: false,\n };\n // bills and piggy banks\n if (0 !== array.piggy_bank_id) {\n currentSplit.piggy_bank_id = array.piggy_bank_id;\n }\n if (0 !== array.bill_id) {\n currentSplit.bill_id = array.bill_id;\n }\n\n // foreign amount:\n if (0 !== array.foreign_currency_id && '' !== array.foreign_amount) {\n currentSplit.foreign_currency_id = array.foreign_currency_id;\n }\n if ('' !== array.foreign_amount) {\n currentSplit.foreign_amount = array.foreign_amount;\n }\n\n // do transaction type\n let transactionType;\n let firstSource;\n let firstDestination;\n\n // get transaction type from first transaction\n transactionType = this.transactionType ? this.transactionType.toLowerCase() : 'any';\n //console.log('Transaction type is now ' + transactionType);\n // if the transaction type is invalid, might just be that we can deduce it from\n // the presence of a source or destination account\n firstSource = this.transactions[0].source_account_type;\n firstDestination = this.transactions[0].destination_account_type;\n //console.log(this.transactions[0].source_account);\n //console.log(this.transactions[0].destination_account);\n //console.log('Type of first source is ' + firstSource);\n //console.log('Type of first destination is ' + firstDestination);\n\n // default to source:\n currentSplit.currency_id = array.source_account_currency_id;\n if ('any' === transactionType && ['asset', 'Asset account', 'Loan', 'Debt', 'Mortgage'].includes(firstSource)) {\n transactionType = 'withdrawal';\n }\n\n if ('any' === transactionType && ['asset', 'Asset account', 'Loan', 'Debt', 'Mortgage'].includes(firstDestination)) {\n transactionType = 'deposit';\n currentSplit.currency_id = array.destination_account_currency_id;\n }\n currentSplit.type = transactionType;\n //console.log('Final type is ' + transactionType);\n\n let links = [];\n for (let i in array.links) {\n if (array.links.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n let current = array.links[i];\n let linkTypeParts = current.link_type_id.split('-');\n let inwardId = 'outward' === linkTypeParts[1] ? 0 : parseInt(current.transaction_journal_id);\n let outwardId = 'inward' === linkTypeParts[1] ? 0 : parseInt(current.transaction_journal_id);\n let newLink = {\n link_type_id: parseInt(linkTypeParts[0]),\n inward_id: inwardId,\n outward_id: outwardId,\n };\n links.push(newLink);\n }\n }\n currentSplit.links = links;\n\n // return it.\n return currentSplit;\n },\n /**\n * Get API value.\n */\n getAllowedOpposingTypes: function () {\n axios.get('./api/v1/configuration/firefly.allowed_opposing_types')\n .then(response => {\n this.allowedOpposingTypes = response.data.data.value;\n });\n },\n /**\n * Get API value.\n */\n getAccountToTransaction: function () {\n axios.get('./api/v1/configuration/firefly.account_to_transaction')\n .then(response => {\n this.accountToTransaction = response.data.data.value;\n });\n },\n /**\n * This method grabs the users preferred custom transaction fields. It's used when configuring the\n * custom date selects that will be available. It could be something the component does by itself,\n * thereby separating concerns. This is on my list. If it changes to a per-component thing, then\n * it should be done via the create.js Vue store because multiple components are interested in the\n * user's custom transaction fields.\n */\n getCustomFields: function () {\n axios.get('./api/v1/preferences/transaction_journal_optional_fields').then(response => {\n this.customFields = response.data.data.attributes.data;\n });\n },\n setDestinationAllowedTypes: function (value) {\n // console.log('Create::setDestinationAllowedTypes');\n // console.log(value);\n if (0 === value.length) {\n this.destinationAllowedTypes = this.defaultDestinationAllowedTypes;\n //console.log('empty so back to defaults');\n return;\n }\n this.destinationAllowedTypes = value;\n },\n setSourceAllowedTypes(value) {\n // console.log('Create::setSourceAllowedTypes');\n // console.log(value);\n if (0 === value.length) {\n this.sourceAllowedTypes = this.defaultSourceAllowedTypes;\n // console.log('empty so back to defaults');\n return;\n }\n this.sourceAllowedTypes = value;\n }\n },\n\n}\n</script>\n\n<style scoped>\n\n</style>","import mod from \"-!../../../node_modules/babel-loader/lib/index.js??ref--4-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Create.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../node_modules/babel-loader/lib/index.js??ref--4-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Create.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./Create.vue?vue&type=template&id=1b78c213&scoped=true&\"\nimport script from \"./Create.vue?vue&type=script&lang=js&\"\nexport * from \"./Create.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"1b78c213\",\n null\n \n)\n\nexport default component.exports","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('alert',{attrs:{\"message\":_vm.errorMessage,\"type\":\"danger\"}}),_vm._v(\" \"),_c('alert',{attrs:{\"message\":_vm.successMessage,\"type\":\"success\"}}),_vm._v(\" \"),_c('SplitPills',{attrs:{\"transactions\":_vm.transactions}}),_vm._v(\" \"),_c('div',{staticClass:\"tab-content\"},_vm._l((this.transactions),function(transaction,index){return _c('SplitForm',{key:index,attrs:{\"allowed-opposing-types\":_vm.allowedOpposingTypes,\"count\":_vm.transactions.length,\"custom-fields\":_vm.customFields,\"date\":_vm.date,\"destination-allowed-types\":_vm.destinationAllowedTypes,\"index\":index,\"source-allowed-types\":_vm.sourceAllowedTypes,\"submitted-transaction\":_vm.submittedTransaction,\"time\":_vm.time,\"transaction\":transaction,\"transaction-type\":_vm.transactionType},on:{\"uploaded-attachments\":function($event){return _vm.uploadedAttachment($event)},\"set-marker-location\":function($event){return _vm.storeLocation($event)},\"set-account\":function($event){return _vm.storeAccountValue($event)},\"switch-accounts\":function($event){return _vm.switchAccounts($event)},\"set-date\":function($event){return _vm.storeDate($event)},\"set-time\":function($event){return _vm.storeTime($event)},\"set-field\":function($event){return _vm.storeField($event)},\"remove-transaction\":function($event){return _vm.removeTransaction($event)},\"set-dest-types\":function($event){return _vm.setDestinationAllowedTypes($event)},\"set-src-types\":function($event){return _vm.setSourceAllowedTypes($event)}}})}),1),_vm._v(\" \"),_c('div',{staticClass:\"row\"},[_c('div',{staticClass:\"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12\"},[(_vm.transactions.length > 1)?_c('div',{staticClass:\"card\"},[_c('div',{staticClass:\"card-body\"},[_c('div',{staticClass:\"row\"},[_c('div',{staticClass:\"col\"},[_c('TransactionGroupTitle',{attrs:{\"errors\":this.groupTitleErrors},on:{\"set-group-title\":function($event){return _vm.storeGroupTitle($event)}},model:{value:(this.groupTitle),callback:function ($$v) {_vm.$set(this, \"groupTitle\", $$v)},expression:\"this.groupTitle\"}})],1)])])]):_vm._e()]),_vm._v(\" \"),_c('div',{staticClass:\"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12\"},[_c('div',{staticClass:\"card card-primary\"},[_c('div',{staticClass:\"card-body\"},[_c('div',{staticClass:\"row\"},[_c('div',{staticClass:\"col\"},[_c('div',{staticClass:\"text-xs d-none d-lg-block d-xl-block\"},[_vm._v(\"\\n  \\n \")]),_vm._v(\" \"),_c('button',{staticClass:\"btn btn-outline-primary btn-block\",on:{\"click\":_vm.addTransaction}},[_c('i',{staticClass:\"far fa-clone\"}),_vm._v(\" \"+_vm._s(_vm.$t('firefly.add_another_split'))+\"\\n \")])]),_vm._v(\" \"),_c('div',{staticClass:\"col\"},[_c('div',{staticClass:\"text-xs d-none d-lg-block d-xl-block\"},[_vm._v(\"\\n  \\n \")]),_vm._v(\" \"),_c('button',{staticClass:\"btn btn-success btn-block\",attrs:{\"disabled\":!_vm.enableSubmit},on:{\"click\":_vm.submitTransaction}},[(_vm.enableSubmit)?_c('span',[_c('i',{staticClass:\"far fa-save\"}),_vm._v(\" \"+_vm._s(_vm.$t('firefly.store_transaction')))]):_vm._e(),_vm._v(\" \"),(!_vm.enableSubmit)?_c('span',[_c('i',{staticClass:\"fas fa-spinner fa-spin\"})]):_vm._e()])])]),_vm._v(\" \"),_c('div',{staticClass:\"row\"},[_c('div',{staticClass:\"col\"},[_vm._v(\"\\n  \\n \")]),_vm._v(\" \"),_c('div',{staticClass:\"col\"},[_c('div',{staticClass:\"form-check\"},[_c('input',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.createAnother),expression:\"createAnother\"}],staticClass:\"form-check-input\",attrs:{\"id\":\"createAnother\",\"type\":\"checkbox\"},domProps:{\"checked\":Array.isArray(_vm.createAnother)?_vm._i(_vm.createAnother,null)>-1:(_vm.createAnother)},on:{\"change\":function($event){var $$a=_vm.createAnother,$$el=$event.target,$$c=$$el.checked?(true):(false);if(Array.isArray($$a)){var $$v=null,$$i=_vm._i($$a,$$v);if($$el.checked){$$i<0&&(_vm.createAnother=$$a.concat([$$v]))}else{$$i>-1&&(_vm.createAnother=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}}else{_vm.createAnother=$$c}}}}),_vm._v(\" \"),_c('label',{staticClass:\"form-check-label\",attrs:{\"for\":\"createAnother\"}},[_c('span',{staticClass:\"small\"},[_vm._v(_vm._s(_vm.$t('firefly.create_another')))])])]),_vm._v(\" \"),_c('div',{staticClass:\"form-check\"},[_c('input',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.resetFormAfter),expression:\"resetFormAfter\"}],staticClass:\"form-check-input\",attrs:{\"id\":\"resetFormAfter\",\"disabled\":!_vm.createAnother,\"type\":\"checkbox\"},domProps:{\"checked\":Array.isArray(_vm.resetFormAfter)?_vm._i(_vm.resetFormAfter,null)>-1:(_vm.resetFormAfter)},on:{\"change\":function($event){var $$a=_vm.resetFormAfter,$$el=$event.target,$$c=$$el.checked?(true):(false);if(Array.isArray($$a)){var $$v=null,$$i=_vm._i($$a,$$v);if($$el.checked){$$i<0&&(_vm.resetFormAfter=$$a.concat([$$v]))}else{$$i>-1&&(_vm.resetFormAfter=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}}else{_vm.resetFormAfter=$$c}}}}),_vm._v(\" \"),_c('label',{staticClass:\"form-check-label\",attrs:{\"for\":\"resetFormAfter\"}},[_c('span',{staticClass:\"small\"},[_vm._v(_vm._s(_vm.$t('firefly.reset_after')))])])])])])])])])])],1)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","/*\n * create.js\n * Copyright (c) 2020 [email protected]\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 <https://www.gnu.org/licenses/>.\n */\n\nimport store from \"../../components/store\";\nimport Create from \"../../components/transactions/Create\";\nimport Vue from \"vue\";\n\nrequire('../../bootstrap');\n\nVue.config.productionTip = false;\n// i18n\nlet i18n = require('../../i18n');\n\nlet props = {};\nnew Vue({\n i18n,\n store,\n render(createElement) {\n return createElement(Create, {props: props});\n },\n beforeCreate() {\n this.$store.commit('initialiseStore');\n this.$store.dispatch('updateCurrencyPreference');\n },\n }).$mount('#transactions_create');\n"],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"sources":["webpack:///src/components/transactions/Create.vue","webpack:///./src/components/transactions/Create.vue?0a62","webpack:///./src/components/transactions/Create.vue","webpack:///./src/components/transactions/Create.vue?a852","webpack:///./src/pages/transactions/create.js"],"names":["name","components","SplitForm","Alert","SplitPills","TransactionGroupTitle","created","this","getAllowedOpposingTypes","getAccountToTransaction","getCustomFields","addTransaction","data","errorMessage","successMessage","customFields","enableSubmit","createAnother","resetFormAfter","submittedTransaction","submittedLinks","submittedAttachments","inError","submittedAttCount","groupTitleErrors","returnedGroupId","returnedGroupTitle","accountToTransaction","allowedOpposingTypes","defaultSourceAllowedTypes","defaultDestinationAllowedTypes","sourceAllowedTypes","destinationAllowedTypes","date","Date","time","computed","watch","finalizeSubmit","methods","removeTransaction","$store","commit","payload","window","location","href","$t","transactions","hasOwnProperty","i","test","updateField","resetTransactions","setTimeout","submitTransaction","axios","post","submitAttachments","result","uploadedAttachment","key","length","storeLocation","storeAccountValue","calculateTransactionType","index","storeField","storeDate","storeTime","storeGroupTitle","setGroupTitle","source","dest","setTransactionType","expectedDestinationTypes","transactionType","submitTransactionLinks","submitted","links","ii","total","currentLink","outward_id","received","transaction_journal_id","inward_id","promises","push","then","Promise","all","parseErrors","resetErrors","errors","message","transactionIndex","parseInt","split","fieldName","setTransactionError","convertData","groupTitle","group_title","convertSplit","description","synchronizeAccounts","source_name","destination_name","source_id","destination_id","switchAccounts","theDate","setHours","getHours","setMinutes","getMinutes","setSeconds","getSeconds","dateStr","array","type","currency_id","amount","budget_id","category_name","category","interest_date","book_date","process_date","due_date","payment_date","invoice_date","internal_reference","external_url","notes","external_id","zoom_level","longitude","latitude","tags","order","reconciled","currentSplit","current","text","piggy_bank_id","bill_id","foreign_currency_id","foreign_amount","toLowerCase","firstSource","source_account_type","firstDestination","destination_account_type","source_account_currency_id","includes","destination_account_currency_id","link_type_id","linkTypeParts","inwardId","outwardId","newLink","get","setDestinationAllowedTypes","value","setSourceAllowedTypes","_vm","_h","$createElement","_c","_self","attrs","_v","staticClass","_l","transaction","on","$event","model","callback","$$v","$set","expression","_e","_s","directives","rawName","domProps","Array","isArray","_i","$$a","$$el","target","$$c","checked","$$i","concat","slice","require","Vue","config","productionTip","i18n","props","store","render","createElement","Create","beforeCreate","dispatch","$mount"],"mappings":"qmCA2HA,sC,EAAA,S,EAAA,e,EAAA,W,EAAA,cC3HsM,ED6HtM,CACEA,KAAM,SACNC,WAAY,CACVC,UAAJ,IACIC,MAAJ,IACIC,WAAJ,IACIC,sBAAJ,KAKEC,QAXF,WAYIC,KAAKC,0BACLD,KAAKE,0BACLF,KAAKG,kBACLH,KAAKI,kBAEPC,KAjBF,WAkBI,MAAO,CAELC,aAAc,GACdC,eAAgB,GAGhBC,aAAc,GAGdC,cAAc,EACdC,eAAe,EACfC,gBAAgB,EAGhBC,sBAAsB,EACtBC,gBAAgB,EAChBC,sBAAsB,EAGtBC,SAAS,EAKTC,kBAAmB,GAGnBC,iBAAkB,GAGlBC,gBAAiB,EACjBC,mBAAoB,GAGpBC,qBAAs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,mBAAmBF,MAAM,CAAC,GAAK,iBAAiB,UAAYL,EAAItJ,cAAc,KAAO,YAAY2K,SAAS,CAAC,QAAUC,MAAMC,QAAQvB,EAAIrJ,gBAAgBqJ,EAAIwB,GAAGxB,EAAIrJ,eAAe,OAAO,EAAGqJ,EAAkB,gBAAGU,GAAG,CAAC,OAAS,SAASC,GAAQ,IAAIc,EAAIzB,EAAIrJ,eAAe+K,EAAKf,EAAOgB,OAAOC,IAAIF,EAAKG,QAAuB,GAAGP,MAAMC,QAAQE,GAAK,CAAC,IAAaK,EAAI9B,EAAIwB,GAAGC,EAAhB,MAA4BC,EAAKG,QAASC,EAAI,IAAI9B,EAAIrJ,eAAe8K,EAAIM,OAAO,CAAhF,QAA6FD,GAAK,IAAI9B,EAAIrJ,eAAe8K,EAAIO,MAAM,EAAEF,GAAKC,OAAON,EAAIO,MAAMF,EAAI,UAAW9B,EAAIrJ,eAAeiL,MAAS5B,EAAIM,GAAG,KAAKH,EAAG,QAAQ,CAACI,YAAY,mBAAmBF,MAAM,CAAC,IAAM,mBAAmB,CAACF,EAAG,OAAO,CAACI,YAAY,SAAS,CAACP,EAAIM,GAAGN,EAAIkB,GAAGlB,EAAIxH,GAAG,4CAA4C,KACl+J,IDUpB,EACA,KACA,WACA,M,wBEUFyJ,EAAQ,IAERC,IAAIC,OAAOC,eAAgB,EAE3B,IAAIC,EAAOJ,EAAQ,IAEfK,EAAQ,GACZ,IAAIJ,IAAI,CACIG,OACAE,UACAC,OAHJ,SAGWC,GACH,OAAOA,EAAcC,EAAQ,CAACJ,MAAOA,KAEzCK,aANJ,WAOQ3M,KAAKkC,OAAOC,OAAO,mBACnBnC,KAAKkC,OAAO0K,SAAS,+BAE1BC,OAAO,0B","file":"/public/js/transactions/create.js","sourcesContent":["<!--\n - Create.vue\n - Copyright (c) 2020 [email protected]\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 <https://www.gnu.org/licenses/>.\n -->\n\n<template>\n <div>\n <alert :message=\"errorMessage\" type=\"danger\"/>\n <alert :message=\"successMessage\" type=\"success\"/>\n <SplitPills :transactions=\"transactions\"/>\n <div class=\"tab-content\">\n <SplitForm\n v-for=\"(transaction, index) in this.transactions\"\n v-bind:key=\"index\"\n :allowed-opposing-types=\"allowedOpposingTypes\"\n :count=\"transactions.length\"\n :custom-fields=\"customFields\"\n :date=\"date\"\n :destination-allowed-types=\"destinationAllowedTypes\"\n :index=\"index\"\n :source-allowed-types=\"sourceAllowedTypes\"\n :submitted-transaction=\"submittedTransaction\"\n :time=\"time\"\n :transaction=\"transaction\"\n :transaction-type=\"transactionType\"\n v-on:uploaded-attachments=\"uploadedAttachment($event)\"\n v-on:set-marker-location=\"storeLocation($event)\"\n v-on:set-account=\"storeAccountValue($event)\"\n v-on:switch-accounts=\"switchAccounts($event)\"\n v-on:set-date=\"storeDate($event)\"\n v-on:set-time=\"storeTime($event)\"\n v-on:set-field=\"storeField($event)\"\n v-on:remove-transaction=\"removeTransaction($event)\"\n v-on:set-dest-types=\"setDestinationAllowedTypes($event)\"\n v-on:set-src-types=\"setSourceAllowedTypes($event)\"\n\n />\n </div>\n\n <div class=\"row\">\n <!-- group title -->\n <div class=\"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12\">\n <div v-if=\"transactions.length > 1\" class=\"card\">\n <div class=\"card-body\">\n <div class=\"row\">\n <div class=\"col\">\n <TransactionGroupTitle v-model=\"this.groupTitle\" :errors=\"this.groupTitleErrors\" v-on:set-group-title=\"storeGroupTitle($event)\"/>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12\">\n <!-- buttons -->\n <div class=\"card card-primary\">\n <div class=\"card-body\">\n <div class=\"row\">\n <div class=\"col\">\n <div class=\"text-xs d-none d-lg-block d-xl-block\">\n &nbsp;\n </div>\n <button class=\"btn btn-outline-primary btn-block\" @click=\"addTransaction\"><i class=\"far fa-clone\"></i> {{ $t('firefly.add_another_split') }}\n </button>\n </div>\n <div class=\"col\">\n <div class=\"text-xs d-none d-lg-block d-xl-block\">\n &nbsp;\n </div>\n <button :disabled=\"!enableSubmit\" class=\"btn btn-success btn-block\" @click=\"submitTransaction\">\n <span v-if=\"enableSubmit\"><i class=\"far fa-save\"></i> {{ $t('firefly.store_transaction') }}</span>\n <span v-if=\"!enableSubmit\"><i class=\"fas fa-spinner fa-spin\"></i></span>\n </button>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col\">\n &nbsp;\n </div>\n <div class=\"col\">\n <div class=\"form-check\">\n <input id=\"createAnother\" v-model=\"createAnother\" class=\"form-check-input\" type=\"checkbox\">\n <label class=\"form-check-label\" for=\"createAnother\">\n <span class=\"small\">{{ $t('firefly.create_another') }}</span>\n </label>\n </div>\n <div class=\"form-check\">\n <input id=\"resetFormAfter\" v-model=\"resetFormAfter\" :disabled=\"!createAnother\" class=\"form-check-input\" type=\"checkbox\">\n <label class=\"form-check-label\" for=\"resetFormAfter\">\n <span class=\"small\">{{ $t('firefly.reset_after') }}</span>\n </label>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<script>\nimport {createNamespacedHelpers} from 'vuex'\nimport Alert from '../partials/Alert';\nimport SplitPills from \"./SplitPills\";\nimport TransactionGroupTitle from \"./TransactionGroupTitle\";\nimport SplitForm from \"./SplitForm\";\nimport {toW3CString} from '../shared/transactions';\n\nconst {mapState, mapGetters, mapActions, mapMutations} = createNamespacedHelpers('transactions/create')\n\nexport default {\n name: \"Create\",\n components: {\n SplitForm,\n Alert,\n SplitPills,\n TransactionGroupTitle,\n },\n /**\n * Grab some stuff from the API, add the first transaction.\n */\n created() {\n this.getAllowedOpposingTypes();\n this.getAccountToTransaction();\n this.getCustomFields();\n this.addTransaction();\n },\n data() {\n return {\n // error or success message\n errorMessage: '',\n successMessage: '',\n\n // custom fields to show, useful for components:\n customFields: {},\n\n // states for the form (makes sense right)\n enableSubmit: true,\n createAnother: false,\n resetFormAfter: false,\n\n // things the process is done working on (3 phases):\n submittedTransaction: false,\n submittedLinks: false,\n submittedAttachments: false,\n\n // transaction was actually submitted?\n inError: false,\n\n // number of uploaded attachments\n // its an object because we count per transaction journal (which can have multiple attachments)\n // and array doesn't work right.\n submittedAttCount: {},\n\n // errors in the group title:\n groupTitleErrors: [],\n\n // group ID + title once submitted:\n returnedGroupId: 0,\n returnedGroupTitle: '',\n\n // meta data for accounts\n accountToTransaction: {},\n allowedOpposingTypes: {},\n defaultSourceAllowedTypes: ['Asset account', 'Loan', 'Debt', 'Mortgage', 'Revenue account'],\n defaultDestinationAllowedTypes: ['Asset account', 'Loan', 'Debt', 'Mortgage', 'Expense account'],\n sourceAllowedTypes: ['Asset account', 'Loan', 'Debt', 'Mortgage', 'Revenue account'],\n destinationAllowedTypes: ['Asset account', 'Loan', 'Debt', 'Mortgage', 'Expense account'],\n\n // date and time not in the store because it was buggy\n date: new Date,\n time: new Date,\n }\n },\n computed: {\n /**\n * Grabbed from the store.\n */\n ...mapGetters([\n 'transactionType',\n 'transactions',\n 'groupTitle'\n ])\n },\n watch: {\n submittedTransaction: function () {\n // see finalizeSubmit()\n this.finalizeSubmit();\n },\n submittedLinks: function () {\n // see finalizeSubmit()\n this.finalizeSubmit();\n },\n submittedAttachments: function () {\n // see finalizeSubmit()\n this.finalizeSubmit();\n }\n },\n methods: {\n /**\n * Store related mutators used by this component.\n */\n ...mapMutations(\n [\n 'setGroupTitle',\n 'addTransaction',\n 'deleteTransaction',\n 'setTransactionError',\n 'setTransactionType',\n 'resetErrors',\n 'updateField',\n 'resetTransactions',\n ],\n ),\n /**\n * Removes a split from the array.\n */\n removeTransaction: function (payload) {\n // console.log('Triggered to remove transaction ' + payload.index);\n this.$store.commit('transactions/create/deleteTransaction', payload);\n },\n /**\n * Submitting a transaction consists of 3 steps: submitting the transaction, uploading attachments\n * and creating links. Only once all three steps are executed may the message be shown or the user be\n * forwarded.\n */\n finalizeSubmit() {\n // console.log('finalizeSubmit (' + this.submittedTransaction + ', ' + this.submittedAttachments + ', ' + this.submittedLinks + ')');\n if (this.submittedTransaction && this.submittedAttachments && this.submittedLinks) {\n // console.log('all true');\n // console.log('createAnother = ' + this.createAnother);\n // console.log('inError = ' + this.inError);\n if (false === this.createAnother && false === this.inError) {\n // console.log('redirect');\n window.location.href = (window.previousURL ?? '/') + '?transaction_group_id=' + this.returnedGroupId + '&message=created';\n return;\n }\n\n if (false === this.inError) {\n // show message:\n this.errorMessage = '';\n this.successMessage = this.$t('firefly.transaction_stored_link', {ID: this.returnedGroupId, title: this.returnedGroupTitle});\n }\n\n // enable flags:\n this.enableSubmit = true;\n this.submittedTransaction = false;\n this.submittedLinks = false;\n this.submittedAttachments = false;\n this.inError = false;\n\n\n // reset attachments (always do this)\n for (let i in this.transactions) {\n if (this.transactions.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n if (this.transactions.hasOwnProperty(i)) {\n // console.log('Reset attachment #' + i);\n this.updateField({index: i, field: 'transaction_journal_id', value: 0});\n }\n }\n }\n this.submittedAttCount = [];\n\n // reset the form:\n if (this.resetFormAfter) {\n this.resetTransactions();\n // do a short time out?\n setTimeout(() => this.addTransaction(), 50);\n }\n // console.log('Done with finalizeSubmit!');\n // return;\n }\n // console.log('Did nothing in finalizeSubmit');\n },\n /**\n * Actually submit the transaction to Firefly III. This is a fairly complex beast of a thing because multiple things\n * need to happen in the right order.\n */\n submitTransaction: function () {\n // console.log('submitTransaction()');\n // disable the submit button:\n this.enableSubmit = false;\n\n // convert the data so its ready to be submitted:\n const url = './api/v1/transactions';\n const data = this.convertData();\n\n // console.log('Will submit:');\n // console.log(data);\n\n // POST the transaction.\n axios.post(url, data)\n .then(response => {\n // console.log('Response is OK!');\n // report the transaction is submitted.\n this.submittedTransaction = true;\n\n // submit links and attachments (can only be done when the transaction is created)\n this.submitTransactionLinks(data, response);\n this.submitAttachments(data, response);\n\n // meanwhile, store the ID and the title in some easy to access variables.\n this.returnedGroupId = parseInt(response.data.data.id);\n this.returnedGroupTitle = null === response.data.data.attributes.group_title ? response.data.data.attributes.transactions[0].description : response.data.data.attributes.group_title;\n // console.log('Group title is now \"' + this.groupTitle + '\"');\n })\n .catch(error => {\n // oh noes Firefly III has something to bitch about.\n this.enableSubmit = true;\n // console.log('enable submit = true');\n // report the transaction is submitted.\n this.submittedTransaction = true;\n // also report attachments and links are submitted:\n this.submittedAttachments = true;\n this.submittedLinks = true;\n\n // but report an error because error:\n this.inError = true;\n this.parseErrors(error.response.data);\n });\n },\n\n /**\n * Submitting transactions means we will give each TransactionAttachment component\n * the ID of the transaction journal (so it works for multiple splits). Each component\n * will then start uploading their transactions (so its a separated concern) and report\n * back to the \"uploadedAttachment\" function below via an event emitter.\n *\n * The ID is set via the store.\n */\n submitAttachments: function (data, response) {\n // console.log('submitAttachments()');\n let result = response.data.data.attributes.transactions\n for (let i in data.transactions) {\n if (data.transactions.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n if (result.hasOwnProperty(i)) {\n // console.log('updateField(' + i + ', transaction_journal_id, ' + result[i].transaction_journal_id + ')');\n this.updateField({index: i, field: 'transaction_journal_id', value: result[i].transaction_journal_id});\n }\n }\n }\n },\n /**\n * When a attachment component is done uploading it ends up here. We create an object where we count how many\n * attachment components have reported back they're done uploading. Of course if they have nothing to upload\n * they will be pretty fast in reporting they're done.\n *\n * Once the number of components matches the number of splits we know all attachments have been uploaded.\n */\n uploadedAttachment: function (journalId) {\n // console.log('Triggered uploadedAttachment(' + journalId + ')');\n let key = 'str' + journalId;\n this.submittedAttCount[key] = 1;\n let count = Object.keys(this.submittedAttCount).length;\n // console.log('Count is now ' + count);\n // console.log('Length is ' + this.transactions.length);\n if (count === this.transactions.length) {\n // mark the attachments as stored:\n this.submittedAttachments = true;\n // console.log('Got them all!');\n }\n },\n /**\n * Responds to changed location.\n */\n storeLocation: function (payload) {\n let zoomLevel = payload.hasMarker ? payload.zoomLevel : null;\n let lat = payload.hasMarker ? payload.lat : null;\n let lng = payload.hasMarker ? payload.lng : null;\n this.updateField({index: payload.index, field: 'zoom_level', value: zoomLevel});\n this.updateField({index: payload.index, field: 'latitude', value: lat});\n this.updateField({index: payload.index, field: 'longitude', value: lng});\n },\n /**\n * Responds to changed account.\n */\n storeAccountValue: function (payload) {\n this.updateField({index: payload.index, field: payload.direction + '_account_id', value: payload.id});\n this.updateField({index: payload.index, field: payload.direction + '_account_type', value: payload.type});\n this.updateField({index: payload.index, field: payload.direction + '_account_name', value: payload.name});\n\n this.updateField({index: payload.index, field: payload.direction + '_account_currency_id', value: payload.currency_id});\n this.updateField({index: payload.index, field: payload.direction + '_account_currency_code', value: payload.currency_code});\n this.updateField({index: payload.index, field: payload.direction + '_account_currency_symbol', value: payload.currency_symbol});\n\n this.calculateTransactionType(payload.index);\n },\n storeField: function (payload) {\n this.updateField(payload);\n },\n storeDate: function (payload) {\n this.date = payload.date;\n },\n storeTime: function (payload) {\n this.time = payload.time;\n },\n storeGroupTitle: function (value) {\n // console.log('set group title: ' + value);\n this.setGroupTitle({groupTitle: value});\n },\n\n /**\n * Calculate the transaction type based on what's currently in the store.\n */\n calculateTransactionType: function (index) {\n //console.log('calculateTransactionType(' + index + ')');\n if (0 === index) {\n let source = this.transactions[0].source_account_type;\n let dest = this.transactions[0].destination_account_type;\n if (null === source || null === dest) {\n //console.log('transactionType any');\n this.setTransactionType('any');\n //this.$store.commit('setTransactionType', 'any');\n //console.log('calculateTransactionType: either type is NULL so no dice.');\n return;\n }\n if ('' === source || '' === dest) {\n //console.log('transactionType any');\n this.setTransactionType('any');\n //this.$store.commit('setTransactionType', 'any');\n //console.log('calculateTransactionType: either type is empty so no dice.');\n return;\n }\n // ok so type is set on both:\n let expectedDestinationTypes = this.accountToTransaction[source];\n if ('undefined' !== typeof expectedDestinationTypes) {\n let transactionType = expectedDestinationTypes[dest];\n if ('undefined' !== typeof expectedDestinationTypes[dest]) {\n //console.log('Found a type: ' + transactionType);\n this.setTransactionType(transactionType);\n //this.$store.commit('setTransactionType', transactionType);\n //console.log('calculateTransactionType: ' + source + ' --> ' + dest + ' = ' + transactionType);\n return;\n }\n }\n //console.log('Found no type for ' + source + ' --> ' + dest);\n if ('Asset account' !== source) {\n //console.log('Drop ID from destination.');\n this.updateField({index: 0, field: 'destination_account_id', value: null});\n //console.log('calculateTransactionType: drop ID from destination.');\n // source.id =null\n // context.commit('updateField', {field: 'source_account',index: })\n // context.state.transactions[0].source_account.id = null;\n }\n if ('Asset account' !== dest) {\n //console.log('Drop ID from source.');\n this.updateField({index: 0, field: 'source_account_id', value: null});\n //console.log('calculateTransactionType: drop ID from source.');\n //context.state.transactions[0].destination_account.id = null;\n }\n //console.log('calculateTransactionType: fallback, type to any.');\n this.setTransactionType('any');\n //this.$store.commit('setTransactionType', 'any');\n }\n },\n /**\n * Submit transaction links.\n */\n submitTransactionLinks(data, response) {\n //console.log('submitTransactionLinks()');\n let promises = [];\n let result = response.data.data.attributes.transactions;\n let total = 0;\n for (let i in data.transactions) {\n if (data.transactions.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n let submitted = data.transactions[i];\n if (result.hasOwnProperty(i)) {\n // found matching created transaction.\n let received = result[i];\n // grab ID from received, loop \"submitted\" transaction links\n for (let ii in submitted.links) {\n if (submitted.links.hasOwnProperty(ii) && /^0$|^[1-9]\\d*$/.test(ii) && ii <= 4294967294) {\n let currentLink = submitted.links[ii];\n total++;\n if (0 === currentLink.outward_id) {\n currentLink.outward_id = received.transaction_journal_id;\n }\n if (0 === currentLink.inward_id) {\n currentLink.inward_id = received.transaction_journal_id;\n }\n // submit transaction link:\n promises.push(axios.post('./api/v1/transaction_links', currentLink).then(response => {\n // TODO error handling.\n }));\n }\n }\n }\n }\n }\n if (0 === total) {\n this.submittedLinks = true;\n return;\n }\n Promise.all(promises).then(function () {\n this.submittedLinks = true;\n });\n },\n\n parseErrors: function (errors) {\n for (let i in this.transactions) {\n this.resetErrors({index: i});\n }\n this.successMessage = '';\n this.errorMessage = this.$t('firefly.errors_submission');\n if (typeof errors.errors === 'undefined') {\n this.successMessage = '';\n this.errorMessage = errors.message;\n }\n\n let payload;\n //payload = {index: 0, field: 'description', errors: ['Test error index 0']};\n //this.setTransactionError(payload);\n\n //payload = {index: 1, field: 'description', errors: ['Test error index 1']};\n //this.setTransactionError(payload);\n\n let transactionIndex;\n let fieldName;\n\n // fairly basic way of exploding the error array.\n for (const key in errors.errors) {\n // console.log('Error index: \"' + key + '\"');\n if (errors.errors.hasOwnProperty(key)) {\n if (key === 'group_title') {\n this.groupTitleErrors = errors.errors[key];\n continue;\n }\n if (key !== 'group_title') {\n // lol dumbest way to explode \"transactions.0.something\" ever.\n transactionIndex = parseInt(key.split('.')[1]);\n\n fieldName = key.split('.')[2];\n\n // set error in this object thing.\n // console.log('The errors in key \"' + key + '\" are');\n // console.log(errors.errors[key]);\n switch (fieldName) {\n case 'amount':\n case 'description':\n case 'date':\n case 'tags':\n payload = {index: transactionIndex, field: fieldName, errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'budget_id':\n payload = {index: transactionIndex, field: 'budget', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'bill_id':\n payload = {index: transactionIndex, field: 'bill', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'piggy_bank_id':\n payload = {index: transactionIndex, field: 'piggy_bank', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'category_name':\n payload = {index: transactionIndex, field: 'category', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'source_name':\n case 'source_id':\n payload = {index: transactionIndex, field: 'source', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'destination_name':\n case 'destination_id':\n payload = {index: transactionIndex, field: 'destination', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'foreign_amount':\n case 'foreign_currency':\n payload = {index: transactionIndex, field: 'foreign_amount', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n }\n }\n // unique some things\n if (typeof this.transactions[transactionIndex] !== 'undefined') {\n //this.transactions[transactionIndex].errors.source = Array.from(new Set(this.transactions[transactionIndex].errors.source));\n //this.transactions[transactionIndex].errors.destination = Array.from(new Set(this.transactions[transactionIndex].errors.destination));\n }\n\n }\n }\n },\n\n /**\n *\n */\n convertData: function () {\n //console.log('now in convertData');\n let data = {\n 'transactions': []\n };\n //console.log('Group title is: \"' + this.groupTitle + '\"');\n if (this.groupTitle.length > 0) {\n data.group_title = this.groupTitle;\n }\n\n for (let i in this.transactions) {\n if (this.transactions.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n data.transactions.push(this.convertSplit(i, this.transactions[i]));\n }\n }\n if (data.transactions.length > 1 && '' !== data.transactions[0].description) {\n data.group_title = data.transactions[0].description;\n }\n\n // depending on the transaction type for this thing, we need to\n // make sure other splits match the data we submit.\n if (data.transactions.length > 1) {\n // console.log('This is a split!');\n data = this.synchronizeAccounts(data);\n }\n\n return data;\n },\n synchronizeAccounts: function (data) {\n // console.log('synchronizeAccounts: ' + this.transactionType);\n // make sure all splits have whatever is in split 0.\n // since its a transfer we can drop the name and use ID's only.\n for (let i in data.transactions) {\n if (data.transactions.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n // console.log('now at ' + i);\n\n // for transfers, overrule both the source and the destination:\n if ('Transfer' === this.transactionType) {\n data.transactions[i].source_name = null;\n data.transactions[i].destination_name = null;\n if (i > 0) {\n data.transactions[i].source_id = data.transactions[0].source_id;\n data.transactions[i].destination_id = data.transactions[0].destination_id;\n }\n }\n // for deposits, overrule the destination and ignore the rest.\n if ('Deposit' === this.transactionType) {\n data.transactions[i].destination_name = null;\n if (i > 0) {\n data.transactions[i].destination_id = data.transactions[0].destination_id;\n }\n }\n\n // for withdrawals, overrule the source and ignore the rest.\n if ('Withdrawal' === this.transactionType) {\n data.transactions[i].source_name = null;\n if (i > 0) {\n data.transactions[i].source_id = data.transactions[0].source_id;\n }\n }\n }\n }\n return data;\n\n },\n\n switchAccounts: function (index) {\n // console.log('user wants to switch Accounts');\n let origSourceId = this.transactions[index].source_account_id;\n let origSourceName = this.transactions[index].source_account_name;\n let origSourceType = this.transactions[index].source_account_type;\n\n let origDestId = this.transactions[index].destination_account_id;\n let origDestName = this.transactions[index].destination_account_name;\n let origDestType = this.transactions[index].destination_account_type;\n\n this.updateField({index: 0, field: 'source_account_id', value: origDestId});\n this.updateField({index: 0, field: 'source_account_name', value: origDestName});\n this.updateField({index: 0, field: 'source_account_type', value: origDestType});\n\n this.updateField({index: 0, field: 'destination_account_id', value: origSourceId});\n this.updateField({index: 0, field: 'destination_account_name', value: origSourceName});\n this.updateField({index: 0, field: 'destination_account_type', value: origSourceType});\n this.calculateTransactionType(0);\n },\n\n\n /**\n *\n * @param key\n * @param array\n */\n convertSplit: function (key, array) {\n let dateStr = 'invalid';\n if (\n this.time instanceof Date && !isNaN(this.time) &&\n this.date instanceof Date && !isNaN(this.date)\n ) {\n let theDate = new Date(this.date);\n // update time in date object.\n theDate.setHours(this.time.getHours());\n theDate.setMinutes(this.time.getMinutes());\n theDate.setSeconds(this.time.getSeconds());\n dateStr = toW3CString(theDate);\n }\n\n // console.log('dateStr = ' + dateStr);\n\n let currentSplit = {\n // basic\n description: array.description,\n date: dateStr,\n type: this.transactionType,\n\n // account\n source_id: array.source_account_id ?? null,\n source_name: array.source_account_name ?? null,\n destination_id: array.destination_account_id ?? null,\n destination_name: array.destination_account_name ?? null,\n\n // amount:\n currency_id: array.currency_id,\n amount: array.amount,\n\n // meta data\n budget_id: array.budget_id,\n category_name: array.category,\n\n // optional date fields (6x):\n interest_date: array.interest_date,\n book_date: array.book_date,\n process_date: array.process_date,\n due_date: array.due_date,\n payment_date: array.payment_date,\n invoice_date: array.invoice_date,\n\n // other optional fields:\n internal_reference: array.internal_reference,\n external_url: array.external_url,\n notes: array.notes,\n external_id: array.external_id,\n\n // location:\n zoom_level: array.zoom_level,\n longitude: array.longitude,\n latitude: array.latitude,\n tags: [],\n\n // from thing:\n order: 0,\n reconciled: false,\n };\n\n if (0 !== array.tags.length) {\n for (let i in array.tags) {\n if (array.tags.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n // array.tags\n let current = array.tags[i];\n if(typeof current === 'object' && null !== current) {\n currentSplit.tags.push(current.text);\n }\n if(typeof current === 'string') {\n currentSplit.tags.push(current);\n }\n }\n }\n }\n\n // bills and piggy banks\n if (0 !== array.piggy_bank_id) {\n currentSplit.piggy_bank_id = array.piggy_bank_id;\n }\n if (0 !== array.bill_id) {\n currentSplit.bill_id = array.bill_id;\n }\n\n // foreign amount:\n if (0 !== array.foreign_currency_id && '' !== array.foreign_amount) {\n currentSplit.foreign_currency_id = array.foreign_currency_id;\n }\n if ('' !== array.foreign_amount) {\n currentSplit.foreign_amount = array.foreign_amount;\n }\n\n // do transaction type\n let transactionType;\n let firstSource;\n let firstDestination;\n\n // get transaction type from first transaction\n transactionType = this.transactionType ? this.transactionType.toLowerCase() : 'any';\n //console.log('Transaction type is now ' + transactionType);\n // if the transaction type is invalid, might just be that we can deduce it from\n // the presence of a source or destination account\n firstSource = this.transactions[0].source_account_type;\n firstDestination = this.transactions[0].destination_account_type;\n //console.log(this.transactions[0].source_account);\n //console.log(this.transactions[0].destination_account);\n //console.log('Type of first source is ' + firstSource);\n //console.log('Type of first destination is ' + firstDestination);\n\n // default to source:\n currentSplit.currency_id = array.source_account_currency_id;\n if ('any' === transactionType && ['asset', 'Asset account', 'Loan', 'Debt', 'Mortgage'].includes(firstSource)) {\n transactionType = 'withdrawal';\n }\n\n if ('any' === transactionType && ['asset', 'Asset account', 'Loan', 'Debt', 'Mortgage'].includes(firstDestination)) {\n transactionType = 'deposit';\n currentSplit.currency_id = array.destination_account_currency_id;\n }\n currentSplit.type = transactionType;\n //console.log('Final type is ' + transactionType);\n\n let links = [];\n for (let i in array.links) {\n if (array.links.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n let current = array.links[i];\n let linkTypeParts = current.link_type_id.split('-');\n let inwardId = 'outward' === linkTypeParts[1] ? 0 : parseInt(current.transaction_journal_id);\n let outwardId = 'inward' === linkTypeParts[1] ? 0 : parseInt(current.transaction_journal_id);\n let newLink = {\n link_type_id: parseInt(linkTypeParts[0]),\n inward_id: inwardId,\n outward_id: outwardId,\n };\n links.push(newLink);\n }\n }\n currentSplit.links = links;\n\n // return it.\n return currentSplit;\n },\n /**\n * Get API value.\n */\n getAllowedOpposingTypes: function () {\n axios.get('./api/v1/configuration/firefly.allowed_opposing_types')\n .then(response => {\n this.allowedOpposingTypes = response.data.data.value;\n });\n },\n /**\n * Get API value.\n */\n getAccountToTransaction: function () {\n axios.get('./api/v1/configuration/firefly.account_to_transaction')\n .then(response => {\n this.accountToTransaction = response.data.data.value;\n });\n },\n /**\n * This method grabs the users preferred custom transaction fields. It's used when configuring the\n * custom date selects that will be available. It could be something the component does by itself,\n * thereby separating concerns. This is on my list. If it changes to a per-component thing, then\n * it should be done via the create.js Vue store because multiple components are interested in the\n * user's custom transaction fields.\n */\n getCustomFields: function () {\n axios.get('./api/v1/preferences/transaction_journal_optional_fields').then(response => {\n this.customFields = response.data.data.attributes.data;\n });\n },\n setDestinationAllowedTypes: function (value) {\n // console.log('Create::setDestinationAllowedTypes');\n // console.log(value);\n if (0 === value.length) {\n this.destinationAllowedTypes = this.defaultDestinationAllowedTypes;\n //console.log('empty so back to defaults');\n return;\n }\n this.destinationAllowedTypes = value;\n },\n setSourceAllowedTypes(value) {\n // console.log('Create::setSourceAllowedTypes');\n // console.log(value);\n if (0 === value.length) {\n this.sourceAllowedTypes = this.defaultSourceAllowedTypes;\n // console.log('empty so back to defaults');\n return;\n }\n this.sourceAllowedTypes = value;\n }\n },\n\n}\n</script>\n\n<style scoped>\n\n</style>","import mod from \"-!../../../node_modules/babel-loader/lib/index.js??ref--4-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Create.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../node_modules/babel-loader/lib/index.js??ref--4-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Create.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./Create.vue?vue&type=template&id=6df98ad4&scoped=true&\"\nimport script from \"./Create.vue?vue&type=script&lang=js&\"\nexport * from \"./Create.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"6df98ad4\",\n null\n \n)\n\nexport default component.exports","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('alert',{attrs:{\"message\":_vm.errorMessage,\"type\":\"danger\"}}),_vm._v(\" \"),_c('alert',{attrs:{\"message\":_vm.successMessage,\"type\":\"success\"}}),_vm._v(\" \"),_c('SplitPills',{attrs:{\"transactions\":_vm.transactions}}),_vm._v(\" \"),_c('div',{staticClass:\"tab-content\"},_vm._l((this.transactions),function(transaction,index){return _c('SplitForm',{key:index,attrs:{\"allowed-opposing-types\":_vm.allowedOpposingTypes,\"count\":_vm.transactions.length,\"custom-fields\":_vm.customFields,\"date\":_vm.date,\"destination-allowed-types\":_vm.destinationAllowedTypes,\"index\":index,\"source-allowed-types\":_vm.sourceAllowedTypes,\"submitted-transaction\":_vm.submittedTransaction,\"time\":_vm.time,\"transaction\":transaction,\"transaction-type\":_vm.transactionType},on:{\"uploaded-attachments\":function($event){return _vm.uploadedAttachment($event)},\"set-marker-location\":function($event){return _vm.storeLocation($event)},\"set-account\":function($event){return _vm.storeAccountValue($event)},\"switch-accounts\":function($event){return _vm.switchAccounts($event)},\"set-date\":function($event){return _vm.storeDate($event)},\"set-time\":function($event){return _vm.storeTime($event)},\"set-field\":function($event){return _vm.storeField($event)},\"remove-transaction\":function($event){return _vm.removeTransaction($event)},\"set-dest-types\":function($event){return _vm.setDestinationAllowedTypes($event)},\"set-src-types\":function($event){return _vm.setSourceAllowedTypes($event)}}})}),1),_vm._v(\" \"),_c('div',{staticClass:\"row\"},[_c('div',{staticClass:\"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12\"},[(_vm.transactions.length > 1)?_c('div',{staticClass:\"card\"},[_c('div',{staticClass:\"card-body\"},[_c('div',{staticClass:\"row\"},[_c('div',{staticClass:\"col\"},[_c('TransactionGroupTitle',{attrs:{\"errors\":this.groupTitleErrors},on:{\"set-group-title\":function($event){return _vm.storeGroupTitle($event)}},model:{value:(this.groupTitle),callback:function ($$v) {_vm.$set(this, \"groupTitle\", $$v)},expression:\"this.groupTitle\"}})],1)])])]):_vm._e()]),_vm._v(\" \"),_c('div',{staticClass:\"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12\"},[_c('div',{staticClass:\"card card-primary\"},[_c('div',{staticClass:\"card-body\"},[_c('div',{staticClass:\"row\"},[_c('div',{staticClass:\"col\"},[_c('div',{staticClass:\"text-xs d-none d-lg-block d-xl-block\"},[_vm._v(\"\\n  \\n \")]),_vm._v(\" \"),_c('button',{staticClass:\"btn btn-outline-primary btn-block\",on:{\"click\":_vm.addTransaction}},[_c('i',{staticClass:\"far fa-clone\"}),_vm._v(\" \"+_vm._s(_vm.$t('firefly.add_another_split'))+\"\\n \")])]),_vm._v(\" \"),_c('div',{staticClass:\"col\"},[_c('div',{staticClass:\"text-xs d-none d-lg-block d-xl-block\"},[_vm._v(\"\\n  \\n \")]),_vm._v(\" \"),_c('button',{staticClass:\"btn btn-success btn-block\",attrs:{\"disabled\":!_vm.enableSubmit},on:{\"click\":_vm.submitTransaction}},[(_vm.enableSubmit)?_c('span',[_c('i',{staticClass:\"far fa-save\"}),_vm._v(\" \"+_vm._s(_vm.$t('firefly.store_transaction')))]):_vm._e(),_vm._v(\" \"),(!_vm.enableSubmit)?_c('span',[_c('i',{staticClass:\"fas fa-spinner fa-spin\"})]):_vm._e()])])]),_vm._v(\" \"),_c('div',{staticClass:\"row\"},[_c('div',{staticClass:\"col\"},[_vm._v(\"\\n  \\n \")]),_vm._v(\" \"),_c('div',{staticClass:\"col\"},[_c('div',{staticClass:\"form-check\"},[_c('input',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.createAnother),expression:\"createAnother\"}],staticClass:\"form-check-input\",attrs:{\"id\":\"createAnother\",\"type\":\"checkbox\"},domProps:{\"checked\":Array.isArray(_vm.createAnother)?_vm._i(_vm.createAnother,null)>-1:(_vm.createAnother)},on:{\"change\":function($event){var $$a=_vm.createAnother,$$el=$event.target,$$c=$$el.checked?(true):(false);if(Array.isArray($$a)){var $$v=null,$$i=_vm._i($$a,$$v);if($$el.checked){$$i<0&&(_vm.createAnother=$$a.concat([$$v]))}else{$$i>-1&&(_vm.createAnother=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}}else{_vm.createAnother=$$c}}}}),_vm._v(\" \"),_c('label',{staticClass:\"form-check-label\",attrs:{\"for\":\"createAnother\"}},[_c('span',{staticClass:\"small\"},[_vm._v(_vm._s(_vm.$t('firefly.create_another')))])])]),_vm._v(\" \"),_c('div',{staticClass:\"form-check\"},[_c('input',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.resetFormAfter),expression:\"resetFormAfter\"}],staticClass:\"form-check-input\",attrs:{\"id\":\"resetFormAfter\",\"disabled\":!_vm.createAnother,\"type\":\"checkbox\"},domProps:{\"checked\":Array.isArray(_vm.resetFormAfter)?_vm._i(_vm.resetFormAfter,null)>-1:(_vm.resetFormAfter)},on:{\"change\":function($event){var $$a=_vm.resetFormAfter,$$el=$event.target,$$c=$$el.checked?(true):(false);if(Array.isArray($$a)){var $$v=null,$$i=_vm._i($$a,$$v);if($$el.checked){$$i<0&&(_vm.resetFormAfter=$$a.concat([$$v]))}else{$$i>-1&&(_vm.resetFormAfter=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}}else{_vm.resetFormAfter=$$c}}}}),_vm._v(\" \"),_c('label',{staticClass:\"form-check-label\",attrs:{\"for\":\"resetFormAfter\"}},[_c('span',{staticClass:\"small\"},[_vm._v(_vm._s(_vm.$t('firefly.reset_after')))])])])])])])])])])],1)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","/*\n * create.js\n * Copyright (c) 2020 [email protected]\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 <https://www.gnu.org/licenses/>.\n */\n\nimport store from \"../../components/store\";\nimport Create from \"../../components/transactions/Create\";\nimport Vue from \"vue\";\n\nrequire('../../bootstrap');\n\nVue.config.productionTip = false;\n// i18n\nlet i18n = require('../../i18n');\n\nlet props = {};\nnew Vue({\n i18n,\n store,\n render(createElement) {\n return createElement(Create, {props: props});\n },\n beforeCreate() {\n this.$store.commit('initialiseStore');\n this.$store.dispatch('updateCurrencyPreference');\n },\n }).$mount('#transactions_create');\n"],"sourceRoot":""}
\ No newline at end of file
diff --git a/public/v2/js/transactions/edit.js b/public/v2/js/transactions/edit.js
index b73f87e8a9..15822d7d6c 100755
--- a/public/v2/js/transactions/edit.js
+++ b/public/v2/js/transactions/edit.js
@@ -1,2 +1,2 @@
-(window.webpackJsonp=window.webpackJsonp||[]).push([[9],{453:function(t,e,s){t.exports=s(462)},462:function(t,e,s){"use strict";s.r(e);var i=s(30),n=s(68),a=s(46),r=s(66),o=s(69),c=s(29),d=s(71),l={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:n.a,SplitPills:a.a,SplitForm:r.a,TransactionGroupTitle:o.a},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,s=e.transactions.reverse();for(var i in this.groupTitle=e.group_title,this.originalGroupTitle=e.group_title,s)if(s.hasOwnProperty(i)&&/^0$|^[1-9]\d*$/.test(i)&&i<=4294967294){var n=this.parseTransaction(parseInt(i),s[i]);this.transactions.push(n),this.originalTransactions.push(d(n)),this.parseLinks(parseInt(n.transaction_journal_id),parseInt(i))}},parseTransaction:function(t,e){var s;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 i=Object(c.b)();return i.description=e.description,i.transaction_journal_id=parseInt(e.transaction_journal_id),i.source_account_id=e.source_id,i.source_account_name=e.source_name,i.source_account_type=e.source_type,i.destination_account_id=e.destination_id,i.destination_account_name=e.destination_name,i.destination_account_type=e.destination_type,i.amount=e.amount,i.currency_id=e.currency_id,i.foreign_amount=e.foreign_amount,i.foreign_currency_id=e.foreign_currency_id,i.category=e.category_name,i.budget_id=e.budget_id,i.bill_id=null!==(s=e.bill_id)&&void 0!==s?s:0,i.tags=e.tags,i.interest_date=e.interest_date?e.interest_date.substr(0,10):"",i.book_date=e.book_date?e.book_date.substr(0,10):"",i.process_date=e.process_date?e.process_date.substr(0,10):"",i.due_date=e.due_date?e.due_date.substr(0,10):"",i.payment_date=e.payment_date?e.payment_date.substr(0,10):"",i.invoice_date=e.invoice_date?e.invoice_date.substr(0,10):"",i.internal_reference=e.internal_reference,i.external_url=e.external_uri,i.external_id=e.external_id,i.notes=e.notes,i.location={zoom_level:e.zoom_level,longitude:e.longitude,latitude:e.latitude},i.zoom_level=e.zoom_level,i.longitude=e.longitude,i.latitude=e.latitude,i.errors=Object(c.a)(),i},parseLinks:function(t,e){var s=this;axios.get("./api/v1/transaction-journals/"+t+"/links").then((function(i){var n=i.data.data;for(var a in n)n.hasOwnProperty(a)&&/^0$|^[1-9]\d*$/.test(a)&&a<=4294967294&&s.parseLink(n[a],t,e)}))},parseLink:function(t,e,s){var i=this,n=[],a=parseInt(t.attributes.inward_id),r="inward";a===e&&(a=parseInt(t.attributes.outward_id),r="outward"),n.push(new Promise((function(i){i({link:t,journalId:e,opposingId:a,index:s,direction:r})}))),n.push(axios.get("./api/v1/transaction-journals/"+a)),n.push(axios.get("./api/v1/transaction_links/"+t.attributes.link_type_id)),Promise.all(n).then((function(e){var s=e[1].data.data.attributes.transactions,n=e[0].opposingId,a={};for(var r in s)s.hasOwnProperty(r)&&/^0$|^[1-9]\d*$/.test(r)&&r<=4294967294&&s[r].transaction_journal_id===n&&(a=s[r]);var o=e[0].index,c=e[0].direction,d=e[2].data.data.id,l={id:t.id,link_type_id:d+"-"+c,transaction_group_id:e[1].data.data.id,transaction_journal_id:a.transaction_journal_id,description:a.description,type:a.type,currency_code:a.currency_code,amount:a.amount};i.transactions[o].links.push(l),i.originalTransactions[o].links.push(l)}))},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,s=t.index;this.transactions[s][e+"_account_id"]=t.id,this.transactions[s][e+"_account_type"]=t.type,this.transactions[s][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=Object(c.b)();t.errors=Object(c.a)(),this.transactions.push(t)},submitTransaction:function(){var t={transactions:[]},e=!1,s=!1,i=!1;this.groupTitle!==this.originalGroupTitle&&(t.group_title=this.groupTitle,e=!0);var n=this.originalTransactions.length;for(var a in this.transactions)if(this.transactions.hasOwnProperty(a)&&/^0$|^[1-9]\d*$/.test(a)&&a<=4294967294){var r=this.transactions[a],o=this.originalTransactions.hasOwnProperty(a)?this.originalTransactions[a]:{},l={},u=["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 u)if(u.hasOwnProperty(p)&&/^0$|^[1-9]\d*$/.test(p)&&p<=4294967294){var h=u[p];r[h]!==o[h]&&(l[h]=r[h],e=!0)}0!==r.piggy_bank_id&&(l.piggy_bank_id=r.piggy_bank_id,e=!0),JSON.stringify(r.tags)!==JSON.stringify(o.tags)&&(l.tags=r.tags,e=!0),this.compareLinks(r.links)!==this.compareLinks(o.links)&&(s=!0),void 0!==r.selectedAttachments&&!0===r.selectedAttachments&&(i=!0);var _="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 g=this.date;g.setHours(this.time.getHours()),g.setMinutes(this.time.getMinutes()),g.setSeconds(this.time.getSeconds()),_=Object(c.c)(g),l.date=_}(0===Object.keys(l).length&&n>1||0!==Object.keys(l).length)&&(l.transaction_journal_id=o.transaction_journal_id,t.transactions.push(d(l)),e=!0)}console.log("submitTransaction"),console.log("shouldUpload : "+i),console.log("shouldLinks : "+s),console.log("shouldSubmit : "+e),e&&this.submitUpdate(t,s,i),e||(this.submittedTransaction=!0),s||(this.submittedLinks=!0),i||(this.submittedAttachments=!0),!e&&s&&this.submitTransactionLinks(),console.log("Done with submit methd.")},compareLinks:function(t){var e=[];for(var s in t)t.hasOwnProperty(s)&&/^0$|^[1-9]\d*$/.test(s)&&s<=4294967294&&e.push({amount:t[s].amount,currency_code:t[s].currency_code,description:t[s].description,link_type_id:t[s].link_type_id,transaction_group_id:t[s].transaction_group_id,type:t[s].type});return JSON.stringify(e)},submitUpdate:function(t,e,s){var i=this;console.log("submitUpdate"),this.inError=!1;var n="./api/v1/transactions/"+this.groupId;console.log(t),axios.put(n,t).then((function(t){console.log("Response is OK!"),i.submittedTransaction=!0,e&&(console.log("Need to update links."),i.submitTransactionLinks()),e||console.log("No need to update links."),i.returnedGroupId=parseInt(t.data.data.id),i.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),i.enableSubmit=!0,i.submittedTransaction=!0,i.submittedAttachments=!0,i.submittedLinks=!0,i.inError=!0,i.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 s,i,n;for(var a 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(a)){if("group_title"===a){this.groupTitleErrors=t.errors[a];continue}if("group_title"!==a)switch(i=parseInt(a.split(".")[1]),n=a.split(".")[2]){case"amount":case"description":case"date":case"tags":s={index:i,field:n,errors:t.errors[a]},this.setTransactionError(s);break;case"budget_id":s={index:i,field:"budget",errors:t.errors[a]},this.setTransactionError(s);break;case"bill_id":s={index:i,field:"bill",errors:t.errors[a]},this.setTransactionError(s);break;case"piggy_bank_id":s={index:i,field:"piggy_bank",errors:t.errors[a]},this.setTransactionError(s);break;case"category_name":s={index:i,field:"category",errors:t.errors[a]},this.setTransactionError(s);break;case"source_name":case"source_id":s={index:i,field:"source",errors:t.errors[a]},this.setTransactionError(s);break;case"destination_name":case"destination_id":s={index:i,field:"destination",errors:t.errors[a]},this.setTransactionError(s);break;case"foreign_amount":case"foreign_currency":s={index:i,field:"foreign_amount",errors:t.errors[a]},this.setTransactionError(s)}this.transactions[i]}},setTransactionError:function(t){this.transactions[t.index].errors[t.field]=t.errors},resetErrors:function(t){this.transactions[t.index].errors=d(Object(c.a)())},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 s="/api/v1/transaction_links/"+t.links[e].id;axios.delete(s).then((function(t){}))}},submitTransactionLinks:function(){var t=0,e=[];for(var s in console.log("submitTransactionLinks()"),this.transactions)if(this.transactions.hasOwnProperty(s)&&/^0$|^[1-9]\d*$/.test(s)&&s<=4294967294){var i=this.transactions[s],n=this.originalTransactions.hasOwnProperty(s)?this.originalTransactions[s]:{},a=this.compareLinks(i.links),r=this.compareLinks(n.links);if(a!==r)for(var o in"[]"!==r&&this.deleteOriginalLinks(n),console.log("links are different!"),i.links)if(i.links.hasOwnProperty(o)&&/^0$|^[1-9]\d*$/.test(o)&&o<=4294967294){var c=i.links[o],d={inward_id:i.transaction_journal_id,outward_id:i.transaction_journal_id,link_type_id:"something"},l=c.link_type_id.split("-");d.link_type_id=l[0],"inward"===l[1]&&(d.inward_id=c.transaction_journal_id),"outward"===l[1]&&(d.outward_id=c.transaction_journal_id),console.log(d),t++,e.push(axios.post("./api/v1/transaction_links",d).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 s 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(s)&&/^0$|^[1-9]\d*$/.test(s)&&s<=4294967294&&this.transactions.hasOwnProperty(s)}}}},u=s(4),p=Object(u.a)(l,(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",[s("Alert",{attrs:{message:t.errorMessage,type:"danger"}}),t._v(" "),s("Alert",{attrs:{message:t.successMessage,type:"success"}}),t._v(" "),s("Alert",{attrs:{message:t.warningMessage,type:"warning"}}),t._v(" "),s("SplitPills",{attrs:{transactions:t.transactions}}),t._v(" "),s("div",{staticClass:"tab-content"},t._l(this.transactions,(function(e,i){return s("SplitForm",{key:i,attrs:{count:t.transactions.length,transaction:e,"allowed-opposing-types":t.allowedOpposingTypes,"custom-fields":t.customFields,date:t.date,time:t.time,index:i,"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(" "),s("div",{staticClass:"row"},[s("div",{staticClass:"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12"},[t.transactions.length>1?s("div",{staticClass:"card"},[s("div",{staticClass:"card-body"},[s("div",{staticClass:"row"},[s("div",{staticClass:"col"},[s("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(" "),s("div",{staticClass:"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12"},[s("div",{staticClass:"card"},[s("div",{staticClass:"card-body"},[s("div",{staticClass:"row"},[s("div",{staticClass:"col"},[s("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[t._v("\n  \n ")]),t._v(" "),s("button",{staticClass:"btn btn-outline-primary btn-block",on:{click:t.addTransaction}},[s("i",{staticClass:"far fa-clone"}),t._v(" "+t._s(t.$t("firefly.add_another_split"))+"\n ")])]),t._v(" "),s("div",{staticClass:"col"},[s("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[t._v("\n  \n ")]),t._v(" "),s("button",{staticClass:"btn btn-info btn-block",attrs:{disabled:!t.enableSubmit},on:{click:t.submitTransaction}},[t.enableSubmit?s("span",[s("i",{staticClass:"far fa-save"}),t._v(" "+t._s(t.$t("firefly.update_transaction")))]):t._e(),t._v(" "),t.enableSubmit?t._e():s("span",[s("i",{staticClass:"fas fa-spinner fa-spin"})])])])]),t._v(" "),s("div",{staticClass:"row"},[s("div",{staticClass:"col"},[t._v("\n  \n ")]),t._v(" "),s("div",{staticClass:"col"},[s("div",{staticClass:"form-check"},[s("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 s=t.stayHere,i=e.target,n=!!i.checked;if(Array.isArray(s)){var a=t._i(s,null);i.checked?a<0&&(t.stayHere=s.concat([null])):a>-1&&(t.stayHere=s.slice(0,a).concat(s.slice(a+1)))}else t.stayHere=n}}}),t._v(" "),s("label",{staticClass:"form-check-label",attrs:{for:"stayHere"}},[s("span",{staticClass:"small"},[t._v(t._s(t.$t("firefly.after_update_create_another")))])])])])])])])])])],1)}),[],!1,null,"7b268106",null).exports,h=s(8),_=s.n(h);s(41),_.a.config.productionTip=!1;var g=s(43),m={};new _.a({i18n:g,store:i.a,render:function(t){return t(p,{props:m})},beforeCreate:function(){this.$store.commit("initialiseStore"),this.$store.dispatch("updateCurrencyPreference")}}).$mount("#transactions_edit")}},[[453,0,1]]]);
+(window.webpackJsonp=window.webpackJsonp||[]).push([[9],{453:function(t,e,s){t.exports=s(462)},462:function(t,e,s){"use strict";s.r(e);var i=s(30),n=s(68),a=s(46),r=s(66),o=s(69),c=s(29);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 d=s(71),u={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:n.a,SplitPills:a.a,SplitForm:r.a,TransactionGroupTitle:o.a},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,s=e.transactions.reverse();for(var i in this.groupTitle=e.group_title,this.originalGroupTitle=e.group_title,s)if(s.hasOwnProperty(i)&&/^0$|^[1-9]\d*$/.test(i)&&i<=4294967294){var n=this.parseTransaction(parseInt(i),s[i]);this.transactions.push(n),this.originalTransactions.push(d(n)),this.parseLinks(parseInt(n.transaction_journal_id),parseInt(i))}},parseTransaction:function(t,e){var s;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 i=Object(c.b)();return i.description=e.description,i.transaction_journal_id=parseInt(e.transaction_journal_id),i.source_account_id=e.source_id,i.source_account_name=e.source_name,i.source_account_type=e.source_type,i.destination_account_id=e.destination_id,i.destination_account_name=e.destination_name,i.destination_account_type=e.destination_type,i.amount=e.amount,i.currency_id=e.currency_id,i.foreign_amount=e.foreign_amount,i.foreign_currency_id=e.foreign_currency_id,i.category=e.category_name,i.budget_id=e.budget_id,i.bill_id=null!==(s=e.bill_id)&&void 0!==s?s:0,i.tags=e.tags,i.interest_date=e.interest_date?e.interest_date.substr(0,10):"",i.book_date=e.book_date?e.book_date.substr(0,10):"",i.process_date=e.process_date?e.process_date.substr(0,10):"",i.due_date=e.due_date?e.due_date.substr(0,10):"",i.payment_date=e.payment_date?e.payment_date.substr(0,10):"",i.invoice_date=e.invoice_date?e.invoice_date.substr(0,10):"",i.internal_reference=e.internal_reference,i.external_url=e.external_uri,i.external_id=e.external_id,i.notes=e.notes,i.location={zoom_level:e.zoom_level,longitude:e.longitude,latitude:e.latitude},i.zoom_level=e.zoom_level,i.longitude=e.longitude,i.latitude=e.latitude,i.errors=Object(c.a)(),i},parseLinks:function(t,e){var s=this;axios.get("./api/v1/transaction-journals/"+t+"/links").then((function(i){var n=i.data.data;for(var a in n)n.hasOwnProperty(a)&&/^0$|^[1-9]\d*$/.test(a)&&a<=4294967294&&s.parseLink(n[a],t,e)}))},parseLink:function(t,e,s){var i=this,n=[],a=parseInt(t.attributes.inward_id),r="inward";a===e&&(a=parseInt(t.attributes.outward_id),r="outward"),n.push(new Promise((function(i){i({link:t,journalId:e,opposingId:a,index:s,direction:r})}))),n.push(axios.get("./api/v1/transaction-journals/"+a)),n.push(axios.get("./api/v1/transaction_links/"+t.attributes.link_type_id)),Promise.all(n).then((function(e){var s=e[1].data.data.attributes.transactions,n=e[0].opposingId,a={};for(var r in s)s.hasOwnProperty(r)&&/^0$|^[1-9]\d*$/.test(r)&&r<=4294967294&&s[r].transaction_journal_id===n&&(a=s[r]);var o=e[0].index,c=e[0].direction,l=e[2].data.data.id,d={id:t.id,link_type_id:l+"-"+c,transaction_group_id:e[1].data.data.id,transaction_journal_id:a.transaction_journal_id,description:a.description,type:a.type,currency_code:a.currency_code,amount:a.amount};i.transactions[o].links.push(d),i.originalTransactions[o].links.push(d)}))},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,s=t.index;this.transactions[s][e+"_account_id"]=t.id,this.transactions[s][e+"_account_type"]=t.type,this.transactions[s][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=Object(c.b)();t.errors=Object(c.a)(),this.transactions.push(t)},submitTransaction:function(){var t={transactions:[]},e=!1,s=!1,i=!1;this.groupTitle!==this.originalGroupTitle&&(t.group_title=this.groupTitle,e=!0);var n=this.originalTransactions.length;for(var a in this.transactions)if(this.transactions.hasOwnProperty(a)&&/^0$|^[1-9]\d*$/.test(a)&&a<=4294967294){var r=this.transactions[a],o=this.originalTransactions.hasOwnProperty(a)?this.originalTransactions[a]:{},u={},p=["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 h in p)if(p.hasOwnProperty(h)&&/^0$|^[1-9]\d*$/.test(h)&&h<=4294967294){var _=p[h];r[_]!==o[_]&&(u[_]=r[_],e=!0)}if(0!==r.piggy_bank_id&&(u.piggy_bank_id=r.piggy_bank_id,e=!0),JSON.stringify(r.tags)!==JSON.stringify(o.tags)){if(u.tags=[],0!==r.tags.length)for(var g in r.tags)if(r.tags.hasOwnProperty(g)&&/^0$|^[1-9]\d*$/.test(g)&&g<=4294967294){var m=r.tags[g];"object"===l(m)&&null!==m&&u.tags.push(m.text),"string"==typeof m&&u.tags.push(m)}e=!0}this.compareLinks(r.links)!==this.compareLinks(o.links)&&(s=!0),void 0!==r.selectedAttachments&&!0===r.selectedAttachments&&(i=!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 b=this.date;b.setHours(this.time.getHours()),b.setMinutes(this.time.getMinutes()),b.setSeconds(this.time.getSeconds()),f=Object(c.c)(b),u.date=f}(0===Object.keys(u).length&&n>1||0!==Object.keys(u).length)&&(u.transaction_journal_id=o.transaction_journal_id,t.transactions.push(d(u)),e=!0)}console.log("submitTransaction"),console.log("shouldUpload : "+i),console.log("shouldLinks : "+s),console.log("shouldSubmit : "+e),e&&this.submitUpdate(t,s,i),e||(this.submittedTransaction=!0),s||(this.submittedLinks=!0),i||(this.submittedAttachments=!0),!e&&s&&this.submitTransactionLinks(),console.log("Done with submit methd.")},compareLinks:function(t){var e=[];for(var s in t)t.hasOwnProperty(s)&&/^0$|^[1-9]\d*$/.test(s)&&s<=4294967294&&e.push({amount:t[s].amount,currency_code:t[s].currency_code,description:t[s].description,link_type_id:t[s].link_type_id,transaction_group_id:t[s].transaction_group_id,type:t[s].type});return JSON.stringify(e)},submitUpdate:function(t,e,s){var i=this;console.log("submitUpdate"),this.inError=!1;var n="./api/v1/transactions/"+this.groupId;console.log(t),axios.put(n,t).then((function(t){console.log("Response is OK!"),i.submittedTransaction=!0,e&&(console.log("Need to update links."),i.submitTransactionLinks()),e||console.log("No need to update links."),i.returnedGroupId=parseInt(t.data.data.id),i.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),i.enableSubmit=!0,i.submittedTransaction=!0,i.submittedAttachments=!0,i.submittedLinks=!0,i.inError=!0,i.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 s,i,n;for(var a 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(a)){if("group_title"===a){this.groupTitleErrors=t.errors[a];continue}if("group_title"!==a)switch(i=parseInt(a.split(".")[1]),n=a.split(".")[2]){case"amount":case"description":case"date":case"tags":s={index:i,field:n,errors:t.errors[a]},this.setTransactionError(s);break;case"budget_id":s={index:i,field:"budget",errors:t.errors[a]},this.setTransactionError(s);break;case"bill_id":s={index:i,field:"bill",errors:t.errors[a]},this.setTransactionError(s);break;case"piggy_bank_id":s={index:i,field:"piggy_bank",errors:t.errors[a]},this.setTransactionError(s);break;case"category_name":s={index:i,field:"category",errors:t.errors[a]},this.setTransactionError(s);break;case"source_name":case"source_id":s={index:i,field:"source",errors:t.errors[a]},this.setTransactionError(s);break;case"destination_name":case"destination_id":s={index:i,field:"destination",errors:t.errors[a]},this.setTransactionError(s);break;case"foreign_amount":case"foreign_currency":s={index:i,field:"foreign_amount",errors:t.errors[a]},this.setTransactionError(s)}this.transactions[i]}},setTransactionError:function(t){this.transactions[t.index].errors[t.field]=t.errors},resetErrors:function(t){this.transactions[t.index].errors=d(Object(c.a)())},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 s="/api/v1/transaction_links/"+t.links[e].id;axios.delete(s).then((function(t){}))}},submitTransactionLinks:function(){var t=0,e=[];for(var s in console.log("submitTransactionLinks()"),this.transactions)if(this.transactions.hasOwnProperty(s)&&/^0$|^[1-9]\d*$/.test(s)&&s<=4294967294){var i=this.transactions[s],n=this.originalTransactions.hasOwnProperty(s)?this.originalTransactions[s]:{},a=this.compareLinks(i.links),r=this.compareLinks(n.links);if(a!==r)for(var o in"[]"!==r&&this.deleteOriginalLinks(n),console.log("links are different!"),i.links)if(i.links.hasOwnProperty(o)&&/^0$|^[1-9]\d*$/.test(o)&&o<=4294967294){var c=i.links[o],l={inward_id:i.transaction_journal_id,outward_id:i.transaction_journal_id,link_type_id:"something"},d=c.link_type_id.split("-");l.link_type_id=d[0],"inward"===d[1]&&(l.inward_id=c.transaction_journal_id),"outward"===d[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 s 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(s)&&/^0$|^[1-9]\d*$/.test(s)&&s<=4294967294&&this.transactions.hasOwnProperty(s)}}}},p=s(4),h=Object(p.a)(u,(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",[s("Alert",{attrs:{message:t.errorMessage,type:"danger"}}),t._v(" "),s("Alert",{attrs:{message:t.successMessage,type:"success"}}),t._v(" "),s("Alert",{attrs:{message:t.warningMessage,type:"warning"}}),t._v(" "),s("SplitPills",{attrs:{transactions:t.transactions}}),t._v(" "),s("div",{staticClass:"tab-content"},t._l(this.transactions,(function(e,i){return s("SplitForm",{key:i,attrs:{count:t.transactions.length,transaction:e,"allowed-opposing-types":t.allowedOpposingTypes,"custom-fields":t.customFields,date:t.date,time:t.time,index:i,"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(" "),s("div",{staticClass:"row"},[s("div",{staticClass:"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12"},[t.transactions.length>1?s("div",{staticClass:"card"},[s("div",{staticClass:"card-body"},[s("div",{staticClass:"row"},[s("div",{staticClass:"col"},[s("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(" "),s("div",{staticClass:"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12"},[s("div",{staticClass:"card"},[s("div",{staticClass:"card-body"},[s("div",{staticClass:"row"},[s("div",{staticClass:"col"},[s("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[t._v("\n  \n ")]),t._v(" "),s("button",{staticClass:"btn btn-outline-primary btn-block",on:{click:t.addTransaction}},[s("i",{staticClass:"far fa-clone"}),t._v(" "+t._s(t.$t("firefly.add_another_split"))+"\n ")])]),t._v(" "),s("div",{staticClass:"col"},[s("div",{staticClass:"text-xs d-none d-lg-block d-xl-block"},[t._v("\n  \n ")]),t._v(" "),s("button",{staticClass:"btn btn-info btn-block",attrs:{disabled:!t.enableSubmit},on:{click:t.submitTransaction}},[t.enableSubmit?s("span",[s("i",{staticClass:"far fa-save"}),t._v(" "+t._s(t.$t("firefly.update_transaction")))]):t._e(),t._v(" "),t.enableSubmit?t._e():s("span",[s("i",{staticClass:"fas fa-spinner fa-spin"})])])])]),t._v(" "),s("div",{staticClass:"row"},[s("div",{staticClass:"col"},[t._v("\n  \n ")]),t._v(" "),s("div",{staticClass:"col"},[s("div",{staticClass:"form-check"},[s("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 s=t.stayHere,i=e.target,n=!!i.checked;if(Array.isArray(s)){var a=t._i(s,null);i.checked?a<0&&(t.stayHere=s.concat([null])):a>-1&&(t.stayHere=s.slice(0,a).concat(s.slice(a+1)))}else t.stayHere=n}}}),t._v(" "),s("label",{staticClass:"form-check-label",attrs:{for:"stayHere"}},[s("span",{staticClass:"small"},[t._v(t._s(t.$t("firefly.after_update_create_another")))])])])])])])])])])],1)}),[],!1,null,"17cb1c2b",null).exports,_=s(8),g=s.n(_);s(41),g.a.config.productionTip=!1;var m=s(43),f={};new g.a({i18n:m,store:i.a,render:function(t){return t(h,{props:f})},beforeCreate:function(){this.$store.commit("initialiseStore"),this.$store.dispatch("updateCurrencyPreference")}}).$mount("#transactions_edit")}},[[453,0,1]]]);
//# sourceMappingURL=edit.js.map
\ No newline at end of file
diff --git a/public/v2/js/transactions/edit.js.map b/public/v2/js/transactions/edit.js.map
index 93329e76f0..3a6ecb7b19 100755
--- a/public/v2/js/transactions/edit.js.map
+++ b/public/v2/js/transactions/edit.js.map
@@ -1 +1 @@
-{"version":3,"sources":["webpack:///src/components/transactions/Edit.vue","webpack:///./src/components/transactions/Edit.vue?f2c6","webpack:///./src/components/transactions/Edit.vue","webpack:///./src/components/transactions/Edit.vue?83bd","webpack:///./src/pages/transactions/edit.js"],"names":["name","created","this","groupId","parseInt","parts","length","getTransactionGroup","getAllowedOpposingTypes","getCustomFields","data","successMessage","errorMessage","warningMessage","transactions","originalTransactions","groupTitle","originalGroupTitle","transactionType","groupTitleErrors","customFields","returnedGroupId","returnedGroupTitle","date","Date","time","originalDate","originalTime","submittedTransaction","submittedLinks","submittedAttachments","inError","allowedOpposingTypes","destinationAllowedTypes","sourceAllowedTypes","enableSubmit","stayHere","components","Alert","SplitPills","SplitForm","TransactionGroupTitle","watch","finalizeSubmit","methods","axios","get","parseTransactionGroup","attributes","group_title","hasOwnProperty","i","test","push","result","lodashClonedeep","parseLinks","transaction_journal_id","parseTransaction","index","array","type","charAt","toUpperCase","slice","source_type","destination_type","description","source_account_id","source_id","source_account_name","source_name","source_account_type","destination_account_id","destination_id","destination_account_name","destination_name","destination_account_type","amount","currency_id","foreign_amount","foreign_currency_id","category","category_name","budget_id","bill_id","tags","interest_date","substr","book_date","process_date","due_date","payment_date","invoice_date","internal_reference","external_url","external_uri","external_id","notes","location","zoom_level","longitude","latitude","errors","journalId","parseLink","opposingId","link","outward_id","linkDirection","promises","Promise","resolve","link_type_id","all","then","journals","journal","id","linkTypeId","direction","transaction_group_id","responses","currency_code","uploadedAttachment","console","log","payload","storeLocation","zoomLevel","lng","lat","storeAccountValue","storeDate","storeTime","storeField","field","value","removeTransaction","splice","storeGroupTitle","selectedAttachments","addTransaction","newTransaction","submitTransaction","submission","shouldSubmit","basicFields","ii","currentTransaction","fieldName","originalTransaction","diff","piggy_bank_id","JSON","stringify","shouldLinks","shouldUpload","theDate","setHours","getHours","setMinutes","getMinutes","setSeconds","getSeconds","dateStr","Object","keys","transactionCount","submitUpdate","submitTransactionLinks","compareLinks","compare","put","url","parseErrors","resetErrors","$t","message","key","transactionIndex","split","setTransactionError","deleteOriginalLinks","transaction","links","newLinks","originalLinks","inward_id","linkObject","currentLink","total","post","window","href","_vm","_h","$createElement","_c","_self","attrs","_v","staticClass","_l","on","$event","model","callback","$$v","$set","expression","_e","_s","directives","rawName","domProps","Array","isArray","_i","$$a","$$el","target","$$c","checked","$$i","concat","require","Vue","config","productionTip","i18n","props","store","render","createElement","Edit","beforeCreate","$store","commit","dispatch","$mount"],"mappings":"2LA+GA,QC/GoM,EDsHpM,CACEA,KAAM,OACNC,QAFF,WAGI,IAAJ,sCACIC,KAAKC,QAAUC,SAASC,EAAMA,EAAMC,OAAS,IAE7CJ,KAAKK,sBACLL,KAAKM,0BACLN,KAAKO,mBAEPC,KAVF,WAWI,MAAO,CACLC,eAAgB,GAChBC,aAAc,GACdC,eAAgB,GAGhBC,aAAc,GACdC,qBAAsB,GACtBC,WAAY,GACZC,mBAAoB,GACpBC,gBAAiB,MACjBf,QAAS,EAGTgB,iBAAkB,GAGlBC,aAAc,GAGdC,gBAAiB,EACjBC,mBAAoB,GAGpBC,KAAM,IAAIC,KACVC,KAAM,IAAID,KACVE,aAAc,IAAIF,KAClBG,aAAc,IAAIH,KAGlBI,sBAAsB,EACtBC,gBAAgB,EAChBC,sBAAsB,EACtBC,SAAS,EAGTC,qBAAsB,GACtBC,wBAAyB,GACzBC,mBAAoB,GAGpBC,cAAc,EACdC,UAAU,IAIdC,WAAY,CACVC,MAAJ,IACIC,WAAJ,IACIC,UAAJ,IACIC,sBAAJ,KAGEC,MAAO,CACLd,qBAAsB,WAEpB1B,KAAKyC,kBAEPd,eAAgB,WAEd3B,KAAKyC,kBAEPb,qBAAsB,WAEpB5B,KAAKyC,mBAITC,QAAS,CAIPrC,oBAAqB,WAAzB,WACMsC,MAAMC,IAAI,yBAA2B5C,KAAKC,SAChD,kBACQ,EAAR,iCAFA,OAIA,iBASI4C,sBAAuB,SAA3B,GAGM,IAAN,oBACA,2BAIM,IAAK,IAAX,KAHM7C,KAAKc,WAAagC,EAAWC,YAC7B/C,KAAKe,mBAAqB+B,EAAWC,YAE3C,EACQ,GAAInC,EAAaoC,eAAeC,IAAM,iBAAiBC,KAAKD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AI/J,SAASuL,EAAI3J,MAAM,EAAEgK,GAAKC,OAAON,EAAI3J,MAAMgK,EAAI,UAAW7B,EAAI/J,SAAS0L,MAAS3B,EAAIM,GAAG,KAAKH,EAAG,QAAQ,CAACI,YAAY,mBAAmBF,MAAM,CAAC,IAAM,aAAa,CAACF,EAAG,OAAO,CAACI,YAAY,SAAS,CAACP,EAAIM,GAAGN,EAAIiB,GAAGjB,EAAIlB,GAAG,4DAA4D,KAChgI,IDUpB,EACA,KACA,WACA,M,wBEUFiD,EAAQ,IAERC,IAAIC,OAAOC,eAAgB,EAE3B,IAAIC,EAAOJ,EAAQ,IAEfK,EAAQ,GACZ,IAAIJ,IAAI,CACIG,OACAE,UACAC,OAHJ,SAGWC,GACH,OAAOA,EAAcC,EAAM,CAACJ,MAAOA,KAEvCK,aANJ,WAOQ1O,KAAK2O,OAAOC,OAAO,mBACnB5O,KAAK2O,OAAOE,SAAS,+BAE1BC,OAAO,wB","file":"/public/js/transactions/edit.js","sourcesContent":["<!--\n - Edit.vue\n - Copyright (c) 2021 [email protected]\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 <https://www.gnu.org/licenses/>.\n -->\n\n<template>\n <div>\n <Alert :message=\"errorMessage\" type=\"danger\"/>\n <Alert :message=\"successMessage\" type=\"success\"/>\n <Alert :message=\"warningMessage\" type=\"warning\"/>\n <SplitPills :transactions=\"transactions\"/>\n\n <div class=\"tab-content\">\n <SplitForm\n v-for=\"(transaction, index) in this.transactions\"\n v-bind:key=\"index\"\n :count=\"transactions.length\"\n :transaction=\"transaction\"\n :allowed-opposing-types=\"allowedOpposingTypes\"\n :custom-fields=\"customFields\"\n :date=\"date\"\n :time=\"time\"\n :index=\"index\"\n :transaction-type=\"transactionType\"\n :destination-allowed-types=\"destinationAllowedTypes\"\n :source-allowed-types=\"sourceAllowedTypes\"\n :allow-switch=\"false\"\n :submitted-transaction=\"submittedTransaction\"\n v-on:uploaded-attachments=\"uploadedAttachment($event)\"\n v-on:set-marker-location=\"storeLocation($event)\"\n v-on:set-account=\"storeAccountValue($event)\"\n v-on:set-date=\"storeDate($event)\"\n v-on:set-time=\"storeTime($event)\"\n v-on:set-field=\"storeField($event)\"\n v-on:remove-transaction=\"removeTransaction($event)\"\n v-on:selected-attachments=\"selectedAttachments($event)\"\n />\n </div>\n\n <!-- bottom buttons etc -->\n <div class=\"row\">\n <!-- group title -->\n <div class=\"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12\">\n <div v-if=\"transactions.length > 1\" class=\"card\">\n <div class=\"card-body\">\n <div class=\"row\">\n <div class=\"col\">\n <TransactionGroupTitle v-model=\"this.groupTitle\" :errors=\"this.groupTitleErrors\" v-on:set-group-title=\"storeGroupTitle($event)\"/>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12\">\n <!-- buttons -->\n <div class=\"card\">\n <div class=\"card-body\">\n <div class=\"row\">\n <div class=\"col\">\n <div class=\"text-xs d-none d-lg-block d-xl-block\">\n &nbsp;\n </div>\n <button class=\"btn btn-outline-primary btn-block\" @click=\"addTransaction\"><i class=\"far fa-clone\"></i> {{ $t('firefly.add_another_split') }}\n </button>\n </div>\n <div class=\"col\">\n <div class=\"text-xs d-none d-lg-block d-xl-block\">\n &nbsp;\n </div>\n <button :disabled=\"!enableSubmit\" class=\"btn btn-info btn-block\" @click=\"submitTransaction\">\n <span v-if=\"enableSubmit\"><i class=\"far fa-save\"></i> {{ $t('firefly.update_transaction') }}</span>\n <span v-if=\"!enableSubmit\"><i class=\"fas fa-spinner fa-spin\"></i></span>\n </button>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col\">\n &nbsp;\n </div>\n <div class=\"col\">\n <div class=\"form-check\">\n <input id=\"stayHere\" v-model=\"stayHere\" class=\"form-check-input\" type=\"checkbox\">\n <label class=\"form-check-label\" for=\"stayHere\">\n <span class=\"small\">{{ $t('firefly.after_update_create_another') }}</span>\n </label>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<script>\nconst lodashClonedeep = require('lodash.clonedeep');\nimport Alert from '../partials/Alert';\nimport SplitPills from \"./SplitPills\";\nimport SplitForm from \"./SplitForm\";\nimport TransactionGroupTitle from \"./TransactionGroupTitle\";\nimport {getDefaultErrors, getDefaultTransaction, toW3CString} from '../shared/transactions';\n\nexport default {\n name: \"Edit\",\n created() {\n let parts = window.location.pathname.split('/');\n this.groupId = parseInt(parts[parts.length - 1]);\n\n this.getTransactionGroup();\n this.getAllowedOpposingTypes();\n this.getCustomFields();\n },\n data() {\n return {\n successMessage: '',\n errorMessage: '',\n warningMessage: '',\n\n // transaction props\n transactions: [],\n originalTransactions: [],\n groupTitle: '',\n originalGroupTitle: '',\n transactionType: 'any',\n groupId: 0,\n\n // errors in the group title:\n groupTitleErrors: [],\n\n // which custom fields to show\n customFields: {},\n\n // group ID + title once submitted:\n returnedGroupId: 0,\n returnedGroupTitle: '',\n\n // date and time of the transaction,\n date: new Date,\n time: new Date,\n originalDate: new Date,\n originalTime: new Date,\n\n // things the process is done working on (3 phases):\n submittedTransaction: false,\n submittedLinks: false,\n submittedAttachments: false,\n inError: false,\n\n // meta data for accounts\n allowedOpposingTypes: {},\n destinationAllowedTypes: [],\n sourceAllowedTypes: [],\n\n // states for the form (makes sense right)\n enableSubmit: true,\n stayHere: false,\n\n }\n },\n components: {\n Alert,\n SplitPills,\n SplitForm,\n TransactionGroupTitle\n },\n\n watch: {\n submittedTransaction: function () {\n // see finalizeSubmit()\n this.finalizeSubmit();\n },\n submittedLinks: function () {\n // see finalizeSubmit()\n this.finalizeSubmit();\n },\n submittedAttachments: function () {\n // see finalizeSubmit()\n this.finalizeSubmit();\n }\n },\n\n methods: {\n /**\n * Grap transaction group from URL and submit GET.\n */\n getTransactionGroup: function () {\n axios.get('./api/v1/transactions/' + this.groupId)\n .then(response => {\n this.parseTransactionGroup(response.data);\n }\n ).catch(error => {\n // console.log('I failed :(');\n // console.log(error);\n });\n },\n /**\n * Parse transaction group. Title is easy, transactions have their own method.\n * @param response\n */\n parseTransactionGroup: function (response) {\n // console.log('Will now parse');\n // console.log(response);\n let attributes = response.data.attributes;\n let transactions = attributes.transactions.reverse();\n this.groupTitle = attributes.group_title;\n this.originalGroupTitle = attributes.group_title;\n\n for (let i in transactions) {\n if (transactions.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n let result = this.parseTransaction(parseInt(i), transactions[i]);\n this.transactions.push(result);\n this.originalTransactions.push(lodashClonedeep(result));\n // pick up the links of this transaction:\n this.parseLinks(parseInt(result.transaction_journal_id), parseInt(i));\n }\n }\n },\n /**\n * Parse a single transaction.\n *\n * @param index\n * @param array\n */\n parseTransaction: function (index, array) {\n //console.log('index: ' + index);\n if (0 === index) {\n this.transactionType = array.type.charAt(0).toUpperCase() + array.type.slice(1);\n this.sourceAllowedTypes = [array.source_type];\n this.destinationAllowedTypes = [array.destination_type];\n this.date = new Date(array.date);\n this.time = new Date(array.date);\n this.originalDate = new Date(array.date);\n this.originalTime = new Date(array.date);\n }\n let result = getDefaultTransaction();\n // parsing here:\n result.description = array.description;\n result.transaction_journal_id = parseInt(array.transaction_journal_id);\n // accounts:\n result.source_account_id = array.source_id;\n result.source_account_name = array.source_name;\n result.source_account_type = array.source_type;\n\n result.destination_account_id = array.destination_id;\n result.destination_account_name = array.destination_name;\n result.destination_account_type = array.destination_type;\n\n // amount:\n result.amount = array.amount;\n result.currency_id = array.currency_id;\n result.foreign_amount = array.foreign_amount;\n result.foreign_currency_id = array.foreign_currency_id;\n\n // meta data\n result.category = array.category_name;\n result.budget_id = array.budget_id;\n result.bill_id = array.bill_id ?? 0;\n\n result.tags = array.tags;\n\n // optional date fields (6x):\n result.interest_date = array.interest_date ? array.interest_date.substr(0, 10) : '';\n result.book_date = array.book_date ? array.book_date.substr(0, 10) : '';\n result.process_date = array.process_date ? array.process_date.substr(0, 10) : '';\n result.due_date = array.due_date ? array.due_date.substr(0, 10) : '';\n result.payment_date = array.payment_date ? array.payment_date.substr(0, 10) : '';\n result.invoice_date = array.invoice_date ? array.invoice_date.substr(0, 10) : '';\n\n // optional other fields:\n result.internal_reference = array.internal_reference;\n result.external_url = array.external_uri;\n result.external_id = array.external_id;\n result.notes = array.notes;\n // location:\n result.location = {\n zoom_level: array.zoom_level,\n longitude: array.longitude,\n latitude: array.latitude,\n };\n result.zoom_level = array.zoom_level;\n result.longitude = array.longitude;\n result.latitude = array.latitude;\n\n // error handling\n result.errors = getDefaultErrors();\n return result;\n },\n /**\n * Get the links of this transaction group from the API.\n */\n parseLinks: function (journalId, index) {\n axios.get('./api/v1/transaction-journals/' + journalId + '/links')\n .then(response => {\n let links = response.data.data;\n for (let i in links) {\n if (links.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n this.parseLink(links[i], journalId, index);\n }\n }\n });\n },\n\n /**\n * Process individual link from the API.\n */\n parseLink: function (link, journalId, index) {\n let promises = [];\n let opposingId = parseInt(link.attributes.inward_id);\n let linkDirection = 'inward';\n if (opposingId === journalId) {\n opposingId = parseInt(link.attributes.outward_id);\n linkDirection = 'outward';\n }\n // add meta data to promise context.\n promises.push(new Promise((resolve) => {\n resolve(\n {\n link: link,\n journalId: journalId,\n opposingId: opposingId,\n index: index,\n direction: linkDirection\n }\n );\n }));\n\n // get stuff from the API:\n promises.push(axios.get('./api/v1/transaction-journals/' + opposingId));\n promises.push(axios.get('./api/v1/transaction_links/' + link.attributes.link_type_id));\n\n Promise.all(promises).then(responses => {\n let journals = responses[1].data.data.attributes.transactions;\n let opposingId = responses[0].opposingId;\n let journal = {};\n // loop over journals to get the correct one:\n for (let i in journals) {\n if (journals.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n if (journals[i].transaction_journal_id === opposingId) {\n journal = journals[i];\n }\n }\n }\n let index = responses[0].index;\n let direction = responses[0].direction;\n let linkTypeId = responses[2].data.data.id;\n let object = {\n id: link.id,\n link_type_id: linkTypeId + '-' + direction,\n transaction_group_id: responses[1].data.data.id,\n transaction_journal_id: journal.transaction_journal_id,\n description: journal.description,\n type: journal.type,\n currency_code: journal.currency_code,\n amount: journal.amount\n };\n this.transactions[index].links.push(object);\n this.originalTransactions[index].links.push(object);\n });\n },\n /**\n * TODO same method as Create\n * Get API value.\n */\n getAllowedOpposingTypes: function () {\n axios.get('./api/v1/configuration/firefly.allowed_opposing_types')\n .then(response => {\n this.allowedOpposingTypes = response.data.data.value;\n // console.log('Set allowedOpposingTypes');\n });\n },\n /**\n * Get API value.\n */\n getCustomFields: function () {\n axios.get('./api/v1/preferences/transaction_journal_optional_fields').then(response => {\n this.customFields = response.data.data.attributes.data;\n });\n },\n uploadedAttachment: function (payload) {\n console.log('event: uploadedAttachment');\n console.log(payload);\n },\n storeLocation: function (payload) {\n this.transactions[payload.index].zoom_level = payload.zoomLevel;\n this.transactions[payload.index].longitude = payload.lng;\n this.transactions[payload.index].latitude = payload.lat;\n },\n storeAccountValue: function (payload) {\n let direction = payload.direction;\n let index = payload.index;\n this.transactions[index][direction + '_account_id'] = payload.id;\n this.transactions[index][direction + '_account_type'] = payload.type;\n this.transactions[index][direction + '_account_name'] = payload.name;\n },\n storeDate: function (payload) {\n // console.log('event: storeDate');\n // console.log(payload);\n this.date = payload.date;\n },\n storeTime: function (payload) {\n this.time = payload.time;\n // console.log('event: storeTime');\n // console.log(payload);\n },\n storeField: function (payload) {\n let field = payload.field;\n if ('category' === field) {\n field = 'category_name';\n }\n // console.log('event: storeField(' + field + ')');\n this.transactions[payload.index][field] = payload.value;\n\n },\n removeTransaction: function (payload) {\n this.transactions.splice(payload.index, 1);\n // this kills the original transactions.\n this.originalTransactions = [];\n },\n storeGroupTitle: function (payload) {\n this.groupTitle = payload;\n },\n selectedAttachments: function (payload) {\n for (let i in this.transactions) {\n if (this.transactions.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n if (parseInt(this.transactions[i].transaction_journal_id) === parseInt(payload)) {\n // console.log('selectedAttachments ' + payload);\n this.transactions[i].selectedAttachments = true;\n }\n }\n }\n },\n addTransaction: function () {\n let newTransaction = getDefaultTransaction();\n newTransaction.errors = getDefaultErrors();\n this.transactions.push(newTransaction);\n },\n submitTransaction: function () {\n let submission = {transactions: []};\n let shouldSubmit = false;\n let shouldLinks = false;\n let shouldUpload = false;\n if (this.groupTitle !== this.originalGroupTitle) {\n submission.group_title = this.groupTitle;\n shouldSubmit = true;\n }\n let transactionCount = this.originalTransactions.length;\n for (let i in this.transactions) {\n if (this.transactions.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n // original transaction present?\n let currentTransaction = this.transactions[i];\n let originalTransaction = this.originalTransactions.hasOwnProperty(i) ? this.originalTransactions[i] : {};\n\n let diff = {};\n\n // compare basic fields:\n let basicFields = [\n 'description',\n 'source_account_id', 'source_account_name',\n 'destination_account_id', 'destination_account_name',\n 'amount', 'foreign_amount', 'foreign_currency_id',\n 'category_name', 'budget_id', 'bill_id',\n 'interest_date', 'book_date', 'due_date', 'payment_date', 'invoice_date',\n 'external_url', 'internal_reference', 'external_id', 'notes',\n 'zoom_level', 'longitude', 'latitude'\n ];\n\n for (let ii in basicFields) {\n if (basicFields.hasOwnProperty(ii) && /^0$|^[1-9]\\d*$/.test(ii) && ii <= 4294967294) {\n let fieldName = basicFields[ii];\n if (currentTransaction[fieldName] !== originalTransaction[fieldName]) {\n // console.log('Index ' + i + ': Field ' + fieldName + ' updated (\"' + originalTransaction[fieldName] + '\" > \"' + currentTransaction[fieldName] + '\")');\n // console.log(originalTransaction[fieldName]);\n // console.log(currentTransaction[fieldName]);\n diff[fieldName] = currentTransaction[fieldName];\n shouldSubmit = true;\n }\n }\n }\n if (0 !== currentTransaction.piggy_bank_id) {\n diff.piggy_bank_id = currentTransaction.piggy_bank_id;\n shouldSubmit = true;\n }\n if (JSON.stringify(currentTransaction.tags) !== JSON.stringify(originalTransaction.tags)) {\n // console.log('tags are different');\n // console.log(currentTransaction.tags);\n // console.log(originalTransaction.tags);\n diff.tags = currentTransaction.tags;\n shouldSubmit = true;\n }\n\n // compare links:\n let newLinks = this.compareLinks(currentTransaction.links);\n let originalLinks = this.compareLinks(originalTransaction.links);\n // console.log('links are?');\n // console.log(newLinks);\n // console.log(originalLinks);\n if (newLinks !== originalLinks) {\n // console.log('links are different!');\n // console.log(newLinks);\n // console.log(originalLinks);\n shouldLinks = true;\n }\n // this.transactions[i].selectedAttachments\n // console.log(typeof currentTransaction.selectedAttachments);\n // console.log(currentTransaction.selectedAttachments);\n if (typeof currentTransaction.selectedAttachments !== 'undefined' && true === currentTransaction.selectedAttachments) {\n // must upload!\n shouldUpload = true;\n }\n\n let dateStr = 'invalid';\n if (\n this.date.toISOString() !== this.originalDate.toISOString() ||\n this.time.toISOString() !== this.originalTime.toISOString()\n ) {\n console.log('Date and/or time is changed');\n // set date and time!\n shouldSubmit = true;\n let theDate = this.date;\n // update time in date object.\n theDate.setHours(this.time.getHours());\n theDate.setMinutes(this.time.getMinutes());\n theDate.setSeconds(this.time.getSeconds());\n dateStr = toW3CString(theDate);\n diff.date = dateStr;\n }\n if (Object.keys(diff).length === 0 && transactionCount > 1) {\n diff.transaction_journal_id = originalTransaction.transaction_journal_id;\n submission.transactions.push(lodashClonedeep(diff));\n shouldSubmit = true;\n } else if (Object.keys(diff).length !== 0) {\n diff.transaction_journal_id = originalTransaction.transaction_journal_id;\n submission.transactions.push(lodashClonedeep(diff));\n shouldSubmit = true;\n }\n }\n }\n\n console.log('submitTransaction');\n console.log('shouldUpload : ' + shouldUpload);\n console.log('shouldLinks : ' + shouldLinks);\n console.log('shouldSubmit : ' + shouldSubmit);\n if (shouldSubmit) {\n this.submitUpdate(submission, shouldLinks, shouldUpload);\n }\n if (!shouldSubmit) {\n this.submittedTransaction = true;\n }\n if (!shouldLinks) {\n this.submittedLinks = true;\n }\n if (!shouldUpload) {\n this.submittedAttachments = true;\n }\n if (!shouldSubmit && shouldLinks) {\n this.submitTransactionLinks();\n }\n\n if (!shouldSubmit && shouldLinks) {\n // TODO\n //this.submittedAttachments();\n }\n console.log('Done with submit methd.');\n //console.log(submission);\n },\n compareLinks: function (array) {\n let compare = [];\n for (let i in array) {\n if (array.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n compare.push(\n {\n amount: array[i].amount,\n currency_code: array[i].currency_code,\n description: array[i].description,\n link_type_id: array[i].link_type_id,\n transaction_group_id: array[i].transaction_group_id,\n type: array[i].type,\n }\n );\n }\n }\n // console.log('compareLinks');\n // console.log(compare);\n return JSON.stringify(compare);\n },\n submitUpdate: function (submission, shouldLinks, shouldUpload) {\n console.log('submitUpdate');\n this.inError = false;\n const url = './api/v1/transactions/' + this.groupId;\n console.log(submission);\n axios.put(url, submission)\n .then(response => {\n console.log('Response is OK!');\n // report the transaction is submitted.\n this.submittedTransaction = true;\n\n // submit links and attachments (can only be done when the transaction is created)\n if (shouldLinks) {\n console.log('Need to update links.');\n this.submitTransactionLinks();\n }\n if (!shouldLinks) {\n console.log('No need to update links.');\n }\n // TODO attachments:\n // this.submitAttachments(data, response);\n //\n // // meanwhile, store the ID and the title in some easy to access variables.\n this.returnedGroupId = parseInt(response.data.data.id);\n this.returnedGroupTitle = null === response.data.data.attributes.group_title ? response.data.data.attributes.transactions[0].description : response.data.data.attributes.group_title;\n }\n )\n .catch(error => {\n console.log('error :(');\n console.log(error.response.data);\n // oh noes Firefly III has something to bitch about.\n this.enableSubmit = true;\n // report the transaction is submitted.\n this.submittedTransaction = true;\n // // also report attachments and links are submitted:\n this.submittedAttachments = true;\n this.submittedLinks = true;\n //\n // but report an error because error:\n this.inError = true;\n this.parseErrors(error.response.data);\n }\n );\n },\n parseErrors: function (errors) {\n for (let i in this.transactions) {\n if (this.transactions.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n this.resetErrors({index: i});\n }\n }\n this.successMessage = '';\n this.errorMessage = this.$t('firefly.errors_submission');\n if (typeof errors.errors === 'undefined') {\n this.successMessage = '';\n this.errorMessage = errors.message;\n }\n\n let payload;\n let transactionIndex;\n let fieldName;\n\n // fairly basic way of exploding the error array.\n for (const key in errors.errors) {\n // console.log('Error index: \"' + key + '\"');\n if (errors.errors.hasOwnProperty(key)) {\n if (key === 'group_title') {\n this.groupTitleErrors = errors.errors[key];\n continue;\n }\n if (key !== 'group_title') {\n // lol dumbest way to explode \"transactions.0.something\" ever.\n transactionIndex = parseInt(key.split('.')[1]);\n\n fieldName = key.split('.')[2];\n\n // set error in this object thing.\n // console.log('The errors in key \"' + key + '\" are');\n // console.log(errors.errors[key]);\n switch (fieldName) {\n case 'amount':\n case 'description':\n case 'date':\n case 'tags':\n payload = {index: transactionIndex, field: fieldName, errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'budget_id':\n payload = {index: transactionIndex, field: 'budget', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'bill_id':\n payload = {index: transactionIndex, field: 'bill', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'piggy_bank_id':\n payload = {index: transactionIndex, field: 'piggy_bank', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'category_name':\n payload = {index: transactionIndex, field: 'category', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'source_name':\n case 'source_id':\n payload = {index: transactionIndex, field: 'source', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'destination_name':\n case 'destination_id':\n payload = {index: transactionIndex, field: 'destination', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'foreign_amount':\n case 'foreign_currency':\n payload = {index: transactionIndex, field: 'foreign_amount', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n }\n }\n // unique some things\n if (typeof this.transactions[transactionIndex] !== 'undefined') {\n //this.transactions[transactionIndex].errors.source = Array.from(new Set(this.transactions[transactionIndex].errors.source));\n //this.transactions[transactionIndex].errors.destination = Array.from(new Set(this.transactions[transactionIndex].errors.destination));\n }\n\n }\n }\n },\n setTransactionError: function (payload) {\n this.transactions[payload.index].errors[payload.field] = payload.errors;\n },\n resetErrors(payload) {\n this.transactions[payload.index].errors = lodashClonedeep(getDefaultErrors());\n },\n\n deleteOriginalLinks: function (transaction) {\n console.log(transaction.links);\n for (let i in transaction.links) {\n if (transaction.links.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n let current = transaction.links[i];\n let url = '/api/v1/transaction_links/' + current.id;\n axios.delete(url).then(response => {\n // TODO response\n });\n }\n }\n },\n\n /**\n * Submit transaction links.\n * TODO same method as CREATE\n */\n submitTransactionLinks() {\n let total = 0;\n let promises = [];\n\n console.log('submitTransactionLinks()');\n for (let i in this.transactions) {\n if (this.transactions.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n // original transaction present?\n let currentTransaction = this.transactions[i];\n let originalTransaction = this.originalTransactions.hasOwnProperty(i) ? this.originalTransactions[i] : {};\n // compare links:\n let newLinks = this.compareLinks(currentTransaction.links);\n let originalLinks = this.compareLinks(originalTransaction.links);\n if (newLinks !== originalLinks) {\n if ('[]' !== originalLinks) {\n this.deleteOriginalLinks(originalTransaction);\n }\n\n console.log('links are different!');\n // console.log(newLinks);\n // console.log(originalLinks);\n for (let ii in currentTransaction.links) {\n if (currentTransaction.links.hasOwnProperty(ii) && /^0$|^[1-9]\\d*$/.test(ii) && ii <= 4294967294) {\n let currentLink = currentTransaction.links[ii];\n let linkObject = {\n inward_id: currentTransaction.transaction_journal_id,\n outward_id: currentTransaction.transaction_journal_id,\n link_type_id: 'something'\n };\n\n let parts = currentLink.link_type_id.split('-');\n linkObject.link_type_id = parts[0];\n if ('inward' === parts[1]) {\n linkObject.inward_id = currentLink.transaction_journal_id;\n }\n if ('outward' === parts[1]) {\n linkObject.outward_id = currentLink.transaction_journal_id;\n }\n\n console.log(linkObject);\n total++;\n // submit transaction link:\n promises.push(axios.post('./api/v1/transaction_links', linkObject).then(response => {\n // TODO error handling.\n }));\n }\n }\n // shouldLinks = true;\n }\n\n }\n }\n if (0 === total) {\n this.submittedLinks = true;\n return;\n }\n Promise.all(promises).then(function () {\n this.submittedLinks = true;\n });\n },\n finalizeSubmit: function () {\n console.log('now in finalizeSubmit()');\n console.log('submittedTransaction : ' + this.submittedTransaction);\n console.log('submittedLinks : ' + this.submittedLinks);\n console.log('submittedAttachments : ' + this.submittedAttachments);\n\n if (this.submittedTransaction && this.submittedAttachments && this.submittedLinks) {\n console.log('all true');\n console.log('inError = ' + this.inError);\n console.log('stayHere = ' + this.stayHere);\n console.log('returnedGroupId = ' + this.returnedGroupId);\n\n // no error + no changes + no redirect\n if (true === this.stayHere && false === this.inError && 0 === this.returnedGroupId) {\n console.log('no error + no changes + no redirect');\n // show message:\n this.errorMessage = '';\n this.successMessage = '';\n // maybe nothing changed in post\n this.warningMessage = this.$t('firefly.transaction_updated_no_changes', {ID: this.returnedGroupId, title: this.returnedGroupTitle});\n }\n\n // no error + no changes + redirect\n if (false === this.stayHere && false === this.inError && 0 === this.returnedGroupId) {\n console.log('no error + no changes + redirect');\n window.location.href = (window.previousURL ?? '/') + '?transaction_group_id=' + this.groupId + '&message=no_change';\n }\n // no error + changes + no redirect\n if (true === this.stayHere && false === this.inError && 0 !== this.returnedGroupId) {\n console.log('no error + changes + redirect');\n // show message:\n this.errorMessage = '';\n this.warningMessage = '';\n // maybe nothing changed in post\n this.successMessage = this.$t('firefly.transaction_updated_link', {ID: this.returnedGroupId, title: this.returnedGroupTitle});\n }\n\n // no error + changes + redirect\n if (false === this.stayHere && false === this.inError && 0 !== this.returnedGroupId) {\n console.log('no error + changes + redirect');\n window.location.href = (window.previousURL ?? '/') + '?transaction_group_id=' + this.groupId + '&message=updated';\n }\n console.log('end of the line');\n // enable flags:\n this.enableSubmit = true;\n this.submittedTransaction = false;\n this.submittedLinks = false;\n this.submittedAttachments = false;\n this.inError = false;\n\n // reset attachments (always do this)\n for (let i in this.transactions) {\n if (this.transactions.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n if (this.transactions.hasOwnProperty(i)) {\n // TODO\n }\n }\n }\n }\n }\n }\n}\n</script>\n\n<style scoped>\n\n</style>","import mod from \"-!../../../node_modules/babel-loader/lib/index.js??ref--4-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Edit.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../node_modules/babel-loader/lib/index.js??ref--4-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Edit.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./Edit.vue?vue&type=template&id=7b268106&scoped=true&\"\nimport script from \"./Edit.vue?vue&type=script&lang=js&\"\nexport * from \"./Edit.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"7b268106\",\n null\n \n)\n\nexport default component.exports","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('Alert',{attrs:{\"message\":_vm.errorMessage,\"type\":\"danger\"}}),_vm._v(\" \"),_c('Alert',{attrs:{\"message\":_vm.successMessage,\"type\":\"success\"}}),_vm._v(\" \"),_c('Alert',{attrs:{\"message\":_vm.warningMessage,\"type\":\"warning\"}}),_vm._v(\" \"),_c('SplitPills',{attrs:{\"transactions\":_vm.transactions}}),_vm._v(\" \"),_c('div',{staticClass:\"tab-content\"},_vm._l((this.transactions),function(transaction,index){return _c('SplitForm',{key:index,attrs:{\"count\":_vm.transactions.length,\"transaction\":transaction,\"allowed-opposing-types\":_vm.allowedOpposingTypes,\"custom-fields\":_vm.customFields,\"date\":_vm.date,\"time\":_vm.time,\"index\":index,\"transaction-type\":_vm.transactionType,\"destination-allowed-types\":_vm.destinationAllowedTypes,\"source-allowed-types\":_vm.sourceAllowedTypes,\"allow-switch\":false,\"submitted-transaction\":_vm.submittedTransaction},on:{\"uploaded-attachments\":function($event){return _vm.uploadedAttachment($event)},\"set-marker-location\":function($event){return _vm.storeLocation($event)},\"set-account\":function($event){return _vm.storeAccountValue($event)},\"set-date\":function($event){return _vm.storeDate($event)},\"set-time\":function($event){return _vm.storeTime($event)},\"set-field\":function($event){return _vm.storeField($event)},\"remove-transaction\":function($event){return _vm.removeTransaction($event)},\"selected-attachments\":function($event){return _vm.selectedAttachments($event)}}})}),1),_vm._v(\" \"),_c('div',{staticClass:\"row\"},[_c('div',{staticClass:\"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12\"},[(_vm.transactions.length > 1)?_c('div',{staticClass:\"card\"},[_c('div',{staticClass:\"card-body\"},[_c('div',{staticClass:\"row\"},[_c('div',{staticClass:\"col\"},[_c('TransactionGroupTitle',{attrs:{\"errors\":this.groupTitleErrors},on:{\"set-group-title\":function($event){return _vm.storeGroupTitle($event)}},model:{value:(this.groupTitle),callback:function ($$v) {_vm.$set(this, \"groupTitle\", $$v)},expression:\"this.groupTitle\"}})],1)])])]):_vm._e()]),_vm._v(\" \"),_c('div',{staticClass:\"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12\"},[_c('div',{staticClass:\"card\"},[_c('div',{staticClass:\"card-body\"},[_c('div',{staticClass:\"row\"},[_c('div',{staticClass:\"col\"},[_c('div',{staticClass:\"text-xs d-none d-lg-block d-xl-block\"},[_vm._v(\"\\n  \\n \")]),_vm._v(\" \"),_c('button',{staticClass:\"btn btn-outline-primary btn-block\",on:{\"click\":_vm.addTransaction}},[_c('i',{staticClass:\"far fa-clone\"}),_vm._v(\" \"+_vm._s(_vm.$t('firefly.add_another_split'))+\"\\n \")])]),_vm._v(\" \"),_c('div',{staticClass:\"col\"},[_c('div',{staticClass:\"text-xs d-none d-lg-block d-xl-block\"},[_vm._v(\"\\n  \\n \")]),_vm._v(\" \"),_c('button',{staticClass:\"btn btn-info btn-block\",attrs:{\"disabled\":!_vm.enableSubmit},on:{\"click\":_vm.submitTransaction}},[(_vm.enableSubmit)?_c('span',[_c('i',{staticClass:\"far fa-save\"}),_vm._v(\" \"+_vm._s(_vm.$t('firefly.update_transaction')))]):_vm._e(),_vm._v(\" \"),(!_vm.enableSubmit)?_c('span',[_c('i',{staticClass:\"fas fa-spinner fa-spin\"})]):_vm._e()])])]),_vm._v(\" \"),_c('div',{staticClass:\"row\"},[_c('div',{staticClass:\"col\"},[_vm._v(\"\\n  \\n \")]),_vm._v(\" \"),_c('div',{staticClass:\"col\"},[_c('div',{staticClass:\"form-check\"},[_c('input',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.stayHere),expression:\"stayHere\"}],staticClass:\"form-check-input\",attrs:{\"id\":\"stayHere\",\"type\":\"checkbox\"},domProps:{\"checked\":Array.isArray(_vm.stayHere)?_vm._i(_vm.stayHere,null)>-1:(_vm.stayHere)},on:{\"change\":function($event){var $$a=_vm.stayHere,$$el=$event.target,$$c=$$el.checked?(true):(false);if(Array.isArray($$a)){var $$v=null,$$i=_vm._i($$a,$$v);if($$el.checked){$$i<0&&(_vm.stayHere=$$a.concat([$$v]))}else{$$i>-1&&(_vm.stayHere=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}}else{_vm.stayHere=$$c}}}}),_vm._v(\" \"),_c('label',{staticClass:\"form-check-label\",attrs:{\"for\":\"stayHere\"}},[_c('span',{staticClass:\"small\"},[_vm._v(_vm._s(_vm.$t('firefly.after_update_create_another')))])])])])])])])])])],1)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","/*\n * edit.js\n * Copyright (c) 2020 [email protected]\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 <https://www.gnu.org/licenses/>.\n */\n\nimport store from \"../../components/store\";\nimport Edit from \"../../components/transactions/Edit\";\nimport Vue from \"vue\";\n\nrequire('../../bootstrap');\n\nVue.config.productionTip = false;\n// i18n\nlet i18n = require('../../i18n');\n\nlet props = {};\nnew Vue({\n i18n,\n store,\n render(createElement) {\n return createElement(Edit, {props: props});\n },\n beforeCreate() {\n this.$store.commit('initialiseStore');\n this.$store.dispatch('updateCurrencyPreference');\n },\n }).$mount('#transactions_edit');\n"],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"sources":["webpack:///src/components/transactions/Edit.vue","webpack:///./src/components/transactions/Edit.vue?f2c6","webpack:///./src/components/transactions/Edit.vue","webpack:///./src/components/transactions/Edit.vue?2290","webpack:///./src/pages/transactions/edit.js"],"names":["name","created","this","groupId","parseInt","parts","length","getTransactionGroup","getAllowedOpposingTypes","getCustomFields","data","successMessage","errorMessage","warningMessage","transactions","originalTransactions","groupTitle","originalGroupTitle","transactionType","groupTitleErrors","customFields","returnedGroupId","returnedGroupTitle","date","Date","time","originalDate","originalTime","submittedTransaction","submittedLinks","submittedAttachments","inError","allowedOpposingTypes","destinationAllowedTypes","sourceAllowedTypes","enableSubmit","stayHere","components","Alert","SplitPills","SplitForm","TransactionGroupTitle","watch","finalizeSubmit","methods","axios","get","parseTransactionGroup","attributes","group_title","hasOwnProperty","i","test","push","result","lodashClonedeep","parseLinks","transaction_journal_id","parseTransaction","index","array","type","charAt","toUpperCase","slice","source_type","destination_type","description","source_account_id","source_id","source_account_name","source_name","source_account_type","destination_account_id","destination_id","destination_account_name","destination_name","destination_account_type","amount","currency_id","foreign_amount","foreign_currency_id","category","category_name","budget_id","bill_id","tags","interest_date","substr","book_date","process_date","due_date","payment_date","invoice_date","internal_reference","external_url","external_uri","external_id","notes","location","zoom_level","longitude","latitude","errors","journalId","parseLink","opposingId","link","outward_id","linkDirection","promises","Promise","resolve","link_type_id","all","then","journals","journal","id","linkTypeId","direction","transaction_group_id","responses","currency_code","uploadedAttachment","console","log","payload","storeLocation","zoomLevel","lng","lat","storeAccountValue","storeDate","storeTime","storeField","field","value","removeTransaction","splice","storeGroupTitle","selectedAttachments","addTransaction","newTransaction","submitTransaction","submission","shouldSubmit","basicFields","ii","currentTransaction","fieldName","originalTransaction","diff","piggy_bank_id","JSON","stringify","currentTag","text","shouldLinks","shouldUpload","theDate","setHours","getHours","setMinutes","getMinutes","setSeconds","getSeconds","dateStr","Object","keys","transactionCount","submitUpdate","submitTransactionLinks","compareLinks","compare","put","url","parseErrors","resetErrors","$t","message","key","transactionIndex","split","setTransactionError","deleteOriginalLinks","transaction","links","newLinks","originalLinks","inward_id","linkObject","currentLink","total","post","window","href","_vm","_h","$createElement","_c","_self","attrs","_v","staticClass","_l","on","$event","model","callback","$$v","$set","expression","_e","_s","directives","rawName","domProps","Array","isArray","_i","$$a","$$el","target","$$c","checked","$$i","concat","require","Vue","config","productionTip","i18n","props","store","render","createElement","Edit","beforeCreate","$store","commit","dispatch","$mount"],"mappings":"gaA+GA,YC/GoM,EDsHpM,CACEA,KAAM,OACNC,QAFF,WAGI,IAAJ,sCACIC,KAAKC,QAAUC,SAASC,EAAMA,EAAMC,OAAS,IAE7CJ,KAAKK,sBACLL,KAAKM,0BACLN,KAAKO,mBAEPC,KAVF,WAWI,MAAO,CACLC,eAAgB,GAChBC,aAAc,GACdC,eAAgB,GAGh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F,EAAG,OAAO,CAACI,YAAY,SAAS,CAACP,EAAIM,GAAGN,EAAIiB,GAAGjB,EAAIlB,GAAG,4DAA4D,KAChgI,IDUpB,EACA,KACA,WACA,M,wBEUFiD,EAAQ,IAERC,IAAIC,OAAOC,eAAgB,EAE3B,IAAIC,EAAOJ,EAAQ,IAEfK,EAAQ,GACZ,IAAIJ,IAAI,CACIG,OACAE,UACAC,OAHJ,SAGWC,GACH,OAAOA,EAAcC,EAAM,CAACJ,MAAOA,KAEvCK,aANJ,WAOQ5O,KAAK6O,OAAOC,OAAO,mBACnB9O,KAAK6O,OAAOE,SAAS,+BAE1BC,OAAO,wB","file":"/public/js/transactions/edit.js","sourcesContent":["<!--\n - Edit.vue\n - Copyright (c) 2021 [email protected]\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 <https://www.gnu.org/licenses/>.\n -->\n\n<template>\n <div>\n <Alert :message=\"errorMessage\" type=\"danger\"/>\n <Alert :message=\"successMessage\" type=\"success\"/>\n <Alert :message=\"warningMessage\" type=\"warning\"/>\n <SplitPills :transactions=\"transactions\"/>\n\n <div class=\"tab-content\">\n <SplitForm\n v-for=\"(transaction, index) in this.transactions\"\n v-bind:key=\"index\"\n :count=\"transactions.length\"\n :transaction=\"transaction\"\n :allowed-opposing-types=\"allowedOpposingTypes\"\n :custom-fields=\"customFields\"\n :date=\"date\"\n :time=\"time\"\n :index=\"index\"\n :transaction-type=\"transactionType\"\n :destination-allowed-types=\"destinationAllowedTypes\"\n :source-allowed-types=\"sourceAllowedTypes\"\n :allow-switch=\"false\"\n :submitted-transaction=\"submittedTransaction\"\n v-on:uploaded-attachments=\"uploadedAttachment($event)\"\n v-on:set-marker-location=\"storeLocation($event)\"\n v-on:set-account=\"storeAccountValue($event)\"\n v-on:set-date=\"storeDate($event)\"\n v-on:set-time=\"storeTime($event)\"\n v-on:set-field=\"storeField($event)\"\n v-on:remove-transaction=\"removeTransaction($event)\"\n v-on:selected-attachments=\"selectedAttachments($event)\"\n />\n </div>\n\n <!-- bottom buttons etc -->\n <div class=\"row\">\n <!-- group title -->\n <div class=\"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12\">\n <div v-if=\"transactions.length > 1\" class=\"card\">\n <div class=\"card-body\">\n <div class=\"row\">\n <div class=\"col\">\n <TransactionGroupTitle v-model=\"this.groupTitle\" :errors=\"this.groupTitleErrors\" v-on:set-group-title=\"storeGroupTitle($event)\"/>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12\">\n <!-- buttons -->\n <div class=\"card\">\n <div class=\"card-body\">\n <div class=\"row\">\n <div class=\"col\">\n <div class=\"text-xs d-none d-lg-block d-xl-block\">\n &nbsp;\n </div>\n <button class=\"btn btn-outline-primary btn-block\" @click=\"addTransaction\"><i class=\"far fa-clone\"></i> {{ $t('firefly.add_another_split') }}\n </button>\n </div>\n <div class=\"col\">\n <div class=\"text-xs d-none d-lg-block d-xl-block\">\n &nbsp;\n </div>\n <button :disabled=\"!enableSubmit\" class=\"btn btn-info btn-block\" @click=\"submitTransaction\">\n <span v-if=\"enableSubmit\"><i class=\"far fa-save\"></i> {{ $t('firefly.update_transaction') }}</span>\n <span v-if=\"!enableSubmit\"><i class=\"fas fa-spinner fa-spin\"></i></span>\n </button>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col\">\n &nbsp;\n </div>\n <div class=\"col\">\n <div class=\"form-check\">\n <input id=\"stayHere\" v-model=\"stayHere\" class=\"form-check-input\" type=\"checkbox\">\n <label class=\"form-check-label\" for=\"stayHere\">\n <span class=\"small\">{{ $t('firefly.after_update_create_another') }}</span>\n </label>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<script>\nconst lodashClonedeep = require('lodash.clonedeep');\nimport Alert from '../partials/Alert';\nimport SplitPills from \"./SplitPills\";\nimport SplitForm from \"./SplitForm\";\nimport TransactionGroupTitle from \"./TransactionGroupTitle\";\nimport {getDefaultErrors, getDefaultTransaction, toW3CString} from '../shared/transactions';\n\nexport default {\n name: \"Edit\",\n created() {\n let parts = window.location.pathname.split('/');\n this.groupId = parseInt(parts[parts.length - 1]);\n\n this.getTransactionGroup();\n this.getAllowedOpposingTypes();\n this.getCustomFields();\n },\n data() {\n return {\n successMessage: '',\n errorMessage: '',\n warningMessage: '',\n\n // transaction props\n transactions: [],\n originalTransactions: [],\n groupTitle: '',\n originalGroupTitle: '',\n transactionType: 'any',\n groupId: 0,\n\n // errors in the group title:\n groupTitleErrors: [],\n\n // which custom fields to show\n customFields: {},\n\n // group ID + title once submitted:\n returnedGroupId: 0,\n returnedGroupTitle: '',\n\n // date and time of the transaction,\n date: new Date,\n time: new Date,\n originalDate: new Date,\n originalTime: new Date,\n\n // things the process is done working on (3 phases):\n submittedTransaction: false,\n submittedLinks: false,\n submittedAttachments: false,\n inError: false,\n\n // meta data for accounts\n allowedOpposingTypes: {},\n destinationAllowedTypes: [],\n sourceAllowedTypes: [],\n\n // states for the form (makes sense right)\n enableSubmit: true,\n stayHere: false,\n\n }\n },\n components: {\n Alert,\n SplitPills,\n SplitForm,\n TransactionGroupTitle\n },\n\n watch: {\n submittedTransaction: function () {\n // see finalizeSubmit()\n this.finalizeSubmit();\n },\n submittedLinks: function () {\n // see finalizeSubmit()\n this.finalizeSubmit();\n },\n submittedAttachments: function () {\n // see finalizeSubmit()\n this.finalizeSubmit();\n }\n },\n\n methods: {\n /**\n * Grap transaction group from URL and submit GET.\n */\n getTransactionGroup: function () {\n axios.get('./api/v1/transactions/' + this.groupId)\n .then(response => {\n this.parseTransactionGroup(response.data);\n }\n ).catch(error => {\n // console.log('I failed :(');\n // console.log(error);\n });\n },\n /**\n * Parse transaction group. Title is easy, transactions have their own method.\n * @param response\n */\n parseTransactionGroup: function (response) {\n // console.log('Will now parse');\n // console.log(response);\n let attributes = response.data.attributes;\n let transactions = attributes.transactions.reverse();\n this.groupTitle = attributes.group_title;\n this.originalGroupTitle = attributes.group_title;\n\n for (let i in transactions) {\n if (transactions.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n let result = this.parseTransaction(parseInt(i), transactions[i]);\n this.transactions.push(result);\n this.originalTransactions.push(lodashClonedeep(result));\n // pick up the links of this transaction:\n this.parseLinks(parseInt(result.transaction_journal_id), parseInt(i));\n }\n }\n },\n /**\n * Parse a single transaction.\n *\n * @param index\n * @param array\n */\n parseTransaction: function (index, array) {\n //console.log('index: ' + index);\n if (0 === index) {\n this.transactionType = array.type.charAt(0).toUpperCase() + array.type.slice(1);\n this.sourceAllowedTypes = [array.source_type];\n this.destinationAllowedTypes = [array.destination_type];\n this.date = new Date(array.date);\n this.time = new Date(array.date);\n this.originalDate = new Date(array.date);\n this.originalTime = new Date(array.date);\n }\n let result = getDefaultTransaction();\n // parsing here:\n result.description = array.description;\n result.transaction_journal_id = parseInt(array.transaction_journal_id);\n // accounts:\n result.source_account_id = array.source_id;\n result.source_account_name = array.source_name;\n result.source_account_type = array.source_type;\n\n result.destination_account_id = array.destination_id;\n result.destination_account_name = array.destination_name;\n result.destination_account_type = array.destination_type;\n\n // amount:\n result.amount = array.amount;\n result.currency_id = array.currency_id;\n result.foreign_amount = array.foreign_amount;\n result.foreign_currency_id = array.foreign_currency_id;\n\n // meta data\n result.category = array.category_name;\n result.budget_id = array.budget_id;\n result.bill_id = array.bill_id ?? 0;\n\n result.tags = array.tags;\n\n // optional date fields (6x):\n result.interest_date = array.interest_date ? array.interest_date.substr(0, 10) : '';\n result.book_date = array.book_date ? array.book_date.substr(0, 10) : '';\n result.process_date = array.process_date ? array.process_date.substr(0, 10) : '';\n result.due_date = array.due_date ? array.due_date.substr(0, 10) : '';\n result.payment_date = array.payment_date ? array.payment_date.substr(0, 10) : '';\n result.invoice_date = array.invoice_date ? array.invoice_date.substr(0, 10) : '';\n\n // optional other fields:\n result.internal_reference = array.internal_reference;\n result.external_url = array.external_uri;\n result.external_id = array.external_id;\n result.notes = array.notes;\n // location:\n result.location = {\n zoom_level: array.zoom_level,\n longitude: array.longitude,\n latitude: array.latitude,\n };\n result.zoom_level = array.zoom_level;\n result.longitude = array.longitude;\n result.latitude = array.latitude;\n\n // error handling\n result.errors = getDefaultErrors();\n return result;\n },\n /**\n * Get the links of this transaction group from the API.\n */\n parseLinks: function (journalId, index) {\n axios.get('./api/v1/transaction-journals/' + journalId + '/links')\n .then(response => {\n let links = response.data.data;\n for (let i in links) {\n if (links.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n this.parseLink(links[i], journalId, index);\n }\n }\n });\n },\n\n /**\n * Process individual link from the API.\n */\n parseLink: function (link, journalId, index) {\n let promises = [];\n let opposingId = parseInt(link.attributes.inward_id);\n let linkDirection = 'inward';\n if (opposingId === journalId) {\n opposingId = parseInt(link.attributes.outward_id);\n linkDirection = 'outward';\n }\n // add meta data to promise context.\n promises.push(new Promise((resolve) => {\n resolve(\n {\n link: link,\n journalId: journalId,\n opposingId: opposingId,\n index: index,\n direction: linkDirection\n }\n );\n }));\n\n // get stuff from the API:\n promises.push(axios.get('./api/v1/transaction-journals/' + opposingId));\n promises.push(axios.get('./api/v1/transaction_links/' + link.attributes.link_type_id));\n\n Promise.all(promises).then(responses => {\n let journals = responses[1].data.data.attributes.transactions;\n let opposingId = responses[0].opposingId;\n let journal = {};\n // loop over journals to get the correct one:\n for (let i in journals) {\n if (journals.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n if (journals[i].transaction_journal_id === opposingId) {\n journal = journals[i];\n }\n }\n }\n let index = responses[0].index;\n let direction = responses[0].direction;\n let linkTypeId = responses[2].data.data.id;\n let object = {\n id: link.id,\n link_type_id: linkTypeId + '-' + direction,\n transaction_group_id: responses[1].data.data.id,\n transaction_journal_id: journal.transaction_journal_id,\n description: journal.description,\n type: journal.type,\n currency_code: journal.currency_code,\n amount: journal.amount\n };\n this.transactions[index].links.push(object);\n this.originalTransactions[index].links.push(object);\n });\n },\n /**\n * TODO same method as Create\n * Get API value.\n */\n getAllowedOpposingTypes: function () {\n axios.get('./api/v1/configuration/firefly.allowed_opposing_types')\n .then(response => {\n this.allowedOpposingTypes = response.data.data.value;\n // console.log('Set allowedOpposingTypes');\n });\n },\n /**\n * Get API value.\n */\n getCustomFields: function () {\n axios.get('./api/v1/preferences/transaction_journal_optional_fields').then(response => {\n this.customFields = response.data.data.attributes.data;\n });\n },\n uploadedAttachment: function (payload) {\n console.log('event: uploadedAttachment');\n console.log(payload);\n },\n storeLocation: function (payload) {\n this.transactions[payload.index].zoom_level = payload.zoomLevel;\n this.transactions[payload.index].longitude = payload.lng;\n this.transactions[payload.index].latitude = payload.lat;\n },\n storeAccountValue: function (payload) {\n let direction = payload.direction;\n let index = payload.index;\n this.transactions[index][direction + '_account_id'] = payload.id;\n this.transactions[index][direction + '_account_type'] = payload.type;\n this.transactions[index][direction + '_account_name'] = payload.name;\n },\n storeDate: function (payload) {\n // console.log('event: storeDate');\n // console.log(payload);\n this.date = payload.date;\n },\n storeTime: function (payload) {\n this.time = payload.time;\n // console.log('event: storeTime');\n // console.log(payload);\n },\n storeField: function (payload) {\n let field = payload.field;\n if ('category' === field) {\n field = 'category_name';\n }\n // console.log('event: storeField(' + field + ')');\n this.transactions[payload.index][field] = payload.value;\n\n },\n removeTransaction: function (payload) {\n this.transactions.splice(payload.index, 1);\n // this kills the original transactions.\n this.originalTransactions = [];\n },\n storeGroupTitle: function (payload) {\n this.groupTitle = payload;\n },\n selectedAttachments: function (payload) {\n for (let i in this.transactions) {\n if (this.transactions.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n if (parseInt(this.transactions[i].transaction_journal_id) === parseInt(payload)) {\n // console.log('selectedAttachments ' + payload);\n this.transactions[i].selectedAttachments = true;\n }\n }\n }\n },\n addTransaction: function () {\n let newTransaction = getDefaultTransaction();\n newTransaction.errors = getDefaultErrors();\n this.transactions.push(newTransaction);\n },\n submitTransaction: function () {\n let submission = {transactions: []};\n let shouldSubmit = false;\n let shouldLinks = false;\n let shouldUpload = false;\n if (this.groupTitle !== this.originalGroupTitle) {\n submission.group_title = this.groupTitle;\n shouldSubmit = true;\n }\n let transactionCount = this.originalTransactions.length;\n for (let i in this.transactions) {\n if (this.transactions.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n // original transaction present?\n let currentTransaction = this.transactions[i];\n let originalTransaction = this.originalTransactions.hasOwnProperty(i) ? this.originalTransactions[i] : {};\n\n let diff = {};\n\n // compare basic fields:\n let basicFields = [\n 'description',\n 'source_account_id', 'source_account_name',\n 'destination_account_id', 'destination_account_name',\n 'amount', 'foreign_amount', 'foreign_currency_id',\n 'category_name', 'budget_id', 'bill_id',\n 'interest_date', 'book_date', 'due_date', 'payment_date', 'invoice_date',\n 'external_url', 'internal_reference', 'external_id', 'notes',\n 'zoom_level', 'longitude', 'latitude'\n ];\n\n for (let ii in basicFields) {\n if (basicFields.hasOwnProperty(ii) && /^0$|^[1-9]\\d*$/.test(ii) && ii <= 4294967294) {\n let fieldName = basicFields[ii];\n if (currentTransaction[fieldName] !== originalTransaction[fieldName]) {\n // console.log('Index ' + i + ': Field ' + fieldName + ' updated (\"' + originalTransaction[fieldName] + '\" > \"' + currentTransaction[fieldName] + '\")');\n // console.log(originalTransaction[fieldName]);\n // console.log(currentTransaction[fieldName]);\n diff[fieldName] = currentTransaction[fieldName];\n shouldSubmit = true;\n }\n }\n }\n if (0 !== currentTransaction.piggy_bank_id) {\n diff.piggy_bank_id = currentTransaction.piggy_bank_id;\n shouldSubmit = true;\n }\n if (JSON.stringify(currentTransaction.tags) !== JSON.stringify(originalTransaction.tags)) {\n // console.log('tags are different');\n // console.log(currentTransaction.tags);\n // console.log(originalTransaction.tags);\n diff.tags = [];//currentTransaction.tags;\n\n if (0 !== currentTransaction.tags.length) {\n for (let ii in currentTransaction.tags) {\n if (currentTransaction.tags.hasOwnProperty(ii) && /^0$|^[1-9]\\d*$/.test(ii) && ii <= 4294967294) {\n // array.tags\n let currentTag = currentTransaction.tags[ii];\n if(typeof currentTag === 'object' && null !== currentTag) {\n diff.tags.push(currentTag.text);\n }\n if(typeof currentTag === 'string') {\n diff.tags.push(currentTag);\n }\n }\n }\n }\n\n shouldSubmit = true;\n }\n\n // compare links:\n let newLinks = this.compareLinks(currentTransaction.links);\n let originalLinks = this.compareLinks(originalTransaction.links);\n // console.log('links are?');\n // console.log(newLinks);\n // console.log(originalLinks);\n if (newLinks !== originalLinks) {\n // console.log('links are different!');\n // console.log(newLinks);\n // console.log(originalLinks);\n shouldLinks = true;\n }\n // this.transactions[i].selectedAttachments\n // console.log(typeof currentTransaction.selectedAttachments);\n // console.log(currentTransaction.selectedAttachments);\n if (typeof currentTransaction.selectedAttachments !== 'undefined' && true === currentTransaction.selectedAttachments) {\n // must upload!\n shouldUpload = true;\n }\n\n let dateStr = 'invalid';\n if (\n this.date.toISOString() !== this.originalDate.toISOString() ||\n this.time.toISOString() !== this.originalTime.toISOString()\n ) {\n console.log('Date and/or time is changed');\n // set date and time!\n shouldSubmit = true;\n let theDate = this.date;\n // update time in date object.\n theDate.setHours(this.time.getHours());\n theDate.setMinutes(this.time.getMinutes());\n theDate.setSeconds(this.time.getSeconds());\n dateStr = toW3CString(theDate);\n diff.date = dateStr;\n }\n if (Object.keys(diff).length === 0 && transactionCount > 1) {\n diff.transaction_journal_id = originalTransaction.transaction_journal_id;\n submission.transactions.push(lodashClonedeep(diff));\n shouldSubmit = true;\n } else if (Object.keys(diff).length !== 0) {\n diff.transaction_journal_id = originalTransaction.transaction_journal_id;\n submission.transactions.push(lodashClonedeep(diff));\n shouldSubmit = true;\n }\n }\n }\n\n console.log('submitTransaction');\n console.log('shouldUpload : ' + shouldUpload);\n console.log('shouldLinks : ' + shouldLinks);\n console.log('shouldSubmit : ' + shouldSubmit);\n if (shouldSubmit) {\n this.submitUpdate(submission, shouldLinks, shouldUpload);\n }\n if (!shouldSubmit) {\n this.submittedTransaction = true;\n }\n if (!shouldLinks) {\n this.submittedLinks = true;\n }\n if (!shouldUpload) {\n this.submittedAttachments = true;\n }\n if (!shouldSubmit && shouldLinks) {\n this.submitTransactionLinks();\n }\n\n if (!shouldSubmit && shouldLinks) {\n // TODO\n //this.submittedAttachments();\n }\n console.log('Done with submit methd.');\n //console.log(submission);\n },\n compareLinks: function (array) {\n let compare = [];\n for (let i in array) {\n if (array.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n compare.push(\n {\n amount: array[i].amount,\n currency_code: array[i].currency_code,\n description: array[i].description,\n link_type_id: array[i].link_type_id,\n transaction_group_id: array[i].transaction_group_id,\n type: array[i].type,\n }\n );\n }\n }\n // console.log('compareLinks');\n // console.log(compare);\n return JSON.stringify(compare);\n },\n submitUpdate: function (submission, shouldLinks, shouldUpload) {\n console.log('submitUpdate');\n this.inError = false;\n const url = './api/v1/transactions/' + this.groupId;\n console.log(submission);\n axios.put(url, submission)\n .then(response => {\n console.log('Response is OK!');\n // report the transaction is submitted.\n this.submittedTransaction = true;\n\n // submit links and attachments (can only be done when the transaction is created)\n if (shouldLinks) {\n console.log('Need to update links.');\n this.submitTransactionLinks();\n }\n if (!shouldLinks) {\n console.log('No need to update links.');\n }\n // TODO attachments:\n // this.submitAttachments(data, response);\n //\n // // meanwhile, store the ID and the title in some easy to access variables.\n this.returnedGroupId = parseInt(response.data.data.id);\n this.returnedGroupTitle = null === response.data.data.attributes.group_title ? response.data.data.attributes.transactions[0].description : response.data.data.attributes.group_title;\n }\n )\n .catch(error => {\n console.log('error :(');\n console.log(error.response.data);\n // oh noes Firefly III has something to bitch about.\n this.enableSubmit = true;\n // report the transaction is submitted.\n this.submittedTransaction = true;\n // // also report attachments and links are submitted:\n this.submittedAttachments = true;\n this.submittedLinks = true;\n //\n // but report an error because error:\n this.inError = true;\n this.parseErrors(error.response.data);\n }\n );\n },\n parseErrors: function (errors) {\n for (let i in this.transactions) {\n if (this.transactions.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n this.resetErrors({index: i});\n }\n }\n this.successMessage = '';\n this.errorMessage = this.$t('firefly.errors_submission');\n if (typeof errors.errors === 'undefined') {\n this.successMessage = '';\n this.errorMessage = errors.message;\n }\n\n let payload;\n let transactionIndex;\n let fieldName;\n\n // fairly basic way of exploding the error array.\n for (const key in errors.errors) {\n // console.log('Error index: \"' + key + '\"');\n if (errors.errors.hasOwnProperty(key)) {\n if (key === 'group_title') {\n this.groupTitleErrors = errors.errors[key];\n continue;\n }\n if (key !== 'group_title') {\n // lol dumbest way to explode \"transactions.0.something\" ever.\n transactionIndex = parseInt(key.split('.')[1]);\n\n fieldName = key.split('.')[2];\n\n // set error in this object thing.\n // console.log('The errors in key \"' + key + '\" are');\n // console.log(errors.errors[key]);\n switch (fieldName) {\n case 'amount':\n case 'description':\n case 'date':\n case 'tags':\n payload = {index: transactionIndex, field: fieldName, errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'budget_id':\n payload = {index: transactionIndex, field: 'budget', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'bill_id':\n payload = {index: transactionIndex, field: 'bill', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'piggy_bank_id':\n payload = {index: transactionIndex, field: 'piggy_bank', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'category_name':\n payload = {index: transactionIndex, field: 'category', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'source_name':\n case 'source_id':\n payload = {index: transactionIndex, field: 'source', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'destination_name':\n case 'destination_id':\n payload = {index: transactionIndex, field: 'destination', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n case 'foreign_amount':\n case 'foreign_currency':\n payload = {index: transactionIndex, field: 'foreign_amount', errors: errors.errors[key]};\n this.setTransactionError(payload);\n break;\n }\n }\n // unique some things\n if (typeof this.transactions[transactionIndex] !== 'undefined') {\n //this.transactions[transactionIndex].errors.source = Array.from(new Set(this.transactions[transactionIndex].errors.source));\n //this.transactions[transactionIndex].errors.destination = Array.from(new Set(this.transactions[transactionIndex].errors.destination));\n }\n\n }\n }\n },\n setTransactionError: function (payload) {\n this.transactions[payload.index].errors[payload.field] = payload.errors;\n },\n resetErrors(payload) {\n this.transactions[payload.index].errors = lodashClonedeep(getDefaultErrors());\n },\n\n deleteOriginalLinks: function (transaction) {\n console.log(transaction.links);\n for (let i in transaction.links) {\n if (transaction.links.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n let current = transaction.links[i];\n let url = '/api/v1/transaction_links/' + current.id;\n axios.delete(url).then(response => {\n // TODO response\n });\n }\n }\n },\n\n /**\n * Submit transaction links.\n * TODO same method as CREATE\n */\n submitTransactionLinks() {\n let total = 0;\n let promises = [];\n\n console.log('submitTransactionLinks()');\n for (let i in this.transactions) {\n if (this.transactions.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n // original transaction present?\n let currentTransaction = this.transactions[i];\n let originalTransaction = this.originalTransactions.hasOwnProperty(i) ? this.originalTransactions[i] : {};\n // compare links:\n let newLinks = this.compareLinks(currentTransaction.links);\n let originalLinks = this.compareLinks(originalTransaction.links);\n if (newLinks !== originalLinks) {\n if ('[]' !== originalLinks) {\n this.deleteOriginalLinks(originalTransaction);\n }\n\n console.log('links are different!');\n // console.log(newLinks);\n // console.log(originalLinks);\n for (let ii in currentTransaction.links) {\n if (currentTransaction.links.hasOwnProperty(ii) && /^0$|^[1-9]\\d*$/.test(ii) && ii <= 4294967294) {\n let currentLink = currentTransaction.links[ii];\n let linkObject = {\n inward_id: currentTransaction.transaction_journal_id,\n outward_id: currentTransaction.transaction_journal_id,\n link_type_id: 'something'\n };\n\n let parts = currentLink.link_type_id.split('-');\n linkObject.link_type_id = parts[0];\n if ('inward' === parts[1]) {\n linkObject.inward_id = currentLink.transaction_journal_id;\n }\n if ('outward' === parts[1]) {\n linkObject.outward_id = currentLink.transaction_journal_id;\n }\n\n console.log(linkObject);\n total++;\n // submit transaction link:\n promises.push(axios.post('./api/v1/transaction_links', linkObject).then(response => {\n // TODO error handling.\n }));\n }\n }\n // shouldLinks = true;\n }\n\n }\n }\n if (0 === total) {\n this.submittedLinks = true;\n return;\n }\n Promise.all(promises).then(function () {\n this.submittedLinks = true;\n });\n },\n finalizeSubmit: function () {\n console.log('now in finalizeSubmit()');\n console.log('submittedTransaction : ' + this.submittedTransaction);\n console.log('submittedLinks : ' + this.submittedLinks);\n console.log('submittedAttachments : ' + this.submittedAttachments);\n\n if (this.submittedTransaction && this.submittedAttachments && this.submittedLinks) {\n console.log('all true');\n console.log('inError = ' + this.inError);\n console.log('stayHere = ' + this.stayHere);\n console.log('returnedGroupId = ' + this.returnedGroupId);\n\n // no error + no changes + no redirect\n if (true === this.stayHere && false === this.inError && 0 === this.returnedGroupId) {\n console.log('no error + no changes + no redirect');\n // show message:\n this.errorMessage = '';\n this.successMessage = '';\n // maybe nothing changed in post\n this.warningMessage = this.$t('firefly.transaction_updated_no_changes', {ID: this.returnedGroupId, title: this.returnedGroupTitle});\n }\n\n // no error + no changes + redirect\n if (false === this.stayHere && false === this.inError && 0 === this.returnedGroupId) {\n console.log('no error + no changes + redirect');\n window.location.href = (window.previousURL ?? '/') + '?transaction_group_id=' + this.groupId + '&message=no_change';\n }\n // no error + changes + no redirect\n if (true === this.stayHere && false === this.inError && 0 !== this.returnedGroupId) {\n console.log('no error + changes + redirect');\n // show message:\n this.errorMessage = '';\n this.warningMessage = '';\n // maybe nothing changed in post\n this.successMessage = this.$t('firefly.transaction_updated_link', {ID: this.returnedGroupId, title: this.returnedGroupTitle});\n }\n\n // no error + changes + redirect\n if (false === this.stayHere && false === this.inError && 0 !== this.returnedGroupId) {\n console.log('no error + changes + redirect');\n window.location.href = (window.previousURL ?? '/') + '?transaction_group_id=' + this.groupId + '&message=updated';\n }\n console.log('end of the line');\n // enable flags:\n this.enableSubmit = true;\n this.submittedTransaction = false;\n this.submittedLinks = false;\n this.submittedAttachments = false;\n this.inError = false;\n\n // reset attachments (always do this)\n for (let i in this.transactions) {\n if (this.transactions.hasOwnProperty(i) && /^0$|^[1-9]\\d*$/.test(i) && i <= 4294967294) {\n if (this.transactions.hasOwnProperty(i)) {\n // TODO\n }\n }\n }\n }\n }\n }\n}\n</script>\n\n<style scoped>\n\n</style>","import mod from \"-!../../../node_modules/babel-loader/lib/index.js??ref--4-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Edit.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../node_modules/babel-loader/lib/index.js??ref--4-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Edit.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./Edit.vue?vue&type=template&id=17cb1c2b&scoped=true&\"\nimport script from \"./Edit.vue?vue&type=script&lang=js&\"\nexport * from \"./Edit.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"17cb1c2b\",\n null\n \n)\n\nexport default component.exports","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('Alert',{attrs:{\"message\":_vm.errorMessage,\"type\":\"danger\"}}),_vm._v(\" \"),_c('Alert',{attrs:{\"message\":_vm.successMessage,\"type\":\"success\"}}),_vm._v(\" \"),_c('Alert',{attrs:{\"message\":_vm.warningMessage,\"type\":\"warning\"}}),_vm._v(\" \"),_c('SplitPills',{attrs:{\"transactions\":_vm.transactions}}),_vm._v(\" \"),_c('div',{staticClass:\"tab-content\"},_vm._l((this.transactions),function(transaction,index){return _c('SplitForm',{key:index,attrs:{\"count\":_vm.transactions.length,\"transaction\":transaction,\"allowed-opposing-types\":_vm.allowedOpposingTypes,\"custom-fields\":_vm.customFields,\"date\":_vm.date,\"time\":_vm.time,\"index\":index,\"transaction-type\":_vm.transactionType,\"destination-allowed-types\":_vm.destinationAllowedTypes,\"source-allowed-types\":_vm.sourceAllowedTypes,\"allow-switch\":false,\"submitted-transaction\":_vm.submittedTransaction},on:{\"uploaded-attachments\":function($event){return _vm.uploadedAttachment($event)},\"set-marker-location\":function($event){return _vm.storeLocation($event)},\"set-account\":function($event){return _vm.storeAccountValue($event)},\"set-date\":function($event){return _vm.storeDate($event)},\"set-time\":function($event){return _vm.storeTime($event)},\"set-field\":function($event){return _vm.storeField($event)},\"remove-transaction\":function($event){return _vm.removeTransaction($event)},\"selected-attachments\":function($event){return _vm.selectedAttachments($event)}}})}),1),_vm._v(\" \"),_c('div',{staticClass:\"row\"},[_c('div',{staticClass:\"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12\"},[(_vm.transactions.length > 1)?_c('div',{staticClass:\"card\"},[_c('div',{staticClass:\"card-body\"},[_c('div',{staticClass:\"row\"},[_c('div',{staticClass:\"col\"},[_c('TransactionGroupTitle',{attrs:{\"errors\":this.groupTitleErrors},on:{\"set-group-title\":function($event){return _vm.storeGroupTitle($event)}},model:{value:(this.groupTitle),callback:function ($$v) {_vm.$set(this, \"groupTitle\", $$v)},expression:\"this.groupTitle\"}})],1)])])]):_vm._e()]),_vm._v(\" \"),_c('div',{staticClass:\"col-xl-6 col-lg-6 col-md-12 col-sm-12 col-xs-12\"},[_c('div',{staticClass:\"card\"},[_c('div',{staticClass:\"card-body\"},[_c('div',{staticClass:\"row\"},[_c('div',{staticClass:\"col\"},[_c('div',{staticClass:\"text-xs d-none d-lg-block d-xl-block\"},[_vm._v(\"\\n  \\n \")]),_vm._v(\" \"),_c('button',{staticClass:\"btn btn-outline-primary btn-block\",on:{\"click\":_vm.addTransaction}},[_c('i',{staticClass:\"far fa-clone\"}),_vm._v(\" \"+_vm._s(_vm.$t('firefly.add_another_split'))+\"\\n \")])]),_vm._v(\" \"),_c('div',{staticClass:\"col\"},[_c('div',{staticClass:\"text-xs d-none d-lg-block d-xl-block\"},[_vm._v(\"\\n  \\n \")]),_vm._v(\" \"),_c('button',{staticClass:\"btn btn-info btn-block\",attrs:{\"disabled\":!_vm.enableSubmit},on:{\"click\":_vm.submitTransaction}},[(_vm.enableSubmit)?_c('span',[_c('i',{staticClass:\"far fa-save\"}),_vm._v(\" \"+_vm._s(_vm.$t('firefly.update_transaction')))]):_vm._e(),_vm._v(\" \"),(!_vm.enableSubmit)?_c('span',[_c('i',{staticClass:\"fas fa-spinner fa-spin\"})]):_vm._e()])])]),_vm._v(\" \"),_c('div',{staticClass:\"row\"},[_c('div',{staticClass:\"col\"},[_vm._v(\"\\n  \\n \")]),_vm._v(\" \"),_c('div',{staticClass:\"col\"},[_c('div',{staticClass:\"form-check\"},[_c('input',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.stayHere),expression:\"stayHere\"}],staticClass:\"form-check-input\",attrs:{\"id\":\"stayHere\",\"type\":\"checkbox\"},domProps:{\"checked\":Array.isArray(_vm.stayHere)?_vm._i(_vm.stayHere,null)>-1:(_vm.stayHere)},on:{\"change\":function($event){var $$a=_vm.stayHere,$$el=$event.target,$$c=$$el.checked?(true):(false);if(Array.isArray($$a)){var $$v=null,$$i=_vm._i($$a,$$v);if($$el.checked){$$i<0&&(_vm.stayHere=$$a.concat([$$v]))}else{$$i>-1&&(_vm.stayHere=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}}else{_vm.stayHere=$$c}}}}),_vm._v(\" \"),_c('label',{staticClass:\"form-check-label\",attrs:{\"for\":\"stayHere\"}},[_c('span',{staticClass:\"small\"},[_vm._v(_vm._s(_vm.$t('firefly.after_update_create_another')))])])])])])])])])])],1)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","/*\n * edit.js\n * Copyright (c) 2020 [email protected]\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 <https://www.gnu.org/licenses/>.\n */\n\nimport store from \"../../components/store\";\nimport Edit from \"../../components/transactions/Edit\";\nimport Vue from \"vue\";\n\nrequire('../../bootstrap');\n\nVue.config.productionTip = false;\n// i18n\nlet i18n = require('../../i18n');\n\nlet props = {};\nnew Vue({\n i18n,\n store,\n render(createElement) {\n return createElement(Edit, {props: props});\n },\n beforeCreate() {\n this.$store.commit('initialiseStore');\n this.$store.dispatch('updateCurrencyPreference');\n },\n }).$mount('#transactions_edit');\n"],"sourceRoot":""}
\ No newline at end of file