mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
Updating tasks to show incomplete, overdue items
This commit is contained in:
parent
5e80ab7f6b
commit
cf715c9dbf
4 changed files with 37 additions and 4 deletions
|
|
@ -26,7 +26,7 @@ Template.myTasksForm.events({
|
|||
showSnackbar("Task Name and Date are Required!", "red");
|
||||
return;
|
||||
} else {
|
||||
Meteor.call("add.task", taskName, "self", "selfId", taskDate, actDate, function(err, result) {
|
||||
Meteor.call("add.mytask", taskName, "self", "selfId", taskDate, actDate, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR adding task for self: " + err);
|
||||
showSnackbar("ERROR adding task for self!", "red");
|
||||
|
|
@ -19,7 +19,8 @@ Template.myTasksTbl.helpers({
|
|||
if (hide == true && onlyToday == false) {
|
||||
return TaskItems.find({ isComplete: false }, { sort: { actualDate: 1 }});
|
||||
} else if (hide == true && onlyToday == true) {
|
||||
return TaskItems.find({ isComplete: false, taskDate: todayIs }, { sort: { actualDate: 1 }});
|
||||
// return TaskItems.find({ isComplete: false, taskDate: todayIs }, { sort: { actualDate: 1 }});
|
||||
return TaskItems.find({ isComplete: false, actualDate: { $lte: new Date()}}, { sort:{ actualDate: 1 }});
|
||||
} else if (hide == false && onlyToday == true) {
|
||||
return TaskItems.find({ taskDate: todayIs }, { sort: { actualDate: 1 }});
|
||||
} else {
|
||||
|
|
@ -29,7 +30,8 @@ Template.myTasksTbl.helpers({
|
|||
passedDate: function() {
|
||||
let taskDate = new Date(this.taskDate);
|
||||
let now = new Date()
|
||||
let diff = now < taskDate;
|
||||
now.setHours(0,0,0,0);
|
||||
let diff = now <= taskDate;
|
||||
let comp = this.isComplete;
|
||||
if (diff == false && comp == false) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -49,6 +49,37 @@ Meteor.methods({
|
|||
}
|
||||
}
|
||||
},
|
||||
'add.mytask' (taskName, assignedTo, assignedToId, taskDate, actDate) {
|
||||
check(taskName, String);
|
||||
check(taskDate, String);
|
||||
check(actDate, Date);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('You are not allowed to add tasks. Make sure you are logged in with valid user credentials.');
|
||||
}
|
||||
|
||||
let username;
|
||||
|
||||
if (assignedTo == "self") {
|
||||
let userInfo = Meteor.users.findOne({ _id: this.userId });
|
||||
username = userInfo.profile.fullname;
|
||||
assignedToId = this.userId;
|
||||
} else {
|
||||
username = assignedTo;
|
||||
}
|
||||
|
||||
return TaskItems.insert({
|
||||
taskName: taskName,
|
||||
taskDate: taskDate,
|
||||
actualDate: actDate,
|
||||
assignedTo: username,
|
||||
assignedToId: assignedToId,
|
||||
isComplete: false,
|
||||
completedOn: null,
|
||||
assignedOn: new Date(),
|
||||
assignedBy: this.userId,
|
||||
});
|
||||
},
|
||||
'edit.task' (taskId, taskName, assignedTo, taskDate) {
|
||||
check(taskId, String);
|
||||
check(taskName, String);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue