Commit 4f79f58d by Phạm Văn Đoan

update list task

parent 04000356
...@@ -70,11 +70,14 @@ exports.getTotal = function (input, callback) { ...@@ -70,11 +70,14 @@ exports.getTotal = function (input, callback) {
*/ */
exports.store = function (data, callback) { exports.store = function (data, callback) {
let sql = 'INSERT INTO ' + consts.DB_TABLE.TASKS + ' SET ?'; let sql = 'INSERT INTO ' + consts.DB_TABLE.TASKS + ' SET ?';
db.query(sql, { let s = db.query(sql, {
project_id: 1,
user_id: 1,
name: data.name, name: data.name,
priority: data.priority, priority: data.priority,
description: data.description, description: data.description,
created_at: moment().format('YYYY-MM-DD HH:mm:ss'), created_at: moment().format('YYYY-MM-DD HH:mm:ss'),
updated_at: moment().format('YYYY-MM-DD HH:mm:ss') updated_at: moment().format('YYYY-MM-DD HH:mm:ss')
}, callback); }, callback);
console.log(s.sql);
} }
\ No newline at end of file
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
clearTimeout(oldTimeout); clearTimeout(oldTimeout);
oldTimeout = setTimeout(function(){ oldTimeout = setTimeout(function(){
getPageByAjax(url_ajax, 1); getDataByAjax(url_ajax, 1);
}, 250); }, 250);
}); });
...@@ -34,16 +34,16 @@ ...@@ -34,16 +34,16 @@
function filterBySelectBox(id, url_ajax){ function filterBySelectBox(id, url_ajax){
$('#'+id).change(function(){ $('#'+id).change(function(){
getPageByAjax(url_ajax, 1); getDataByAjax(url_ajax, 1);
}); });
} }
function changePagination(pageId) { function changePagination(page_index) {
var url_ajax = '/task/ajax-list'; var url_ajax = '/task/ajax-list';
getPageByAjax(url_ajax, pageId); getDataByAjax(url_ajax, page_index);
} }
function getPageByAjax(url_ajax, pageId) { function getDataByAjax(url_ajax, page_index) {
$('#data-loading').show(); $('#data-loading').show();
var key_word = $('#task_key_word').val(); var key_word = $('#task_key_word').val();
...@@ -57,9 +57,7 @@ ...@@ -57,9 +57,7 @@
key_word: key_word, key_word: key_word,
priority: priority, priority: priority,
status: status, status: status,
skip: 0, page_index: page_index
limit: 10,
page_index: pageId
}, },
success: function(result) { success: function(result) {
$('#ajax_list').html(result); $('#ajax_list').html(result);
......
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
<form> <form>
<div class="form-group"> <div class="form-group">
<label class="">Tên công việc <span style="color: red">(*)</span></label> <label class="">Tên công việc <span style="color: red">(*)</span></label>
<input type="text" class="form-control" id="task_name" name="task_name" autofocus autocomplete="false"> <input type="text" class="form-control" id="name" name="name" autofocus autocomplete="false">
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="">Chọn độ ưu tiên <span style="color: red">(*)</span></label> <label class="">Chọn độ ưu tiên <span style="color: red">(*)</span></label>
<select class="form-control" id="task_priority" name="task_priority"> <select class="form-control" id="priority" name="priority">
<option value="0">Thấp</option> <option value="0">Thấp</option>
<option value="1">Bình thường</option> <option value="1">Bình thường</option>
<option value="2">Trung bình</option> <option value="2">Trung bình</option>
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="">Mô tả thêm công việc</label> <label class="">Mô tả thêm công việc</label>
<textarea class="form-control" rows="3" id="task_description" name="task_description" autocomplete="false"></textarea> <textarea class="form-control" rows="3" id="description" name="description" autocomplete="false"></textarea>
</div> </div>
</form> </form>
</div> </div>
...@@ -41,9 +41,9 @@ ...@@ -41,9 +41,9 @@
<script> <script>
$('#btn-save').click(function () { $('#btn-save').click(function () {
var name = $('#task_name').val(); var name = $('#name').val();
var priority = $('#task_priority').val(); var priority = $('#priority').val();
var description = $('#task_description').val(); var description = $('#description').val();
jQuery.ajax({ jQuery.ajax({
url: "/task/store", url: "/task/store",
......
<a class="navbar-brand" href="#">Navbar</a> <a class="navbar-brand" href="#">MyWork</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
<div class="collapse navbar-collapse" id="navbarsExampleDefault"> <div class="collapse navbar-collapse" id="navbarsExampleDefault">
<ul class="navbar-nav mr-auto"> <ul class="navbar-nav mr-auto">
<li class="nav-item active"> <li class="nav-item">
<a class="nav-link" href="/">Home <span class="sr-only">(current)</span></a> <a class="nav-link" href="/">Home <span class="sr-only">(current)</span></a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="/task/list">Task</a> <a class="nav-link" href="/task/list">Project</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="/task/list">User</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="/task/list">Task</a>
</li>
<!--<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a> <a class="nav-link disabled" href="#">Disabled</a>
</li> </li>
<li class="nav-item dropdown"> <li class="nav-item dropdown">
...@@ -21,6 +27,6 @@ ...@@ -21,6 +27,6 @@
<a class="dropdown-item" href="#">Another action</a> <a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a> <a class="dropdown-item" href="#">Something else here</a>
</div> </div>
</li> </li>-->
</ul> </ul>
</div> </div>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment