mirror of
https://github.com/itflow-org/itflow
synced 2026-03-22 21:45:37 +00:00
Change spacing to 4 spaces; general refactor/tidy up
This commit is contained in:
127
ticket.php
127
ticket.php
@@ -163,6 +163,21 @@ if(isset($_GET['ticket_id'])){
|
|||||||
$dt_value = "None"; $warranty_status_color ='red';
|
$dt_value = "None"; $warranty_status_color ='red';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get all ticket replies
|
||||||
|
$sql_ticket_replies = mysqli_query($mysqli,"SELECT * FROM ticket_replies LEFT JOIN users ON ticket_reply_by = user_id LEFT JOIN contacts ON ticket_reply_by = contact_id WHERE ticket_reply_ticket_id = $ticket_id AND ticket_reply_archived_at IS NULL ORDER BY ticket_reply_id DESC");
|
||||||
|
|
||||||
|
// Get other tickets for this asset
|
||||||
|
if (!empty($asset_id)) {
|
||||||
|
$sql_asset_tickets = mysqli_query($mysqli,"SELECT * FROM tickets WHERE ticket_asset_id = $asset_id ORDER BY ticket_number DESC");
|
||||||
|
$ticket_asset_count = mysqli_num_rows($sql_asset_tickets);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get technicians to assign the ticket to
|
||||||
|
$sql_assign_to_select = mysqli_query($mysqli,"SELECT users.user_id, user_name FROM users
|
||||||
|
LEFT JOIN user_companies ON users.user_id = user_companies.user_id
|
||||||
|
LEFT JOIN user_settings on users.user_id = user_settings.user_id
|
||||||
|
WHERE user_companies.company_id = $session_company_id
|
||||||
|
AND user_role > 1 AND user_archived_at IS NULL ORDER BY user_name ASC");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@@ -205,12 +220,15 @@ if(isset($_GET['ticket_id'])){
|
|||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
|
|
||||||
<div class="card card-outline card-primary mb-3">
|
<div class="card card-outline card-primary mb-3">
|
||||||
|
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title"><?php echo $ticket_subject; ?></h3>
|
<h3 class="card-title"><?php echo $ticket_subject; ?></h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<?php echo $ticket_details; ?>
|
<?php echo $ticket_details; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Only show ticket reply modal if status is not closed -->
|
<!-- Only show ticket reply modal if status is not closed -->
|
||||||
@@ -264,10 +282,10 @@ if(isset($_GET['ticket_id'])){
|
|||||||
<!-- End IF for reply modal -->
|
<!-- End IF for reply modal -->
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
<!-- Ticket replies -->
|
||||||
<?php
|
<?php
|
||||||
$sql = mysqli_query($mysqli,"SELECT * FROM ticket_replies LEFT JOIN users ON ticket_reply_by = user_id LEFT JOIN contacts ON ticket_reply_by = contact_id WHERE ticket_reply_ticket_id = $ticket_id AND ticket_reply_archived_at IS NULL ORDER BY ticket_reply_id DESC");
|
|
||||||
|
|
||||||
while($row = mysqli_fetch_array($sql)){
|
while ($row = mysqli_fetch_array($sql_ticket_replies)) {
|
||||||
$ticket_reply_id = $row['ticket_reply_id'];
|
$ticket_reply_id = $row['ticket_reply_id'];
|
||||||
$ticket_reply = $row['ticket_reply'];
|
$ticket_reply = $row['ticket_reply'];
|
||||||
$ticket_reply_type = htmlentities($row['ticket_reply_type']);
|
$ticket_reply_type = htmlentities($row['ticket_reply_type']);
|
||||||
@@ -280,8 +298,7 @@ if(isset($_GET['ticket_id'])){
|
|||||||
$user_initials = initials($row['contact_name']);
|
$user_initials = initials($row['contact_name']);
|
||||||
$user_avatar = $row['contact_photo'];
|
$user_avatar = $row['contact_photo'];
|
||||||
$avatar_link = "uploads/clients/$session_company_id/$client_id/$user_avatar";
|
$avatar_link = "uploads/clients/$session_company_id/$client_id/$user_avatar";
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$ticket_reply_by_display = htmlentities($row['user_name']);
|
$ticket_reply_by_display = htmlentities($row['user_name']);
|
||||||
$user_id = $row['user_id'];
|
$user_id = $row['user_id'];
|
||||||
$user_avatar = htmlentities($row['user_avatar']);
|
$user_avatar = htmlentities($row['user_avatar']);
|
||||||
@@ -289,6 +306,7 @@ if(isset($_GET['ticket_id'])){
|
|||||||
$avatar_link = "uploads/users/$user_id/$user_avatar";
|
$avatar_link = "uploads/users/$user_id/$user_avatar";
|
||||||
$ticket_reply_time_worked = date_create($row['ticket_reply_time_worked']);
|
$ticket_reply_time_worked = date_create($row['ticket_reply_time_worked']);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<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">
|
||||||
@@ -302,9 +320,7 @@ if(isset($_GET['ticket_id'])){
|
|||||||
<i class="fa fa-circle fa-stack-2x text-secondary"></i>
|
<i class="fa fa-circle fa-stack-2x text-secondary"></i>
|
||||||
<span class="fa fa-stack-1x text-white"><?php echo $user_initials; ?></span>
|
<span class="fa fa-stack-1x text-white"><?php echo $user_initials; ?></span>
|
||||||
</span>
|
</span>
|
||||||
<?php
|
<?php } ?>
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="media-body">
|
<div class="media-body">
|
||||||
<?php echo $ticket_reply_by_display; ?>
|
<?php echo $ticket_reply_by_display; ?>
|
||||||
@@ -340,6 +356,7 @@ if(isset($_GET['ticket_id'])){
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<?php echo $ticket_reply; ?>
|
<?php echo $ticket_reply; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
@@ -359,19 +376,15 @@ if(isset($_GET['ticket_id'])){
|
|||||||
<div>
|
<div>
|
||||||
<h5><strong><?php echo $client_name; ?></strong></h5>
|
<h5><strong><?php echo $client_name; ?></strong></h5>
|
||||||
<?php
|
<?php
|
||||||
if(!empty($location_phone)){
|
if (!empty($location_phone)) { ?>
|
||||||
?>
|
|
||||||
<i class="fa fa-fw fa-phone text-secondary ml-1 mr-2 mb-2"></i><?php echo $location_phone; ?>
|
<i class="fa fa-fw fa-phone text-secondary ml-1 mr-2 mb-2"></i><?php echo $location_phone; ?>
|
||||||
<br>
|
<br>
|
||||||
<?php
|
<?php } ?>
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (!empty($client_tags_display)) {
|
if (!empty($client_tags_display)) {
|
||||||
echo "$client_tags_display";
|
echo "$client_tags_display";
|
||||||
}
|
} ?>
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -385,37 +398,27 @@ if(isset($_GET['ticket_id'])){
|
|||||||
<span class="ml-1">Related tickets: Open <strong><?php echo $ticket_related_open; ?></strong> | Closed <strong><?php echo $ticket_related_closed; ?></strong> | Total <strong><?php echo $ticket_related_total; ?></strong></span>
|
<span class="ml-1">Related tickets: Open <strong><?php echo $ticket_related_open; ?></strong> | Closed <strong><?php echo $ticket_related_closed; ?></strong> | Total <strong><?php echo $ticket_related_total; ?></strong></span>
|
||||||
<hr>
|
<hr>
|
||||||
<?php
|
<?php
|
||||||
if(!empty($location_name)){
|
|
||||||
?>
|
if (!empty($location_name)) { ?>
|
||||||
<i class="fa fa-fw fa-map-marker-alt text-secondary ml-1 mr-2 mb-2"></i><?php echo $location_name; ?>
|
<i class="fa fa-fw fa-map-marker-alt text-secondary ml-1 mr-2 mb-2"></i><?php echo $location_name; ?>
|
||||||
<br>
|
<br>
|
||||||
<?php
|
<?php }
|
||||||
}
|
|
||||||
?>
|
if (!empty($contact_email)) { ?>
|
||||||
<?php
|
|
||||||
if(!empty($contact_email)){
|
|
||||||
?>
|
|
||||||
<i class="fa fa-fw fa-envelope text-secondary ml-1 mr-2 mb-2"></i><a href="mailto:<?php echo $contact_email; ?>"><?php echo $contact_email; ?></a>
|
<i class="fa fa-fw fa-envelope text-secondary ml-1 mr-2 mb-2"></i><a href="mailto:<?php echo $contact_email; ?>"><?php echo $contact_email; ?></a>
|
||||||
<br>
|
<br>
|
||||||
<?php
|
<?php }
|
||||||
}
|
|
||||||
?>
|
if (!empty($contact_phone)) { ?>
|
||||||
<?php
|
|
||||||
if(!empty($contact_phone)){
|
|
||||||
?>
|
|
||||||
<i class="fa fa-fw fa-phone text-secondary ml-1 mr-2 mb-2"></i><?php echo $contact_phone; ?>
|
<i class="fa fa-fw fa-phone text-secondary ml-1 mr-2 mb-2"></i><?php echo $contact_phone; ?>
|
||||||
<br>
|
<br>
|
||||||
<?php
|
<?php }
|
||||||
}
|
|
||||||
?>
|
if (!empty($contact_mobile)) { ?>
|
||||||
<?php
|
|
||||||
if(!empty($contact_mobile)){
|
|
||||||
?>
|
|
||||||
<i class="fa fa-fw fa-mobile-alt text-secondary ml-1 mr-2 mb-2"></i><?php echo $contact_mobile; ?>
|
<i class="fa fa-fw fa-mobile-alt text-secondary ml-1 mr-2 mb-2"></i><?php echo $contact_mobile; ?>
|
||||||
<br>
|
<br>
|
||||||
<?php
|
<?php } ?>
|
||||||
}
|
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -431,8 +434,7 @@ if(isset($_GET['ticket_id'])){
|
|||||||
if ($ticket_status == "Closed") {
|
if ($ticket_status == "Closed") {
|
||||||
$sql_closed_by = mysqli_query($mysqli,"SELECT * FROM tickets, users WHERE ticket_closed_by = user_id");
|
$sql_closed_by = mysqli_query($mysqli,"SELECT * FROM tickets, users WHERE ticket_closed_by = user_id");
|
||||||
$row = mysqli_fetch_array($sql_closed_by);
|
$row = mysqli_fetch_array($sql_closed_by);
|
||||||
$ticket_closed_by_display = htmlentities($row['user_name']);
|
$ticket_closed_by_display = htmlentities($row['user_name']); ?>
|
||||||
?>
|
|
||||||
<div class="ml-1"><i class="fa fa-fw fa-user text-secondary mr-2 mb-2"></i>Closed by: <?php echo ucwords($ticket_closed_by_display); ?></a></div>
|
<div class="ml-1"><i class="fa fa-fw fa-user text-secondary mr-2 mb-2"></i>Closed by: <?php echo ucwords($ticket_closed_by_display); ?></a></div>
|
||||||
<div class="ml-1"><i class="fa fa-fw fa-comment-dots text-secondary mr-2 mb-2"></i>Feedback: <?php echo $ticket_feedback; ?></a></div>
|
<div class="ml-1"><i class="fa fa-fw fa-comment-dots text-secondary mr-2 mb-2"></i>Feedback: <?php echo $ticket_feedback; ?></a></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@@ -452,40 +454,27 @@ if(isset($_GET['ticket_id'])){
|
|||||||
<?php if (!empty($asset_os)) { ?>
|
<?php if (!empty($asset_os)) { ?>
|
||||||
<i class="fab fa-fw fa-microsoft text-secondary ml-1 mr-2 mb-2"></i><?php echo $asset_os; ?>
|
<i class="fab fa-fw fa-microsoft text-secondary ml-1 mr-2 mb-2"></i><?php echo $asset_os; ?>
|
||||||
<br>
|
<br>
|
||||||
<?php
|
<?php }
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($asset_ip)) { ?>
|
if (!empty($asset_ip)) { ?>
|
||||||
<i class="fa fa-fw fa-network-wired text-secondary ml-1 mr-2 mb-2"></i><?php echo "$asset_ip"; ?>
|
<i class="fa fa-fw fa-network-wired text-secondary ml-1 mr-2 mb-2"></i><?php echo "$asset_ip"; ?>
|
||||||
<br>
|
<br>
|
||||||
<?php
|
<?php }
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($asset_make)) { ?>
|
if (!empty($asset_make)) { ?>
|
||||||
<i class="fa fa-fw fa-tag text-secondary ml-1 mr-2 mb-2"></i>Model: <?php echo "$asset_make $asset_model"; ?>
|
<i class="fa fa-fw fa-tag text-secondary ml-1 mr-2 mb-2"></i>Model: <?php echo "$asset_make $asset_model"; ?>
|
||||||
<br>
|
<br>
|
||||||
<?php
|
<?php }
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($asset_serial)) {
|
if (!empty($asset_serial)) { ?>
|
||||||
?>
|
|
||||||
<i class="fa fa-fw fa-barcode text-secondary ml-1 mr-2 mb-2"></i>Service Tag: <?php echo $asset_serial; ?>
|
<i class="fa fa-fw fa-barcode text-secondary ml-1 mr-2 mb-2"></i>Service Tag: <?php echo $asset_serial; ?>
|
||||||
<br>
|
<br>
|
||||||
|
<?php }
|
||||||
|
|
||||||
<?php
|
if (!empty($asset_warranty_expire)) { ?>
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($asset_warranty_expire)) {
|
|
||||||
?>
|
|
||||||
<i class="far fa-fw fa-calendar-alt text-secondary ml-1 mr-2 mb-2"></i>Warranty expires: <strong><font color="<?php echo $warranty_status_color ?>"> <?php echo $dt_value ?></font></strong>
|
<i class="far fa-fw fa-calendar-alt text-secondary ml-1 mr-2 mb-2"></i>Warranty expires: <strong><font color="<?php echo $warranty_status_color ?>"> <?php echo $dt_value ?></font></strong>
|
||||||
<br>
|
<br>
|
||||||
<?php
|
<?php }
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
$sql_asset_tickets = mysqli_query($mysqli,"SELECT * FROM tickets WHERE ticket_asset_id = $asset_id ORDER BY ticket_number DESC");
|
|
||||||
$ticket_asset_count = mysqli_num_rows($sql_asset_tickets);
|
|
||||||
|
|
||||||
if ($ticket_asset_count > 0 ) {
|
if ($ticket_asset_count > 0 ) {
|
||||||
?>
|
?>
|
||||||
@@ -553,21 +542,11 @@ if(isset($_GET['ticket_id'])){
|
|||||||
<option value="0">Not Assigned</option>
|
<option value="0">Not Assigned</option>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql_assign_to_select = mysqli_query($mysqli,"SELECT users.user_id, user_name FROM users
|
|
||||||
LEFT JOIN user_companies ON users.user_id = user_companies.user_id
|
|
||||||
LEFT JOIN user_settings on users.user_id = user_settings.user_id
|
|
||||||
WHERE user_companies.company_id = $session_company_id
|
|
||||||
AND user_role > 1 AND user_archived_at IS NULL ORDER BY user_name ASC"
|
|
||||||
);
|
|
||||||
while ($row = mysqli_fetch_array($sql_assign_to_select)) {
|
while ($row = mysqli_fetch_array($sql_assign_to_select)) {
|
||||||
$user_id = $row['user_id'];
|
$user_id = $row['user_id'];
|
||||||
$user_name = htmlentities($row['user_name']);
|
$user_name = 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">
|
<div class="input-group-append">
|
||||||
<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>
|
||||||
@@ -581,8 +560,7 @@ if(isset($_GET['ticket_id'])){
|
|||||||
<div class="">
|
<div class="">
|
||||||
<a href="#" class="btn btn-outline-success btn-block" href="#" data-toggle="modal" data-target="#addInvoiceFromTicketModal">Invoice Ticket</a>
|
<a href="#" class="btn btn-outline-success btn-block" href="#" data-toggle="modal" data-target="#addInvoiceFromTicketModal">Invoice Ticket</a>
|
||||||
<?php
|
<?php
|
||||||
if($ticket_status !== "Closed"){
|
if ($ticket_status !== "Closed") { ?>
|
||||||
?>
|
|
||||||
<a href="post.php?close_ticket=<?php echo $ticket_id; ?>" class="btn btn-outline-danger btn-block">Close Ticket</a>
|
<a href="post.php?close_ticket=<?php echo $ticket_id; ?>" class="btn btn-outline-danger btn-block">Close Ticket</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
@@ -597,9 +575,6 @@ if(isset($_GET['ticket_id'])){
|
|||||||
include("ticket_edit_modal.php");
|
include("ticket_edit_modal.php");
|
||||||
include("ticket_merge_modal.php");
|
include("ticket_merge_modal.php");
|
||||||
include("ticket_invoice_add_modal.php");
|
include("ticket_invoice_add_modal.php");
|
||||||
?>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user