File tree Expand file tree Collapse file tree 4 files changed +63
-0
lines changed
awesome_dashboard/static/src/dashboard Expand file tree Collapse file tree 4 files changed +63
-0
lines changed Original file line number Diff line number Diff line change 1+ import { Component } from "@odoo/owl" ;
2+ import { CheckBox } from "@web/core/checkbox/checkbox" ;
3+ import { Dialog } from "@web/core/dialog/dialog" ;
4+ import { registry } from "@web/core/registry" ;
5+ import dashboard_items from "../dashboard_items" ;
6+
7+ export class ConfigurationDialog extends Component {
8+ static template = "awesome_dashboard.ConfigurationDialog" ;
9+ static components = { CheckBox, Dialog } ;
10+ static props = { close } ;
11+
12+ setup ( ) {
13+ this . items = registry . category ( "awesome_dashboard" ) . getAll ( ) ;
14+ }
15+
16+ onChange ( item , value ) {
17+ localStorage . setItem ( "" , { } ) ;
18+ }
19+
20+ onClose ( ) {
21+ this . props . close ( ) ;
22+ }
23+ }
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <templates xml : space =" preserve" >
3+
4+ <t t-name =" awesome_dashboard.ConfigurationDialog" >
5+ <Dialog
6+ size =" 'md'"
7+ title =" 'Dashboard items configuration'"
8+ >
9+ <p >Which cards do you wish to see?</p >
10+ <t t-foreach =" items" t-as =" item" t-key =" item.id" >
11+ <CheckBox
12+ name =" 'enabled'"
13+ value =" false"
14+ >
15+ <t t-esc =" item.description" />
16+ </CheckBox >
17+ </t >
18+ <t t-set-slot =" footer" >
19+ <button class =" btn btn-primary" t-on-click =" onClose" >
20+ Apply
21+ </button >
22+ </t >
23+ </Dialog >
24+ </t >
25+
26+ </templates >
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { useService } from "@web/core/utils/hooks";
44import { Layout } from "@web/search/layout" ;
55import { DashboardItem } from "./dashboard_item/dashboard_item" ;
66import { PieChart } from "./pie_chart/pie_chart" ;
7+ import { ConfigurationDialog } from "./configuration_dialog/configuration_dialog" ;
78import dashboard_items from "./dashboard_items" ;
89
910class AwesomeDashboard extends Component {
@@ -14,6 +15,7 @@ class AwesomeDashboard extends Component {
1415 this . action = useService ( "action" ) ;
1516 this . state = reactive ( { statistics : useService ( "statistics" ) } ) ;
1617 this . items = registry . category ( "awesome_dashboard" ) . getAll ( ) ;
18+ this . dialog = useService ( "dialog" ) ;
1719 }
1820
1921 openLeads ( ) {
@@ -31,6 +33,13 @@ class AwesomeDashboard extends Component {
3133 openCustomers ( ) {
3234 this . action . doAction ( "base.action_partner_form" ) ;
3335 }
36+
37+ openConfiguration ( ) {
38+ this . dialog . add (
39+ ConfigurationDialog ,
40+ { } ,
41+ ) ;
42+ }
3443}
3544
3645registry . category ( "lazy_components" ) . add ( "AwesomeDashboard" , AwesomeDashboard ) ;
Original file line number Diff line number Diff line change 1414 Leads
1515 </button >
1616 </t >
17+ <t t-set-slot =" control-panel-additional-actions" >
18+ <button t-on-click =" openConfiguration" class =" btn" >
19+ <i class =" fa fa-cog" />
20+ </button >
21+ </t >
1722 <div class =" d-flex align-items-start flex-wrap" >
1823 <t t-foreach =" items" t-as =" item" t-key =" item.id" >
1924 <DashboardItem size =" item.size || 1" >
You can’t perform that action at this time.
0 commit comments