Files
firefly-iii/public/v3/js/7946.6c049916.js
2022-07-16 09:26:19 +02:00

1 line
3.4 KiB
JavaScript
Vendored

"use strict";(globalThis["webpackChunkfirefly_iii"]=globalThis["webpackChunkfirefly_iii"]||[]).push([[7946],{7946:(e,t,r)=>{r.r(t),r.d(t,{default:()=>R});var a=r(9835);const s={class:"q-mt-sm q-mr-sm"},n=(0,a._)("strong",null,"Bla bla accounts",-1),i=(0,a._)("div",null,null,-1);function o(e,t,r,o,l,c){const h=(0,a.up)("q-item-label"),u=(0,a.up)("q-item-section"),d=(0,a.up)("q-item"),m=(0,a.up)("q-separator"),g=(0,a.up)("ApexChart"),p=(0,a.up)("q-card");return(0,a.wg)(),(0,a.iD)(a.HY,null,[(0,a._)("div",s,[(0,a.Wm)(p,{bordered:""},{default:(0,a.w5)((()=>[(0,a.Wm)(d,null,{default:(0,a.w5)((()=>[(0,a.Wm)(u,null,{default:(0,a.w5)((()=>[(0,a.Wm)(h,null,{default:(0,a.w5)((()=>[n])),_:1})])),_:1})])),_:1}),(0,a.Wm)(m),(0,a.Wm)(g,{ref:"chart",height:"350",type:"line",options:l.options,series:l.series},null,8,["options","series"])])),_:1})]),i],64)}r(702);var l=r(1569),c=r(8898);class h{overview(e,t){let r=(0,c.Z)(e.start,"y-MM-dd"),a=(0,c.Z)(e.end,"y-MM-dd");return l.api.get("/api/v2/chart/account/dashboard",{params:{start:r,end:a,cache:t}})}}var u=r(9302),d=r(3555);const m={name:"AccountChart",data(){return{loading:!1,currencies:[],options:{theme:{mode:"dark"},dataLabels:{enabled:!1},noData:{text:"Loading..."},chart:{id:"account-chart",toolbar:{show:!0,tools:{download:!1,selection:!1,pan:!1}}},yaxis:{labels:{formatter:this.numberFormatter}},labels:[],xaxis:{categories:[]}},series:[],locale:"en-US",dateFormat:"MMMM d, y",store:null}},created(){this.dateFormat=this.$t("config.month_and_day_fns")},mounted(){this.store=(0,d.S)();const e=(0,u.Z)();this.options.theme.mode=e.dark.isActive?"dark":"light",this.store.$onAction((({name:e,store:t,args:r,after:a,onError:s})=>{a((t=>{"setRange"===e&&(this.locale=this.store.getLocale,this.buildChart())}))})),null!==this.store.getRange.start&&null!==this.store.getRange.end&&this.buildChart()},methods:{numberFormatter:function(e,t){if(t instanceof Object){var r;let a=null!==(r=this.currencies[t.seriesIndex])&&void 0!==r?r:"EUR";return Intl.NumberFormat(this.locale,{style:"currency",currency:a}).format(e)}if(Number.isInteger(t)){var a;let r=null!==(a=this.currencies[t])&&void 0!==a?a:"EUR";return Intl.NumberFormat(this.locale,{style:"currency",currency:r}).format(e)}return"x"},buildChart:function(){if(console.log("buildChart"),null!==this.store.getRange.start&&null!==this.store.getRange.end&&!1===this.loading){console.log("buildChart go!");let e=this.store.getRange.start,t=this.store.getRange.end;!1===this.loading&&(this.loading=!0,this.generateStaticLabels({start:e,end:t}),(new h).overview({start:e,end:t},this.getCacheKey).then((e=>{this.generateSeries(e.data)})))}},generateSeries:function(e){let t;console.log("generateSeries"),this.series=[];for(let r in e)if(e.hasOwnProperty(r)){t={},t.name=e[r].label,t.data=[],e[r].converted||this.currencies.push(e[r].currency_code),e[r].converted&&this.currencies.push(e[r].native_code);for(let a in e[r].entries)t.data.push(e[r].entries[a]);this.series.push(t)}this.loading=!1},generateStaticLabels:function(e){let t,r=new Date(e.start),a=[];while(r<=e.end)a.push((0,c.Z)(r,this.dateFormat)),t=r.setDate(r.getDate()+1),r=new Date(t);this.options={...this.options,labels:a}}},components:{ApexChart:(0,a.RC)((()=>r.e(4736).then(r.t.bind(r,7092,23))))}};var g=r(1639),p=r(4458),b=r(490),f=r(1233),v=r(3115),y=r(926),w=r(9984),_=r.n(w);const C=(0,g.Z)(m,[["render",o]]),R=C;_()(m,"components",{QCard:p.Z,QItem:b.Z,QItemSection:f.Z,QItemLabel:v.Z,QSeparator:y.Z})}}]);