updated UI for contact details so menu is on the left instead of top. Also load the first tab based off the count

This commit is contained in:
johnnyq
2026-01-17 17:35:05 -05:00
parent c1f0b63101
commit 3cfe38c948

View File

@@ -13,6 +13,7 @@ $sql = mysqli_query($mysqli, "SELECT * FROM contacts
"); ");
$row = mysqli_fetch_assoc($sql); $row = mysqli_fetch_assoc($sql);
$client_id = intval($row['client_id']); $client_id = intval($row['client_id']);
$client_name = nullable_htmlentities($row['client_name']); $client_name = nullable_htmlentities($row['client_name']);
$contact_name = nullable_htmlentities($row['contact_name']); $contact_name = nullable_htmlentities($row['contact_name']);
@@ -34,6 +35,7 @@ $contact_billing = intval($row['contact_billing']);
$contact_technical = intval($row['contact_technical']); $contact_technical = intval($row['contact_technical']);
$contact_created_at = nullable_htmlentities($row['contact_created_at']); $contact_created_at = nullable_htmlentities($row['contact_created_at']);
$contact_location_id = intval($row['contact_location_id']); $contact_location_id = intval($row['contact_location_id']);
$location_name = nullable_htmlentities($row['location_name']); $location_name = nullable_htmlentities($row['location_name']);
$location_country = nullable_htmlentities($row['location_country']); $location_country = nullable_htmlentities($row['location_country']);
$location_address = nullable_htmlentities($row['location_address']); $location_address = nullable_htmlentities($row['location_address']);
@@ -42,11 +44,8 @@ $location_state = nullable_htmlentities($row['location_state']);
$location_zip = nullable_htmlentities($row['location_zip']); $location_zip = nullable_htmlentities($row['location_zip']);
$location_phone_country_code = nullable_htmlentities($row['location_phone_country_code']); $location_phone_country_code = nullable_htmlentities($row['location_phone_country_code']);
$location_phone = nullable_htmlentities(formatPhoneNumber($row['location_phone'], $location_phone_country_code)); $location_phone = nullable_htmlentities(formatPhoneNumber($row['location_phone'], $location_phone_country_code));
if (empty($location_phone)) { $location_phone_display = empty($location_phone) ? "-" : $location_phone;
$location_phone_display = "-";
} else {
$location_phone_display = $location_phone;
}
$auth_method = nullable_htmlentities($row['user_auth_method']); $auth_method = nullable_htmlentities($row['user_auth_method']);
$contact_client_id = intval($row['contact_client_id']); $contact_client_id = intval($row['contact_client_id']);
@@ -69,16 +68,15 @@ $sql_linked_software = mysqli_query($mysqli, "SELECT * FROM software_contacts, s
ORDER BY software_name ASC" ORDER BY software_name ASC"
); );
$software_count = mysqli_num_rows($sql_linked_software); $software_count = mysqli_num_rows($sql_linked_software);
$linked_software = array(); $linked_software = array();
// Related Credentials Query 1 to 1 relationship // Related Credentials Query 1 to 1 relationship
$sql_related_credentials = mysqli_query($mysqli, " $sql_related_credentials = mysqli_query($mysqli, "
SELECT SELECT
credentials.credential_id AS credentials_credential_id, -- Alias for credentials.credential_id credentials.credential_id AS credentials_credential_id,
credentials.*, -- All other columns from credentials credentials.*,
credential_tags.*, -- All columns from credential_tags credential_tags.*,
tags.* -- All columns from tags tags.*
FROM credentials FROM credentials
LEFT JOIN credential_tags ON credential_tags.credential_id = credentials.credential_id LEFT JOIN credential_tags ON credential_tags.credential_id = credentials.credential_id
LEFT JOIN tags ON tags.tag_id = credential_tags.tag_id LEFT JOIN tags ON tags.tag_id = credential_tags.tag_id
@@ -92,7 +90,9 @@ $credential_count = mysqli_num_rows($sql_related_credentials);
$sql_related_tickets = mysqli_query($mysqli, "SELECT * FROM tickets $sql_related_tickets = mysqli_query($mysqli, "SELECT * FROM tickets
LEFT JOIN users ON ticket_assigned_to = user_id LEFT JOIN users ON ticket_assigned_to = user_id
LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id
WHERE ticket_contact_id = $contact_id ORDER BY ticket_id DESC"); WHERE ticket_contact_id = $contact_id
ORDER BY ticket_id DESC
");
$ticket_count = mysqli_num_rows($sql_related_tickets); $ticket_count = mysqli_num_rows($sql_related_tickets);
// Related Recurring Tickets Query // Related Recurring Tickets Query
@@ -102,11 +102,14 @@ $sql_related_recurring_tickets = mysqli_query($mysqli, "SELECT * FROM recurring_
); );
$recurring_ticket_count = mysqli_num_rows($sql_related_recurring_tickets); $recurring_ticket_count = mysqli_num_rows($sql_related_recurring_tickets);
// Tags - many to many relationship // Tags - many to many relationship
$contact_tag_name_display_array = array(); $contact_tag_name_display_array = array();
$contact_tag_id_array = array(); $contact_tag_id_array = array();
$sql_contact_tags = mysqli_query($mysqli, "SELECT * FROM contact_tags LEFT JOIN tags ON contact_tags.tag_id = tags.tag_id WHERE contact_id = $contact_id ORDER BY tag_name ASC"); $sql_contact_tags = mysqli_query($mysqli, "SELECT * FROM contact_tags
LEFT JOIN tags ON contact_tags.tag_id = tags.tag_id
WHERE contact_id = $contact_id
ORDER BY tag_name ASC
");
while ($row = mysqli_fetch_assoc($sql_contact_tags)) { while ($row = mysqli_fetch_assoc($sql_contact_tags)) {
$contact_tag_id = intval($row['tag_id']); $contact_tag_id = intval($row['tag_id']);
@@ -126,17 +129,21 @@ while ($row = mysqli_fetch_assoc($sql_contact_tags)) {
$contact_tags_display = implode('', $contact_tag_name_display_array); $contact_tags_display = implode('', $contact_tag_name_display_array);
// Notes - 1 to 1 relationship // Notes - 1 to 1 relationship
$sql_related_notes = mysqli_query($mysqli, "SELECT * FROM contact_notes LEFT JOIN users ON contact_note_created_by = user_id WHERE contact_note_contact_id = $contact_id AND contact_note_archived_at IS NULL ORDER BY contact_note_created_at DESC"); $sql_related_notes = mysqli_query($mysqli, "SELECT * FROM contact_notes
LEFT JOIN users ON contact_note_created_by = user_id
WHERE contact_note_contact_id = $contact_id
AND contact_note_archived_at IS NULL
ORDER BY contact_note_created_at DESC
");
$note_count = mysqli_num_rows($sql_related_notes); $note_count = mysqli_num_rows($sql_related_notes);
// Linked Services // Linked Services
$sql_linked_services = mysqli_query($mysqli, "SELECT * FROM service_contacts, services $sql_linked_services = mysqli_query($mysqli, "SELECT * FROM service_contacts, services
WHERE service_contacts.contact_id = $contact_id WHERE service_contacts.contact_id = $contact_id
AND service_contacts.service_id = services.service_id AND service_contacts.service_id = services.service_id
ORDER BY service_name ASC" ORDER BY service_name ASC"
); );
$services_count = mysqli_num_rows($sql_linked_services); $services_count = mysqli_num_rows($sql_linked_services);
$linked_services = array(); $linked_services = array();
// Linked Documents // Linked Documents
@@ -148,7 +155,6 @@ $sql_linked_documents = mysqli_query($mysqli, "SELECT * FROM contact_documents,
ORDER BY document_name ASC" ORDER BY document_name ASC"
); );
$document_count = mysqli_num_rows($sql_linked_documents); $document_count = mysqli_num_rows($sql_linked_documents);
$linked_documents = array(); $linked_documents = array();
// Linked Files // Linked Files
@@ -159,7 +165,6 @@ $sql_linked_files = mysqli_query($mysqli, "SELECT * FROM contact_files, files
ORDER BY file_name ASC" ORDER BY file_name ASC"
); );
$file_count = mysqli_num_rows($sql_linked_files); $file_count = mysqli_num_rows($sql_linked_files);
$linked_files = array(); $linked_files = array();
if (isset($_GET['client_id'])) { if (isset($_GET['client_id'])) {
@@ -168,6 +173,17 @@ if (isset($_GET['client_id'])) {
$client_url = ''; $client_url = '';
} }
// Pick first available tab (Details tab removed)
$first_tab = null;
if ($asset_count) { $first_tab = "assets"; }
elseif ($credential_count) { $first_tab = "credentials"; }
elseif ($software_count) { $first_tab = "licenses"; }
elseif ($ticket_count) { $first_tab = "tickets"; }
elseif ($recurring_ticket_count) { $first_tab = "recurring"; }
elseif ($document_count) { $first_tab = "documents"; }
elseif ($file_count) { $first_tab = "files"; }
elseif ($note_count) { $first_tab = "notes"; }
// Generate the HTML form content using output buffering. // Generate the HTML form content using output buffering.
ob_start(); ob_start();
?> ?>
@@ -196,140 +212,222 @@ ob_start();
<div class="modal-body"> <div class="modal-body">
<ul class="nav nav-pills nav-justified mt-3"> <!-- Contact details always visible (top of every tab) -->
<li class="nav-item"> <div class="card card-outline card-secondary mb-3">
<a class="nav-link" data-toggle="pill" href="#pills-contact-details"><i class="fas fa-fw fa-user fa-2x"></i><br>Details</a> <div class="card-body p-3">
</li>
<?php if ($asset_count) { ?>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#pills-contact-assets<?= $contact_id ?>"><i class="fas fa-fw fa-desktop fa-2x"></i><br>Assets (<?= $asset_count ?>)</a>
</li>
<?php } ?>
<?php if ($credential_count) { ?>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#pills-contact-credentials<?= $contact_id ?>"><i class="fas fa-fw fa-key fa-2x"></i><br>Credentials (<?= $credential_count ?>)</a>
</li>
<?php } ?>
<?php if ($software_count) { ?>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#pills-contact-licenses<?= $contact_id ?>"><i class="fas fa-fw fa-cube fa-2x"></i><br>Licenses (<?= $software_count ?>)</a>
</li>
<?php } ?>
<?php if ($ticket_count) { ?>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#pills-contact-tickets<?= $contact_id ?>"><i class="fas fa-fw fa-life-ring fa-2x"></i><br>Tickets (<?= $ticket_count ?>)</a>
</li>
<?php } ?>
<?php if ($recurring_ticket_count) { ?>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#pills-contact-recurring-tickets<?= $contact_id ?>"><i class="fas fa-fw fa-redo-alt fa-2x"></i><br>Rcr Tickets (<?= $recurring_ticket_count ?>)</a>
</li>
<?php } ?>
<?php if ($document_count) { ?>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#pills-contact-documents<?= $contact_id ?>"><i class="fas fa-fw fa-file-alt fa-2x"></i><br>Documents (<?= $document_count ?>)</a>
</li>
<?php } ?>
<?php if ($file_count) { ?>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#pills-contact-files<?= $contact_id ?>"><i class="fas fa-fw fa-briefcase fa-2x"></i><br>Files (<?= $file_count ?>)</a>
</li>
<?php } ?>
<?php if ($note_count) { ?>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#pills-contact-notes<?= $contact_id ?>"><i class="fas fa-fw fa-edit fa-2x"></i><br>Notes (<?= $note_count ?>)</a>
</li>
<?php } ?>
</ul>
<div class="tab-content">
<div class="tab-pane fade" id="pills-contact-details">
<div class="row"> <div class="row">
<?php if ($contact_phone || $contact_mobile || $contact_extension || $contact_email) { ?> <div class="col-12 col-md-5 mb-3 mb-md-0">
<div class="col-4"> <div class="d-flex align-items-start">
<div class="media"> <i class="fas fa-fw fa-user text-secondary mr-2 mt-1"></i>
<i class="fas fa-fw fa-user fa-2x text-secondary"></i> <div class="w-100">
<div class="media-body ml-2"> <div class="text-muted text-sm">Contact</div>
<dt>Contact Details</dt>
<?php if ($contact_phone) { ?> <?php if ($contact_phone) { ?>
<div> <div class="mt-1">
<i class="fas fa-fw fa-phone-alt text-secondary mt-2"></i> <i class="fas fa-fw fa-phone-alt text-secondary mr-1"></i>
<a href="tel:<?= $contact_phone ?>"><?= $contact_phone ?></a> <a href="tel:<?= $contact_phone ?>"><?= $contact_phone ?></a>
<?php if ($contact_extension) { ?> <?php if ($contact_extension) { ?>
<span>ext: <?= $contact_extension ?></span> <span class="text-muted ml-1">ext: <?= $contact_extension ?></span>
<?php } ?> <?php } ?>
</div> </div>
<?php } ?> <?php } ?>
<?php if ($contact_mobile) { ?> <?php if ($contact_mobile) { ?>
<div> <div class="mt-1">
<i class="fas fa-fw fa-mobile-alt text-secondary mt-2"></i> <i class="fas fa-fw fa-mobile-alt text-secondary mr-1"></i>
<a href="tel:<?= $contact_mobile ?>"><?= $contact_mobile ?></a> <a href="tel:<?= $contact_mobile ?>"><?= $contact_mobile ?></a>
</div> </div>
<?php } ?> <?php } ?>
<?php if ($contact_email) { ?> <?php if ($contact_email) { ?>
<div> <div class="mt-1">
<i class="fas fa-fw fa-envelope text-secondary mt-2"></i> <i class="fas fa-fw fa-envelope text-secondary mr-1"></i>
<a href='mailto:<?= $contact_email ?>'><?= $contact_email ?></a> <a href="mailto:<?= $contact_email ?>"><?= $contact_email ?></a>
<button type="button" class='btn btn-sm clipboardjs' data-clipboard-text='<?= $contact_email ?>'> <button type="button" class="btn btn-xs btn-link p-0 ml-1 clipboardjs" data-clipboard-text="<?= $contact_email ?>">
<i class='far fa-copy text-secondary'></i></button> <i class="far fa-copy text-secondary"></i>
</div> </button>
<?php } ?>
</div>
</div>
</div> </div>
<?php } ?> <?php } ?>
<?php if (!$contact_phone && !$contact_mobile && !$contact_email) { ?>
<div class="text-muted">-</div>
<?php } ?>
<?php if ($contact_tags_display) { ?>
<div class="mt-2">
<?= $contact_tags_display ?>
</div>
<?php } ?>
</div>
</div>
</div>
<div class="col-12 col-md-4 mb-3 mb-md-0">
<div class="d-flex align-items-start">
<i class="fas fa-fw fa-map-marker-alt text-secondary mr-2 mt-1"></i>
<div class="w-100">
<div class="text-muted text-sm">Location</div>
<?php if ($location_name) { ?> <?php if ($location_name) { ?>
<div class="col-4"> <div class="font-weight-bold"><?= $location_name ?></div>
<div class="media"> <div class="text-muted">
<i class="fas fa-fw fa-map-marker-alt text-secondary fa-2x"></i> <?= $location_address ?><br>
<div class="media-body ml-2"> <?= "$location_city $location_state $location_zip" ?><br>
<dt><?= $location_name ?></dt> <?= $location_country ?>
<dd>
<div><?= $location_address ?></div>
<div><?= "$location_city $location_state $location_zip" ?></div>
<div><?= $location_country ?></div>
</dd>
</div>
</div>
</div> </div>
<?php } else { ?>
<div class="text-muted">-</div>
<?php } ?> <?php } ?>
</div>
</div>
</div>
<div class="col-12 col-md-3">
<div class="d-flex align-items-start">
<i class="fas fa-fw fa-info-circle text-secondary mr-2 mt-1"></i>
<div class="w-100">
<div class="text-muted text-sm">Flags</div>
<div class="col-4">
<div class="media">
<i class="fa fa-fw fa-info-circle text-secondary fa-2x"></i>
<div class="media-body ml-2">
<?php if ($contact_primary) { ?> <?php if ($contact_primary) { ?>
<span class="text-success text-bold">Primary Contact</span><br> <div><span class="text-success font-weight-bold">Primary</span></div>
<?php } ?> <?php } ?>
<?php if ($contact_billing) { ?> <?php if ($contact_billing) { ?>
<span class="text-dark font-weight-bold">Billing</span><br> <div><span class="font-weight-bold text-dark">Billing</span></div>
<?php } ?> <?php } ?>
<?php if ($contact_technical) { ?> <?php if ($contact_technical) { ?>
<span class="text-secondary">Technical</span><br> <div><span class="text-secondary">Technical</span></div>
<?php } ?> <?php } ?>
<?php if ($contact_important) { ?> <?php if ($contact_important) { ?>
<span class="text-dark font-weight-bold">Important</span> <div><span class="font-weight-bold text-dark">Important</span></div>
<?php } ?> <?php } ?>
<?php if ($contact_pin) { ?> <?php if ($contact_pin) { ?>
<div> <div class="mt-1"><span class="text-muted">PIN:</span> <?= $contact_pin ?></div>
Pin: <?= $contact_pin ?> <?php } ?>
</div>
<?php if (!$contact_primary && !$contact_billing && !$contact_technical && !$contact_important && !$contact_pin) { ?>
<div class="text-muted">-</div>
<?php } ?> <?php } ?>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
</div> </div>
<div class="row no-gutters">
<!-- Left sticky nav -->
<div class="col-12 col-md-3 pr-md-3 mb-3 mb-md-0">
<div class="sticky-top">
<div class="nav nav-pills nav-sidebar flex-column" role="tablist" aria-orientation="vertical">
<?php if ($asset_count) { ?> <?php if ($asset_count) { ?>
<div class="tab-pane fade" id="pills-contact-assets<?= $contact_id ?>"> <a class="nav-link <?= ($first_tab === "assets") ? "active" : "" ?>"
data-toggle="pill"
href="#pills-contact-assets<?= $contact_id ?>"
role="tab"
aria-controls="pills-contact-assets<?= $contact_id ?>"
aria-selected="<?= ($first_tab === "assets") ? "true" : "false" ?>">
<i class="fas fa-fw fa-desktop mr-2"></i>
<span class="d-none d-md-inline">Assets (<?= $asset_count ?>)</span>
</a>
<?php } ?>
<?php if ($credential_count) { ?>
<a class="nav-link <?= ($first_tab === "credentials") ? "active" : "" ?>"
data-toggle="pill"
href="#pills-contact-credentials<?= $contact_id ?>"
role="tab"
aria-controls="pills-contact-credentials<?= $contact_id ?>"
aria-selected="<?= ($first_tab === "credentials") ? "true" : "false" ?>">
<i class="fas fa-fw fa-key mr-2"></i>
<span class="d-none d-md-inline">Credentials (<?= $credential_count ?>)</span>
</a>
<?php } ?>
<?php if ($software_count) { ?>
<a class="nav-link <?= ($first_tab === "licenses") ? "active" : "" ?>"
data-toggle="pill"
href="#pills-contact-licenses<?= $contact_id ?>"
role="tab"
aria-controls="pills-contact-licenses<?= $contact_id ?>"
aria-selected="<?= ($first_tab === "licenses") ? "true" : "false" ?>">
<i class="fas fa-fw fa-cube mr-2"></i>
<span class="d-none d-md-inline">Licenses (<?= $software_count ?>)</span>
</a>
<?php } ?>
<?php if ($ticket_count) { ?>
<a class="nav-link <?= ($first_tab === "tickets") ? "active" : "" ?>"
data-toggle="pill"
href="#pills-contact-tickets<?= $contact_id ?>"
role="tab"
aria-controls="pills-contact-tickets<?= $contact_id ?>"
aria-selected="<?= ($first_tab === "tickets") ? "true" : "false" ?>">
<i class="fas fa-fw fa-life-ring mr-2"></i>
<span class="d-none d-md-inline">Tickets (<?= $ticket_count ?>)</span>
</a>
<?php } ?>
<?php if ($recurring_ticket_count) { ?>
<a class="nav-link <?= ($first_tab === "recurring") ? "active" : "" ?>"
data-toggle="pill"
href="#pills-contact-recurring-tickets<?= $contact_id ?>"
role="tab"
aria-controls="pills-contact-recurring-tickets<?= $contact_id ?>"
aria-selected="<?= ($first_tab === "recurring") ? "true" : "false" ?>">
<i class="fas fa-fw fa-redo-alt mr-2"></i>
<span class="d-none d-md-inline">Rcr Tickets (<?= $recurring_ticket_count ?>)</span>
</a>
<?php } ?>
<?php if ($document_count) { ?>
<a class="nav-link <?= ($first_tab === "documents") ? "active" : "" ?>"
data-toggle="pill"
href="#pills-contact-documents<?= $contact_id ?>"
role="tab"
aria-controls="pills-contact-documents<?= $contact_id ?>"
aria-selected="<?= ($first_tab === "documents") ? "true" : "false" ?>">
<i class="fas fa-fw fa-file-alt mr-2"></i>
<span class="d-none d-md-inline">Documents (<?= $document_count ?>)</span>
</a>
<?php } ?>
<?php if ($file_count) { ?>
<a class="nav-link <?= ($first_tab === "files") ? "active" : "" ?>"
data-toggle="pill"
href="#pills-contact-files<?= $contact_id ?>"
role="tab"
aria-controls="pills-contact-files<?= $contact_id ?>"
aria-selected="<?= ($first_tab === "files") ? "true" : "false" ?>">
<i class="fas fa-fw fa-briefcase mr-2"></i>
<span class="d-none d-md-inline">Files (<?= $file_count ?>)</span>
</a>
<?php } ?>
<?php if ($note_count) { ?>
<a class="nav-link <?= ($first_tab === "notes") ? "active" : "" ?>"
data-toggle="pill"
href="#pills-contact-notes<?= $contact_id ?>"
role="tab"
aria-controls="pills-contact-notes<?= $contact_id ?>"
aria-selected="<?= ($first_tab === "notes") ? "true" : "false" ?>">
<i class="fas fa-fw fa-edit mr-2"></i>
<span class="d-none d-md-inline">Notes (<?= $note_count ?>)</span>
</a>
<?php } ?>
</div>
</div>
</div>
<!-- Right content -->
<div class="col-12 col-md-9">
<div class="tab-content">
<?php if ($asset_count) { ?>
<div class="tab-pane fade <?= ($first_tab === "assets") ? "show active" : "" ?>" id="pills-contact-assets<?= $contact_id ?>">
<div class="table-responsive-sm"> <div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover table-sm"> <table class="table table-striped table-borderless table-hover table-sm">
@@ -345,7 +443,6 @@ ob_start();
</thead> </thead>
<tbody> <tbody>
<?php <?php
while ($row = mysqli_fetch_assoc($sql_related_assets)) { while ($row = mysqli_fetch_assoc($sql_related_assets)) {
$asset_id = intval($row['asset_id']); $asset_id = intval($row['asset_id']);
$asset_type = nullable_htmlentities($row['asset_type']); $asset_type = nullable_htmlentities($row['asset_type']);
@@ -354,64 +451,33 @@ ob_start();
$asset_make = nullable_htmlentities($row['asset_make']); $asset_make = nullable_htmlentities($row['asset_make']);
$asset_model = nullable_htmlentities($row['asset_model']); $asset_model = nullable_htmlentities($row['asset_model']);
$asset_serial = nullable_htmlentities($row['asset_serial']); $asset_serial = nullable_htmlentities($row['asset_serial']);
if (empty($asset_serial)) { $asset_serial_display = empty($asset_serial) ? "-" : $asset_serial;
$asset_serial_display = "-";
} else {
$asset_serial_display = $asset_serial;
}
$asset_os = nullable_htmlentities($row['asset_os']);
if (empty($asset_os)) {
$asset_os_display = "-";
} else {
$asset_os_display = $asset_os;
}
$asset_ip = nullable_htmlentities($row['interface_ip']);
if (empty($asset_ip)) {
$asset_ip_display = "-";
} else {
$asset_ip_display = "$asset_ip<button class='btn btn-sm' data-clipboard-text='$asset_ip'><i class='far fa-copy text-secondary'></i></button>";
}
$asset_nat_ip = nullable_htmlentities($row['interface_nat_ip']);
$asset_ipv6 = nullable_htmlentities($row['interface_ipv6']);
$asset_mac = nullable_htmlentities($row['interface_mac']);
$asset_status = nullable_htmlentities($row['asset_status']);
$asset_purchase_date = nullable_htmlentities($row['asset_purchase_date']);
$asset_warranty_expire = nullable_htmlentities($row['asset_warranty_expire']);
$asset_install_date = nullable_htmlentities($row['asset_install_date']); $asset_install_date = nullable_htmlentities($row['asset_install_date']);
if (empty($asset_install_date)) { $asset_install_date_display = empty($asset_install_date) ? "-" : $asset_install_date;
$asset_install_date_display = "-";
} else { $asset_status = nullable_htmlentities($row['asset_status']);
$asset_install_date_display = $asset_install_date;
}
$asset_uri = nullable_htmlentities($row['asset_uri']);
$asset_uri_2 = nullable_htmlentities($row['asset_uri_2']);
$asset_photo = nullable_htmlentities($row['asset_photo']);
$asset_physical_location = nullable_htmlentities($row['asset_physical_location']);
$asset_notes = nullable_htmlentities($row['asset_notes']);
$asset_created_at = nullable_htmlentities($row['asset_created_at']);
$device_icon = getAssetIcon($asset_type); $device_icon = getAssetIcon($asset_type);
// Tags // Tags
$asset_tag_name_display_array = array(); $asset_tag_name_display_array = array();
$asset_tag_id_array = array();
$sql_asset_tags = mysqli_query($mysqli, "SELECT * FROM asset_tags LEFT JOIN tags ON asset_tag_tag_id = tag_id WHERE asset_tag_asset_id = $asset_id ORDER BY tag_name ASC"); $sql_asset_tags = mysqli_query($mysqli, "SELECT * FROM asset_tags LEFT JOIN tags ON asset_tag_tag_id = tag_id WHERE asset_tag_asset_id = $asset_id ORDER BY tag_name ASC");
while ($row = mysqli_fetch_assoc($sql_asset_tags)) { while ($row2 = mysqli_fetch_assoc($sql_asset_tags)) {
$asset_tag_id = intval($row2['tag_id']);
$asset_tag_id = intval($row['tag_id']); $asset_tag_name = nullable_htmlentities($row2['tag_name']);
$asset_tag_name = nullable_htmlentities($row['tag_name']); $asset_tag_color = nullable_htmlentities($row2['tag_color']);
$asset_tag_color = nullable_htmlentities($row['tag_color']);
if (empty($asset_tag_color)) { if (empty($asset_tag_color)) {
$asset_tag_color = "dark"; $asset_tag_color = "dark";
} }
$asset_tag_icon = nullable_htmlentities($row['tag_icon']); $asset_tag_icon = nullable_htmlentities($row2['tag_icon']);
if (empty($asset_tag_icon)) { if (empty($asset_tag_icon)) {
$asset_tag_icon = "tag"; $asset_tag_icon = "tag";
} }
$asset_tag_id_array[] = $asset_tag_id;
$asset_tag_name_display_array[] = "<a href='assets.php?$client_url tags[]=$asset_tag_id'><span class='badge text-light p-1 mr-1' style='background-color: $asset_tag_color;'><i class='fa fa-fw fa-$asset_tag_icon mr-2'></i>$asset_tag_name</span></a>"; $asset_tag_name_display_array[] = "<a href='assets.php?$client_url tags[]=$asset_tag_id'><span class='badge text-light p-1 mr-1' style='background-color: $asset_tag_color;'><i class='fa fa-fw fa-$asset_tag_icon mr-2'></i>$asset_tag_name</span></a>";
} }
$asset_tags_display = implode('', $asset_tag_name_display_array); $asset_tags_display = implode('', $asset_tag_name_display_array);
?> ?>
<tr> <tr>
<th> <th>
@@ -424,8 +490,7 @@ ob_start();
<div class="mt-0"> <div class="mt-0">
<small class="text-muted"><?= $asset_description ?></small> <small class="text-muted"><?= $asset_description ?></small>
</div> </div>
<?php <?php if ($asset_tags_display) { ?>
if ($asset_tags_display) { ?>
<div class="mt-1"> <div class="mt-1">
<?= $asset_tags_display ?> <?= $asset_tags_display ?>
</div> </div>
@@ -442,21 +507,18 @@ ob_start();
<td><?= $asset_install_date_display ?></td> <td><?= $asset_install_date_display ?></td>
<td><?= $asset_status ?></td> <td><?= $asset_status ?></td>
</tr> </tr>
<?php <?php
} }
?> ?>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
<?php } ?> <?php } ?>
<?php if ($credential_count) { ?> <?php if ($credential_count) { ?>
<div class="tab-pane fade" id="pills-contact-credentials<?= $contact_id ?>"> <div class="tab-pane fade <?= ($first_tab === "credentials") ? "show active" : "" ?>" id="pills-contact-credentials<?= $contact_id ?>">
<div class="table-responsive-sm"> <div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover table-sm dataTables" style="width:100%"> <table class="table table-striped table-borderless table-hover table-sm dataTables" style="width:100%">
<thead> <thead>
@@ -471,89 +533,57 @@ ob_start();
</thead> </thead>
<tbody> <tbody>
<?php <?php
while ($row = mysqli_fetch_assoc($sql_related_credentials)) { while ($row = mysqli_fetch_assoc($sql_related_credentials)) {
$credential_id = intval($row['credentials_credential_id']); $credential_id = intval($row['credentials_credential_id']);
$credential_name = nullable_htmlentities($row['credential_name']); $credential_name = nullable_htmlentities($row['credential_name']);
$credential_description = nullable_htmlentities($row['credential_description']); $credential_description = nullable_htmlentities($row['credential_description']);
$credential_uri = nullable_htmlentities($row['credential_uri']); $credential_uri = nullable_htmlentities($row['credential_uri']);
if (empty($credential_uri)) { $credential_uri_display = empty($credential_uri) ? "-" : $credential_uri;
$credential_uri_display = "-";
} else {
$credential_uri_display = "$credential_uri";
}
$credential_uri_2 = nullable_htmlentities($row['credential_uri_2']);
$credential_username = nullable_htmlentities(decryptCredentialEntry($row['credential_username'])); $credential_username = nullable_htmlentities(decryptCredentialEntry($row['credential_username']));
if (empty($credential_username)) { if (empty($credential_username)) {
$credential_username_display = "-"; $credential_username_display = "-";
} else { } else {
$credential_username_display = "$credential_username <button type='button' class='btn btn-sm clipboardjs' data-clipboard-text='$credential_username'><i class='far fa-copy text-secondary'></i></button>"; $credential_username_display = "$credential_username <button type='button' class='btn btn-sm clipboardjs' data-clipboard-text='$credential_username'><i class='far fa-copy text-secondary'></i></button>";
} }
$credential_password = nullable_htmlentities(decryptCredentialEntry($row['credential_password'])); $credential_password = nullable_htmlentities(decryptCredentialEntry($row['credential_password']));
$credential_otp_secret = nullable_htmlentities($row['credential_otp_secret']); $credential_otp_secret = nullable_htmlentities($row['credential_otp_secret']);
$credential_id_with_secret = '"' . $row['credential_id'] . '","' . $row['credential_otp_secret'] . '"';
if (empty($credential_otp_secret)) { if (empty($credential_otp_secret)) {
$otp_display = "-"; $otp_display = "-";
} else { } else {
$otp_display = "<span onmouseenter='showOTPViaCredentialID($credential_id)'><i class='far fa-clock'></i> <span id='otp_$credential_id'><i>Hover..</i></span></span>"; $otp_display = "<span onmouseenter='showOTPViaCredentialID($credential_id)'><i class='far fa-clock'></i> <span id='otp_$credential_id'><i>Hover..</i></span></span>";
} }
$credential_note = nullable_htmlentities($row['credential_note']);
$credential_important = intval($row['credential_important']);
$credential_contact_id = intval($row['credential_contact_id']);
$credential_asset_id = intval($row['credential_asset_id']);
// Tags
$credential_tag_name_display_array = array();
$credential_tag_id_array = array();
$sql_credential_tags = mysqli_query($mysqli, "SELECT * FROM credential_tags LEFT JOIN tags ON credential_tags.tag_id = tags.tag_id WHERE credential_id = $credential_id ORDER BY tag_name ASC");
while ($row = mysqli_fetch_assoc($sql_credential_tags)) {
$credential_tag_id = intval($row['tag_id']);
$credential_tag_name = nullable_htmlentities($row['tag_name']);
$credential_tag_color = nullable_htmlentities($row['tag_color']);
if (empty($credential_tag_color)) {
$credential_tag_color = "dark";
}
$credential_tag_icon = nullable_htmlentities($row['tag_icon']);
if (empty($credential_tag_icon)) {
$credential_tag_icon = "tag";
}
$credential_tag_id_array[] = $credential_tag_id;
$credential_tag_name_display_array[] = "<a href='credentials.php?client_id=$client_id&tags[]=$credential_tag_id'><span class='badge text-light p-1 mr-1' style='background-color: $credential_tag_color;'><i class='fa fa-fw fa-$credential_tag_icon mr-2'></i>$credential_tag_name</span></a>";
}
$credential_tags_display = implode('', $credential_tag_name_display_array);
?> ?>
<tr> <tr>
<td><i class="fa fa-fw fa-key text-secondary mr-2"></i><?= $credential_name ?></td> <td><i class="fa fa-fw fa-key text-secondary mr-2"></i><?= $credential_name ?></td>
<td><?= $credential_description ?></td> <td><?= $credential_description ?></td>
<td><?= $credential_username_display ?></td> <td><?= $credential_username_display ?></td>
<td> <td>
<button class="btn p-0" type="button" data-toggle="popover" data-trigger="focus" data-placement="top" data-content="<?= $credential_password ?>"><i class="fas fa-2x fa-ellipsis-h text-secondary"></i><i class="fas fa-2x fa-ellipsis-h text-secondary"></i></button> <button class="btn p-0" type="button" data-toggle="popover" data-trigger="focus" data-placement="top" data-content="<?= $credential_password ?>">
<i class="fas fa-ellipsis-h text-secondary"></i><i class="fas fa-ellipsis-h text-secondary"></i>
<button type="button" class='btn btn-sm clipboardjs' data-clipboard-text='<?= $credential_password ?>'><i class='far fa-copy text-secondary'></i></button> </button>
<button type="button" class="btn btn-sm clipboardjs" data-clipboard-text="<?= $credential_password ?>">
<i class="far fa-copy text-secondary"></i>
</button>
</td> </td>
<td><?= $otp_display ?></td> <td><?= $otp_display ?></td>
<td><?= $credential_uri_display ?></td> <td><?= $credential_uri_display ?></td>
</tr> </tr>
<?php <?php
} }
?> ?>
</tbody> </tbody>
</table> </table>
</div> </div>
</div>
<!-- Include script to get TOTP code via the credential ID -->
<script src="js/credential_show_otp_via_id.js"></script> <script src="js/credential_show_otp_via_id.js"></script>
</div>
<?php } ?> <?php } ?>
<?php if ($ticket_count) { ?> <?php if ($ticket_count) { ?>
<div class="tab-pane fade" id="pills-contact-tickets<?= $contact_id ?>"> <div class="tab-pane fade <?= ($first_tab === "tickets") ? "show active" : "" ?>" id="pills-contact-tickets<?= $contact_id ?>">
<div class="table-responsive-sm"> <div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover table-sm"> <table class="table table-striped table-borderless table-hover table-sm">
<thead class="text-dark"> <thead class="text-dark">
@@ -569,7 +599,6 @@ ob_start();
</thead> </thead>
<tbody> <tbody>
<?php <?php
while ($row = mysqli_fetch_assoc($sql_related_tickets)) { while ($row = mysqli_fetch_assoc($sql_related_tickets)) {
$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']);
@@ -581,6 +610,7 @@ ob_start();
$ticket_status_color = nullable_htmlentities($row['ticket_status_color']); $ticket_status_color = nullable_htmlentities($row['ticket_status_color']);
$ticket_created_at = nullable_htmlentities($row['ticket_created_at']); $ticket_created_at = nullable_htmlentities($row['ticket_created_at']);
$ticket_updated_at = nullable_htmlentities($row['ticket_updated_at']); $ticket_updated_at = nullable_htmlentities($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>";
@@ -590,7 +620,6 @@ ob_start();
} else { } else {
$ticket_updated_at_display = $ticket_updated_at; $ticket_updated_at_display = $ticket_updated_at;
} }
$ticket_closed_at = nullable_htmlentities($row['ticket_closed_at']);
if ($ticket_priority == "High") { if ($ticket_priority == "High") {
$ticket_priority_display = "<span class='p-2 badge badge-danger'>$ticket_priority</span>"; $ticket_priority_display = "<span class='p-2 badge badge-danger'>$ticket_priority</span>";
@@ -601,6 +630,7 @@ ob_start();
} else { } else {
$ticket_priority_display = "-"; $ticket_priority_display = "-";
} }
$ticket_assigned_to = intval($row['ticket_assigned_to']); $ticket_assigned_to = intval($row['ticket_assigned_to']);
if (empty($ticket_assigned_to)) { if (empty($ticket_assigned_to)) {
if ($ticket_status == "Closed") { if ($ticket_status == "Closed") {
@@ -611,25 +641,23 @@ ob_start();
} else { } else {
$ticket_assigned_to_display = nullable_htmlentities($row['user_name']); $ticket_assigned_to_display = nullable_htmlentities($row['user_name']);
} }
?> ?>
<tr> <tr>
<td><a href="ticket.php?client_id=<?= $client_id ?>&ticket_id=<?= $ticket_id ?>"><span class="badge badge-pill badge-secondary p-3"><?= "$ticket_prefix$ticket_number" ?></span></a></td> <td>
<a href="ticket.php?client_id=<?= $client_id ?>&ticket_id=<?= $ticket_id ?>">
<span class="badge badge-pill badge-secondary p-3"><?= "$ticket_prefix$ticket_number" ?></span>
</a>
</td>
<td><a href="ticket.php?client_id=<?= $client_id ?>&ticket_id=<?= $ticket_id ?>"><?= $ticket_subject ?></a></td> <td><a href="ticket.php?client_id=<?= $client_id ?>&ticket_id=<?= $ticket_id ?>"><?= $ticket_subject ?></a></td>
<td><?= $ticket_priority_display ?></td> <td><?= $ticket_priority_display ?></td>
<td><span class='badge badge-pill text-light p-2' style="background-color: <?= $ticket_status_color ?>"><?= $ticket_status_name ?></span></td> <td><span class="badge badge-pill text-light p-2" style="background-color: <?= $ticket_status_color ?>"><?= $ticket_status_name ?></span></td>
<td><?= $ticket_assigned_to_display ?></td> <td><?= $ticket_assigned_to_display ?></td>
<td><?= $ticket_updated_at_display ?></td> <td><?= $ticket_updated_at_display ?></td>
<td><?= $ticket_created_at ?></td> <td><?= $ticket_created_at ?></td>
</tr> </tr>
<?php <?php
} }
?> ?>
</tbody> </tbody>
</table> </table>
</div> </div>
@@ -637,8 +665,7 @@ ob_start();
<?php } ?> <?php } ?>
<?php if ($recurring_ticket_count) { ?> <?php if ($recurring_ticket_count) { ?>
<div class="tab-pane fade" id="pills-contact-recurring-tickets<?= $contact_id ?>"> <div class="tab-pane fade <?= ($first_tab === "recurring") ? "show active" : "" ?>" id="pills-contact-recurring-tickets<?= $contact_id ?>">
<div class="table-responsive-sm"> <div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover table-sm"> <table class="table table-striped table-borderless table-hover table-sm">
<thead class="text-dark"> <thead class="text-dark">
@@ -651,24 +678,21 @@ ob_start();
</thead> </thead>
<tbody> <tbody>
<?php <?php
while ($row = mysqli_fetch_assoc($sql_related_recurring_tickets)) { while ($row = mysqli_fetch_assoc($sql_related_recurring_tickets)) {
$recurring_ticket_id = intval($row['recurring_ticket_id']);
$recurring_ticket_subject = nullable_htmlentities($row['recurring_ticket_subject']); $recurring_ticket_subject = nullable_htmlentities($row['recurring_ticket_subject']);
$recurring_ticket_priority = nullable_htmlentities($row['recurring_ticket_priority']); $recurring_ticket_priority = nullable_htmlentities($row['recurring_ticket_priority']);
$recurring_ticket_frequency = nullable_htmlentities($row['recurring_ticket_frequency']); $recurring_ticket_frequency = nullable_htmlentities($row['recurring_ticket_frequency']);
$recurring_ticket_next_run = nullable_htmlentities($row['recurring_ticket_next_run']); $recurring_ticket_next_run = nullable_htmlentities($row['recurring_ticket_next_run']);
?> ?>
<tr> <tr>
<td class="text-bold"><?= $recurring_ticket_subject ?></td> <td class="text-bold"><?= $recurring_ticket_subject ?></td>
<td><?= $recurring_ticket_priority ?></td> <td><?= $recurring_ticket_priority ?></td>
<td><?= $recurring_ticket_frequency ?></td> <td><?= $recurring_ticket_frequency ?></td>
<td><?= $recurring_ticket_next_run ?></td> <td><?= $recurring_ticket_next_run ?></td>
</tr> </tr>
<?php
<?php } ?> }
?>
</tbody> </tbody>
</table> </table>
</div> </div>
@@ -676,7 +700,7 @@ ob_start();
<?php } ?> <?php } ?>
<?php if ($software_count) { ?> <?php if ($software_count) { ?>
<div class="tab-pane fade" id="pills-contact-licenses<?= $contact_id ?>"> <div class="tab-pane fade <?= ($first_tab === "licenses") ? "show active" : "" ?>" id="pills-contact-licenses<?= $contact_id ?>">
<div class="table-responsive-sm"> <div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover table-sm"> <table class="table table-striped table-borderless table-hover table-sm">
<thead class="text-dark"> <thead class="text-dark">
@@ -689,41 +713,29 @@ ob_start();
</thead> </thead>
<tbody> <tbody>
<?php <?php
while ($row = mysqli_fetch_assoc($sql_linked_software)) { while ($row = mysqli_fetch_assoc($sql_linked_software)) {
$software_id = intval($row['software_id']); $software_id = intval($row['software_id']);
$software_name = nullable_htmlentities($row['software_name']); $software_name = nullable_htmlentities($row['software_name']);
$software_version = nullable_htmlentities($row['software_version']); $software_version = nullable_htmlentities($row['software_version']);
$software_type = nullable_htmlentities($row['software_type']); $software_type = nullable_htmlentities($row['software_type']);
$software_license_type = nullable_htmlentities($row['software_license_type']);
$software_key = nullable_htmlentities($row['software_key']); $software_key = nullable_htmlentities($row['software_key']);
$software_seats = nullable_htmlentities($row['software_seats']); $software_seats = nullable_htmlentities($row['software_seats']);
$software_purchase = nullable_htmlentities($row['software_purchase']);
$software_expire = nullable_htmlentities($row['software_expire']);
$software_notes = nullable_htmlentities($row['software_notes']);
$seat_count = 0; $seat_count = 0;
// Asset Licenses // Asset Licenses
$asset_licenses_sql = mysqli_query($mysqli, "SELECT asset_id FROM software_assets WHERE software_id = $software_id"); $asset_licenses_sql = mysqli_query($mysqli, "SELECT asset_id FROM software_assets WHERE software_id = $software_id");
$asset_licenses_array = array(); while ($row2 = mysqli_fetch_assoc($asset_licenses_sql)) {
while ($row = mysqli_fetch_assoc($asset_licenses_sql)) {
$asset_licenses_array[] = intval($row['asset_id']);
$seat_count = $seat_count + 1; $seat_count = $seat_count + 1;
} }
$asset_licenses = implode(',', $asset_licenses_array);
// Contact Licenses // Contact Licenses
$contact_licenses_sql = mysqli_query($mysqli, "SELECT contact_id FROM software_contacts WHERE software_id = $software_id"); $contact_licenses_sql = mysqli_query($mysqli, "SELECT contact_id FROM software_contacts WHERE software_id = $software_id");
$contact_licenses_array = array(); while ($row2 = mysqli_fetch_assoc($contact_licenses_sql)) {
while ($row = mysqli_fetch_assoc($contact_licenses_sql)) {
$contact_licenses_array[] = intval($row['contact_id']);
$seat_count = $seat_count + 1; $seat_count = $seat_count + 1;
} }
$contact_licenses = implode(',', $contact_licenses_array);
$linked_software[] = $software_id; $linked_software[] = $software_id;
?> ?>
<tr> <tr>
<td><?= "$software_name $software_version" ?></td> <td><?= "$software_name $software_version" ?></td>
@@ -731,13 +743,9 @@ ob_start();
<td><?= $software_key ?></td> <td><?= $software_key ?></td>
<td><?= "$seat_count / $software_seats" ?></td> <td><?= "$seat_count / $software_seats" ?></td>
</tr> </tr>
<?php <?php
} }
?> ?>
</tbody> </tbody>
</table> </table>
</div> </div>
@@ -745,8 +753,7 @@ ob_start();
<?php } ?> <?php } ?>
<?php if ($document_count) { ?> <?php if ($document_count) { ?>
<div class="tab-pane fade" id="pills-contact-documents<?= $contact_id ?>"> <div class="tab-pane fade <?= ($first_tab === "documents") ? "show active" : "" ?>" id="pills-contact-documents<?= $contact_id ?>">
<div class="table-responsive-sm"> <div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover table-sm"> <table class="table table-striped table-borderless table-hover table-sm">
<thead class="text-dark"> <thead class="text-dark">
@@ -759,7 +766,6 @@ ob_start();
</thead> </thead>
<tbody> <tbody>
<?php <?php
while ($row = mysqli_fetch_assoc($sql_linked_documents)) { while ($row = mysqli_fetch_assoc($sql_linked_documents)) {
$document_id = intval($row['document_id']); $document_id = intval($row['document_id']);
$document_name = nullable_htmlentities($row['document_name']); $document_name = nullable_htmlentities($row['document_name']);
@@ -769,15 +775,13 @@ ob_start();
$document_updated_at = nullable_htmlentities($row['document_updated_at']); $document_updated_at = nullable_htmlentities($row['document_updated_at']);
$linked_documents[] = $document_id; $linked_documents[] = $document_id;
?> ?>
<tr> <tr>
<td> <td>
<a class="ajax-modal" href="#" <a class="ajax-modal" href="#"
data-modal-size="lg" data-modal-size="lg"
data-modal-url="modals/document/document_view.php?id=<?= $document_id ?>"> data-modal-url="modals/document/document_view.php?id=<?= $document_id ?>">
<?php echo $document_name; ?> <?= $document_name ?>
</a> </a>
<div class="text-secondary"><?= $document_description ?></div> <div class="text-secondary"><?= $document_description ?></div>
</td> </td>
@@ -785,13 +789,9 @@ ob_start();
<td><?= $document_created_at ?></td> <td><?= $document_created_at ?></td>
<td><?= $document_updated_at ?></td> <td><?= $document_updated_at ?></td>
</tr> </tr>
<?php <?php
} }
?> ?>
</tbody> </tbody>
</table> </table>
</div> </div>
@@ -799,7 +799,7 @@ ob_start();
<?php } ?> <?php } ?>
<?php if ($file_count) { ?> <?php if ($file_count) { ?>
<div class="tab-pane fade" id="pills-contact-files<?= $contact_id ?>"> <div class="tab-pane fade <?= ($first_tab === "files") ? "show active" : "" ?>" id="pills-contact-files<?= $contact_id ?>">
<div class="table-responsive-sm"> <div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover table-sm"> <table class="table table-striped table-borderless table-hover table-sm">
<thead class="text-dark"> <thead class="text-dark">
@@ -812,9 +812,7 @@ ob_start();
</thead> </thead>
<tbody> <tbody>
<?php <?php
while ($row = mysqli_fetch_assoc($sql_linked_files)) { while ($row = mysqli_fetch_assoc($sql_linked_files)) {
$file_id = intval($row['file_id']);
$file_name = nullable_htmlentities($row['file_name']); $file_name = nullable_htmlentities($row['file_name']);
$file_description = nullable_htmlentities($row['file_description']); $file_description = nullable_htmlentities($row['file_description']);
$file_size = nullable_htmlentities($row['file_size']); $file_size = nullable_htmlentities($row['file_size']);
@@ -823,10 +821,8 @@ ob_start();
$file_mime_type = nullable_htmlentities($row['file_mime_type']); $file_mime_type = nullable_htmlentities($row['file_mime_type']);
$file_created_at = nullable_htmlentities($row['file_created_at']); $file_created_at = nullable_htmlentities($row['file_created_at']);
$linked_files[] = $file_id; $linked_files[] = intval($row['file_id']);
?> ?>
<tr> <tr>
<td> <td>
<div><a href="../uploads/clients/<?= $client_id ?>/<?= $file_reference_name ?>" target="_blank"><?= $file_name ?></a></div> <div><a href="../uploads/clients/<?= $client_id ?>/<?= $file_reference_name ?>" target="_blank"><?= $file_name ?></a></div>
@@ -836,13 +832,9 @@ ob_start();
<td><?= $file_size_KB ?> KB</td> <td><?= $file_size_KB ?> KB</td>
<td><?= $file_created_at ?></td> <td><?= $file_created_at ?></td>
</tr> </tr>
<?php <?php
} }
?> ?>
</tbody> </tbody>
</table> </table>
</div> </div>
@@ -850,7 +842,7 @@ ob_start();
<?php } ?> <?php } ?>
<?php if ($note_count) { ?> <?php if ($note_count) { ?>
<div class="tab-pane fade" id="pills-contact-notes<?php echo $contact_id; ?>"> <div class="tab-pane fade <?= ($first_tab === "notes") ? "show active" : "" ?>" id="pills-contact-notes<?= $contact_id ?>">
<div class="table-responsive-sm"> <div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover table-sm"> <table class="table table-striped table-borderless table-hover table-sm">
<thead class="text-dark"> <thead class="text-dark">
@@ -863,32 +855,23 @@ ob_start();
</thead> </thead>
<tbody> <tbody>
<?php <?php
while ($row = mysqli_fetch_assoc($sql_related_notes)) { while ($row = mysqli_fetch_assoc($sql_related_notes)) {
$contact_note_id = intval($row['contact_note_id']);
$contact_note_type = nullable_htmlentities($row['contact_note_type']); $contact_note_type = nullable_htmlentities($row['contact_note_type']);
$contact_note = nullable_htmlentities($row['contact_note']); $contact_note = nullable_htmlentities($row['contact_note']);
$note_by = nullable_htmlentities($row['user_name']); $note_by = nullable_htmlentities($row['user_name']);
$contact_note_created_at = nullable_htmlentities($row['contact_note_created_at']); $contact_note_created_at = nullable_htmlentities($row['contact_note_created_at']);
// Get the corresponding icon for the note type $note_type_icon = isset($note_types_array[$contact_note_type]) ? $note_types_array[$contact_note_type] : 'fa-fw fa-sticky-note';
$note_type_icon = isset($note_types_array[$contact_note_type]) ? $note_types_array[$contact_note_type] : 'fa-fw fa-sticky-note'; // default icon if not found
?> ?>
<tr> <tr>
<td><i class="fa fa-fw <?= $note_type_icon ?> mr-2"></i><?= $contact_note_type ?></td> <td><i class="fa fa-fw <?= $note_type_icon ?> mr-2"></i><?= $contact_note_type ?></td>
<td><?= $contact_note ?></td> <td><?= $contact_note ?></td>
<td><?= $note_by ?></td> <td><?= $note_by ?></td>
<td><?= $contact_note_created_at ?></td> <td><?= $contact_note_created_at ?></td>
</tr> </tr>
<?php <?php
} }
?> ?>
</tbody> </tbody>
</table> </table>
</div> </div>
@@ -896,12 +879,15 @@ ob_start();
<?php } ?> <?php } ?>
</div> </div>
</div>
</div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a href="contact_details.php?client_id=<?= $client_id ?>&contact_id=<?= $contact_id ?>" class="btn btn-outline-primary"> <a href="contact_details.php?client_id=<?= $client_id ?>&contact_id=<?= $contact_id ?>" class="btn btn-outline-primary">
<i class="fas fa-info-circle mr-2"></i>More Details <i class="fas fa-info-circle mr-2"></i>Open Full Contact
</a> </a>
<a href="#" class="btn btn-secondary ajax-modal" <a href="#" class="btn btn-secondary ajax-modal"
data-modal-url="modals/contact/contact_edit.php?id=<?= $contact_id ?>"> data-modal-url="modals/contact/contact_edit.php?id=<?= $contact_id ?>">