mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-18 10:16:49 +00:00
1 line
3.0 KiB
JavaScript
Vendored
1 line
3.0 KiB
JavaScript
Vendored
"use strict";(self["webpackChunkfirefly_iii"]=self["webpackChunkfirefly_iii"]||[]).push([[9048],{9048:(t,e,n)=>{n.r(e),n.d(e,{default:()=>D});var r=n(9835),a=n(6970);const i={class:"q-ml-sm"},o=(0,r._)("br",null,null,-1),s=["title"],l={key:0};function u(t,e,n,u,m,c){const d=(0,r.up)("q-item-label"),p=(0,r.up)("q-item-section"),h=(0,r.up)("q-item"),f=(0,r.up)("q-separator"),g=(0,r.up)("q-icon"),v=(0,r.up)("q-card-section"),_=(0,r.up)("q-card");return(0,r.wg)(),(0,r.iD)("div",i,[(0,r.Wm)(_,{bordered:""},{default:(0,r.w5)((()=>[(0,r.Wm)(h,null,{default:(0,r.w5)((()=>[(0,r.Wm)(p,null,{default:(0,r.w5)((()=>[(0,r.Wm)(d,null,{default:(0,r.w5)((()=>[(0,r._)("strong",null,(0,a.zw)(t.$t("firefly.net_worth")),1)])),_:1})])),_:1})])),_:1}),(0,r.Wm)(f),(0,r.Wm)(v,{horizontal:""},{default:(0,r.w5)((()=>[(0,r.Wm)(v,null,{default:(0,r.w5)((()=>[(0,r.Wm)(g,{name:"fas fa-chart-line",size:"50px",color:m.primary>0?"positive":"negative"},null,8,["color"])])),_:1}),(0,r.Wm)(f,{vertical:""}),(0,r.Wm)(v,null,{default:(0,r.w5)((()=>[(0,r._)("strong",null,(0,a.zw)(c.formatAmount(m.currency,m.primary)),1),o,(0,r._)("small",null,[((0,r.wg)(!0),(0,r.iD)(r.HY,null,(0,r.Ko)(m.netWorth,((t,e)=>((0,r.wg)(),(0,r.iD)("span",null,[(0,r._)("span",{title:c.formatAmount(t.native_code,t.native_sum)},(0,a.zw)(c.formatAmount(t.code,t.sum)),9,s),e+1!==m.netWorth.length?((0,r.wg)(),(0,r.iD)("span",l," + ")):(0,r.kq)("",!0)])))),256))])])),_:1})])),_:1})])),_:1})])}var m=n(3555),c=n(1569),d=n(8898);class p{get(t){let e=(0,d.Z)(t,"y-MM-dd");return c.api.get("/api/v2/net-worth",{params:{date:e}})}}const h={name:"NetWorthInsightBox",data(){return{netWorth:[],primary:0,currency:"EUR",store:null}},mounted(){this.store=(0,m.S)(),this.store.$onAction((({name:t,$store:e,args:n,after:r,onError:a})=>{r((e=>{"setRange"===t&&this.triggerUpdate()}))})),this.triggerUpdate()},methods:{triggerUpdate:function(){if(null!==this.store.getRange.start&&null!==this.store.getRange.end){this.unpaid=[];const t=new Date(this.store.getRange.start),e=new Date(this.store.getRange.end),n=new Date;let r=e;n>=t&&n<=e&&(r=n),this.currency=this.store.getCurrencyCode,(new p).get(r).then((t=>this.parseResponse(t.data)))}},parseResponse(t){for(let e in t)if(t.hasOwnProperty(e)){const n=t[e];if(parseFloat(n.sum)<=0)continue;const r=n.converted&&n.native_id!==n.id&&0!==parseFloat(n.native_sum);n.converted&&(r||n.native_id===n.id)&&(this.primary=this.primary+parseFloat(n.native_sum)),n.converted||(this.primary=this.primary+parseFloat(n.sum)),this.netWorth.push({sum:n.sum,code:n.code,native_sum:n.converted?n.native_sum:n.sum,native_code:n.converted?n.native_code:n.code,native:r})}},formatAmount:function(t,e){var n,r;return Intl.NumberFormat(null!==(n=null===(r=this.store)||void 0===r?void 0:r.getLocale)&&void 0!==n?n:"en-US",{style:"currency",currency:t}).format(e)}}};var f=n(1639),g=n(4458),v=n(490),_=n(1233),w=n(3115),y=n(926),W=n(3190),q=n(2857),Z=n(9984),R=n.n(Z);const b=(0,f.Z)(h,[["render",u]]),D=b;R()(h,"components",{QCard:g.Z,QItem:v.Z,QItemSection:_.Z,QItemLabel:w.Z,QSeparator:y.Z,QCardSection:W.Z,QIcon:q.Z})}}]); |