From 5c81e982180ae88b957b294a9a8d353ca3d8f876 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 13 Jan 2024 20:34:09 +0100 Subject: [PATCH] Add list of transactions. --- .../assets/autocomplete-functions-ac0d2cb1.js | 1 - public/build/assets/create-46b63de1.js | 1 + public/build/assets/create-9af1982c.js | 1 - ...oard-d274a3dc.js => dashboard-2ad8d866.js} | 2 +- public/build/assets/edit-4a0660ed.js | 1 - public/build/assets/edit-b45ed381.js | 1 + public/build/assets/format-money-43e05102.js | 1 + public/build/assets/format-money-e259f5e4.js | 1 - .../{get-da167d5b.js => get-94678769.js} | 2 +- .../{get-3bb14de5.js => get-a29f6df7.js} | 2 +- public/build/assets/index-8df22335.js | 1 + .../{show-9f0eb3b4.js => show-61e79d17.js} | 2 +- ...plice-errors-into-transactions-9c9b99c0.js | 1 + public/build/manifest.json | 91 +++++----- public/v2/i18n/{en_US.json => en.json} | 0 .../assets/v2/pages/transactions/index.js | 148 ++++++++++++++++ .../assets/v2/support/load-translations.js | 11 +- .../views/v2/transactions/index.blade.php | 167 ++++++++++++++++++ .../views/v2/transactions/show.blade.php | 10 +- vite.config.js | 1 + 20 files changed, 385 insertions(+), 60 deletions(-) delete mode 100644 public/build/assets/autocomplete-functions-ac0d2cb1.js create mode 100644 public/build/assets/create-46b63de1.js delete mode 100644 public/build/assets/create-9af1982c.js rename public/build/assets/{dashboard-d274a3dc.js => dashboard-2ad8d866.js} (99%) delete mode 100644 public/build/assets/edit-4a0660ed.js create mode 100644 public/build/assets/edit-b45ed381.js create mode 100644 public/build/assets/format-money-43e05102.js delete mode 100644 public/build/assets/format-money-e259f5e4.js rename public/build/assets/{get-da167d5b.js => get-94678769.js} (81%) rename public/build/assets/{get-3bb14de5.js => get-a29f6df7.js} (66%) create mode 100644 public/build/assets/index-8df22335.js rename public/build/assets/{show-9f0eb3b4.js => show-61e79d17.js} (91%) create mode 100644 public/build/assets/splice-errors-into-transactions-9c9b99c0.js rename public/v2/i18n/{en_US.json => en.json} (100%) create mode 100644 resources/assets/v2/pages/transactions/index.js create mode 100644 resources/views/v2/transactions/index.blade.php diff --git a/public/build/assets/autocomplete-functions-ac0d2cb1.js b/public/build/assets/autocomplete-functions-ac0d2cb1.js deleted file mode 100644 index 6327601eaa..0000000000 --- a/public/build/assets/autocomplete-functions-ac0d2cb1.js +++ /dev/null @@ -1 +0,0 @@ -import{a as l}from"./format-money-e259f5e4.js";import{a as p,G as m}from"./get-da167d5b.js";import{n as f}from"./vendor-fca45885.js";let g=class{list(t){return l.get("/api/v2/currencies",{params:t})}};function v(){let e={page:1,limit:1337};return new g().list(e).then(a=>{let n={defaultCurrency:{},nativeCurrencies:[],foreignCurrencies:[],enabledCurrencies:[]};n.foreignCurrencies.push({id:0,name:"(no foreign currency)",code:"",default:!1,symbol:"",decimal_places:2});for(let i in a.data.data)if(a.data.data.hasOwnProperty(i)){let r=a.data.data[i];if(r.attributes.enabled){let u={id:r.id,name:r.attributes.name,code:r.attributes.code,default:r.attributes.default,symbol:r.attributes.symbol,decimal_places:r.attributes.decimal_places};u.default&&(n.defaultCurrency=u),n.enabledCurrencies.push(u),n.nativeCurrencies.push(u),n.foreignCurrencies.push(u)}}return n})}class _{list(t){return l.get("/api/v2/budgets",{params:t})}}function I(){let e={page:1,limit:1337};return new _().list(e).then(a=>{let n=[{id:0,name:"(no budget)"}];for(let i in a.data.data)if(a.data.data.hasOwnProperty(i)){let r=a.data.data[i],u={id:r.id,name:r.attributes.name};n.push(u)}return n})}function x(){let e={page:1,limit:1337};return new p().list(e).then(a=>{let n={0:{id:0,name:"(no group)",order:0,piggyBanks:[{id:0,name:"(no piggy bank)",order:0}]}};for(let i in a.data.data)if(a.data.data.hasOwnProperty(i)){let r=a.data.data[i],u=r.attributes.object_group_id??"0",c=r.attributes.object_group_title??"(no group)",d={id:r.id,name:r.attributes.name,order:r.attributes.order};n.hasOwnProperty(u)||(n[u]={id:u,name:c,order:r.attributes.object_group_order??0,piggyBanks:[]}),n[u].piggyBanks.push(d),n[u].piggyBanks.sort((o,s)=>o.order-s.order)}return Object.keys(n).sort().reduce((i,r)=>(i[r]=n[r],i),{})})}function k(){let e={page:1,limit:1337};return new m().list(e).then(a=>{let n={0:{id:0,name:"(no group)",order:0,subscriptions:[{id:0,name:"(no subscription)",order:0}]}};for(let i in a.data.data)if(a.data.data.hasOwnProperty(i)){let r=a.data.data[i],u=r.attributes.object_group_id??"0",c=r.attributes.object_group_title??"(no group)",d={id:r.id,name:r.attributes.name,order:r.attributes.order};n.hasOwnProperty(u)||(n[u]={id:u,name:c,order:r.attributes.object_group_order??0,subscriptions:[]}),n[u].subscriptions.push(d),n[u].subscriptions.sort((o,s)=>o.order-s.order)}return Object.keys(n).sort().reduce((i,r)=>(i[r]=n[r],i),{})})}function q(){return{description:"/api/v2/autocomplete/transaction-descriptions",account:"/api/v2/autocomplete/accounts",category:"/api/v2/autocomplete/categories",tag:"/api/v2/autocomplete/tags"}}function C(e){const t={server:e.serverUrl,serverParams:{},fetchOptions:{headers:{"X-CSRF-TOKEN":document.head.querySelector('meta[name="csrf-token"]').content}},hiddenInput:!0,highlightTyped:!0,liveServer:!0};typeof e.filters<"u"&&e.filters.length>0&&(t.serverParams.types=e.filters),typeof e.onRenderItem<"u"&&e.onRenderItem!==null&&(t.onRenderItem=e.onRenderItem),e.valueField&&(t.valueField=e.valueField),e.labelField&&(t.labelField=e.labelField),e.onSelectItem&&(t.onSelectItem=e.onSelectItem),e.onChange&&(t.onChange=e.onChange),e.hiddenValue&&(t.hiddenValue=e.hiddenValue),f.init(e.selector,t)}function j(e,t){const a=parseInt(t._searchInput.attributes["data-index"].value);if(typeof e<"u"&&e.name){document.querySelector("#form")._x_dataStack[0].$data.entries[a].category_name=e.name;return}document.querySelector("#form")._x_dataStack[0].$data.entries[a].category_name=t._searchInput.value}function $(e,t){const a=parseInt(t._searchInput.attributes["data-index"].value);if(typeof e<"u"&&e.description){document.querySelector("#form")._x_dataStack[0].$data.entries[a].description=e.description;return}document.querySelector("#form")._x_dataStack[0].$data.entries[a].description=t._searchInput.value}function w(e,t){if(typeof e>"u"){const a=parseInt(t._searchInput.attributes["data-index"].value);if(document.querySelector("#form")._x_dataStack[0].$data.entries[a].destination_account.name===t._searchInput.value){console.warn('Ignore hallucinated destination account name change to "'+t._searchInput.value+'"');return}document.querySelector("#form")._x_dataStack[0].$data.entries[a].destination_account={name:t._searchInput.value,alpine_name:t._searchInput.value},document.querySelector("#form")._x_dataStack[0].changedDestinationAccount()}}function A(e,t){const a=parseInt(t._searchInput.attributes["data-index"].value);document.querySelector("#form")._x_dataStack[0].$data.entries[a].destination_account={id:e.id,name:e.name,alpine_name:e.name,type:e.type,currency_code:e.currency_code},document.querySelector("#form")._x_dataStack[0].changedDestinationAccount()}function G(e,t){if(typeof e>"u"){const a=parseInt(t._searchInput.attributes["data-index"].value);if(document.querySelector("#form")._x_dataStack[0].$data.entries[a].source_account.name===t._searchInput.value)return;document.querySelector("#form")._x_dataStack[0].$data.entries[a].source_account={name:t._searchInput.value,alpine_name:t._searchInput.value},document.querySelector("#form")._x_dataStack[0].changedSourceAccount()}}function O(e,t){const a=parseInt(t._searchInput.attributes["data-index"].value);document.querySelector("#form")._x_dataStack[0].$data.entries[a].source_account={id:e.id,name:e.name,alpine_name:e.name,type:e.type,currency_code:e.currency_code},document.querySelector("#form")._x_dataStack[0].changedSourceAccount()}export{I as a,x as b,k as c,C as d,G as e,w as f,A as g,q as h,j as i,$ as j,v as l,O as s}; diff --git a/public/build/assets/create-46b63de1.js b/public/build/assets/create-46b63de1.js new file mode 100644 index 0000000000..3a3ab19aec --- /dev/null +++ b/public/build/assets/create-46b63de1.js @@ -0,0 +1 @@ +import{a as m,d as y,f as d}from"./format-money-43e05102.js";import{d as w,c as b}from"./create-empty-split-fb5bda92.js";import{l as v,a as C,b as T,c as E,p as P,d as _,s as L,e as c,f as S,g as D,h as A,i as x,j as k,k as h,m as p}from"./splice-errors-into-transactions-9c9b99c0.js";import{l,i as r,m as B}from"./vendor-fca45885.js";import"./get-94678769.js";class M{post(t){let s="/api/v2/transactions";return m.post(s,t)}}let n=[],u=[];document.addEventListener("location-remove",e=>{u[e.detail.index].remove()});function O(e){let t=0;if(document.querySelector("#form")._x_dataStack[0].$data.entries[t].hasLocation===!1){u[t]=new l.marker(e.latlng,{draggable:!0}),u[t].on("dragend",U),u[t].addTo(n[t]);const i=new CustomEvent("location-set",{detail:{latitude:e.latlng.lat,longitude:e.latlng.lng,index:t,zoomLevel:n[t].getZoom()}});document.dispatchEvent(i)}}function F(e){let t=0;const s=new CustomEvent("location-zoom",{detail:{index:t,zoomLevel:n[t].getZoom()}});document.dispatchEvent(s)}function U(e){let t=e.target,s=t.getLatLng();t.setLatLng(new l.LatLng(s.lat,s.lng),{draggable:"true"});const i=new CustomEvent("location-move",{detail:{latitude:s.lat,longitude:s.lng,index:0}});document.dispatchEvent(i)}function z(e){if(e>0){console.warn("Corwardly refuse to add a map on split #"+(e+1));return}if(typeof n[e]>"u"){let t=document.getElementById("location_map");n[e]=l.map(t).setView([t.dataset.latitude,t.dataset.longitude],t.dataset.zoomLevel),l.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png",{maxZoom:19,attribution:'© OpenStreetMap'}).addTo(n[e]),n[e].on("click",O),n[e].on("zoomend",F)}}const a=k();let I=function(){return{entries:[],formStates:{loadingCurrencies:!0,loadingBudgets:!0,loadingPiggyBanks:!0,loadingSubscriptions:!0,isSubmitting:!1,returnHereButton:!1,saveAsNewButton:!1,resetButton:!0,rulesButton:!0,webhooksButton:!0},formBehaviour:{formType:"create",foreignCurrencyEnabled:!0},formData:{defaultCurrency:null,enabledCurrencies:[],nativeCurrencies:[],foreignCurrencies:[],budgets:[],piggyBanks:[],subscriptions:[]},groupProperties:{transactionType:"unknown",title:null,id:null,totalAmount:0},notifications:{error:{show:!1,text:"",url:""},success:{show:!1,text:"",url:""},wait:{show:!1,text:""}},filters:{source:[],destination:[]},changedDateTime(e){console.warn("changedDateTime, event is not used")},changedDescription(e){console.warn("changedDescription, event is not used")},changedDestinationAccount(e){this.detectTransactionType()},changedSourceAccount(e){this.detectTransactionType()},detectTransactionType(){const e=this.entries[0].source_account.type??"unknown",t=this.entries[0].destination_account.type??"unknown";if(e==="unknown"&&t==="unknown"){this.groupProperties.transactionType="unknown",console.warn("Cannot infer transaction type from two unknown accounts.");return}if(e===t&&["Asset account","Loan","Debt","Mortgage"].includes(e)){this.groupProperties.transactionType="transfer",console.log('Transaction type is detected to be "'+this.groupProperties.transactionType+'".'),console.log("filter down currencies for transfer."),this.filterNativeCurrencies(this.entries[0].source_account.currency_code),this.filterForeignCurrencies(this.entries[0].destination_account.currency_code);return}if(e==="Asset account"&&["Expense account","Debt","Loan","Mortgage"].includes(t)){this.groupProperties.transactionType="withdrawal",console.log('[a] Transaction type is detected to be "'+this.groupProperties.transactionType+'".'),this.filterNativeCurrencies(this.entries[0].source_account.currency_code);return}if(e==="Asset account"&&t==="unknown"){this.groupProperties.transactionType="withdrawal",console.log('[b] Transaction type is detected to be "'+this.groupProperties.transactionType+'".'),console.log(this.entries[0].source_account),this.filterNativeCurrencies(this.entries[0].source_account.currency_code);return}if(["Debt","Loan","Mortgage"].includes(e)&&t==="Expense account"){this.groupProperties.transactionType="withdrawal",console.log('[c] Transaction type is detected to be "'+this.groupProperties.transactionType+'".'),this.filterNativeCurrencies(this.entries[0].source_account.currency_code);return}if(e==="Revenue account"&&["Asset account","Debt","Loan","Mortgage"].includes(t)){this.groupProperties.transactionType="deposit",console.log('Transaction type is detected to be "'+this.groupProperties.transactionType+'".');return}if(["Debt","Loan","Mortgage"].includes(e)&&t==="Asset account"){this.groupProperties.transactionType="deposit",console.log('Transaction type is detected to be "'+this.groupProperties.transactionType+'".');return}console.warn('Unknown account combination between "'+e+'" and "'+t+'".')},formattedTotalAmount(){return this.entries.length===0?d(this.groupProperties.totalAmount,"EUR"):d(this.groupProperties.totalAmount,this.entries[0].currency_code??"EUR")},filterForeignCurrencies(e){let t=[],s;for(let i in this.formData.enabledCurrencies)if(this.formData.enabledCurrencies.hasOwnProperty(i)){let o=this.formData.enabledCurrencies[i];o.code===e&&(s=o)}t.push(s),this.formData.foreignCurrencies=t,t.length===1&&t[0].code===this.entries[0].source_account.currency_code&&(console.log("Foreign currency is same as source currency. Disable foreign amount."),this.formBehaviour.foreignCurrencyEnabled=!1),t.length===1&&t[0].code!==this.entries[0].source_account.currency_code&&(console.log("Foreign currency is NOT same as source currency. Enable foreign amount."),this.formBehaviour.foreignCurrencyEnabled=!0);for(let i in this.entries)this.entries.hasOwnProperty(i)&&(this.entries[i].foreign_currency_code=e)},filterNativeCurrencies(e){let t=[],s;for(let i in this.formData.enabledCurrencies)if(this.formData.enabledCurrencies.hasOwnProperty(i)){let o=this.formData.enabledCurrencies[i];o.code===e&&(s=o)}t.push(s),this.formData.nativeCurrencies=t;for(let i in this.entries)this.entries.hasOwnProperty(i)&&(this.entries[i].currency_code=e)},changedAmount(e){const t=parseInt(e.target.dataset.index);this.entries[t].amount=parseFloat(e.target.value),this.groupProperties.totalAmount=0;for(let s in this.entries)this.entries.hasOwnProperty(s)&&(this.groupProperties.totalAmount=this.groupProperties.totalAmount+parseFloat(this.entries[s].amount))},addedSplit(){},processUpload(e){this.showMessageOrRedirectUser()},processUploadError(e){this.notifications.success.show=!1,this.notifications.wait.show=!1,this.notifications.error.show=!0,this.formStates.isSubmitting=!1,this.notifications.error.text=r.t("firefly.errors_upload"),console.error(e)},init(){this.addSplit(),v().then(e=>{this.formStates.loadingCurrencies=!1,this.formData.defaultCurrency=e.defaultCurrency,this.formData.enabledCurrencies=e.enabledCurrencies,this.formData.nativeCurrencies=e.nativeCurrencies,this.formData.foreignCurrencies=e.foreignCurrencies}),C().then(e=>{this.formData.budgets=e,this.formStates.loadingBudgets=!1}),T().then(e=>{this.formData.piggyBanks=e,this.formStates.loadingPiggyBanks=!1}),E().then(e=>{this.formData.subscriptions=e,this.formStates.loadingSubscriptions=!1}),document.addEventListener("upload-success",e=>{this.processUpload(e),document.querySelectorAll("input[type=file]").value=""}),document.addEventListener("upload-error",e=>{this.processUploadError(e)}),document.addEventListener("location-move",e=>{this.entries[e.detail.index].latitude=e.detail.latitude,this.entries[e.detail.index].longitude=e.detail.longitude}),document.addEventListener("location-set",e=>{this.entries[e.detail.index].hasLocation=!0,this.entries[e.detail.index].latitude=e.detail.latitude,this.entries[e.detail.index].longitude=e.detail.longitude,this.entries[e.detail.index].zoomLevel=e.detail.zoomLevel}),document.addEventListener("location-zoom",e=>{this.entries[e.detail.index].hasLocation=!0,this.entries[e.detail.index].zoomLevel=e.detail.zoomLevel}),this.filters.source=["Asset account","Loan","Debt","Mortgage","Revenue account"],this.filters.destination=["Expense account","Loan","Debt","Mortgage","Asset account"]},submitTransaction(){this.notifications.error.show=!1,this.notifications.success.show=!1,this.notifications.wait.show=!1;for(let i in this.entries)this.entries.hasOwnProperty(i)&&(this.entries[i].errors=w());this.formStates.isSubmitting=!0,this.detectTransactionType();let e=P(this.entries,this.groupProperties.transactionType),t={group_title:this.groupProperties.title,fire_webhooks:this.formStates.webhooksButton,apply_rules:this.formStates.rulesButton,transactions:e};this.groupProperties.title===null&&e.length>1&&(t.group_title=e[0].description);let s=new M;console.log(t),s.post(t).then(i=>{const o=i.data.data;if(this.groupProperties.id=parseInt(o.id),this.groupProperties.title=o.attributes.group_title??o.attributes.transactions[0].description,_(this.groupProperties.id,o.attributes.transactions)>0){this.notifications.wait.show=!0,this.notifications.wait.text=r.t("firefly.wait_attachments");return}this.showMessageOrRedirectUser()}).catch(i=>{this.submitting=!1,console.log(i),typeof i.response<"u"&&this.parseErrors(i.response.data)})},showMessageOrRedirectUser(){if(this.notifications.error.show=!1,this.notifications.success.show=!1,this.notifications.wait.show=!1,this.formStates.returnHereButton){this.notifications.success.show=!0,this.notifications.success.url="transactions/show/"+this.groupProperties.id,this.notifications.success.text=r.t("firefly.stored_journal_js",{description:this.groupProperties.title}),this.formStates.resetButton&&(this.entries=[],this.addSplit(),this.groupProperties.totalAmount=0);return}window.location="transactions/show/"+this.groupProperties.id+"?transaction_group_id="+this.groupProperties.id+"&message=created"},parseErrors(e){this.notifications.error.show=!0,this.notifications.success.show=!1,this.notifications.wait.show=!1,this.formStates.isSubmitting=!1,this.notifications.error.text=r.t("firefly.errors_submission",{errorMessage:e.message}),e.hasOwnProperty("errors")&&(this.entries=L(e.errors,this.entries))},addSplit(){this.entries.push(b()),setTimeout(()=>{B.init("select.ac-tags",{allowClear:!0,server:a.tag,liveServer:!0,clearEnd:!0,allowNew:!0,notFoundMessage:r.t("firefly.nothing_found"),noCache:!0,fetchOptions:{headers:{"X-CSRF-TOKEN":document.head.querySelector('meta[name="csrf-token"]').content}}});const e=this.entries.length-1;z(e);const t=function(s,i,o){return s.name_with_balance+'
'+r.t("firefly.account_type_"+s.type)+""};c({selector:"input.ac-source",serverUrl:a.account,onChange:S,onSelectItem:D,hiddenValue:this.items[e].source_account.alpine_name}),c({selector:"input.ac-dest",serverUrl:a.account,filters:this.filters.destination,onRenderItem:t,onChange:A,onSelectItem:x}),c({selector:"input.ac-category",serverUrl:a.category,valueField:"id",labelField:"name",onChange:h,onSelectItem:h}),c({selector:"input.ac-description",serverUrl:a.description,valueField:"id",labelField:"description",onChange:p,onSelectItem:p})},150)},removeSplit(e){this.entries.splice(e,1),document.querySelector("#split-0-tab").click()},clearLocation(e){e.preventDefault();const t=e.currentTarget,s=parseInt(t.attributes["data-index"].value);this.entries[s].hasLocation=!1,this.entries[s].latitude=null,this.entries[s].longitude=null,this.entries[s].zoomLevel=null;const i=new CustomEvent("location-remove",{detail:{index:s}});return document.dispatchEvent(i),!1}}},f={transactions:I,dates:y};function g(){Object.keys(f).forEach(e=>{console.log(`Loading page component "${e}"`);let t=f[e]();Alpine.data(e,()=>t)}),Alpine.start()}document.addEventListener("firefly-iii-bootstrapped",()=>{console.log("Loaded through event listener."),g()});window.bootstrapped&&(console.log("Loaded through window variable."),g()); diff --git a/public/build/assets/create-9af1982c.js b/public/build/assets/create-9af1982c.js deleted file mode 100644 index 6aa4f52fbf..0000000000 --- a/public/build/assets/create-9af1982c.js +++ /dev/null @@ -1 +0,0 @@ -import{a as v,d as E,f as _}from"./format-money-e259f5e4.js";import{d as P,c as S}from"./create-empty-split-fb5bda92.js";import{l as T,a as L,b as k,c as A,d as h,e as x,s as D,f as O,g as B,h as F,i as y,j as w}from"./autocomplete-functions-ac0d2cb1.js";import{l as g,i as d,m as z}from"./vendor-fca45885.js";import"./get-da167d5b.js";function M(e,n){let t=[];for(let r in e)if(e.hasOwnProperty(r)){const o=e[r];let i={};i.description=o.description,i.source_name=o.source_account.name,i.destination_name=o.destination_account.name,i.amount=o.amount,i.currency_code=o.currency_code,i.date=o.date,i.interest_date=o.interest_date,i.book_date=o.book_date,i.process_date=o.process_date,i.due_date=o.due_date,i.payment_date=o.payment_date,i.invoice_date=o.invoice_date,i.budget_id=o.budget_id,i.category_name=o.category_name,i.piggy_bank_id=o.piggy_bank_id,i.bill_id=o.bill_id,i.tags=o.tags,i.notes=o.notes,i.internal_reference=o.internal_reference,i.external_url=o.external_url,i.store_location=!1,o.hasLocation&&(i.store_location=!0,i.longitude=o.longitude.toString(),i.latitude=o.latitude.toString(),i.zoom_level=o.zoomLevel),typeof o.foreign_currency_code<"u"&&o.foreign_currency_code.toString()!==""&&(i.foreign_currency_code=o.foreign_currency_code,typeof o.foreign_amount<"u"&&o.foreign_amount.toString()!==""&&(i.foreign_amount=o.foreign_amount),(typeof o.foreign_amount>"u"||o.foreign_amount.toString()==="")&&(delete i.foreign_amount,delete i.foreign_currency_code)),typeof o.source_account.id<"u"&&o.source_account.id.toString()!==""&&(i.source_id=o.source_account.id),typeof o.destination_account.id<"u"&&o.destination_account.id.toString()!==""&&(i.destination_id=o.destination_account.id),i.type=n,t.push(i)}return t}let U=class{post(n){let t="/api/v2/transactions";return v.post(t,n)}};class I{post(n,t,r){let o="/api/v1/attachments";return v.post(o,{filename:n,attachable_type:t,attachable_id:r})}upload(n,t){let r="./api/v1/attachments/"+n+"/upload";return axios.post(r,t)}}let R=function(e){let n=e.length,t=0,r=!1;for(const o in e)if(e.hasOwnProperty(o)&&/^0$|^[1-9]\d*$/.test(o)&&o<=4294967294&&r===!1){let i=new I;i.post(e[o].name,"TransactionJournal",e[o].journal).then(s=>{let a=parseInt(s.data.data.id);i.upload(a,e[o].content).then(u=>{if(t++,t===n){const l=new CustomEvent("upload-success",{some:"details"});document.dispatchEvent(l)}}).catch(u=>{console.error("Could not upload"),console.error(u),t++;const l=new CustomEvent("upload-failed",{error:u});document.dispatchEvent(l),r=!0})}).catch(s=>{console.error("Could not create upload."),console.error(s),t++;const a=new CustomEvent("upload-failed",{error:s});document.dispatchEvent(a),r=!0})}};function N(e,n){n=n.reverse();let t=[],r=0,o=[],i=document.querySelectorAll('input[name="attachments[]"]');for(const s in i)if(i.hasOwnProperty(s)&&/^0$|^[1-9]\d*$/.test(s)&&s<=4294967294)for(const a in i[s].files)i[s].files.hasOwnProperty(a)&&/^0$|^[1-9]\d*$/.test(a)&&a<=4294967294&&(t.push({journal:n[s].transaction_journal_id,file:i[s].files[a]}),r++);for(const s in t)t.hasOwnProperty(s)&&/^0$|^[1-9]\d*$/.test(s)&&s<=4294967294&&function(a,u){let l=new FileReader;l.onloadend=function(m){m.target.readyState===FileReader.DONE&&(o.push({name:t[u].file.name,journal:t[u].journal,content:new Blob([m.target.result])}),o.length===r&&R(o))},l.readAsArrayBuffer(a.file)}(t[s],s);return r}function $(e,n,t){let r=[];for(let o in t)t.hasOwnProperty(o)&&r.push(t[o].replace(e,n));return r}function j(e,n,t){let r,o,i;for(const s in n)if(n.hasOwnProperty(s)){if(s==="group_title"){console.error("Cannot handle error in group title.");continue}if(r=parseInt(s.split(".")[1]),o=s.split(".")[2],i=$(s,o,n[s]),!t.hasOwnProperty(r)){console.error("Cannot handle errors in index #"+r);continue}switch(o){case"currency_code":case"foreign_currency_code":case"category_name":case"piggy_bank_id":case"notes":case"internal_reference":case"external_url":case"latitude":case"longitude":case"zoom_level":case"interest_date":case"book_date":case"process_date":case"due_date":case"payment_date":case"invoice_date":case"amount":case"date":case"budget_id":case"bill_id":case"description":case"tags":t[r].errors[o]=i;break;case"source_name":case"source_id":t[r].errors.source_account=t[r].errors.source_account.concat(i);break;case"type":t[r].errors.source_account=t[r].errors.source_account.concat([e.t("validation.bad_type_source")]),t[r].errors.destination_account=t[r].errors.destination_account.concat([e.t("validation.bad_type_destination")]);break;case"destination_name":case"destination_id":t[r].errors.destination_account=t[r].errors.destination_account.concat(i);break;case"foreign_amount":case"foreign_currency_id":t[r].errors.foreign_amount=t[r].errors.foreign_amount.concat(i);break}typeof t[r]<"u"&&(t[r].errors.source_account=Array.from(new Set(t[r].errors.source_account)),t[r].errors.destination_account=Array.from(new Set(t[r].errors.destination_account)))}return console.log(t[0].errors),t}let c=[],f=[];document.addEventListener("location-remove",e=>{f[e.detail.index].remove()});function q(e){let n=0;if(document.querySelector("#form")._x_dataStack[0].$data.entries[n].hasLocation===!1){f[n]=new g.marker(e.latlng,{draggable:!0}),f[n].on("dragend",H),f[n].addTo(c[n]);const r=new CustomEvent("location-set",{detail:{latitude:e.latlng.lat,longitude:e.latlng.lng,index:n,zoomLevel:c[n].getZoom()}});document.dispatchEvent(r)}}function Z(e){let n=0;const t=new CustomEvent("location-zoom",{detail:{index:n,zoomLevel:c[n].getZoom()}});document.dispatchEvent(t)}function H(e){let n=e.target,t=n.getLatLng();n.setLatLng(new g.LatLng(t.lat,t.lng),{draggable:"true"});const r=new CustomEvent("location-move",{detail:{latitude:t.lat,longitude:t.lng,index:0}});document.dispatchEvent(r)}function K(e){if(e>0){console.warn("Corwardly refuse to add a map on split #"+(e+1));return}if(typeof c[e]>"u"){let n=document.getElementById("location_map");c[e]=g.map(n).setView([n.dataset.latitude,n.dataset.longitude],n.dataset.zoomLevel),g.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png",{maxZoom:19,attribution:'© OpenStreetMap'}).addTo(c[e]),c[e].on("click",q),c[e].on("zoomend",Z)}}const p=F();let V=function(){return{entries:[],formStates:{loadingCurrencies:!0,loadingBudgets:!0,loadingPiggyBanks:!0,loadingSubscriptions:!0,isSubmitting:!1,returnHereButton:!1,saveAsNewButton:!1,resetButton:!0,rulesButton:!0,webhooksButton:!0},formBehaviour:{formType:"create",foreignCurrencyEnabled:!0},formData:{defaultCurrency:null,enabledCurrencies:[],nativeCurrencies:[],foreignCurrencies:[],budgets:[],piggyBanks:[],subscriptions:[]},groupProperties:{transactionType:"unknown",title:null,id:null,totalAmount:0},notifications:{error:{show:!1,text:"",url:""},success:{show:!1,text:"",url:""},wait:{show:!1,text:""}},filters:{source:[],destination:[]},changedDateTime(e){console.warn("changedDateTime, event is not used")},changedDescription(e){console.warn("changedDescription, event is not used")},changedDestinationAccount(e){this.detectTransactionType()},changedSourceAccount(e){this.detectTransactionType()},detectTransactionType(){const e=this.entries[0].source_account.type??"unknown",n=this.entries[0].destination_account.type??"unknown";if(e==="unknown"&&n==="unknown"){this.groupProperties.transactionType="unknown",console.warn("Cannot infer transaction type from two unknown accounts.");return}if(e===n&&["Asset account","Loan","Debt","Mortgage"].includes(e)){this.groupProperties.transactionType="transfer",console.log('Transaction type is detected to be "'+this.groupProperties.transactionType+'".'),console.log("filter down currencies for transfer."),this.filterNativeCurrencies(this.entries[0].source_account.currency_code),this.filterForeignCurrencies(this.entries[0].destination_account.currency_code);return}if(e==="Asset account"&&["Expense account","Debt","Loan","Mortgage"].includes(n)){this.groupProperties.transactionType="withdrawal",console.log('[a] Transaction type is detected to be "'+this.groupProperties.transactionType+'".'),this.filterNativeCurrencies(this.entries[0].source_account.currency_code);return}if(e==="Asset account"&&n==="unknown"){this.groupProperties.transactionType="withdrawal",console.log('[b] Transaction type is detected to be "'+this.groupProperties.transactionType+'".'),console.log(this.entries[0].source_account),this.filterNativeCurrencies(this.entries[0].source_account.currency_code);return}if(["Debt","Loan","Mortgage"].includes(e)&&n==="Expense account"){this.groupProperties.transactionType="withdrawal",console.log('[c] Transaction type is detected to be "'+this.groupProperties.transactionType+'".'),this.filterNativeCurrencies(this.entries[0].source_account.currency_code);return}if(e==="Revenue account"&&["Asset account","Debt","Loan","Mortgage"].includes(n)){this.groupProperties.transactionType="deposit",console.log('Transaction type is detected to be "'+this.groupProperties.transactionType+'".');return}if(["Debt","Loan","Mortgage"].includes(e)&&n==="Asset account"){this.groupProperties.transactionType="deposit",console.log('Transaction type is detected to be "'+this.groupProperties.transactionType+'".');return}console.warn('Unknown account combination between "'+e+'" and "'+n+'".')},formattedTotalAmount(){return this.entries.length===0?_(this.groupProperties.totalAmount,"EUR"):_(this.groupProperties.totalAmount,this.entries[0].currency_code??"EUR")},filterForeignCurrencies(e){let n=[],t;for(let r in this.formData.enabledCurrencies)if(this.formData.enabledCurrencies.hasOwnProperty(r)){let o=this.formData.enabledCurrencies[r];o.code===e&&(t=o)}n.push(t),this.formData.foreignCurrencies=n,n.length===1&&n[0].code===this.entries[0].source_account.currency_code&&(console.log("Foreign currency is same as source currency. Disable foreign amount."),this.formBehaviour.foreignCurrencyEnabled=!1),n.length===1&&n[0].code!==this.entries[0].source_account.currency_code&&(console.log("Foreign currency is NOT same as source currency. Enable foreign amount."),this.formBehaviour.foreignCurrencyEnabled=!0);for(let r in this.entries)this.entries.hasOwnProperty(r)&&(this.entries[r].foreign_currency_code=e)},filterNativeCurrencies(e){let n=[],t;for(let r in this.formData.enabledCurrencies)if(this.formData.enabledCurrencies.hasOwnProperty(r)){let o=this.formData.enabledCurrencies[r];o.code===e&&(t=o)}n.push(t),this.formData.nativeCurrencies=n;for(let r in this.entries)this.entries.hasOwnProperty(r)&&(this.entries[r].currency_code=e)},changedAmount(e){const n=parseInt(e.target.dataset.index);this.entries[n].amount=parseFloat(e.target.value),this.groupProperties.totalAmount=0;for(let t in this.entries)this.entries.hasOwnProperty(t)&&(this.groupProperties.totalAmount=this.groupProperties.totalAmount+parseFloat(this.entries[t].amount))},addedSplit(){},processUpload(e){this.showMessageOrRedirectUser()},processUploadError(e){this.notifications.success.show=!1,this.notifications.wait.show=!1,this.notifications.error.show=!0,this.formStates.isSubmitting=!1,this.notifications.error.text=d.t("firefly.errors_upload"),console.error(e)},init(){this.addSplit(),T().then(e=>{this.formStates.loadingCurrencies=!1,this.formData.defaultCurrency=e.defaultCurrency,this.formData.enabledCurrencies=e.enabledCurrencies,this.formData.nativeCurrencies=e.nativeCurrencies,this.formData.foreignCurrencies=e.foreignCurrencies}),L().then(e=>{this.formData.budgets=e,this.formStates.loadingBudgets=!1}),k().then(e=>{this.formData.piggyBanks=e,this.formStates.loadingPiggyBanks=!1}),A().then(e=>{this.formData.subscriptions=e,this.formStates.loadingSubscriptions=!1}),document.addEventListener("upload-success",e=>{this.processUpload(e),document.querySelectorAll("input[type=file]").value=""}),document.addEventListener("upload-error",e=>{this.processUploadError(e)}),document.addEventListener("location-move",e=>{this.entries[e.detail.index].latitude=e.detail.latitude,this.entries[e.detail.index].longitude=e.detail.longitude}),document.addEventListener("location-set",e=>{this.entries[e.detail.index].hasLocation=!0,this.entries[e.detail.index].latitude=e.detail.latitude,this.entries[e.detail.index].longitude=e.detail.longitude,this.entries[e.detail.index].zoomLevel=e.detail.zoomLevel}),document.addEventListener("location-zoom",e=>{this.entries[e.detail.index].hasLocation=!0,this.entries[e.detail.index].zoomLevel=e.detail.zoomLevel}),this.filters.source=["Asset account","Loan","Debt","Mortgage","Revenue account"],this.filters.destination=["Expense account","Loan","Debt","Mortgage","Asset account"]},submitTransaction(){this.notifications.error.show=!1,this.notifications.success.show=!1,this.notifications.wait.show=!1;for(let r in this.entries)this.entries.hasOwnProperty(r)&&(this.entries[r].errors=P());this.formStates.isSubmitting=!0,this.detectTransactionType();let e=M(this.entries,this.groupProperties.transactionType),n={group_title:this.groupProperties.title,fire_webhooks:this.formStates.webhooksButton,apply_rules:this.formStates.rulesButton,transactions:e};this.groupProperties.title===null&&e.length>1&&(n.group_title=e[0].description);let t=new U;console.log(n),t.post(n).then(r=>{const o=r.data.data;if(this.groupProperties.id=parseInt(o.id),this.groupProperties.title=o.attributes.group_title??o.attributes.transactions[0].description,N(this.groupProperties.id,o.attributes.transactions)>0){this.notifications.wait.show=!0,this.notifications.wait.text=d.t("firefly.wait_attachments");return}this.showMessageOrRedirectUser()}).catch(r=>{this.submitting=!1,console.log(r),typeof r.response<"u"&&this.parseErrors(r.response.data)})},showMessageOrRedirectUser(){if(this.notifications.error.show=!1,this.notifications.success.show=!1,this.notifications.wait.show=!1,this.formStates.returnHereButton){this.notifications.success.show=!0,this.notifications.success.url="transactions/show/"+this.groupProperties.id,this.notifications.success.text=d.t("firefly.stored_journal_js",{description:this.groupProperties.title}),this.formStates.resetButton&&(this.entries=[],this.addSplit(),this.groupProperties.totalAmount=0);return}window.location="transactions/show/"+this.groupProperties.id+"?transaction_group_id="+this.groupProperties.id+"&message=created"},parseErrors(e){this.notifications.error.show=!0,this.notifications.success.show=!1,this.notifications.wait.show=!1,this.formStates.isSubmitting=!1,this.notifications.error.text=d.t("firefly.errors_submission",{errorMessage:e.message}),e.hasOwnProperty("errors")&&(this.entries=j(i18n,e.errors,this.entries))},addSplit(){this.entries.push(S()),setTimeout(()=>{z.init("select.ac-tags",{allowClear:!0,server:p.tag,liveServer:!0,clearEnd:!0,allowNew:!0,notFoundMessage:d.t("firefly.nothing_found"),noCache:!0,fetchOptions:{headers:{"X-CSRF-TOKEN":document.head.querySelector('meta[name="csrf-token"]').content}}});const e=this.entries.length-1;K(e);const n=function(t,r,o){return t.name_with_balance+'
'+d.t("firefly.account_type_"+t.type)+""};h({selector:"input.ac-source",serverUrl:p.account,onChange:x,onSelectItem:D,hiddenValue:this.items[e].source_account.alpine_name}),h({selector:"input.ac-dest",serverUrl:p.account,filters:this.filters.destination,onRenderItem:n,onChange:O,onSelectItem:B}),h({selector:"input.ac-category",serverUrl:p.category,valueField:"id",labelField:"name",onChange:y,onSelectItem:y}),h({selector:"input.ac-description",serverUrl:p.description,valueField:"id",labelField:"description",onChange:w,onSelectItem:w})},150)},removeSplit(e){this.entries.splice(e,1),document.querySelector("#split-0-tab").click()},clearLocation(e){e.preventDefault();const n=e.currentTarget,t=parseInt(n.attributes["data-index"].value);this.entries[t].hasLocation=!1,this.entries[t].latitude=null,this.entries[t].longitude=null,this.entries[t].zoomLevel=null;const r=new CustomEvent("location-remove",{detail:{index:t}});return document.dispatchEvent(r),!1}}},b={transactions:V,dates:E};function C(){Object.keys(b).forEach(e=>{console.log(`Loading page component "${e}"`);let n=b[e]();Alpine.data(e,()=>n)}),Alpine.start()}document.addEventListener("firefly-iii-bootstrapped",()=>{console.log("Loaded through event listener."),C()});window.bootstrapped&&(console.log("Loaded through window variable."),C()); diff --git a/public/build/assets/dashboard-d274a3dc.js b/public/build/assets/dashboard-2ad8d866.js similarity index 99% rename from public/build/assets/dashboard-d274a3dc.js rename to public/build/assets/dashboard-2ad8d866.js index 9d42165db0..e342b91eac 100644 --- a/public/build/assets/dashboard-d274a3dc.js +++ b/public/build/assets/dashboard-2ad8d866.js @@ -1 +1 @@ -import{a as O,f,g as v,P as bt,d as wt}from"./format-money-e259f5e4.js";import{f as g,C as m,a as S,i as p,S as vt,F as mt,L as Ct,b as kt,A as Pt,B as Dt,T as xt,P as Ot,c as Mt,d as Ft,p as St,e as At,g as Bt,h as jt,j as Wt,k as It}from"./vendor-fca45885.js";import{G as $t}from"./get-3bb14de5.js";import{G as Vt,a as Kt}from"./get-da167d5b.js";class Lt{get(e,n,a){return O.get("/api/v2/summary/basic",{params:{start:e,end:n,code:a}})}}function P(t,e,n){const a=g(e,"y-MM-dd")+"_"+g(n,"y-MM-dd")+"_"+t;return console.log("getCacheKey: "+a),String(a)}let U=!1;const Et=()=>({balanceBox:{amounts:[],subtitles:[]},billBox:{paid:[],unpaid:[]},leftBox:{left:[],perDay:[]},netBox:{net:[]},autoConversion:!1,loading:!1,boxData:null,boxOptions:null,getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P("dashboard-boxes-data",t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){this.boxData=r,this.generateOptions(this.boxData);return}new Lt().get(g(t,"yyyy-MM-dd"),g(e,"yyyy-MM-dd"),null).then(i=>{this.boxData=i.data,window.store.set(n,i.data),this.generateOptions(this.boxData)})},generateOptions(t){this.balanceBox={amounts:[],subtitles:[]},this.billBox={paid:[],unpaid:[]},this.leftBox={left:[],perDay:[]},this.netBox={net:[]};let e={};for(const n in t)if(t.hasOwnProperty(n)){const a=t[n];if(!a.hasOwnProperty("key"))continue;let r=a.key;if(this.autoConversion){if(r.startsWith("balance-in-native")){this.balanceBox.amounts.push(f(a.value,a.currency_code)),e.hasOwnProperty(a.currency_code)||(e[a.currency_code]="");continue}if(r.startsWith("spent-in-native")){e.hasOwnProperty(a.currency_code)||(e[a.currency_code]=""),e[a.currency_code]=e[a.currency_code]+f(a.value,a.currency_code);continue}if(r.startsWith("earned-in-native")){e.hasOwnProperty(a.currency_code)||(e[a.currency_code]=""),e[a.currency_code]=f(a.value,a.currency_code)+" + "+e[a.currency_code];continue}if(r.startsWith("bills-unpaid-in-native")){this.billBox.unpaid.push(f(a.value,a.currency_code));continue}if(r.startsWith("bills-paid-in-native")){this.billBox.paid.push(f(a.value,a.currency_code));continue}if(r.startsWith("left-to-spend-in-native")){this.leftBox.left.push(f(a.value,a.currency_code));continue}if(r.startsWith("left-per-day-to-spend-in-native")){this.leftBox.perDay.push(f(a.value,a.currency_code));continue}if(r.startsWith("net-worth-in-native")){this.netBox.net.push(f(a.value,a.currency_code));continue}}if(!this.autoConversion&&!r.endsWith("native")){if(r.startsWith("balance-in-")){this.balanceBox.amounts.push(f(a.value,a.currency_code));continue}if(r.startsWith("spent-in-")){e.hasOwnProperty(a.currency_code)||(e[a.currency_code]=""),e[a.currency_code]=e[a.currency_code]+f(a.value,a.currency_code);continue}if(r.startsWith("earned-in-")){e.hasOwnProperty(a.currency_code)||(e[a.currency_code]=""),e[a.currency_code]=f(a.value,a.currency_code)+" + "+e[a.currency_code];continue}if(r.startsWith("bills-unpaid-in-")){this.billBox.unpaid.push(f(a.value,a.currency_code));continue}if(r.startsWith("bills-paid-in-")){this.billBox.paid.push(f(a.value,a.currency_code));continue}if(r.startsWith("left-to-spend-in-")){this.leftBox.left.push(f(a.value,a.currency_code));continue}if(r.startsWith("left-per-day-to-spend-in-")){this.leftBox.perDay.push(f(a.value,a.currency_code));continue}r.startsWith("net-worth-in-")&&this.netBox.net.push(f(a.value,a.currency_code))}}for(let n in e)e.hasOwnProperty(n)&&this.balanceBox.subtitles.push(e[n]);this.loading=!1},loadBoxes(){if(this.loading!==!0){if(this.loading=!0,this.boxData===null){this.getFreshData();return}this.generateOptions(this.boxData),this.loading=!1}},init(){Promise.all([v("viewRange"),v("autoConversion",!1)]).then(t=>{U=!0,this.autoConversion=t[1],this.loadBoxes()}),window.store.observe("end",()=>{U&&(this.boxData=null,this.loadBoxes())}),window.store.observe("autoConversion",t=>{U&&(this.autoConversion=t,this.loadBoxes())})}});class Gt{put(e,n){let a="/api/v1/preferences/"+e;return O.put(a,{data:n})}}function Tt(t,e=null){window.store.set(t,e),new Gt().put(t,e).then(a=>{}).catch(()=>{new bt().post(t,e).then(r=>{})})}let Rt=class{dashboard(e,n){let a=g(e,"y-MM-dd"),r=g(n,"y-MM-dd");return O.get("/api/v2/chart/account/dashboard",{params:{start:a,end:r}})}expense(e,n){let a=g(e,"y-MM-dd"),r=g(n,"y-MM-dd");return O.get("/api/v2/chart/account/expense-dashboard",{params:{start:a,end:r}})}};class st{get(e,n){let a={date:g(n,"y-MM-dd").slice(0,10)};return n?O.get("/api/v2/accounts/"+e,{params:a}):O.get("/api/v2/accounts/"+e)}transactions(e,n){const a={page:n.page??1};return n.hasOwnProperty("start")&&(a.start=g(n.start,"y-MM-dd")),n.hasOwnProperty("end")&&(a.end=g(n.end,"y-MM-dd")),O.get("/api/v2/accounts/"+e+"/transactions",{params:a})}}function N(t){return t==="sankey"?{type:"sankey",data:{datasets:[]},options:{animations:!1}}:t==="pie"?{type:"pie",data:{datasets:[]}}:t==="column"?{type:"bar",data:{labels:[],datasets:[]},options:{plugins:{tooltip:{callbacks:{label:function(e){let n=e.dataset.currency_code;return f(e.raw,n)}}}},maintainAspectRatio:!1,scales:{}}}:t==="line"?{options:{plugins:{tooltip:{callbacks:{label:function(e){let n=e.dataset.currency_code;return f(e.raw,n)}}}},maintainAspectRatio:!1,scales:{x:{type:"time",time:{tooltipFormat:"PP"}}}},type:"line",data:{labels:[],datasets:[]}}:{}}let q=new m("#36a2eb"),I=new m("#ff6384"),G=new m("#4bc0c0"),ft=new m("#ff9f40"),qt=new m("#9966ff"),Nt=new m("#ffcd56"),Yt=new m("#c9cbcf"),lt=0;window.theme==="dark"&&(I.darken(.3).desaturate(.3),G.darken(.3).desaturate(.3),q.darken(.3).desaturate(.3),ft.darken(.3).desaturate(.3));let z=[I,ft,q,G,qt,Nt,Yt,G];function j(t,e){let n={borderColor:I.rgbString(),backgroundColor:I.rgbString()},a;switch(t){default:let o=Math.floor(lt/2)%z.length;a=new m(z[o].rgbString()),a.lighten(.38),n={borderColor:z[o].hexString(),backgroundColor:a.hexString()};break;case"spent":a=new m(q.rgbString()),a.lighten(.38),n={borderColor:q.rgbString(),backgroundColor:a.rgbString()};break;case"left":a=new m(G.rgbString()),a.lighten(.38),n={borderColor:G.rgbString(),backgroundColor:a.rgbString()};break;case"overspent":a=new m(I.rgbString()),a.lighten(.22),n={borderColor:I.rgbString(),backgroundColor:a.rgbString()};break}return lt++,e==="border"?n.borderColor:e==="background"?n.backgroundColor:"#FF0000"}let A=[],$=null,H=null,J=!1;const Ut=()=>({loading:!1,loadingAccounts:!1,accountList:[],autoConversion:!1,chartOptions:null,switchAutoConversion(){this.autoConversion=!this.autoConversion,Tt("autoConversion",this.autoConversion)},getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P("dashboard-accounts-chart",t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){console.log(r),this.drawChart(this.generateOptions(r)),this.loading=!1;return}new Rt().dashboard(t,e,null).then(i=>{this.chartData=i.data,window.store.set(n,i.data),console.log(i.data),this.drawChart(this.generateOptions(this.chartData)),this.loading=!1})},generateOptions(t){A=[];let e=N("line");for(let n=0;n0){this.loadingAccounts=!1;return}const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P("dashboard-accounts-data",t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){this.accountList=r,this.loadingAccounts=!1;return}const o=10;let i=0,l=0,u=[];Promise.all([v("frontpageAccounts")]).then(d=>{i=d[0].length;for(let h in d[0]){let c=d[0];if(c.hasOwnProperty(h)){let _=c[h];new st().get(_,new Date(window.store.get("end"))).then(w=>{let C=w.data.data;const yt={page:1,start:new Date(window.store.get("start")),end:new Date(window.store.get("end"))};new st().transactions(C.id,yt).then(at=>{let nt=[];for(let B=0;B=o);B++){let M=at.data.data[B],rt={title:M.attributes.group_title===null?"":M.attributes.group_title,id:M.id,transactions:[]};for(let Y=0;YB.order-M.order),this.accountList=u,this.loadingAccounts=!1,window.store.set(n,u))})})}}})},init(){Promise.all([v("viewRange","1M"),v("autoConversion",!1),v("language","en_US")]).then(t=>{this.autoConversion=t[1],J=!0,this.loadChart(),this.loadAccounts()}),window.store.observe("end",()=>{J&&(H=null,this.accountList=[],this.loadChart(),this.loadAccounts())}),window.store.observe("autoConversion",()=>{J&&(this.loadChart(),this.loadAccounts())})}});let zt=class{dashboard(e,n){let a=g(e,"y-MM-dd"),r=g(n,"y-MM-dd");return O.get("/api/v2/chart/budget/dashboard",{params:{start:a,end:r}})}},V=[],T=null,F=null,Z=!1;const Ht=()=>({loading:!1,autoConversion:!1,loadChart(){if(this.loading!==!0){if(this.loading=!0,F!==null){this.drawChart(this.generateOptions(F)),this.loading=!1;return}this.getFreshData()}},drawChart(t){if(T!==null){T.data.datasets=t.data.datasets,T.update();return}T=new S(document.querySelector("#budget-chart"),t)},getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P("dashboard-budgets-chart",t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){F=r,this.drawChart(this.generateOptions(F)),this.loading=!1;return}new zt().dashboard(t,e,null).then(i=>{F=i.data,this.drawChart(this.generateOptions(F)),window.store.set(n,F),this.loading=!1})},generateOptions(t){V=[];let e=N("column");e.options.locale=window.store.get("locale").replace("_","-"),e.options.plugins={tooltip:{callbacks:{title:function(n){return n.label},label:function(n){let a=n.dataset.label||"";return a&&(a+=": "),a+" "+f(n.parsed.y,V[n.parsed.x]??"EUR")}}}},e.data={labels:[],datasets:[{label:p.t("firefly.spent"),data:[],borderWidth:1,stack:1,backgroundColor:j("spent","background"),borderColor:j("spent","border")},{label:p.t("firefly.left"),data:[],borderWidth:1,stack:1,backgroundColor:j("left","background"),borderColor:j("left","border")},{label:p.t("firefly.overspent"),data:[],borderWidth:1,stack:1,backgroundColor:j("overspent","background"),borderColor:j("overspent","border")}]};for(const n in t)if(t.hasOwnProperty(n)){let a=t[n],r=a.label+" ("+a.currency_code+")";e.data.labels.push(r),this.autoConversion&&(V.push(a.native_currency_code),e.data.datasets[0].data.push(parseFloat(a.native_entries.spent)*-1),e.data.datasets[1].data.push(parseFloat(a.native_entries.left)),e.data.datasets[2].data.push(parseFloat(a.native_entries.overspent))),this.autoConversion||(V.push(a.currency_code),e.data.datasets[0].data.push(parseFloat(a.entries.spent)*-1),e.data.datasets[1].data.push(parseFloat(a.entries.left)),e.data.datasets[2].data.push(parseFloat(a.entries.overspent)))}return e.options.scales={y:{ticks:{callback:function(n){return f(n,V[0]??"EUR")}}}},e},init(){Promise.all([v("autoConversion",!1)]).then(t=>{this.autoConversion=t[0],Z=!0,this.loading===!1&&this.loadChart()}),window.store.observe("end",()=>{Z&&this.loading===!1&&(F=null,this.loadChart())}),window.store.observe("autoConversion",t=>{Z&&(this.autoConversion=t,this.loading===!1&&this.loadChart())})}});class Jt{dashboard(e,n){let a=g(e,"y-MM-dd"),r=g(n,"y-MM-dd");return O.get("/api/v2/chart/category/dashboard",{params:{start:a,end:r}})}}let ut=[],K=null,W=null,Q=!1;const Zt=()=>({loading:!1,autoConversion:!1,generateOptions(t){ut=[];let e=N("column"),n={};for(const r in t)if(t.hasOwnProperty(r)){let o=t[r],i=o.currency_code;this.autoConversion&&(i=o.native_currency_code),n.hasOwnProperty(i)||(n[i]={name:i,yAxisID:"",data:{}},ut.push(i))}for(const r in t)if(t.hasOwnProperty(r)){let o=t[r],i=o.currency_code;this.autoConversion&&(i=o.native_currency_code);for(const l in n)if(n.hasOwnProperty(l)){let u=0;i===l&&(u=parseFloat(o.amount),""+o.currency_code,this.autoConversion&&(u=parseFloat(o.native_amount),""+o.native_currency_code)),n[l].data.hasOwnProperty(o.label)&&(n[l].data[o.label]=n[l].data[o.label]+u),n[l].data.hasOwnProperty(o.label)||(n[l].data[o.label]=u)}e.data.labels.includes(o.label)||e.data.labels.push(o.label)}let a=0;for(const r in n){let o="y"+r,i={label:r,currency_code:r,yAxisID:o,data:[]};for(const l in n[r].data)i.data.push(n[r].data[l]);e.data.datasets.push(i),e.options.scales.hasOwnProperty(o)||(e.options.scales[o]={beginAtZero:!0,type:"linear",position:a===1?"right":"left",ticks:{callback:function(l,u,d){return f(l,r)}}},a++)}return e},drawChart(t){if(K!==null){K.options=t.options,K.data=t.data,K.update();return}K=new S(document.querySelector("#category-chart"),t)},getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P("dashboard-categories-chart",t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){W=r,this.drawChart(this.generateOptions(W)),this.loading=!1;return}new Jt().dashboard(t,e,null).then(i=>{W=i.data,this.drawChart(this.generateOptions(i.data)),window.store.set(n,W),this.loading=!1})},loadChart(){if(this.loading!==!0){if(this.loading=!0,W!==null){this.drawChart(this.generateOptions(W)),this.loading=!1;return}this.getFreshData()}},init(){Promise.all([v("autoConversion",!1)]).then(t=>{this.autoConversion=t[0],Q=!0,this.loadChart()}),window.store.observe("end",()=>{Q&&(this.chartData=null,this.loadChart())}),window.store.observe("autoConversion",t=>{Q&&(this.autoConversion=t,this.loadChart())})}});S.register({SankeyController:vt,Flow:mt});const ct="dashboard-sankey-data";let X=!1,R=null,D=[],y=!1,s={category:null,unknown_category:null,in:null,out:null,unknown_source:null,unknown_dest:null,unknown_account:null,expense_account:null,revenue_account:null,budget:null,unknown_budget:null,all_money:null};const dt=function(t){return t.includes(s.revenue_account)?"forestgreen":t.includes("("+s.in+",")?"green":t.includes(s.budget)||t.includes(s.unknown_budget)?"Orchid":t.includes("("+s.out+",")?"MediumOrchid":t.includes(s.all_money)?"blue":"red"};function L(t,e,n,a){if(t==="category"&&e!==null&&n==="in")return s.category+' "'+e+'" ('+s.in+(y?", "+a+")":")");if(t==="category"&&e===null&&n==="in")return s.unknown_category+" ("+s.in+(y?", "+a+")":")");if(t==="category"&&e!==null&&n==="out")return s.category+' "'+e+'" ('+s.out+(y?", "+a+")":")");if(t==="category"&&e===null&&n==="out")return s.unknown_category+" ("+s.out+(y?", "+a+")":")");if(t==="account"&&e===null&&n==="in")return s.unknown_source+(y?" ("+a+")":"");if(t==="account"&&e!==null&&n==="in")return s.revenue_account+'"'+e+'"'+(y?" ("+a+")":"");if(t==="account"&&e===null&&n==="out")return s.unknown_dest+(y?" ("+a+")":"");if(t==="account"&&e!==null&&n==="out")return s.expense_account+' "'+e+'"'+(y?" ("+a+")":"");if(t==="budget"&&e!==null)return s.budget+' "'+e+'"'+(y?" ("+a+")":"");if(t==="budget"&&e===null)return s.unknown_budget+(y?" ("+a+")":"");console.error('Cannot handle: type:"'+t+'", dir: "'+n+'"')}function E(t,e,n){if(t==="category"&&e!==null)return s.category+' "'+e+'"'+(y?" ("+n+")":"");if(t==="category"&&e===null)return s.unknown_category+(y?" ("+n+")":"");if(t==="account"&&e===null)return s.unknown_account+(y?" ("+n+")":"");if(t==="account"&&e!==null)return e+(y?" ("+n+")":"");if(t==="budget"&&e!==null)return s.budget+' "'+e+'"'+(y?" ("+n+")":"");if(t==="budget"&&e===null)return s.unknown_budget+(y?" ("+n+")":"");console.error('Cannot handle: type:"'+t+'"')}const Qt=()=>({loading:!1,autoConversion:!1,generateOptions(){let t=N("sankey"),e={},n={};for(let r in D)if(D.hasOwnProperty(r)){let o=D[r];for(let i in o.attributes.transactions)if(o.attributes.transactions.hasOwnProperty(i)){let l=o.attributes.transactions[i],u=this.autoConversion?l.native_currency_code:l.currency_code,d=this.autoConversion?parseFloat(l.native_amount):parseFloat(l.amount),h;if(l.type==="deposit"){let c=L("category",l.category_name,"in",u),_=L("account",l.source_name,"in",u);n[c]=E("category",l.category_name,u),n[_]=E("account",l.source_name,u),h=_+"-"+c+"-"+u,e.hasOwnProperty(h)||(e[h]={from:_,to:c,amount:0}),e[h].amount+=d,h=c+"-"+s.all_money+"-"+u,e.hasOwnProperty(h)||(e[h]={from:c,to:s.all_money+(this.autoConversion?" ("+u+")":""),amount:0}),e[h].amount+=d}if(l.type==="withdrawal"){let c=L("budget",l.budget_name,"out",u);n[c]=E("budget",l.budget_name,u),h=s.all_money+"-"+c+"-"+u,e.hasOwnProperty(h)||(e[h]={from:s.all_money+(this.autoConversion?" ("+u+")":""),to:c,amount:0}),e[h].amount+=d;let _=L("category",l.category_name,"out",u);n[_]=E("category",l.category_name,u),h=c+"-"+_+"-"+u,e.hasOwnProperty(h)||(e[h]={from:c,to:_,amount:0}),e[h].amount+=d;let w=L("account",l.destination_name,"out",u);n[w]=E("account",l.destination_name,u),h=_+"-"+w+"-"+u,e.hasOwnProperty(h)||(e[h]={from:_,to:w,amount:0}),e[h].amount+=d}}}let a={label:"Firefly III dashboard sankey chart",data:[],colorFrom:r=>dt(r.dataset.data[r.dataIndex]?r.dataset.data[r.dataIndex].from:""),colorTo:r=>dt(r.dataset.data[r.dataIndex]?r.dataset.data[r.dataIndex].to:""),colorMode:"gradient",labels:n,size:"min"};for(let r in e)if(e.hasOwnProperty(r)){let o=e[r];a.data.push({from:o.from,to:o.to,flow:o.amount})}return t.data.datasets.push(a),t},drawChart(t){if(R!==null){R.data.datasets=t.data.datasets,R.update();return}R=new S(document.querySelector("#sankey-chart"),t)},getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P(ct,t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){D=r,this.drawChart(this.generateOptions()),this.loading=!1;return}let o={start:g(t,"y-MM-dd"),end:g(e,"y-MM-dd"),type:"withdrawal,deposit",page:1};this.downloadTransactions(o)},downloadTransactions(t){const e=new Date(window.store.get("start")),n=new Date(window.store.get("end")),a=P(ct,e,n);new $t().list(t).then(o=>{if(D=[...D,...o.data.data],parseInt(o.data.meta.pagination.total_pages)>t.page){t.page++,this.downloadTransactions(t);return}window.store.set(a,D),this.drawChart(this.generateOptions()),this.loading=!1})},loadChart(){if(this.loading!==!0){if(this.loading=!0,D.length!==0){this.drawChart(this.generateOptions()),this.loading=!1;return}this.getFreshData()}},init(){D=[],Promise.all([v("autoConversion",!1)]).then(t=>{this.autoConversion=t[0],y=t[0],s.all_money=p.t("firefly.all_money"),s.category=p.t("firefly.category"),s.in=p.t("firefly.money_flowing_in"),s.out=p.t("firefly.money_flowing_out"),s.unknown_category=p.t("firefly.unknown_category_plain"),s.unknown_source=p.t("firefly.unknown_source_plain"),s.unknown_dest=p.t("firefly.unknown_dest_plain"),s.unknown_account=p.t("firefly.unknown_any_plain"),s.unknown_budget=p.t("firefly.unknown_budget_plain"),s.expense_account=p.t("firefly.expense_account"),s.revenue_account=p.t("firefly.revenue_account"),s.budget=p.t("firefly.budget"),X=!0,this.loadChart()}),window.store.observe("end",()=>{X&&(this.transactions=[],this.loadChart())}),window.store.observe("autoConversion",t=>{X&&(this.autoConversion=t,this.loadChart())})}});let tt=!1,b={};function gt(t){return new Vt().list(t).then(n=>{let a=n.data.data;for(let r in a)if(a.hasOwnProperty(r)){let o=a[r];if(o.attributes.active&&o.attributes.pay_dates.length>0){let i=o.attributes.object_group_id===null?0:o.attributes.object_group_id,l=o.attributes.object_group_title===null?p.t("firefly.default_group_title_name_plain"):o.attributes.object_group_title,u=o.attributes.object_group_order===null?0:o.attributes.object_group_order;b.hasOwnProperty(i)||(b[i]={id:i,title:l,order:u,payment_info:{},bills:[]});let d={id:o.id,name:o.attributes.name,amount_min:o.attributes.amount_min,amount_max:o.attributes.amount_max,amount:(parseFloat(o.attributes.amount_max)+parseFloat(o.attributes.amount_min))/2,currency_code:o.attributes.currency_code,native_amount_min:o.attributes.native_amount_min,native_amount_max:o.attributes.native_amount_max,native_amount:(parseFloat(o.attributes.native_amount_max)+parseFloat(o.attributes.native_amount_min))/2,native_currency_code:o.attributes.native_currency_code,transactions:[],pay_dates:o.attributes.pay_dates,paid:o.attributes.paid_dates.length>0};d.expected_amount=t.autoConversion?f(d.native_amount,d.native_currency_code):f(d.amount,d.currency_code),d.expected_times=p.t("firefly.subscr_expected_x_times",{times:o.attributes.pay_dates.length,amount:d.expected_amount});for(let h in o.attributes.paid_dates)if(o.attributes.paid_dates.hasOwnProperty(h)){const c=o.attributes.paid_dates[h];let _=100;t.autoConversion&&(_=Math.round(-100+parseFloat(c.native_amount)*-1/parseFloat(d.native_amount)*100)),t.autoConversion||(_=Math.round(-100+parseFloat(c.amount)*-1/parseFloat(d.amount)*100));let w={amount:t.autoConversion?f(c.native_amount,c.native_currency_code):f(c.amount,c.currency_code),percentage:_,date:g(new Date(c.date),"PP"),foreign_amount:null};c.foreign_currency_code!==null&&(w.foreign_amount=t.autoConversion?c.foreign_native_amount:c.foreign_amount,w.foreign_currency_code=t.autoConversion?c.native_currency_code:c.foreign_currency_code),d.transactions.push(w)}if(b[i].bills.push(d),o.attributes.paid_dates.length===0){const h=o.attributes.pay_dates.length*d.amount,c=o.attributes.pay_dates.length*d.native_amount;b[i].payment_info.hasOwnProperty(d.currency_code)||(b[i].payment_info[d.currency_code]={currency_code:d.currency_code,paid:0,unpaid:0,native_currency_code:d.native_currency_code,native_paid:0,native_unpaid:0}),b[i].payment_info[d.currency_code].unpaid+=h,b[i].payment_info[d.currency_code].native_unpaid+=c}if(o.attributes.paid_dates.length>0){for(let h in o.attributes.paid_dates)if(o.attributes.paid_dates.hasOwnProperty(h)){let c=o.attributes.paid_dates[h];b[i].payment_info.hasOwnProperty(c.currency_code)||(b[i].payment_info[c.currency_code]={currency_code:d.currency_code,paid:0,unpaid:0,native_currency_code:d.native_currency_code,native_paid:0,native_unpaid:0});const _=parseFloat(c.amount)*-1,w=parseFloat(c.native_amount)*-1;b[i].payment_info[c.currency_code].paid+=_,b[i].payment_info[c.currency_code].native_paid+=w}}}}return parseInt(n.data.meta.pagination.total_pages)>t.page?(t.page++,gt(t)):Promise.resolve()})}const Xt=()=>({loading:!1,autoConversion:!1,subscriptions:[],startSubscriptions(){this.loading=!0;let t=new Date(window.store.get("start")),e=new Date(window.store.get("end"));const n=window.store.get("cacheValid");let a=window.store.get(P("subscriptions-data-dashboard",t,e));n&&typeof a<"u",b={},this.subscriptions=[];let r={start:g(t,"y-MM-dd"),end:g(e,"y-MM-dd"),autoConversion:this.autoConversion,page:1};gt(r).then(()=>{let o=Object.values(b);for(let i in o)if(o.hasOwnProperty(i)){let l=o[i];const u=Object.keys(l.payment_info);l.col_size=u.length===1?"col-6 offset-3":"col-6",l.chart_width=u.length===1?"50%":"100%",l.payment_length=u.length,this.subscriptions.push(l)}this.loading=!1})},drawPieChart(t,e,n){let a="#pie_"+t+"_"+n.currency_code;const r=this.autoConversion?n.native_unpaid:n.unpaid,o=this.autoConversion?n.native_paid:n.paid,i=this.autoConversion?n.native_currency_code:n.currency_code,u={type:"doughnut",data:{labels:[p.t("firefly.paid"),p.t("firefly.unpaid")],datasets:[{label:p.t("firefly.subscriptions_in_group",{title:e}),data:[o,r],backgroundColor:["rgb(54, 162, 235)","rgb(255, 99, 132)"],hoverOffset:4}]},options:{plugins:{tooltip:{callbacks:{label:function(h){return h.dataset.label+": "+f(h.raw,i)}}}}}};var d=S.getChart(document.querySelector(a));typeof d<"u"&&d.destroy(),new S(document.querySelector(a),u)},init(){Promise.all([v("autoConversion",!1)]).then(t=>{this.autoConversion=t[0],tt=!0,this.loading===!1&&this.startSubscriptions()}),window.store.observe("end",()=>{tt&&this.loading===!1&&this.startSubscriptions()}),window.store.observe("autoConversion",t=>{tt&&(this.autoConversion=t,this.loading===!1&&this.startSubscriptions())})}});let x={},et=!1;const ht="dashboard-piggies-data",te=()=>({loading:!1,autoConversion:!1,sankeyGrouping:"account",piggies:[],getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P(ht,t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){x=r,this.parsePiggies(),this.loading=!1;return}let o={start:g(t,"y-MM-dd"),end:g(e,"y-MM-dd"),page:1};this.downloadPiggyBanks(o)},downloadPiggyBanks(t){const e=new Date(window.store.get("start")),n=new Date(window.store.get("end")),a=P(ht,e,n);new Kt().list(t).then(o=>{if(x=[...x,...o.data.data],parseInt(o.data.meta.pagination.total_pages)>t.page){t.page++,this.downloadPiggyBanks(t);return}window.store.set(a,x),this.parsePiggies(),this.loading=!1})},parsePiggies(){let t=[];for(let e in x)if(x.hasOwnProperty(e)){let n=x[e];if(n.attributes.percentage>=100||n.attributes.percentage===0)continue;let a=n.object_group_title??p.t("firefly.default_group_title_name_plain");t.hasOwnProperty(a)||(t[a]={id:n.object_group_id??0,title:a,order:n.object_group_order??0,piggies:[]});let r={id:n.id,name:n.attributes.name,percentage:parseInt(n.attributes.percentage),amount:this.autoConversion?n.attributes.native_current_amount:n.attributes.current_amount,left_to_save:this.autoConversion?n.attributes.native_left_to_save:n.attributes.left_to_save,target_amount:this.autoConversion?n.attributes.native_target_amount:n.attributes.target_amount,save_per_month:this.autoConversion?n.attributes.native_save_per_month:n.attributes.save_per_month,currency_code:this.autoConversion?n.attributes.native_currency_code:n.attributes.currency_code};t[a].piggies.push(r)}this.piggies=Object.values(t)},loadPiggyBanks(){if(this.loading!==!0){if(this.loading=!0,this.piggies.length!==0){this.parsePiggies(),this.loading=!1;return}this.getFreshData()}},init(){x=[],Promise.all([v("autoConversion",!1)]).then(t=>{et=!0,this.autoConversion=t[0],this.loadPiggyBanks()}),window.store.observe("end",()=>{et&&(x=[],this.loadPiggyBanks())}),window.store.observe("autoConversion",t=>{et&&(this.autoConversion=t,this.loadPiggyBanks())})}});S.register({LineController:Ct,LineElement:kt,ArcElement:Pt,BarController:Dt,TimeScale:xt,PieController:Ot,BarElement:Mt,Filler:Ft,Colors:St,LinearScale:At,CategoryScale:Bt,PointElement:jt,Tooltip:Wt,Legend:It});const pt={dates:wt,boxes:Et,accounts:Ut,budgets:Ht,categories:Zt,sankey:Qt,subscriptions:Xt,piggies:te};function _t(t){Object.keys(t).forEach(e=>{let n=t[e]();Alpine.data(e,()=>n)}),Alpine.start()}document.addEventListener("firefly-iii-bootstrapped",()=>{console.log("Loaded through event listener."),_t(pt)});window.bootstrapped&&(console.log("Loaded through window variable."),_t(pt)); +import{a as O,f,g as v,P as bt,d as wt}from"./format-money-43e05102.js";import{f as g,C as m,a as S,i as p,S as vt,F as mt,L as Ct,b as kt,A as Pt,B as Dt,T as xt,P as Ot,c as Mt,d as Ft,p as St,e as At,g as Bt,h as jt,j as Wt,k as It}from"./vendor-fca45885.js";import{G as $t}from"./get-a29f6df7.js";import{G as Vt,a as Kt}from"./get-94678769.js";class Lt{get(e,n,a){return O.get("/api/v2/summary/basic",{params:{start:e,end:n,code:a}})}}function P(t,e,n){const a=g(e,"y-MM-dd")+"_"+g(n,"y-MM-dd")+"_"+t;return console.log("getCacheKey: "+a),String(a)}let U=!1;const Et=()=>({balanceBox:{amounts:[],subtitles:[]},billBox:{paid:[],unpaid:[]},leftBox:{left:[],perDay:[]},netBox:{net:[]},autoConversion:!1,loading:!1,boxData:null,boxOptions:null,getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P("dashboard-boxes-data",t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){this.boxData=r,this.generateOptions(this.boxData);return}new Lt().get(g(t,"yyyy-MM-dd"),g(e,"yyyy-MM-dd"),null).then(i=>{this.boxData=i.data,window.store.set(n,i.data),this.generateOptions(this.boxData)})},generateOptions(t){this.balanceBox={amounts:[],subtitles:[]},this.billBox={paid:[],unpaid:[]},this.leftBox={left:[],perDay:[]},this.netBox={net:[]};let e={};for(const n in t)if(t.hasOwnProperty(n)){const a=t[n];if(!a.hasOwnProperty("key"))continue;let r=a.key;if(this.autoConversion){if(r.startsWith("balance-in-native")){this.balanceBox.amounts.push(f(a.value,a.currency_code)),e.hasOwnProperty(a.currency_code)||(e[a.currency_code]="");continue}if(r.startsWith("spent-in-native")){e.hasOwnProperty(a.currency_code)||(e[a.currency_code]=""),e[a.currency_code]=e[a.currency_code]+f(a.value,a.currency_code);continue}if(r.startsWith("earned-in-native")){e.hasOwnProperty(a.currency_code)||(e[a.currency_code]=""),e[a.currency_code]=f(a.value,a.currency_code)+" + "+e[a.currency_code];continue}if(r.startsWith("bills-unpaid-in-native")){this.billBox.unpaid.push(f(a.value,a.currency_code));continue}if(r.startsWith("bills-paid-in-native")){this.billBox.paid.push(f(a.value,a.currency_code));continue}if(r.startsWith("left-to-spend-in-native")){this.leftBox.left.push(f(a.value,a.currency_code));continue}if(r.startsWith("left-per-day-to-spend-in-native")){this.leftBox.perDay.push(f(a.value,a.currency_code));continue}if(r.startsWith("net-worth-in-native")){this.netBox.net.push(f(a.value,a.currency_code));continue}}if(!this.autoConversion&&!r.endsWith("native")){if(r.startsWith("balance-in-")){this.balanceBox.amounts.push(f(a.value,a.currency_code));continue}if(r.startsWith("spent-in-")){e.hasOwnProperty(a.currency_code)||(e[a.currency_code]=""),e[a.currency_code]=e[a.currency_code]+f(a.value,a.currency_code);continue}if(r.startsWith("earned-in-")){e.hasOwnProperty(a.currency_code)||(e[a.currency_code]=""),e[a.currency_code]=f(a.value,a.currency_code)+" + "+e[a.currency_code];continue}if(r.startsWith("bills-unpaid-in-")){this.billBox.unpaid.push(f(a.value,a.currency_code));continue}if(r.startsWith("bills-paid-in-")){this.billBox.paid.push(f(a.value,a.currency_code));continue}if(r.startsWith("left-to-spend-in-")){this.leftBox.left.push(f(a.value,a.currency_code));continue}if(r.startsWith("left-per-day-to-spend-in-")){this.leftBox.perDay.push(f(a.value,a.currency_code));continue}r.startsWith("net-worth-in-")&&this.netBox.net.push(f(a.value,a.currency_code))}}for(let n in e)e.hasOwnProperty(n)&&this.balanceBox.subtitles.push(e[n]);this.loading=!1},loadBoxes(){if(this.loading!==!0){if(this.loading=!0,this.boxData===null){this.getFreshData();return}this.generateOptions(this.boxData),this.loading=!1}},init(){Promise.all([v("viewRange"),v("autoConversion",!1)]).then(t=>{U=!0,this.autoConversion=t[1],this.loadBoxes()}),window.store.observe("end",()=>{U&&(this.boxData=null,this.loadBoxes())}),window.store.observe("autoConversion",t=>{U&&(this.autoConversion=t,this.loadBoxes())})}});class Gt{put(e,n){let a="/api/v1/preferences/"+e;return O.put(a,{data:n})}}function Tt(t,e=null){window.store.set(t,e),new Gt().put(t,e).then(a=>{}).catch(()=>{new bt().post(t,e).then(r=>{})})}let Rt=class{dashboard(e,n){let a=g(e,"y-MM-dd"),r=g(n,"y-MM-dd");return O.get("/api/v2/chart/account/dashboard",{params:{start:a,end:r}})}expense(e,n){let a=g(e,"y-MM-dd"),r=g(n,"y-MM-dd");return O.get("/api/v2/chart/account/expense-dashboard",{params:{start:a,end:r}})}};class st{get(e,n){let a={date:g(n,"y-MM-dd").slice(0,10)};return n?O.get("/api/v2/accounts/"+e,{params:a}):O.get("/api/v2/accounts/"+e)}transactions(e,n){const a={page:n.page??1};return n.hasOwnProperty("start")&&(a.start=g(n.start,"y-MM-dd")),n.hasOwnProperty("end")&&(a.end=g(n.end,"y-MM-dd")),O.get("/api/v2/accounts/"+e+"/transactions",{params:a})}}function N(t){return t==="sankey"?{type:"sankey",data:{datasets:[]},options:{animations:!1}}:t==="pie"?{type:"pie",data:{datasets:[]}}:t==="column"?{type:"bar",data:{labels:[],datasets:[]},options:{plugins:{tooltip:{callbacks:{label:function(e){let n=e.dataset.currency_code;return f(e.raw,n)}}}},maintainAspectRatio:!1,scales:{}}}:t==="line"?{options:{plugins:{tooltip:{callbacks:{label:function(e){let n=e.dataset.currency_code;return f(e.raw,n)}}}},maintainAspectRatio:!1,scales:{x:{type:"time",time:{tooltipFormat:"PP"}}}},type:"line",data:{labels:[],datasets:[]}}:{}}let q=new m("#36a2eb"),I=new m("#ff6384"),G=new m("#4bc0c0"),ft=new m("#ff9f40"),qt=new m("#9966ff"),Nt=new m("#ffcd56"),Yt=new m("#c9cbcf"),lt=0;window.theme==="dark"&&(I.darken(.3).desaturate(.3),G.darken(.3).desaturate(.3),q.darken(.3).desaturate(.3),ft.darken(.3).desaturate(.3));let z=[I,ft,q,G,qt,Nt,Yt,G];function j(t,e){let n={borderColor:I.rgbString(),backgroundColor:I.rgbString()},a;switch(t){default:let o=Math.floor(lt/2)%z.length;a=new m(z[o].rgbString()),a.lighten(.38),n={borderColor:z[o].hexString(),backgroundColor:a.hexString()};break;case"spent":a=new m(q.rgbString()),a.lighten(.38),n={borderColor:q.rgbString(),backgroundColor:a.rgbString()};break;case"left":a=new m(G.rgbString()),a.lighten(.38),n={borderColor:G.rgbString(),backgroundColor:a.rgbString()};break;case"overspent":a=new m(I.rgbString()),a.lighten(.22),n={borderColor:I.rgbString(),backgroundColor:a.rgbString()};break}return lt++,e==="border"?n.borderColor:e==="background"?n.backgroundColor:"#FF0000"}let A=[],$=null,H=null,J=!1;const Ut=()=>({loading:!1,loadingAccounts:!1,accountList:[],autoConversion:!1,chartOptions:null,switchAutoConversion(){this.autoConversion=!this.autoConversion,Tt("autoConversion",this.autoConversion)},getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P("dashboard-accounts-chart",t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){console.log(r),this.drawChart(this.generateOptions(r)),this.loading=!1;return}new Rt().dashboard(t,e,null).then(i=>{this.chartData=i.data,window.store.set(n,i.data),console.log(i.data),this.drawChart(this.generateOptions(this.chartData)),this.loading=!1})},generateOptions(t){A=[];let e=N("line");for(let n=0;n0){this.loadingAccounts=!1;return}const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P("dashboard-accounts-data",t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){this.accountList=r,this.loadingAccounts=!1;return}const o=10;let i=0,l=0,u=[];Promise.all([v("frontpageAccounts")]).then(d=>{i=d[0].length;for(let h in d[0]){let c=d[0];if(c.hasOwnProperty(h)){let _=c[h];new st().get(_,new Date(window.store.get("end"))).then(w=>{let C=w.data.data;const yt={page:1,start:new Date(window.store.get("start")),end:new Date(window.store.get("end"))};new st().transactions(C.id,yt).then(at=>{let nt=[];for(let B=0;B=o);B++){let M=at.data.data[B],rt={title:M.attributes.group_title===null?"":M.attributes.group_title,id:M.id,transactions:[]};for(let Y=0;YB.order-M.order),this.accountList=u,this.loadingAccounts=!1,window.store.set(n,u))})})}}})},init(){Promise.all([v("viewRange","1M"),v("autoConversion",!1),v("language","en_US")]).then(t=>{this.autoConversion=t[1],J=!0,this.loadChart(),this.loadAccounts()}),window.store.observe("end",()=>{J&&(H=null,this.accountList=[],this.loadChart(),this.loadAccounts())}),window.store.observe("autoConversion",()=>{J&&(this.loadChart(),this.loadAccounts())})}});let zt=class{dashboard(e,n){let a=g(e,"y-MM-dd"),r=g(n,"y-MM-dd");return O.get("/api/v2/chart/budget/dashboard",{params:{start:a,end:r}})}},V=[],T=null,F=null,Z=!1;const Ht=()=>({loading:!1,autoConversion:!1,loadChart(){if(this.loading!==!0){if(this.loading=!0,F!==null){this.drawChart(this.generateOptions(F)),this.loading=!1;return}this.getFreshData()}},drawChart(t){if(T!==null){T.data.datasets=t.data.datasets,T.update();return}T=new S(document.querySelector("#budget-chart"),t)},getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P("dashboard-budgets-chart",t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){F=r,this.drawChart(this.generateOptions(F)),this.loading=!1;return}new zt().dashboard(t,e,null).then(i=>{F=i.data,this.drawChart(this.generateOptions(F)),window.store.set(n,F),this.loading=!1})},generateOptions(t){V=[];let e=N("column");e.options.locale=window.store.get("locale").replace("_","-"),e.options.plugins={tooltip:{callbacks:{title:function(n){return n.label},label:function(n){let a=n.dataset.label||"";return a&&(a+=": "),a+" "+f(n.parsed.y,V[n.parsed.x]??"EUR")}}}},e.data={labels:[],datasets:[{label:p.t("firefly.spent"),data:[],borderWidth:1,stack:1,backgroundColor:j("spent","background"),borderColor:j("spent","border")},{label:p.t("firefly.left"),data:[],borderWidth:1,stack:1,backgroundColor:j("left","background"),borderColor:j("left","border")},{label:p.t("firefly.overspent"),data:[],borderWidth:1,stack:1,backgroundColor:j("overspent","background"),borderColor:j("overspent","border")}]};for(const n in t)if(t.hasOwnProperty(n)){let a=t[n],r=a.label+" ("+a.currency_code+")";e.data.labels.push(r),this.autoConversion&&(V.push(a.native_currency_code),e.data.datasets[0].data.push(parseFloat(a.native_entries.spent)*-1),e.data.datasets[1].data.push(parseFloat(a.native_entries.left)),e.data.datasets[2].data.push(parseFloat(a.native_entries.overspent))),this.autoConversion||(V.push(a.currency_code),e.data.datasets[0].data.push(parseFloat(a.entries.spent)*-1),e.data.datasets[1].data.push(parseFloat(a.entries.left)),e.data.datasets[2].data.push(parseFloat(a.entries.overspent)))}return e.options.scales={y:{ticks:{callback:function(n){return f(n,V[0]??"EUR")}}}},e},init(){Promise.all([v("autoConversion",!1)]).then(t=>{this.autoConversion=t[0],Z=!0,this.loading===!1&&this.loadChart()}),window.store.observe("end",()=>{Z&&this.loading===!1&&(F=null,this.loadChart())}),window.store.observe("autoConversion",t=>{Z&&(this.autoConversion=t,this.loading===!1&&this.loadChart())})}});class Jt{dashboard(e,n){let a=g(e,"y-MM-dd"),r=g(n,"y-MM-dd");return O.get("/api/v2/chart/category/dashboard",{params:{start:a,end:r}})}}let ut=[],K=null,W=null,Q=!1;const Zt=()=>({loading:!1,autoConversion:!1,generateOptions(t){ut=[];let e=N("column"),n={};for(const r in t)if(t.hasOwnProperty(r)){let o=t[r],i=o.currency_code;this.autoConversion&&(i=o.native_currency_code),n.hasOwnProperty(i)||(n[i]={name:i,yAxisID:"",data:{}},ut.push(i))}for(const r in t)if(t.hasOwnProperty(r)){let o=t[r],i=o.currency_code;this.autoConversion&&(i=o.native_currency_code);for(const l in n)if(n.hasOwnProperty(l)){let u=0;i===l&&(u=parseFloat(o.amount),""+o.currency_code,this.autoConversion&&(u=parseFloat(o.native_amount),""+o.native_currency_code)),n[l].data.hasOwnProperty(o.label)&&(n[l].data[o.label]=n[l].data[o.label]+u),n[l].data.hasOwnProperty(o.label)||(n[l].data[o.label]=u)}e.data.labels.includes(o.label)||e.data.labels.push(o.label)}let a=0;for(const r in n){let o="y"+r,i={label:r,currency_code:r,yAxisID:o,data:[]};for(const l in n[r].data)i.data.push(n[r].data[l]);e.data.datasets.push(i),e.options.scales.hasOwnProperty(o)||(e.options.scales[o]={beginAtZero:!0,type:"linear",position:a===1?"right":"left",ticks:{callback:function(l,u,d){return f(l,r)}}},a++)}return e},drawChart(t){if(K!==null){K.options=t.options,K.data=t.data,K.update();return}K=new S(document.querySelector("#category-chart"),t)},getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P("dashboard-categories-chart",t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){W=r,this.drawChart(this.generateOptions(W)),this.loading=!1;return}new Jt().dashboard(t,e,null).then(i=>{W=i.data,this.drawChart(this.generateOptions(i.data)),window.store.set(n,W),this.loading=!1})},loadChart(){if(this.loading!==!0){if(this.loading=!0,W!==null){this.drawChart(this.generateOptions(W)),this.loading=!1;return}this.getFreshData()}},init(){Promise.all([v("autoConversion",!1)]).then(t=>{this.autoConversion=t[0],Q=!0,this.loadChart()}),window.store.observe("end",()=>{Q&&(this.chartData=null,this.loadChart())}),window.store.observe("autoConversion",t=>{Q&&(this.autoConversion=t,this.loadChart())})}});S.register({SankeyController:vt,Flow:mt});const ct="dashboard-sankey-data";let X=!1,R=null,D=[],y=!1,s={category:null,unknown_category:null,in:null,out:null,unknown_source:null,unknown_dest:null,unknown_account:null,expense_account:null,revenue_account:null,budget:null,unknown_budget:null,all_money:null};const dt=function(t){return t.includes(s.revenue_account)?"forestgreen":t.includes("("+s.in+",")?"green":t.includes(s.budget)||t.includes(s.unknown_budget)?"Orchid":t.includes("("+s.out+",")?"MediumOrchid":t.includes(s.all_money)?"blue":"red"};function L(t,e,n,a){if(t==="category"&&e!==null&&n==="in")return s.category+' "'+e+'" ('+s.in+(y?", "+a+")":")");if(t==="category"&&e===null&&n==="in")return s.unknown_category+" ("+s.in+(y?", "+a+")":")");if(t==="category"&&e!==null&&n==="out")return s.category+' "'+e+'" ('+s.out+(y?", "+a+")":")");if(t==="category"&&e===null&&n==="out")return s.unknown_category+" ("+s.out+(y?", "+a+")":")");if(t==="account"&&e===null&&n==="in")return s.unknown_source+(y?" ("+a+")":"");if(t==="account"&&e!==null&&n==="in")return s.revenue_account+'"'+e+'"'+(y?" ("+a+")":"");if(t==="account"&&e===null&&n==="out")return s.unknown_dest+(y?" ("+a+")":"");if(t==="account"&&e!==null&&n==="out")return s.expense_account+' "'+e+'"'+(y?" ("+a+")":"");if(t==="budget"&&e!==null)return s.budget+' "'+e+'"'+(y?" ("+a+")":"");if(t==="budget"&&e===null)return s.unknown_budget+(y?" ("+a+")":"");console.error('Cannot handle: type:"'+t+'", dir: "'+n+'"')}function E(t,e,n){if(t==="category"&&e!==null)return s.category+' "'+e+'"'+(y?" ("+n+")":"");if(t==="category"&&e===null)return s.unknown_category+(y?" ("+n+")":"");if(t==="account"&&e===null)return s.unknown_account+(y?" ("+n+")":"");if(t==="account"&&e!==null)return e+(y?" ("+n+")":"");if(t==="budget"&&e!==null)return s.budget+' "'+e+'"'+(y?" ("+n+")":"");if(t==="budget"&&e===null)return s.unknown_budget+(y?" ("+n+")":"");console.error('Cannot handle: type:"'+t+'"')}const Qt=()=>({loading:!1,autoConversion:!1,generateOptions(){let t=N("sankey"),e={},n={};for(let r in D)if(D.hasOwnProperty(r)){let o=D[r];for(let i in o.attributes.transactions)if(o.attributes.transactions.hasOwnProperty(i)){let l=o.attributes.transactions[i],u=this.autoConversion?l.native_currency_code:l.currency_code,d=this.autoConversion?parseFloat(l.native_amount):parseFloat(l.amount),h;if(l.type==="deposit"){let c=L("category",l.category_name,"in",u),_=L("account",l.source_name,"in",u);n[c]=E("category",l.category_name,u),n[_]=E("account",l.source_name,u),h=_+"-"+c+"-"+u,e.hasOwnProperty(h)||(e[h]={from:_,to:c,amount:0}),e[h].amount+=d,h=c+"-"+s.all_money+"-"+u,e.hasOwnProperty(h)||(e[h]={from:c,to:s.all_money+(this.autoConversion?" ("+u+")":""),amount:0}),e[h].amount+=d}if(l.type==="withdrawal"){let c=L("budget",l.budget_name,"out",u);n[c]=E("budget",l.budget_name,u),h=s.all_money+"-"+c+"-"+u,e.hasOwnProperty(h)||(e[h]={from:s.all_money+(this.autoConversion?" ("+u+")":""),to:c,amount:0}),e[h].amount+=d;let _=L("category",l.category_name,"out",u);n[_]=E("category",l.category_name,u),h=c+"-"+_+"-"+u,e.hasOwnProperty(h)||(e[h]={from:c,to:_,amount:0}),e[h].amount+=d;let w=L("account",l.destination_name,"out",u);n[w]=E("account",l.destination_name,u),h=_+"-"+w+"-"+u,e.hasOwnProperty(h)||(e[h]={from:_,to:w,amount:0}),e[h].amount+=d}}}let a={label:"Firefly III dashboard sankey chart",data:[],colorFrom:r=>dt(r.dataset.data[r.dataIndex]?r.dataset.data[r.dataIndex].from:""),colorTo:r=>dt(r.dataset.data[r.dataIndex]?r.dataset.data[r.dataIndex].to:""),colorMode:"gradient",labels:n,size:"min"};for(let r in e)if(e.hasOwnProperty(r)){let o=e[r];a.data.push({from:o.from,to:o.to,flow:o.amount})}return t.data.datasets.push(a),t},drawChart(t){if(R!==null){R.data.datasets=t.data.datasets,R.update();return}R=new S(document.querySelector("#sankey-chart"),t)},getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P(ct,t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){D=r,this.drawChart(this.generateOptions()),this.loading=!1;return}let o={start:g(t,"y-MM-dd"),end:g(e,"y-MM-dd"),type:"withdrawal,deposit",page:1};this.downloadTransactions(o)},downloadTransactions(t){const e=new Date(window.store.get("start")),n=new Date(window.store.get("end")),a=P(ct,e,n);new $t().list(t).then(o=>{if(D=[...D,...o.data.data],parseInt(o.data.meta.pagination.total_pages)>t.page){t.page++,this.downloadTransactions(t);return}window.store.set(a,D),this.drawChart(this.generateOptions()),this.loading=!1})},loadChart(){if(this.loading!==!0){if(this.loading=!0,D.length!==0){this.drawChart(this.generateOptions()),this.loading=!1;return}this.getFreshData()}},init(){D=[],Promise.all([v("autoConversion",!1)]).then(t=>{this.autoConversion=t[0],y=t[0],s.all_money=p.t("firefly.all_money"),s.category=p.t("firefly.category"),s.in=p.t("firefly.money_flowing_in"),s.out=p.t("firefly.money_flowing_out"),s.unknown_category=p.t("firefly.unknown_category_plain"),s.unknown_source=p.t("firefly.unknown_source_plain"),s.unknown_dest=p.t("firefly.unknown_dest_plain"),s.unknown_account=p.t("firefly.unknown_any_plain"),s.unknown_budget=p.t("firefly.unknown_budget_plain"),s.expense_account=p.t("firefly.expense_account"),s.revenue_account=p.t("firefly.revenue_account"),s.budget=p.t("firefly.budget"),X=!0,this.loadChart()}),window.store.observe("end",()=>{X&&(this.transactions=[],this.loadChart())}),window.store.observe("autoConversion",t=>{X&&(this.autoConversion=t,this.loadChart())})}});let tt=!1,b={};function gt(t){return new Vt().list(t).then(n=>{let a=n.data.data;for(let r in a)if(a.hasOwnProperty(r)){let o=a[r];if(o.attributes.active&&o.attributes.pay_dates.length>0){let i=o.attributes.object_group_id===null?0:o.attributes.object_group_id,l=o.attributes.object_group_title===null?p.t("firefly.default_group_title_name_plain"):o.attributes.object_group_title,u=o.attributes.object_group_order===null?0:o.attributes.object_group_order;b.hasOwnProperty(i)||(b[i]={id:i,title:l,order:u,payment_info:{},bills:[]});let d={id:o.id,name:o.attributes.name,amount_min:o.attributes.amount_min,amount_max:o.attributes.amount_max,amount:(parseFloat(o.attributes.amount_max)+parseFloat(o.attributes.amount_min))/2,currency_code:o.attributes.currency_code,native_amount_min:o.attributes.native_amount_min,native_amount_max:o.attributes.native_amount_max,native_amount:(parseFloat(o.attributes.native_amount_max)+parseFloat(o.attributes.native_amount_min))/2,native_currency_code:o.attributes.native_currency_code,transactions:[],pay_dates:o.attributes.pay_dates,paid:o.attributes.paid_dates.length>0};d.expected_amount=t.autoConversion?f(d.native_amount,d.native_currency_code):f(d.amount,d.currency_code),d.expected_times=p.t("firefly.subscr_expected_x_times",{times:o.attributes.pay_dates.length,amount:d.expected_amount});for(let h in o.attributes.paid_dates)if(o.attributes.paid_dates.hasOwnProperty(h)){const c=o.attributes.paid_dates[h];let _=100;t.autoConversion&&(_=Math.round(-100+parseFloat(c.native_amount)*-1/parseFloat(d.native_amount)*100)),t.autoConversion||(_=Math.round(-100+parseFloat(c.amount)*-1/parseFloat(d.amount)*100));let w={amount:t.autoConversion?f(c.native_amount,c.native_currency_code):f(c.amount,c.currency_code),percentage:_,date:g(new Date(c.date),"PP"),foreign_amount:null};c.foreign_currency_code!==null&&(w.foreign_amount=t.autoConversion?c.foreign_native_amount:c.foreign_amount,w.foreign_currency_code=t.autoConversion?c.native_currency_code:c.foreign_currency_code),d.transactions.push(w)}if(b[i].bills.push(d),o.attributes.paid_dates.length===0){const h=o.attributes.pay_dates.length*d.amount,c=o.attributes.pay_dates.length*d.native_amount;b[i].payment_info.hasOwnProperty(d.currency_code)||(b[i].payment_info[d.currency_code]={currency_code:d.currency_code,paid:0,unpaid:0,native_currency_code:d.native_currency_code,native_paid:0,native_unpaid:0}),b[i].payment_info[d.currency_code].unpaid+=h,b[i].payment_info[d.currency_code].native_unpaid+=c}if(o.attributes.paid_dates.length>0){for(let h in o.attributes.paid_dates)if(o.attributes.paid_dates.hasOwnProperty(h)){let c=o.attributes.paid_dates[h];b[i].payment_info.hasOwnProperty(c.currency_code)||(b[i].payment_info[c.currency_code]={currency_code:d.currency_code,paid:0,unpaid:0,native_currency_code:d.native_currency_code,native_paid:0,native_unpaid:0});const _=parseFloat(c.amount)*-1,w=parseFloat(c.native_amount)*-1;b[i].payment_info[c.currency_code].paid+=_,b[i].payment_info[c.currency_code].native_paid+=w}}}}return parseInt(n.data.meta.pagination.total_pages)>t.page?(t.page++,gt(t)):Promise.resolve()})}const Xt=()=>({loading:!1,autoConversion:!1,subscriptions:[],startSubscriptions(){this.loading=!0;let t=new Date(window.store.get("start")),e=new Date(window.store.get("end"));const n=window.store.get("cacheValid");let a=window.store.get(P("subscriptions-data-dashboard",t,e));n&&typeof a<"u",b={},this.subscriptions=[];let r={start:g(t,"y-MM-dd"),end:g(e,"y-MM-dd"),autoConversion:this.autoConversion,page:1};gt(r).then(()=>{let o=Object.values(b);for(let i in o)if(o.hasOwnProperty(i)){let l=o[i];const u=Object.keys(l.payment_info);l.col_size=u.length===1?"col-6 offset-3":"col-6",l.chart_width=u.length===1?"50%":"100%",l.payment_length=u.length,this.subscriptions.push(l)}this.loading=!1})},drawPieChart(t,e,n){let a="#pie_"+t+"_"+n.currency_code;const r=this.autoConversion?n.native_unpaid:n.unpaid,o=this.autoConversion?n.native_paid:n.paid,i=this.autoConversion?n.native_currency_code:n.currency_code,u={type:"doughnut",data:{labels:[p.t("firefly.paid"),p.t("firefly.unpaid")],datasets:[{label:p.t("firefly.subscriptions_in_group",{title:e}),data:[o,r],backgroundColor:["rgb(54, 162, 235)","rgb(255, 99, 132)"],hoverOffset:4}]},options:{plugins:{tooltip:{callbacks:{label:function(h){return h.dataset.label+": "+f(h.raw,i)}}}}}};var d=S.getChart(document.querySelector(a));typeof d<"u"&&d.destroy(),new S(document.querySelector(a),u)},init(){Promise.all([v("autoConversion",!1)]).then(t=>{this.autoConversion=t[0],tt=!0,this.loading===!1&&this.startSubscriptions()}),window.store.observe("end",()=>{tt&&this.loading===!1&&this.startSubscriptions()}),window.store.observe("autoConversion",t=>{tt&&(this.autoConversion=t,this.loading===!1&&this.startSubscriptions())})}});let x={},et=!1;const ht="dashboard-piggies-data",te=()=>({loading:!1,autoConversion:!1,sankeyGrouping:"account",piggies:[],getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P(ht,t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){x=r,this.parsePiggies(),this.loading=!1;return}let o={start:g(t,"y-MM-dd"),end:g(e,"y-MM-dd"),page:1};this.downloadPiggyBanks(o)},downloadPiggyBanks(t){const e=new Date(window.store.get("start")),n=new Date(window.store.get("end")),a=P(ht,e,n);new Kt().list(t).then(o=>{if(x=[...x,...o.data.data],parseInt(o.data.meta.pagination.total_pages)>t.page){t.page++,this.downloadPiggyBanks(t);return}window.store.set(a,x),this.parsePiggies(),this.loading=!1})},parsePiggies(){let t=[];for(let e in x)if(x.hasOwnProperty(e)){let n=x[e];if(n.attributes.percentage>=100||n.attributes.percentage===0)continue;let a=n.object_group_title??p.t("firefly.default_group_title_name_plain");t.hasOwnProperty(a)||(t[a]={id:n.object_group_id??0,title:a,order:n.object_group_order??0,piggies:[]});let r={id:n.id,name:n.attributes.name,percentage:parseInt(n.attributes.percentage),amount:this.autoConversion?n.attributes.native_current_amount:n.attributes.current_amount,left_to_save:this.autoConversion?n.attributes.native_left_to_save:n.attributes.left_to_save,target_amount:this.autoConversion?n.attributes.native_target_amount:n.attributes.target_amount,save_per_month:this.autoConversion?n.attributes.native_save_per_month:n.attributes.save_per_month,currency_code:this.autoConversion?n.attributes.native_currency_code:n.attributes.currency_code};t[a].piggies.push(r)}this.piggies=Object.values(t)},loadPiggyBanks(){if(this.loading!==!0){if(this.loading=!0,this.piggies.length!==0){this.parsePiggies(),this.loading=!1;return}this.getFreshData()}},init(){x=[],Promise.all([v("autoConversion",!1)]).then(t=>{et=!0,this.autoConversion=t[0],this.loadPiggyBanks()}),window.store.observe("end",()=>{et&&(x=[],this.loadPiggyBanks())}),window.store.observe("autoConversion",t=>{et&&(this.autoConversion=t,this.loadPiggyBanks())})}});S.register({LineController:Ct,LineElement:kt,ArcElement:Pt,BarController:Dt,TimeScale:xt,PieController:Ot,BarElement:Mt,Filler:Ft,Colors:St,LinearScale:At,CategoryScale:Bt,PointElement:jt,Tooltip:Wt,Legend:It});const pt={dates:wt,boxes:Et,accounts:Ut,budgets:Ht,categories:Zt,sankey:Qt,subscriptions:Xt,piggies:te};function _t(t){Object.keys(t).forEach(e=>{let n=t[e]();Alpine.data(e,()=>n)}),Alpine.start()}document.addEventListener("firefly-iii-bootstrapped",()=>{console.log("Loaded through event listener."),_t(pt)});window.bootstrapped&&(console.log("Loaded through window variable."),_t(pt)); diff --git a/public/build/assets/edit-4a0660ed.js b/public/build/assets/edit-4a0660ed.js deleted file mode 100644 index b205793a1c..0000000000 --- a/public/build/assets/edit-4a0660ed.js +++ /dev/null @@ -1 +0,0 @@ -import{d as g,f as l}from"./format-money-e259f5e4.js";import{G as p}from"./get-3bb14de5.js";import{p as f}from"./parse-downloaded-splits-4afea167.js";import{d as r,e as m,s as w,f as y,g as b,l as v,a as A,b as C,c as S,h as D,i as u,j as c}from"./autocomplete-functions-ac0d2cb1.js";import{m as P,i as a}from"./vendor-fca45885.js";import"./create-empty-split-fb5bda92.js";import"./get-da167d5b.js";const i=D();let L=function(){return{entries:[],formStates:{loadingCurrencies:!0,loadingBudgets:!0,loadingPiggyBanks:!0,loadingSubscriptions:!0,isSubmitting:!1,returnHereButton:!1,saveAsNewButton:!1,resetButton:!0,rulesButton:!0,webhooksButton:!0},formBehaviour:{formType:"edit",foreignCurrencyEnabled:!0},formData:{defaultCurrency:null,enabledCurrencies:[],nativeCurrencies:[],foreignCurrencies:[],budgets:[],piggyBanks:[],subscriptions:[]},groupProperties:{transactionType:"unknown",title:null,id:null,totalAmount:0},notifications:{error:{show:!1,text:"",url:""},success:{show:!1,text:"",url:""},wait:{show:!1,text:""}},filters:{source:[],destination:[]},addedSplit(){setTimeout(()=>{const t=function(e,n,s){return e.name_with_balance+'
'+a.t("firefly.account_type_"+e.type)+""};r({selector:"input.ac-source",serverUrl:i.account,filters:this.filters.source,onRenderItem:t,onChange:m,onSelectItem:w}),console.log("ok"),console.log(this.entries[0].source_account.alpine_name),r({selector:"input.ac-dest",serverUrl:i.account,filters:this.filters.destination,onRenderItem:t,onChange:y,onSelectItem:b}),r({selector:"input.ac-category",serverUrl:i.category,valueField:"id",labelField:"name",onChange:u,onSelectItem:u}),r({selector:"input.ac-description",serverUrl:i.description,valueField:"id",labelField:"description",onChange:c,onSelectItem:c})},250)},changedDateTime(t){console.warn("changedDateTime, event is not used")},changedDescription(t){console.warn("changedDescription, event is not used")},changedDestinationAccount(t){console.warn("changedDestinationAccount, event is not used")},changedSourceAccount(t){console.warn("changedSourceAccount, event is not used")},formattedTotalAmount(){return this.entries.length===0?l(this.groupProperties.totalAmount,"EUR"):l(this.groupProperties.totalAmount,this.entries[0].currency_code??"EUR")},getTags(t){return console.log("at get tags "+t),console.log(this.entries[t].tags),this.entries[t].tags??[]},getTransactionGroup(){this.entries=[];const t=window.location.href.split("/"),e=parseInt(t[t.length-1]);new p().show(e,{}).then(s=>{const o=s.data.data;this.groupProperties.id=parseInt(o.id),this.groupProperties.transactionType=o.attributes.transactions[0].type,this.groupProperties.title=o.attributes.title??o.attributes.transactions[0].description,this.entries=f(o.attributes.transactions),this.notifications.wait.show=!1}).then(()=>{this.groupProperties.totalAmount=0;for(let s in this.entries)this.entries.hasOwnProperty(s)&&(this.groupProperties.totalAmount=this.groupProperties.totalAmount+parseFloat(this.entries[s].amount),this.filters.source.push(this.entries[s].source_account.type),this.filters.destination.push(this.entries[s].source_account.type));console.log(this.filters),setTimeout(()=>{P.init("select.ac-tags",{allowClear:!0,server:i.tag,liveServer:!0,clearEnd:!0,allowNew:!0,notFoundMessage:a.t("firefly.nothing_found"),noCache:!0,fetchOptions:{headers:{"X-CSRF-TOKEN":document.head.querySelector('meta[name="csrf-token"]').content}}})},150)})},init(){this.notifications.wait.show=!0,this.notifications.wait.text=a.t("firefly.wait_loading_transaction"),this.getTransactionGroup(),v().then(t=>{this.formStates.loadingCurrencies=!1,this.formData.defaultCurrency=t.defaultCurrency,this.formData.enabledCurrencies=t.enabledCurrencies,this.formData.nativeCurrencies=t.nativeCurrencies,this.formData.foreignCurrencies=t.foreignCurrencies}),A().then(t=>{this.formData.budgets=t,this.formStates.loadingBudgets=!1}),C().then(t=>{this.formData.piggyBanks=t,this.formStates.loadingPiggyBanks=!1}),S().then(t=>{this.formData.subscriptions=t,this.formStates.loadingSubscriptions=!1}),document.addEventListener("upload-success",t=>{this.processUpload(t),document.querySelectorAll("input[type=file]").value=""}),document.addEventListener("upload-error",t=>{this.processUploadError(t)}),document.addEventListener("location-move",t=>{this.entries[t.detail.index].latitude=t.detail.latitude,this.entries[t.detail.index].longitude=t.detail.longitude}),document.addEventListener("location-set",t=>{this.entries[t.detail.index].hasLocation=!0,this.entries[t.detail.index].latitude=t.detail.latitude,this.entries[t.detail.index].longitude=t.detail.longitude,this.entries[t.detail.index].zoomLevel=t.detail.zoomLevel}),document.addEventListener("location-zoom",t=>{this.entries[t.detail.index].hasLocation=!0,this.entries[t.detail.index].zoomLevel=t.detail.zoomLevel})},changedAmount(t){const e=parseInt(t.target.dataset.index);this.entries[e].amount=parseFloat(t.target.value),this.groupProperties.totalAmount=0;for(let n in this.entries)this.entries.hasOwnProperty(n)&&(this.groupProperties.totalAmount=this.groupProperties.totalAmount+parseFloat(this.entries[n].amount))}}},d={transactions:L,dates:g};function h(){Object.keys(d).forEach(t=>{console.log(`Loading page component "${t}"`);let e=d[t]();Alpine.data(t,()=>e)}),Alpine.start()}document.addEventListener("firefly-iii-bootstrapped",()=>{console.log("Loaded through event listener."),h()});window.bootstrapped&&(console.log("Loaded through window variable."),h()); diff --git a/public/build/assets/edit-b45ed381.js b/public/build/assets/edit-b45ed381.js new file mode 100644 index 0000000000..cc0764f838 --- /dev/null +++ b/public/build/assets/edit-b45ed381.js @@ -0,0 +1 @@ +import{a as p,d as f,f as c}from"./format-money-43e05102.js";import{G as g}from"./get-a29f6df7.js";import{p as m}from"./parse-downloaded-splits-4afea167.js";import{p as w,d as y,e as a,f as b,g as S,h as P,i as v,l as A,a as C,b as _,c as E,s as D,j as x,k as l,m as u}from"./splice-errors-into-transactions-9c9b99c0.js";import{i as r,m as B}from"./vendor-fca45885.js";import{d as T}from"./create-empty-split-fb5bda92.js";import"./get-94678769.js";class L{put(s,o){let e="/api/v2/transactions/"+parseInt(o.id);return p.put(e,s)}}const n=x();let U=function(){return{entries:[],formStates:{loadingCurrencies:!0,loadingBudgets:!0,loadingPiggyBanks:!0,loadingSubscriptions:!0,isSubmitting:!1,returnHereButton:!1,saveAsNewButton:!1,resetButton:!0,rulesButton:!0,webhooksButton:!0},formBehaviour:{formType:"edit",foreignCurrencyEnabled:!0},formData:{defaultCurrency:null,enabledCurrencies:[],nativeCurrencies:[],foreignCurrencies:[],budgets:[],piggyBanks:[],subscriptions:[]},groupProperties:{transactionType:"unknown",title:null,id:null,totalAmount:0},notifications:{error:{show:!1,text:"",url:""},success:{show:!1,text:"",url:""},wait:{show:!1,text:""}},submitTransaction(){this.notifications.error.show=!1,this.notifications.success.show=!1,this.notifications.wait.show=!1;for(let e in this.entries)this.entries.hasOwnProperty(e)&&(this.entries[e].errors=T());this.formStates.isSubmitting=!0;let t=w(this.entries,this.groupProperties.transactionType),s={group_title:this.groupProperties.title,fire_webhooks:this.formStates.webhooksButton,apply_rules:this.formStates.rulesButton,transactions:t};this.groupProperties.title===null&&t.length>1&&(s.group_title=t[0].description);let o=new L;console.log(s),o.put(s,{id:this.groupProperties.id}).then(e=>{const i=e.data.data;if(this.groupProperties.id=parseInt(i.id),this.groupProperties.title=i.attributes.group_title??i.attributes.transactions[0].description,y(this.groupProperties.id,i.attributes.transactions)>0){this.notifications.wait.show=!0,this.notifications.wait.text=r.t("firefly.wait_attachments");return}this.showMessageOrRedirectUser()}).catch(e=>{this.submitting=!1,console.log(e),typeof e.response<"u"&&this.parseErrors(e.response.data)})},filters:{source:[],destination:[]},addedSplit(){setTimeout(()=>{const t=function(s,o,e){return s.name_with_balance+'
'+r.t("firefly.account_type_"+s.type)+""};a({selector:"input.ac-source",serverUrl:n.account,filters:this.filters.source,onRenderItem:t,onChange:b,onSelectItem:S}),console.log("ok"),console.log(this.entries[0].source_account.alpine_name),a({selector:"input.ac-dest",serverUrl:n.account,filters:this.filters.destination,onRenderItem:t,onChange:P,onSelectItem:v}),a({selector:"input.ac-category",serverUrl:n.category,valueField:"id",labelField:"name",onChange:l,onSelectItem:l}),a({selector:"input.ac-description",serverUrl:n.description,valueField:"id",labelField:"description",onChange:u,onSelectItem:u})},250)},changedDateTime(t){console.warn("changedDateTime, event is not used")},changedDescription(t){console.warn("changedDescription, event is not used")},changedDestinationAccount(t){console.warn("changedDestinationAccount, event is not used")},changedSourceAccount(t){console.warn("changedSourceAccount, event is not used")},formattedTotalAmount(){return this.entries.length===0?c(this.groupProperties.totalAmount,"EUR"):c(this.groupProperties.totalAmount,this.entries[0].currency_code??"EUR")},getTags(t){return console.log("at get tags "+t),console.log(this.entries[t].tags),this.entries[t].tags??[]},getTransactionGroup(){this.entries=[];const t=window.location.href.split("/"),s=parseInt(t[t.length-1]);new g().show(s,{}).then(e=>{const i=e.data.data;this.groupProperties.id=parseInt(i.id),this.groupProperties.transactionType=i.attributes.transactions[0].type,this.groupProperties.title=i.attributes.title??i.attributes.transactions[0].description,this.entries=m(i.attributes.transactions),this.notifications.wait.show=!1}).then(()=>{this.groupProperties.totalAmount=0;for(let e in this.entries)this.entries.hasOwnProperty(e)&&(this.groupProperties.totalAmount=this.groupProperties.totalAmount+parseFloat(this.entries[e].amount),this.filters.source.push(this.entries[e].source_account.type),this.filters.destination.push(this.entries[e].source_account.type));console.log(this.filters),setTimeout(()=>{B.init("select.ac-tags",{allowClear:!0,server:n.tag,liveServer:!0,clearEnd:!0,allowNew:!0,notFoundMessage:r.t("firefly.nothing_found"),noCache:!0,fetchOptions:{headers:{"X-CSRF-TOKEN":document.head.querySelector('meta[name="csrf-token"]').content}}})},150)})},init(){this.notifications.wait.show=!0,this.notifications.wait.text=r.t("firefly.wait_loading_transaction"),this.getTransactionGroup(),A().then(t=>{this.formStates.loadingCurrencies=!1,this.formData.defaultCurrency=t.defaultCurrency,this.formData.enabledCurrencies=t.enabledCurrencies,this.formData.nativeCurrencies=t.nativeCurrencies,this.formData.foreignCurrencies=t.foreignCurrencies}),C().then(t=>{this.formData.budgets=t,this.formStates.loadingBudgets=!1}),_().then(t=>{this.formData.piggyBanks=t,this.formStates.loadingPiggyBanks=!1}),E().then(t=>{this.formData.subscriptions=t,this.formStates.loadingSubscriptions=!1}),document.addEventListener("upload-success",t=>{this.processUpload(t),document.querySelectorAll("input[type=file]").value=""}),document.addEventListener("upload-error",t=>{this.processUploadError(t)}),document.addEventListener("location-move",t=>{this.entries[t.detail.index].latitude=t.detail.latitude,this.entries[t.detail.index].longitude=t.detail.longitude}),document.addEventListener("location-set",t=>{this.entries[t.detail.index].hasLocation=!0,this.entries[t.detail.index].latitude=t.detail.latitude,this.entries[t.detail.index].longitude=t.detail.longitude,this.entries[t.detail.index].zoomLevel=t.detail.zoomLevel}),document.addEventListener("location-zoom",t=>{this.entries[t.detail.index].hasLocation=!0,this.entries[t.detail.index].zoomLevel=t.detail.zoomLevel})},changedAmount(t){const s=parseInt(t.target.dataset.index);this.entries[s].amount=parseFloat(t.target.value),this.groupProperties.totalAmount=0;for(let o in this.entries)this.entries.hasOwnProperty(o)&&(this.groupProperties.totalAmount=this.groupProperties.totalAmount+parseFloat(this.entries[o].amount))},showMessageOrRedirectUser(){if(this.notifications.error.show=!1,this.notifications.success.show=!1,this.notifications.wait.show=!1,this.formStates.returnHereButton){this.notifications.success.show=!0,this.notifications.success.url="transactions/show/"+this.groupProperties.id,this.notifications.success.text=r.t("firefly.updated_journal_js",{description:this.groupProperties.title});return}window.location="transactions/show/"+this.groupProperties.id+"?transaction_group_id="+this.groupProperties.id+"&message=updated"},parseErrors(t){this.notifications.error.show=!0,this.notifications.success.show=!1,this.notifications.wait.show=!1,this.formStates.isSubmitting=!1,this.notifications.error.text=r.t("firefly.errors_submission",{errorMessage:t.message}),t.hasOwnProperty("errors")&&(this.entries=D(t.errors,this.entries))},processUpload(t){this.showMessageOrRedirectUser()},processUploadError(t){this.notifications.success.show=!1,this.notifications.wait.show=!1,this.notifications.error.show=!0,this.formStates.isSubmitting=!1,this.notifications.error.text=r.t("firefly.errors_upload"),console.error(t)}}},h={transactions:U,dates:f};function d(){Object.keys(h).forEach(t=>{console.log(`Loading page component "${t}"`);let s=h[t]();Alpine.data(t,()=>s)}),Alpine.start()}document.addEventListener("firefly-iii-bootstrapped",()=>{console.log("Loaded through event listener."),d()});window.bootstrapped&&(console.log("Loaded through window variable."),d()); diff --git a/public/build/assets/format-money-43e05102.js b/public/build/assets/format-money-43e05102.js new file mode 100644 index 0000000000..7a1caade22 --- /dev/null +++ b/public/build/assets/format-money-43e05102.js @@ -0,0 +1 @@ +import{o as y,s as d,q as l,r as p,t as _,u as c,v as b,w as N,x as P,y as v,z as g,i as C,D as B,E as x,G as O,H as o,I as E,J as T,f as L,K as S,M as W,N as I,O as U,Q as q,R as Q,U as V,V as Y,W as $,X as j,Y as z,Z as X,_ as F,$ as G,a0 as H,a1 as J,a2 as K,a3 as Z,a4 as ee,a5 as te,a6 as ae,a7 as se,a8 as ne,a9 as re,aa as le,ab as de,ac as oe,ad as ie,ae as ue,af as ge,ag as ce,ah as we,ai as he,aj as ye}from"./vendor-fca45885.js";const k="/",h=y.create({baseURL:k,withCredentials:!0});y.defaults.withCredentials=!0;y.defaults.baseURL=k;class R{getByName(e){return h.get("/api/v1/preferences/"+e)}getByNameNow(e){return h.get("/api/v1/preferences/"+e)}postByName(e,a){return h.post("/api/v1/preferences",{name:e,data:a})}}class A{post(e,a){let s="/api/v1/preferences";return h.post(s,{name:e,data:a})}}function fe(t,e=null){return new R().getByName(t).then(s=>Promise.resolve(M(t,s))).catch(()=>{new A().post(t,e).then(i=>Promise.resolve(M(t,i)))})}function M(t,e){return e.data.data.attributes.data}function w(t,e=null){const a=window.store.get("cacheValid");if(a&&window.hasOwnProperty(t))return Promise.resolve(window[t]);const s=window.store.get(t);return a&&typeof s<"u"?Promise.resolve(s):new R().getByName(t).then(u=>Promise.resolve(m(t,u))).catch(()=>{new A().post(t,e).then(n=>Promise.resolve(m(t,n)))})}function m(t,e){let a=e.data.data.attributes.data;return window.store.set(t,a),a}function be(t,e){let a,s;switch(t){case"last365":a=d(g(e,365)),s=l(e);break;case"last90":a=d(g(e,90)),s=l(e);break;case"last30":a=d(g(e,30)),s=l(e);break;case"last7":a=d(g(e,7)),s=l(e);break;case"YTD":a=v(e),s=l(e);break;case"QTD":a=p(e),s=l(e);break;case"MTD":a=c(e),s=l(e);break;case"1D":a=d(e),s=l(e);break;case"1W":a=d(N(e,{weekStartsOn:1})),s=l(P(e,{weekStartsOn:1}));break;case"1M":a=d(c(e)),s=l(b(e));break;case"3M":a=d(p(e)),s=l(_(e));break;case"6M":e.getMonth()<=5&&(a=new Date(e),a.setMonth(0),a.setDate(1),a=d(a),s=new Date(e),s.setMonth(5),s.setDate(30),s=l(a)),e.getMonth()>5&&(a=new Date(e),a.setMonth(6),a.setDate(1),a=d(a),s=new Date(e),s.setMonth(11),s.setDate(31),s=l(a));break;case"1Y":a=new Date(e),a.setMonth(0),a.setDate(1),a=d(a),s=new Date(e),s.setMonth(11),s.setDate(31),s=l(s);break}return{start:a,end:s}}let D=!1;function pe(t){if(D===!1){const e=t.replace("-","_");D=!0;const a=7*24*60*60*1e3;return console.log('Will load language "'+e+'"'),C.use(B).init({load:"languageOnly",fallbackLng:"en",lng:e,debug:!1,backend:{backends:[x,O],backendOptions:[{load:"languageOnly",expirationTime:a},{loadPath:"./v2/i18n/{{lng}}.json"}]}})}return console.warn("Loading translations skipped."),Promise.resolve()}o.addPlugin(E);window.bootstrapped=!1;window.store=o;fe("lastActivity").then(t=>{const e=o.get("lastActivity");o.set("cacheValid",e===t),o.set("lastActivity",t),console.log("Server value: "+t),console.log("Local value: "+e),console.log("Cache valid: "+(e===t))}).then(()=>{Promise.all([w("viewRange"),w("darkMode"),w("locale"),w("language")]).then(t=>{if(!o.get("start")||!o.get("end")){const e=be(t[0],new Date);o.set("start",e.start),o.set("end",e.end)}window.__localeId__=t[2],o.set("language",t[3]),o.set("locale",t[3]),pe(t[3]).then(()=>{const e=new Event("firefly-iii-bootstrapped");document.dispatchEvent(e),window.bootstrapped=!0})})});window.axios=y;window.axios.defaults.headers.common["X-Requested-With"]="XMLHttpRequest";window.Alpine=T;const f={bg:S,cs:W,da:I,de:U,el:q,enGB:Q,enUS:V,es:Y,ca:$,fi:j,fr:z,hu:X,id:F,it:G,ja:H,ko:J,nb:K,nn:Z,nl:ee,pl:te,ptBR:ae,pt:se,ro:ne,ru:re,sk:le,sl:de,sv:oe,tr:ie,uk:ue,vi:ge,zhTW:ce,zhCN:we};function r(t,e="PP"){let a=window.__localeId__.replace("_","");return L(t,e,{locale:f[a]??f[a.slice(0,2)]??f.enUS})}const me=()=>({range:{start:null,end:null},defaultRange:{start:null,end:null},language:"en_US",init(){this.range={start:new Date(window.store.get("start")),end:new Date(window.store.get("end"))},this.defaultRange={start:new Date(window.store.get("start")),end:new Date(window.store.get("end"))},this.language=window.store.get("language"),this.locale=window.store.get("locale"),this.locale=this.locale==="equal"?this.language:this.locale,window.__localeId__=this.language,this.buildDateRange(),window.store.observe("start",t=>{this.range.start=new Date(t)}),window.store.observe("end",t=>{this.range.end=new Date(t),this.buildDateRange()})},buildDateRange(){let t=this.getNextRange(),e=this.getPrevRange(),a=this.lastDays(7),s=this.lastDays(30),i=this.mtd(),u=this.ytd(),n=document.getElementsByClassName("daterange-holder")[0];n.textContent=r(this.range.start)+" - "+r(this.range.end),n.setAttribute("data-start",r(this.range.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(this.range.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-current")[0],n.textContent=r(this.defaultRange.start)+" - "+r(this.defaultRange.end),n.setAttribute("data-start",r(this.defaultRange.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(this.defaultRange.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-next")[0],n.textContent=r(t.start)+" - "+r(t.end),n.setAttribute("data-start",r(t.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(t.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-prev")[0],n.textContent=r(e.start)+" - "+r(e.end),n.setAttribute("data-start",r(e.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(e.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-7d")[0],n.setAttribute("data-start",r(a.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(a.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-90d")[0],n.setAttribute("data-start",r(s.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(s.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-mtd")[0],n.setAttribute("data-start",r(i.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(i.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-ytd")[0],n.setAttribute("data-start",r(u.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(u.end,"yyyy-MM-dd"))},getNextRange(){let t=c(this.range.start),e=he(t,1),a=b(e);return{start:e,end:a}},getPrevRange(){let t=c(this.range.start),e=ye(t,1),a=b(e);return{start:e,end:a}},ytd(){let t=new Date;return{start:v(this.range.start),end:t}},mtd(){let t=new Date;return{start:c(this.range.start),end:t}},lastDays(t){let e=new Date;return{start:g(e,t),end:e}},changeDateRange(t){t.preventDefault();let e=t.currentTarget,a=new Date(e.getAttribute("data-start")),s=new Date(e.getAttribute("data-end"));return window.store.set("start",a),window.store.set("end",s),!1}});function De(t,e){let a=window.__localeId__.replace("_","-");return Intl.NumberFormat(a,{style:"currency",currency:e}).format(t)}export{A as P,h as a,me as d,De as f,w as g}; diff --git a/public/build/assets/format-money-e259f5e4.js b/public/build/assets/format-money-e259f5e4.js deleted file mode 100644 index 21cc8281ee..0000000000 --- a/public/build/assets/format-money-e259f5e4.js +++ /dev/null @@ -1 +0,0 @@ -import{o as y,s as l,q as d,r as p,t as A,u as g,v as b,w as N,x as P,y as v,z as c,i as C,D as B,E as x,G as O,H as o,I as E,J as S,f as T,K as L,M as U,N as I,O as W,Q as q,R as Q,U as V,V as Y,W as $,X as j,Y as z,Z as X,_ as F,$ as G,a0 as H,a1 as J,a2 as K,a3 as Z,a4 as ee,a5 as te,a6 as ae,a7 as se,a8 as ne,a9 as re,aa as de,ab as le,ac as oe,ad as ie,ae as ue,af as ce,ag as ge,ah as we,ai as he,aj as ye}from"./vendor-fca45885.js";const k="/",h=y.create({baseURL:k,withCredentials:!0});y.defaults.withCredentials=!0;y.defaults.baseURL=k;class R{getByName(e){return h.get("/api/v1/preferences/"+e)}getByNameNow(e){return h.get("/api/v1/preferences/"+e)}postByName(e,a){return h.post("/api/v1/preferences",{name:e,data:a})}}class _{post(e,a){let s="/api/v1/preferences";return h.post(s,{name:e,data:a})}}function fe(t,e=null){return new R().getByName(t).then(s=>Promise.resolve(M(t,s))).catch(()=>{new _().post(t,e).then(i=>Promise.resolve(M(t,i)))})}function M(t,e){return e.data.data.attributes.data}function w(t,e=null){const a=window.store.get("cacheValid");if(a&&window.hasOwnProperty(t))return Promise.resolve(window[t]);const s=window.store.get(t);return a&&typeof s<"u"?Promise.resolve(s):new R().getByName(t).then(u=>Promise.resolve(m(t,u))).catch(()=>{new _().post(t,e).then(n=>Promise.resolve(m(t,n)))})}function m(t,e){let a=e.data.data.attributes.data;return window.store.set(t,a),a}function be(t,e){let a,s;switch(t){case"last365":a=l(c(e,365)),s=d(e);break;case"last90":a=l(c(e,90)),s=d(e);break;case"last30":a=l(c(e,30)),s=d(e);break;case"last7":a=l(c(e,7)),s=d(e);break;case"YTD":a=v(e),s=d(e);break;case"QTD":a=p(e),s=d(e);break;case"MTD":a=g(e),s=d(e);break;case"1D":a=l(e),s=d(e);break;case"1W":a=l(N(e,{weekStartsOn:1})),s=d(P(e,{weekStartsOn:1}));break;case"1M":a=l(g(e)),s=d(b(e));break;case"3M":a=l(p(e)),s=d(A(e));break;case"6M":e.getMonth()<=5&&(a=new Date(e),a.setMonth(0),a.setDate(1),a=l(a),s=new Date(e),s.setMonth(5),s.setDate(30),s=d(a)),e.getMonth()>5&&(a=new Date(e),a.setMonth(6),a.setDate(1),a=l(a),s=new Date(e),s.setMonth(11),s.setDate(31),s=d(a));break;case"1Y":a=new Date(e),a.setMonth(0),a.setDate(1),a=l(a),s=new Date(e),s.setMonth(11),s.setDate(31),s=d(s);break}return{start:a,end:s}}let D=!1;function pe(t){if(D===!1){const e=t.replace("-","_");D=!0,console.log("production");const a=7*24*60*60*1e3;return C.use(B).init({fallbackLng:"en_US",lng:e,debug:!1,backend:{backends:[x,O],backendOptions:[{expirationTime:a},{loadPath:"./v2/i18n/{{lng}}.json"}]}})}return console.warn("Loading translations skipped."),Promise.resolve()}o.addPlugin(E);window.bootstrapped=!1;window.store=o;fe("lastActivity").then(t=>{const e=o.get("lastActivity");o.set("cacheValid",e===t),o.set("lastActivity",t),console.log("Server value: "+t),console.log("Local value: "+e),console.log("Cache valid: "+(e===t))}).then(()=>{Promise.all([w("viewRange"),w("darkMode"),w("locale"),w("language")]).then(t=>{if(!o.get("start")||!o.get("end")){const e=be(t[0],new Date);o.set("start",e.start),o.set("end",e.end)}window.__localeId__=t[2],o.set("language",t[3]),o.set("locale",t[3]),pe(t[3]).then(()=>{const e=new Event("firefly-iii-bootstrapped");document.dispatchEvent(e),window.bootstrapped=!0})})});window.axios=y;window.axios.defaults.headers.common["X-Requested-With"]="XMLHttpRequest";window.Alpine=S;const f={bg:L,cs:U,da:I,de:W,el:q,enGB:Q,enUS:V,es:Y,ca:$,fi:j,fr:z,hu:X,id:F,it:G,ja:H,ko:J,nb:K,nn:Z,nl:ee,pl:te,ptBR:ae,pt:se,ro:ne,ru:re,sk:de,sl:le,sv:oe,tr:ie,uk:ue,vi:ce,zhTW:ge,zhCN:we};function r(t,e="PP"){let a=window.__localeId__.replace("_","");return T(t,e,{locale:f[a]??f[a.slice(0,2)]??f.enUS})}const me=()=>({range:{start:null,end:null},defaultRange:{start:null,end:null},language:"en_US",init(){this.range={start:new Date(window.store.get("start")),end:new Date(window.store.get("end"))},this.defaultRange={start:new Date(window.store.get("start")),end:new Date(window.store.get("end"))},this.language=window.store.get("language"),this.locale=window.store.get("locale"),this.locale=this.locale==="equal"?this.language:this.locale,window.__localeId__=this.language,this.buildDateRange(),window.store.observe("start",t=>{this.range.start=new Date(t)}),window.store.observe("end",t=>{this.range.end=new Date(t),this.buildDateRange()})},buildDateRange(){let t=this.getNextRange(),e=this.getPrevRange(),a=this.lastDays(7),s=this.lastDays(30),i=this.mtd(),u=this.ytd(),n=document.getElementsByClassName("daterange-holder")[0];n.textContent=r(this.range.start)+" - "+r(this.range.end),n.setAttribute("data-start",r(this.range.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(this.range.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-current")[0],n.textContent=r(this.defaultRange.start)+" - "+r(this.defaultRange.end),n.setAttribute("data-start",r(this.defaultRange.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(this.defaultRange.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-next")[0],n.textContent=r(t.start)+" - "+r(t.end),n.setAttribute("data-start",r(t.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(t.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-prev")[0],n.textContent=r(e.start)+" - "+r(e.end),n.setAttribute("data-start",r(e.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(e.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-7d")[0],n.setAttribute("data-start",r(a.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(a.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-90d")[0],n.setAttribute("data-start",r(s.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(s.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-mtd")[0],n.setAttribute("data-start",r(i.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(i.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-ytd")[0],n.setAttribute("data-start",r(u.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(u.end,"yyyy-MM-dd"))},getNextRange(){let t=g(this.range.start),e=he(t,1),a=b(e);return{start:e,end:a}},getPrevRange(){let t=g(this.range.start),e=ye(t,1),a=b(e);return{start:e,end:a}},ytd(){let t=new Date;return{start:v(this.range.start),end:t}},mtd(){let t=new Date;return{start:g(this.range.start),end:t}},lastDays(t){let e=new Date;return{start:c(e,t),end:e}},changeDateRange(t){t.preventDefault();let e=t.currentTarget,a=new Date(e.getAttribute("data-start")),s=new Date(e.getAttribute("data-end"));return window.store.set("start",a),window.store.set("end",s),!1}});function De(t,e){let a=window.__localeId__.replace("_","-");return Intl.NumberFormat(a,{style:"currency",currency:e}).format(t)}export{_ as P,h as a,me as d,De as f,w as g}; diff --git a/public/build/assets/get-da167d5b.js b/public/build/assets/get-94678769.js similarity index 81% rename from public/build/assets/get-da167d5b.js rename to public/build/assets/get-94678769.js index ba0b6dac36..d96f4ad33e 100644 --- a/public/build/assets/get-da167d5b.js +++ b/public/build/assets/get-94678769.js @@ -1 +1 @@ -import{a as s}from"./format-money-e259f5e4.js";let t=class{list(a){return s.get("/api/v2/subscriptions",{params:a})}paid(a){return s.get("/api/v2/subscriptions/sum/paid",{params:a})}unpaid(a){return s.get("/api/v2/subscriptions/sum/unpaid",{params:a})}};class e{list(a){return s.get("/api/v2/piggy-banks",{params:a})}}export{t as G,e as a}; +import{a as s}from"./format-money-43e05102.js";let t=class{list(a){return s.get("/api/v2/subscriptions",{params:a})}paid(a){return s.get("/api/v2/subscriptions/sum/paid",{params:a})}unpaid(a){return s.get("/api/v2/subscriptions/sum/unpaid",{params:a})}};class e{list(a){return s.get("/api/v2/piggy-banks",{params:a})}}export{t as G,e as a}; diff --git a/public/build/assets/get-3bb14de5.js b/public/build/assets/get-a29f6df7.js similarity index 66% rename from public/build/assets/get-3bb14de5.js rename to public/build/assets/get-a29f6df7.js index be41f2b17b..df3596abad 100644 --- a/public/build/assets/get-3bb14de5.js +++ b/public/build/assets/get-a29f6df7.js @@ -1 +1 @@ -import{a as s}from"./format-money-e259f5e4.js";class p{list(a){return s.get("/api/v2/transactions",{params:a})}show(a,t){return s.get("/api/v2/transactions/"+a,{params:t})}}export{p as G}; +import{a as s}from"./format-money-43e05102.js";class p{list(a){return s.get("/api/v2/transactions",{params:a})}show(a,t){return s.get("/api/v2/transactions/"+a,{params:t})}}export{p as G}; diff --git a/public/build/assets/index-8df22335.js b/public/build/assets/index-8df22335.js new file mode 100644 index 0000000000..745af4c51d --- /dev/null +++ b/public/build/assets/index-8df22335.js @@ -0,0 +1 @@ +import{d as c,f as d}from"./format-money-43e05102.js";import{f,i as r}from"./vendor-fca45885.js";import{G as p}from"./get-a29f6df7.js";let g=function(){return{notifications:{error:{show:!1,text:"",url:""},success:{show:!1,text:"",url:""},wait:{show:!1,text:""}},transactions:[],totalPages:1,perPage:50,page:1,tableColumns:{description:{enabled:!0},source:{enabled:!0},destination:{enabled:!0},amount:{enabled:!0}},formatMoney(a,i){return d(a,i)},format(a){return f(a,r.t("config.date_time_fns"))},init(){this.notifications.wait.show=!0,this.notifications.wait.text=r.t("firefly.wait_loading_data"),this.getTransactions(this.page)},getTransactions(a){new p().list({page:a}).then(t=>{this.parseTransactions(t.data.data),this.totalPages=t.data.meta.pagination.total_pages,this.perPage=t.data.meta.pagination.per_page,this.page=t.data.meta.pagination.current_page}).catch(t=>{this.notifications.wait.show=!1,this.notifications.error.show=!0,this.notifications.error.text=t.response.data.message})},parseTransactions(a){for(let i in a)if(a.hasOwnProperty(i)){let t=a[i],u=t.attributes.transactions.length>1,s=!0;for(let o in t.attributes.transactions)if(t.attributes.transactions.hasOwnProperty(o)){let e=t.attributes.transactions[o];e.split=u,e.firstSplit=s,e.group_title=t.attributes.group_title,e.id=t.id,e.created_at=t.attributes.created_at,e.updated_at=t.attributes.updated_at,e.user=t.attributes.user,e.user_group=t.attributes.user_group,s=!1,console.log(e),this.transactions.push(e)}}this.notifications.wait.show=!1}}},n={index:g,dates:c};function l(){Object.keys(n).forEach(a=>{console.log(`Loading page component "${a}"`);let i=n[a]();Alpine.data(a,()=>i)}),Alpine.start()}document.addEventListener("firefly-iii-bootstrapped",()=>{console.log("Loaded through event listener."),l()});window.bootstrapped&&(console.log("Loaded through window variable."),l()); diff --git a/public/build/assets/show-9f0eb3b4.js b/public/build/assets/show-61e79d17.js similarity index 91% rename from public/build/assets/show-9f0eb3b4.js rename to public/build/assets/show-61e79d17.js index 3b3da37f2f..679d1b2cd2 100644 --- a/public/build/assets/show-9f0eb3b4.js +++ b/public/build/assets/show-61e79d17.js @@ -1 +1 @@ -import{d,f as p}from"./format-money-e259f5e4.js";import{f as c,i as o}from"./vendor-fca45885.js";import{G as l}from"./get-3bb14de5.js";import{p as f}from"./parse-downloaded-splits-4afea167.js";import"./create-empty-split-fb5bda92.js";let h=function(){return{notifications:{error:{show:!1,text:"",url:""},success:{show:!1,text:"",url:""},wait:{show:!1,text:""}},groupProperties:{id:0,transactionType:"",transactionTypeTranslated:"",title:"",date:new Date},dateFields:["book_date","due_date","interest_date","invoice_date","payment_date","process_date"],metaFields:["external_id","internal_reference","sepa_batch_id","sepa_ct_id","sepa_ct_op","sepa_db","sepa_country","sepa_cc","sepa_ep","sepa_ci","external_url"],amounts:{},entries:[],pageProperties:{},formatMoney(e,s){return p(e,s)},format(e){return c(e,o.t("config.date_time_fns"))},init(){this.notifications.wait.show=!0,this.notifications.wait.text=o.t("firefly.wait_loading_data");const e=window.location.href.split("/"),s=parseInt(e[e.length-1]);new l().show(s,{}).then(t=>{const i=t.data.data;this.groupProperties.id=parseInt(i.id),this.groupProperties.transactionType=i.attributes.transactions[0].type,this.groupProperties.transactionTypeTranslated=o.t("firefly."+i.attributes.transactions[0].type),this.groupProperties.title=i.attributes.title??i.attributes.transactions[0].description,this.entries=f(i.attributes.transactions),this.notifications.wait.show=!1}).then(()=>{for(let t in this.entries)if(this.entries.hasOwnProperty(t)){const i=this.entries[t].currency_code,a=this.entries[t].foreign_currency_code;this.amounts[i]===void 0&&(this.amounts[i]=0,this.amounts[i]+=parseFloat(this.entries[t].amount)),a!==null&&a!==""&&this.amounts[a]===void 0&&(this.amounts[a]=0,this.amounts[a]+=parseFloat(this.entries[t].foreign_amount)),parseInt(t)===0&&(this.groupProperties.date=this.entries[t].date)}}).catch(t=>{this.notifications.error.show=!0,this.notifications.error.text=t.message})}}},r={show:h,dates:d};function n(){Object.keys(r).forEach(e=>{console.log(`Loading page component "${e}"`);let s=r[e]();Alpine.data(e,()=>s)}),Alpine.start()}document.addEventListener("firefly-iii-bootstrapped",()=>{console.log("Loaded through event listener."),n()});window.bootstrapped&&(console.log("Loaded through window variable."),n()); +import{d,f as p}from"./format-money-43e05102.js";import{f as c,i as o}from"./vendor-fca45885.js";import{G as l}from"./get-a29f6df7.js";import{p as f}from"./parse-downloaded-splits-4afea167.js";import"./create-empty-split-fb5bda92.js";let h=function(){return{notifications:{error:{show:!1,text:"",url:""},success:{show:!1,text:"",url:""},wait:{show:!1,text:""}},groupProperties:{id:0,transactionType:"",transactionTypeTranslated:"",title:"",date:new Date},dateFields:["book_date","due_date","interest_date","invoice_date","payment_date","process_date"],metaFields:["external_id","internal_reference","sepa_batch_id","sepa_ct_id","sepa_ct_op","sepa_db","sepa_country","sepa_cc","sepa_ep","sepa_ci","external_url"],amounts:{},entries:[],pageProperties:{},formatMoney(e,s){return p(e,s)},format(e){return c(e,o.t("config.date_time_fns"))},init(){this.notifications.wait.show=!0,this.notifications.wait.text=o.t("firefly.wait_loading_data");const e=window.location.href.split("/"),s=parseInt(e[e.length-1]);new l().show(s,{}).then(t=>{const i=t.data.data;this.groupProperties.id=parseInt(i.id),this.groupProperties.transactionType=i.attributes.transactions[0].type,this.groupProperties.transactionTypeTranslated=o.t("firefly."+i.attributes.transactions[0].type),this.groupProperties.title=i.attributes.title??i.attributes.transactions[0].description,this.entries=f(i.attributes.transactions),this.notifications.wait.show=!1}).then(()=>{for(let t in this.entries)if(this.entries.hasOwnProperty(t)){const i=this.entries[t].currency_code,a=this.entries[t].foreign_currency_code;this.amounts[i]===void 0&&(this.amounts[i]=0,this.amounts[i]+=parseFloat(this.entries[t].amount)),a!==null&&a!==""&&this.amounts[a]===void 0&&(this.amounts[a]=0,this.amounts[a]+=parseFloat(this.entries[t].foreign_amount)),parseInt(t)===0&&(this.groupProperties.date=this.entries[t].date)}}).catch(t=>{this.notifications.error.show=!0,this.notifications.error.text=t.message})}}},r={show:h,dates:d};function n(){Object.keys(r).forEach(e=>{console.log(`Loading page component "${e}"`);let s=r[e]();Alpine.data(e,()=>s)}),Alpine.start()}document.addEventListener("firefly-iii-bootstrapped",()=>{console.log("Loaded through event listener."),n()});window.bootstrapped&&(console.log("Loaded through window variable."),n()); diff --git a/public/build/assets/splice-errors-into-transactions-9c9b99c0.js b/public/build/assets/splice-errors-into-transactions-9c9b99c0.js new file mode 100644 index 0000000000..a11bdf4ad2 --- /dev/null +++ b/public/build/assets/splice-errors-into-transactions-9c9b99c0.js @@ -0,0 +1 @@ +import{a as l}from"./format-money-43e05102.js";import{a as p,G as f}from"./get-94678769.js";import{n as m,i as _}from"./vendor-fca45885.js";function x(r,n){let a=[];for(let o in r)if(r.hasOwnProperty(o)){const t=r[o];let e={};e.description=t.description,e.source_name=t.source_account.name,e.destination_name=t.destination_account.name,e.amount=t.amount,e.currency_code=t.currency_code,e.date=t.date,e.interest_date=t.interest_date,e.book_date=t.book_date,e.process_date=t.process_date,e.due_date=t.due_date,e.payment_date=t.payment_date,e.invoice_date=t.invoice_date,e.budget_id=t.budget_id,e.category_name=t.category_name,e.piggy_bank_id=t.piggy_bank_id,e.bill_id=t.bill_id,e.tags=t.tags,e.notes=t.notes,e.internal_reference=t.internal_reference,e.external_url=t.external_url,e.store_location=!1,t.hasLocation&&(e.store_location=!0,e.longitude=t.longitude.toString(),e.latitude=t.latitude.toString(),e.zoom_level=t.zoomLevel),typeof t.foreign_currency_code<"u"&&t.foreign_currency_code.toString()!==""&&(e.foreign_currency_code=t.foreign_currency_code,typeof t.foreign_amount<"u"&&t.foreign_amount.toString()!==""&&(e.foreign_amount=t.foreign_amount),(typeof t.foreign_amount>"u"||t.foreign_amount.toString()==="")&&(delete e.foreign_amount,delete e.foreign_currency_code)),typeof t.source_account.id<"u"&&t.source_account.id.toString()!==""&&(e.source_id=t.source_account.id),typeof t.destination_account.id<"u"&&t.destination_account.id.toString()!==""&&(e.destination_id=t.destination_account.id),e.type=n,a.push(e)}return a}let g=class{list(n){return l.get("/api/v2/currencies",{params:n})}};function C(){let r={page:1,limit:1337};return new g().list(r).then(a=>{let o={defaultCurrency:{},nativeCurrencies:[],foreignCurrencies:[],enabledCurrencies:[]};o.foreignCurrencies.push({id:0,name:"(no foreign currency)",code:"",default:!1,symbol:"",decimal_places:2});for(let t in a.data.data)if(a.data.data.hasOwnProperty(t)){let e=a.data.data[t];if(e.attributes.enabled){let c={id:e.id,name:e.attributes.name,code:e.attributes.code,default:e.attributes.default,symbol:e.attributes.symbol,decimal_places:e.attributes.decimal_places};c.default&&(o.defaultCurrency=c),o.enabledCurrencies.push(c),o.nativeCurrencies.push(c),o.foreignCurrencies.push(c)}}return o})}class y{list(n){return l.get("/api/v2/budgets",{params:n})}}function $(){let r={page:1,limit:1337};return new y().list(r).then(a=>{let o=[{id:0,name:"(no budget)"}];for(let t in a.data.data)if(a.data.data.hasOwnProperty(t)){let e=a.data.data[t],c={id:e.id,name:e.attributes.name};o.push(c)}return o})}function O(){let r={page:1,limit:1337};return new p().list(r).then(a=>{let o={0:{id:0,name:"(no group)",order:0,piggyBanks:[{id:0,name:"(no piggy bank)",order:0}]}};for(let t in a.data.data)if(a.data.data.hasOwnProperty(t)){let e=a.data.data[t],c=e.attributes.object_group_id??"0",i=e.attributes.object_group_title??"(no group)",u={id:e.id,name:e.attributes.name,order:e.attributes.order};o.hasOwnProperty(c)||(o[c]={id:c,name:i,order:e.attributes.object_group_order??0,piggyBanks:[]}),o[c].piggyBanks.push(u),o[c].piggyBanks.sort((d,s)=>d.order-s.order)}return Object.keys(o).sort().reduce((t,e)=>(t[e]=o[e],t),{})})}function j(){let r={page:1,limit:1337};return new f().list(r).then(a=>{let o={0:{id:0,name:"(no group)",order:0,subscriptions:[{id:0,name:"(no subscription)",order:0}]}};for(let t in a.data.data)if(a.data.data.hasOwnProperty(t)){let e=a.data.data[t],c=e.attributes.object_group_id??"0",i=e.attributes.object_group_title??"(no group)",u={id:e.id,name:e.attributes.name,order:e.attributes.order};o.hasOwnProperty(c)||(o[c]={id:c,name:i,order:e.attributes.object_group_order??0,subscriptions:[]}),o[c].subscriptions.push(u),o[c].subscriptions.sort((d,s)=>d.order-s.order)}return Object.keys(o).sort().reduce((t,e)=>(t[e]=o[e],t),{})})}function A(){return{description:"/api/v2/autocomplete/transaction-descriptions",account:"/api/v2/autocomplete/accounts",category:"/api/v2/autocomplete/categories",tag:"/api/v2/autocomplete/tags"}}function P(r){const n={server:r.serverUrl,serverParams:{},fetchOptions:{headers:{"X-CSRF-TOKEN":document.head.querySelector('meta[name="csrf-token"]').content}},hiddenInput:!0,highlightTyped:!0,liveServer:!0};typeof r.filters<"u"&&r.filters.length>0&&(n.serverParams.types=r.filters),typeof r.onRenderItem<"u"&&r.onRenderItem!==null&&(n.onRenderItem=r.onRenderItem),r.valueField&&(n.valueField=r.valueField),r.labelField&&(n.labelField=r.labelField),r.onSelectItem&&(n.onSelectItem=r.onSelectItem),r.onChange&&(n.onChange=r.onChange),r.hiddenValue&&(n.hiddenValue=r.hiddenValue),m.init(r.selector,n)}function q(r,n){const a=parseInt(n._searchInput.attributes["data-index"].value);if(typeof r<"u"&&r.name){document.querySelector("#form")._x_dataStack[0].$data.entries[a].category_name=r.name;return}document.querySelector("#form")._x_dataStack[0].$data.entries[a].category_name=n._searchInput.value}function E(r,n){const a=parseInt(n._searchInput.attributes["data-index"].value);if(typeof r<"u"&&r.description){document.querySelector("#form")._x_dataStack[0].$data.entries[a].description=r.description;return}document.querySelector("#form")._x_dataStack[0].$data.entries[a].description=n._searchInput.value}function B(r,n){if(typeof r>"u"){const a=parseInt(n._searchInput.attributes["data-index"].value);if(document.querySelector("#form")._x_dataStack[0].$data.entries[a].destination_account.name===n._searchInput.value){console.warn('Ignore hallucinated destination account name change to "'+n._searchInput.value+'"');return}document.querySelector("#form")._x_dataStack[0].$data.entries[a].destination_account={name:n._searchInput.value,alpine_name:n._searchInput.value},document.querySelector("#form")._x_dataStack[0].changedDestinationAccount()}}function F(r,n){const a=parseInt(n._searchInput.attributes["data-index"].value);document.querySelector("#form")._x_dataStack[0].$data.entries[a].destination_account={id:r.id,name:r.name,alpine_name:r.name,type:r.type,currency_code:r.currency_code},document.querySelector("#form")._x_dataStack[0].changedDestinationAccount()}function G(r,n){if(typeof r>"u"){const a=parseInt(n._searchInput.attributes["data-index"].value);if(document.querySelector("#form")._x_dataStack[0].$data.entries[a].source_account.name===n._searchInput.value)return;document.querySelector("#form")._x_dataStack[0].$data.entries[a].source_account={name:n._searchInput.value,alpine_name:n._searchInput.value},document.querySelector("#form")._x_dataStack[0].changedSourceAccount()}}function R(r,n){const a=parseInt(n._searchInput.attributes["data-index"].value);document.querySelector("#form")._x_dataStack[0].$data.entries[a].source_account={id:r.id,name:r.name,alpine_name:r.name,type:r.type,currency_code:r.currency_code},document.querySelector("#form")._x_dataStack[0].changedSourceAccount()}class h{post(n,a,o){let t="/api/v1/attachments";return l.post(t,{filename:n,attachable_type:a,attachable_id:o})}upload(n,a){let o="./api/v1/attachments/"+n+"/upload";return axios.post(o,a)}}let b=function(r){let n=r.length,a=0,o=!1;for(const t in r)if(r.hasOwnProperty(t)&&/^0$|^[1-9]\d*$/.test(t)&&t<=4294967294&&o===!1){let e=new h;e.post(r[t].name,"TransactionJournal",r[t].journal).then(c=>{let i=parseInt(c.data.data.id);e.upload(i,r[t].content).then(u=>{if(a++,a===n){const d=new CustomEvent("upload-success",{some:"details"});document.dispatchEvent(d)}}).catch(u=>{console.error("Could not upload"),console.error(u),a++;const d=new CustomEvent("upload-failed",{error:u});document.dispatchEvent(d),o=!0})}).catch(c=>{console.error("Could not create upload."),console.error(c),a++;const i=new CustomEvent("upload-failed",{error:c});document.dispatchEvent(i),o=!0})}};function T(r,n){n=n.reverse();let a=[],o=0,t=[],e=document.querySelectorAll('input[name="attachments[]"]');for(const c in e)if(e.hasOwnProperty(c)&&/^0$|^[1-9]\d*$/.test(c)&&c<=4294967294)for(const i in e[c].files)e[c].files.hasOwnProperty(i)&&/^0$|^[1-9]\d*$/.test(i)&&i<=4294967294&&(a.push({journal:n[c].transaction_journal_id,file:e[c].files[i]}),o++);for(const c in a)a.hasOwnProperty(c)&&/^0$|^[1-9]\d*$/.test(c)&&c<=4294967294&&function(i,u){let d=new FileReader;d.onloadend=function(s){s.target.readyState===FileReader.DONE&&(t.push({name:a[u].file.name,journal:a[u].journal,content:new Blob([s.target.result])}),t.length===o&&b(t))},d.readAsArrayBuffer(i.file)}(a[c],c);return o}function v(r,n,a){let o=[];for(let t in a)a.hasOwnProperty(t)&&o.push(a[t].replace(r,n));return o}function D(r,n){let a,o,t;for(const e in r)if(r.hasOwnProperty(e)){if(e==="group_title"){console.error("Cannot handle error in group title.");continue}if(a=parseInt(e.split(".")[1]),o=e.split(".")[2],t=v(e,o,r[e]),!n.hasOwnProperty(a)){console.error("Cannot handle errors in index #"+a);continue}switch(o){case"currency_code":case"foreign_currency_code":case"category_name":case"piggy_bank_id":case"notes":case"internal_reference":case"external_url":case"latitude":case"longitude":case"zoom_level":case"interest_date":case"book_date":case"process_date":case"due_date":case"payment_date":case"invoice_date":case"amount":case"date":case"budget_id":case"bill_id":case"description":case"tags":n[a].errors[o]=t;break;case"source_name":case"source_id":n[a].errors.source_account=n[a].errors.source_account.concat(t);break;case"type":n[a].errors.source_account=n[a].errors.source_account.concat([_.t("validation.bad_type_source")]),n[a].errors.destination_account=n[a].errors.destination_account.concat([_.t("validation.bad_type_destination")]);break;case"destination_name":case"destination_id":n[a].errors.destination_account=n[a].errors.destination_account.concat(t);break;case"foreign_amount":case"foreign_currency_id":n[a].errors.foreign_amount=n[a].errors.foreign_amount.concat(t);break}typeof n[a]<"u"&&(n[a].errors.source_account=Array.from(new Set(n[a].errors.source_account)),n[a].errors.destination_account=Array.from(new Set(n[a].errors.destination_account)))}return console.log(n[0].errors),n}export{$ as a,O as b,j as c,T as d,P as e,G as f,R as g,B as h,F as i,A as j,q as k,C as l,E as m,x as p,D as s}; diff --git a/public/build/manifest.json b/public/build/manifest.json index f615bb2f35..05f1630db3 100644 --- a/public/build/manifest.json +++ b/public/build/manifest.json @@ -1,13 +1,4 @@ { - "_autocomplete-functions-ac0d2cb1.js": { - "file": "assets/autocomplete-functions-ac0d2cb1.js", - "imports": [ - "_format-money-e259f5e4.js", - "_get-da167d5b.js", - "_vendor-fca45885.js" - ], - "integrity": "sha384-ylbI7yXfy5qc0QwMwNSdc4QMHKM1eXXR6R2zLxLUSccW3OCkFCc5pEm1ZpCDbdXh" - }, "_create-empty-split-fb5bda92.js": { "file": "assets/create-empty-split-fb5bda92.js", "imports": [ @@ -15,26 +6,26 @@ ], "integrity": "sha384-hhKUcZf3xSLJgwkzufZGpLjOUeD5gulL71KQu72SoGIUVLPU3EIBT+ICT/znc01b" }, - "_format-money-e259f5e4.js": { - "file": "assets/format-money-e259f5e4.js", + "_format-money-43e05102.js": { + "file": "assets/format-money-43e05102.js", "imports": [ "_vendor-fca45885.js" ], - "integrity": "sha384-zfi6/58+Nb5L5Ryx5WARPOstXPNq+qioNeeQB0XP4V9ZAPg4Bi9bdC3+fVmNsE/M" + "integrity": "sha384-/lP2o0Yj4DAtc93ChQvqF5ctDGjH6jakuIZcEQBICvDn/YtSDaPr7PzrZd4w53jV" }, - "_get-3bb14de5.js": { - "file": "assets/get-3bb14de5.js", + "_get-94678769.js": { + "file": "assets/get-94678769.js", "imports": [ - "_format-money-e259f5e4.js" + "_format-money-43e05102.js" ], - "integrity": "sha384-ZgD+gbjUNu1QpP5ZH5WE8+bJmZsLQOx73UT9vPxPRzBwxtGignJ2BC8h9WYdJxU3" + "integrity": "sha384-/nzI9V1buTN8n1p1uL9UOxOasx6+q6kTpiwDCaZZHBCVrrnFqWSCQCHAPQFcqYGB" }, - "_get-da167d5b.js": { - "file": "assets/get-da167d5b.js", + "_get-a29f6df7.js": { + "file": "assets/get-a29f6df7.js", "imports": [ - "_format-money-e259f5e4.js" + "_format-money-43e05102.js" ], - "integrity": "sha384-ADxhKsFImio/UdUojkpvUHQ9lKqGcHbhsvCj5TEYLNuefhUlz0RIyWX/0/cFcasS" + "integrity": "sha384-QRZtv6rXwaf1k9JOU1p1T42Nn2t5En83j/8rbh00dJ+1sSoNLD0maS8FkPKVRbpE" }, "_parse-downloaded-splits-4afea167.js": { "file": "assets/parse-downloaded-splits-4afea167.js", @@ -44,6 +35,15 @@ ], "integrity": "sha384-rTgD6HzwbdSD/qoN3b4vipowqanriBYLYnORI3F23R+uFbr1kyZIE1AHYA9oe2qO" }, + "_splice-errors-into-transactions-9c9b99c0.js": { + "file": "assets/splice-errors-into-transactions-9c9b99c0.js", + "imports": [ + "_format-money-43e05102.js", + "_get-94678769.js", + "_vendor-fca45885.js" + ], + "integrity": "sha384-6QHZSbNE9w8hPmdvtcEi1wqimo8+lyJWXBaYaX7/c8qoveRKX5A2WZVhqb7bMRkV" + }, "_vendor-fca45885.js": { "assets": [ "assets/layers-1dbbe9d0.png", @@ -102,57 +102,68 @@ "integrity": "sha384-wg83fCOXjBtqzFAWhTL9Sd9vmLUNhfEEzfmNUX9zwv2igKlz/YQbdapF4ObdxF+R" }, "resources/assets/v2/pages/dashboard/dashboard.js": { - "file": "assets/dashboard-d274a3dc.js", + "file": "assets/dashboard-2ad8d866.js", "imports": [ - "_format-money-e259f5e4.js", + "_format-money-43e05102.js", "_vendor-fca45885.js", - "_get-3bb14de5.js", - "_get-da167d5b.js" + "_get-a29f6df7.js", + "_get-94678769.js" ], "isEntry": true, "src": "resources/assets/v2/pages/dashboard/dashboard.js", - "integrity": "sha384-yhbUCvDl5ePrqXSXJu1jJ6eGLWzC137n7Ee3gHZDaO9kOKqtajG3KbILBpYlM5u9" + "integrity": "sha384-drEV1+zgjVGIfpdo1BovDls72a22l303XFZq/n0BE9VMTuydOYDBBgEqjM1GgwQD" }, "resources/assets/v2/pages/transactions/create.js": { - "file": "assets/create-9af1982c.js", + "file": "assets/create-46b63de1.js", "imports": [ - "_format-money-e259f5e4.js", + "_format-money-43e05102.js", "_create-empty-split-fb5bda92.js", - "_autocomplete-functions-ac0d2cb1.js", + "_splice-errors-into-transactions-9c9b99c0.js", "_vendor-fca45885.js", - "_get-da167d5b.js" + "_get-94678769.js" ], "isEntry": true, "src": "resources/assets/v2/pages/transactions/create.js", - "integrity": "sha384-f1FX2idAuYuItQyu41hCRa1AtE+65Pqky4Dwn2+u+5Vmsm2gw1uoZp2sODAfpiS5" + "integrity": "sha384-qacGHBXX2jXhiYdstJdUk5SBbdF1y8uj9RTdWetpmATLMNSjetRemPMk4PJoGxgZ" }, "resources/assets/v2/pages/transactions/edit.js": { - "file": "assets/edit-4a0660ed.js", + "file": "assets/edit-b45ed381.js", "imports": [ - "_format-money-e259f5e4.js", - "_get-3bb14de5.js", + "_format-money-43e05102.js", + "_get-a29f6df7.js", "_parse-downloaded-splits-4afea167.js", - "_autocomplete-functions-ac0d2cb1.js", + "_splice-errors-into-transactions-9c9b99c0.js", "_vendor-fca45885.js", "_create-empty-split-fb5bda92.js", - "_get-da167d5b.js" + "_get-94678769.js" ], "isEntry": true, "src": "resources/assets/v2/pages/transactions/edit.js", - "integrity": "sha384-RPpIOYVoXcKosf6gEb0H1RpeEVWHSfPfr8/wwG1X2dJQ/AA1qBCIdisog0bryCgS" + "integrity": "sha384-CoTAYJsk4/69IMBbgV50+i5mK+pANKXl0hLH9nqErgit1WDdBK6U4VimDsq5fvMf" + }, + "resources/assets/v2/pages/transactions/index.js": { + "file": "assets/index-8df22335.js", + "imports": [ + "_format-money-43e05102.js", + "_vendor-fca45885.js", + "_get-a29f6df7.js" + ], + "isEntry": true, + "src": "resources/assets/v2/pages/transactions/index.js", + "integrity": "sha384-UcghdFUsV8Bp01abyYn4u6sI/mWjXuY677vyQ76p1gVaMl9pVMGjdPa8Cd9Lg6M5" }, "resources/assets/v2/pages/transactions/show.js": { - "file": "assets/show-9f0eb3b4.js", + "file": "assets/show-61e79d17.js", "imports": [ - "_format-money-e259f5e4.js", + "_format-money-43e05102.js", "_vendor-fca45885.js", - "_get-3bb14de5.js", + "_get-a29f6df7.js", "_parse-downloaded-splits-4afea167.js", "_create-empty-split-fb5bda92.js" ], "isEntry": true, "src": "resources/assets/v2/pages/transactions/show.js", - "integrity": "sha384-MFgnhVMItZ2xoPPjfYAj+0uYCqL31JMZSdS9or8muf/YECi7R6Cz0CmJB+kPrehe" + "integrity": "sha384-JBLT+bepNQ1x9TTUWy1H/ekjto18Jzudb4suKq+rF1YvqeSpouHzJU2l1YeObQ7y" }, "resources/assets/v2/sass/app.scss": { "file": "assets/app-fb7b26ec.css", diff --git a/public/v2/i18n/en_US.json b/public/v2/i18n/en.json similarity index 100% rename from public/v2/i18n/en_US.json rename to public/v2/i18n/en.json diff --git a/resources/assets/v2/pages/transactions/index.js b/resources/assets/v2/pages/transactions/index.js new file mode 100644 index 0000000000..cd3d99f8ea --- /dev/null +++ b/resources/assets/v2/pages/transactions/index.js @@ -0,0 +1,148 @@ +/* + * show.js + * Copyright (c) 2024 james@firefly-iii.org. + * + * This file is part of Firefly III (https://github.com/firefly-iii). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import '../../boot/bootstrap.js'; +import dates from "../shared/dates.js"; +import i18next from "i18next"; +import {format} from "date-fns"; +import formatMoney from "../../util/format-money.js"; +import Get from "../../api/v2/model/transaction/get.js"; + + +let index = function () { + return { + // notifications + notifications: { + error: { + show: false, text: '', url: '', + }, success: { + show: false, text: '', url: '', + }, wait: { + show: false, text: '', + + } + }, + transactions: [], + totalPages: 1, + perPage: 50, + page: 1, + // available columns: + tableColumns: { + description: { + enabled: true + }, + source: { + enabled: true + }, + destination: { + enabled: true + }, + amount: { + enabled: true + }, + }, + + formatMoney(amount, currencyCode) { + return formatMoney(amount, currencyCode); + }, + format(date) { + return format(date, i18next.t('config.date_time_fns')); + }, + init() { + this.notifications.wait.show = true; + this.notifications.wait.text = i18next.t('firefly.wait_loading_data') + // TODO need date range. + // TODO handle page number + this.getTransactions(this.page); + }, + getTransactions(page) { + let getter = new Get(); + + getter.list({page: page}).then(response => { + this.parseTransactions(response.data.data) + + // set meta data + this.totalPages = response.data.meta.pagination.total_pages; + this.perPage = response.data.meta.pagination.per_page; + this.page = response.data.meta.pagination.current_page; + }).catch(error => { + // todo this is auto generated + this.notifications.wait.show = false; + this.notifications.error.show = true; + this.notifications.error.text = error.response.data.message; + }); + }, + parseTransactions(data) { + // no parse, just save + for (let i in data) { + if (data.hasOwnProperty(i)) { + let current = data[i]; + let isSplit = current.attributes.transactions.length > 1; + let firstSplit = true; + + // foreach on transactions, no matter how many. + for (let ii in current.attributes.transactions) { + if (current.attributes.transactions.hasOwnProperty(ii)) { + let transaction = current.attributes.transactions[ii]; + transaction.split = isSplit; + transaction.firstSplit = firstSplit; + transaction.group_title = current.attributes.group_title; + transaction.id = current.id; + transaction.created_at = current.attributes.created_at; + transaction.updated_at = current.attributes.updated_at; + transaction.user = current.attributes.user; + transaction.user_group = current.attributes.user_group; + + // set firstSplit = false for next run if applicable. + firstSplit = false; + console.log(transaction); + this.transactions.push(transaction); + } + } + } + } + // only now, disable wait thing. + this.notifications.wait.show = false; + + }, + } +} + +let comps = {index, dates}; + +function loadPage() { + Object.keys(comps).forEach(comp => { + console.log(`Loading page component "${comp}"`); + let data = comps[comp](); + Alpine.data(comp, () => data); + }); + Alpine.start(); +} + +// wait for load until bootstrapped event is received. +document.addEventListener('firefly-iii-bootstrapped', () => { + console.log('Loaded through event listener.'); + loadPage(); +}); +// or is bootstrapped before event is triggered. +if (window.bootstrapped) { + console.log('Loaded through window variable.'); + loadPage(); +} diff --git a/resources/assets/v2/support/load-translations.js b/resources/assets/v2/support/load-translations.js index e493801c44..6e7a372745 100644 --- a/resources/assets/v2/support/load-translations.js +++ b/resources/assets/v2/support/load-translations.js @@ -24,33 +24,30 @@ import ChainedBackend from "i18next-chained-backend"; import HttpBackend from "i18next-http-backend"; import LocalStorageBackend from "i18next-localstorage-backend"; - - - let loaded = false; function loadTranslations(locale) { if (false === loaded) { const replacedLocale = locale.replace('-', '_'); loaded = true; - console.log(import.meta.env.MODE); const expireTime = import.meta.env.MODE === 'development' ? 1 : 7 * 24 * 60 * 60 * 1000; + console.log('Will load language "'+replacedLocale+'"'); return i18next .use(ChainedBackend) .init({ - fallbackLng: "en_US", + load: 'languageOnly', + fallbackLng: "en", lng: replacedLocale, debug: import.meta.env.MODE === 'development', - // ... your i18next config backend: { backends: [ LocalStorageBackend, HttpBackend ], backendOptions: [{ + load: 'languageOnly', expirationTime: expireTime }, { - // const response = await fetch(`./v2/i18n/${locale}.json`); loadPath: './v2/i18n/{{lng}}.json' }] } diff --git a/resources/views/v2/transactions/index.blade.php b/resources/views/v2/transactions/index.blade.php new file mode 100644 index 0000000000..60311cac87 --- /dev/null +++ b/resources/views/v2/transactions/index.blade.php @@ -0,0 +1,167 @@ +@extends('layout.v2') +@section('vite') + @vite(['resources/assets/v2/sass/app.scss', 'resources/assets/v2/pages/transactions/index.js']) +@endsection +@section('content') +
+
+ +
+
+
+
+

Info

+
+
+ some chart +
+
+
+
+
+
+

Info

+
+
+ Same +
+
+
+
+
+
+

Info

+
+
+ Same +
+
+
+
+
+
+ Nav +
+
+
+
+
+
+

Info

+
+
+ + + + + + + + + + + + + +
+ Icon +
+
+
+
+ +
+
+
+

Sidebar

+
+
+ I like sidebar +
+
+
+
+
+
+ Nav +
+
+
+
+ +@endsection diff --git a/resources/views/v2/transactions/show.blade.php b/resources/views/v2/transactions/show.blade.php index 6c3f8f7531..8f81a197a5 100644 --- a/resources/views/v2/transactions/show.blade.php +++ b/resources/views/v2/transactions/show.blade.php @@ -224,7 +224,7 @@ recurring things - meta + TODO meta