mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-12 09:52:20 +00:00
2 lines
21 KiB
JavaScript
2 lines
21 KiB
JavaScript
|
|
import{a as g,d as k,g as x,l as P}from"./load-translations-23553922.js";import{f as C,k as I,I as T,l as h}from"./vendor-e194ad60.js";import{a as A,G as E,f as m}from"./get-748a816c.js";function _(){return{id:"",name:"",alpine_name:""}}function S(){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 D(){let t=C(new Date,"yyyy-MM-dd HH:mm");return{description:"",amount:"",currency_code:"EUR",foreign_amount:"",foreign_currency_code:"",source_account:_(),destination_account:_(),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:S()}}function $(e,t){let r=[];for(let o in e)if(e.hasOwnProperty(o)){const n=e[o];let a={};a.description=n.description,a.source_name=n.source_account.name,a.destination_name=n.destination_account.name,a.amount=n.amount,a.currency_code=n.currency_code,a.date=n.date,a.interest_date=n.interest_date,a.book_date=n.book_date,a.process_date=n.process_date,a.due_date=n.due_date,a.payment_date=n.payment_date,a.invoice_date=n.invoice_date,a.budget_id=n.budget_id,a.category_name=n.category_name,a.piggy_bank_id=n.piggy_bank_id,a.bill_id=n.bill_id,a.tags=n.tags,a.notes=n.notes,a.internal_reference=n.internal_reference,a.external_url=n.external_url,a.store_location=!1,n.hasLocation&&(a.store_location=!0,a.longitude=n.longitude.toString(),a.latitude=n.latitude.toString(),a.zoom_level=n.zoomLevel),typeof n.foreign_currency_code<"u"&&n.foreign_currency_code.toString()!==""&&(a.foreign_currency_code=n.foreign_currency_code,typeof n.foreign_amount<"u"&&n.foreign_amount.toString()!==""&&(a.foreign_amount=n.foreign_amount),(typeof n.foreign_amount>"u"||n.foreign_amount.toString()==="")&&(delete a.foreign_amount,delete a.foreign_currency_code)),typeof n.source_account.id<"u"&&n.source_account.id.toString()!==""&&(a.source_id=n.source_account.id),typeof n.destination_account.id<"u"&&n.destination_account.id.toString()!==""&&(a.destination_id=n.destination_account.id),a.type=t,r.push(a)}return r}let O=class{post(t){let r="/api/v2/transactions";return g.post(r,t)}},B=class{list(t){return g.get("/api/v2/currencies",{params:t})}};function L(){let e={page:1,limit:1337};return new B().list(e).then(r=>{let o={defaultCurrency:{},nativeCurrencies:[],foreignCurrencies:[],enabledCurrencies:[]};o.foreignCurrencies.push({id:0,name:"(no foreign currency)",code:"",default:!1,symbol:"",decimal_places:2});for(let n in r.data.data)if(r.data.data.hasOwnProperty(n)){let a=r.data.data[n];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&&(o.defaultCurrency=i),o.enabledCurrencies.push(i),o.nativeCurrencies.push(i),o.foreignCurrencies.push(i)}}return o})}class q{list(t){return g.get("/api/v2/budgets",{params:t})}}function F(){let e={page:1,limit:1337};return new q().list(e).then(r=>{let o=[{id:0,name:"(no budget)"}];for(let n in r.data.data)if(r.data.data.hasOwnProperty(n)){let a=r.data.data[n],i={id:a.id,name:a.attributes.name};o.push(i)}return o})}function j(){let e={page:1,limit:1337};return new A().list(e).then(r=>{let o={0:{id:0,name:"(no group)",order:0,piggyBanks:[{id:0,name:"(no piggy bank)",order:0}]}};for(let n in r.data.data)if(r.data.data.hasOwnProperty(n)){let a=r.data.data[n],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};o.hasOwnProperty(i)||(o[i]={id:i,name:s,order:a.attributes.object_group_order??0,piggyBan
|