Fix the completed boolean of tasks in the class and set the toast accordingly
This commit is contained in:
parent
6222ca71a4
commit
8f47e90251
|
|
@ -58,12 +58,13 @@ class Task implements JsonSerializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCompleted($flag = 0) {
|
public function getCompleted($flag = 0) {
|
||||||
|
$completed = (is_null($this->getCompleteTime())) ? false : true;
|
||||||
switch ($flag) {
|
switch ($flag) {
|
||||||
case AppDB::BOOLEANDB:
|
case AppDB::BOOLEANDB:
|
||||||
return ($this->completed) ? "true" : "false";
|
return ($completed) ? "true" : "false";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return $this->completed;
|
return $completed;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -220,6 +221,7 @@ class Task implements JsonSerializable {
|
||||||
'createdate' => $this->getCreateTime(SHORTDATE),
|
'createdate' => $this->getCreateTime(SHORTDATE),
|
||||||
'duetime' => $this->getDueTime(),
|
'duetime' => $this->getDueTime(),
|
||||||
'duedate' => $this->getDueTime(SHORTDATE),
|
'duedate' => $this->getDueTime(SHORTDATE),
|
||||||
|
'completed' => $this->getCompleted(),
|
||||||
'completetime' => $this->getCompleteTime(),
|
'completetime' => $this->getCompleteTime(),
|
||||||
'completedate' => $this->getCompleteTime(SHORTDATE)
|
'completedate' => $this->getCompleteTime(SHORTDATE)
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,11 @@ function setTaskComplete(incomplete = false) {
|
||||||
if ( data.error ) {
|
if ( data.error ) {
|
||||||
toastr.error(data.message, "Submission Error");
|
toastr.error(data.message, "Submission Error");
|
||||||
} else {
|
} else {
|
||||||
|
if ( data.task.completed ) {
|
||||||
toastr.success(data.message, "Task Complete");
|
toastr.success(data.message, "Task Complete");
|
||||||
|
} else {
|
||||||
|
toastr.success(data.message, "Task Incomplete");
|
||||||
|
}
|
||||||
getTasks();
|
getTasks();
|
||||||
updateImage();
|
updateImage();
|
||||||
resetForm(true);
|
resetForm(true);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user