- hello world
+
+
+
+
+
+
Test 2
+
General counter:
+
+
+
+
diff --git a/awesome_owl/static/src/todo/todo_item.js b/awesome_owl/static/src/todo/todo_item.js
new file mode 100644
index 00000000000..02c9e57e12c
--- /dev/null
+++ b/awesome_owl/static/src/todo/todo_item.js
@@ -0,0 +1,26 @@
+/** @odoo-module **/
+
+import { Component, useState } 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
+ }
+ },
+ removeTodo: { type: Function }
+ };
+
+ toggleState() {
+ this.props.todo.isCompleted = !this.props.todo.isCompleted
+ }
+
+ removeTodo() {
+ this.props.removeTodo(this.props.todo.id);
+ }
+}
diff --git a/awesome_owl/static/src/todo/todo_item.xml b/awesome_owl/static/src/todo/todo_item.xml
new file mode 100644
index 00000000000..b5b93186683
--- /dev/null
+++ b/awesome_owl/static/src/todo/todo_item.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
diff --git a/awesome_owl/static/src/todo/todo_list.js b/awesome_owl/static/src/todo/todo_list.js
new file mode 100644
index 00000000000..62828b951f1
--- /dev/null
+++ b/awesome_owl/static/src/todo/todo_list.js
@@ -0,0 +1,36 @@
+/** @odoo-module **/
+
+import { Component, useState, useRef, onMounted } from "@odoo/owl";
+import { TodoItem } from "./todo_item";
+
+export class TodoList extends Component {
+ static template = "awesome_owl.TodoList";
+
+
+ setup() {
+ this.todos = useState([]);
+ this.inputRef = useRef('todoInput');
+ onMounted(() => {
+ if (this.inputRef.el) {
+ this.inputRef.el.focus();
+ }
+ });
+ }
+
+ addTodo(ev) {
+ // event.Key === "Enter" marche aussi
+ if (ev.keyCode === 13 && ev.target.value.trim() != "") {
+ this.todos.push({id: this.todos.length + 1, description: ev.target.value, isCompleted: false});
+ ev.target.value = ""
+ }
+ }
+
+ removeTodo(id) {
+ const index = this.todos.findIndex(todo => todo.id === id);
+ if (index >= 0) {
+ this.todos.splice(index, 1);
+ }
+ }
+
+ static components = { TodoItem }
+}
diff --git a/awesome_owl/static/src/todo/todo_list.xml b/awesome_owl/static/src/todo/todo_list.xml
new file mode 100644
index 00000000000..652f0e13cc7
--- /dev/null
+++ b/awesome_owl/static/src/todo/todo_list.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+