mirror of
https://github.com/frappe/books.git
synced 2024-12-23 11:29:03 +00:00
fix: Dashboard
- Refresh dashboard charts when visited from another page
This commit is contained in:
parent
3a72dc6d0d
commit
dd4fdb2343
@ -44,8 +44,8 @@
|
||||
<div class="flex w-full text-gray-600">
|
||||
<div
|
||||
class="w-6 h-6 mr-1 last:mr-0 flex-center text-center"
|
||||
v-for="d in ['S', 'M', 'T', 'W', 'T', 'F', 'S']"
|
||||
:key="d"
|
||||
v-for="(d, i) in ['S', 'M', 'T', 'W', 'T', 'F', 'S']"
|
||||
:key="i"
|
||||
>
|
||||
{{ d }}
|
||||
</div>
|
||||
|
@ -109,7 +109,7 @@ export default {
|
||||
watch: {
|
||||
period: 'render'
|
||||
},
|
||||
mounted() {
|
||||
activated() {
|
||||
this.render();
|
||||
},
|
||||
methods: {
|
||||
|
@ -40,10 +40,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="totalExpense === 0"
|
||||
class="absolute inset-0 flex-center"
|
||||
>
|
||||
<div v-if="totalExpense === 0" class="absolute inset-0 flex-center">
|
||||
<span class="text-base text-gray-600">
|
||||
{{ _('No transactions yet') }}
|
||||
</span>
|
||||
@ -70,7 +67,7 @@ export default {
|
||||
period: 'This Year',
|
||||
expenses: [{ account: 'Test', total: 0 }]
|
||||
}),
|
||||
mounted() {
|
||||
activated() {
|
||||
this.render();
|
||||
},
|
||||
watch: {
|
||||
@ -118,7 +115,7 @@ export default {
|
||||
|
||||
this.expenses = topExpenses;
|
||||
|
||||
let chart = new Chart(this.$refs['top-expenses'], {
|
||||
new Chart(this.$refs['top-expenses'], {
|
||||
type: 'donut',
|
||||
hoverRadio: 0.01,
|
||||
strokeWidth: 18,
|
||||
|
@ -32,7 +32,7 @@ export default {
|
||||
SectionHeader
|
||||
},
|
||||
data: () => ({ period: 'This Year', hasData: false }),
|
||||
mounted() {
|
||||
activated() {
|
||||
this.render();
|
||||
},
|
||||
watch: {
|
||||
|
@ -113,13 +113,13 @@ export default {
|
||||
salesInvoicePeriod: 'calculateInvoiceTotals',
|
||||
purchaseInvoicePeriod: 'calculateInvoiceTotals'
|
||||
},
|
||||
mounted() {
|
||||
activated() {
|
||||
this.calculateInvoiceTotals();
|
||||
},
|
||||
methods: {
|
||||
async calculateInvoiceTotals() {
|
||||
let promises = this.invoices.map(async d => {
|
||||
let { fromDate, toDate, periodicity } = await getDatesAndPeriodicity(
|
||||
let { fromDate, toDate } = await getDatesAndPeriodicity(
|
||||
this.$data[d.periodKey]
|
||||
);
|
||||
|
||||
@ -127,6 +127,7 @@ export default {
|
||||
.knex(d.doctype)
|
||||
.sum({ total: 'baseGrandTotal' })
|
||||
.sum({ outstanding: 'outstandingAmount' })
|
||||
.where('submitted', 1)
|
||||
.whereBetween('date', [fromDate, toDate])
|
||||
.first();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user