Files
firefly-iii/public/v2/js/transactions/edit.js

2 lines
13 KiB
JavaScript
Raw Normal View History

2021-03-22 06:45:13 +01:00
(window.webpackJsonp=window.webpackJsonp||[]).push([[9],{422:function(t,e,s){t.exports=s(431)},431:function(t,e,s){"use strict";s.r(e);var i=s(17),a=s(39),n=s(22),r=s(38),o=s(40),c=s(7),d=s(41),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:"",transactions:[],originalTransactions:[],groupTitle:"",originalGroupTitle:"",transactionType:"any",groudId: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:a.a,SplitPills:n.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,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 a=this.parseTransaction(parseInt(i),s[i]);this.transactions.push(a),this.originalTransactions.push(d(a)),this.parseLinks(parseInt(a.transaction_journal_id),parseInt(i))}},parseTransaction:function(t,e){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 s=Object(c.b)();return s.description=e.description,s.transaction_journal_id=parseInt(e.transaction_journal_id),s.source_account_id=e.source_id,s.source_account_name=e.source_name,s.source_account_type=e.source_type,s.destination_account_id=e.destination_id,s.destination_account_name=e.destination_name,s.destination_account_type=e.destination_type,s.amount=e.amount,s.currency_id=e.currency_id,s.foreign_amount=e.foreign_amount,s.foreign_currency_id=e.foreign_currency_id,s.category=e.category_name,s.budget_id=e.budget_id,s.bill_id=e.bill_id,s.tags=e.tags,s.interest_date=e.interest_date?e.interest_date.substr(0,10):"",s.book_date=e.book_date?e.book_date.substr(0,10):"",s.process_date=e.process_date?e.process_date.substr(0,10):"",s.due_date=e.due_date?e.due_date.substr(0,10):"",s.payment_date=e.payment_date?e.payment_date.substr(0,10):"",s.invoice_date=e.invoice_date?e.invoice_date.substr(0,10):"",s.internal_reference=e.internal_reference,s.external_url=e.external_uri,s.external_id=e.external_id,s.notes=e.notes,s.location={zoom_level:e.zoom_level,longitude:e.longitude,latitude:e.latitude},s.zoom_level=e.zoom_level,s.longitude=e.longitude,s.latitude=e.latitude,s.errors=Object(c.a)(),s},parseLinks:function(t,e){var s=this;axios.get("./api/v1/transactions/"+t+"/links").then((function(i){var a=i.data.data;for(var n in a)a.hasOwnProperty(n)&&/^0$|^[1-9]\d*$/.test(n)&&n<=4294967294&&s.parseLink(a[n],t,e)}))},parseLink:function(t,e,s){var i=this,a=[],n=parseInt(t.attributes.inward_id),r="inward";n===e&&(n=parseInt(t.attributes.outward_id),r="outward"),a.push(new Promise((function(i){i({link:t,journalId:e,opposingId:n,index:s,direction:r})}))),a.push(axios.get("./api/v1/transaction-journals/"+n)),a.push(axios.get("./api/v1/transaction_links/"+t.attributes.link_type_id)),Promise.all(a).then((function(t){var e=t[1].data.data.attributes.transactions,s=t[0].opposingId,a={};for(var n in e)e.hasOwnProperty(n)&&/^0$|^[1-9]\d*$/.test(n)&&n<=4294967294&&e[n].transaction_journal_id===s&&(a=e[n]);var r=t[0].index,o=t[0].direction,c={link_type_id:t[2].data.data.id+"-"+o,transaction_group_id:t[1].data.data.id,transaction_journal_id:a.transaction_journal_id,description:a.description,type:a.type,curre
2021-02-14 19:13:42 +01:00
//# sourceMappingURL=edit.js.map