This commit is contained in:
o-psi
2024-02-09 22:49:12 +00:00
parent 971830ac21
commit 2bf0a2aef8
12 changed files with 1334 additions and 1225 deletions

View File

@@ -41,18 +41,16 @@ while ($row = mysqli_fetch_array($sql)) {
$client_id = intval($row['event_client_id']); $client_id = intval($row['event_client_id']);
require "calendar_event_edit_modal.php"; require "calendar_event_edit_modal.php";
} }
?> ?>
<?php require_once "footer.php"; <?php require_once "footer.php";
?> ?>
<script src='plugins/fullcalendar/main.min.js'></script> <script src='plugins/fullcalendar/main.min.js'></script>
<script> <script>
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar'); var calendarEl = document.getElementById('calendar');
@@ -121,7 +119,6 @@ while ($row = mysqli_fetch_array($sql)) {
$event_start = json_encode($row['ticket_created_at']); $event_start = json_encode($row['ticket_created_at']);
echo "{ id: $event_id, title: $event_title, start: $event_start, color: 'orange', url: 'ticket.php?ticket_id=$event_id' },"; echo "{ id: $event_id, title: $event_title, start: $event_start, color: 'orange', url: 'ticket.php?ticket_id=$event_id' },";
} }
//Tickets Scheduled //Tickets Scheduled
@@ -137,7 +134,7 @@ while ($row = mysqli_fetch_array($sql)) {
if (strtotime($row['ticket_schedule']) < time()) { if (strtotime($row['ticket_schedule']) < time()) {
if ($row['ticket_status'] == 'Scheduled') { if ($row['ticket_status'] == 'Scheduled') {
$event_color = "red"; $event_color = "red";
}else { } else {
$event_color = "green"; $event_color = "green";
} }
} else { } else {
@@ -175,13 +172,12 @@ while ($row = mysqli_fetch_array($sql)) {
], ],
eventClick: function(editEvent) { eventClick: function(editEvent) {
$('#editEventModal'+editEvent.event.id).modal(); $('#editEventModal' + editEvent.event.id).modal();
} }
}); });
calendar.render(); calendar.render();
}); });
</script> </script>
<!-- Automatically set new event end date to 1 hr after start date --> <!-- Automatically set new event end date to 1 hr after start date -->

View File

@@ -24,7 +24,7 @@ if ($config_enable_cron == 0) {
} }
// Check Cron Key // Check Cron Key
if ( $argv[1] !== $config_cron_key ) { if ($argv[1] !== $config_cron_key) {
exit("Cron Key invalid -- Quitting.."); exit("Cron Key invalid -- Quitting..");
} }
@@ -131,6 +131,7 @@ if (mysqli_num_rows($sql_failed_queue) > 0) {
$email_content = $row['email_content']; $email_content = $row['email_content'];
$email_queued_at = $row['email_queued_at']; $email_queued_at = $row['email_queued_at'];
$email_sent_at = $row['email_sent_at']; $email_sent_at = $row['email_sent_at'];
$email_ics_str = $row['email_cal_str'];
// Increment the attempts // Increment the attempts
$email_attempts = intval($row['email_attempts']) + 1; $email_attempts = intval($row['email_attempts']) + 1;
@@ -155,7 +156,8 @@ if (mysqli_num_rows($sql_failed_queue) > 0) {
$email_recipient, $email_recipient,
$email_recipient_name, $email_recipient_name,
$email_subject, $email_subject,
$email_content $email_content,
$email_ics_str
); );
if ($mail !== true) { if ($mail !== true) {

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -1597,18 +1597,18 @@ if (isset($_POST['edit_ticket_schedule'])) {
</div>")), </div>")),
'cal_str' => $cal_str 'cal_str' => $cal_str
]; ];
} }
$response = addToMailQueue($mysqli, $data); $response = addToMailQueue($mysqli, $data);
// Update ticket reply // Update ticket reply
mysqli_query($mysqli, "INSERT INTO ticket_replies SET ticket_reply = 'Ticket scheduled for $schedule', ticket_reply_type = 'Internal', ticket_reply_time_worked = '00:05:00', ticket_reply_by = $session_user_id, ticket_reply_ticket_id = $ticket_id"); mysqli_query($mysqli, "INSERT INTO ticket_replies SET ticket_reply = 'Ticket scheduled for $schedule', ticket_reply_type = 'Internal', ticket_reply_time_worked = '00:05:00', ticket_reply_by = $session_user_id, ticket_reply_ticket_id = $ticket_id");
//Logging //Logging
mysqli_query( mysqli_query(
$mysqli, $mysqli,
"INSERT INTO logs SET "INSERT INTO logs SET
log_type = 'Ticket', log_type = 'Ticket',
log_action = 'Modify', log_action = 'Modify',
log_description = '$session_name modified ticket schedule', log_description = '$session_name modified ticket schedule',
@@ -1616,18 +1616,17 @@ if (isset($_POST['edit_ticket_schedule'])) {
log_user_agent = '$session_user_agent', log_user_agent = '$session_user_agent',
log_user_id = $session_user_id, log_user_id = $session_user_id,
log_entity_id = $ticket_id" log_entity_id = $ticket_id"
); );
if(empty($conflicting_tickets)){ if (empty($conflicting_tickets)) {
$_SESSION['alert_message'] = "Ticket scheduled for $email_datetime"; $_SESSION['alert_message'] = "Ticket scheduled for $email_datetime";
header("Location: " . $_SERVER["HTTP_REFERER"]); header("Location: " . $_SERVER["HTTP_REFERER"]);
} else { } else {
$_SESSION['alert_type'] = "error"; $_SESSION['alert_type'] = "error";
$_SESSION['alert_message'] = "Ticket scheduled for $email_datetime. Yet there are conflicting tickets scheduled for the same time: <br>" . implode(", <br>", $conflicting_tickets); $_SESSION['alert_message'] = "Ticket scheduled for $email_datetime. Yet there are conflicting tickets scheduled for the same time: <br>" . implode(", <br>", $conflicting_tickets);
header("Location: calendar_events.php"); header("Location: calendar_events.php");
} }
exit; exit;
} }

View File

@@ -25,26 +25,28 @@
$contact_id = intval($row['contact_id']); $contact_id = intval($row['contact_id']);
$contact_name = nullable_htmlentities($row['contact_name']); $contact_name = nullable_htmlentities($row['contact_name']);
$contact_primary = intval($row['contact_primary']); $contact_primary = intval($row['contact_primary']);
if($contact_primary == 1) { if ($contact_primary == 1) {
$contact_primary_display = " (Primary)"; $contact_primary_display = " (Primary)";
} else { } else {
$contact_primary_display = ""; $contact_primary_display = "";
} }
$contact_technical = intval($row['contact_technical']); $contact_technical = intval($row['contact_technical']);
if($contact_technical == 1) { if ($contact_technical == 1) {
$contact_technical_display = " (Technical)"; $contact_technical_display = " (Technical)";
} else { } else {
$contact_technical_display = ""; $contact_technical_display = "";
} }
$contact_title = nullable_htmlentities($row['contact_title']); $contact_title = nullable_htmlentities($row['contact_title']);
if(!empty($contact_title)) { if (!empty($contact_title)) {
$contact_title_display = " - $contact_title"; $contact_title_display = " - $contact_title";
} else { } else {
$contact_title_display = ""; $contact_title_display = "";
} }
?> ?>
<option value="<?php echo $contact_id; ?>" <?php if ($contact_primary == 1) { echo "selected"; } ?>><?php echo "$contact_name$contact_title_display$contact_primary_display$contact_technical_display"; ?></option> <option value="<?php echo $contact_id; ?>" <?php if ($contact_primary == 1) {
echo "selected";
} ?>><?php echo "$contact_name$contact_title_display$contact_primary_display$contact_technical_display"; ?></option>
<?php } ?> <?php } ?>
</select> </select>
</div> </div>
@@ -64,7 +66,7 @@
while ($row = mysqli_fetch_array($sql)) { while ($row = mysqli_fetch_array($sql)) {
$selectable_client_id = intval($row['client_id']); $selectable_client_id = intval($row['client_id']);
$client_name = nullable_htmlentities($row['client_name']); $client_name = nullable_htmlentities($row['client_name']);
?> ?>
<option value="<?php echo $selectable_client_id; ?>"><?php echo $client_name; ?></option> <option value="<?php echo $selectable_client_id; ?>"><?php echo $client_name; ?></option>
<?php } ?> <?php } ?>
@@ -139,7 +141,7 @@
while ($row = mysqli_fetch_array($sql_assets)) { while ($row = mysqli_fetch_array($sql_assets)) {
$asset_id_select = intval($row['asset_id']); $asset_id_select = intval($row['asset_id']);
$asset_name_select = nullable_htmlentities($row['asset_name']); $asset_name_select = nullable_htmlentities($row['asset_name']);
?> ?>
<option value="<?php echo $asset_id_select; ?>"><?php echo $asset_name_select; ?></option> <option value="<?php echo $asset_id_select; ?>"><?php echo $asset_name_select; ?></option>
<?php } ?> <?php } ?>

View File

@@ -23,59 +23,60 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?> ?>
<div class="card card-dark"> <div class="card card-dark">
<div class="card-header py-2"> <div class="card-header py-2">
<h3 class="card-title mt-2"><i class="fas fa-fw fa-calendar-check mr-2"></i>Recurring Tickets</h3> <h3 class="card-title mt-2"><i class="fas fa-fw fa-calendar-check mr-2"></i>Recurring Tickets</h3>
<div class='card-tools'> <div class='card-tools'>
<div class="float-left"> <div class="float-left">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addScheduledTicketModal"> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addScheduledTicketModal">
<i class="fas fa-plus mr-2"></i>New Recurring Ticket <i class="fas fa-plus mr-2"></i>New Recurring Ticket
</button> </button>
</div>
</div> </div>
</div> </div>
</div>
<div class="card-body"> <div class="card-body">
<form autocomplete="off"> <form autocomplete="off">
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-4">
<div class="input-group mb-3 mb-md-0"> <div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search Scheduled Tickets"> <input type="search" class="form-control" name="q" value="<?php if (isset($q)) {
<div class="input-group-append"> echo stripslashes(nullable_htmlentities($q));
<button class="btn btn-dark"><i class="fa fa-search"></i></button> } ?>" placeholder="Search Scheduled Tickets">
</div> <div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div> </div>
</div> </div>
<div class="col-md-8">
<div class="dropdown float-right" 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">
<button class="dropdown-item text-danger text-bold"
type="submit" form="multi_actions" name="bulk_delete_scheduled_tickets">
<i class="fas fa-fw fa-trash mr-2"></i>Delete
</button>
</div>
</div>
</div>
</div> </div>
</form> <div class="col-md-8">
<hr>
<div class="table-responsive-sm"> <div class="dropdown float-right" 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">
<button class="dropdown-item text-danger text-bold" type="submit" form="multi_actions" name="bulk_delete_scheduled_tickets">
<i class="fas fa-fw fa-trash mr-2"></i>Delete
</button>
</div>
</div>
<form id="bulkActions" action="post.php" method="post"> </div>
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>"> </div>
</form>
<hr>
<table class="table table-striped table-borderless table-hover"> <div class="table-responsive-sm">
<thead class="<?php if (!$num_rows[0]) {
echo "d-none"; <form id="bulkActions" action="post.php" method="post">
} ?>"> <input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
<table class="table table-striped table-borderless table-hover">
<thead class="<?php if (!$num_rows[0]) {
echo "d-none";
} ?>">
<tr> <tr>
<td class="pr-0"> <td class="pr-0">
<div class="form-check"> <div class="form-check">
@@ -89,9 +90,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<th><a class="text-dark">Next Run Date</a></th> <th><a class="text-dark">Next Run Date</a></th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php
@@ -103,7 +104,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
$scheduled_ticket_frequency = nullable_htmlentities($row['scheduled_ticket_frequency']); $scheduled_ticket_frequency = nullable_htmlentities($row['scheduled_ticket_frequency']);
$scheduled_ticket_next_run = nullable_htmlentities($row['scheduled_ticket_next_run']); $scheduled_ticket_next_run = nullable_htmlentities($row['scheduled_ticket_next_run']);
$scheduled_ticket_client_name = nullable_htmlentities($row['client_name']); $scheduled_ticket_client_name = nullable_htmlentities($row['client_name']);
?> ?>
<tr> <tr>
<td class="pr-0"> <td class="pr-0">
@@ -116,8 +117,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</th> </th>
<td> <td>
<a href="#" data-toggle="modal" data-target="#editScheduledTicketModal" <a href="#" data-toggle="modal" data-target="#editScheduledTicketModal" onclick="populateScheduledTicketEditModal(<?php echo $scheduled_ticket_client_id, ",", $scheduled_ticket_id ?>)"> <?php echo $scheduled_ticket_subject ?>
onclick="populateScheduledTicketEditModal(<?php echo $scheduled_ticket_client_id, ",", $scheduled_ticket_id ?>)"> <?php echo $scheduled_ticket_subject ?>
</a> </a>
</td> </td>
@@ -133,8 +133,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<i class="fas fa-ellipsis-h"></i> <i class="fas fa-ellipsis-h"></i>
</button> </button>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" <a class="dropdown-item" href="#" data-toggle="modal" data-target="#editScheduledTicketModal" onclick="populateScheduledTicketEditModal(<?php echo $scheduled_ticket_client_id, ",", $scheduled_ticket_id ?>)">
data-target="#editScheduledTicketModal" onclick="populateScheduledTicketEditModal(<?php echo $scheduled_ticket_client_id, ",", $scheduled_ticket_id ?>)">
<i class="fas fa-fw fa-edit mr-2"></i>Edit <i class="fas fa-fw fa-edit mr-2"></i>Edit
</a> </a>
<?php <?php
@@ -152,22 +151,22 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<?php } ?> <?php } ?>
</tbody> </tbody>
</table> </table>
</form> </form>
</div>
<?php require_once 'pagination.php';
?>
</div> </div>
</div>
<script src="js/scheduled_tickets_edit_modal.js"></script> <?php require_once 'pagination.php';
<script src="js/bulk_actions.js"></script> ?>
</div>
</div>
<script src="js/scheduled_tickets_edit_modal.js"></script>
<script src="js/bulk_actions.js"></script>
<?php <?php
require_once "scheduled_ticket_add_modal.php"; require_once "scheduled_ticket_add_modal.php";
@@ -175,4 +174,3 @@ require_once "scheduled_ticket_add_modal.php";
require_once "scheduled_ticket_edit_modal.php"; require_once "scheduled_ticket_edit_modal.php";
require_once "footer.php"; require_once "footer.php";

View File

@@ -14,14 +14,18 @@
<ul class="nav nav-pills nav-sidebar flex-column mt-3" data-widget="treeview" data-accordion="false"> <ul class="nav nav-pills nav-sidebar flex-column mt-3" data-widget="treeview" data-accordion="false">
<li class="nav-item"> <li class="nav-item">
<a href="dashboard.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "dashboard.php") { echo "active"; } ?>"> <a href="dashboard.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "dashboard.php") {
echo "active";
} ?>">
<i class="nav-icon fas fa-tachometer-alt"></i> <i class="nav-icon fas fa-tachometer-alt"></i>
<p>Dashboard</p> <p>Dashboard</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="clients.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "clients.php") { echo "active"; } ?>"> <a href="clients.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "clients.php") {
echo "active";
} ?>">
<i class="nav-icon fas fa-user-friends"></i> <i class="nav-icon fas fa-user-friends"></i>
<p>Clients</p> <p>Clients</p>
</a> </a>
@@ -31,7 +35,9 @@
<li class="nav-header mt-3">SUPPORT</li> <li class="nav-header mt-3">SUPPORT</li>
<li class="nav-item"> <li class="nav-item">
<a href="tickets.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "tickets.php" || basename($_SERVER["PHP_SELF"]) == "ticket.php" || basename($_SERVER["PHP_SELF"]) == "scheduled_tickets.php") { echo "active"; } ?>"> <a href="tickets.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "tickets.php" || basename($_SERVER["PHP_SELF"]) == "ticket.php" || basename($_SERVER["PHP_SELF"]) == "scheduled_tickets.php") {
echo "active";
} ?>">
<i class="nav-icon fas fa-life-ring"></i> <i class="nav-icon fas fa-life-ring"></i>
<p>Tickets</p> <p>Tickets</p>
</a> </a>
@@ -40,7 +46,9 @@
<?php } ?> <?php } ?>
<li class="nav-item"> <li class="nav-item">
<a href="calendar_events.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "calendar_events.php") { echo "active"; } ?>"> <a href="calendar_events.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "calendar_events.php") {
echo "active";
} ?>">
<i class="nav-icon fas fa-calendar-alt"></i> <i class="nav-icon fas fa-calendar-alt"></i>
<p>Calendar</p> <p>Calendar</p>
</a> </a>
@@ -50,31 +58,41 @@
<li class="nav-header mt-3">SALES</li> <li class="nav-header mt-3">SALES</li>
<li class="nav-item"> <li class="nav-item">
<a href="quotes.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "quotes.php" || basename($_SERVER["PHP_SELF"]) == "quote.php") { echo "active"; } ?>"> <a href="quotes.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "quotes.php" || basename($_SERVER["PHP_SELF"]) == "quote.php") {
echo "active";
} ?>">
<i class="nav-icon fas fa-comment-dollar"></i> <i class="nav-icon fas fa-comment-dollar"></i>
<p>Quotes</p> <p>Quotes</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="invoices.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "invoices.php" || basename($_SERVER["PHP_SELF"]) == "invoice.php") { echo "active"; } ?>"> <a href="invoices.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "invoices.php" || basename($_SERVER["PHP_SELF"]) == "invoice.php") {
echo "active";
} ?>">
<i class="nav-icon fas fa-file-invoice"></i> <i class="nav-icon fas fa-file-invoice"></i>
<p>Invoices</p> <p>Invoices</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="recurring_invoices.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "recurring_invoices.php") { echo "active"; } ?>"> <a href="recurring_invoices.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "recurring_invoices.php") {
echo "active";
} ?>">
<i class="nav-icon fas fa-redo-alt"></i> <i class="nav-icon fas fa-redo-alt"></i>
<p>Recurring Invoices</p> <p>Recurring Invoices</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="revenues.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "revenues.php") { echo "active"; } ?>"> <a href="revenues.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "revenues.php") {
echo "active";
} ?>">
<i class="nav-icon fas fa-hand-holding-usd"></i> <i class="nav-icon fas fa-hand-holding-usd"></i>
<p>Revenues</p> <p>Revenues</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="products.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "products.php") { echo "active"; } ?>"> <a href="products.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "products.php") {
echo "active";
} ?>">
<i class="nav-icon fas fa-box-open"></i> <i class="nav-icon fas fa-box-open"></i>
<p>Products</p> <p>Products</p>
</a> </a>
@@ -86,60 +104,78 @@
<li class="nav-header mt-3">FINANCE</li> <li class="nav-header mt-3">FINANCE</li>
<li class="nav-item"> <li class="nav-item">
<a href="payments.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "payments.php") { echo "active"; } ?>"> <a href="payments.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "payments.php") {
echo "active";
} ?>">
<i class="nav-icon fas fa-credit-card"></i> <i class="nav-icon fas fa-credit-card"></i>
<p>Payments</p> <p>Payments</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="vendors.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "vendors.php") { echo "active"; } ?>"> <a href="vendors.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "vendors.php") {
echo "active";
} ?>">
<i class="nav-icon fas fa-building"></i> <i class="nav-icon fas fa-building"></i>
<p>Vendors</p> <p>Vendors</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="expenses.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "expenses.php") { echo "active"; } ?>"> <a href="expenses.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "expenses.php") {
echo "active";
} ?>">
<i class="nav-icon fas fa-shopping-cart"></i> <i class="nav-icon fas fa-shopping-cart"></i>
<p>Expenses</p> <p>Expenses</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="recurring_expenses.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "recurring_expenses.php") { echo "active"; } ?>"> <a href="recurring_expenses.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "recurring_expenses.php") {
echo "active";
} ?>">
<i class="nav-icon fas fa-redo-alt"></i> <i class="nav-icon fas fa-redo-alt"></i>
<p>Recurring Expenses</p> <p>Recurring Expenses</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="accounts.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "accounts.php") { echo "active"; } ?>"> <a href="accounts.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "accounts.php") {
echo "active";
} ?>">
<i class="nav-icon fas fa-piggy-bank"></i> <i class="nav-icon fas fa-piggy-bank"></i>
<p>Accounts</p> <p>Accounts</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="transfers.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "transfers.php") { echo "active"; } ?>"> <a href="transfers.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "transfers.php") {
echo "active";
} ?>">
<i class="nav-icon fas fa-exchange-alt"></i> <i class="nav-icon fas fa-exchange-alt"></i>
<p>Transfers</p> <p>Transfers</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="budget.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "budget.php") { echo "active"; } ?>"> <a href="budget.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "budget.php") {
echo "active";
} ?>">
<i class="nav-icon fas fa-balance-scale"></i> <i class="nav-icon fas fa-balance-scale"></i>
<p>Budget</p> <p>Budget</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="trips.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "trips.php") { echo "active"; } ?>"> <a href="trips.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "trips.php") {
<i class="nav-icon fas fa-route"></i> echo "active";
<p>Trips</p> } ?>">
</a> <i class="nav-icon fas fa-route"></i>
</li> <p>Trips</p>
</a>
</li>
<?php } ?> <?php } ?>
<li class="nav-header mt-3">MORE</li> <li class="nav-header mt-3">MORE</li>
<li class="nav-item"> <li class="nav-item">
<a href="report_income_summary.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "report_income_summary.php") { echo "active"; } ?>"> <a href="report_income_summary.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "report_income_summary.php") {
echo "active";
} ?>">
<i class="fas fa-chart-line nav-icon"></i> <i class="fas fa-chart-line nav-icon"></i>
<p>Reports</p> <p>Reports</p>
<i class="fas fa-angle-right nav-icon float-right"></i> <i class="fas fa-angle-right nav-icon float-right"></i>
@@ -148,13 +184,13 @@
<?php if ($session_user_role == 3) { ?> <?php if ($session_user_role == 3) { ?>
<li class="nav-item"> <li class="nav-item">
<a href="users.php" class="nav-link"> <a href="users.php" class="nav-link">
<i class="nav-icon fas fa-cogs"></i> <i class="nav-icon fas fa-cogs"></i>
<p>Administration</p> <p>Administration</p>
<i class="fas fa-angle-right nav-icon float-right"></i> <i class="fas fa-angle-right nav-icon float-right"></i>
</a> </a>
</li> </li>
<?php } ?> <?php } ?>

View File

@@ -34,8 +34,6 @@ if (isset($_GET['ticket_id'])) {
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1><a class='btn btn-lg btn-secondary mt-3' href='tickets.php'><i class='fa fa-fw fa-arrow-left'></i> Go Back</a></center>"; echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1><a class='btn btn-lg btn-secondary mt-3' href='tickets.php'><i class='fa fa-fw fa-arrow-left'></i> Go Back</a></center>";
include_once "footer.php"; include_once "footer.php";
} else { } else {
$row = mysqli_fetch_array($sql); $row = mysqli_fetch_array($sql);
@@ -193,13 +191,15 @@ if (isset($_GET['ticket_id'])) {
$warranty_check = date('m/d/Y', strtotime('-8 hours')); $warranty_check = date('m/d/Y', strtotime('-8 hours'));
if ($dt_value <= $date) { if ($dt_value <= $date) {
$dt_value = "Expired on $asset_warranty_expire"; $warranty_status_color ='red'; $dt_value = "Expired on $asset_warranty_expire";
$warranty_status_color = 'red';
} else { } else {
$warranty_status_color = 'green'; $warranty_status_color = 'green';
} }
if ($asset_warranty_expire == "NULL") { if ($asset_warranty_expire == "NULL") {
$dt_value = "None"; $warranty_status_color ='red'; $dt_value = "None";
$warranty_status_color = 'red';
} }
// Get all ticket replies // Get all ticket replies
@@ -228,7 +228,7 @@ if (isset($_GET['ticket_id'])) {
AND ticket_attachment_ticket_id = $ticket_id" AND ticket_attachment_ticket_id = $ticket_id"
); );
?> ?>
<!-- Breadcrumbs--> <!-- Breadcrumbs-->
<ol class="breadcrumb d-print-none"> <ol class="breadcrumb d-print-none">
@@ -246,30 +246,30 @@ if (isset($_GET['ticket_id'])) {
<h3><i class="fas fa-fw fa-life-ring text-secondary mr-2"></i>Ticket <?php echo "$ticket_prefix$ticket_number"; ?> <?php echo $ticket_status_display; ?></h3> <h3><i class="fas fa-fw fa-life-ring text-secondary mr-2"></i>Ticket <?php echo "$ticket_prefix$ticket_number"; ?> <?php echo $ticket_status_display; ?></h3>
</div> </div>
<?php if ($ticket_status != "Closed") { ?> <?php if ($ticket_status != "Closed") { ?>
<div class="col-3"> <div class="col-3">
<div class="dropdown dropleft text-center d-print-none"> <div class="dropdown dropleft text-center d-print-none">
<button class="btn btn-secondary btn-sm float-right" type="button" id="dropdownMenuButton" data-toggle="dropdown"> <button class="btn btn-secondary btn-sm float-right" type="button" id="dropdownMenuButton" data-toggle="dropdown">
<i class="fas fa-fw fa-ellipsis-v"></i> <i class="fas fa-fw fa-ellipsis-v"></i>
</button> </button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editTicketModal<?php echo $ticket_id; ?>"> <a class="dropdown-item" href="#" data-toggle="modal" data-target="#editTicketModal<?php echo $ticket_id; ?>">
<i class="fas fa-fw fa-edit mr-2"></i>Edit <i class="fas fa-fw fa-edit mr-2"></i>Edit
</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#mergeTicketModal<?php echo $ticket_id; ?>">
<i class="fas fa-fw fa-clone mr-2"></i>Merge
</a>
<a class="dropdown-item" href="#" data-toggle="modal" id="clientChangeTicketModalLoad" data-target="#clientChangeTicketModal">
<i class="fas fa-fw fa-people-carry mr-2"></i>Change Client
</a>
<?php if ($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_ticket=<?php echo $ticket_id; ?>">
<i class="fas fa-fw fa-trash mr-2"></i>Delete
</a> </a>
<?php } ?> <a class="dropdown-item" href="#" data-toggle="modal" data-target="#mergeTicketModal<?php echo $ticket_id; ?>">
<i class="fas fa-fw fa-clone mr-2"></i>Merge
</a>
<a class="dropdown-item" href="#" data-toggle="modal" id="clientChangeTicketModalLoad" data-target="#clientChangeTicketModal">
<i class="fas fa-fw fa-people-carry mr-2"></i>Change Client
</a>
<?php if ($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_ticket=<?php echo $ticket_id; ?>">
<i class="fas fa-fw fa-trash mr-2"></i>Delete
</a>
<?php } ?>
</div>
</div> </div>
</div> </div>
</div>
<?php } ?> <?php } ?>
</div> </div>
@@ -312,12 +312,22 @@ if (isset($_GET['ticket_id'])) {
<span class="input-group-text"><i class="fa fa-fw fa-thermometer-half"></i></span> <span class="input-group-text"><i class="fa fa-fw fa-thermometer-half"></i></span>
</div> </div>
<select class="form-control select2" name="status" required> <select class="form-control select2" name="status" required>
<option <?php if ($ticket_status == "In-Progress") {echo "selected";}?> >In-Progress</option> <option <?php if ($ticket_status == "In-Progress") {
<option <?php if ($ticket_status == "Pending-Client") {echo "selected";}?> >Pending-Client</option> echo "selected";
<option <?php if ($ticket_status == "Pending-Vendor") {echo "selected";}?> >Pending-Vendor</option> } ?>>In-Progress</option>
<option <?php if ($ticket_status == "Pending-Shipment") {echo "selected";}?> >Pending-Shipment</option> <option <?php if ($ticket_status == "Pending-Client") {
<?php if($config_ticket_autoclose) { ?> echo "selected";
<option <?php if ($ticket_status == 'Auto Close') { echo "selected"; } ?> >Auto Close</option> } ?>>Pending-Client</option>
<option <?php if ($ticket_status == "Pending-Vendor") {
echo "selected";
} ?>>Pending-Vendor</option>
<option <?php if ($ticket_status == "Pending-Shipment") {
echo "selected";
} ?>>Pending-Shipment</option>
<?php if ($config_ticket_autoclose) { ?>
<option <?php if ($ticket_status == 'Auto Close') {
echo "selected";
} ?>>Auto Close</option>
<?php } ?> <?php } ?>
</select> </select>
</div> </div>
@@ -365,16 +375,16 @@ if (isset($_GET['ticket_id'])) {
<div class="form-row"> <div class="form-row">
<?php if(!empty($contact_email && $contact_email !== $session_email)){ ?> <?php if (!empty($contact_email && $contact_email !== $session_email)) { ?>
<div class="col-md-2"> <div class="col-md-2">
<div class="form-group"> <div class="form-group">
<div class="custom-control custom-checkbox"> <div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="ticket_reply_type_checkbox" name="public_reply_type" value="1" checked> <input type="checkbox" class="custom-control-input" id="ticket_reply_type_checkbox" name="public_reply_type" value="1" checked>
<label class="custom-control-label" for="ticket_reply_type_checkbox">Email contact<br><small class="text-secondary">(Public Update)</small></label> <label class="custom-control-label" for="ticket_reply_type_checkbox">Email contact<br><small class="text-secondary">(Public Update)</small></label>
</div>
</div> </div>
</div> </div>
</div>
<?php } ?> <?php } ?>
@@ -424,9 +434,15 @@ if (isset($_GET['ticket_id'])) {
AND ticket_attachment_ticket_id = $ticket_id" AND ticket_attachment_ticket_id = $ticket_id"
); );
?> ?>
<div class="card card-outline <?php if ($ticket_reply_type == 'Internal') { echo "card-dark"; } elseif ($ticket_reply_type == 'Client') {echo "card-warning"; } else { echo "card-info"; } ?> mb-3"> <div class="card card-outline <?php if ($ticket_reply_type == 'Internal') {
echo "card-dark";
} elseif ($ticket_reply_type == 'Client') {
echo "card-warning";
} else {
echo "card-info";
} ?> mb-3">
<div class="card-header"> <div class="card-header">
<h3 class="card-title"> <h3 class="card-title">
<div class="media"> <div class="media">
@@ -442,7 +458,9 @@ if (isset($_GET['ticket_id'])) {
<div class="media-body"> <div class="media-body">
<?php echo $ticket_reply_by_display; ?> <?php echo $ticket_reply_by_display; ?>
<div> <div>
<small class="text-muted"><?php echo $ticket_reply_created_at; ?> <?php if (!empty($ticket_reply_updated_at)) { echo "modified: $ticket_reply_updated_at"; } ?></small> <small class="text-muted"><?php echo $ticket_reply_created_at; ?> <?php if (!empty($ticket_reply_updated_at)) {
echo "modified: $ticket_reply_updated_at";
} ?></small>
</div> </div>
<?php if ($ticket_reply_type !== "Client") { ?> <?php if ($ticket_reply_type !== "Client") { ?>
<div> <div>
@@ -490,11 +508,9 @@ if (isset($_GET['ticket_id'])) {
</div> </div>
<?php <?php
require "ticket_reply_edit_modal.php"; require "ticket_reply_edit_modal.php";
} }
?> ?>
@@ -569,7 +585,7 @@ if (isset($_GET['ticket_id'])) {
$prev_ticket_id = intval($prev_ticket_row['ticket_id']); $prev_ticket_id = intval($prev_ticket_row['ticket_id']);
$prev_ticket_subject = nullable_htmlentities($prev_ticket_row['ticket_subject']); $prev_ticket_subject = nullable_htmlentities($prev_ticket_row['ticket_subject']);
$prev_ticket_status = nullable_htmlentities($prev_ticket_row['ticket_status']); $prev_ticket_status = nullable_htmlentities($prev_ticket_row['ticket_status']);
?> ?>
<hr> <hr>
<div> <div>
@@ -580,7 +596,7 @@ if (isset($_GET['ticket_id'])) {
<i class="fa fa-fw fa-hourglass-start text-secondary ml-1 mr-2"></i><strong>Status:</strong> <i class="fa fa-fw fa-hourglass-start text-secondary ml-1 mr-2"></i><strong>Status:</strong>
<span class="text-success"><?php echo $prev_ticket_status; ?></span> <span class="text-success"><?php echo $prev_ticket_status; ?></span>
</div> </div>
<?php } ?> <?php } ?>
<?php } else { ?> <?php } else { ?>
<div class="d-print-none"> <div class="d-print-none">
@@ -605,11 +621,10 @@ if (isset($_GET['ticket_id'])) {
while ($ticket_watcher_row = mysqli_fetch_array($sql_ticket_watchers)) { while ($ticket_watcher_row = mysqli_fetch_array($sql_ticket_watchers)) {
$watcher_id = intval($ticket_watcher_row['watcher_id']); $watcher_id = intval($ticket_watcher_row['watcher_id']);
$ticket_watcher_email = nullable_htmlentities($ticket_watcher_row['watcher_email']); $ticket_watcher_email = nullable_htmlentities($ticket_watcher_row['watcher_email']);
?> ?>
<div class='mt-1'> <div class='mt-1'>
<i class="fa fa-fw fa-eye text-secondary ml-1 mr-2"></i><?php echo $ticket_watcher_email; ?> <i class="fa fa-fw fa-eye text-secondary ml-1 mr-2"></i><?php echo $ticket_watcher_email; ?>
<a class="confirm-link" <a class="confirm-link" href="post.php?delete_ticket_watcher=<?php echo $watcher_id; ?>">
href="post.php?delete_ticket_watcher=<?php echo $watcher_id; ?>">
<i class="fas fa-fw fa-times text-secondary ml-1"></i> <i class="fas fa-fw fa-times text-secondary ml-1"></i>
</a> </a>
</div> </div>
@@ -693,7 +708,7 @@ if (isset($_GET['ticket_id'])) {
<?php } else { ?> <?php } else { ?>
<div> <div>
<a href='client_asset_details.php?client_id=<?php echo $client_id?>&asset_id=<?php echo $asset_id?>' ><i class="fa fa-fw fa-desktop text-secondary ml-1 mr-2"></i><strong><?php echo $asset_name; ?></strong></a> <a href='client_asset_details.php?client_id=<?php echo $client_id ?>&asset_id=<?php echo $asset_id ?>'><i class="fa fa-fw fa-desktop text-secondary ml-1 mr-2"></i><strong><?php echo $asset_name; ?></strong></a>
</div> </div>
<?php if (!empty($asset_os)) { ?> <?php if (!empty($asset_os)) { ?>
@@ -757,12 +772,12 @@ if (isset($_GET['ticket_id'])) {
$service_ticket_status = nullable_htmlentities($row['ticket_status']); $service_ticket_status = nullable_htmlentities($row['ticket_status']);
$service_ticket_created_at = nullable_htmlentities($row['ticket_created_at']); $service_ticket_created_at = nullable_htmlentities($row['ticket_created_at']);
$service_ticket_updated_at = nullable_htmlentities($row['ticket_updated_at']); $service_ticket_updated_at = nullable_htmlentities($row['ticket_updated_at']);
?> ?>
<p> <p>
<i class="fas fa-fw fa-ticket-alt"></i> <i class="fas fa-fw fa-ticket-alt"></i>
Ticket: <a href="ticket.php?ticket_id=<?php echo $service_ticket_id; ?>"><?php echo "$service_ticket_prefix$service_ticket_number" ?></a> <?php echo "on $service_ticket_created_at - <b>$service_ticket_subject</b> ($service_ticket_status)"; ?> Ticket: <a href="ticket.php?ticket_id=<?php echo $service_ticket_id; ?>"><?php echo "$service_ticket_prefix$service_ticket_number" ?></a> <?php echo "on $service_ticket_created_at - <b>$service_ticket_subject</b> ($service_ticket_status)"; ?>
</p> </p>
<?php <?php
} }
?> ?>
</div> </div>
@@ -774,9 +789,11 @@ if (isset($_GET['ticket_id'])) {
</div> </div>
</div> </div>
<?php } // End Ticket asset Count ?> <?php } // End Ticket asset Count
?>
<?php } // End if asset_id == 0 else ?> <?php } // End if asset_id == 0 else
?>
</div> </div>
<!-- End Asset card --> <!-- End Asset card -->
@@ -824,7 +841,8 @@ if (isset($_GET['ticket_id'])) {
</div> </div>
<?php } ?> <?php } ?>
<?php } //End Else ?> <?php } //End Else
?>
</div> </div>
<!-- End Vendor card --> <!-- End Vendor card -->
@@ -837,18 +855,24 @@ if (isset($_GET['ticket_id'])) {
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span> <span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
</div> </div>
<select class="form-control select2" name="assigned_to" <?php if ($ticket_status == "Closed") {echo "disabled";} ?>> <select class="form-control select2" name="assigned_to" <?php if ($ticket_status == "Closed") {
echo "disabled";
} ?>>
<option value="0">Not Assigned</option> <option value="0">Not Assigned</option>
<?php <?php
while ($row = mysqli_fetch_array($sql_assign_to_select)) { while ($row = mysqli_fetch_array($sql_assign_to_select)) {
$user_id = intval($row['user_id']); $user_id = intval($row['user_id']);
$user_name = nullable_htmlentities($row['user_name']); ?> $user_name = nullable_htmlentities($row['user_name']); ?>
<option <?php if ($ticket_assigned_to == $user_id) { echo "selected"; } ?> value="<?php echo $user_id; ?>"><?php echo $user_name; ?></option> <option <?php if ($ticket_assigned_to == $user_id) {
echo "selected";
} ?> value="<?php echo $user_id; ?>"><?php echo $user_name; ?></option>
<?php } ?> <?php } ?>
</select> </select>
<div class="input-group-append d-print-none"> <div class="input-group-append d-print-none">
<button type="submit" class="btn btn-primary" name="assign_ticket" <?php if ($ticket_status == "Closed") {echo "disabled";} ?>><i class="fas fa-check"></i></button> <button type="submit" class="btn btn-primary" name="assign_ticket" <?php if ($ticket_status == "Closed") {
echo "disabled";
} ?>><i class="fas fa-check"></i></button>
</div> </div>
</div> </div>
</div> </div>
@@ -872,7 +896,7 @@ if (isset($_GET['ticket_id'])) {
</div> </div>
<?php <?php
require_once "ticket_edit_modal.php"; require_once "ticket_edit_modal.php";
require_once "ticket_edit_contact_modal.php"; require_once "ticket_edit_contact_modal.php";
@@ -895,9 +919,7 @@ if (isset($_GET['ticket_id'])) {
require_once "ticket_edit_billable_modal.php"; require_once "ticket_edit_billable_modal.php";
require_once "ticket_invoice_add_modal.php"; require_once "ticket_invoice_add_modal.php";
} }
} }
} }
@@ -911,7 +933,7 @@ require_once "footer.php";
<script src="js/show_modals.js"></script> <?php <script src="js/show_modals.js"></script> <?php
if ($ticket_status !== "Closed") { ?> if ($ticket_status !== "Closed") { ?>
<!-- Ticket Time Tracking JS --> <!-- Ticket Time Tracking JS -->
<script src="js/ticket_time_tracking.js"></script> <script src="js/ticket_time_tracking.js"></script>
@@ -921,4 +943,3 @@ if ($ticket_status !== "Closed") { ?>
<?php } ?> <?php } ?>
<script src="js/pretty_content.js"></script> <script src="js/pretty_content.js"></script>

View File

@@ -16,11 +16,9 @@
<div class="form-group"> <div class="form-group">
<label>Scheduled Date and Time</label> <label>Scheduled Date and Time</label>
<?php if (!$ticket_scheduled_for) { ?> <?php if (!$ticket_scheduled_for) { ?>
<input type="datetime-local" class="form-control" name="scheduled_date_time" <input type="datetime-local" class="form-control" name="scheduled_date_time" placeholder="Scheduled Date & Time">
placeholder="Scheduled Date & Time">
<?php } else { ?> <?php } else { ?>
<input type="datetime-local" class="form-control" name="scheduled_date_time" <input type="datetime-local" class="form-control" name="scheduled_date_time" value="<?php echo $ticket_scheduled_for; ?>">
value="<?php echo $ticket_scheduled_for; ?>">
<?php } ?> <?php } ?>
</div> </div>
@@ -34,10 +32,8 @@
</div> </div>
<div class="modal-footer bg-white"> <div class="modal-footer bg-white">
<button type="submit" name="edit_ticket_schedule" class="btn btn-primary text-bold"><i <button type="submit" name="edit_ticket_schedule" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
class="fa fa-check mr-2"></i>Save</button> <button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
<button type="button" class="btn btn-light" data-dismiss="modal"><i
class="fa fa-times mr-2"></i>Cancel</button>
</div> </div>
</form> </form>

View File

@@ -39,7 +39,7 @@ if (isset($_GET['assigned']) & !empty($_GET['assigned'])) {
if ($_GET['assigned'] == 'unassigned') { if ($_GET['assigned'] == 'unassigned') {
$ticket_assigned_filter = 'AND ticket_assigned_to = 0'; $ticket_assigned_filter = 'AND ticket_assigned_to = 0';
} else { } else {
$ticket_assigned_filter = 'AND ticket_assigned_to = '.intval($_GET['assigned']); $ticket_assigned_filter = 'AND ticket_assigned_to = ' . intval($_GET['assigned']);
} }
} else { } else {
// Default - any // Default - any
@@ -117,10 +117,11 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
<div class="row"> <div class="row">
<div class="col-sm-4"> <div class="col-sm-4">
<div class="input-group"> <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"> <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"> <div class="input-group-append">
<button class="btn btn-secondary" type="button" data-toggle="collapse" <button class="btn btn-secondary" type="button" data-toggle="collapse" data-target="#advancedFilter"><i class="fas fa-filter"></i></button>
data-target="#advancedFilter"><i class="fas fa-filter"></i></button>
<button class="btn btn-primary"><i class="fa fa-search"></i></button> <button class="btn btn-primary"><i class="fa fa-search"></i></button>
</div> </div>
</div> </div>
@@ -172,47 +173,49 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
</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="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="row">
<div class="col-md-2"> <div class="col-md-2">
<div class="form-group"> <div class="form-group">
<label>Canned Date</label> <label>Canned Date</label>
<select class="form-control select2" name="canned_date"> <select class="form-control select2" name="canned_date">
<option <?php if ($_GET['canned_date'] == "custom") { <option <?php if ($_GET['canned_date'] == "custom") {
echo "selected"; echo "selected";
} ?> value="custom">Custom } ?> value="custom">Custom
</option> </option>
<option <?php if ($_GET['canned_date'] == "today") { <option <?php if ($_GET['canned_date'] == "today") {
echo "selected"; echo "selected";
} ?> value="today">Today } ?> value="today">Today
</option> </option>
<option <?php if ($_GET['canned_date'] == "yesterday") { <option <?php if ($_GET['canned_date'] == "yesterday") {
echo "selected"; echo "selected";
} ?> value="yesterday">Yesterday } ?> value="yesterday">Yesterday
</option> </option>
<option <?php if ($_GET['canned_date'] == "thisweek") { <option <?php if ($_GET['canned_date'] == "thisweek") {
echo "selected"; echo "selected";
} ?> value="thisweek">This Week } ?> value="thisweek">This Week
</option> </option>
<option <?php if ($_GET['canned_date'] == "lastweek") { <option <?php if ($_GET['canned_date'] == "lastweek") {
echo "selected"; echo "selected";
} ?> value="lastweek">Last Week } ?> value="lastweek">Last Week
</option> </option>
<option <?php if ($_GET['canned_date'] == "thismonth") { <option <?php if ($_GET['canned_date'] == "thismonth") {
echo "selected"; echo "selected";
} ?> value="thismonth">This Month } ?> value="thismonth">This Month
</option> </option>
<option <?php if ($_GET['canned_date'] == "lastmonth") { <option <?php if ($_GET['canned_date'] == "lastmonth") {
echo "selected"; echo "selected";
} ?> value="lastmonth">Last Month } ?> value="lastmonth">Last Month
</option> </option>
<option <?php if ($_GET['canned_date'] == "thisyear") { <option <?php if ($_GET['canned_date'] == "thisyear") {
echo "selected"; echo "selected";
} ?> value="thisyear">This Year } ?> value="thisyear">This Year
</option> </option>
<option <?php if ($_GET['canned_date'] == "lastyear") { <option <?php if ($_GET['canned_date'] == "lastyear") {
echo "selected"; echo "selected";
} ?> value="lastyear">Last Year } ?> value="lastyear">Last Year
</option> </option>
</select> </select>
</div> </div>
@@ -232,14 +235,28 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
<div class="col-md-2"> <div class="col-md-2">
<div class="form-group"> <div class="form-group">
<label>Ticket Status</label> <label>Ticket Status</label>
<select class="form-control select2" name="status[]" data-placeholder = "Select Status" multiple> <select class="form-control select2" name="status[]" data-placeholder="Select Status" multiple>
<option value="In-Progress" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('In-Progress', $_GET['status'])) { echo 'selected'; } ?> >In-Progress</option> <option value="In-Progress" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('In-Progress', $_GET['status'])) {
<option value="Client-Replied" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('Client-Replied', $_GET['status'])) { echo 'selected'; } ?> >Client-Replied</option> echo 'selected';
<option value="Pending-Client" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('Pending-Client', $_GET['status'])) { echo 'selected'; } ?> >Pending-Client</option> } ?>>In-Progress</option>
<option value="Pending-Vendor" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('Pending-Vendor', $_GET['status'])) { echo 'selected'; } ?> >Pending-Vendor</option> <option value="Client-Replied" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('Client-Replied', $_GET['status'])) {
<option value="Pending-Shipment" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('Pending-Shipment', $_GET['status'])) { echo 'selected'; } ?> >Pending-Shipment</option> echo 'selected';
<option value="Scheduled" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('Scheduled', $_GET['status'])) { echo 'selected'; } ?> >Scheduled</option> } ?>>Client-Replied</option>
<option value="Closed" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('Closed', $_GET['status'])) { echo 'selected'; } ?> >Closed</option> <option value="Pending-Client" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('Pending-Client', $_GET['status'])) {
echo 'selected';
} ?>>Pending-Client</option>
<option value="Pending-Vendor" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('Pending-Vendor', $_GET['status'])) {
echo 'selected';
} ?>>Pending-Vendor</option>
<option value="Pending-Shipment" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('Pending-Shipment', $_GET['status'])) {
echo 'selected';
} ?>>Pending-Shipment</option>
<option value="Scheduled" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('Scheduled', $_GET['status'])) {
echo 'selected';
} ?>>Scheduled</option>
<option value="Closed" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('Closed', $_GET['status'])) {
echo 'selected';
} ?>>Closed</option>
</select> </select>
</div> </div>
</div> </div>
@@ -247,17 +264,23 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
<div class="form-group"> <div class="form-group">
<label>Assigned to</label> <label>Assigned to</label>
<select class="form-control select2" name="assigned"> <select class="form-control select2" name="assigned">
<option value="" <?php if ($ticket_assigned_filter == "") {echo "selected";}?> >Any</option> <option value="" <?php if ($ticket_assigned_filter == "") {
<option value="unassigned"<?php if ($ticket_assigned_filter == "0") {echo "selected";}?> >Unassigned</option> echo "selected";
} ?>>Any</option>
<option value="unassigned" <?php if ($ticket_assigned_filter == "0") {
echo "selected";
} ?>>Unassigned</option>
<?php <?php
$sql_assign_to = mysqli_query($mysqli, "SELECT * FROM users WHERE user_archived_at IS NULL ORDER BY user_name ASC"); $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)) { while ($row = mysqli_fetch_array($sql_assign_to)) {
$user_id = intval($row['user_id']); $user_id = intval($row['user_id']);
$user_name = nullable_htmlentities($row['user_name']); $user_name = nullable_htmlentities($row['user_name']);
?> ?>
<option <?php if ($ticket_assigned_filter == $user_id) { echo "selected"; } ?> value="<?php echo $user_id; ?>"><?php echo $user_name; ?></option> <option <?php if ($ticket_assigned_filter == $user_id) {
<?php echo "selected";
} ?> value="<?php echo $user_id; ?>"><?php echo $user_name; ?></option>
<?php
} }
?> ?>
@@ -272,192 +295,186 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>"> <input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
<div class="table-responsive-sm"> <div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover"> <table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if (!$num_rows[0]) { echo "d-none"; } ?>"> <thead class="text-dark <?php if (!$num_rows[0]) {
<tr> echo "d-none";
<td> } ?>">
<div class="form-check"> <tr>
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)"> <td>
</div> <div class="form-check">
</td> <input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
<th><a class="text-dark" </div>
href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_number&order=<?php echo $disp; ?>">Number</a> </td>
</th> <th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_number&order=<?php echo $disp; ?>">Number</a>
<th><a class="text-dark"
href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_subject&order=<?php echo $disp; ?>">Subject</a>
</th>
<th><a class="text-dark"
href="?<?php echo $url_query_strings_sort; ?>&sort=client_name&order=<?php echo $disp; ?>">Client / Contact</a>
</th>
<?php if ($config_module_enable_accounting) {
?>
<th class="text-center"><a class="text-dark"
href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_billable&order=<?php echo $disp; ?>">Billable</a>
</th> </th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_subject&order=<?php echo $disp; ?>">Subject</a>
</th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=client_name&order=<?php echo $disp; ?>">Client / Contact</a>
</th>
<?php if ($config_module_enable_accounting) {
?>
<th class="text-center"><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_billable&order=<?php echo $disp; ?>">Billable</a>
</th>
<?php <?php
} }
?> ?>
<th><a class="text-dark" <th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_priority&order=<?php echo $disp; ?>">Priority</a>
href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_priority&order=<?php echo $disp; ?>">Priority</a> </th>
</th> <th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_status&order=<?php echo $disp; ?>">Status</a>
<th><a class="text-dark" <th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_name&order=<?php echo $disp; ?>">Assigned</a>
href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_status&order=<?php echo $disp; ?>">Status</a> </th>
<th><a class="text-dark" <th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_updated_at&order=<?php echo $disp; ?>">Last Response</a>
href="?<?php echo $url_query_strings_sort; ?>&sort=user_name&order=<?php echo $disp; ?>">Assigned</a> </th>
</th> <th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_created_at&order=<?php echo $disp; ?>">Created</a>
<th><a class="text-dark" </th>
href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_updated_at&order=<?php echo $disp; ?>">Last Response</a>
</th>
<th><a class="text-dark"
href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_created_at&order=<?php echo $disp; ?>">Created</a>
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php
while ($row = mysqli_fetch_array($sql)) { while ($row = mysqli_fetch_array($sql)) {
$ticket_id = intval($row['ticket_id']); $ticket_id = intval($row['ticket_id']);
$ticket_prefix = nullable_htmlentities($row['ticket_prefix']); $ticket_prefix = nullable_htmlentities($row['ticket_prefix']);
$ticket_number = intval($row['ticket_number']); $ticket_number = intval($row['ticket_number']);
$ticket_subject = nullable_htmlentities($row['ticket_subject']); $ticket_subject = nullable_htmlentities($row['ticket_subject']);
$ticket_priority = nullable_htmlentities($row['ticket_priority']); $ticket_priority = nullable_htmlentities($row['ticket_priority']);
$ticket_status = nullable_htmlentities($row['ticket_status']); $ticket_status = nullable_htmlentities($row['ticket_status']);
$ticket_billable = intval($row['ticket_billable']); $ticket_billable = intval($row['ticket_billable']);
$ticket_vendor_ticket_number = nullable_htmlentities($row['ticket_vendor_ticket_number']); $ticket_vendor_ticket_number = nullable_htmlentities($row['ticket_vendor_ticket_number']);
$ticket_created_at = nullable_htmlentities($row['ticket_created_at']); $ticket_created_at = nullable_htmlentities($row['ticket_created_at']);
$ticket_created_at_time_ago = timeAgo($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 = nullable_htmlentities($row['ticket_updated_at']);
$ticket_updated_at_time_ago = timeAgo($row['ticket_updated_at']); $ticket_updated_at_time_ago = timeAgo($row['ticket_updated_at']);
if (empty($ticket_updated_at)) { if (empty($ticket_updated_at)) {
if ($ticket_status == "Closed") { if ($ticket_status == "Closed") {
$ticket_updated_at_display = "<p>Never</p>"; $ticket_updated_at_display = "<p>Never</p>";
} else {
$ticket_updated_at_display = "<p class='text-danger'>Never</p>";
}
} else { } 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_closed_at = nullable_htmlentities($row['ticket_closed_at']);
$ticket_updated_at_display = "$ticket_updated_at_time_ago<br><small class='text-secondary'>$ticket_updated_at</small>"; $client_id = intval($row['ticket_client_id']);
} $client_name = nullable_htmlentities($row['client_name']);
$ticket_closed_at = nullable_htmlentities($row['ticket_closed_at']); $contact_id = intval($row['ticket_contact_id']);
$client_id = intval($row['ticket_client_id']); $contact_name = nullable_htmlentities($row['contact_name']);
$client_name = nullable_htmlentities($row['client_name']); $contact_title = nullable_htmlentities($row['contact_title']);
$contact_id = intval($row['ticket_contact_id']); $contact_email = nullable_htmlentities($row['contact_email']);
$contact_name = nullable_htmlentities($row['contact_name']); $contact_phone = formatPhoneNumber($row['contact_phone']);
$contact_title = nullable_htmlentities($row['contact_title']); $contact_extension = nullable_htmlentities($row['contact_extension']);
$contact_email = nullable_htmlentities($row['contact_email']); $contact_mobile = formatPhoneNumber($row['contact_mobile']);
$contact_phone = formatPhoneNumber($row['contact_phone']); if ($ticket_status == "Pending-Assignment") {
$contact_extension = nullable_htmlentities($row['contact_extension']); $ticket_status_color = "danger";
$contact_mobile = formatPhoneNumber($row['contact_mobile']); } elseif ($ticket_status == "Assigned") {
if ($ticket_status == "Pending-Assignment") { $ticket_status_color = "primary";
$ticket_status_color = "danger"; } elseif ($ticket_status == "In-Progress") {
} elseif ($ticket_status == "Assigned") { $ticket_status_color = "success";
$ticket_status_color = "primary"; } elseif ($ticket_status == "Closed") {
} elseif ($ticket_status == "In-Progress") { $ticket_status_color = "dark";
$ticket_status_color = "success"; } elseif ($ticket_status == "Auto Close") {
} elseif ($ticket_status == "Closed") { $ticket_status_color = "dark";
$ticket_status_color = "dark"; } elseif ($ticket_status == "Client-Replied") {
} elseif ($ticket_status == "Auto Close") { $ticket_status_color = "warning";
$ticket_status_color = "dark";
} elseif ($ticket_status == "Client-Replied") {
$ticket_status_color = "warning";
} else{
$ticket_status_color = "secondary";
}
if ($ticket_priority == "High") {
$ticket_priority_color = "danger";
} elseif ($ticket_priority == "Medium") {
$ticket_priority_color = "warning";
} else{
$ticket_priority_color = "info";
}
$ticket_assigned_to = intval($row['ticket_assigned_to']);
if (empty($ticket_assigned_to)) {
if ($ticket_status == "Closed") {
$ticket_assigned_to_display = "<p>Not Assigned</p>";
} else { } else {
$ticket_assigned_to_display = "<p class='text-danger'>Not Assigned</p>"; $ticket_status_color = "secondary";
} }
} else {
$ticket_assigned_to_display = nullable_htmlentities($row['user_name']);
}
if (empty($contact_name)) { if ($ticket_priority == "High") {
$contact_display = "-"; $ticket_priority_color = "danger";
} else { } elseif ($ticket_priority == "Medium") {
$contact_display = "$contact_name<br><small class='text-secondary'>$contact_email</small>"; $ticket_priority_color = "warning";
} } else {
$ticket_priority_color = "info";
}
$ticket_assigned_to = intval($row['ticket_assigned_to']);
if (empty($ticket_assigned_to)) {
if ($ticket_status == "Closed") {
$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 = nullable_htmlentities($row['user_name']);
}
$asset_id = intval($row['ticket_asset_id']); if (empty($contact_name)) {
$vendor_id = intval($row['ticket_vendor_id']); $contact_display = "-";
} else {
$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']);
?> ?>
<tr class="<?php if(empty($ticket_updated_at)) { echo "text-bold"; }?>"> <tr class="<?php if (empty($ticket_updated_at)) {
<td> echo "text-bold";
<?php if($ticket_status !== "Closed") { ?> } ?>">
<div class="form-check"> <td>
<input class="form-check-input bulk-select" type="checkbox" name="ticket_ids[]" value="<?php echo $ticket_id ?>"> <?php if ($ticket_status !== "Closed") { ?>
</div> <div class="form-check">
<?php } ?> <input class="form-check-input bulk-select" type="checkbox" name="ticket_ids[]" value="<?php echo $ticket_id ?>">
</td> </div>
<td> <?php } ?>
<a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>"> </td>
<span class="badge badge-pill badge-secondary p-3"><?php echo "$ticket_prefix$ticket_number"; ?></span> <td>
</a> <a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>">
</td> <span class="badge badge-pill badge-secondary p-3"><?php echo "$ticket_prefix$ticket_number"; ?></span>
<td> </a>
<a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>"><?php echo $ticket_subject; ?></a> </td>
</td> <td>
<td> <a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>"><?php echo $ticket_subject; ?></a>
<a href="client_tickets.php?client_id=<?php echo $client_id; ?>"><strong><?php echo $client_name; ?></strong></a> </td>
<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> <div class="mt-1"><?php echo $contact_display; ?></div>
</td> </td>
<?php if ($config_module_enable_accounting) { <?php if ($config_module_enable_accounting) {
?> ?>
<td class="text-center"> <td class="text-center">
<a href="#" data-toggle="modal" data-target="#editTicketBillableModal<?php echo $ticket_id; ?>"> <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 <?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; ?>"><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></td>
?> <td><a href="#" data-toggle="modal" data-target="#assignTicketModal<?php echo $ticket_id; ?>"><?php echo $ticket_assigned_to_display; ?></a></td>
<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><?php echo $ticket_updated_at_display; ?></td>
<td><span class='p-2 badge badge-pill badge-<?php echo $ticket_status_color; ?>'><?php echo $ticket_status; ?></span></td> <td>
<td><a href="#" data-toggle="modal" data-target="#assignTicketModal<?php echo $ticket_id; ?>"><?php echo $ticket_assigned_to_display; ?></a></td> <?php echo $ticket_created_at_time_ago; ?>
<td><?php echo $ticket_updated_at_display; ?></td> <br>
<td> <small class="text-secondary"><?php echo $ticket_created_at; ?></small>
<?php echo $ticket_created_at_time_ago; ?> </td>
<br> </tr>
<small class="text-secondary"><?php echo $ticket_created_at; ?></small>
</td>
</tr>
<?php <?php
if ($ticket_status !== "Closed") { if ($ticket_status !== "Closed") {
// Temp performance boost for closed tickets, until we move to dynamic modals // Temp performance boost for closed tickets, until we move to dynamic modals
require "ticket_assign_modal.php"; require "ticket_assign_modal.php";
require "ticket_edit_priority_modal.php"; require "ticket_edit_priority_modal.php";
if ($config_module_enable_accounting) { if ($config_module_enable_accounting) {
require "ticket_edit_billable_modal.php"; require "ticket_edit_billable_modal.php";
}
} }
} }
} ?>
?>
</tbody> </tbody>
</table> </table>