From 950a5d4c403b0bda06aa7ea96393f2f80ceb3f24 Mon Sep 17 00:00:00 2001 From: Anoop Kumar Date: Fri, 27 Oct 2017 17:38:00 +0530 Subject: [PATCH] Basic app completed(Added 4 buttons) --- .idea/Todo.iml | 12 ++ .idea/misc.xml | 6 + .idea/modules.xml | 8 + .idea/typescript-compiler.xml | 7 + .idea/watcherTasks.xml | 4 + .idea/workspace.xml | 274 ++++++++++++++++++++++++++++++++++ index.html | 18 +++ todo.js | 54 +++++++ todo.ts | 81 ++++++++++ userinput.js | 113 ++++++++++++++ 10 files changed, 577 insertions(+) create mode 100644 .idea/Todo.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/typescript-compiler.xml create mode 100644 .idea/watcherTasks.xml create mode 100644 .idea/workspace.xml create mode 100644 index.html create mode 100644 todo.js create mode 100644 todo.ts create mode 100644 userinput.js diff --git a/.idea/Todo.iml b/.idea/Todo.iml new file mode 100644 index 0000000..24643cc --- /dev/null +++ b/.idea/Todo.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..28a804d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..23d1e3a --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/typescript-compiler.xml b/.idea/typescript-compiler.xml new file mode 100644 index 0000000..17ff836 --- /dev/null +++ b/.idea/typescript-compiler.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/watcherTasks.xml b/.idea/watcherTasks.xml new file mode 100644 index 0000000..9338ba6 --- /dev/null +++ b/.idea/watcherTasks.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..fb7a5d3 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + status + lst + list + typesc + + + status_list + l + todos + todoList + + + + + + + + + true + + false + true + true + + + true + DEFINITION_ORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
    +
+ + + + + diff --git a/todo.js b/todo.js new file mode 100644 index 0000000..e16a804 --- /dev/null +++ b/todo.js @@ -0,0 +1,54 @@ +var TodoList = (function () { + function TodoList() { + this.todoList = []; + } + TodoList.prototype.add = function (atodo) { + this.todoList.push(atodo); + }; + TodoList.prototype.delete = function (index) { + this.todoList.splice(index, 1); + // this.status.splice(index, 1); + }; + TodoList.prototype.update = function (index, taskUpdate) { + this.todoList[index].task = taskUpdate; + }; + TodoList.prototype.changeStatus = function (index) { + this.todoList[index].done = !this.todoList[index].done; + }; + TodoList.prototype.getList = function () { + return this.todoList; + }; + TodoList.prototype.display = function () { + // console.log('Tasks '+this.todo); + // console.log('Status '+this.status); + var a = 2; + }; + return TodoList; +}()); +// let atodo = {task : "kill him", done : "false"}; +var list = new TodoList(); +function addTodo(task, done) { + list.add({ + task: task, + done: false + }); +} +function deleteTodo(index) { + list.delete(index); +} +function updateTodo(index, taskupdate) { + list.update(index, taskupdate); +} +function changeStatusTodo(index) { + list.changeStatus(index); +} +function getTodos() { + return list.getList(); +} +// list.add({task: "Learn Angular",done: false}); +// Task name +// done +//mark as read +//delete +//update +// list.display() diff --git a/todo.ts b/todo.ts new file mode 100644 index 0000000..d86c766 --- /dev/null +++ b/todo.ts @@ -0,0 +1,81 @@ +interface todo{ + task: string; + done: boolean; +} + +class TodoList{ + private todoList : todo []; + + constructor(){ + this.todoList = []; + } + + add(atodo: todo){ + this.todoList.push(atodo) + } + + delete(index: number){ + this.todoList.splice(index, 1); + // this.status.splice(index, 1); + } + + update(index: number, taskUpdate: string){ + this.todoList[index].task = taskUpdate; + } + + changeStatus(index: number) + { + this.todoList[index].done = !this.todoList[index].done; + } + + getList() + { + return this.todoList; + } + + display(){ + // console.log('Tasks '+this.todo); + // console.log('Status '+this.status); + var a = 2; + } +} + +// let atodo = {task : "kill him", done : "false"}; + +var list = new TodoList(); + + +function addTodo(task: string, done: boolean){ + list.add({ + task: task, + done: false + }) +} + +function deleteTodo(index: number){ + list.delete(index); +} + +function updateTodo(index: number, taskupdate: string){ + list.update(index, taskupdate); +} + +function changeStatusTodo(index: number) +{ + list.changeStatus(index); +} + +function getTodos(){ + return list.getList(); +} + + +// list.add({task: "Learn Angular",done: false}); + +// Task name +// done +//mark as read +//delete +//update + +// list.display() diff --git a/userinput.js b/userinput.js new file mode 100644 index 0000000..b59cace --- /dev/null +++ b/userinput.js @@ -0,0 +1,113 @@ + +var todoList = document.getElementById('todos'); + + + +window.onload = function() { + var input = document.getElementById('inp'); + var btn = document.getElementById('btn'); + + var lst = getTodos(); + + btn.onclick = function () { + var value = input.value; + addTodo(value, false); + mydisplay(); + }; + +} + + +function mydelete(id){ + deleteTodo(id); + mydisplay(); +} + +function mydisplay(){ + + todoList.innerHTML = ''; + var lst = getTodos(); + for (let i=0; i'; + todoListString += '
  • Status : ' +done+ '
  • '; + todoListString += ''; + + todoListString += ''; + todoListString += ''; + todoListString += ''; + + todoListString += '' + // todoListString += '' + todoListString += '
    '; + return todoListString; +} \ No newline at end of file