- hello world
+
+
+ hello world
+
+
+
+
+
+
+
+
+
+
+
+
+ Star Platinum
+
+
+
+
+
+ Hierophant green
+ Global count:
+
+
+
+
+ Silver Chariot
+
+ Silver Chariot again
+ Global count:
+
+
+
+
+
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..4bb47c7a0bd
--- /dev/null
+++ b/awesome_owl/static/src/todo/todo_item.js
@@ -0,0 +1,12 @@
+import {Component} from "@odoo/owl";
+import {Todo} from "./todo_model";
+
+
+export class TodoItem extends Component {
+ static template = "awesome_owl.todo_item";
+ static props = {
+ model: { type: Todo },
+ toggle: { type: Function },
+ removeTodo: { type: Function },
+ };
+}
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..bc7bda55cf0
--- /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..685361f8b06
--- /dev/null
+++ b/awesome_owl/static/src/todo/todo_list.js
@@ -0,0 +1,42 @@
+import {Component, useState} from "@odoo/owl";
+import {TodoItem} from "./todo_item";
+import {Todo} from "./todo_model";
+import {useAutoFocus} from "../utils";
+
+
+export class TodoList extends Component {
+ static template = "awesome_owl.todo_list";
+ static components = {TodoItem};
+
+ index = 0;
+ state = useState({todos: []});
+
+ setup() {
+ useAutoFocus('addTaskInput')
+ this.toggleStateBind = this.toggleState.bind(this);
+ this.removeTodoBind = this.removeTodo.bind(this);
+ }
+
+ keyUpAddTodo(ev) {
+ if (ev.keyCode === 13 && ev.target.value !== "") {
+ this.state.todos.push(new Todo(this.index + 1, ev.target.value, false));
+ this.index++;
+ ev.target.value = "";
+ }
+ }
+
+ toggleState(id) {
+ this.state.todos.forEach((value, index, arr) => {
+ if (value.id === id) {
+ value.toggle();
+ }
+ })
+ }
+
+ removeTodo(id) {
+ const index = this.state.todos.findIndex((todo) => todo.id === id);
+ if (index >= 0) {
+ this.state.todos.splice(index, 1);
+ }
+ }
+}
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..cd4ee9ed0fe
--- /dev/null
+++ b/awesome_owl/static/src/todo/todo_list.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/awesome_owl/static/src/todo/todo_model.js b/awesome_owl/static/src/todo/todo_model.js
new file mode 100644
index 00000000000..4ced2b48328
--- /dev/null
+++ b/awesome_owl/static/src/todo/todo_model.js
@@ -0,0 +1,11 @@
+export class Todo {
+ constructor(id, description, isCompleted) {
+ this.id = id;
+ this.description = description;
+ this.isCompleted = isCompleted;
+ }
+
+ toggle() {
+ this.isCompleted = !this.isCompleted;
+ }
+}
diff --git a/awesome_owl/static/src/utils.js b/awesome_owl/static/src/utils.js
new file mode 100644
index 00000000000..d64f94484c2
--- /dev/null
+++ b/awesome_owl/static/src/utils.js
@@ -0,0 +1,9 @@
+import {useRef, onMounted} from "@odoo/owl";
+
+
+export function useAutoFocus(name) {
+ const ref = useRef(name);
+ onMounted(() => {
+ ref.el.focus();
+ });
+}