mirror of
https://github.com/SARL-PACIFIC-ERP/odoo-sh-test.git
synced 2025-06-25 01:32:20 +00:00
ch2.4 Call the server, add some statistics
This commit is contained in:
parent
c0f193b52c
commit
7d74834fb7
|
@ -1,6 +1,6 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import { Component } from "@odoo/owl";
|
||||
import { Component, onWillStart } from "@odoo/owl";
|
||||
import { registry } from "@web/core/registry";
|
||||
import { Layout } from "@web/search/layout";
|
||||
import { useService } from "@web/core/utils/hooks"
|
||||
|
@ -16,6 +16,11 @@ class AwesomeDashboard extends Component {
|
|||
};
|
||||
|
||||
this.action = useService("action");
|
||||
|
||||
this.rpc = useService('rpc');
|
||||
onWillStart(async () => {
|
||||
this.stats = await this.rpc("/awesome_dashboard/statistics");
|
||||
});
|
||||
}
|
||||
|
||||
openCustomers() {
|
||||
|
|
|
@ -2,15 +2,55 @@
|
|||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="awesome_dashboard.AwesomeDashboard">
|
||||
|
||||
|
||||
|
||||
|
||||
Total amount of new orders this month
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<Layout display="display" className="'o_dashboard h-100'">
|
||||
<t t-set-slot="layout-buttons">
|
||||
<button class="btn btn-primary" t-on-click="openCustomers">Customers</button>
|
||||
<button class="btn btn-primary" t-on-click="openLeads">Leads</button>
|
||||
</t>
|
||||
<div class="d-flex flex-wrap">
|
||||
<DashboardItem />
|
||||
<DashboardItem size="2">That's a bigger one</DashboardItem>
|
||||
<DashboardItem/>
|
||||
<DashboardItem>
|
||||
Number of new orders this month
|
||||
<div class="fs-1 fw-bold text-success text-center">
|
||||
<t t-out="stats.nb_new_orders"/>
|
||||
</div>
|
||||
</DashboardItem>
|
||||
<DashboardItem>
|
||||
Total amount of new orders this month
|
||||
<div class="fs-1 fw-bold text-success text-center">
|
||||
<t t-out="stats.total_amount"/>
|
||||
</div>
|
||||
</DashboardItem>
|
||||
<DashboardItem>
|
||||
Average amount of t-shirt by order this month
|
||||
<div class="fs-1 fw-bold text-success text-center">
|
||||
<t t-out="stats.average_quantity"/>
|
||||
</div>
|
||||
</DashboardItem>
|
||||
<DashboardItem>
|
||||
Number of cancelled orders this month
|
||||
<div class="fs-1 fw-bold text-success text-center">
|
||||
<t t-out="stats.nb_cancelled_orders"/>
|
||||
</div>
|
||||
</DashboardItem>
|
||||
<DashboardItem>
|
||||
Average time for an order to go from ‘new’ to ‘sent’ or ‘cancelled’
|
||||
<div class="fs-1 fw-bold text-success text-center">
|
||||
<t t-out="stats.average_time"/>
|
||||
</div>
|
||||
</DashboardItem>
|
||||
</div>
|
||||
</Layout>
|
||||
</t>
|
||||
|
|
Loading…
Reference in a new issue