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

update list task

parent 04000356
......@@ -70,11 +70,14 @@ exports.getTotal = function (input, callback) {
*/
exports.store = function (data, callback) {
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,
priority: data.priority,
description: data.description,
created_at: moment().format('YYYY-MM-DD HH:mm:ss'),
updated_at: moment().format('YYYY-MM-DD HH:mm:ss')
}, callback);
console.log(s.sql);
}
\ No newline at end of file
......@@ -25,7 +25,7 @@
clearTimeout(oldTimeout);
oldTimeout = setTimeout(function(){
getPageByAjax(url_ajax, 1);
getDataByAjax(url_ajax, 1);
}, 250);
});
......@@ -34,16 +34,16 @@
function filterBySelectBox(id, url_ajax){
$('#'+id).change(function(){
getPageByAjax(url_ajax, 1);
getDataByAjax(url_ajax, 1);
});
}
function changePagination(pageId) {
function changePagination(page_index) {
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();
var key_word = $('#task_key_word').val();
......@@ -57,9 +57,7 @@
key_word: key_word,
priority: priority,
status: status,
skip: 0,
limit: 10,
page_index: pageId
page_index: page_index
},
success: function(result) {
$('#ajax_list').html(result);
......
......@@ -12,11 +12,11 @@
<form>
<div class="form-group">
<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 class="form-group">
<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="1">Bình thường</option>
<option value="2">Trung bình</option>
......@@ -27,7 +27,7 @@
</div>
<div class="form-group">
<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>
</form>
</div>
......@@ -41,9 +41,9 @@
<script>
$('#btn-save').click(function () {
var name = $('#task_name').val();
var priority = $('#task_priority').val();
var description = $('#task_description').val();
var name = $('#name').val();
var priority = $('#priority').val();
var description = $('#description').val();
jQuery.ajax({
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">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
<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>
</li>
<li class="nav-item">
<a class="nav-link" href="/task/list">Task</a>
<a class="nav-link" href="/task/list">Project</a>
</li>
<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>
</li>
<li class="nav-item dropdown">
......@@ -21,6 +27,6 @@
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
</li>-->
</ul>
</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