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="flex w-full text-gray-600">
|
||||||
<div
|
<div
|
||||||
class="w-6 h-6 mr-1 last:mr-0 flex-center text-center"
|
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']"
|
v-for="(d, i) in ['S', 'M', 'T', 'W', 'T', 'F', 'S']"
|
||||||
:key="d"
|
:key="i"
|
||||||
>
|
>
|
||||||
{{ d }}
|
{{ d }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -109,7 +109,7 @@ export default {
|
|||||||
watch: {
|
watch: {
|
||||||
period: 'render'
|
period: 'render'
|
||||||
},
|
},
|
||||||
mounted() {
|
activated() {
|
||||||
this.render();
|
this.render();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -40,10 +40,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div v-if="totalExpense === 0" class="absolute inset-0 flex-center">
|
||||||
v-if="totalExpense === 0"
|
|
||||||
class="absolute inset-0 flex-center"
|
|
||||||
>
|
|
||||||
<span class="text-base text-gray-600">
|
<span class="text-base text-gray-600">
|
||||||
{{ _('No transactions yet') }}
|
{{ _('No transactions yet') }}
|
||||||
</span>
|
</span>
|
||||||
@ -70,7 +67,7 @@ export default {
|
|||||||
period: 'This Year',
|
period: 'This Year',
|
||||||
expenses: [{ account: 'Test', total: 0 }]
|
expenses: [{ account: 'Test', total: 0 }]
|
||||||
}),
|
}),
|
||||||
mounted() {
|
activated() {
|
||||||
this.render();
|
this.render();
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -118,7 +115,7 @@ export default {
|
|||||||
|
|
||||||
this.expenses = topExpenses;
|
this.expenses = topExpenses;
|
||||||
|
|
||||||
let chart = new Chart(this.$refs['top-expenses'], {
|
new Chart(this.$refs['top-expenses'], {
|
||||||
type: 'donut',
|
type: 'donut',
|
||||||
hoverRadio: 0.01,
|
hoverRadio: 0.01,
|
||||||
strokeWidth: 18,
|
strokeWidth: 18,
|
||||||
|
@ -32,7 +32,7 @@ export default {
|
|||||||
SectionHeader
|
SectionHeader
|
||||||
},
|
},
|
||||||
data: () => ({ period: 'This Year', hasData: false }),
|
data: () => ({ period: 'This Year', hasData: false }),
|
||||||
mounted() {
|
activated() {
|
||||||
this.render();
|
this.render();
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -113,13 +113,13 @@ export default {
|
|||||||
salesInvoicePeriod: 'calculateInvoiceTotals',
|
salesInvoicePeriod: 'calculateInvoiceTotals',
|
||||||
purchaseInvoicePeriod: 'calculateInvoiceTotals'
|
purchaseInvoicePeriod: 'calculateInvoiceTotals'
|
||||||
},
|
},
|
||||||
mounted() {
|
activated() {
|
||||||
this.calculateInvoiceTotals();
|
this.calculateInvoiceTotals();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async calculateInvoiceTotals() {
|
async calculateInvoiceTotals() {
|
||||||
let promises = this.invoices.map(async d => {
|
let promises = this.invoices.map(async d => {
|
||||||
let { fromDate, toDate, periodicity } = await getDatesAndPeriodicity(
|
let { fromDate, toDate } = await getDatesAndPeriodicity(
|
||||||
this.$data[d.periodKey]
|
this.$data[d.periodKey]
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -127,6 +127,7 @@ export default {
|
|||||||
.knex(d.doctype)
|
.knex(d.doctype)
|
||||||
.sum({ total: 'baseGrandTotal' })
|
.sum({ total: 'baseGrandTotal' })
|
||||||
.sum({ outstanding: 'outstandingAmount' })
|
.sum({ outstanding: 'outstandingAmount' })
|
||||||
|
.where('submitted', 1)
|
||||||
.whereBetween('date', [fromDate, toDate])
|
.whereBetween('date', [fromDate, toDate])
|
||||||
.first();
|
.first();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user