From 25db6c6e03fdbcc382d2977c66216ed0cf08ccb0 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Fri, 21 Feb 2025 20:14:36 -0500 Subject: [PATCH] Replaced more contact Links with the new ajax contact details modal, updated the modal UI as well to use bigger icons and have the icon on its own line --- ajax/ajax_contact_details.php | 765 ++++++++++++++++++++++++++++++++++ ajax/ajax_service_details.php | 17 +- assets.php | 74 +--- client_document_details.php | 7 +- client_overview.php | 8 +- contact_details.php | 6 +- contacts.php | 6 +- ticket.php | 126 +----- 8 files changed, 829 insertions(+), 180 deletions(-) create mode 100644 ajax/ajax_contact_details.php diff --git a/ajax/ajax_contact_details.php b/ajax/ajax_contact_details.php new file mode 100644 index 00000000..3d3bee15 --- /dev/null +++ b/ajax/ajax_contact_details.php @@ -0,0 +1,765 @@ +$contact_tag_name"; +} +$contact_tags_display = implode('', $contact_tag_name_display_array); + +// 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"); +$note_count = mysqli_num_rows($sql_related_notes); + + // Linked Services +$sql_linked_services = mysqli_query($mysqli, "SELECT * FROM service_contacts, services + WHERE service_contacts.contact_id = $contact_id + AND service_contacts.service_id = services.service_id + ORDER BY service_name ASC" +); +$service_count = mysqli_num_rows($sql_linked_services); + +$linked_services = array(); + +// Linked Documents +$sql_linked_documents = mysqli_query($mysqli, "SELECT * FROM contact_documents, documents + LEFT JOIN users ON document_created_by = user_id + WHERE contact_documents.contact_id = $contact_id + AND contact_documents.document_id = documents.document_id + AND document_template = 0 + AND document_archived_at IS NULL + ORDER BY document_name ASC" +); +$document_count = mysqli_num_rows($sql_linked_documents); + +$linked_documents = array(); + +// Linked Files +$sql_linked_files = mysqli_query($mysqli, "SELECT * FROM contact_files, files + WHERE contact_files.contact_id = $contact_id + AND contact_files.file_id = files.file_id + AND file_archived_at IS NULL + ORDER BY file_name ASC" +); +$file_count = mysqli_num_rows($sql_linked_files); + +$linked_files = array(); + + + +// Generate the HTML form content using output buffering. +ob_start(); +?> + + + + + + +$row[asset_name] $ip"; + echo "
  • $asset_name$ip
  • "; } ?> @@ -288,7 +293,15 @@ ob_start(); mysqli_data_seek($sql_contacts, 0); while ($row = mysqli_fetch_array($sql_contacts)) { - echo "
  • $row[contact_name]
  • "; + $contact_id = intval($row['contact_id']); + $contact_name = nullable_htmlentities($row['contact_name']); + echo "
  • + $contact_name + +
  • "; } ?> diff --git a/assets.php b/assets.php index f9292d71..0f14642b 100644 --- a/assets.php +++ b/assets.php @@ -489,17 +489,25 @@ if (mysqli_num_rows($os_sql) > 0) { $device_icon = getAssetIcon($asset_type); - $contact_name = nullable_htmlentities($row['contact_name']); - if (empty($contact_name)) { - $contact_name = "-"; - } $contact_archived_at = nullable_htmlentities($row['contact_archived_at']); if ($contact_archived_at) { - $contact_name_display = "
    $contact_name
    "; + $contact_archive_display = "(Archived)"; } else { - $contact_name_display = $contact_name; + $contact_archive_display = ''; } - + $contact_name = nullable_htmlentities($row['contact_name']); + if ($contact_name) { + $contact_name_display = " + $contact_name $contact_archive_display + "; + } else { + $contact_name_display = "-"; + } + $location_name = nullable_htmlentities($row['location_name']); if (empty($location_name)) { $location_name = "-"; @@ -579,58 +587,6 @@ if (mysqli_num_rows($os_sql) > 0) {
    - 0) { ?> - - - - -