mirror of
https://github.com/SARL-PACIFIC-ERP/odoo-sh-test.git
synced 2025-06-25 09:32:22 +00:00
ch2.3 Add a dashboard item
This commit is contained in:
parent
ef7fb887b7
commit
c0f193b52c
|
@ -4,10 +4,11 @@ import { Component } from "@odoo/owl";
|
||||||
import { registry } from "@web/core/registry";
|
import { registry } from "@web/core/registry";
|
||||||
import { Layout } from "@web/search/layout";
|
import { Layout } from "@web/search/layout";
|
||||||
import { useService } from "@web/core/utils/hooks"
|
import { useService } from "@web/core/utils/hooks"
|
||||||
|
import { DashboardItem } from "./dashboard_item";
|
||||||
|
|
||||||
class AwesomeDashboard extends Component {
|
class AwesomeDashboard extends Component {
|
||||||
static template = "awesome_dashboard.AwesomeDashboard";
|
static template = "awesome_dashboard.AwesomeDashboard";
|
||||||
static components = { Layout };
|
static components = { Layout, DashboardItem };
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
this.display = {
|
this.display = {
|
||||||
|
|
|
@ -7,6 +7,11 @@
|
||||||
<button class="btn btn-primary" t-on-click="openCustomers">Customers</button>
|
<button class="btn btn-primary" t-on-click="openCustomers">Customers</button>
|
||||||
<button class="btn btn-primary" t-on-click="openLeads">Leads</button>
|
<button class="btn btn-primary" t-on-click="openLeads">Leads</button>
|
||||||
</t>
|
</t>
|
||||||
|
<div class="d-flex flex-wrap">
|
||||||
|
<DashboardItem />
|
||||||
|
<DashboardItem size="2">That's a bigger one</DashboardItem>
|
||||||
|
<DashboardItem/>
|
||||||
|
</div>
|
||||||
</Layout>
|
</Layout>
|
||||||
</t>
|
</t>
|
||||||
|
|
||||||
|
|
20
awesome_dashboard/static/src/dashboard_item.js
Normal file
20
awesome_dashboard/static/src/dashboard_item.js
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
/** @odoo-module **/
|
||||||
|
|
||||||
|
import { Component } from "@odoo/owl";
|
||||||
|
|
||||||
|
export class DashboardItem extends Component {
|
||||||
|
static template = "awesome_dashboard.DashboardItem";
|
||||||
|
static props = {
|
||||||
|
size: {
|
||||||
|
type: Number,
|
||||||
|
default: 1,
|
||||||
|
optional: true,
|
||||||
|
},
|
||||||
|
slots: {
|
||||||
|
type: Object,
|
||||||
|
shape: {
|
||||||
|
default: Object
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
14
awesome_dashboard/static/src/dashboard_item.xml
Normal file
14
awesome_dashboard/static/src/dashboard_item.xml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<templates xml:space="preserve">
|
||||||
|
|
||||||
|
<t t-name="awesome_dashboard.DashboardItem">
|
||||||
|
<section>
|
||||||
|
<div class="card d-inline-block m-2" t-attf-style="width:{{18*props.size}}rem;">
|
||||||
|
<div class="card-body">
|
||||||
|
<t t-slot="default">some content</t>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</t>
|
||||||
|
|
||||||
|
</templates>
|
Loading…
Reference in a new issue