Files
firefly-iii/public/v3/js/3171.37255ab3.js
2022-02-27 10:16:34 +01:00

1 line
5.4 KiB
JavaScript
Vendored
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";(self["webpackChunkfirefly_iii"]=self["webpackChunkfirefly_iii"]||[]).push([[3171],{3171:(e,t,r)=>{r.r(t),r.d(t,{default:()=>S});r(71);var n=r(3673),s=r(2323);const i={class:"row"},l={class:"col-4 q-pr-sm q-pr-sm"},a={class:"text-overline"},d={class:"float-right"},o={key:0},p={class:"col-4 q-pr-sm q-pl-sm"},g={class:"text-overline"},u={class:"float-right"},c=["title"],f={key:0},h={class:"col-4 q-pl-sm"},y={class:"text-overline"},w={class:"float-right"},_=["title"],U={key:0},m={key:0};function C(e,t,r,C,k,v){const b=(0,n.up)("q-card-section"),W=(0,n.up)("q-card");return(0,n.wg)(),(0,n.iD)("div",i,[(0,n._)("div",l,[(0,n.Wm)(W,{bordered:""},{default:(0,n.w5)((()=>[(0,n.Wm)(b,{class:"q-pt-xs"},{default:(0,n.w5)((()=>[(0,n._)("div",a,[(0,n.Uk)((0,s.zw)(e.$t("firefly.bills_to_pay"))+" ",1),(0,n._)("span",d,[(0,n._)("span",{class:"text-grey-4 fas fa-redo-alt",style:{cursor:"pointer"},onClick:t[0]||(t[0]=(...e)=>v.triggerForcedUpgrade&&v.triggerForcedUpgrade(...e))})])])])),_:1}),(0,n.Wm)(b,{class:"q-pt-xs"},{default:(0,n.w5)((()=>[((0,n.wg)(!0),(0,n.iD)(n.HY,null,(0,n.Ko)(v.prefBillsUnpaid,(e=>((0,n.wg)(),(0,n.iD)("span",null,(0,s.zw)(e.value_parsed),1)))),256)),((0,n.wg)(!0),(0,n.iD)(n.HY,null,(0,n.Ko)(v.notPrefBillsUnpaid,((e,t)=>((0,n.wg)(),(0,n.iD)("span",null,[(0,n.Uk)((0,s.zw)(e.value_parsed),1),t+1!==v.notPrefBillsUnpaid.length?((0,n.wg)(),(0,n.iD)("span",o,", ")):(0,n.kq)("",!0)])))),256))])),_:1})])),_:1})]),(0,n._)("div",p,[(0,n.Wm)(W,{bordered:""},{default:(0,n.w5)((()=>[(0,n.Wm)(b,{class:"q-pt-xs"},{default:(0,n.w5)((()=>[(0,n._)("div",g,[(0,n.Uk)((0,s.zw)(e.$t("firefly.left_to_spend"))+" ",1),(0,n._)("span",u,[(0,n._)("span",{class:"text-grey-4 fas fa-redo-alt",style:{cursor:"pointer"},onClick:t[1]||(t[1]=(...e)=>v.triggerForcedUpgrade&&v.triggerForcedUpgrade(...e))})])])])),_:1}),(0,n.Wm)(b,{class:"q-pt-xs"},{default:(0,n.w5)((()=>[((0,n.wg)(!0),(0,n.iD)(n.HY,null,(0,n.Ko)(v.prefLeftToSpend,(e=>((0,n.wg)(),(0,n.iD)("span",{title:e.sub_title},(0,s.zw)(e.value_parsed),9,c)))),256)),((0,n.wg)(!0),(0,n.iD)(n.HY,null,(0,n.Ko)(v.notPrefLeftToSpend,((e,t)=>((0,n.wg)(),(0,n.iD)("span",null,[(0,n.Uk)((0,s.zw)(e.value_parsed),1),t+1!==v.notPrefLeftToSpend.length?((0,n.wg)(),(0,n.iD)("span",f,", ")):(0,n.kq)("",!0)])))),256))])),_:1})])),_:1})]),(0,n._)("div",h,[(0,n.Wm)(W,{bordered:""},{default:(0,n.w5)((()=>[(0,n.Wm)(b,{class:"q-pt-xs"},{default:(0,n.w5)((()=>[(0,n._)("div",y,[(0,n.Uk)((0,s.zw)(e.$t("firefly.net_worth"))+" ",1),(0,n._)("span",w,[(0,n._)("span",{class:"text-grey-4 fas fa-redo-alt",style:{cursor:"pointer"},onClick:t[2]||(t[2]=(...e)=>v.triggerForcedUpgrade&&v.triggerForcedUpgrade(...e))})])])])),_:1}),(0,n.Wm)(b,{class:"q-pt-xs"},{default:(0,n.w5)((()=>[((0,n.wg)(!0),(0,n.iD)(n.HY,null,(0,n.Ko)(v.prefNetWorth,(e=>((0,n.wg)(),(0,n.iD)("span",{title:e.sub_title},(0,s.zw)(e.value_parsed),9,_)))),256)),((0,n.wg)(!0),(0,n.iD)(n.HY,null,(0,n.Ko)(v.notPrefNetWorth,((e,t)=>((0,n.wg)(),(0,n.iD)("span",null,[(0,n.Uk)((0,s.zw)(e.value_parsed),1),t+1!==v.notPrefNetWorth.length?((0,n.wg)(),(0,n.iD)("span",U,", ")):(0,n.kq)("",!0)])))),256)),0===v.notPrefNetWorth.length?((0,n.wg)(),(0,n.iD)("span",m," ")):(0,n.kq)("",!0)])),_:1})])),_:1})])])}var k=r(5474),v=r(6810);class b{list(e,t){let r=(0,v.Z)(e.start,"y-MM-dd"),n=(0,v.Z)(e.end,"y-MM-dd");return k.api.get("/api/v1/summary/basic",{params:{start:r,end:n,cache:t}})}}var W=r(3617);const q={name:"Boxes",computed:{...(0,W.Se)("fireflyiii",["getCurrencyCode","getCurrencyId","getRange","getCacheKey"]),prefBillsUnpaid:function(){return this.filterOnCurrency(this.billsUnpaid)},notPrefBillsUnpaid:function(){return this.filterOnNotCurrency(this.billsUnpaid)},prefLeftToSpend:function(){return this.filterOnCurrency(this.leftToSpend)},notPrefLeftToSpend:function(){return this.filterOnNotCurrency(this.leftToSpend)},prefNetWorth:function(){return this.filterOnCurrency(this.netWorth)},notPrefNetWorth:function(){return this.filterOnNotCurrency(this.netWorth)}},created(){},data(){return{summary:[],billsPaid:[],billsUnpaid:[],leftToSpend:[],netWorth:[],range:{start:null,end:null}}},mounted(){if(null===this.range.start||null===this.range.end){const e=(0,W.oR)();e.subscribe((e=>{"fireflyiii/setRange"===e.type&&(this.range=e.payload,this.triggerUpdate())}))}null!==this.getRange.start&&null!==this.getRange.end&&(this.start=this.getRange.start,this.end=this.getRange.end,this.triggerUpdate())},methods:{triggerForcedUpgrade:function(){this.$store.dispatch("fireflyiii/refreshCacheKey"),this.triggerUpdate()},triggerUpdate:function(){if(null!==this.getRange.start&&null!==this.getRange.end){const e=new b;e.list({start:this.getRange.start,end:this.getRange.end},this.getCacheKey).then((e=>{this.netWorth=this.getKeyedEntries(e.data,"net-worth-in-"),this.leftToSpend=this.getKeyedEntries(e.data,"left-to-spend-in-"),this.billsPaid=this.getKeyedEntries(e.data,"bills-paid-in-"),this.billsUnpaid=this.getKeyedEntries(e.data,"bills-unpaid-in-")}))}},getKeyedEntries(e,t){let r=[];for(const n in e)e.hasOwnProperty(n)&&t===n.substr(0,t.length)&&r.push(e[n]);return r},filterOnCurrency(e){let t=[];for(const r in e)e.hasOwnProperty(r)&&e[r].currency_id===this.getCurrencyId&&t.push(e[r]);return 0===t.length&&e.hasOwnProperty(0)&&t.push(e[0]),t},filterOnNotCurrency(e){let t=[];for(const r in e)e.hasOwnProperty(r)&&e[r].currency_id!==this.getCurrencyId&&t.push(e[r]);return t}}};var D=r(4260),P=r(151),K=r(5589),x=r(7518),O=r.n(x);const R=(0,D.Z)(q,[["render",C]]),S=R;O()(q,"components",{QCard:P.Z,QCardSection:K.Z})}}]);