Skip to content

Commit

Permalink
Client Portal Ticketing - Show attachments for each reply
Browse files Browse the repository at this point in the history
  • Loading branch information
wrongecho committed Dec 27, 2024
1 parent 3e0e30a commit a6451c7
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions portal/ticket.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@
$ticket_closed_at = nullable_htmlentities($ticket_row['ticket_closed_at']);
$ticket_feedback = nullable_htmlentities($ticket_row['ticket_feedback']);

// Get Ticket Attachments (not associated with a specific reply)
$sql_ticket_attachments = mysqli_query(
$mysqli,
"SELECT * FROM ticket_attachments
WHERE ticket_attachment_reply_id IS NULL
AND ticket_attachment_ticket_id = $ticket_id"
);

// Get Tasks
$sql_tasks = mysqli_query( $mysqli, "SELECT * FROM tasks WHERE task_ticket_id = $ticket_id ORDER BY task_order ASC, task_id ASC");
Expand Down Expand Up @@ -106,6 +113,14 @@
<?php } ?>
</p>
<?php echo $ticket_details ?>

<?php
while ($ticket_attachment = mysqli_fetch_array($sql_ticket_attachments)) {
$name = nullable_htmlentities($ticket_attachment['ticket_attachment_name']);
$ref_name = nullable_htmlentities($ticket_attachment['ticket_attachment_reference_name']);
echo "<hr class=''><i class='fas fa-fw fa-paperclip text-secondary mr-1'></i>$name | <a target='_blank' href='https://$config_base_url/uploads/tickets/$ticket_id/$ref_name'><i class='fas fa-fw fa-external-link-alt mr-1'></i>View</a>";
}
?>
</div>
</div>

Expand Down Expand Up @@ -195,6 +210,14 @@
$user_initials = initials($row['user_name']);
$avatar_link = "../uploads/users/$user_id/$user_avatar";
}

// Get attachments for this reply
$sql_ticket_reply_attachments = mysqli_query(
$mysqli,
"SELECT * FROM ticket_attachments
WHERE ticket_attachment_reply_id = $ticket_reply_id
AND ticket_attachment_ticket_id = $ticket_id"
);
?>

<div class="card card-outline <?php if ($ticket_reply_type == 'Client') { echo "card-warning"; } else { echo "card-info"; } ?> mb-3">
Expand Down Expand Up @@ -227,6 +250,14 @@

<div class="card-body prettyContent">
<?php echo $ticket_reply; ?>

<?php
while ($ticket_attachment = mysqli_fetch_array($sql_ticket_reply_attachments)) {
$name = nullable_htmlentities($ticket_attachment['ticket_attachment_name']);
$ref_name = nullable_htmlentities($ticket_attachment['ticket_attachment_reference_name']);
echo "<hr><i class='fas fa-fw fa-paperclip text-secondary mr-1'></i>$name | <a target='_blank' href='https://$config_base_url/uploads/tickets/$ticket_id/$ref_name'><i class='fas fa-fw fa-external-link-alt mr-1'></i>View</a>";
}
?>
</div>
</div>

Expand Down

0 comments on commit a6451c7

Please sign in to comment.