mirror of
https://github.com/itflow-org/itflow
synced 2026-03-01 03:14:52 +00:00
FEATURE: Added Task Completion Estimate to the UI
This commit is contained in:
@@ -85,9 +85,9 @@ $sql_task_templates = mysqli_query($mysqli, "SELECT * FROM task_templates WHERE
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-tasks"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-tasks"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="task_name" placeholder="Task name">
|
<input type="text" class="form-control" name="task_name" placeholder="Create a task" required>
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<button type="submit" name="add_ticket_template_task" class="btn btn-primary"><i class="fas fa-fw fa-check mr-2"></i>Create</button>
|
<button type="submit" name="add_ticket_template_task" class="btn btn-primary"><i class="fas fa-fw fa-check"></i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -98,18 +98,29 @@ $sql_task_templates = mysqli_query($mysqli, "SELECT * FROM task_templates WHERE
|
|||||||
$task_id = intval($row['task_template_id']);
|
$task_id = intval($row['task_template_id']);
|
||||||
$task_name = nullable_htmlentities($row['task_template_name']);
|
$task_name = nullable_htmlentities($row['task_template_name']);
|
||||||
$task_order = intval($row['task_template_order']);
|
$task_order = intval($row['task_template_order']);
|
||||||
|
$task_completion_estimate = intval($row['task_template_completion_estimate']);
|
||||||
$task_description = nullable_htmlentities($row['task_template_description']);
|
$task_description = nullable_htmlentities($row['task_template_description']);
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><i class="far fa-fw fa-square text-secondary"></i></td>
|
<td><i class="far fa-fw fa-square text-secondary"></i></td>
|
||||||
<td><?php echo $task_name; ?></td>
|
<td><span class="text-secondary"><?php echo $task_completion_estimate; ?>m</span> - <?php echo $task_name; ?></td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<button type="button" class="btn btn-link btn-sm text-secondary" data-toggle="modal" data-target="#editTaskModal<?php echo $task_id; ?>">
|
<div class="float-right">
|
||||||
<i class="fa fa-fw fa-pencil-alt"></i>
|
<div class="dropdown dropleft text-center">
|
||||||
</button>
|
<button class="btn btn-link text-secondary btn-sm" type="button" data-toggle="dropdown">
|
||||||
<a href="post.php?delete_task_template=<?php echo $task_id; ?>" class="btn btn-link btn-sm text-danger">
|
<i class="fas fa-fw fa-ellipsis-v"></i>
|
||||||
<i class="fa fa-fw fa-trash-alt"></i>
|
</button>
|
||||||
</a>
|
<div class="dropdown-menu">
|
||||||
|
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editTaskModal<?php echo $task_id; ?>">
|
||||||
|
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<a class="dropdown-item text-danger confirm-link" href="post.php?delete_task_template=<?php echo $task_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
|
||||||
|
<i class="fas fa-fw fa-trash-alt mr-2"></i>Delete
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ if (isset($_POST['edit_task'])) {
|
|||||||
$task_id = intval($_POST['task_id']);
|
$task_id = intval($_POST['task_id']);
|
||||||
$task_name = sanitizeInput($_POST['name']);
|
$task_name = sanitizeInput($_POST['name']);
|
||||||
$task_order = intval($_POST['order']);
|
$task_order = intval($_POST['order']);
|
||||||
|
$task_completion_estimate = intval($_POST['completion_estimate']);
|
||||||
$is_ticket = intval($_POST['is_ticket']);
|
$is_ticket = intval($_POST['is_ticket']);
|
||||||
|
|
||||||
if($is_ticket == 1) {
|
if($is_ticket == 1) {
|
||||||
@@ -42,10 +43,10 @@ if (isset($_POST['edit_task'])) {
|
|||||||
$sql = mysqli_query($mysqli, "SELECT * FROM tasks LEFT JOIN tickets ON ticket_id = task_ticket_id WHERE task_id = $task_id");
|
$sql = mysqli_query($mysqli, "SELECT * FROM tasks LEFT JOIN tickets ON ticket_id = task_ticket_id WHERE task_id = $task_id");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_array($sql);
|
||||||
$client_id = intval($row['ticket_client_id']);
|
$client_id = intval($row['ticket_client_id']);
|
||||||
mysqli_query($mysqli, "UPDATE tasks SET task_name = '$task_name', task_order = $task_order WHERE task_id = $task_id");
|
mysqli_query($mysqli, "UPDATE tasks SET task_name = '$task_name', task_order = $task_order, task_completion_estimate = $task_completion_estimate WHERE task_id = $task_id");
|
||||||
} else {
|
} else {
|
||||||
$client_id = 0;
|
$client_id = 0;
|
||||||
mysqli_query($mysqli, "UPDATE task_templates SET task_template_name = '$task_name', task_template_order = $task_order WHERE task_template_id = $task_id");
|
mysqli_query($mysqli, "UPDATE task_templates SET task_template_name = '$task_name', task_template_order = $task_order, task_template_completion_estimate = $task_completion_estimate WHERE task_template_id = $task_id");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
@@ -94,12 +95,16 @@ if (isset($_GET['complete_task'])) {
|
|||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_array($sql);
|
||||||
$client_id = intval($row['ticket_client_id']);
|
$client_id = intval($row['ticket_client_id']);
|
||||||
$task_name = sanitizeInput($row['task_name']);
|
$task_name = sanitizeInput($row['task_name']);
|
||||||
|
$task_completion_estimate = intval($row['task_completion_estimate']);
|
||||||
$ticket_id = intval($row['ticket_id']);
|
$ticket_id = intval($row['ticket_id']);
|
||||||
|
|
||||||
mysqli_query($mysqli, "UPDATE tasks SET task_completed_at = NOW(), task_completed_by = $session_user_id WHERE task_id = $task_id");
|
mysqli_query($mysqli, "UPDATE tasks SET task_completed_at = NOW(), task_completed_by = $session_user_id WHERE task_id = $task_id");
|
||||||
|
|
||||||
|
// Convert task completion estimate from minutes to TIME format
|
||||||
|
$time_worked = gmdate("H:i:s", $task_completion_estimate * 60); // Convert minutes to HH:MM:SS
|
||||||
|
|
||||||
// Add reply
|
// Add reply
|
||||||
mysqli_query($mysqli, "INSERT INTO ticket_replies SET ticket_reply = 'Completed Task - $task_name', ticket_reply_time_worked = '00:05:00', ticket_reply_type = 'Internal', ticket_reply_by = $session_user_id, ticket_reply_ticket_id = $ticket_id");
|
mysqli_query($mysqli, "INSERT INTO ticket_replies SET ticket_reply = 'Completed Task - $task_name', ticket_reply_time_worked = '$time_worked', ticket_reply_type = 'Internal', ticket_reply_by = $session_user_id, ticket_reply_ticket_id = $ticket_id");
|
||||||
|
|
||||||
$ticket_reply_id = mysqli_insert_id($mysqli);
|
$ticket_reply_id = mysqli_insert_id($mysqli);
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,16 @@
|
|||||||
<input type="number" class="form-control" name="order" placeholder="Order" value="<?php echo $task_order; ?>">
|
<input type="number" class="form-control" name="order" placeholder="Order" value="<?php echo $task_order; ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Estimated Completion Time <span class="text-secondary">(Minutes)</span></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-clock"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="number" class="form-control" name="completion_estimate" placeholder="Estimated time to complete task in mins" value="<?php echo $task_completion_estimate; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -894,6 +894,7 @@ if (isset($_GET['ticket_id'])) {
|
|||||||
$task_name = nullable_htmlentities($row['task_name']);
|
$task_name = nullable_htmlentities($row['task_name']);
|
||||||
$task_order = intval($row['task_order']);
|
$task_order = intval($row['task_order']);
|
||||||
//$task_description = nullable_htmlentities($row['task_description']); // not in db yet
|
//$task_description = nullable_htmlentities($row['task_description']); // not in db yet
|
||||||
|
$task_completion_estimate = intval($row['task_completion_estimate']);
|
||||||
$task_completed_at = nullable_htmlentities($row['task_completed_at']);
|
$task_completed_at = nullable_htmlentities($row['task_completed_at']);
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -906,7 +907,7 @@ if (isset($_GET['ticket_id'])) {
|
|||||||
</a>
|
</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</td>
|
</td>
|
||||||
<td><?php echo $task_name; ?></td>
|
<td><span class="text-secondary"><?php echo $task_completion_estimate; ?>m</span> - <?php echo $task_name; ?></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="float-right">
|
<div class="float-right">
|
||||||
<?php if (empty($ticket_closed_at) && lookupUserPermission("module_support") >= 2) { ?>
|
<?php if (empty($ticket_closed_at) && lookupUserPermission("module_support") >= 2) { ?>
|
||||||
|
|||||||
Reference in New Issue
Block a user