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']);
require "calendar_event_edit_modal.php";
}
?>
<?php require_once "footer.php";
?>
?>
<script src='plugins/fullcalendar/main.min.js'></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
@ -121,7 +119,6 @@ while ($row = mysqli_fetch_array($sql)) {
$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' },";
}
//Tickets Scheduled
@ -137,7 +134,7 @@ while ($row = mysqli_fetch_array($sql)) {
if (strtotime($row['ticket_schedule']) < time()) {
if ($row['ticket_status'] == 'Scheduled') {
$event_color = "red";
}else {
} else {
$event_color = "green";
}
} else {
@ -175,13 +172,12 @@ while ($row = mysqli_fetch_array($sql)) {
],
eventClick: function(editEvent) {
$('#editEventModal'+editEvent.event.id).modal();
$('#editEventModal' + editEvent.event.id).modal();
}
});
calendar.render();
});
</script>
<!-- Automatically set new event end date to 1 hr after start date -->
@ -210,4 +206,4 @@ while ($row = mysqli_fetch_array($sql)) {
// Update the end date field
document.getElementById("event_add_end").value = new_end;
}
</script>
</script>

View File

@ -24,7 +24,7 @@ if ($config_enable_cron == 0) {
}
// Check Cron Key
if ( $argv[1] !== $config_cron_key ) {
if ($argv[1] !== $config_cron_key) {
exit("Cron Key invalid -- Quitting..");
}
@ -37,7 +37,7 @@ $lock_file_path = "{$temp_dir}/itflow_mail_queue_{$installation_id}.lock";
// Check for lock file to prevent concurrent script runs
if (file_exists($lock_file_path)) {
$file_age = time() - filemtime($lock_file_path);
// If file is older than 10 minutes (600 seconds), delete and continue
if ($file_age > 600) {
unlink($lock_file_path);
@ -111,7 +111,7 @@ if (mysqli_num_rows($sql_queue) > 0) {
// Update Message
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 3, email_sent_at = NOW(), email_attempts = 1 WHERE email_id = $email_id");
}
}
}
}
}
@ -131,6 +131,7 @@ if (mysqli_num_rows($sql_failed_queue) > 0) {
$email_content = $row['email_content'];
$email_queued_at = $row['email_queued_at'];
$email_sent_at = $row['email_sent_at'];
$email_ics_str = $row['email_cal_str'];
// Increment the attempts
$email_attempts = intval($row['email_attempts']) + 1;
@ -155,7 +156,8 @@ if (mysqli_num_rows($sql_failed_queue) > 0) {
$email_recipient,
$email_recipient_name,
$email_subject,
$email_content
$email_content,
$email_ics_str
);
if ($mail !== true) {
@ -168,7 +170,7 @@ if (mysqli_num_rows($sql_failed_queue) > 0) {
// Update Message
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 3, email_sent_at = NOW(), email_attempts = $email_attempts WHERE email_id = $email_id");
}
}
}
}
}

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>")),
'cal_str' => $cal_str
];
}
}
$response = addToMailQueue($mysqli, $data);
$response = addToMailQueue($mysqli, $data);
// 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");
// 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");
//Logging
mysqli_query(
$mysqli,
"INSERT INTO logs SET
//Logging
mysqli_query(
$mysqli,
"INSERT INTO logs SET
log_type = 'Ticket',
log_action = 'Modify',
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_id = $session_user_id,
log_entity_id = $ticket_id"
);
);
if(empty($conflicting_tickets)){
$_SESSION['alert_message'] = "Ticket scheduled for $email_datetime";
header("Location: " . $_SERVER["HTTP_REFERER"]);
} else {
$_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);
header("Location: calendar_events.php");
}
if (empty($conflicting_tickets)) {
$_SESSION['alert_message'] = "Ticket scheduled for $email_datetime";
header("Location: " . $_SERVER["HTTP_REFERER"]);
} else {
$_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);
header("Location: calendar_events.php");
}
exit;
exit;
}

View File

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

View File

@ -100,4 +100,4 @@
</form>
</div>
</div>
</div>
</div>

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-header py-2">
<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="float-left">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addScheduledTicketModal">
<i class="fas fa-plus mr-2"></i>New Recurring Ticket
</button>
</div>
<div class="card card-dark">
<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>
<div class='card-tools'>
<div class="float-left">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addScheduledTicketModal">
<i class="fas fa-plus mr-2"></i>New Recurring Ticket
</button>
</div>
</div>
</div>
<div class="card-body">
<div class="card-body">
<form autocomplete="off">
<div class="row">
<form autocomplete="off">
<div class="row">
<div class="col-md-4">
<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">
<div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
<div class="col-md-4">
<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">
<div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</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>
</form>
<hr>
<div class="col-md-8">
<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">
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
</div>
</div>
</form>
<hr>
<table class="table table-striped table-borderless table-hover">
<thead class="<?php if (!$num_rows[0]) {
echo "d-none";
} ?>">
<div class="table-responsive-sm">
<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>
<td class="pr-0">
<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 class="text-center">Action</th>
</tr>
</thead>
</thead>
<tbody>
<tbody>
<?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_next_run = nullable_htmlentities($row['scheduled_ticket_next_run']);
$scheduled_ticket_client_name = nullable_htmlentities($row['client_name']);
?>
?>
<tr>
<td class="pr-0">
@ -116,8 +117,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</th>
<td>
<a href="#" data-toggle="modal" data-target="#editScheduledTicketModal"
onclick="populateScheduledTicketEditModal(<?php echo $scheduled_ticket_client_id, ",", $scheduled_ticket_id ?>)"> <?php echo $scheduled_ticket_subject ?>
<a href="#" data-toggle="modal" data-target="#editScheduledTicketModal" onclick="populateScheduledTicketEditModal(<?php echo $scheduled_ticket_client_id, ",", $scheduled_ticket_id ?>)"> <?php echo $scheduled_ticket_subject ?>
</a>
</td>
@ -133,8 +133,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal"
data-target="#editScheduledTicketModal" onclick="populateScheduledTicketEditModal(<?php echo $scheduled_ticket_client_id, ",", $scheduled_ticket_id ?>)">
<a class="dropdown-item" href="#" data-toggle="modal" 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
</a>
<?php
@ -152,22 +151,22 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<?php } ?>
</tbody>
</tbody>
</table>
</table>
</form>
</div>
<?php require_once 'pagination.php';
?>
</form>
</div>
</div>
<script src="js/scheduled_tickets_edit_modal.js"></script>
<script src="js/bulk_actions.js"></script>
<?php require_once 'pagination.php';
?>
</div>
</div>
<script src="js/scheduled_tickets_edit_modal.js"></script>
<script src="js/bulk_actions.js"></script>
<?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 "footer.php";

View File

@ -1,7 +1,7 @@
<!-- Main Sidebar Container -->
<aside class="main-sidebar sidebar-dark-<?php echo nullable_htmlentities($config_theme); ?> d-print-none">
<div class="brand-link">
<div class="brand-link">
<h3 class="brand-text text-light mb-0"><?php echo nullable_htmlentities($session_company_name); ?></h3>
</div>
@ -14,14 +14,18 @@
<ul class="nav nav-pills nav-sidebar flex-column mt-3" data-widget="treeview" data-accordion="false">
<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>
<p>Dashboard</p>
</a>
</li>
<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>
<p>Clients</p>
</a>
@ -31,7 +35,9 @@
<li class="nav-header mt-3">SUPPORT</li>
<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>
<p>Tickets</p>
</a>
@ -40,7 +46,9 @@
<?php } ?>
<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>
<p>Calendar</p>
</a>
@ -50,31 +58,41 @@
<li class="nav-header mt-3">SALES</li>
<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>
<p>Quotes</p>
</a>
</li>
<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>
<p>Invoices</p>
</a>
</li>
<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>
<p>Recurring Invoices</p>
</a>
</li>
<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>
<p>Revenues</p>
</a>
</li>
<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>
<p>Products</p>
</a>
@ -86,60 +104,78 @@
<li class="nav-header mt-3">FINANCE</li>
<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>
<p>Payments</p>
</a>
</li>
<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>
<p>Vendors</p>
</a>
</li>
<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>
<p>Expenses</p>
</a>
</li>
<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>
<p>Recurring Expenses</p>
</a>
</li>
<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>
<p>Accounts</p>
</a>
</li>
<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>
<p>Transfers</p>
</a>
</li>
<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>
<p>Budget</p>
</a>
</li>
<li class="nav-item">
<a href="trips.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "trips.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-route"></i>
<p>Trips</p>
</a>
</li>
<a href="trips.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "trips.php") {
echo "active";
} ?>">
<i class="nav-icon fas fa-route"></i>
<p>Trips</p>
</a>
</li>
<?php } ?>
<li class="nav-header mt-3">MORE</li>
<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>
<p>Reports</p>
<i class="fas fa-angle-right nav-icon float-right"></i>
@ -148,13 +184,13 @@
<?php if ($session_user_role == 3) { ?>
<li class="nav-item">
<a href="users.php" class="nav-link">
<i class="nav-icon fas fa-cogs"></i>
<p>Administration</p>
<i class="fas fa-angle-right nav-icon float-right"></i>
</a>
</li>
<li class="nav-item">
<a href="users.php" class="nav-link">
<i class="nav-icon fas fa-cogs"></i>
<p>Administration</p>
<i class="fas fa-angle-right nav-icon float-right"></i>
</a>
</li>
<?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>";
include_once "footer.php";
} else {
$row = mysqli_fetch_array($sql);
@ -193,13 +191,15 @@ if (isset($_GET['ticket_id'])) {
$warranty_check = date('m/d/Y', strtotime('-8 hours'));
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 {
$warranty_status_color = 'green';
}
if ($asset_warranty_expire == "NULL") {
$dt_value = "None"; $warranty_status_color ='red';
$dt_value = "None";
$warranty_status_color = 'red';
}
// Get all ticket replies
@ -228,7 +228,7 @@ if (isset($_GET['ticket_id'])) {
AND ticket_attachment_ticket_id = $ticket_id"
);
?>
?>
<!-- Breadcrumbs-->
<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>
</div>
<?php if ($ticket_status != "Closed") { ?>
<div class="col-3">
<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">
<i class="fas fa-fw fa-ellipsis-v"></i>
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<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
</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
<div class="col-3">
<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">
<i class="fas fa-fw fa-ellipsis-v"></i>
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<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
</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>
<?php } ?>
</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>
</div>
<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 == "Pending-Client") {echo "selected";}?> >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>
<option <?php if ($ticket_status == "In-Progress") {
echo "selected";
} ?>>In-Progress</option>
<option <?php if ($ticket_status == "Pending-Client") {
echo "selected";
} ?>>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 } ?>
</select>
</div>
@ -365,16 +375,16 @@ if (isset($_GET['ticket_id'])) {
<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="form-group">
<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>
<label class="custom-control-label" for="ticket_reply_type_checkbox">Email contact<br><small class="text-secondary">(Public Update)</small></label>
<div class="col-md-2">
<div class="form-group">
<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>
<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>
<?php } ?>
@ -424,9 +434,15 @@ if (isset($_GET['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">
<h3 class="card-title">
<div class="media">
@ -442,7 +458,9 @@ if (isset($_GET['ticket_id'])) {
<div class="media-body">
<?php echo $ticket_reply_by_display; ?>
<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>
<?php if ($ticket_reply_type !== "Client") { ?>
<div>
@ -490,11 +508,9 @@ if (isset($_GET['ticket_id'])) {
</div>
<?php
<?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_subject = nullable_htmlentities($prev_ticket_row['ticket_subject']);
$prev_ticket_status = nullable_htmlentities($prev_ticket_row['ticket_status']);
?>
?>
<hr>
<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>
<span class="text-success"><?php echo $prev_ticket_status; ?></span>
</div>
<?php } ?>
<?php } ?>
<?php } else { ?>
<div class="d-print-none">
@ -605,11 +621,10 @@ if (isset($_GET['ticket_id'])) {
while ($ticket_watcher_row = mysqli_fetch_array($sql_ticket_watchers)) {
$watcher_id = intval($ticket_watcher_row['watcher_id']);
$ticket_watcher_email = nullable_htmlentities($ticket_watcher_row['watcher_email']);
?>
?>
<div class='mt-1'>
<i class="fa fa-fw fa-eye text-secondary ml-1 mr-2"></i><?php echo $ticket_watcher_email; ?>
<a class="confirm-link"
href="post.php?delete_ticket_watcher=<?php echo $watcher_id; ?>">
<a class="confirm-link" href="post.php?delete_ticket_watcher=<?php echo $watcher_id; ?>">
<i class="fas fa-fw fa-times text-secondary ml-1"></i>
</a>
</div>
@ -693,7 +708,7 @@ if (isset($_GET['ticket_id'])) {
<?php } else { ?>
<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>
<?php if (!empty($asset_os)) { ?>
@ -757,12 +772,12 @@ if (isset($_GET['ticket_id'])) {
$service_ticket_status = nullable_htmlentities($row['ticket_status']);
$service_ticket_created_at = nullable_htmlentities($row['ticket_created_at']);
$service_ticket_updated_at = nullable_htmlentities($row['ticket_updated_at']);
?>
?>
<p>
<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)"; ?>
</p>
<?php
<?php
}
?>
</div>
@ -774,9 +789,11 @@ if (isset($_GET['ticket_id'])) {
</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>
<!-- End Asset card -->
@ -824,7 +841,8 @@ if (isset($_GET['ticket_id'])) {
</div>
<?php } ?>
<?php } //End Else ?>
<?php } //End Else
?>
</div>
<!-- End Vendor card -->
@ -837,18 +855,24 @@ if (isset($_GET['ticket_id'])) {
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
</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>
<?php
while ($row = mysqli_fetch_array($sql_assign_to_select)) {
$user_id = intval($row['user_id']);
$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 } ?>
</select>
<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>
@ -872,7 +896,7 @@ if (isset($_GET['ticket_id'])) {
</div>
<?php
<?php
require_once "ticket_edit_modal.php";
require_once "ticket_edit_contact_modal.php";
@ -895,23 +919,21 @@ if (isset($_GET['ticket_id'])) {
require_once "ticket_edit_billable_modal.php";
require_once "ticket_invoice_add_modal.php";
}
}
}
require_once "footer.php";
?>
?>
<script src="js/show_modals.js"></script> <?php
if ($ticket_status !== "Closed") { ?>
if ($ticket_status !== "Closed") { ?>
<!-- Ticket Time Tracking JS -->
<script src="js/ticket_time_tracking.js"></script>
@ -920,5 +942,4 @@ if ($ticket_status !== "Closed") { ?>
<script src="js/ticket_button_respond_note.js"></script>
<?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">
<label>Scheduled Date and Time</label>
<?php if (!$ticket_scheduled_for) { ?>
<input type="datetime-local" class="form-control" name="scheduled_date_time"
placeholder="Scheduled Date & Time">
<input type="datetime-local" class="form-control" name="scheduled_date_time" placeholder="Scheduled Date & Time">
<?php } else { ?>
<input type="datetime-local" class="form-control" name="scheduled_date_time"
value="<?php echo $ticket_scheduled_for; ?>">
<input type="datetime-local" class="form-control" name="scheduled_date_time" value="<?php echo $ticket_scheduled_for; ?>">
<?php } ?>
</div>
@ -34,10 +32,8 @@
</div>
<div class="modal-footer bg-white">
<button type="submit" name="edit_ticket_schedule" class="btn btn-primary text-bold"><i
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="submit" name="edit_ticket_schedule" class="btn btn-primary text-bold"><i 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>
</div>
</form>

View File

@ -39,7 +39,7 @@ if (isset($_GET['assigned']) & !empty($_GET['assigned'])) {
if ($_GET['assigned'] == 'unassigned') {
$ticket_assigned_filter = 'AND ticket_assigned_to = 0';
} else {
$ticket_assigned_filter = 'AND ticket_assigned_to = '.intval($_GET['assigned']);
$ticket_assigned_filter = 'AND ticket_assigned_to = ' . intval($_GET['assigned']);
}
} else {
// Default - any
@ -117,10 +117,11 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
<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">
<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-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>
@ -143,7 +144,7 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
<a href="scheduled_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>)
@ -168,51 +169,53 @@ $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="col-md-2">
<div class="form-group">
<label>Canned Date</label>
<select class="form-control select2" name="canned_date">
<option <?php if ($_GET['canned_date'] == "custom") {
echo "selected";
} ?> value="custom">Custom
echo "selected";
} ?> value="custom">Custom
</option>
<option <?php if ($_GET['canned_date'] == "today") {
echo "selected";
} ?> value="today">Today
echo "selected";
} ?> value="today">Today
</option>
<option <?php if ($_GET['canned_date'] == "yesterday") {
echo "selected";
} ?> value="yesterday">Yesterday
echo "selected";
} ?> value="yesterday">Yesterday
</option>
<option <?php if ($_GET['canned_date'] == "thisweek") {
echo "selected";
} ?> value="thisweek">This Week
echo "selected";
} ?> value="thisweek">This Week
</option>
<option <?php if ($_GET['canned_date'] == "lastweek") {
echo "selected";
} ?> value="lastweek">Last Week
echo "selected";
} ?> value="lastweek">Last Week
</option>
<option <?php if ($_GET['canned_date'] == "thismonth") {
echo "selected";
} ?> value="thismonth">This Month
echo "selected";
} ?> value="thismonth">This Month
</option>
<option <?php if ($_GET['canned_date'] == "lastmonth") {
echo "selected";
} ?> value="lastmonth">Last Month
echo "selected";
} ?> value="lastmonth">Last Month
</option>
<option <?php if ($_GET['canned_date'] == "thisyear") {
echo "selected";
} ?> value="thisyear">This Year
echo "selected";
} ?> value="thisyear">This Year
</option>
<option <?php if ($_GET['canned_date'] == "lastyear") {
echo "selected";
} ?> value="lastyear">Last Year
echo "selected";
} ?> value="lastyear">Last Year
</option>
</select>
</div>
@ -232,14 +235,28 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
<div class="col-md-2">
<div class="form-group">
<label>Ticket Status</label>
<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="Client-Replied" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('Client-Replied', $_GET['status'])) { echo 'selected'; } ?> >Client-Replied</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 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="Client-Replied" <?php if (isset($_GET['status']) && is_array($_GET['status']) && in_array('Client-Replied', $_GET['status'])) {
echo 'selected';
} ?>>Client-Replied</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>
</div>
</div>
@ -247,17 +264,23 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
<div class="form-group">
<label>Assigned to</label>
<select class="form-control select2" name="assigned">
<option value="" <?php if ($ticket_assigned_filter == "") {echo "selected";}?> >Any</option>
<option value="unassigned"<?php if ($ticket_assigned_filter == "0") {echo "selected";}?> >Unassigned</option>
<option value="" <?php if ($ticket_assigned_filter == "") {
echo "selected";
} ?>>Any</option>
<option value="unassigned" <?php if ($ticket_assigned_filter == "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 == $user_id) { echo "selected"; } ?> value="<?php echo $user_id; ?>"><?php echo $user_name; ?></option>
<?php
?>
<option <?php if ($ticket_assigned_filter == $user_id) {
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'] ?>">
<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">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div>
</td>
<th><a class="text-dark"
href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_number&order=<?php echo $disp; ?>">Number</a>
</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>
<thead class="text-dark <?php if (!$num_rows[0]) {
echo "d-none";
} ?>">
<tr>
<td>
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div>
</td>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_number&order=<?php echo $disp; ?>">Number</a>
</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
}
?>
}
?>
<th><a class="text-dark"
href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_priority&order=<?php echo $disp; ?>">Priority</a>
</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"
href="?<?php echo $url_query_strings_sort; ?>&sort=user_name&order=<?php echo $disp; ?>">Assigned</a>
</th>
<th><a class="text-dark"
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>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_priority&order=<?php echo $disp; ?>">Priority</a>
</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" href="?<?php echo $url_query_strings_sort; ?>&sort=user_name&order=<?php echo $disp; ?>">Assigned</a>
</th>
<th><a class="text-dark" 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>
<tbody>
<?php
<?php
while ($row = mysqli_fetch_array($sql)) {
$ticket_id = intval($row['ticket_id']);
$ticket_prefix = nullable_htmlentities($row['ticket_prefix']);
$ticket_number = intval($row['ticket_number']);
$ticket_subject = nullable_htmlentities($row['ticket_subject']);
$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']);
$ticket_updated_at_time_ago = timeAgo($row['ticket_updated_at']);
if (empty($ticket_updated_at)) {
if ($ticket_status == "Closed") {
$ticket_updated_at_display = "<p>Never</p>";
while ($row = mysqli_fetch_array($sql)) {
$ticket_id = intval($row['ticket_id']);
$ticket_prefix = nullable_htmlentities($row['ticket_prefix']);
$ticket_number = intval($row['ticket_number']);
$ticket_subject = nullable_htmlentities($row['ticket_subject']);
$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']);
$ticket_updated_at_time_ago = timeAgo($row['ticket_updated_at']);
if (empty($ticket_updated_at)) {
if ($ticket_status == "Closed") {
$ticket_updated_at_display = "<p>Never</p>";
} else {
$ticket_updated_at_display = "<p class='text-danger'>Never</p>";
}
} else {
$ticket_updated_at_display = "<p class='text-danger'>Never</p>";
$ticket_updated_at_display = "$ticket_updated_at_time_ago<br><small class='text-secondary'>$ticket_updated_at</small>";
}
} else {
$ticket_updated_at_display = "$ticket_updated_at_time_ago<br><small class='text-secondary'>$ticket_updated_at</small>";
}
$ticket_closed_at = nullable_htmlentities($row['ticket_closed_at']);
$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 == "Pending-Assignment") {
$ticket_status_color = "danger";
} elseif ($ticket_status == "Assigned") {
$ticket_status_color = "primary";
} elseif ($ticket_status == "In-Progress") {
$ticket_status_color = "success";
} elseif ($ticket_status == "Closed") {
$ticket_status_color = "dark";
} elseif ($ticket_status == "Auto Close") {
$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>";
$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 == "Pending-Assignment") {
$ticket_status_color = "danger";
} elseif ($ticket_status == "Assigned") {
$ticket_status_color = "primary";
} elseif ($ticket_status == "In-Progress") {
$ticket_status_color = "success";
} elseif ($ticket_status == "Closed") {
$ticket_status_color = "dark";
} elseif ($ticket_status == "Auto Close") {
$ticket_status_color = "dark";
} elseif ($ticket_status == "Client-Replied") {
$ticket_status_color = "warning";
} 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)) {
$contact_display = "-";
} else {
$contact_display = "$contact_name<br><small class='text-secondary'>$contact_email</small>";
}
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 {
$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']);
$vendor_id = intval($row['ticket_vendor_id']);
if (empty($contact_name)) {
$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"; }?>">
<td>
<?php if($ticket_status !== "Closed") { ?>
<div class="form-check">
<input class="form-check-input bulk-select" type="checkbox" name="ticket_ids[]" value="<?php echo $ticket_id ?>">
</div>
<?php } ?>
</td>
<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>
<td>
<a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>"><?php echo $ticket_subject; ?></a>
</td>
<td>
<a href="client_tickets.php?client_id=<?php echo $client_id; ?>"><strong><?php echo $client_name; ?></strong></a>
<tr class="<?php if (empty($ticket_updated_at)) {
echo "text-bold";
} ?>">
<td>
<?php if ($ticket_status !== "Closed") { ?>
<div class="form-check">
<input class="form-check-input bulk-select" type="checkbox" name="ticket_ids[]" value="<?php echo $ticket_id ?>">
</div>
<?php } ?>
</td>
<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>
<td>
<a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>"><?php echo $ticket_subject; ?></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>
</td>
<?php if ($config_module_enable_accounting) {
?>
<td class="text-center">
<a href="#" data-toggle="modal" data-target="#editTicketBillableModal<?php echo $ticket_id; ?>">
<div class="mt-1"><?php echo $contact_display; ?></div>
</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>";
}
?>
</td>
<?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><?php echo $ticket_updated_at_display; ?></td>
<td>
<?php echo $ticket_created_at_time_ago; ?>
<br>
<small class="text-secondary"><?php echo $ticket_created_at; ?></small>
</td>
</tr>
?>
<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><?php echo $ticket_updated_at_display; ?></td>
<td>
<?php echo $ticket_created_at_time_ago; ?>
<br>
<small class="text-secondary"><?php echo $ticket_created_at; ?></small>
</td>
</tr>
<?php
if ($ticket_status !== "Closed") {
// Temp performance boost for closed tickets, until we move to dynamic modals
if ($ticket_status !== "Closed") {
// 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) {
require "ticket_edit_billable_modal.php";
if ($config_module_enable_accounting) {
require "ticket_edit_billable_modal.php";
}
}
}
}
?>
?>
</tbody>
</table>