Files
firefly-iii/public/build/assets/create-409a9a86.js

2 lines
22 KiB
JavaScript
Raw Normal View History

2024-01-05 14:04:44 +01:00
import{a as _,d as P,g as x,l as E}from"./load-translations-9dfbf635.js";import{f as T,k as I,l as m,I as L,m as A}from"./vendor-97200597.js";import{a as D,G as O,f as y}from"./get-35a1642f.js";function b(){return{id:"",name:"",alpine_name:""}}function C(){return{description:[],amount:[],currency_code:[],foreign_amount:[],foreign_currency_code:[],source_account:[],destination_account:[],budget_id:[],category_name:[],piggy_bank_id:[],bill_id:[],tags:[],notes:[],internal_reference:[],external_url:[],latitude:[],longitude:[],zoom_level:[],date:[],interest_date:[],book_date:[],process_date:[],due_date:[],payment_date:[],invoice_date:[]}}function B(){let t=T(new Date,"yyyy-MM-dd HH:mm");return{description:"",amount:"",currency_code:"EUR",foreign_amount:"",foreign_currency_code:"",source_account:b(),destination_account:b(),budget_id:null,category_name:"",piggy_bank_id:null,bill_id:null,tags:[],notes:"",internal_reference:"",external_url:"",hasLocation:!1,map:null,latitude:null,longitude:null,zoomLevel:null,marker:null,date:t,interest_date:"",book_date:"",process_date:"",due_date:"",payment_date:"",invoice_date:"",errors:C()}}function F(e,t){let n=[];for(let r in e)if(e.hasOwnProperty(r)){const o=e[r];let a={};a.description=o.description,a.source_name=o.source_account.name,a.destination_name=o.destination_account.name,a.amount=o.amount,a.currency_code=o.currency_code,a.date=o.date,a.interest_date=o.interest_date,a.book_date=o.book_date,a.process_date=o.process_date,a.due_date=o.due_date,a.payment_date=o.payment_date,a.invoice_date=o.invoice_date,a.budget_id=o.budget_id,a.category_name=o.category_name,a.piggy_bank_id=o.piggy_bank_id,a.bill_id=o.bill_id,a.tags=o.tags,a.notes=o.notes,a.internal_reference=o.internal_reference,a.external_url=o.external_url,a.store_location=!1,o.hasLocation&&(a.store_location=!0,a.longitude=o.longitude.toString(),a.latitude=o.latitude.toString(),a.zoom_level=o.zoomLevel),typeof o.foreign_currency_code<"u"&&o.foreign_currency_code.toString()!==""&&(a.foreign_currency_code=o.foreign_currency_code,typeof o.foreign_amount<"u"&&o.foreign_amount.toString()!==""&&(a.foreign_amount=o.foreign_amount),(typeof o.foreign_amount>"u"||o.foreign_amount.toString()==="")&&(delete a.foreign_amount,delete a.foreign_currency_code)),typeof o.source_account.id<"u"&&o.source_account.id.toString()!==""&&(a.source_id=o.source_account.id),typeof o.destination_account.id<"u"&&o.destination_account.id.toString()!==""&&(a.destination_id=o.destination_account.id),a.type=t,n.push(a)}return n}let $=class{post(t){let n="/api/v2/transactions";return _.post(n,t)}},j=class{list(t){return _.get("/api/v2/currencies",{params:t})}};function q(){let e={page:1,limit:1337};return new j().list(e).then(n=>{let r={defaultCurrency:{},nativeCurrencies:[],foreignCurrencies:[],enabledCurrencies:[]};r.foreignCurrencies.push({id:0,name:"(no foreign currency)",code:"",default:!1,symbol:"",decimal_places:2});for(let o in n.data.data)if(n.data.data.hasOwnProperty(o)){let a=n.data.data[o];if(a.attributes.enabled){let i={id:a.id,name:a.attributes.name,code:a.attributes.code,default:a.attributes.default,symbol:a.attributes.symbol,decimal_places:a.attributes.decimal_places};i.default&&(r.defaultCurrency=i),r.enabledCurrencies.push(i),r.nativeCurrencies.push(i),r.foreignCurrencies.push(i)}}return r})}class R{list(t){return _.get("/api/v2/budgets",{params:t})}}function z(){let e={page:1,limit:1337};return new R().list(e).then(n=>{let r=[{id:0,name:"(no budget)"}];for(let o in n.data.data)if(n.data.data.hasOwnProperty(o)){let a=n.data.data[o],i={id:a.id,name:a.attributes.name};r.push(i)}return r})}function M(){let e={page:1,limit:1337};return new D().list(e).then(n=>{let r={0:{id:0,name:"(no group)",order:0,piggyBanks:[{id:0,name:"(no piggy bank)",order:0}]}};for(let o in n.data.data)if(n.data.data.hasOwnProperty(o)){let a=n.data.data[o],i=a.attributes.object_group_id??"0",s=a.attributes.object_group_title??"(no group)",c={id:a.id,name:a.attributes.name,order:a.attributes.order};r.hasOwnProperty(i)||(r[i]={id:i,name:s,order:a.attributes.object_group_order??0,p