2021-03-21 18:48:47 +01:00
|
|
|
(window.webpackJsonp=window.webpackJsonp||[]).push([[9],{422:function(t,e,i){t.exports=i(431)},431:function(t,e,i){"use strict";i.r(e);var n=i(17),s=i(39),a=i(22),r=i(38),o=i(40),c=i(7),l=i(41),d={name:"Edit",created:function(){var t=window.location.pathname.split("/");this.groupId=parseInt(t[t.length-1]),this.getTransactionGroup(),this.getAllowedOpposingTypes(),this.getCustomFields()},data:function(){return{successMessage:"",errorMessage:"",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,allowedOpposingTypes:{},destinationAllowedTypes:[],sourceAllowedTypes:[],enableSubmit:!0,createAnother:!1,resetFormAfter:!1}},components:{Alert:s.a,SplitPills:a.a,SplitForm:r.a,TransactionGroupTitle:o.a},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,i=e.transactions.reverse();for(var n in this.groupTitle=e.group_title,this.originalGroupTitle=e.group_title,i)if(i.hasOwnProperty(n)&&/^0$|^[1-9]\d*$/.test(n)&&n<=4294967294){var s=this.parseTransaction(parseInt(n),i[n]);this.transactions.push(s),this.originalTransactions.push(l(s)),this.parseLinks(parseInt(s.transaction_journal_id),parseInt(n))}},parseTransaction:function(t,e){var i;0===t&&(this.transactionType=e.type.charAt(0).toUpperCase()+e.type.slice(1),this.sourceAllowedTypes=[e.source_type],this.destinationAllowedTypes=[e.destination_type],this.date=new Date(e.date),this.time=new Date(e.date),this.originalDate=new Date(e.date),this.originalTime=new Date(e.date));var n=Object(c.b)();return n.description=e.description,n.transaction_journal_id=parseInt(e.transaction_journal_id),n.source_account_id=e.source_id,n.source_account_name=e.source_name,n.source_account_type=e.source_type,n.destination_account_id=e.destination_id,n.destination_account_name=e.destination_name,n.destination_account_type=e.destination_type,n.amount=e.amount,n.currency_id=e.currency_id,n.foreign_amount=e.foreign_amount,n.foreign_currency_id=e.foreign_currency_id,n.category=e.category_name,n.budget_id=e.budget_id,n.bill_id=null!==(i=e.bill_id)&&void 0!==i?i:0,n.tags=e.tags,n.interest_date=e.interest_date?e.interest_date.substr(0,10):"",n.book_date=e.book_date?e.book_date.substr(0,10):"",n.process_date=e.process_date?e.process_date.substr(0,10):"",n.due_date=e.due_date?e.due_date.substr(0,10):"",n.payment_date=e.payment_date?e.payment_date.substr(0,10):"",n.invoice_date=e.invoice_date?e.invoice_date.substr(0,10):"",n.internal_reference=e.internal_reference,n.external_url=e.external_uri,n.external_id=e.external_id,n.notes=e.notes,n.location={zoom_level:e.zoom_level,longitude:e.longitude,latitude:e.latitude},n.zoom_level=e.zoom_level,n.longitude=e.longitude,n.latitude=e.latitude,n.errors=Object(c.a)(),n},parseLinks:function(t,e){var i=this;axios.get("./api/v1/transaction-journals/"+t+"/links").then((function(n){var s=n.data.data;for(var a in s)s.hasOwnProperty(a)&&/^0$|^[1-9]\d*$/.test(a)&&a<=4294967294&&i.parseLink(s[a],t,e)}))},parseLink:function(t,e,i){var n=this,s=[],a=parseInt(t.attributes.inward_id),r="inward";a===e&&(a=parseInt(t.attributes.outward_id),r="outward"),s.push(new Promise((function(n){n({link:t,journalId:e,opposingId:a,index:i,direction:r})}))),s.push(axios.get("./api/v1/transaction-journals/"+a)),s.push(axios.get("./api/v1/transaction_links/"+t.attributes.link_type_id)),Promise.all(s).then((function(e){var i=e[1].data.data.attributes.transactions,s=e[0].opposingId,a={};for(var r in i)i.hasOwnProperty(r)&&/^0$|^[1-9]\d*$/.test(r)&&r<=4294967294&&i[r].transaction_journal_id===s&&(a=i[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_j
|