Portal - show client contacts

This commit is contained in:
wrongecho 2024-09-05 14:05:51 +01:00
parent 34b9e2978a
commit a23005babe
6 changed files with 80 additions and 1 deletions

72
portal/contacts.php Normal file
View File

@ -0,0 +1,72 @@
<?php
/*
* Client Portal
* Docs for PTC / technical contacts
*/
header("Content-Security-Policy: default-src 'self' fonts.googleapis.com fonts.gstatic.com");
require_once "inc_portal.php";
if ($session_contact_primary == 0 && !$session_contact_is_technical_contact) {
header("Location: portal_post.php?logout");
exit();
}
$contacts_sql = mysqli_query($mysqli, "SELECT contact_id, contact_name, contact_email, contact_primary, contact_technical, contact_billing FROM contacts WHERE contact_client_id = $session_client_id AND contacts.contact_archived_at IS NULL ORDER BY contact_created_at");
?>
<h3>Contacts</h3>
<div class="row">
<div class="col-md-10">
<table class="table tabled-bordered border border-dark">
<thead class="thead-dark">
<tr>
<th>Name</th>
<th>Email</th>
<th>Roles</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_array($contacts_sql)) {
$contact_id = intval($row['contact_id']);
$contact_name = nullable_htmlentities($row['contact_name']);
$contact_email = nullable_htmlentities($row['contact_email']);
$contact_primary = intval($row['contact_primary']);
$contact_technical = intval($row['contact_technical']);
$contact_billing = intval($row['contact_billing']);
$contact_roles_display = '-';
if ($contact_primary) {
$contact_roles_display = 'Primary contact';
} else if ($contact_technical && $contact_billing) {
$contact_roles_display = 'Technical & Billing';
} else if ($contact_technical) {
$contact_roles_display = 'Technical';
} else if ($contact_billing) {
$contact_roles_display = 'Billing';
}
?>
<tr>
<td><a href="contact.php?id=<?php echo $contact_id?>" disabled="disabled"><?php echo $contact_name ?></a></td>
<td><?php echo $contact_email; ?></td>
<td><?php echo $contact_roles_display ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
<?php
require_once "portal_footer.php";

View File

@ -16,6 +16,7 @@ if ($session_contact_primary == 0 && !$session_contact_is_technical_contact) {
$documents_sql = mysqli_query($mysqli, "SELECT document_id, document_name, document_created_at, folder_name FROM documents LEFT JOIN folders ON document_folder_id = folder_id WHERE document_client_id = $session_client_id AND document_template = 0 AND document_archived_at IS NULL ORDER BY folder_id, document_name DESC");
?>
<h3>Documents</h3>
<div class="row">
<div class="col-md-10">

View File

@ -17,6 +17,7 @@ if ($session_contact_primary == 0 && !$session_contact_is_billing_contact) {
$invoices_sql = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_client_id = $session_client_id AND invoice_status != 'Draft' ORDER BY invoice_date DESC");
?>
<h3>Invoices</h3>
<div class="row">
<div class="col-md-10">

View File

@ -62,10 +62,13 @@ header("X-Frame-Options: DENY"); // Legacy
<a class="nav-link <?php if (basename($_SERVER['PHP_SELF']) == "quotes.php") {echo "active";} ?>" href="quotes.php">Quotes</a>
</li>
<?php } ?>
<?php if ($session_contact_primary == 1 || $session_contact_is_technical_contact) { ?>
<?php if ($config_module_enable_itdoc && ($session_contact_primary == 1 || $session_contact_is_technical_contact)) { ?>
<li class="nav-item">
<a class="nav-link <?php if (basename($_SERVER['PHP_SELF']) == "documents.php") {echo "active";} ?>" href="documents.php">Documents</a>
</li>
<li class="nav-item">
<a class="nav-link <?php if (basename($_SERVER['PHP_SELF']) == "contacts.php") {echo "active";} ?>" href="contacts.php">Contacts</a>
</li>
<?php } ?>
</ul>

View File

@ -16,6 +16,7 @@ if ($session_contact_primary == 0 && !$session_contact_is_billing_contact) {
$quotes_sql = mysqli_query($mysqli, "SELECT * FROM quotes WHERE quote_client_id = $session_client_id AND quote_status != 'Draft' ORDER BY quote_date DESC");
?>
<h3>Quotes</h3>
<div class="row">
<div class="col-md-10">

View File

@ -42,6 +42,7 @@ $total_tickets = intval($row['total_tickets']);
?>
<h3>Tickets</h3>
<div class="row">
<div class="col-md-10">