- hello world
+
+
+
+
+
+
+
+
+
+
+
+ Sum:
+
+
+
+
-
diff --git a/awesome_owl/static/src/todo/todoitem.js b/awesome_owl/static/src/todo/todoitem.js
new file mode 100644
index 00000000000..7e9f3c3ef52
--- /dev/null
+++ b/awesome_owl/static/src/todo/todoitem.js
@@ -0,0 +1,14 @@
+import { Component } from "@odoo/owl";
+
+export class TodoItem extends Component {
+ static template = "awesome_owl.TodoItem";
+
+ static props = {
+ todo: {
+ type: Object,
+ shape: { id: Number, description: String, isCompleted: Boolean },
+ },
+ toggleState: { type: Function, optional: true },
+ deleteTodo: { type: Function, optional: true },
+ };
+}
diff --git a/awesome_owl/static/src/todo/todoitem.xml b/awesome_owl/static/src/todo/todoitem.xml
new file mode 100644
index 00000000000..a4b7fe57be0
--- /dev/null
+++ b/awesome_owl/static/src/todo/todoitem.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
diff --git a/awesome_owl/static/src/todo/todolist.js b/awesome_owl/static/src/todo/todolist.js
new file mode 100644
index 00000000000..c02e1ce80e2
--- /dev/null
+++ b/awesome_owl/static/src/todo/todolist.js
@@ -0,0 +1,40 @@
+import { Component, useState } from "@odoo/owl";
+import { useAutoFocus } from "../utils";
+import { TodoItem } from "./todoitem";
+
+export class TodoList extends Component {
+ static template = "awesome_owl.TodoList";
+
+ static components = { TodoItem };
+
+ setup() {
+ this.todos = useState([]);
+ this.nextId = 1;
+ this.inputRef = useAutoFocus('input');
+ }
+
+ addTodo(ev) {
+ if (ev.key === "Enter") {
+ const content = ev.target.value.trim();
+ if (content !== "") {
+ this.todos.push({ id: this.nextId, description: content, isCompleted: false });
+ ev.target.value = "";
+ this.nextId++;
+ }
+ }
+ }
+
+ toggleTodo(id) {
+ const todo = this.todos.find(t => t.id === id);
+ if (todo) {
+ todo.isCompleted = !todo.isCompleted;
+ }
+ }
+
+ deleteTodo(id) {
+ const index = this.todos.findIndex((t) => t.id === id);
+ if (index >= 0) {
+ this.todos.splice(index, 1);
+ }
+ }
+}
diff --git a/awesome_owl/static/src/todo/todolist.xml b/awesome_owl/static/src/todo/todolist.xml
new file mode 100644
index 00000000000..e2e2cfe8790
--- /dev/null
+++ b/awesome_owl/static/src/todo/todolist.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/awesome_owl/static/src/utils.js b/awesome_owl/static/src/utils.js
new file mode 100644
index 00000000000..4c2773a546a
--- /dev/null
+++ b/awesome_owl/static/src/utils.js
@@ -0,0 +1,9 @@
+import { useRef, onMounted } from "@odoo/owl";
+
+export function useAutoFocus(refName) {
+ const ref = useRef(refName);
+ onMounted(() => {
+ ref.el.focus();
+ });
+ return ref;
+}