My page “Dashboard” is a summary that shows for each contract if there is a unpaid balance (and the amount of the unpaid balance).
My page “Contract” has an area in which the user puts the amount of rent received for each month. The unpaid balance on the page “Contract” is updated when a button is clicked or when the page “Contract” is loaded.
The issue is that if a user logs in and goes to the Dashboard page, the unpaid balance reflected may not be correct.
For example if the user logs in on the 5th of the month and the rent was due on the 1st of the month for a specific contract. Since we have not been on the page “Contract” yet, the unpaid balance of that contract will not be updated
Is there a way that when the page “Dashboard” is loaded, all the “Contract” pages would also load (in the background of course, not showing on the screen) so that all the unpaid balances are updated?
It is not about loading pages, but about loading the data…where does the data for the contracts come from and where in the app are they stored for display on the page contract and are they at all, connected (so on the same page) as the dashboard or are you using separate pages and not a single page app design.
Yes, the Dashboard page and the Contract Page are 2 different pages.
Here is an example. You create a contract (on Contract page) today. You thus create a new data Contract that has various information. It is saved in the database.
Contract tenant John:
start date: April 23, 2024
end date: April 23, 2025
rent amount: USD 500
On the contract page, there is an area where you can input the rent amount that has been received for each month. Then you click a button save and the field “unpaid balance” is created. It is simply the sum of all (rent amount - rent received).
Let’s say that today, 23 April 2024, the tenant paid the rent so the unpaid balance today is 0.
The issue is that, when you will log in to the app and land on the Dashboard page one month from now (24 May, 2024), you will still see that the unpaid balance is 0.
But it should not be the case because there is also the new rent that is due and we have not said yet that it has been paid on that specific contract page. The unpaid balance should be 500. So the information on the Dashboard page will be wrong until we go one by one in each contract to update the unpaid balance.
You can use a recurring backend workflow. These are able to be scheduled to run on a regular basis at set intervals, in your case every month, and when you first trigger them, you set the date at which they are supposed to run on the interval. In the actions on this you will add the rent amount to the unpaid balance amount, so in the event the renter doesn’t pay in full in month 2 then in month 3 they will see the rent for month 3 plus what was still due from month 2.
You can also use regular backend workflows to send email reminders to the renter if their unpaid balance is greater than zero some pre-determined amount of time after the rent was due.