mirror of https://github.com/itflow-org/itflow
General ticket updates/cleanup
- Tickets & Client Tickets: General tidy up, fix broken vars, remove unneeded vars, add comments - Client Portal: Show assigned agent for open tickets
This commit is contained in:
parent
b47aba1d5a
commit
ccb1bf9b0d
|
|
@ -144,7 +144,6 @@ $total_scheduled_tickets = intval($row['total_scheduled_tickets']);
|
|||
$ticket_priority = nullable_htmlentities($row['ticket_priority']);
|
||||
$ticket_status = nullable_htmlentities($row['ticket_status']);
|
||||
$ticket_billable = intval($row['ticket_billable']);
|
||||
$ticket_vendor_ticket_number = nullable_htmlentities($row['ticket_vendor_ticket_number']);
|
||||
$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']);
|
||||
|
|
@ -192,13 +191,8 @@ $total_scheduled_tickets = intval($row['total_scheduled_tickets']);
|
|||
} else {
|
||||
$ticket_assigned_to_display = nullable_htmlentities($row['user_name']);
|
||||
}
|
||||
$contact_id = intval($row['ticket_contact_id']);
|
||||
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||
$contact_title = nullable_htmlentities($row['contact_title']);
|
||||
$contact_email = nullable_htmlentities($row['contact_email']);
|
||||
$contact_phone = formatPhoneNumber($row['contact_phone']);
|
||||
$contact_extension = nullable_htmlentities($row['contact_extension']);
|
||||
$contact_mobile = formatPhoneNumber($row['contact_mobile']);
|
||||
$contact_archived_at = nullable_htmlentities($row['contact_archived_at']);
|
||||
if (empty($contact_archived_at)) {
|
||||
$contact_archived_display = "";
|
||||
|
|
@ -211,76 +205,93 @@ $total_scheduled_tickets = intval($row['total_scheduled_tickets']);
|
|||
$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);
|
||||
|
||||
$asset_id = intval($row['ticket_asset_id']);
|
||||
$vendor_id = intval($row['ticket_vendor_id']);
|
||||
|
||||
|
||||
// Get Ticket Last updated By in the last ticket reply to be show in the last Response column
|
||||
$sql_ticket_reply = mysqli_query($mysqli, "SELECT * 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);
|
||||
$ticket_reply_type = nullable_htmlentities($row['ticket_reply_type']);
|
||||
$ticket_reply_by = intval($row['ticket_reply_by']);
|
||||
if ($ticket_reply_type == "Client") {
|
||||
$ticket_reply_by_display = nullable_htmlentities($row['contact_name']);
|
||||
$user_initials = initials($row['contact_name']);
|
||||
$user_avatar = nullable_htmlentities($row['contact_photo']);
|
||||
$avatar_link = "uploads/clients/$client_id/$user_avatar";
|
||||
} else {
|
||||
$ticket_reply_by_display = nullable_htmlentities($row['user_name']);
|
||||
$user_id = intval($row['user_id']);
|
||||
$user_avatar = nullable_htmlentities($row['user_avatar']);
|
||||
$user_initials = initials($row['user_name']);
|
||||
$avatar_link = "uploads/users/$user_id/$user_avatar";
|
||||
}
|
||||
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 class="<?php if(empty($ticket_updated_at)) { echo "text-bold"; }?> <?php if ($ticket_reply_type == "Client") { echo "table-warning"; } ?>">
|
||||
<td><a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>"><span class="badge badge-pill badge-secondary p-3"><?php echo "$ticket_prefix$ticket_number"; ?></span></a></td>
|
||||
|
||||
<!-- Ticket Number -->
|
||||
<td>
|
||||
<a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>"><span class="badge badge-pill badge-secondary p-3"><?php echo "$ticket_prefix$ticket_number"; ?></span></a>
|
||||
</td>
|
||||
|
||||
<!-- Ticket Subject -->
|
||||
<td>
|
||||
<a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>"><?php echo $ticket_subject; ?></a>
|
||||
</td>
|
||||
<td><a href="#" data-toggle="modal" data-target="#editTicketContactModal<?php echo $ticket_id; ?>"><?php echo $contact_display; ?></a></td>
|
||||
|
||||
<?php if ($config_module_enable_accounting) { ?>
|
||||
<td class="text-center">
|
||||
<a href="#" data-toggle="modal" data-target="#editTicketBillableModal<?php echo $ticket_id; ?>">
|
||||
<?php
|
||||
if ($ticket_billable == 1) {
|
||||
echo "<span class='badge badge-pill badge-success'>$</span>";
|
||||
} else {
|
||||
echo "<span class='badge badge-pill badge-secondary'>X</span>";
|
||||
}
|
||||
?>
|
||||
<!-- Ticket Contact -->
|
||||
<td>
|
||||
<a href="#" data-toggle="modal" data-target="#editTicketContactModal<?php echo $ticket_id; ?>"><?php echo $contact_display; ?></a>
|
||||
</td>
|
||||
|
||||
<!-- Ticket Billable (if accounting enabled -->
|
||||
<?php if ($config_module_enable_accounting) { ?>
|
||||
<td class="text-center">
|
||||
<a href="#" data-toggle="modal" data-target="#editTicketBillableModal<?php echo $ticket_id; ?>">
|
||||
<?php
|
||||
if ($ticket_billable == 1) {
|
||||
echo "<span class='badge badge-pill badge-success'>$</span>";
|
||||
} else {
|
||||
echo "<span class='badge badge-pill badge-secondary'>X</span>";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
|
||||
<td><a href="#" data-toggle="modal" data-target="#editTicketPriorityModal<?php echo $ticket_id; ?>"><?php echo $ticket_priority_display; ?></a></td>
|
||||
<td><span class='p-2 badge badge-pill badge-<?php echo $ticket_status_color; ?>'><?php echo $ticket_status; ?></span></td>
|
||||
<td><a href="#" data-toggle="modal" data-target="#assignTicketModal<?php echo $ticket_id; ?>"><?php echo $ticket_assigned_to_display; ?></a></td>
|
||||
<!-- Ticket Priority -->
|
||||
<td>
|
||||
<a href="#" data-toggle="modal" data-target="#editTicketPriorityModal<?php echo $ticket_id; ?>"><?php echo $ticket_priority_display; ?></a>
|
||||
</td>
|
||||
|
||||
<!-- Ticket Status -->
|
||||
<td>
|
||||
<span class='p-2 badge badge-pill badge-<?php echo $ticket_status_color; ?>'><?php echo $ticket_status; ?></span>
|
||||
</td>
|
||||
|
||||
<!-- Ticket Assigned agent -->
|
||||
<td>
|
||||
<a href="#" data-toggle="modal" data-target="#assignTicketModal<?php echo $ticket_id; ?>"><?php echo $ticket_assigned_to_display; ?></a>
|
||||
</td>
|
||||
|
||||
<!-- Ticket Last Response -->
|
||||
<td>
|
||||
<div><?php echo $ticket_updated_at_display; ?></div>
|
||||
<div><?php echo $ticket_reply_by_display; ?></div>
|
||||
</td>
|
||||
|
||||
</td>
|
||||
|
||||
<!-- Ticket Created At -->
|
||||
<td>
|
||||
<?php echo $ticket_created_at_time_ago; ?>
|
||||
<br>
|
||||
<small class="text-secondary"><?php echo $ticket_created_at; ?></small>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
// Edit actions, for open tickets
|
||||
if ($ticket_status !== "Closed") {
|
||||
// Temp performance boost for closed tickets, until we move to dynamic modals
|
||||
|
||||
require "ticket_assign_modal.php";
|
||||
|
||||
|
|
@ -288,7 +299,9 @@ $total_scheduled_tickets = intval($row['total_scheduled_tickets']);
|
|||
|
||||
require "ticket_edit_contact_modal.php";
|
||||
|
||||
require "ticket_edit_billable_modal.php";
|
||||
if ($config_module_enable_accounting) {
|
||||
require "ticket_edit_billable_modal.php";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -299,8 +312,7 @@ $total_scheduled_tickets = intval($row['total_scheduled_tickets']);
|
|||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php require_once "pagination.php";
|
||||
?>
|
||||
<?php require_once "pagination.php"; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -311,4 +323,3 @@ require_once "client_ticket_export_modal.php";
|
|||
|
||||
require_once "footer.php";
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -19,9 +19,11 @@ if (isset($_GET['id']) && intval($_GET['id'])) {
|
|||
$ticket_id = intval($_GET['id']);
|
||||
|
||||
if ($session_contact_primary == 1 || $session_contact_is_technical_contact) {
|
||||
$ticket_sql = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id AND ticket_client_id = $session_client_id");
|
||||
// For a primary / technical contact viewing all tickets
|
||||
$ticket_sql = mysqli_query($mysqli, "SELECT * FROM tickets LEFT JOIN users on ticket_assigned_to = user_id WHERE ticket_id = $ticket_id AND ticket_client_id = $session_client_id");
|
||||
} else {
|
||||
$ticket_sql = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id AND ticket_client_id = $session_client_id AND ticket_contact_id = $session_contact_id");
|
||||
// For a user viewing their own ticket
|
||||
$ticket_sql = mysqli_query($mysqli, "SELECT * FROM tickets LEFT JOIN users on ticket_assigned_to = user_id WHERE ticket_id = $ticket_id AND ticket_client_id = $session_client_id AND ticket_contact_id = $session_contact_id");
|
||||
}
|
||||
|
||||
$ticket_row = mysqli_fetch_array($ticket_sql);
|
||||
|
|
@ -34,6 +36,7 @@ if (isset($_GET['id']) && intval($_GET['id'])) {
|
|||
$ticket_priority = nullable_htmlentities($ticket_row['ticket_priority']);
|
||||
$ticket_subject = nullable_htmlentities($ticket_row['ticket_subject']);
|
||||
$ticket_details = $purifier->purify($ticket_row['ticket_details']);
|
||||
$ticket_assigned_to = nullable_htmlentities($ticket_row['user_name']);
|
||||
$ticket_feedback = nullable_htmlentities($ticket_row['ticket_feedback']);
|
||||
|
||||
?>
|
||||
|
|
@ -66,6 +69,10 @@ if (isset($_GET['id']) && intval($_GET['id'])) {
|
|||
<strong>State:</strong> <?php echo $ticket_status ?>
|
||||
<br>
|
||||
<strong>Priority:</strong> <?php echo $ticket_priority ?>
|
||||
<br>
|
||||
<?php if (!empty($ticket_assigned_to) && $ticket_status !== "Closed") { ?>
|
||||
<strong>Assigned to: </strong> <?php echo $ticket_assigned_to ?>
|
||||
<?php } ?>
|
||||
</p>
|
||||
<?php echo $ticket_details ?>
|
||||
</div>
|
||||
|
|
@ -180,7 +187,7 @@ if (isset($_GET['id']) && intval($_GET['id'])) {
|
|||
|
||||
<script src="../js/pretty_content.js"></script>
|
||||
|
||||
<?php
|
||||
<?php
|
||||
} else {
|
||||
echo "Ticket ID not found!";
|
||||
}
|
||||
|
|
|
|||
453
tickets.php
453
tickets.php
|
|
@ -96,183 +96,183 @@ $row = mysqli_fetch_array($sql_total_tickets_assigned);
|
|||
$user_active_assigned_tickets = intval($row['total_tickets_assigned']);
|
||||
|
||||
?>
|
||||
<style>
|
||||
.popover {
|
||||
max-width: 600px;
|
||||
}
|
||||
</style>
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-life-ring mr-2"></i>Support Tickets
|
||||
<small class="ml-3">
|
||||
<a href="?status=Open" class="text-white"><strong><?php echo $total_tickets_open; ?></strong> Open</a> |
|
||||
<a href="?status=Closed" class="text-white"><strong><?php echo $total_tickets_closed; ?></strong> Closed</a>
|
||||
</small>
|
||||
</h3>
|
||||
<div class='card-tools'>
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addTicketModal">
|
||||
<i class="fas fa-plus mr-2"></i>New Ticket
|
||||
</button>
|
||||
<style>
|
||||
.popover {
|
||||
max-width: 600px;
|
||||
}
|
||||
</style>
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-life-ring mr-2"></i>Support Tickets
|
||||
<small class="ml-3">
|
||||
<a href="?status=Open" class="text-white"><strong><?php echo $total_tickets_open; ?></strong> Open</a> |
|
||||
<a href="?status=Closed" class="text-white"><strong><?php echo $total_tickets_closed; ?></strong> Closed</a>
|
||||
</small>
|
||||
</h3>
|
||||
<div class='card-tools'>
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addTicketModal">
|
||||
<i class="fas fa-plus mr-2"></i>New Ticket
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="input-group">
|
||||
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search Tickets">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-secondary" type="button" data-toggle="collapse" data-target="#advancedFilter"><i class="fas fa-filter"></i></button>
|
||||
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<div class="btn-group float-right">
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-outline-dark dropdown-toggle" id="dropdownMenuButton" data-toggle="dropdown">
|
||||
<i class="fa fa-fw fa-envelope mr-2"></i>My Tickets
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="?status=Open&assigned=<?php echo $session_user_id ?>">Active tickets (<?php echo $user_active_assigned_tickets ?>)</a>
|
||||
<a class="dropdown-item " href="?status=Closed&assigned=<?php echo $session_user_id ?>">Closed tickets</a>
|
||||
</div>
|
||||
</div>
|
||||
<a href="?assigned=unassigned" class="btn btn-outline-danger">
|
||||
<i class="fa fa-fw fa-exclamation-triangle mr-2"></i>Unassigned Tickets | <strong> <?php echo $total_tickets_unassigned; ?></strong>
|
||||
</a>
|
||||
|
||||
<a href="recurring_tickets.php" class="btn btn-outline-info">
|
||||
<i class="fa fa-fw fa-redo-alt mr-2"></i>Recurring Tickets | <strong> <?php echo $total_scheduled_tickets; ?></strong>
|
||||
</a>
|
||||
|
||||
<div class="dropdown ml-2" id="bulkActionButton" hidden>
|
||||
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown">
|
||||
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>)
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkAssignTicketModal">
|
||||
<i class="fas fa-fw fa-user-check mr-2"></i>Assign Tech
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkEditPriorityTicketModal">
|
||||
<i class="fas fa-fw fa-thermometer-half mr-2"></i>Update Priority
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkCloseTicketsModal">
|
||||
<i class="fas fa-fw fa-gavel mr-2"></i>Close
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkReplyTicketModal">
|
||||
<i class="fas fa-fw fa-paper-plane mr-2"></i>Bulk Update/Reply
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="collapse <?php if (!empty($_GET['dtf']) || (isset($_GET['canned_date']) && $_GET['canned_date'] !== "custom") || (isset($_GET['status']) && is_array($_GET['status']))) { echo "show"; } ?>" id="advancedFilter">
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label>Canned Date</label>
|
||||
<select onchange="this.form.submit()" class="form-control select2" name="canned_date">
|
||||
<option <?php if ($_GET['canned_date'] == "custom") {
|
||||
echo "selected";
|
||||
} ?> value="custom">Custom
|
||||
</option>
|
||||
<option <?php if ($_GET['canned_date'] == "today") {
|
||||
echo "selected";
|
||||
} ?> value="today">Today
|
||||
</option>
|
||||
<option <?php if ($_GET['canned_date'] == "yesterday") {
|
||||
echo "selected";
|
||||
} ?> value="yesterday">Yesterday
|
||||
</option>
|
||||
<option <?php if ($_GET['canned_date'] == "thisweek") {
|
||||
echo "selected";
|
||||
} ?> value="thisweek">This Week
|
||||
</option>
|
||||
<option <?php if ($_GET['canned_date'] == "lastweek") {
|
||||
echo "selected";
|
||||
} ?> value="lastweek">Last Week
|
||||
</option>
|
||||
<option <?php if ($_GET['canned_date'] == "thismonth") {
|
||||
echo "selected";
|
||||
} ?> value="thismonth">This Month
|
||||
</option>
|
||||
<option <?php if ($_GET['canned_date'] == "lastmonth") {
|
||||
echo "selected";
|
||||
} ?> value="lastmonth">Last Month
|
||||
</option>
|
||||
<option <?php if ($_GET['canned_date'] == "thisyear") {
|
||||
echo "selected";
|
||||
} ?> value="thisyear">This Year
|
||||
</option>
|
||||
<option <?php if ($_GET['canned_date'] == "lastyear") {
|
||||
echo "selected";
|
||||
} ?> value="lastyear">Last Year
|
||||
</option>
|
||||
</select>
|
||||
<div class="col-sm-4">
|
||||
<div class="input-group">
|
||||
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search Tickets">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-secondary" type="button" data-toggle="collapse" data-target="#advancedFilter"><i class="fas fa-filter"></i></button>
|
||||
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label>Date From</label>
|
||||
<input onchange="this.form.submit()" type="date" class="form-control" name="dtf" max="2999-12-31" value="<?php echo nullable_htmlentities($dtf); ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label>Date To</label>
|
||||
<input onchange="this.form.submit()" type="date" class="form-control" name="dtt" max="2999-12-31" value="<?php echo nullable_htmlentities($dtt); ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label>Ticket Status</label>
|
||||
<select onchange="this.form.submit()" class="form-control select2" name="status[]" data-placeholder="Select Status" multiple>
|
||||
<option value="New" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('New', $_GET['status'])) { echo 'selected'; } ?>>New</option>
|
||||
<option value="Open" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('Open', $_GET['status'])) { echo 'selected'; } ?>>Open</option>
|
||||
<option value="On Hold" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('On Hold', $_GET['status'])) { echo 'selected'; } ?>>On Hold</option>
|
||||
<option value="Auto Close" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('Auto Close', $_GET['status'])) { echo 'selected'; } ?>>Auto Close</option>
|
||||
<option value="Closed" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('Closed', $_GET['status'])) { echo 'selected'; } ?>>Closed</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label>Assigned to</label>
|
||||
<select onchange="this.form.submit()" class="form-control select2" name="assigned">
|
||||
<option value="" <?php if ($ticket_assigned_filter_id == "") { echo "selected"; } ?>>Any</option>
|
||||
<option value="unassigned" <?php if ($ticket_assigned_filter_id == "0") { echo "selected"; } ?>>Unassigned</option>
|
||||
<div class="col-sm-8">
|
||||
<div class="btn-group float-right">
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-outline-dark dropdown-toggle" id="dropdownMenuButton" data-toggle="dropdown">
|
||||
<i class="fa fa-fw fa-envelope mr-2"></i>My Tickets
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="?status=Open&assigned=<?php echo $session_user_id ?>">Active tickets (<?php echo $user_active_assigned_tickets ?>)</a>
|
||||
<a class="dropdown-item " href="?status=Closed&assigned=<?php echo $session_user_id ?>">Closed tickets</a>
|
||||
</div>
|
||||
</div>
|
||||
<a href="?assigned=unassigned" class="btn btn-outline-danger">
|
||||
<i class="fa fa-fw fa-exclamation-triangle mr-2"></i>Unassigned Tickets | <strong> <?php echo $total_tickets_unassigned; ?></strong>
|
||||
</a>
|
||||
|
||||
<?php
|
||||
$sql_assign_to = mysqli_query($mysqli, "SELECT * FROM users WHERE user_archived_at IS NULL ORDER BY user_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_assign_to)) {
|
||||
$user_id = intval($row['user_id']);
|
||||
$user_name = nullable_htmlentities($row['user_name']);
|
||||
?>
|
||||
<option <?php if ($ticket_assigned_filter_id == $user_id) { echo "selected"; } ?> value="<?php echo $user_id; ?>"><?php echo $user_name; ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<a href="recurring_tickets.php" class="btn btn-outline-info">
|
||||
<i class="fa fa-fw fa-redo-alt mr-2"></i>Recurring Tickets | <strong> <?php echo $total_scheduled_tickets; ?></strong>
|
||||
</a>
|
||||
|
||||
</select>
|
||||
<div class="dropdown ml-2" id="bulkActionButton" hidden>
|
||||
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown">
|
||||
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>)
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkAssignTicketModal">
|
||||
<i class="fas fa-fw fa-user-check mr-2"></i>Assign Tech
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkEditPriorityTicketModal">
|
||||
<i class="fas fa-fw fa-thermometer-half mr-2"></i>Update Priority
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkCloseTicketsModal">
|
||||
<i class="fas fa-fw fa-gavel mr-2"></i>Close
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkReplyTicketModal">
|
||||
<i class="fas fa-fw fa-paper-plane mr-2"></i>Bulk Update/Reply
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="collapse <?php if (!empty($_GET['dtf']) || (isset($_GET['canned_date']) && $_GET['canned_date'] !== "custom") || (isset($_GET['status']) && is_array($_GET['status']))) { echo "show"; } ?>" id="advancedFilter">
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label>Canned Date</label>
|
||||
<select onchange="this.form.submit()" class="form-control select2" name="canned_date">
|
||||
<option <?php if ($_GET['canned_date'] == "custom") {
|
||||
echo "selected";
|
||||
} ?> value="custom">Custom
|
||||
</option>
|
||||
<option <?php if ($_GET['canned_date'] == "today") {
|
||||
echo "selected";
|
||||
} ?> value="today">Today
|
||||
</option>
|
||||
<option <?php if ($_GET['canned_date'] == "yesterday") {
|
||||
echo "selected";
|
||||
} ?> value="yesterday">Yesterday
|
||||
</option>
|
||||
<option <?php if ($_GET['canned_date'] == "thisweek") {
|
||||
echo "selected";
|
||||
} ?> value="thisweek">This Week
|
||||
</option>
|
||||
<option <?php if ($_GET['canned_date'] == "lastweek") {
|
||||
echo "selected";
|
||||
} ?> value="lastweek">Last Week
|
||||
</option>
|
||||
<option <?php if ($_GET['canned_date'] == "thismonth") {
|
||||
echo "selected";
|
||||
} ?> value="thismonth">This Month
|
||||
</option>
|
||||
<option <?php if ($_GET['canned_date'] == "lastmonth") {
|
||||
echo "selected";
|
||||
} ?> value="lastmonth">Last Month
|
||||
</option>
|
||||
<option <?php if ($_GET['canned_date'] == "thisyear") {
|
||||
echo "selected";
|
||||
} ?> value="thisyear">This Year
|
||||
</option>
|
||||
<option <?php if ($_GET['canned_date'] == "lastyear") {
|
||||
echo "selected";
|
||||
} ?> value="lastyear">Last Year
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label>Date From</label>
|
||||
<input onchange="this.form.submit()" type="date" class="form-control" name="dtf" max="2999-12-31" value="<?php echo nullable_htmlentities($dtf); ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label>Date To</label>
|
||||
<input onchange="this.form.submit()" type="date" class="form-control" name="dtt" max="2999-12-31" value="<?php echo nullable_htmlentities($dtt); ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label>Ticket Status</label>
|
||||
<select onchange="this.form.submit()" class="form-control select2" name="status[]" data-placeholder="Select Status" multiple>
|
||||
<option value="New" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('New', $_GET['status'])) { echo 'selected'; } ?>>New</option>
|
||||
<option value="Open" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('Open', $_GET['status'])) { echo 'selected'; } ?>>Open</option>
|
||||
<option value="On Hold" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('On Hold', $_GET['status'])) { echo 'selected'; } ?>>On Hold</option>
|
||||
<option value="Auto Close" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('Auto Close', $_GET['status'])) { echo 'selected'; } ?>>Auto Close</option>
|
||||
<option value="Closed" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('Closed', $_GET['status'])) { echo 'selected'; } ?>>Closed</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label>Assigned to</label>
|
||||
<select onchange="this.form.submit()" class="form-control select2" name="assigned">
|
||||
<option value="" <?php if ($ticket_assigned_filter_id == "") { echo "selected"; } ?>>Any</option>
|
||||
<option value="unassigned" <?php if ($ticket_assigned_filter_id == "0") { echo "selected"; } ?>>Unassigned</option>
|
||||
|
||||
<?php
|
||||
$sql_assign_to = mysqli_query($mysqli, "SELECT * FROM users WHERE user_archived_at IS NULL ORDER BY user_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_assign_to)) {
|
||||
$user_id = intval($row['user_id']);
|
||||
$user_name = nullable_htmlentities($row['user_name']);
|
||||
?>
|
||||
<option <?php if ($ticket_assigned_filter_id == $user_id) { echo "selected"; } ?> value="<?php echo $user_id; ?>"><?php echo $user_name; ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<hr>
|
||||
<form id="bulkActions" action="post.php" method="post">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table table-striped table-borderless table-hover">
|
||||
<thead class="text-dark <?php if (!$num_rows[0]) { echo "d-none"; } ?>">
|
||||
</form>
|
||||
<hr>
|
||||
<form id="bulkActions" action="post.php" method="post">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table table-striped table-borderless table-hover">
|
||||
<thead class="text-dark <?php if (!$num_rows[0]) { echo "d-none"; } ?>">
|
||||
<tr>
|
||||
<td>
|
||||
<div class="form-check">
|
||||
|
|
@ -301,8 +301,8 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
|
|||
</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
|
|
@ -314,7 +314,6 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
|
|||
$ticket_status = nullable_htmlentities($row['ticket_status']);
|
||||
$ticket_billable = intval($row['ticket_billable']);
|
||||
$ticket_scheduled_for = nullable_htmlentities($row['ticket_schedule']);
|
||||
$ticket_vendor_ticket_number = nullable_htmlentities($row['ticket_vendor_ticket_number']);
|
||||
$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']);
|
||||
|
|
@ -331,13 +330,8 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
|
|||
$ticket_closed_at = nullable_htmlentities($row['ticket_closed_at']);
|
||||
$client_id = intval($row['ticket_client_id']);
|
||||
$client_name = nullable_htmlentities($row['client_name']);
|
||||
$contact_id = intval($row['ticket_contact_id']);
|
||||
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||
$contact_title = nullable_htmlentities($row['contact_title']);
|
||||
$contact_email = nullable_htmlentities($row['contact_email']);
|
||||
$contact_phone = formatPhoneNumber($row['contact_phone']);
|
||||
$contact_extension = nullable_htmlentities($row['contact_extension']);
|
||||
$contact_mobile = formatPhoneNumber($row['contact_mobile']);
|
||||
|
||||
if ($ticket_status == "New") {
|
||||
$ticket_status_color = "danger";
|
||||
|
|
@ -376,39 +370,33 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
|
|||
$contact_display = "$contact_name<br><small class='text-secondary'>$contact_email</small>";
|
||||
}
|
||||
|
||||
$asset_id = intval($row['ticket_asset_id']);
|
||||
$vendor_id = intval($row['ticket_vendor_id']);
|
||||
|
||||
|
||||
// Get Ticket Last updated By in the last ticket reply to be show in the last Response column
|
||||
$sql_ticket_reply = mysqli_query($mysqli, "SELECT * 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"
|
||||
// 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);
|
||||
$ticket_reply_type = nullable_htmlentities($row['ticket_reply_type']);
|
||||
$ticket_reply_by = intval($row['ticket_reply_by']);
|
||||
if ($ticket_reply_type == "Client") {
|
||||
$ticket_reply_by_display = nullable_htmlentities($row['contact_name']);
|
||||
$user_initials = initials($row['contact_name']);
|
||||
$user_avatar = nullable_htmlentities($row['contact_photo']);
|
||||
$avatar_link = "uploads/clients/$client_id/$user_avatar";
|
||||
} else {
|
||||
$ticket_reply_by_display = nullable_htmlentities($row['user_name']);
|
||||
$user_id = intval($row['user_id']);
|
||||
$user_avatar = nullable_htmlentities($row['user_avatar']);
|
||||
$user_initials = initials($row['user_name']);
|
||||
$avatar_link = "uploads/users/$user_id/$user_avatar";
|
||||
|
||||
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 class="<?php if (empty($ticket_updated_at)) {
|
||||
echo "text-bold";
|
||||
} ?>">
|
||||
<tr class="<?php if(empty($ticket_updated_at)) { echo "text-bold"; }?> <?php if ($ticket_reply_type == "Client") { echo "table-warning"; } ?>">
|
||||
|
||||
<!-- Ticket Bulk Select -->
|
||||
<td>
|
||||
<?php if ($ticket_status !== "Closed") { ?>
|
||||
<div class="form-check">
|
||||
|
|
@ -416,20 +404,27 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
|
|||
</div>
|
||||
<?php } ?>
|
||||
</td>
|
||||
|
||||
<!-- Ticket Number -->
|
||||
<td>
|
||||
<a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>">
|
||||
<span class="badge badge-pill badge-secondary p-3"><?php echo "$ticket_prefix$ticket_number"; ?></span>
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<!-- Ticket Subject -->
|
||||
<td>
|
||||
<a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>"><?php echo $ticket_subject; ?></a>
|
||||
</td>
|
||||
|
||||
<!-- Ticket Contact -->
|
||||
<td>
|
||||
<a href="client_tickets.php?client_id=<?php echo $client_id; ?>"><strong><?php echo $client_name; ?></strong></a>
|
||||
|
||||
<div class="mt-1"><?php echo $contact_display; ?></div>
|
||||
</td>
|
||||
|
||||
<!-- Ticket Billable (if accounting enabled -->
|
||||
<?php if ($config_module_enable_accounting) { ?>
|
||||
<td class="text-center">
|
||||
<a href="#" data-toggle="modal" data-target="#editTicketBillableModal<?php echo $ticket_id; ?>">
|
||||
|
|
@ -443,24 +438,39 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
|
|||
</td>
|
||||
<?php } ?>
|
||||
|
||||
<td><a href="#" data-toggle="modal" data-target="#editTicketPriorityModal<?php echo $ticket_id; ?>"><span class='p-2 badge badge-pill badge-<?php echo $ticket_priority_color; ?>'><?php echo $ticket_priority; ?></span></a></td>
|
||||
<td><span class='p-2 badge badge-pill badge-<?php echo $ticket_status_color; ?>'><?php echo $ticket_status; ?></span> <?php if ($ticket_status == 'On Hold' && isset ($ticket_scheduled_for)) { echo "<div class=\"mt-1\"> <small class='text-secondary'> $ticket_scheduled_for </small></div>"; } ?></td>
|
||||
<td><a href="#" data-toggle="modal" data-target="#assignTicketModal<?php echo $ticket_id; ?>"><?php echo $ticket_assigned_to_display; ?></a></td>
|
||||
<!-- Ticket Priority -->
|
||||
<td>
|
||||
<a href="#" data-toggle="modal" data-target="#editTicketPriorityModal<?php echo $ticket_id; ?>"><span class='p-2 badge badge-pill badge-<?php echo $ticket_priority_color; ?>'><?php echo $ticket_priority; ?></span></a>
|
||||
</td>
|
||||
|
||||
<!-- Ticket Status -->
|
||||
<td>
|
||||
<span class='p-2 badge badge-pill badge-<?php echo $ticket_status_color; ?>'><?php echo $ticket_status; ?></span> <?php if ($ticket_status == 'On Hold' && isset ($ticket_scheduled_for)) { echo "<div class=\"mt-1\"> <small class='text-secondary'> $ticket_scheduled_for </small></div>"; } ?>
|
||||
</td>
|
||||
|
||||
<!-- Ticket Assigned agent -->
|
||||
<td>
|
||||
<a href="#" data-toggle="modal" data-target="#assignTicketModal<?php echo $ticket_id; ?>"><?php echo $ticket_assigned_to_display; ?></a>
|
||||
</td>
|
||||
|
||||
<!-- Ticket Last Response -->
|
||||
<td>
|
||||
<div><?php echo $ticket_updated_at_display; ?></div>
|
||||
<div><?php echo $ticket_reply_by_display; ?></div>
|
||||
</td>
|
||||
|
||||
<!-- Ticket Created At -->
|
||||
<td>
|
||||
<?php echo $ticket_created_at_time_ago; ?>
|
||||
<br>
|
||||
<small class="text-secondary"><?php echo $ticket_created_at; ?></small>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
<?php
|
||||
// Edit actions, for open tickets
|
||||
if ($ticket_status !== "Closed") {
|
||||
// Temp performance boost for closed tickets, until we move to dynamic modals
|
||||
|
||||
require "ticket_assign_modal.php";
|
||||
|
||||
|
|
@ -474,20 +484,19 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
|
|||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php require_once "ticket_bulk_assign_modal.php"; ?>
|
||||
<?php require_once "ticket_bulk_edit_priority_modal.php"; ?>
|
||||
<?php require_once "ticket_bulk_close_modal.php"; ?>
|
||||
<?php require_once "ticket_bulk_reply_modal.php"; ?>
|
||||
</form>
|
||||
<?php require_once "pagination.php";
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php require_once "ticket_bulk_assign_modal.php"; ?>
|
||||
<?php require_once "ticket_bulk_edit_priority_modal.php"; ?>
|
||||
<?php require_once "ticket_bulk_close_modal.php"; ?>
|
||||
<?php require_once "ticket_bulk_reply_modal.php"; ?>
|
||||
</form>
|
||||
<?php require_once "pagination.php"; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="js/bulk_actions.js"></script>
|
||||
<script src="js/bulk_actions.js"></script>
|
||||
|
||||
<?php
|
||||
require_once "ticket_add_modal.php";
|
||||
|
|
|
|||
Loading…
Reference in New Issue