diff --git a/db/tasks.go b/db/tasks.go index 5ebbfad..cfb641f 100644 --- a/db/tasks.go +++ b/db/tasks.go @@ -205,19 +205,23 @@ func DeleteTask(username string, id int) error { } //AddTask is used to add the task in the database -func AddTask(title, content, category string, taskPriority int, username string) error { +func AddTask(title, content, category string, taskPriority int, username, dueDate string) error { log.Println("AddTask: started function") var err error + timeDueDate, err := time.Parse("31/12/2016", dueDate) + if err != nil { + log.Fatal(err) + } userID, err := GetUserID(username) if err != nil && (title != "" || content != "") { return err } if category == "" { - err = taskQuery("insert into task(title, content, priority, task_status_id, created_date, last_modified_at, user_id) values(?,?,?,?,datetime(), datetime(),?)", title, content, taskPriority, taskStatus["PENDING"], userID) + err = taskQuery("insert into task(title, content, priority, task_status_id, created_date, last_modified_at, user_id,due_date) values(?,?,?,?,datetime(), datetime(),?)", title, content, taskPriority, taskStatus["PENDING"], userID, timeDueDate) } else { categoryID := GetCategoryByName(username, category) - err = taskQuery("insert into task(title, content, priority, created_date, last_modified_at, cat_id, task_status_id, user_id) values(?,?,?,datetime(), datetime(), ?,?,?)", title, content, taskPriority, categoryID, taskStatus["PENDING"], userID) + err = taskQuery("insert into task(title, content, priority, created_date, last_modified_at, cat_id, task_status_id, user_id,due_date) values(?,?,?,datetime(), datetime(), ?,?,?)", title, content, taskPriority, categoryID, taskStatus["PENDING"], userID, timeDueDate) } return err } diff --git a/public/static/js/script.js b/public/static/js/script.js index 2ba79f4..d59a39d 100644 --- a/public/static/js/script.js +++ b/public/static/js/script.js @@ -22,6 +22,8 @@ $(document).ready(function(){ $('#addNoteModal').modal('show'); }); + $("#datepicker").datepicker(); + $('#editCatFrmBtn').click(function(){ $('#EditForm').toggleClass('hidden') }); diff --git a/templates/_head.html b/templates/_head.html index efa6936..7c01669 100644 --- a/templates/_head.html +++ b/templates/_head.html @@ -17,6 +17,7 @@ + @@ -25,6 +26,8 @@ + + diff --git a/templates/home.html b/templates/home.html index f587fcc..3fcbaf1 100644 --- a/templates/home.html +++ b/templates/home.html @@ -25,6 +25,7 @@ + Date:
Priority: High Medium @@ -37,6 +38,7 @@ {{end}} +