Add start and finish dates to task cards, change assigned/due icons, add resume action that doesn't overwrite starttime
This commit is contained in:
parent
be21944818
commit
4d4ac5db3a
13
action.php
13
action.php
@ -59,12 +59,19 @@ switch ($VARS['action']) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "start":
|
case "start":
|
||||||
header('HTTP/1.0 204 No Content');
|
|
||||||
if (!$database->has('assigned_tasks', ["AND" => ['taskid' => $VARS['taskid'], 'userid' => $_SESSION['uid']]])) {
|
if (!$database->has('assigned_tasks', ["AND" => ['taskid' => $VARS['taskid'], 'userid' => $_SESSION['uid']]])) {
|
||||||
die('You are not assigned to this task!');
|
die('You are not assigned to this task!');
|
||||||
}
|
}
|
||||||
|
header('HTTP/1.0 204 No Content');
|
||||||
$database->update('assigned_tasks', ['#starttime' => 'NOW()', 'statusid' => 1], ["AND" => ['taskid' => $VARS['taskid'], 'userid' => $_SESSION['uid']]]);
|
$database->update('assigned_tasks', ['#starttime' => 'NOW()', 'statusid' => 1], ["AND" => ['taskid' => $VARS['taskid'], 'userid' => $_SESSION['uid']]]);
|
||||||
break;
|
break;
|
||||||
|
case "resume":
|
||||||
|
if (!$database->has('assigned_tasks', ["AND" => ['taskid' => $VARS['taskid'], 'userid' => $_SESSION['uid'], 'starttime[!]' => null]])) {
|
||||||
|
die('Invalid operation.');
|
||||||
|
}
|
||||||
|
header('HTTP/1.0 204 No Content');
|
||||||
|
$database->update('assigned_tasks', ['statusid' => 1], ["AND" => ['taskid' => $VARS['taskid'], 'userid' => $_SESSION['uid']]]);
|
||||||
|
break;
|
||||||
case "finish":
|
case "finish":
|
||||||
header('HTTP/1.0 204 No Content');
|
header('HTTP/1.0 204 No Content');
|
||||||
if (!$database->has('assigned_tasks', ["AND" => ['taskid' => $VARS['taskid'], 'userid' => $_SESSION['uid']]])) {
|
if (!$database->has('assigned_tasks', ["AND" => ['taskid' => $VARS['taskid'], 'userid' => $_SESSION['uid']]])) {
|
||||||
@ -73,17 +80,17 @@ switch ($VARS['action']) {
|
|||||||
$database->update('assigned_tasks', ['#endtime' => 'NOW()', 'statusid' => 2], ["AND" => ['taskid' => $VARS['taskid'], 'userid' => $_SESSION['uid']]]);
|
$database->update('assigned_tasks', ['#endtime' => 'NOW()', 'statusid' => 2], ["AND" => ['taskid' => $VARS['taskid'], 'userid' => $_SESSION['uid']]]);
|
||||||
break;
|
break;
|
||||||
case "pause":
|
case "pause":
|
||||||
header('HTTP/1.0 204 No Content');
|
|
||||||
if (!$database->has('assigned_tasks', ["AND" => ['taskid' => $VARS['taskid'], 'userid' => $_SESSION['uid']]])) {
|
if (!$database->has('assigned_tasks', ["AND" => ['taskid' => $VARS['taskid'], 'userid' => $_SESSION['uid']]])) {
|
||||||
die('You are not assigned to this task!');
|
die('You are not assigned to this task!');
|
||||||
}
|
}
|
||||||
|
header('HTTP/1.0 204 No Content');
|
||||||
$database->update('assigned_tasks', ['statusid' => 3], ["AND" => ['taskid' => $VARS['taskid'], 'userid' => $_SESSION['uid']]]);
|
$database->update('assigned_tasks', ['statusid' => 3], ["AND" => ['taskid' => $VARS['taskid'], 'userid' => $_SESSION['uid']]]);
|
||||||
break;
|
break;
|
||||||
case "problem":
|
case "problem":
|
||||||
header('HTTP/1.0 204 No Content');
|
|
||||||
if (!$database->has('assigned_tasks', ["AND" => ['taskid' => $VARS['taskid'], 'userid' => $_SESSION['uid']]])) {
|
if (!$database->has('assigned_tasks', ["AND" => ['taskid' => $VARS['taskid'], 'userid' => $_SESSION['uid']]])) {
|
||||||
die('You are not assigned to this task!');
|
die('You are not assigned to this task!');
|
||||||
}
|
}
|
||||||
|
header('HTTP/1.0 204 No Content');
|
||||||
$database->update('assigned_tasks', ['statusid' => 4], ["AND" => ['taskid' => $VARS['taskid'], 'userid' => $_SESSION['uid']]]);
|
$database->update('assigned_tasks', ['statusid' => 4], ["AND" => ['taskid' => $VARS['taskid'], 'userid' => $_SESSION['uid']]]);
|
||||||
break;
|
break;
|
||||||
case "edittask":
|
case "edittask":
|
||||||
|
@ -71,5 +71,7 @@ define("STRINGS", [
|
|||||||
"user not managed" => "You are not a manager of the selected user, and cannot assign a task to them.",
|
"user not managed" => "You are not a manager of the selected user, and cannot assign a task to them.",
|
||||||
"task edit not allowed" => "You are not allowed to edit that task.",
|
"task edit not allowed" => "You are not allowed to edit that task.",
|
||||||
"task delete not allowed" => "You are not allowed to delete that task.",
|
"task delete not allowed" => "You are not allowed to delete that task.",
|
||||||
"task deleted" => "Task deleted."
|
"task deleted" => "Task deleted.",
|
||||||
|
"finished on" => "Finished on: {date}",
|
||||||
|
"started on" => "Started on: {date}",
|
||||||
]);
|
]);
|
@ -24,7 +24,9 @@ $tasks = $database->select('tasks', [
|
|||||||
'taskassignedon (assigned)',
|
'taskassignedon (assigned)',
|
||||||
'taskdueby (due)',
|
'taskdueby (due)',
|
||||||
'userid',
|
'userid',
|
||||||
'statusid'
|
'statusid',
|
||||||
|
'starttime',
|
||||||
|
'endtime'
|
||||||
], [
|
], [
|
||||||
"AND" =>
|
"AND" =>
|
||||||
[
|
[
|
||||||
@ -92,9 +94,25 @@ if (count($tasks) > 0) {
|
|||||||
<div class='panel-footer'>
|
<div class='panel-footer'>
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<div class='col-xs-12 col-sm-8 col-md-8'>
|
<div class='col-xs-12 col-sm-8 col-md-8'>
|
||||||
<i class='fa fa-clock-o'></i> <?php lang2("assigned on", ["date" => ($task['assigned'] > 0 ? date("F j, Y, g:i a", strtotime($task['assigned'])) : lang("no assigned date", false))]) ?>
|
<i class='fa fa-hourglass-start fa-fw'></i> <?php lang2("assigned on", ["date" => ($task['assigned'] > 0 ? date("F j, Y, g:i a", strtotime($task['assigned'])) : lang("no assigned date", false))]) ?>
|
||||||
<br />
|
<br />
|
||||||
<i class='fa fa-clock-o'></i> <?php lang2("due by", ["date" => ($task['due'] > 0 ? date("F j, Y, g:i a", strtotime($task['due'])) : lang("no due date", false))]) ?>
|
<i class='fa fa-hourglass-end fa-fw'></i> <?php lang2("due by", ["date" => ($task['due'] > 0 ? date("F j, Y, g:i a", strtotime($task['due'])) : lang("no due date", false))]) ?>
|
||||||
|
<?php
|
||||||
|
if ($task['statusid'] > 0) {
|
||||||
|
?>
|
||||||
|
<br />
|
||||||
|
<i class='fa fa-play fa-fw'></i> <?php lang2("started on", ["date" => date("F j, Y, g:i a", strtotime($task['starttime']))]) ?>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
if ($task['statusid'] == 2) {
|
||||||
|
?>
|
||||||
|
<br />
|
||||||
|
<i class='fa fa-stop fa-fw'></i> <?php lang2("finished on", ["date" => date("F j, Y, g:i a", strtotime($task['endtime']))]) ?>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-xs-12 col-sm-4 col-md-4'>
|
<div class='col-xs-12 col-sm-4 col-md-4'>
|
||||||
<div class='pull-right'>
|
<div class='pull-right'>
|
||||||
|
@ -48,9 +48,25 @@ if (count($tasks) > 0) {
|
|||||||
<div class='panel-footer'>
|
<div class='panel-footer'>
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<div class='col-xs-12 col-sm-6 col-md-6 col-lg-5'>
|
<div class='col-xs-12 col-sm-6 col-md-6 col-lg-5'>
|
||||||
<i class='fa fa-clock-o'></i> <?php lang2("assigned on", ["date" => date("F j, Y, g:i a", strtotime($task['taskassignedon']))]) ?>
|
<i class='fa fa-hourglass-start fa-fw'></i> <?php lang2("assigned on", ["date" => date("F j, Y, g:i a", strtotime($task['taskassignedon']))]) ?>
|
||||||
<br />
|
<br />
|
||||||
<i class='fa fa-clock-o'></i> <?php lang2("due by", ["date" => ($task['taskdueby'] > 0 ? date("F j, Y, g:i a", strtotime($task['taskdueby'])) : "No due date")]) ?>
|
<i class='fa fa-hourglass-end fa-fw'></i> <?php lang2("due by", ["date" => ($task['taskdueby'] > 0 ? date("F j, Y, g:i a", strtotime($task['taskdueby'])) : "No due date")]) ?>
|
||||||
|
<?php
|
||||||
|
if ($task['statusid'] > 0) {
|
||||||
|
?>
|
||||||
|
<br />
|
||||||
|
<i class='fa fa-play fa-fw'></i> <?php lang2("started on", ["date" => date("F j, Y, g:i a", strtotime($task['starttime']))]) ?>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
if ($task['statusid'] == 2) {
|
||||||
|
?>
|
||||||
|
<br />
|
||||||
|
<i class='fa fa-stop fa-fw'></i> <?php lang2("finished on", ["date" => date("F j, Y, g:i a", strtotime($task['endtime']))]) ?>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-xs-12 col-sm-6 col-md-6 col-lg-7'>
|
<div class='col-xs-12 col-sm-6 col-md-6 col-lg-7'>
|
||||||
<?php lang("actions") ?>:<br />
|
<?php lang("actions") ?>:<br />
|
||||||
@ -83,10 +99,10 @@ if (count($tasks) > 0) {
|
|||||||
<?php
|
<?php
|
||||||
} else if ($task['statusid'] == 3 || $task['statusid'] == 4) {
|
} else if ($task['statusid'] == 3 || $task['statusid'] == 4) {
|
||||||
?>
|
?>
|
||||||
<form action='action.php' method='POST' onsubmit='$("#starttaskbtn<?php echo $task['taskid'] ?>").prop("disabled", true); refreshTasksSoon();' class='form-inline' style='display: inline-block;'>
|
<form action='action.php' method='POST' onsubmit='$("#resumetaskbtn<?php echo $task['taskid'] ?>").prop("disabled", true); refreshTasksSoon();' class='form-inline' style='display: inline-block;'>
|
||||||
<input type='hidden' name='taskid' value='<?php echo $task['taskid'] ?>' />
|
<input type='hidden' name='taskid' value='<?php echo $task['taskid'] ?>' />
|
||||||
<input type='hidden' name='action' value='start' />
|
<input type='hidden' name='action' value='resume' />
|
||||||
<button type='submit' id='starttaskbtn<?php echo $task['taskid'] ?>' class='btn btn-primary'><i class='fa fa-play'></i> <?php lang("resume") ?></button>
|
<button type='submit' id='resumetaskbtn<?php echo $task['taskid'] ?>' class='btn btn-primary'><i class='fa fa-play'></i> <?php lang("resume") ?></button>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user