Files
firefly-iii/public/v2/js/dashboard.js
2020-12-29 08:34:31 +01:00

2 lines
25 KiB
JavaScript
Executable File
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.

(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{242:function(t,e,s){s(411),t.exports=s(417)},245:function(t,e,s){"use strict";s(59)},246:function(t,e,s){(t.exports=s(33)(!1)).push([t.i,".dropdown-item[data-v-03e62f58],.dropdown-item[data-v-03e62f58]:hover{color:#212529}",""])},274:function(t,e,s){var a={"./af":68,"./af.js":68,"./ar":69,"./ar-dz":70,"./ar-dz.js":70,"./ar-kw":71,"./ar-kw.js":71,"./ar-ly":72,"./ar-ly.js":72,"./ar-ma":73,"./ar-ma.js":73,"./ar-sa":74,"./ar-sa.js":74,"./ar-tn":75,"./ar-tn.js":75,"./ar.js":69,"./az":76,"./az.js":76,"./be":77,"./be.js":77,"./bg":78,"./bg.js":78,"./bm":79,"./bm.js":79,"./bn":80,"./bn-bd":81,"./bn-bd.js":81,"./bn.js":80,"./bo":82,"./bo.js":82,"./br":83,"./br.js":83,"./bs":84,"./bs.js":84,"./ca":85,"./ca.js":85,"./cs":86,"./cs.js":86,"./cv":87,"./cv.js":87,"./cy":88,"./cy.js":88,"./da":89,"./da.js":89,"./de":90,"./de-at":91,"./de-at.js":91,"./de-ch":92,"./de-ch.js":92,"./de.js":90,"./dv":93,"./dv.js":93,"./el":94,"./el.js":94,"./en-au":95,"./en-au.js":95,"./en-ca":96,"./en-ca.js":96,"./en-gb":97,"./en-gb.js":97,"./en-ie":98,"./en-ie.js":98,"./en-il":99,"./en-il.js":99,"./en-in":100,"./en-in.js":100,"./en-nz":101,"./en-nz.js":101,"./en-sg":102,"./en-sg.js":102,"./eo":103,"./eo.js":103,"./es":104,"./es-do":105,"./es-do.js":105,"./es-mx":106,"./es-mx.js":106,"./es-us":107,"./es-us.js":107,"./es.js":104,"./et":108,"./et.js":108,"./eu":109,"./eu.js":109,"./fa":110,"./fa.js":110,"./fi":111,"./fi.js":111,"./fil":112,"./fil.js":112,"./fo":113,"./fo.js":113,"./fr":114,"./fr-ca":115,"./fr-ca.js":115,"./fr-ch":116,"./fr-ch.js":116,"./fr.js":114,"./fy":117,"./fy.js":117,"./ga":118,"./ga.js":118,"./gd":119,"./gd.js":119,"./gl":120,"./gl.js":120,"./gom-deva":121,"./gom-deva.js":121,"./gom-latn":122,"./gom-latn.js":122,"./gu":123,"./gu.js":123,"./he":124,"./he.js":124,"./hi":125,"./hi.js":125,"./hr":126,"./hr.js":126,"./hu":127,"./hu.js":127,"./hy-am":128,"./hy-am.js":128,"./id":129,"./id.js":129,"./is":130,"./is.js":130,"./it":131,"./it-ch":132,"./it-ch.js":132,"./it.js":131,"./ja":133,"./ja.js":133,"./jv":134,"./jv.js":134,"./ka":135,"./ka.js":135,"./kk":136,"./kk.js":136,"./km":137,"./km.js":137,"./kn":138,"./kn.js":138,"./ko":139,"./ko.js":139,"./ku":140,"./ku.js":140,"./ky":141,"./ky.js":141,"./lb":142,"./lb.js":142,"./lo":143,"./lo.js":143,"./lt":144,"./lt.js":144,"./lv":145,"./lv.js":145,"./me":146,"./me.js":146,"./mi":147,"./mi.js":147,"./mk":148,"./mk.js":148,"./ml":149,"./ml.js":149,"./mn":150,"./mn.js":150,"./mr":151,"./mr.js":151,"./ms":152,"./ms-my":153,"./ms-my.js":153,"./ms.js":152,"./mt":154,"./mt.js":154,"./my":155,"./my.js":155,"./nb":156,"./nb.js":156,"./ne":157,"./ne.js":157,"./nl":158,"./nl-be":159,"./nl-be.js":159,"./nl.js":158,"./nn":160,"./nn.js":160,"./oc-lnc":161,"./oc-lnc.js":161,"./pa-in":162,"./pa-in.js":162,"./pl":163,"./pl.js":163,"./pt":164,"./pt-br":165,"./pt-br.js":165,"./pt.js":164,"./ro":166,"./ro.js":166,"./ru":167,"./ru.js":167,"./sd":168,"./sd.js":168,"./se":169,"./se.js":169,"./si":170,"./si.js":170,"./sk":171,"./sk.js":171,"./sl":172,"./sl.js":172,"./sq":173,"./sq.js":173,"./sr":174,"./sr-cyrl":175,"./sr-cyrl.js":175,"./sr.js":174,"./ss":176,"./ss.js":176,"./sv":177,"./sv.js":177,"./sw":178,"./sw.js":178,"./ta":179,"./ta.js":179,"./te":180,"./te.js":180,"./tet":181,"./tet.js":181,"./tg":182,"./tg.js":182,"./th":183,"./th.js":183,"./tk":184,"./tk.js":184,"./tl-ph":185,"./tl-ph.js":185,"./tlh":186,"./tlh.js":186,"./tr":187,"./tr.js":187,"./tzl":188,"./tzl.js":188,"./tzm":189,"./tzm-latn":190,"./tzm-latn.js":190,"./tzm.js":189,"./ug-cn":191,"./ug-cn.js":191,"./uk":192,"./uk.js":192,"./ur":193,"./ur.js":193,"./uz":194,"./uz-latn":195,"./uz-latn.js":195,"./uz.js":194,"./vi":196,"./vi.js":196,"./x-pseudo":197,"./x-pseudo.js":197,"./yo":198,"./yo.js":198,"./zh-cn":199,"./zh-cn.js":199,"./zh-hk":200,"./zh-hk.js":200,"./zh-mo":201,"./zh-mo.js":201,"./zh-tw":202,"./zh-tw.js":202};function r(t){var e=n(t);return s(e)}function n(t){if(!s.o(a,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return a[t]}r.keys=function(){return Object.keys(a)},r.resolve=n,t.exports=r,r.id=274},411:function(t,e,s){"use strict";s.r(e);var a=s(32),r=s(49),n=s(48),i=s(50),o=s(51),l={name:"BudgetLimitRow",mounted:function(){var t;this.locale=null!==(t=localStorage.locale)&&void 0!==t?t:"en-US"},data:function(){return{locale:"en-US"}},props:{budgetLimit:{type:Object,default:function(){return{}}},budget:{type:Object,default:function(){return{}}}}},c=s(1),d=Object(c.a)(l,(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("tr",[s("td",{staticStyle:{width:"25%"}},[s("a",{attrs:{href:"./budgets/show/"+t.budgetLimit.budget_id}},[t._v(t._s(t.budgetLimit.budget_name))])]),t._v(" "),s("td",{staticStyle:{"vertical-align":"middle"}},[s("div",{staticClass:"progress progress active"},[s("div",{staticClass:"progress-bar bg-success progress-bar-striped",style:"width: "+t.budgetLimit.pctGreen+"%;",attrs:{role:"progressbar","aria-valuenow":t.budgetLimit.pctGreen,"aria-valuemin":"0","aria-valuemax":"100"}},[t.budgetLimit.pctGreen>35?s("span",[t._v("\n Spent\n "+t._s(Intl.NumberFormat(t.locale,{style:"currency",currency:t.budgetLimit.currency_code}).format(t.budgetLimit.spent))+"\n of\n "+t._s(Intl.NumberFormat(t.locale,{style:"currency",currency:t.budgetLimit.currency_code}).format(t.budgetLimit.amount))+"\n ")]):t._e()]),t._v(" "),s("div",{staticClass:"progress-bar bg-warning progress-bar-striped",style:"width: "+t.budgetLimit.pctOrange+"%;",attrs:{role:"progressbar","aria-valuenow":t.budgetLimit.pctOrange,"aria-valuemin":"0","aria-valuemax":"100"}},[t.budgetLimit.pctRed<=50&&t.budgetLimit.pctOrange>35?s("span",[t._v("\n Spent\n "+t._s(Intl.NumberFormat(t.locale,{style:"currency",currency:t.budgetLimit.currency_code}).format(t.budgetLimit.spent))+"\n of\n "+t._s(Intl.NumberFormat(t.locale,{style:"currency",currency:t.budgetLimit.currency_code}).format(t.budgetLimit.amount))+"\n ")]):t._e()]),t._v(" "),s("div",{staticClass:"progress-bar bg-danger progress-bar-striped",style:"width: "+t.budgetLimit.pctRed+"%;",attrs:{role:"progressbar","aria-valuenow":t.budgetLimit.pctRed,"aria-valuemin":"0","aria-valuemax":"100"}},[t.budgetLimit.pctOrange<=50&&t.budgetLimit.pctRed>35?s("span",[t._v("\n Spent\n "+t._s(Intl.NumberFormat(t.locale,{style:"currency",currency:t.budgetLimit.currency_code}).format(t.budgetLimit.spent))+"\n of\n "+t._s(Intl.NumberFormat(t.locale,{style:"currency",currency:t.budgetLimit.currency_code}).format(t.budgetLimit.amount))+"\n ")]):t._e()])]),t._v(" "),s("small",{staticClass:"d-none d-lg-block"},[t._v("\n "+t._s(new Intl.DateTimeFormat(t.locale,{year:"numeric",month:"long",day:"numeric"}).format(t.budgetLimit.start))+"\n →\n "+t._s(new Intl.DateTimeFormat(t.locale,{year:"numeric",month:"long",day:"numeric"}).format(t.budgetLimit.end))+"\n ")])]),t._v(" "),s("td",{staticClass:"align-middle d-none d-lg-table-cell",staticStyle:{width:"10%"}},[parseFloat(t.budgetLimit.amount)+parseFloat(t.budgetLimit.spent)>0?s("span",{staticClass:"text-success"},[t._v("\n "+t._s(Intl.NumberFormat(t.locale,{style:"currency",currency:t.budgetLimit.currency_code}).format(parseFloat(t.budgetLimit.amount)+parseFloat(t.budgetLimit.spent)))+"\n ")]):t._e(),t._v(" "),0===parseFloat(t.budgetLimit.amount)+parseFloat(t.budgetLimit.spent)?s("span",{staticClass:"text-muted"},[t._v("\n "+t._s(Intl.NumberFormat(t.locale,{style:"currency",currency:t.budgetLimit.currency_code}).format(0))+"\n ")]):t._e(),t._v(" "),parseFloat(t.budgetLimit.amount)+parseFloat(t.budgetLimit.spent)<0?s("span",{staticClass:"text-danger"},[t._v("\n "+t._s(Intl.NumberFormat(t.locale,{style:"currency",currency:t.budgetLimit.currency_code}).format(parseFloat(t.budgetLimit.amount)+parseFloat(t.budgetLimit.spent)))+"\n ")]):t._e()])])}),[],!1,null,"20d55ede",null).exports,u={name:"BudgetRow",mounted:function(){var t;this.locale=null!==(t=localStorage.locale)&&void 0!==t?t:"en-US"},data:function(){return{locale:"en-US"}},props:{budget:{type:Object,default:{}}}},m={name:"BudgetListGroup",components:{BudgetLimitRow:d,BudgetRow:Object(c.a)(u,(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("tr",[s("td",{staticStyle:{width:"25%"}},[s("a",{attrs:{href:"./budgets/show/"+t.budget.id}},[t._v(t._s(t.budget.name))])]),t._v(" "),s("td",{staticClass:"align-middle text-right"},[s("span",{staticClass:"text-danger"},[t._v("\n "+t._s(Intl.NumberFormat(t.locale,{style:"currency",currency:t.budget.currency_code}).format(parseFloat(t.budget.spent)))+"\n ")])])])}),[],!1,null,"3e0b277e",null).exports},props:{title:String,budgetLimits:Array,budgets:Array}},p={name:"MainBudgetList",components:{BudgetListGroup:Object(c.a)(m,(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"card"},[s("div",{staticClass:"card-header"},[s("h3",{staticClass:"card-title"},[t._v(t._s(t.title))])]),t._v(" "),s("div",{staticClass:"card-body table-responsive p-0"},[s("table",{staticClass:"table table-sm"},[s("tbody",[t._l(t.budgetLimits,(function(t,e){return s("BudgetLimitRow",{key:e,attrs:{budgetLimit:t}})})),t._v(" "),t._l(t.budgets,(function(t,e){return s("BudgetRow",{key:e,attrs:{budget:t}})}))],2)])]),t._v(" "),s("div",{staticClass:"card-footer"},[s("a",{staticClass:"btn btn-default button-sm",attrs:{href:"./budgets"}},[s("i",{staticClass:"far fa-money-bill-alt"}),t._v(" "+t._s(t.$t("firefly.go_to_budgets")))])])])}),[],!1,null,"1480b15a",null).exports},data:function(){return{budgetList:["daily","weekly","monthly","quarterly","half_year","yearly","other"],budgetLimits:{daily:[],weekly:[],monthly:[],quarterly:[],half_year:[],yearly:[],other:[]},budgets:{},rawBudgets:[],locale:"en-US"}},created:function(){var t;this.locale=null!==(t=localStorage.locale)&&void 0!==t?t:"en-US",this.collectData()},methods:{collectData:function(){this.getBudgets()},getBudgets:function(){var t=this;axios.get("./api/v1/budgets?start="+window.sessionStart+"&end="+window.sessionEnd).then((function(e){t.parseBudgets(e.data)}))},parseBudgets:function(t){for(var e in t.data)if(t.data.hasOwnProperty(e)&&/^0$|^[1-9]\d*$/.test(e)&&e<=4294967294){var s=t.data[e];for(var a in s.attributes.spent)if(s.attributes.spent.hasOwnProperty(a)&&/^0$|^[1-9]\d*$/.test(a)&&a<=4294967294){var r=s.attributes.spent[a];this.rawBudgets.push({id:parseInt(s.id),name:s.attributes.name,currency_id:parseInt(r.currency_id),currency_code:r.currency_code,spent:r.sum})}}this.getBudgetLimits()},getBudgetLimits:function(){var t=this;axios.get("./api/v1/budgets/limits?start="+window.sessionStart+"&end="+window.sessionEnd).then((function(e){t.parseBudgetLimits(e.data)}))},parseBudgetLimits:function(t){for(var e in t.included)t.included.hasOwnProperty(e)&&/^0$|^[1-9]\d*$/.test(e)&&e<=4294967294&&(this.budgets[t.included[e].id]={id:t.included[e].id,name:t.included[e].attributes.name});for(var s in t.data)if(t.data.hasOwnProperty(s)&&/^0$|^[1-9]\d*$/.test(s)&&s<=4294967294){var a,r=0,n=0,i=0;this.filterBudgets(t.data[s].attributes.budget_id,t.data[s].attributes.currency_id),0!==parseFloat(t.data[s].attributes.spent)&&-1*parseFloat(t.data[s].attributes.spent)<parseFloat(t.data[s].attributes.amount)&&(r=-1*parseFloat(t.data[s].attributes.spent)/parseFloat(t.data[s].attributes.amount)*100),0!==parseFloat(t.data[s].attributes.spent)&&-1*parseFloat(t.data[s].attributes.spent)>parseFloat(t.data[s].attributes.amount)&&(i=100-(n=parseFloat(t.data[s].attributes.amount)/parseFloat(t.data[s].attributes.spent)*-1*100));var o={id:t.data[s].id,amount:t.data[s].attributes.amount,budget_id:t.data[s].attributes.budget_id,budget_name:this.budgets[t.data[s].attributes.budget_id].name,currency_id:t.data[s].attributes.currency_id,currency_code:t.data[s].attributes.currency_code,period:t.data[s].attributes.period,start:new Date(t.data[s].attributes.start),end:new Date(t.data[s].attributes.end),spent:t.data[s].attributes.spent,pctGreen:r,pctOrange:n,pctRed:i},l=null!==(a=t.data[s].attributes.period)&&void 0!==a?a:"other";this.budgetLimits[l].push(o)}},filterBudgets:function(t,e){for(var s in this.rawBudgets)this.rawBudgets.hasOwnProperty(s)&&/^0$|^[1-9]\d*$/.test(s)&&s<=4294967294&&this.rawBudgets[s].currency_id===e&&this.rawBudgets[s].id===t&&this.rawBudgets.splice(s,1)}}},g=Object(c.a)(p,(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",[s("div",{staticClass:"row"},[t.budgetLimits.daily.length>0?s("div",{staticClass:"col-xl-6 col-lg-12 col-md-12 col-sm-12 col-xs-12"},[s("BudgetListGroup",{attrs:{title:t.$t("firefly.daily_budgets"),budgetLimits:t.budgetLimits.daily}})],1):t._e(),t._v(" "),t.budgetLimits.weekly.length>0?s("div",{staticClass:"col-xl-6 col-lg-12 col-md-12 col-sm-12 col-xs-12"},[s("BudgetListGroup",{attrs:{title:t.$t("firefly.weekly_budgets"),budgetLimits:t.budgetLimits.weekly}})],1):t._e(),t._v(" "),t.budgetLimits.monthly.length>0?s("div",{staticClass:"col-xl-6 col-lg-12 col-md-12 col-sm-12 col-xs-12"},[s("BudgetListGroup",{attrs:{title:t.$t("firefly.monthly_budgets"),budgetLimits:t.budgetLimits.monthly}})],1):t._e(),t._v(" "),t.budgetLimits.quarterly.length>0?s("div",{staticClass:"col-xl-6 col-lg-12 col-md-12 col-sm-12 col-xs-12"},[s("BudgetListGroup",{attrs:{title:t.$t("firefly.quarterly_budgets"),budgetLimits:t.budgetLimits.quarterly}})],1):t._e(),t._v(" "),t.budgetLimits.half_year.length>0?s("div",{staticClass:"col-xl-6 col-lg-12 col-md-12 col-sm-12 col-xs-12"},[s("BudgetListGroup",{attrs:{title:t.$t("firefly.half_year_budgets"),budgetLimits:t.budgetLimits.half_year}})],1):t._e(),t._v(" "),t.budgetLimits.yearly.length>0?s("div",{staticClass:"col-xl-6 col-lg-12 col-md-12 col-sm-12 col-xs-12"},[s("BudgetListGroup",{attrs:{title:t.$t("firefly.yearly_budgets"),budgetLimits:t.budgetLimits.yearly}})],1):t._e(),t._v(" "),t.budgetLimits.other.length>0||t.rawBudgets.length>0?s("div",{staticClass:"col-xl-6 col-lg-12 col-md-12 col-sm-12 col-xs-12"},[s("BudgetListGroup",{attrs:{title:t.$t("firefly.other_budgets"),budgetLimits:t.budgetLimits.other,budgets:t.rawBudgets}})],1):t._e()])])}),[],!1,null,"f0d512f0",null).exports,b={name:"MainCreditList",data:function(){return{locale:"en-US",income:[],max:0}},created:function(){var t;this.locale=null!==(t=localStorage.locale)&&void 0!==t?t:"en-US",this.getExpenses()},methods:{getExpenses:function(){var t=this;axios.get("./api/v1/insight/income/date/basic?start="+window.sessionStart+"&end="+window.sessionEnd).then((function(e){t.parseExpenses(e.data)}))},parseExpenses:function(t){for(var e in t)if(t.hasOwnProperty(e)&&/^0$|^[1-9]\d*$/.test(e)&&e<=4294967294){var s=t[e];0===parseInt(e)&&(this.max=t[e].difference_float,s.pct=100),0!==parseInt(e)&&(s.pct=t[e].difference_float/this.max*100),this.income.push(s)}}}},f=Object(c.a)(b,(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"card"},[s("div",{staticClass:"card-header"},[s("h3",{staticClass:"card-title"},[t._v(t._s(t.$t("firefly.revenue_accounts")))])]),t._v(" "),s("div",{staticClass:"card-body table-responsive p-0"},[s("table",{staticClass:"table table-sm"},[s("tbody",t._l(t.income,(function(e){return s("tr",[s("td",{staticStyle:{width:"20%"}},[s("a",{attrs:{href:"./accounts/show/"+e.id}},[t._v(t._s(e.name))])]),t._v(" "),s("td",{staticClass:"align-middle"},[e.pct>0?s("div",{staticClass:"progress"},[s("div",{staticClass:"progress-bar progress-bar-striped bg-success",style:{width:e.pct+"%"},attrs:{role:"progressbar","aria-valuenow":e.pct,"aria-valuemin":"0","aria-valuemax":"100"}},[e.pct>20?s("span",[t._v("\n "+t._s(Intl.NumberFormat(t.locale,{style:"currency",currency:e.currency_code}).format(e.difference_float))+"\n ")]):t._e()]),t._v(" "),e.pct<=20?s("span",[t._v(" \n "+t._s(Intl.NumberFormat(t.locale,{style:"currency",currency:e.currency_code}).format(e.difference_float))+"\n ")]):t._e()]):t._e()])])})),0)])]),t._v(" "),s("div",{staticClass:"card-footer"},[s("a",{staticClass:"btn btn-default button-sm",attrs:{href:"./transactions/deposit"}},[s("i",{staticClass:"far fa-money-bill-alt"}),t._v(" "+t._s(t.$t("firefly.go_to_deposits")))])])])}),[],!1,null,null,null).exports,v={name:"MainDebitList",data:function(){return{locale:"en-US",expenses:[],max:0}},created:function(){var t;this.locale=null!==(t=localStorage.locale)&&void 0!==t?t:"en-US",this.getExpenses()},methods:{getExpenses:function(){var t=this;axios.get("./api/v1/insight/expense/date/basic?start="+window.sessionStart+"&end="+window.sessionEnd).then((function(e){t.parseExpenses(e.data)}))},parseExpenses:function(t){for(var e in t)if(t.hasOwnProperty(e)&&/^0$|^[1-9]\d*$/.test(e)&&e<=4294967294){var s=t[e];0===parseInt(e)&&(this.max=t[e].difference_float,s.pct=100),0!==parseInt(e)&&(s.pct=t[e].difference_float/this.max*100),this.expenses.push(s)}}}},y=Object(c.a)(v,(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"card"},[s("div",{staticClass:"card-header"},[s("h3",{staticClass:"card-title"},[t._v(t._s(t.$t("firefly.expense_accounts")))])]),t._v(" "),s("div",{staticClass:"card-body table-responsive p-0"},[s("table",{staticClass:"table table-sm"},[s("tbody",t._l(t.expenses,(function(e){return s("tr",[s("td",{staticStyle:{width:"20%"}},[s("a",{attrs:{href:"./accounts/show/"+e.id}},[t._v(t._s(e.name))])]),t._v(" "),s("td",{staticClass:"align-middle"},[e.pct>0?s("div",{staticClass:"progress"},[s("div",{staticClass:"progress-bar progress-bar-striped bg-danger",style:{width:e.pct+"%"},attrs:{role:"progressbar","aria-valuenow":e.pct,"aria-valuemin":"0","aria-valuemax":"100"}},[e.pct>20?s("span",[t._v("\n "+t._s(Intl.NumberFormat(t.locale,{style:"currency",currency:e.currency_code}).format(e.difference_float))+"\n ")]):t._e()]),t._v(" "),e.pct<=20?s("span",[t._v(" \n "+t._s(Intl.NumberFormat(t.locale,{style:"currency",currency:e.currency_code}).format(e.difference_float))+"\n ")]):t._e()]):t._e()])])})),0)])]),t._v(" "),s("div",{staticClass:"card-footer"},[s("a",{staticClass:"btn btn-default button-sm",attrs:{href:"./transactions/withdrawal"}},[s("i",{staticClass:"far fa-money-bill-alt"}),t._v(" "+t._s(t.$t("firefly.go_to_withdrawals")))])])])}),[],!1,null,null,null).exports,_=s(52),h=s(53),j=s(54),w=s(55),L=s(233),C=s.n(L),x={name:"Calendar",created:function(){},data:function(){return{locale:"en-US",range:{start:new Date(window.sessionStart),end:new Date(window.sessionEnd)},defaultRange:{start:new Date(window.sessionStart),end:new Date(window.sessionEnd)}}}},F=(s(245),Object(c.a)(x,(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",[s("div",{staticClass:"row"},[s("div",{staticClass:"col"},[t._v("Start")]),t._v(" "),s("div",{staticClass:"col-8"},[t._v(t._s(new Intl.DateTimeFormat(t.locale,{year:"numeric",month:"long",day:"numeric"}).format(t.range.start)))])]),t._v(" "),s("div",{staticClass:"row"},[s("div",{staticClass:"col"},[t._v("End")]),t._v(" "),s("div",{staticClass:"col-8"},[t._v(t._s(new Intl.DateTimeFormat(t.locale,{year:"numeric",month:"long",day:"numeric"}).format(t.range.end)))])]),t._v(" "),s("date-picker",{attrs:{mode:"date",rows:"2","is-range":""},scopedSlots:t._u([{key:"default",fn:function(e){var a=e.inputValue,r=e.inputEvents,n=e.isDragging,i=e.togglePopover;return[s("div",{staticClass:"row"},[s("div",{staticClass:"col"},[s("div",{staticClass:"btn-group btn-group-sm d-flex"},[s("button",{staticClass:"btn btn-secondary btn-sm",on:{click:function(t){return i({placement:"auto-start",positionFixed:!0})}}},[s("i",{staticClass:"fas fa-calendar-alt"})]),t._v(" "),s("button",{staticClass:"btn btn-secondary"},[s("i",{staticClass:"fas fa-history"})]),t._v(" "),s("button",{staticClass:"btn btn-secondary dropdown-toggle",attrs:{type:"button",id:"dropdownMenuButton","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"}},[s("i",{staticClass:"fas fa-list"})]),t._v(" "),s("div",{staticClass:"dropdown-menu",attrs:{"aria-labelledby":"dropdownMenuButton"}},[s("a",{staticClass:"dropdown-item",attrs:{href:"#"}},[t._v("(prev period)")]),t._v(" "),s("a",{staticClass:"dropdown-item",attrs:{href:"#"}},[t._v("(next period)")]),t._v(" "),s("a",{staticClass:"dropdown-item",attrs:{href:"#"}},[t._v("(this week?)")])])]),t._v(" "),s("input",t._g({class:n?"text-gray-600":"text-gray-900",attrs:{type:"hidden"},domProps:{value:a.start}},r.start)),t._v(" "),s("input",t._g({class:n?"text-gray-600":"text-gray-900",attrs:{type:"hidden"},domProps:{value:a.end}},r.end))])])]}}]),model:{value:t.range,callback:function(e){t.range=e},expression:"range"}})],1)}),[],!1,null,"03e62f58",null).exports),k={name:"MainCategoryList",created:function(){var t;this.locale=null!==(t=localStorage.locale)&&void 0!==t?t:"en-US",this.getCategories()},data:function(){return{locale:"en-US",categories:[],sortedList:[],spent:0,earned:0}},methods:{getCategories:function(){var t=this;axios.get("./api/v1/categories?start="+window.sessionStart+"&end="+window.sessionEnd).then((function(e){t.parseCategories(e.data)}))},parseCategories:function(t){for(var e in t.data)if(t.data.hasOwnProperty(e)&&/^0$|^[1-9]\d*$/.test(e)&&e<=4294967294){var s=t.data[e],a=null,r=parseInt(s.id);for(var n in s.attributes.spent)if(s.attributes.spent.hasOwnProperty(n)&&/^0$|^[1-9]\d*$/.test(n)&&n<=4294967294){var i,o=s.attributes.spent[n];a=o.currency_id.toString()+"-"+s.id.toString(),this.categories[a]=null!==(i=this.categories[a])&&void 0!==i?i:{id:r,name:s.attributes.name,currency_code:o.currency_code,currency_symbol:o.currency_symbol,spent:0,earned:0,spentPct:0,earnedPct:0},this.categories[a].spent=parseFloat(o.sum),this.spent=parseFloat(o.sum)<this.spent?parseFloat(o.sum):this.spent}for(var l in s.attributes.earned)if(s.attributes.earned.hasOwnProperty(l)&&/^0$|^[1-9]\d*$/.test(l)&&l<=4294967294){var c,d=s.attributes.earned[l];a=d.currency_id.toString()+"-"+s.id.toString(),this.categories[a]=null!==(c=this.categories[a])&&void 0!==c?c:{id:r,name:s.attributes.name,currency_code:d.currency_code,currency_symbol:d.currency_symbol,spent:0,earned:0,spentPct:0,earnedPct:0},this.categories[a].earned=parseFloat(d.sum),this.earned=parseFloat(d.sum)>this.earned?parseFloat(d.sum):this.earned}}this.sortCategories()},sortCategories:function(){var t=[];for(var e in this.categories)this.categories.hasOwnProperty(e)&&t.push(this.categories[e]);for(var s in t.sort((function(t,e){return t.spent+t.earned-(e.spent+e.earned)})),t)if(t.hasOwnProperty(s)){var a=t[s];a.spentPct=a.spent/this.spent*100,a.earnedPct=a.earned/this.earned*100,this.sortedList.push(a)}}}},S=Object(c.a)(k,(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"card"},[s("div",{staticClass:"card-header"},[s("h3",{staticClass:"card-title"},[t._v(t._s(t.$t("firefly.categories")))])]),t._v(" "),s("div",{staticClass:"card-body table-responsive p-0"},[s("table",{staticClass:"table table-sm"},[s("tbody",t._l(t.sortedList,(function(e){return s("tr",[s("td",{staticStyle:{width:"20%"}},[s("a",{attrs:{href:"./categories/show/"+e.id}},[t._v(t._s(e.name))])]),t._v(" "),s("td",{staticClass:"align-middle"},[e.spentPct>0?s("div",{staticClass:"progress"},[s("div",{staticClass:"progress-bar progress-bar-striped bg-danger",style:{width:e.spentPct+"%"},attrs:{role:"progressbar","aria-valuenow":e.spentPct,"aria-valuemin":"0","aria-valuemax":"100"}},[e.spentPct>20?s("span",[t._v("\n "+t._s(Intl.NumberFormat(t.locale,{style:"currency",currency:e.currency_code}).format(e.spent))+"\n ")]):t._e()]),t._v(" "),e.spentPct<=20?s("span",[t._v(" \n "+t._s(Intl.NumberFormat(t.locale,{style:"currency",currency:e.currency_code}).format(e.spent))+"\n ")]):t._e()]):t._e(),t._v(" "),e.earnedPct>0?s("div",{staticClass:"progress justify-content-end",attrs:{title:"hello2"}},[e.earnedPct<=20?s("span",[t._v("\n "+t._s(Intl.NumberFormat(t.locale,{style:"currency",currency:e.currency_code}).format(e.earned))+"\n  ")]):t._e(),t._v(" "),s("div",{staticClass:"progress-bar progress-bar-striped bg-success",style:{width:e.earnedPct+"%"},attrs:{role:"progressbar","aria-valuenow":e.earnedPct,"aria-valuemin":"0","aria-valuemax":"100",title:"hello"}},[e.earnedPct>20?s("span",[t._v("\n "+t._s(Intl.NumberFormat(t.locale,{style:"currency",currency:e.currency_code}).format(e.earned))+"\n ")]):t._e()])]):t._e()])])})),0)])])])}),[],!1,null,"00bc733f",null).exports,$=s(2),B=s.n($),O=s(3),P=s(22);s(15),s(273),B.a.component("transaction-list-large",h.a),B.a.component("transaction-list-medium",j.a),B.a.component("transaction-list-small",w.a),B.a.component("date-picker",C.a),B.a.component("dashboard",a.a),B.a.component("top-boxes",r.a),B.a.component("main-account",n.a),B.a.component("main-account-list",i.a),B.a.component("main-bills-list",o.a),B.a.component("main-budget-list",g),B.a.component("main-category-list",S),B.a.component("main-debit-list",y),B.a.component("main-credit-list",f),B.a.component("main-piggy-list",_.a),B.a.use(O.c);var I=s(18),E={};new B.a({i18n:I,store:P.a,el:"#dashboard",render:function(t){return t(a.a,{props:E})},beforeCreate:function(){this.$store.commit("initialiseStore"),this.$store.dispatch("updateCurrencyPreference")}}),new B.a({i18n:I,store:P.a,el:"#calendar",render:function(t){return t(F,{props:E})}})},417:function(t,e){},59:function(t,e,s){var a=s(246);"string"==typeof a&&(a=[[t.i,a,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};s(34)(a,r);a.locals&&(t.exports=a.locals)}},[[242,0,1]]]);
//# sourceMappingURL=dashboard.js.map