Files
firefly-iii/public/v3/js/2382.a6898a70.js
2023-01-29 15:29:42 +01:00

1 line
6.6 KiB
JavaScript
Vendored

"use strict";(globalThis["webpackChunkfirefly_iii"]=globalThis["webpackChunkfirefly_iii"]||[]).push([[2382],{2382:(t,n,a)=>{a.r(n),a.d(n,{default:()=>B});var e=a(9835),r=a(6970);const i={key:0},o=(0,e._)("thead",null,[(0,e._)("tr",null,[(0,e._)("th",{class:"text-left"},"Description"),(0,e._)("th",{class:"text-right"},"Opposing account"),(0,e._)("th",{class:"text-right"},"Amount")])],-1),s={class:"text-left"},c={key:0},u=(0,e._)("br",null,null,-1),l={key:0},d=(0,e._)("br",null,null,-1),_={class:"text-right"},g={key:0},p=(0,e._)("br",null,null,-1),h=[p],m={key:0},f={class:"text-right"},w={key:0},y=(0,e._)("br",null,null,-1),k=[y],b={key:0},v=["title"],D={key:2},q={key:0},A=["title"],C={key:3};function T(t,n,a,p,y,T){const x=(0,e.up)("q-item-label"),I=(0,e.up)("q-item-section"),G=(0,e.up)("q-item"),W=(0,e.up)("q-separator"),z=(0,e.up)("router-link"),Z=(0,e.up)("q-markup-table"),j=(0,e.up)("q-card");return(0,e.wg)(),(0,e.iD)("div",null,[(0,e.Wm)(j,{bordered:""},{default:(0,e.w5)((()=>[(0,e.Wm)(G,null,{default:(0,e.w5)((()=>[(0,e.Wm)(I,null,{default:(0,e.w5)((()=>[(0,e.Wm)(x,null,{default:(0,e.w5)((()=>[(0,e._)("strong",null,(0,r.zw)(y.accountName),1),""!==y.accountCurrencyCode?((0,e.wg)(),(0,e.iD)("span",i," ("+(0,r.zw)(T.formatAmount(y.accountCurrencyCode,y.accountBalance))+") ",1)):(0,e.kq)("",!0)])),_:1})])),_:1})])),_:1}),(0,e.Wm)(W),(0,e.Wm)(Z,null,{default:(0,e.w5)((()=>[o,(0,e._)("tbody",null,[((0,e.wg)(!0),(0,e.iD)(e.HY,null,(0,e.Ko)(y.transactions,(n=>((0,e.wg)(),(0,e.iD)("tr",null,[(0,e._)("td",s,[(0,e.Wm)(z,{class:(0,r.C_)(t.$q.dark.isActive?"text-red":"text-blue"),to:{name:"transactions.show",params:{id:n.transactionGroupId}}},{default:(0,e.w5)((()=>[n.transactions.length>1?((0,e.wg)(),(0,e.iD)("strong",c,[(0,e.Uk)((0,r.zw)(n.transactionGroupTitle),1),u])):(0,e.kq)("",!0)])),_:2},1032,["class","to"]),((0,e.wg)(!0),(0,e.iD)(e.HY,null,(0,e.Ko)(n.transactions,(a=>((0,e.wg)(),(0,e.iD)("span",null,[n.transactions.length>1?((0,e.wg)(),(0,e.iD)("span",l,[(0,e.Uk)((0,r.zw)(a.description)+" ",1),d])):(0,e.kq)("",!0),1===n.transactions.length?((0,e.wg)(),(0,e.j4)(z,{key:1,class:(0,r.C_)(t.$q.dark.isActive?"text-red":"text-blue"),to:{name:"transactions.show",params:{id:n.transactionGroupId}}},{default:(0,e.w5)((()=>[(0,e.Uk)((0,r.zw)(a.description),1)])),_:2},1032,["class","to"])):(0,e.kq)("",!0)])))),256))]),(0,e._)("td",_,[n.transactions.length>1?((0,e.wg)(),(0,e.iD)("span",g,h)):(0,e.kq)("",!0),((0,e.wg)(!0),(0,e.iD)(e.HY,null,(0,e.Ko)(n.transactions,(a=>((0,e.wg)(),(0,e.iD)("span",null,[(0,e.Wm)(z,{class:(0,r.C_)(t.$q.dark.isActive?"text-red":"text-blue"),to:{name:"accounts.show",params:{id:a.destination_id}}},{default:(0,e.w5)((()=>[(0,e.Uk)((0,r.zw)(a.destination_name),1)])),_:2},1032,["class","to"]),n.transactions.length>1?((0,e.wg)(),(0,e.iD)("br",m)):(0,e.kq)("",!0)])))),256))]),(0,e._)("td",f,[n.transactions.length>1?((0,e.wg)(),(0,e.iD)("span",w,k)):(0,e.kq)("",!0),((0,e.wg)(!0),(0,e.iD)(e.HY,null,(0,e.Ko)(n.transactions,(t=>((0,e.wg)(),(0,e.iD)("span",null,[!1===t.native_currency_converted?((0,e.wg)(),(0,e.iD)("span",b,(0,r.zw)(T.formatAmount(t.currency_code,t.amount)),1)):(0,e.kq)("",!0),!0===t.native_currency_converted?((0,e.wg)(),(0,e.iD)("span",{key:1,title:T.formatAmount(t.currency_code,t.amount)},(0,r.zw)(T.formatAmount(t.native_currency_code,t.native_amount)),9,v)):(0,e.kq)("",!0),null!==t.foreign_amount?((0,e.wg)(),(0,e.iD)("span",D,[!1===t.foreign_currency_converted?((0,e.wg)(),(0,e.iD)("span",q," ("+(0,r.zw)(T.formatAmount(t.foreign_currency_code,t.foreign_amount))+")",1)):(0,e.kq)("",!0),!0===t.foreign_currency_converted?((0,e.wg)(),(0,e.iD)("span",{key:1,title:T.formatAmount(t.foreign_currency_code,t.foreign_amount)}," ("+(0,r.zw)(T.formatAmount(t.native_currency_code,t.native_foreign_amount))+")",9,A)):(0,e.kq)("",!0)])):(0,e.kq)("",!0),n.transactions.length>1?((0,e.wg)(),(0,e.iD)("br",C)):(0,e.kq)("",!0)])))),256))])])))),256))])])),_:1})])),_:1})])}var x=a(5148),I=a.n(x),G=a(1569);class W{constructor(t){I()(this,"root","/api/v2/"),I()(this,"path",""),this.path=t}apiPath(){return this.root+this.path}apiPathWithObject(t){return this.root+this.path+"/"+t}apiGet(t,n){let a=this.apiPathWithObject(t);return n?G.api.get(a,{params:n}):G.api.get(a)}apiGetTransactions(t,n){let a=this.apiPathWithObject(t)+"/transactions";return n?G.api.get(a,{params:n}):G.api.get(a)}}class z extends W{constructor(){super("accounts")}get(t,n){let a={date:n};return n?this.apiGet(t,a):this.apiGet(t)}transactions(t,n){return n?this.apiGetTransactions(t,n):this.apiGetTransactions(t)}}var Z=a(3555),j=a(8898);const O={name:"TransactionList",props:{accountId:0},data(){return{store:null,accountName:"",transactions:[],accountCurrencyCode:"",accountBalance:0}},mounted(){this.store=(0,Z.S)(),0!==this.accountId&&(this.getAccount(),this.store.$onAction((({name:t,$store:n,args:a,after:e,onError:r})=>{e((n=>{"setRange"===t&&this.getTransactions()}))})),this.getTransactions())},methods:{getAccount:function(){(new z).get(this.accountId).then((t=>this.parseAccount(t.data)))},parseAccount:function(t){console.log(t.data.attributes),this.accountName=t.data.attributes.name,this.accountBalance=t.data.attributes.current_balance,this.accountCurrencyCode=t.data.attributes.currency_code},getTransactions:function(){if(null!==this.store.getRange.start&&null!==this.store.getRange.end){const t=new Date(this.store.getRange.start),n=new Date(this.store.getRange.end);let a=(0,j.Z)(t,"y-MM-dd"),e=(0,j.Z)(n,"y-MM-dd");(new z).transactions(this.accountId,{start:a,end:e,limit:10}).then((t=>this.parseTransactions(t.data)))}},formatAmount:function(t,n){return Intl.NumberFormat(this.store.getLocale,{style:"currency",currency:t}).format(n)},parseTransactions:function(t){for(let n in t.data)if(t.data.hasOwnProperty(n)){let a=t.data[n],e={transactionGroupId:a.id,transactionGroupTitle:a.attributes.group_title,transactions:[]};for(let t in a.attributes.transactions)if(a.attributes.transactions.hasOwnProperty(t)){let n=a.attributes.transactions[t],r={journalId:n.transaction_journal_id,description:n.description,destination_name:n.destination_name,destination_id:n.destination_id,type:n.type,amount:n.amount,native_amount:n.native_amount,foreign_amount:n.foreign_amount,native_foreign_amount:n.native_foreign_amount,currency_code:n.currency_code,native_currency_code:n.native_currency_code,foreign_currency_code:n.foreign_currency_code,native_currency_converted:n.native_currency_converted,foreign_currency_converted:n.foreign_currency_converted};e.transactions.push(r)}this.transactions.push(e)}}}};var P=a(1639),Q=a(4458),M=a(490),R=a(1233),$=a(3115),H=a(926),K=a(6933),N=a(9984),U=a.n(N);const Y=(0,P.Z)(O,[["render",T]]),B=Y;U()(O,"components",{QCard:Q.Z,QItem:M.Z,QItemSection:R.Z,QItemLabel:$.Z,QSeparator:H.Z,QMarkupTable:K.Z})}}]);