-
-
+
+
+
+
+
+
+
diff --git a/awesome_owl/static/src/todo_list/todo_list.js b/awesome_owl/static/src/todo_list/todo_list.js
index 0d9af640047..eb38b1694d7 100644
--- a/awesome_owl/static/src/todo_list/todo_list.js
+++ b/awesome_owl/static/src/todo_list/todo_list.js
@@ -22,4 +22,17 @@ export class TodoList extends Component {
ev.target.value = "";
}
}
+ toggleTodo(id) {
+ const todo = this.todos.find(todo => todo.id === id);
+ if (todo) {
+ todo.isCompleted = !todo.isCompleted;
+ }
+ }
+
+ removeTodo(id) {
+ const index = this.todos.findIndex(todo => todo.id === id);
+ if (index !== -1) {
+ this.todos.splice(index, 1);
+ }
+ }
}
\ No newline at end of file
diff --git a/awesome_owl/static/src/todo_list/todo_list.xml b/awesome_owl/static/src/todo_list/todo_list.xml
index d950a54bd5b..f3d1d9f4021 100644
--- a/awesome_owl/static/src/todo_list/todo_list.xml
+++ b/awesome_owl/static/src/todo_list/todo_list.xml
@@ -4,7 +4,7 @@
-
+
From 73465b9174076043aa9d481e235b1af326a53736 Mon Sep 17 00:00:00 2001
From: oumaima-aarabe <111888559+oumaima-aarabe@users.noreply.github.com>
Date: Fri, 30 May 2025 10:00:42 +0200
Subject: [PATCH 12/17] [ADD] awesome_owl: update Card component to use slots
for dynamic content rendering
---
awesome_owl/static/src/card/card.js | 5 ++++-
awesome_owl/static/src/card/card.xml | 2 +-
awesome_owl/static/src/playground.xml | 8 ++++++--
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/awesome_owl/static/src/card/card.js b/awesome_owl/static/src/card/card.js
index 03e2f9ff39b..74c112db376 100644
--- a/awesome_owl/static/src/card/card.js
+++ b/awesome_owl/static/src/card/card.js
@@ -4,6 +4,9 @@ export class Card extends Component {
static template = "awesome_owl.Card";
static props = {
title: { type: String },
- content: { type: String, optional: true },
+ slots: {
+ type: Object,
+ shape: { default:true },
+ }
}
}
\ No newline at end of file
diff --git a/awesome_owl/static/src/card/card.xml b/awesome_owl/static/src/card/card.xml
index 7a0f39cf6dc..eb5d0d5efb8 100644
--- a/awesome_owl/static/src/card/card.xml
+++ b/awesome_owl/static/src/card/card.xml
@@ -4,7 +4,7 @@
diff --git a/awesome_owl/static/src/playground.xml b/awesome_owl/static/src/playground.xml
index ed02c834d93..65298c9a32a 100644
--- a/awesome_owl/static/src/playground.xml
+++ b/awesome_owl/static/src/playground.xml
@@ -9,8 +9,12 @@
The sum is:
From 82ac6adb96b238215528916b1c7c1790a07ce61d Mon Sep 17 00:00:00 2001
From: oumaima-aarabe <111888559+oumaima-aarabe@users.noreply.github.com>
Date: Fri, 30 May 2025 10:19:36 +0200
Subject: [PATCH 13/17] [ADD] awesome_owl: enhance Card component with toggle
functionality and state management
---
awesome_owl/static/src/card/card.js | 12 +++++++++++-
awesome_owl/static/src/card/card.xml | 9 +++++++--
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/awesome_owl/static/src/card/card.js b/awesome_owl/static/src/card/card.js
index 74c112db376..a36b44300d3 100644
--- a/awesome_owl/static/src/card/card.js
+++ b/awesome_owl/static/src/card/card.js
@@ -1,4 +1,4 @@
-import { Component } from "@odoo/owl";
+import { Component, useState } from "@odoo/owl";
export class Card extends Component {
static template = "awesome_owl.Card";
@@ -7,6 +7,16 @@ export class Card extends Component {
slots: {
type: Object,
shape: { default:true },
+ },
+ }
+
+ setup() {
+ this.state = useState({ isToggled: true });
+ }
+ toggle() {
+ this.state.isToggled = !this.state.isToggled;
+ if (this.props.onChange) {
+ this.props.onChange(this.state.isToggled);
}
}
}
\ No newline at end of file
diff --git a/awesome_owl/static/src/card/card.xml b/awesome_owl/static/src/card/card.xml
index eb5d0d5efb8..9b662da71a5 100644
--- a/awesome_owl/static/src/card/card.xml
+++ b/awesome_owl/static/src/card/card.xml
@@ -3,8 +3,13 @@
From 1e85def6878bfd0f777d539d99a7d4ac44f23933 Mon Sep 17 00:00:00 2001
From: oumaima-aarabe <111888559+oumaima-aarabe@users.noreply.github.com>
Date: Mon, 2 Jun 2025 09:58:18 +0200
Subject: [PATCH 14/17] [ADD] awesome_dashboard: implement layout and buttons
for customer and leads actions
---
awesome_dashboard/static/src/dashboard.js | 27 +++++++++++++++++++++
awesome_dashboard/static/src/dashboard.scss | 3 +++
awesome_dashboard/static/src/dashboard.xml | 8 +++++-
3 files changed, 37 insertions(+), 1 deletion(-)
create mode 100644 awesome_dashboard/static/src/dashboard.scss
diff --git a/awesome_dashboard/static/src/dashboard.js b/awesome_dashboard/static/src/dashboard.js
index 637fa4bb972..fceea180f24 100644
--- a/awesome_dashboard/static/src/dashboard.js
+++ b/awesome_dashboard/static/src/dashboard.js
@@ -2,9 +2,36 @@
import { Component } from "@odoo/owl";
import { registry } from "@web/core/registry";
+import { Layout } from "@web/search/layout";
+import { useService } from "@web/core/utils/hooks";
class AwesomeDashboard extends Component {
static template = "awesome_dashboard.AwesomeDashboard";
+
+ static components = { Layout };
+
+ setup() {
+ this.action = useService("action");
+ this.display = {
+ controlPanel: {},
+ };
+ }
+
+ openCustomerView() {
+ this.action.doAction("base.action_partner_form");
+ }
+
+ openLeads() {
+ this.action.doAction({
+ type: "ir.actions.act_window",
+ name: "All leads",
+ res_model: "crm.lead",
+ views: [
+ [false, "list"],
+ [false, "form"],
+ ],
+ });
+ }
}
registry.category("actions").add("awesome_dashboard.dashboard", AwesomeDashboard);
diff --git a/awesome_dashboard/static/src/dashboard.scss b/awesome_dashboard/static/src/dashboard.scss
new file mode 100644
index 00000000000..49a8d6a691f
--- /dev/null
+++ b/awesome_dashboard/static/src/dashboard.scss
@@ -0,0 +1,3 @@
+.o_dashboard {
+ background-color: rgb(86, 72, 90);
+}
\ No newline at end of file
diff --git a/awesome_dashboard/static/src/dashboard.xml b/awesome_dashboard/static/src/dashboard.xml
index 1a2ac9a2fed..58c1df94324 100644
--- a/awesome_dashboard/static/src/dashboard.xml
+++ b/awesome_dashboard/static/src/dashboard.xml
@@ -2,7 +2,13 @@
- hello dashboard
+
+
+ Customers
+ Leads
+
+ content goes here
+
From 5a048a9829a52cd50d77b77eb490c3847735e5c1 Mon Sep 17 00:00:00 2001
From: oumaima-aarabe <111888559+oumaima-aarabe@users.noreply.github.com>
Date: Mon, 2 Jun 2025 10:01:26 +0200
Subject: [PATCH 15/17] [ADD] awesome_dashboard: add DashboardItem component
and integrate it into AwesomeDashboard layout
---
awesome_dashboard/static/src/dashboard.js | 4 ++--
awesome_dashboard/static/src/dashboard.xml | 12 +++++++++++-
.../static/src/dashboard_item/dashboard_item.js | 16 ++++++++++++++++
.../static/src/dashboard_item/dashboard_item.xml | 10 ++++++++++
4 files changed, 39 insertions(+), 3 deletions(-)
create mode 100644 awesome_dashboard/static/src/dashboard_item/dashboard_item.js
create mode 100644 awesome_dashboard/static/src/dashboard_item/dashboard_item.xml
diff --git a/awesome_dashboard/static/src/dashboard.js b/awesome_dashboard/static/src/dashboard.js
index fceea180f24..230fc12eb82 100644
--- a/awesome_dashboard/static/src/dashboard.js
+++ b/awesome_dashboard/static/src/dashboard.js
@@ -4,11 +4,11 @@ import { Component } from "@odoo/owl";
import { registry } from "@web/core/registry";
import { Layout } from "@web/search/layout";
import { useService } from "@web/core/utils/hooks";
-
+import { DashboardItem } from "./dashboard_item/dashboard_item"
class AwesomeDashboard extends Component {
static template = "awesome_dashboard.AwesomeDashboard";
- static components = { Layout };
+ static components = { Layout, DashboardItem };
setup() {
this.action = useService("action");
diff --git a/awesome_dashboard/static/src/dashboard.xml b/awesome_dashboard/static/src/dashboard.xml
index 58c1df94324..c677f756d0d 100644
--- a/awesome_dashboard/static/src/dashboard.xml
+++ b/awesome_dashboard/static/src/dashboard.xml
@@ -7,7 +7,17 @@
Customers
Leads
- content goes here
+
+
+ some content
+
+
+ I love milk
+
+
+ some content
+
+
diff --git a/awesome_dashboard/static/src/dashboard_item/dashboard_item.js b/awesome_dashboard/static/src/dashboard_item/dashboard_item.js
new file mode 100644
index 00000000000..24373d4836b
--- /dev/null
+++ b/awesome_dashboard/static/src/dashboard_item/dashboard_item.js
@@ -0,0 +1,16 @@
+import { Component } from "@odoo/owl";
+export class DashboardItem extends Component {
+ static template = "awesome_dashboard.DashboardItem"
+ static props = {
+ slots: {
+ type: Object,
+ optional: true,
+ default: () => ({}),
+ },
+ size: {
+ type: Number,
+ default: 1,
+ optional: true,
+ },
+ };
+}
diff --git a/awesome_dashboard/static/src/dashboard_item/dashboard_item.xml b/awesome_dashboard/static/src/dashboard_item/dashboard_item.xml
new file mode 100644
index 00000000000..d023340bb59
--- /dev/null
+++ b/awesome_dashboard/static/src/dashboard_item/dashboard_item.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
From 0cd0cbc75aeca69019692d5a1ed78e9bb6d7adb8 Mon Sep 17 00:00:00 2001
From: oumaima-aarabe <111888559+oumaima-aarabe@users.noreply.github.com>
Date: Mon, 2 Jun 2025 13:20:45 +0200
Subject: [PATCH 16/17] [ADD] awesome_dashboard: fetch and display statistics
in DashboardItem components
---
awesome_dashboard/static/src/dashboard.js | 6 +++++-
awesome_dashboard/static/src/dashboard.xml | 19 +++++++++++++++----
2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/awesome_dashboard/static/src/dashboard.js b/awesome_dashboard/static/src/dashboard.js
index 230fc12eb82..0a7de097ff5 100644
--- a/awesome_dashboard/static/src/dashboard.js
+++ b/awesome_dashboard/static/src/dashboard.js
@@ -1,10 +1,11 @@
/** @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";
import { DashboardItem } from "./dashboard_item/dashboard_item"
+import { rpc } from "@web/core/network/rpc";
class AwesomeDashboard extends Component {
static template = "awesome_dashboard.AwesomeDashboard";
@@ -15,6 +16,9 @@ class AwesomeDashboard extends Component {
this.display = {
controlPanel: {},
};
+ onWillStart(async () => {
+ this.statistics = await rpc("awesome_dashboard/statistics", {});
+ });
}
openCustomerView() {
diff --git a/awesome_dashboard/static/src/dashboard.xml b/awesome_dashboard/static/src/dashboard.xml
index c677f756d0d..ff654ba4f90 100644
--- a/awesome_dashboard/static/src/dashboard.xml
+++ b/awesome_dashboard/static/src/dashboard.xml
@@ -9,13 +9,24 @@
- some content
+ Number of new orders this month
+
-
- I love milk
+
+ Total amount of new orders this month
+
+
+
+ Average amount of t-shirt by order this month
+
+
+
+ Number of cancelled orders this month
+
- some content
+ Average time for an order to go from ‘new’ to ‘sent’ or ‘cancelled’
+
From 1ff36c0a8e1e4f234859f73cc931d2d26e4b9c2c Mon Sep 17 00:00:00 2001
From: oumaima-aarabe <111888559+oumaima-aarabe@users.noreply.github.com>
Date: Mon, 2 Jun 2025 13:44:25 +0200
Subject: [PATCH 17/17] [ADD] awesome_dashboard: implement statistics service
for loading dashboard statistics
---
awesome_dashboard/static/src/dashboard.js | 4 ++--
awesome_dashboard/static/src/statistics.js | 14 ++++++++++++++
2 files changed, 16 insertions(+), 2 deletions(-)
create mode 100644 awesome_dashboard/static/src/statistics.js
diff --git a/awesome_dashboard/static/src/dashboard.js b/awesome_dashboard/static/src/dashboard.js
index 0a7de097ff5..0c19267a96c 100644
--- a/awesome_dashboard/static/src/dashboard.js
+++ b/awesome_dashboard/static/src/dashboard.js
@@ -5,7 +5,6 @@ import { registry } from "@web/core/registry";
import { Layout } from "@web/search/layout";
import { useService } from "@web/core/utils/hooks";
import { DashboardItem } from "./dashboard_item/dashboard_item"
-import { rpc } from "@web/core/network/rpc";
class AwesomeDashboard extends Component {
static template = "awesome_dashboard.AwesomeDashboard";
@@ -13,11 +12,12 @@ class AwesomeDashboard extends Component {
setup() {
this.action = useService("action");
+ this.statistics = useService("awesome_dashboard.statistics");
this.display = {
controlPanel: {},
};
onWillStart(async () => {
- this.statistics = await rpc("awesome_dashboard/statistics", {});
+ this.statistics = await this.statistics.loadStatistics();
});
}
diff --git a/awesome_dashboard/static/src/statistics.js b/awesome_dashboard/static/src/statistics.js
new file mode 100644
index 00000000000..9f7a1b19a09
--- /dev/null
+++ b/awesome_dashboard/static/src/statistics.js
@@ -0,0 +1,14 @@
+import { registry } from "@web/core/registry";
+import { memoize } from "@web/core/utils/functions";
+import { rpc } from "@web/core/network/rpc";
+
+const statistics = {
+ async: ["loadStatistics"],
+ start() {
+ return {
+ loadStatistics: memoize(() => rpc("/awesome_dashboard/statistics")),
+ };
+ },
+};
+
+registry.category("services").add("awesome_dashboard.statistics", statistics);
\ No newline at end of file