-
Notifications
You must be signed in to change notification settings - Fork 574
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] awesome_dashboard: Chapt2-9. make dashboard generic + some fixes
- Loading branch information
1 parent
64f2257
commit d7b3c03
Showing
20 changed files
with
140 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
{ | ||
'name': "Awesome Dashboard", | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/** @odoo-module */ | ||
|
||
import { NumberCard } from "./number_card/number_card"; | ||
import { PieChartCard } from "./pie_chart_card/pie_chart_card"; | ||
|
||
export const items = [ | ||
{ | ||
id: "average_quantity", | ||
description: "Average amount of t-shirt", | ||
Component: NumberCard, | ||
props: (data) => ({ | ||
title: "Average amount of t-shirt by order this month", | ||
value: data.average_quantity, | ||
}) | ||
}, | ||
{ | ||
id: "average_time", | ||
description: "Average time for an order", | ||
Component: NumberCard, | ||
props: (data) => ({ | ||
title: "Average time for an order to go from 'new' to 'sent' or 'cancelled'", | ||
value: data.average_time, | ||
}) | ||
}, | ||
{ | ||
id: "number_new_orders", | ||
description: "New orders this month", | ||
Component: NumberCard, | ||
props: (data) => ({ | ||
title: "Number of new orders this month", | ||
value: data.nb_new_orders, | ||
}) | ||
}, | ||
{ | ||
id: "cancelled_orders", | ||
description: "Cancelled orders this month", | ||
Component: NumberCard, | ||
props: (data) => ({ | ||
title: "Number of cancelled orders this month", | ||
value: data.nb_cancelled_orders, | ||
}) | ||
}, | ||
{ | ||
id: "amount_new_orders", | ||
description: "amount orders this month", | ||
Component: NumberCard, | ||
props: (data) => ({ | ||
title: "Total amount of new orders this month", | ||
value: data.total_amount, | ||
}) | ||
}, | ||
{ | ||
id: "pie_chart", | ||
description: "Shirt orders by size", | ||
Component: PieChartCard, | ||
size: 2, | ||
props: (data) => ({ | ||
title: "Shirt orders by size", | ||
values: data.orders_by_size, | ||
}) | ||
} | ||
] |
15 changes: 15 additions & 0 deletions
15
awesome_dashboard/static/src/dashboard/number_card/number_card.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** @odoo-module */ | ||
|
||
import { Component } from "@odoo/owl"; | ||
|
||
export class NumberCard extends Component { | ||
static template = "awesome_dashboard.NumberCard"; | ||
static props = { | ||
title: { | ||
type: String, | ||
}, | ||
value: { | ||
type: Number, | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
awesome_dashboard/static/src/dashboard/number_card/number_card.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<templates xml:space="preserve"> | ||
<t t-name="awesome_dashboard.NumberCard" owl="1"> | ||
<t t-esc="props.title"/> | ||
<div class="fs-1 fw-bold text-success text-center"> | ||
<t t-esc="props.value"/> | ||
</div> | ||
</t> | ||
</templates> |
17 changes: 17 additions & 0 deletions
17
awesome_dashboard/static/src/dashboard/pie_chart_card/pie_chart_card.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** @odoo-module */ | ||
|
||
import { Component } from "@odoo/owl"; | ||
import { PieChart } from "../pie_chart/pie_chart"; | ||
|
||
export class PieChartCard extends Component { | ||
static template = "awesome_dashboard.PieChartCard"; | ||
static components = { PieChart } | ||
static props = { | ||
title: { | ||
type: String, | ||
}, | ||
values: { | ||
type: Object, | ||
}, | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
awesome_dashboard/static/src/dashboard/pie_chart_card/pie_chart_card.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<templates xml:space="preserve"> | ||
<t t-name="awesome_dashboard.PieChartCard" owl="1"> | ||
<t t-esc="props.title"/> | ||
<PieChart data="props.values" label="''"/> | ||
</t> | ||
</templates> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters