Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
training-dhtd2019-mysql
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Phạm Văn Đoan
training-dhtd2019-mysql
Commits
4f79f58d
Commit
4f79f58d
authored
5 years ago
by
Phạm Văn Đoan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update list task
parent
04000356
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
19 deletions
+28
-19
task.model.js
modules/task/models/task.model.js
+5
-1
index.ejs
views/pages/task/index.ejs
+6
-8
form_add.ejs
views/pages/task/partials/form_add.ejs
+6
-6
nav.ejs
views/partials/nav.ejs
+11
-4
No files found.
modules/task/models/task.model.js
View file @
4f79f58d
...
@@ -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
This diff is collapsed.
Click to expand it.
views/pages/task/index.ejs
View file @
4f79f58d
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
clearTimeout(oldTimeout);
clearTimeout(oldTimeout);
oldTimeout = setTimeout(function(){
oldTimeout = setTimeout(function(){
get
Page
ByAjax(url_ajax, 1);
get
Data
ByAjax(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(){
get
Page
ByAjax(url_ajax, 1);
get
Data
ByAjax(url_ajax, 1);
});
});
}
}
function changePagination(page
Id
) {
function changePagination(page
_index
) {
var url_ajax = '/task/ajax-list';
var url_ajax = '/task/ajax-list';
get
PageByAjax(url_ajax, pageId
);
get
DataByAjax(url_ajax, page_index
);
}
}
function get
PageByAjax(url_ajax, pageId
) {
function get
DataByAjax(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);
...
...
This diff is collapsed.
Click to expand it.
views/pages/task/partials/form_add.ejs
View file @
4f79f58d
...
@@ -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",
...
...
This diff is collapsed.
Click to expand it.
views/partials/nav.ejs
View file @
4f79f58d
<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
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment