mirror of https://github.com/itflow-org/itflow
commit
b318872ba8
|
|
@ -17,7 +17,7 @@ if (isset($_GET['leads'])) {
|
|||
$leads = intval($_GET['leads']);
|
||||
}
|
||||
|
||||
if($leads == 1){
|
||||
if ($leads == 1){
|
||||
$leads_query = 1;
|
||||
} else {
|
||||
$leads_query = 0;
|
||||
|
|
@ -35,7 +35,7 @@ if (isset($_GET['tags']) && is_array($_GET['tags']) && !empty($_GET['tags'])) {
|
|||
// Convert the sanitized tags into a comma-separated string
|
||||
$sanitizedTagsString = implode(",", $sanitizedTags);
|
||||
$tag_query = "AND tags.tag_id IN ($sanitizedTagsString)";
|
||||
} else{
|
||||
} else {
|
||||
$tag_query = '';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
if (isset($_POST['add_project'])) {
|
||||
|
||||
validateTechRole();
|
||||
enforceUserPermission('module_support', 2);
|
||||
|
||||
$project_name = sanitizeInput($_POST['name']);
|
||||
$project_description = sanitizeInput($_POST['description']);
|
||||
|
|
@ -78,7 +78,7 @@ if (isset($_POST['add_project'])) {
|
|||
|
||||
if (isset($_POST['edit_project'])) {
|
||||
|
||||
validateTechRole();
|
||||
enforceUserPermission('module_support', 2);
|
||||
|
||||
$project_id = intval($_POST['project_id']);
|
||||
$project_name = sanitizeInput($_POST['name']);
|
||||
|
|
@ -99,7 +99,7 @@ if (isset($_POST['edit_project'])) {
|
|||
|
||||
if (isset($_GET['close_project'])) {
|
||||
|
||||
validateTechRole();
|
||||
enforceUserPermission('module_support', 2);
|
||||
|
||||
$project_id = intval($_GET['close_project']);
|
||||
|
||||
|
|
@ -119,9 +119,52 @@ if (isset($_GET['close_project'])) {
|
|||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
|
||||
if (isset($_GET['archive_project'])) {
|
||||
|
||||
enforceUserPermission('module_support', 2);
|
||||
|
||||
$project_id = intval($_GET['archive_project']);
|
||||
|
||||
// Get Client Name
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM projects WHERE project_id = $project_id");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$project_name = sanitizeInput($row['project_name']);
|
||||
|
||||
mysqli_query($mysqli, "UPDATE projects SET project_archived_at = NOW() WHERE project_id = $project_id");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Project', log_action = 'Archive', log_description = '$session_name archived project $project_name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id, log_entity_id = $project_id");
|
||||
|
||||
$_SESSION['alert_type'] = "error";
|
||||
$_SESSION['alert_message'] = "Project $project_name archived";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
|
||||
if (isset($_GET['unarchive_project'])) {
|
||||
|
||||
enforceUserPermission('module_support', 2);
|
||||
|
||||
$project_id = intval($_GET['unarchive_project']);
|
||||
|
||||
// Get Client Name
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM projects WHERE project_id = $project_id");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$project_name = sanitizeInput($row['project_name']);
|
||||
|
||||
mysqli_query($mysqli, "UPDATE projects SET project_archived_at = NULL WHERE project_id = $project_id");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Project', log_action = 'Undo Archive', log_description = '$session_name unarchived project $project_name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id, log_entity_id = $project_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Project $project_name unarchived";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
|
||||
if (isset($_GET['delete_project'])) {
|
||||
|
||||
validateTechRole();
|
||||
enforceUserPermission('module_support', 3);
|
||||
|
||||
$project_id = intval($_GET['delete_project']);
|
||||
|
||||
|
|
@ -134,7 +177,7 @@ if (isset($_GET['delete_project'])) {
|
|||
mysqli_query($mysqli, "DELETE FROM projects WHERE project_id = $project_id");
|
||||
|
||||
// Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Projects', log_action = 'Delete', log_description = '$session_name deleted project $project_name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $project_id");
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Project', log_action = 'Delete', log_description = '$session_name deleted project $project_name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $project_id");
|
||||
|
||||
$_SESSION['alert_type'] = "error";
|
||||
$_SESSION['alert_message'] = "You Deleted Project <strong>$project_name</strong>";
|
||||
|
|
@ -144,7 +187,7 @@ if (isset($_GET['delete_project'])) {
|
|||
|
||||
if (isset($_POST['add_project_ticket'])) {
|
||||
|
||||
validateTechRole();
|
||||
enforceUserPermission('module_support', 2);
|
||||
$project_id = intval($_POST['project_id']);
|
||||
|
||||
// Get Project Name
|
||||
|
|
|
|||
|
|
@ -22,16 +22,17 @@ if (isset($_GET['project_id'])) {
|
|||
}
|
||||
|
||||
$row = mysqli_fetch_array($sql_project);
|
||||
|
||||
|
||||
$project_id = intval($row['project_id']);
|
||||
$project_prefix = nullable_htmlentities($row['project_prefix']);
|
||||
$project_number = intval($row['project_number']);
|
||||
$project_name = nullable_htmlentities($row['project_name']);
|
||||
$project_description = nullable_htmlentities($row['project_description']);
|
||||
$project_due = nullable_htmlentities($row['project_due']);
|
||||
$project_completed_at = nullable_htmlentities($row['project_completed_at']);
|
||||
$project_created_at = date("Y-m-d", strtotime($row['project_created_at']));
|
||||
$project_updated_at = nullable_htmlentities($row['project_updated_at']);
|
||||
$project_completed_at = nullable_htmlentities($row['project_completed_at']);
|
||||
$project_archived_at = nullable_htmlentities($row['project_archived_at']);
|
||||
|
||||
$client_id = intval($row['client_id']);
|
||||
$client_name = nullable_htmlentities($row['client_name']);
|
||||
|
|
@ -49,7 +50,7 @@ if (isset($_GET['project_id'])) {
|
|||
$project_manager_display = "-";
|
||||
}
|
||||
|
||||
if($project_completed_at) {
|
||||
if ($project_completed_at) {
|
||||
$project_status_display = "<span class='badge badge-pill badge-dark ml-2'>Closed</span>";
|
||||
$project_completed_date_display = "<div class='text-primary text-bold'><small><i class='fa fa-fw fa-door-closed mr-2'></i>" . date('Y-m-d', strtotime($project_completed_at)) . "</small></div>";
|
||||
} else {
|
||||
|
|
@ -70,8 +71,9 @@ if (isset($_GET['project_id'])) {
|
|||
$sql_closed_tickets = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_project_id = $project_id AND ticket_closed_at IS NOT NULL");
|
||||
|
||||
$closed_ticket_count = mysqli_num_rows($sql_closed_tickets);
|
||||
|
||||
if($ticket_count) {
|
||||
|
||||
$tickets_closed_percent = 100; //Default
|
||||
if ($ticket_count) {
|
||||
$tickets_closed_percent = round(($closed_ticket_count / $ticket_count) * 100);
|
||||
}
|
||||
|
||||
|
|
@ -94,7 +96,7 @@ if (isset($_GET['project_id'])) {
|
|||
$completed_task_count = mysqli_num_rows($sql_tasks_completed);
|
||||
|
||||
// Tasks Completed Percent
|
||||
if($task_count) {
|
||||
if ($task_count) {
|
||||
$tasks_completed_percent = round(($completed_task_count / $task_count) * 100);
|
||||
}
|
||||
|
||||
|
|
@ -119,291 +121,291 @@ if (isset($_GET['project_id'])) {
|
|||
|
||||
// The user names in a comma-separated string
|
||||
$ticket_collaborators = nullable_htmlentities($row['user_names']);
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<!-- Breadcrumbs-->
|
||||
<ol class="breadcrumb d-print-none">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="projects.php">Projects</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active">Project Details</li>
|
||||
</ol>
|
||||
<!-- Breadcrumbs-->
|
||||
<ol class="breadcrumb d-print-none">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="projects.php">Projects</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active">Project Details</li>
|
||||
</ol>
|
||||
|
||||
<!-- Project Header -->
|
||||
<div class="card card-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="media">
|
||||
<i class="fa fa-fw fa-2x fa-project-diagram text-secondary mr-3"></i>
|
||||
<div class="media-body">
|
||||
<h3 class="mb-0"><?php echo "$project_prefix$project_number$project_status_display<br><small>$project_name</small>"; ?></h3>
|
||||
<div><small class="text-secondary"><?php echo $project_description; ?></small></div>
|
||||
<!-- Project Header -->
|
||||
<div class="card card-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="media">
|
||||
<i class="fa fa-fw fa-2x fa-project-diagram text-secondary mr-3"></i>
|
||||
<div class="media-body">
|
||||
<h3 class="mb-0"><?php echo "$project_prefix$project_number$project_status_display<br><small>$project_name</small>"; ?></h3>
|
||||
<div><small class="text-secondary"><?php echo $project_description; ?></small></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<div><?php echo $client_name_display; ?></div>
|
||||
<div><?php echo $project_manager_display; ?></div>
|
||||
<div class='text-secondary'><i class='fa fa-fw fa-clock mr-2'></i><?php echo $project_due; ?></div>
|
||||
<div><?php echo $project_completed_date_display; ?></div>
|
||||
<!-- Time tracking -->
|
||||
<?php if ($ticket_total_reply_time) { ?>
|
||||
<div>
|
||||
<i class="far fa-fw fa-clock text-secondary mr-2"></i>Total time worked: <?php echo $ticket_total_reply_time; ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<?php if($ticket_count) { ?>
|
||||
<div class="progress" style="height: 20px;">
|
||||
<i class="fa fas fa-fw fa-life-ring mr-2"></i>
|
||||
<div class="progress-bar bg-primary" style="width: <?php echo $tickets_closed_percent; ?>%;"><?php echo $closed_ticket_count; ?> / <?php echo $ticket_count; ?></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if($task_count) { ?>
|
||||
<div class="progress mt-2" style="height: 20px;">
|
||||
<i class="fa fas fa-fw fa-tasks mr-2"></i>
|
||||
<div class="progress-bar bg-secondary" style="width: <?php echo $tasks_completed_percent; ?>%;"><?php echo $completed_task_count; ?> / <?php echo $task_count; ?></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if($ticket_collaborators) { ?>
|
||||
<div class=mt-1>
|
||||
<i class="fas fa-fw fa-users mr-2 text-secondary"></i><?php echo $ticket_collaborators; ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<div class="btn-group float-right d-print-none">
|
||||
<?php if($tickets_closed_percent == 100 && empty($project_completed_at)) { ?>
|
||||
<a class="btn btn-primary btn-sm confirm-link" href="post.php?close_project=<?php echo $project_id; ?>">
|
||||
<i class="fas fa-fw fa-check mr-2"></i>Close
|
||||
</a>
|
||||
<?php } else { ?>
|
||||
<button type="button" class="btn btn-primary btn-sm" href="#" data-toggle="modal" data-target="#addProjectTicketModal">
|
||||
<i class="fas fa-fw fa-plus mr-2"></i>Add Ticket
|
||||
</button>
|
||||
<div class="col-sm-3">
|
||||
<div><?php echo $client_name_display; ?></div>
|
||||
<div><?php echo $project_manager_display; ?></div>
|
||||
<div class='text-secondary'><i class='fa fa-fw fa-clock mr-2'></i><?php echo $project_due; ?></div>
|
||||
<div><?php echo $project_completed_date_display; ?></div>
|
||||
<!-- Time tracking -->
|
||||
<?php if ($ticket_total_reply_time) { ?>
|
||||
<div>
|
||||
<i class="far fa-fw fa-clock text-secondary mr-2"></i>Total time worked: <?php echo $ticket_total_reply_time; ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="dropdown dropleft text-center ml-3">
|
||||
<button class="btn btn-secondary btn-sm" type="button" id="dropdownMenuButton" data-toggle="dropdown">
|
||||
<i class="fas fa-fw fa-ellipsis-v"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<?php if(empty($project_completed_at)) { ?>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editProjectModal<?php echo $project_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<?php if ($ticket_count) { ?>
|
||||
<div class="progress" style="height: 20px;">
|
||||
<i class="fa fas fa-fw fa-life-ring mr-2"></i>
|
||||
<div class="progress-bar bg-primary" style="width: <?php echo $tickets_closed_percent; ?>%;"><?php echo $closed_ticket_count; ?> / <?php echo $ticket_count; ?></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if ($task_count) { ?>
|
||||
<div class="progress mt-2" style="height: 20px;">
|
||||
<i class="fa fas fa-fw fa-tasks mr-2"></i>
|
||||
<div class="progress-bar bg-secondary" style="width: <?php echo $tasks_completed_percent; ?>%;"><?php echo $completed_task_count; ?> / <?php echo $task_count; ?></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if ($ticket_collaborators) { ?>
|
||||
<div class=mt-1>
|
||||
<i class="fas fa-fw fa-users mr-2 text-secondary"></i><?php echo $ticket_collaborators; ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<div class="btn-group float-right d-print-none">
|
||||
<?php if ($tickets_closed_percent == 100 && empty($project_completed_at)) { ?>
|
||||
<a class="btn btn-primary btn-sm confirm-link" href="post.php?close_project=<?php echo $project_id; ?>">
|
||||
<i class="fas fa-fw fa-check mr-2"></i>Close
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<?php } ?>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?archive_project=<?php echo $project_id; ?>">
|
||||
<i class="fas fa-fw fa-archive mr-2"></i>Archive
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger confirm-link" href="post.php?delete_project=<?php echo $project_id; ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php if (empty($project_completed_at)) { ?>
|
||||
<button type="button" class="btn btn-primary btn-sm" href="#" data-toggle="modal" data-target="#addProjectTicketModal">
|
||||
<i class="fas fa-fw fa-plus mr-2"></i>Add Ticket
|
||||
</button>
|
||||
<?php } ?>
|
||||
<div class="dropdown dropleft text-center ml-3">
|
||||
<button class="btn btn-secondary btn-sm" type="button" id="dropdownMenuButton" data-toggle="dropdown">
|
||||
<i class="fas fa-fw fa-ellipsis-v"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<?php if (empty($project_completed_at)) { ?>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editProjectModal<?php echo $project_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if (!empty($project_completed_at) && empty($project_archived_at) && lookupUserPermission("module_support" >= 2)) { ?>
|
||||
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?archive_project=<?php echo $project_id; ?>">
|
||||
<i class="fas fa-fw fa-archive mr-2"></i>Archive
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if (!empty($project_archived_at) && lookupUserPermission("module_support" >= 3)) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger confirm-link" href="post.php?delete_project=<?php echo $project_id; ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
|
||||
<!-- Tickets card -->
|
||||
<?php if (mysqli_num_rows($sql_tickets) > 0) { ?>
|
||||
<div class="card card-body card-outline card-dark mb-3">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
|
||||
<h5 class="text-secondary"><i class="fa fa-fw fa-life-ring mr-2"></i>Project Tickets</h5>
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table table-striped table-borderless table-hover">
|
||||
<thead class="text-dark">
|
||||
<tr>
|
||||
<th>Ticket</th>
|
||||
<th>Priority</th>
|
||||
<th>Status</th>
|
||||
<th>Assigned</th>
|
||||
<th>Last Response</th>
|
||||
<th>Client</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
<!-- Tickets card -->
|
||||
<?php if (mysqli_num_rows($sql_tickets) > 0) { ?>
|
||||
<div class="card card-body card-outline card-dark mb-3">
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_tickets)) {
|
||||
$ticket_id = intval($row['ticket_id']);
|
||||
$ticket_prefix = nullable_htmlentities($row['ticket_prefix']);
|
||||
$ticket_number = nullable_htmlentities($row['ticket_number']);
|
||||
$ticket_subject = nullable_htmlentities($row['ticket_subject']);
|
||||
$ticket_priority = nullable_htmlentities($row['ticket_priority']);
|
||||
$ticket_status = intval($row['ticket_status']);
|
||||
$ticket_status_name = nullable_htmlentities($row['ticket_status_name']);
|
||||
$ticket_status_color = nullable_htmlentities($row['ticket_status_color']);
|
||||
$ticket_billable = intval($row['ticket_billable']);
|
||||
$ticket_created_at = nullable_htmlentities($row['ticket_created_at']);
|
||||
$ticket_created_at_time_ago = timeAgo($row['ticket_created_at']);
|
||||
$ticket_updated_at = nullable_htmlentities($row['ticket_updated_at']);
|
||||
$ticket_updated_at_time_ago = timeAgo($row['ticket_updated_at']);
|
||||
if (empty($ticket_updated_at)) {
|
||||
if ($ticket_status == 5) {
|
||||
$ticket_updated_at_display = "<p>Never</p>";
|
||||
<h5 class="text-secondary"><i class="fa fa-fw fa-life-ring mr-2"></i>Project Tickets</h5>
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table table-striped table-borderless table-hover">
|
||||
<thead class="text-dark">
|
||||
<tr>
|
||||
<th>Ticket</th>
|
||||
<th>Priority</th>
|
||||
<th>Status</th>
|
||||
<th>Assigned</th>
|
||||
<th>Last Response</th>
|
||||
<th>Client</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_tickets)) {
|
||||
$ticket_id = intval($row['ticket_id']);
|
||||
$ticket_prefix = nullable_htmlentities($row['ticket_prefix']);
|
||||
$ticket_number = nullable_htmlentities($row['ticket_number']);
|
||||
$ticket_subject = nullable_htmlentities($row['ticket_subject']);
|
||||
$ticket_priority = nullable_htmlentities($row['ticket_priority']);
|
||||
$ticket_status = intval($row['ticket_status']);
|
||||
$ticket_status_name = nullable_htmlentities($row['ticket_status_name']);
|
||||
$ticket_status_color = nullable_htmlentities($row['ticket_status_color']);
|
||||
$ticket_billable = intval($row['ticket_billable']);
|
||||
$ticket_created_at = nullable_htmlentities($row['ticket_created_at']);
|
||||
$ticket_created_at_time_ago = timeAgo($row['ticket_created_at']);
|
||||
$ticket_updated_at = nullable_htmlentities($row['ticket_updated_at']);
|
||||
$ticket_updated_at_time_ago = timeAgo($row['ticket_updated_at']);
|
||||
if (empty($ticket_updated_at)) {
|
||||
if ($ticket_status == 5) {
|
||||
$ticket_updated_at_display = "<p>Never</p>";
|
||||
} else {
|
||||
$ticket_updated_at_display = "<p class='text-danger'>Never</p>";
|
||||
}
|
||||
} else {
|
||||
$ticket_updated_at_display = "<p class='text-danger'>Never</p>";
|
||||
$ticket_updated_at_display = "$ticket_updated_at_time_ago<br><small class='text-secondary'>$ticket_updated_at</small>";
|
||||
}
|
||||
} else {
|
||||
$ticket_updated_at_display = "$ticket_updated_at_time_ago<br><small class='text-secondary'>$ticket_updated_at</small>";
|
||||
}
|
||||
$ticket_closed_at = nullable_htmlentities($row['ticket_closed_at']);
|
||||
$ticket_closed_at = nullable_htmlentities($row['ticket_closed_at']);
|
||||
|
||||
if ($ticket_priority == "High") {
|
||||
$ticket_priority_display = "<span class='p-2 badge badge-danger'>$ticket_priority</span>";
|
||||
} elseif ($ticket_priority == "Medium") {
|
||||
$ticket_priority_display = "<span class='p-2 badge badge-warning'>$ticket_priority</span>";
|
||||
} elseif ($ticket_priority == "Low") {
|
||||
$ticket_priority_display = "<span class='p-2 badge badge-info'>$ticket_priority</span>";
|
||||
} else{
|
||||
$ticket_priority_display = "-";
|
||||
}
|
||||
if ($ticket_priority == "High") {
|
||||
$ticket_priority_display = "<span class='p-2 badge badge-danger'>$ticket_priority</span>";
|
||||
} elseif ($ticket_priority == "Medium") {
|
||||
$ticket_priority_display = "<span class='p-2 badge badge-warning'>$ticket_priority</span>";
|
||||
} elseif ($ticket_priority == "Low") {
|
||||
$ticket_priority_display = "<span class='p-2 badge badge-info'>$ticket_priority</span>";
|
||||
} else{
|
||||
$ticket_priority_display = "-";
|
||||
}
|
||||
|
||||
$ticket_assigned_to = intval($row['ticket_assigned_to']);
|
||||
if (empty($ticket_assigned_to)) {
|
||||
if ($ticket_status == 5) {
|
||||
$ticket_assigned_to_display = "<p>Not Assigned</p>";
|
||||
$ticket_assigned_to = intval($row['ticket_assigned_to']);
|
||||
if (empty($ticket_assigned_to)) {
|
||||
if ($ticket_status == 5) {
|
||||
$ticket_assigned_to_display = "<p>Not Assigned</p>";
|
||||
} else {
|
||||
$ticket_assigned_to_display = "<p class='text-danger'>Not Assigned</p>";
|
||||
}
|
||||
} else {
|
||||
$ticket_assigned_to_display = "<p class='text-danger'>Not Assigned</p>";
|
||||
$ticket_assigned_to_display = nullable_htmlentities($row['user_name']);
|
||||
}
|
||||
} else {
|
||||
$ticket_assigned_to_display = nullable_htmlentities($row['user_name']);
|
||||
}
|
||||
|
||||
$project_id = intval($row['ticket_project_id']);
|
||||
|
||||
$client_id = intval($row['client_id']);
|
||||
$client_name = nullable_htmlentities($row['client_name']);
|
||||
|
||||
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||
$contact_email = nullable_htmlentities($row['contact_email']);
|
||||
$contact_archived_at = nullable_htmlentities($row['contact_archived_at']);
|
||||
if (empty($contact_archived_at)) {
|
||||
$contact_archived_display = "";
|
||||
} else {
|
||||
$contact_archived_display = "Archived - ";
|
||||
}
|
||||
if (empty($contact_name)) {
|
||||
$contact_display = "-";
|
||||
} else {
|
||||
$contact_display = "$contact_archived_display$contact_name<br><small class='text-secondary'>$contact_email</small>";
|
||||
}
|
||||
$project_id = intval($row['ticket_project_id']);
|
||||
|
||||
// Get who last updated the ticket - to be shown in the last Response column
|
||||
$ticket_reply_type = "Client"; // Default to client for unreplied tickets
|
||||
$ticket_reply_by_display = ""; // Default none
|
||||
$sql_ticket_reply = mysqli_query($mysqli, "SELECT ticket_reply_type, contact_name, user_name FROM ticket_replies
|
||||
$client_id = intval($row['client_id']);
|
||||
$client_name = nullable_htmlentities($row['client_name']);
|
||||
|
||||
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||
$contact_email = nullable_htmlentities($row['contact_email']);
|
||||
$contact_archived_at = nullable_htmlentities($row['contact_archived_at']);
|
||||
if (empty($contact_archived_at)) {
|
||||
$contact_archived_display = "";
|
||||
} else {
|
||||
$contact_archived_display = "Archived - ";
|
||||
}
|
||||
if (empty($contact_name)) {
|
||||
$contact_display = "-";
|
||||
} else {
|
||||
$contact_display = "$contact_archived_display$contact_name<br><small class='text-secondary'>$contact_email</small>";
|
||||
}
|
||||
|
||||
// Get who last updated the ticket - to be shown in the last Response column
|
||||
$ticket_reply_type = "Client"; // Default to client for unreplied tickets
|
||||
$ticket_reply_by_display = ""; // Default none
|
||||
$sql_ticket_reply = mysqli_query($mysqli, "SELECT ticket_reply_type, contact_name, user_name FROM ticket_replies
|
||||
LEFT JOIN users ON ticket_reply_by = user_id
|
||||
LEFT JOIN contacts ON ticket_reply_by = contact_id
|
||||
WHERE ticket_reply_ticket_id = $ticket_id
|
||||
AND ticket_reply_archived_at IS NULL
|
||||
ORDER BY ticket_reply_id DESC LIMIT 1"
|
||||
);
|
||||
$row = mysqli_fetch_array($sql_ticket_reply);
|
||||
);
|
||||
$row = mysqli_fetch_array($sql_ticket_reply);
|
||||
|
||||
if ($row) {
|
||||
$ticket_reply_type = nullable_htmlentities($row['ticket_reply_type']);
|
||||
if ($ticket_reply_type == "Client") {
|
||||
$ticket_reply_by_display = nullable_htmlentities($row['contact_name']);
|
||||
} else {
|
||||
$ticket_reply_by_display = nullable_htmlentities($row['user_name']);
|
||||
if ($row) {
|
||||
$ticket_reply_type = nullable_htmlentities($row['ticket_reply_type']);
|
||||
if ($ticket_reply_type == "Client") {
|
||||
$ticket_reply_by_display = nullable_htmlentities($row['contact_name']);
|
||||
} else {
|
||||
$ticket_reply_by_display = nullable_htmlentities($row['user_name']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<tr>
|
||||
|
||||
<!-- Ticket Number / Subject -->
|
||||
<td>
|
||||
<a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>">
|
||||
<span class="badge badge-pill badge-secondary p-3 mr-2"><?php echo "$ticket_prefix$ticket_number"; ?></span>
|
||||
<?php echo $ticket_subject; ?>
|
||||
</a>
|
||||
</td>
|
||||
<!-- Ticket Priority -->
|
||||
<td><?php echo $ticket_priority_display; ?></a></td>
|
||||
|
||||
<!-- Ticket Status -->
|
||||
<td>
|
||||
<span class='badge badge-pill text-light p-2' style="background-color: <?php echo $ticket_status_color; ?>"><?php echo $ticket_status_name; ?></span>
|
||||
</td>
|
||||
|
||||
<!-- Ticket Assigned agent -->
|
||||
<td><?php echo $ticket_assigned_to_display; ?></td>
|
||||
|
||||
<!-- Ticket Last Response -->
|
||||
<td>
|
||||
<div><?php echo $ticket_updated_at_display; ?></div>
|
||||
<div><?php echo $ticket_reply_by_display; ?></div>
|
||||
</td>
|
||||
<td><?php echo $client_name; ?></td>
|
||||
</tr>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
|
||||
<!-- Tasks Card -->
|
||||
<?php if (mysqli_num_rows($sql_tasks) > 0) { ?>
|
||||
<div class="card card-body card-outline card-dark">
|
||||
<h5 class="text-secondary"><i class="fas fa-fw fa-tasks mr-2"></i>All Tasks</h5>
|
||||
<table class="table">
|
||||
<?php
|
||||
while($row = mysqli_fetch_array($sql_tasks)){
|
||||
$task_id = intval($row['task_id']);
|
||||
$task_name = nullable_htmlentities($row['task_name']);
|
||||
$task_description = nullable_htmlentities($row['task_description']);
|
||||
$task_completed_at = nullable_htmlentities($row['task_completed_at']);
|
||||
?>
|
||||
|
||||
<tr>
|
||||
|
||||
<!-- Ticket Number / Subject -->
|
||||
<td>
|
||||
<a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>">
|
||||
<span class="badge badge-pill badge-secondary p-3 mr-2"><?php echo "$ticket_prefix$ticket_number"; ?></span>
|
||||
<?php echo $ticket_subject; ?>
|
||||
</a>
|
||||
<?php if ($task_completed_at) { ?>
|
||||
<i class="far fa-fw fa-check-square text-primary mr-3"></i>
|
||||
<?php } else { ?>
|
||||
<a href="post.php?complete_task=<?php echo $task_id; ?>">
|
||||
<i class="far fa-fw fa-square text-secondary mr-3"></i>
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php echo $task_name; ?>
|
||||
</td>
|
||||
<!-- Ticket Priority -->
|
||||
<td><?php echo $ticket_priority_display; ?></a></td>
|
||||
|
||||
<!-- Ticket Status -->
|
||||
<td>
|
||||
<span class='badge badge-pill text-light p-2' style="background-color: <?php echo $ticket_status_color; ?>"><?php echo $ticket_status_name; ?></span>
|
||||
</td>
|
||||
|
||||
<!-- Ticket Assigned agent -->
|
||||
<td><?php echo $ticket_assigned_to_display; ?></td>
|
||||
|
||||
<!-- Ticket Last Response -->
|
||||
<td>
|
||||
<div><?php echo $ticket_updated_at_display; ?></div>
|
||||
<div><?php echo $ticket_reply_by_display; ?></div>
|
||||
</td>
|
||||
<td><?php echo $client_name; ?></td>
|
||||
</tr>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<!-- End Tasks Card -->
|
||||
|
||||
<div class="col-md-4">
|
||||
|
||||
<!-- Tasks Card -->
|
||||
<?php if (mysqli_num_rows($sql_tasks) > 0) { ?>
|
||||
<div class="card card-body card-outline card-dark">
|
||||
<h5 class="text-secondary"><i class="fas fa-fw fa-tasks mr-2"></i>All Tasks</h5>
|
||||
<table class="table">
|
||||
<?php
|
||||
while($row = mysqli_fetch_array($sql_tasks)){
|
||||
$task_id = intval($row['task_id']);
|
||||
$task_name = nullable_htmlentities($row['task_name']);
|
||||
$task_description = nullable_htmlentities($row['task_description']);
|
||||
$task_completed_at = nullable_htmlentities($row['task_completed_at']);
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php if($task_completed_at) { ?>
|
||||
<i class="far fa-fw fa-check-square text-primary mr-3"></i>
|
||||
<?php } else { ?>
|
||||
<a href="post.php?complete_task=<?php echo $task_id; ?>">
|
||||
<i class="far fa-fw fa-square text-secondary mr-3"></i>
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php echo $task_name; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<!-- End Tasks Card -->
|
||||
</div> <!-- End col-3 -->
|
||||
|
||||
</div> <!-- End col-3 -->
|
||||
</div> <!-- End row -->
|
||||
|
||||
</div> <!-- End row -->
|
||||
<?php
|
||||
|
||||
<?php
|
||||
|
||||
require_once "project_edit_modal.php";
|
||||
require_once "project_ticket_add_modal.php";
|
||||
require_once "project_edit_modal.php";
|
||||
require_once "project_ticket_add_modal.php";
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
49
projects.php
49
projects.php
|
|
@ -39,9 +39,9 @@ $sql_projects = mysqli_query(
|
|||
LEFT JOIN users ON user_id = project_manager
|
||||
WHERE DATE(project_created_at) BETWEEN '$dtf' AND '$dtt'
|
||||
AND (project_name LIKE '%$q%' OR project_description LIKE '%$q%' OR user_name LIKE '%$q%')
|
||||
AND project_archived_at IS NULL
|
||||
AND project_completed_at $status_query
|
||||
$project_permission_snippet
|
||||
AND project_$archive_query
|
||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||
);
|
||||
|
||||
|
|
@ -59,6 +59,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
|
||||
<div class="card-body">
|
||||
<form class="mb-4" autocomplete="off">
|
||||
<input type="hidden" name="archived" value="<?php echo $archived; ?>">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="input-group">
|
||||
|
|
@ -72,8 +73,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<div class="col-sm-8">
|
||||
<div class="btn-toolbar float-right">
|
||||
<div class="btn-group mr-2">
|
||||
<a href="?status=0" class="btn btn-<?php if($status == 0){ echo "primary"; } else { echo "default"; } ?>"><i class="fa fa-fw fa-door-open mr-2"></i>Open</a>
|
||||
<a href="?status=1" class="btn btn-<?php if($status == 1){ echo "primary"; } else { echo "default"; } ?>"><i class="fa fa-fw fa-door-closed mr-2"></i>Closed</a>
|
||||
<a href="?status=0" class="btn btn-<?php if ($status == 0){ echo "primary"; } else { echo "default"; } ?>"><i class="fa fa-fw fa-door-open mr-2"></i>Open</a>
|
||||
<a href="?status=1" class="btn btn-<?php if ($status == 1){ echo "primary"; } else { echo "default"; } ?>"><i class="fa fa-fw fa-door-closed mr-2"></i>Closed</a>
|
||||
</div>
|
||||
|
||||
<div class="btn-group mr-2">
|
||||
<a href="?<?php echo $url_query_strings_sort ?>&archived=<?php if($archived == 1){ echo 0; } else { echo 1; } ?>"
|
||||
class="btn btn-<?php if ($archived == 1) { echo "primary"; } else { echo "default"; } ?>">
|
||||
<i class="fa fa-fw fa-archive mr-2"></i>Archived
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
@ -152,11 +160,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
$project_name = nullable_htmlentities($row['project_name']);
|
||||
$project_description = nullable_htmlentities($row['project_description']);
|
||||
$project_due = nullable_htmlentities($row['project_due']);
|
||||
$project_completed_at = nullable_htmlentities($row['project_completed_at']);
|
||||
$project_completed_at_display = date("Y-m-d", strtotime($project_completed_at));
|
||||
$project_created_at = nullable_htmlentities($row['project_created_at']);
|
||||
$project_created_at_display = date("Y-m-d", strtotime($project_created_at));
|
||||
$project_updated_at = nullable_htmlentities($row['project_updated_at']);
|
||||
$project_completed_at = nullable_htmlentities($row['project_completed_at']);
|
||||
$project_completed_at_display = date("Y-m-d", strtotime($project_completed_at));
|
||||
$project_archived_at = nullable_htmlentities($row['project_archived_at']);
|
||||
|
||||
$client_id = intval($row['client_id']);
|
||||
$client_name = nullable_htmlentities($row['client_name']);
|
||||
|
|
@ -256,15 +265,29 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<?php if(empty($project_completed_at)) { ?>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editProjectModal<?php echo $project_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<?php if (empty($project_completed_at)) { ?>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editProjectModal<?php echo $project_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if (!empty($project_completed_at) && lookupUserPermission("module_support" >= 2)) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<?php if (empty($project_archived_at)) { ?>
|
||||
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_project=<?php echo $project_id; ?>">
|
||||
<i class="fas fa-fw fa-archive mr-2"></i>Archive
|
||||
</a>
|
||||
<?php } else { ?>
|
||||
<a class="dropdown-item text-info confirm-link" href="post.php?unarchive_project=<?php echo $project_id; ?>">
|
||||
<i class="fas fa-fw fa-redo mr-2"></i>Unarchive
|
||||
</a>
|
||||
<?php if (lookupUserPermission("module_support" >= 3)) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger confirm-link" href="post.php?delete_project=<?php echo $project_id; ?>">
|
||||
<i class="fas fa-fw fa-archive mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<a class="dropdown-item text-danger confirm-link" href="post.php?delete_project=<?php echo $project_id; ?>">
|
||||
<i class="fas fa-fw fa-archive mr-2"></i>Delete
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
|||
Loading…
Reference in New Issue