Files
firefly-iii/public/v2/js/dashboard.js
James Cole 9d05d26aa4 Rebuild FP
2020-12-25 12:49:28 +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],{169:function(t,e,s){s(234),t.exports=s(240)},172:function(t,e,s){"use strict";s(23)},173:function(t,e,s){(t.exports=s(174)(!1)).push([t.i,".dropdown-item[data-v-03e62f58],.dropdown-item[data-v-03e62f58]:hover{color:#212529}",""])},204:function(t,e,s){var a={"./af":32,"./af.js":32,"./ar":33,"./ar-dz":34,"./ar-dz.js":34,"./ar-kw":35,"./ar-kw.js":35,"./ar-ly":36,"./ar-ly.js":36,"./ar-ma":37,"./ar-ma.js":37,"./ar-sa":38,"./ar-sa.js":38,"./ar-tn":39,"./ar-tn.js":39,"./ar.js":33,"./az":40,"./az.js":40,"./be":41,"./be.js":41,"./bg":42,"./bg.js":42,"./bm":43,"./bm.js":43,"./bn":44,"./bn-bd":45,"./bn-bd.js":45,"./bn.js":44,"./bo":46,"./bo.js":46,"./br":47,"./br.js":47,"./bs":48,"./bs.js":48,"./ca":49,"./ca.js":49,"./cs":50,"./cs.js":50,"./cv":51,"./cv.js":51,"./cy":52,"./cy.js":52,"./da":53,"./da.js":53,"./de":54,"./de-at":55,"./de-at.js":55,"./de-ch":56,"./de-ch.js":56,"./de.js":54,"./dv":57,"./dv.js":57,"./el":58,"./el.js":58,"./en-au":59,"./en-au.js":59,"./en-ca":60,"./en-ca.js":60,"./en-gb":61,"./en-gb.js":61,"./en-ie":62,"./en-ie.js":62,"./en-il":63,"./en-il.js":63,"./en-in":64,"./en-in.js":64,"./en-nz":65,"./en-nz.js":65,"./en-sg":66,"./en-sg.js":66,"./eo":67,"./eo.js":67,"./es":68,"./es-do":69,"./es-do.js":69,"./es-mx":70,"./es-mx.js":70,"./es-us":71,"./es-us.js":71,"./es.js":68,"./et":72,"./et.js":72,"./eu":73,"./eu.js":73,"./fa":74,"./fa.js":74,"./fi":75,"./fi.js":75,"./fil":76,"./fil.js":76,"./fo":77,"./fo.js":77,"./fr":78,"./fr-ca":79,"./fr-ca.js":79,"./fr-ch":80,"./fr-ch.js":80,"./fr.js":78,"./fy":81,"./fy.js":81,"./ga":82,"./ga.js":82,"./gd":83,"./gd.js":83,"./gl":84,"./gl.js":84,"./gom-deva":85,"./gom-deva.js":85,"./gom-latn":86,"./gom-latn.js":86,"./gu":87,"./gu.js":87,"./he":88,"./he.js":88,"./hi":89,"./hi.js":89,"./hr":90,"./hr.js":90,"./hu":91,"./hu.js":91,"./hy-am":92,"./hy-am.js":92,"./id":93,"./id.js":93,"./is":94,"./is.js":94,"./it":95,"./it-ch":96,"./it-ch.js":96,"./it.js":95,"./ja":97,"./ja.js":97,"./jv":98,"./jv.js":98,"./ka":99,"./ka.js":99,"./kk":100,"./kk.js":100,"./km":101,"./km.js":101,"./kn":102,"./kn.js":102,"./ko":103,"./ko.js":103,"./ku":104,"./ku.js":104,"./ky":105,"./ky.js":105,"./lb":106,"./lb.js":106,"./lo":107,"./lo.js":107,"./lt":108,"./lt.js":108,"./lv":109,"./lv.js":109,"./me":110,"./me.js":110,"./mi":111,"./mi.js":111,"./mk":112,"./mk.js":112,"./ml":113,"./ml.js":113,"./mn":114,"./mn.js":114,"./mr":115,"./mr.js":115,"./ms":116,"./ms-my":117,"./ms-my.js":117,"./ms.js":116,"./mt":118,"./mt.js":118,"./my":119,"./my.js":119,"./nb":120,"./nb.js":120,"./ne":121,"./ne.js":121,"./nl":122,"./nl-be":123,"./nl-be.js":123,"./nl.js":122,"./nn":124,"./nn.js":124,"./oc-lnc":125,"./oc-lnc.js":125,"./pa-in":126,"./pa-in.js":126,"./pl":127,"./pl.js":127,"./pt":128,"./pt-br":129,"./pt-br.js":129,"./pt.js":128,"./ro":130,"./ro.js":130,"./ru":131,"./ru.js":131,"./sd":132,"./sd.js":132,"./se":133,"./se.js":133,"./si":134,"./si.js":134,"./sk":135,"./sk.js":135,"./sl":136,"./sl.js":136,"./sq":137,"./sq.js":137,"./sr":138,"./sr-cyrl":139,"./sr-cyrl.js":139,"./sr.js":138,"./ss":140,"./ss.js":140,"./sv":141,"./sv.js":141,"./sw":142,"./sw.js":142,"./ta":143,"./ta.js":143,"./te":144,"./te.js":144,"./tet":145,"./tet.js":145,"./tg":146,"./tg.js":146,"./th":147,"./th.js":147,"./tk":148,"./tk.js":148,"./tl-ph":149,"./tl-ph.js":149,"./tlh":150,"./tlh.js":150,"./tr":151,"./tr.js":151,"./tzl":152,"./tzl.js":152,"./tzm":153,"./tzm-latn":154,"./tzm-latn.js":154,"./tzm.js":153,"./ug-cn":155,"./ug-cn.js":155,"./uk":156,"./uk.js":156,"./ur":157,"./ur.js":157,"./uz":158,"./uz-latn":159,"./uz-latn.js":159,"./uz.js":158,"./vi":160,"./vi.js":160,"./x-pseudo":161,"./x-pseudo.js":161,"./yo":162,"./yo.js":162,"./zh-cn":163,"./zh-cn.js":163,"./zh-hk":164,"./zh-hk.js":164,"./zh-mo":165,"./zh-mo.js":165,"./zh-tw":166,"./zh-tw.js":166};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=204},23:function(t,e,s){var a=s(173);"string"==typeof a&&(a=[[t.i,a,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};s(175)(a,r);a.locals&&(t.exports=a.locals)},234:function(t,e,s){"use strict";s.r(e);var a=s(12),r=s(14),n=s(13),i=s(15),o=s(16),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(17),h=s(18),j=s(19),w=s(20),L=s(168),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(172),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(5),P=s(11);s(8),s(202),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(10),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})}})},240:function(t,e){}},[[169,0,1]]]);
//# sourceMappingURL=dashboard.js.map