mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-24 06:43:23 +00:00
1 line
3.4 KiB
JavaScript
Vendored
1 line
3.4 KiB
JavaScript
Vendored
"use strict";(self["webpackChunkfirefly_iii"]=self["webpackChunkfirefly_iii"]||[]).push([[7946],{7946:(e,t,r)=>{r.r(t),r.d(t,{default:()=>R});var s=r(9835);const a={class:"q-mt-sm q-mr-sm"},n=(0,s._)("strong",null,"Bla bla accounts",-1),i=(0,s._)("div",null,null,-1);function o(e,t,r,o,l,c){const u=(0,s.up)("q-item-label"),d=(0,s.up)("q-item-section"),h=(0,s.up)("q-item"),m=(0,s.up)("q-separator"),g=(0,s.up)("ApexChart"),p=(0,s.up)("q-card");return(0,s.wg)(),(0,s.iD)(s.HY,null,[(0,s._)("div",a,[(0,s.Wm)(p,{bordered:""},{default:(0,s.w5)((()=>[(0,s.Wm)(h,null,{default:(0,s.w5)((()=>[(0,s.Wm)(d,null,{default:(0,s.w5)((()=>[(0,s.Wm)(u,null,{default:(0,s.w5)((()=>[n])),_:1})])),_:1})])),_:1}),(0,s.Wm)(m),(0,s.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 u{overview(e,t){let r=(0,c.Z)(e.start,"y-MM-dd"),s=(0,c.Z)(e.end,"y-MM-dd");return l.api.get("/api/v2/chart/account/dashboard",{params:{start:r,end:s,cache:t}})}}var d=r(9302),h=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,h.S)();const e=(0,d.Z)();this.options.theme.mode=e.dark.isActive?"dark":"light",this.store.$onAction((({name:e,store:t,args:r,after:s,onError:a})=>{s((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 s=null!==(r=this.currencies[t.seriesIndex])&&void 0!==r?r:"EUR";return Intl.NumberFormat(this.locale,{style:"currency",currency:s}).format(e)}if(Number.isInteger(t)){var s;let r=null!==(s=this.currencies[t])&&void 0!==s?s:"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 u).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 s in e[r].entries)t.data.push(e[r].entries[s]);this.series.push(t)}this.loading=!1},generateStaticLabels:function(e){let t,r=new Date(e.start),s=[];while(r<=e.end)s.push((0,c.Z)(r,this.dateFormat)),t=r.setDate(r.getDate()+1),r=new Date(t);this.options={...this.options,labels:s}}},components:{ApexChart:(0,s.RC)((()=>r.e(4736).then(r.t.bind(r,7092,23))))}};var g=r(1639),p=r(4458),f=r(490),b=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:f.Z,QItemSection:b.Z,QItemLabel:v.Z,QSeparator:y.Z})}}]); |