Update Portal UI elements and Mail Functions

This commit is contained in:
johnnyq 2024-01-20 23:11:35 -05:00
parent 3b71e6132e
commit 623ed33a27
9 changed files with 191 additions and 316 deletions

View File

@ -8,7 +8,6 @@ header("Content-Security-Policy: default-src 'self' fonts.googleapis.com fonts.g
require_once "inc_portal.php";
if ($session_contact_primary == 0 && !$session_contact_is_technical_contact) {
header("Location: portal_post.php?logout");
exit();
@ -21,7 +20,6 @@ $purifier_config = HTMLPurifier_Config::createDefault();
$purifier_config->set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'http' => true, 'https' => true]);
$purifier = new HTMLPurifier($purifier_config);
// Check for a document ID
if (!isset($_GET['id']) && !intval($_GET['id'])) {
header("Location: documents.php");
@ -39,27 +37,6 @@ $document_content = $purifier->purify($row['document_content']);
?>
<div class="row">
<div class="col-md-1 text-center">
<?php if (!empty($session_contact_photo)) { ?>
<img src="<?php echo "../uploads/clients/$session_client_id/$session_contact_photo"; ?>" alt="..." height="50" width="50" class="img-circle img-responsive">
<?php } else { ?>
<span class="fa-stack fa-2x rounded-left">
<i class="fa fa-circle fa-stack-2x text-secondary"></i>
<span class="fa fa-stack-1x text-white"><?php echo $session_contact_initials; ?></span>
</span>
<?php } ?>
</div>
<div class="col-md-11 p-0">
<h4>Welcome, <strong><?php echo $session_contact_name ?></strong>!</h4>
<hr>
</div>
</div>
<br>
<div class="card">
<div class="card-body prettyContent">
<h3><?php echo $document_name; ?></h3>
@ -72,4 +49,3 @@ $document_content = $purifier->purify($row['document_content']);
<?php
require_once "portal_footer.php";

View File

@ -8,7 +8,6 @@ header("Content-Security-Policy: default-src 'self' fonts.googleapis.com fonts.g
require_once "inc_portal.php";
if ($session_contact_primary == 0 && !$session_contact_is_technical_contact) {
header("Location: portal_post.php?logout");
exit();
@ -17,71 +16,48 @@ 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 ORDER BY folder_id, document_name DESC");
?>
<div class="row">
<div class="col-md-1 text-center">
<?php if (!empty($session_contact_photo)) { ?>
<img src="<?php echo "../uploads/clients/$session_client_id/$session_contact_photo"; ?>" alt="..." height="50" width="50" class="img-circle img-responsive">
<?php } else { ?>
<span class="fa-stack fa-2x rounded-left">
<i class="fa fa-circle fa-stack-2x text-secondary"></i>
<span class="fa fa-stack-1x text-white"><?php echo $session_contact_initials; ?></span>
</span>
<?php } ?>
</div>
<div class="row">
<div class="col-md-11 p-0">
<h4>Welcome, <strong><?php echo $session_contact_name ?></strong>!</h4>
<hr>
</div>
<div class="col-md-10">
</div>
<table class="table tabled-bordered border border-dark">
<thead class="thead-dark">
<tr>
<th>Name</th>
<th>Created</th>
</tr>
</thead>
<tbody>
<br>
<?php
while ($row = mysqli_fetch_array($documents_sql)) {
$document_id = intval($row['document_id']);
$folder_name = nullable_htmlentities($row['folder_name']);
$document_name = nullable_htmlentities($row['document_name']);
$document_created_at = nullable_htmlentities($row['document_created_at']);
<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>Created</th>
<td><a href="document.php?id=<?php echo $document_id?>">
<?php
if (!empty($folder_name)) {
echo "$folder_name / ";
}
echo $document_name;
?>
</a>
</td>
<td><?php echo $document_created_at; ?></td>
</tr>
</thead>
<tbody>
<?php } ?>
<?php
while ($row = mysqli_fetch_array($documents_sql)) {
$document_id = intval($row['document_id']);
$folder_name = nullable_htmlentities($row['folder_name']);
$document_name = nullable_htmlentities($row['document_name']);
$document_created_at = nullable_htmlentities($row['document_created_at']);
?>
<tr>
<td><a href="document.php?id=<?php echo $document_id?>">
<?php
if (!empty($folder_name)) {
echo "$folder_name / ";
}
echo $document_name;
?>
</a>
</td>
<td><?php echo $document_created_at; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</tbody>
</table>
</div>
</div>
<?php
require_once "portal_footer.php";

View File

@ -10,32 +10,8 @@ require_once "inc_portal.php";
?>
<div class="row">
<div class="col-md-1 text-center">
<?php if (!empty($session_contact_photo)) { ?>
<img src="<?php echo "../uploads/clients/$session_client_id/$session_contact_photo"; ?>" alt="..." height="50" width="50" class="img-circle img-responsive">
<?php } else { ?>
<span class="fa-stack fa-2x rounded-left">
<i class="fa fa-circle fa-stack-2x text-secondary"></i>
<span class="fa fa-stack-1x text-white"><?php echo $session_contact_initials; ?></span>
</span>
<?php } ?>
</div>
<div class="col-md-11 p-0">
<h4>Welcome, <strong><?php echo $session_contact_name ?></strong>!</h4>
<hr>
</div>
<br>
<div class="col-md-2 offset-1">
<a href="ticket_add.php" class="btn btn-primary btn-block">New ticket</a>
</div>
<div class="col-md-2 offset-1">
<a href="ticket_add.php" class="btn btn-primary btn-block">New ticket</a>
</div>
<?php require_once "portal_footer.php";
?>
<?php require_once "portal_footer.php"; ?>

View File

@ -17,106 +17,85 @@ 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");
?>
<div class="row">
<div class="col-md-1 text-center">
<?php if (!empty($session_contact_photo)) { ?>
<img src="<?php echo "../uploads/clients/$session_client_id/$session_contact_photo"; ?>" alt="..." height="50" width="50" class="img-circle img-responsive">
<?php } else { ?>
<span class="fa-stack fa-2x rounded-left">
<i class="fa fa-circle fa-stack-2x text-secondary"></i>
<span class="fa fa-stack-1x text-white"><?php echo $session_contact_initials; ?></span>
</span>
<?php } ?>
</div>
<div class="row">
<div class="col-md-11 p-0">
<h4>Welcome, <strong><?php echo $session_contact_name ?></strong>!</h4>
<hr>
</div>
<div class="col-md-10">
</div>
<table class="table tabled-bordered border border-dark">
<thead class="thead-dark">
<tr>
<th>#</th>
<th>Scope</th>
<th>Amount</th>
<th>Date</th>
<th>Due</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<br>
<?php
while ($row = mysqli_fetch_array($invoices_sql)) {
$invoice_id = intval($row['invoice_id']);
$invoice_prefix = nullable_htmlentities($row['invoice_prefix']);
$invoice_number = intval($row['invoice_number']);
$invoice_scope = nullable_htmlentities($row['invoice_scope']);
$invoice_status = nullable_htmlentities($row['invoice_status']);
$invoice_date = nullable_htmlentities($row['invoice_date']);
$invoice_due = nullable_htmlentities($row['invoice_due']);
$invoice_amount = floatval($row['invoice_amount']);
$invoice_url_key = nullable_htmlentities($row['invoice_url_key']);
<div class="row">
if (empty($invoice_scope)) {
$invoice_scope_display = "-";
} else {
$invoice_scope_display = $invoice_scope;
}
<div class="col-md-10">
$now = time();
if (($invoice_status == "Sent" || $invoice_status == "Partial" || $invoice_status == "Viewed") && strtotime($invoice_due) + 86400 < $now) {
$overdue_color = "text-danger font-weight-bold";
} else {
$overdue_color = "";
}
if ($invoice_status == "Sent") {
$invoice_badge_color = "warning text-white";
} elseif ($invoice_status == "Viewed") {
$invoice_badge_color = "info";
} elseif ($invoice_status == "Partial") {
$invoice_badge_color = "primary";
} elseif ($invoice_status == "Paid") {
$invoice_badge_color = "success";
} elseif ($invoice_status == "Cancelled") {
$invoice_badge_color = "danger";
} else{
$invoice_badge_color = "secondary";
}
?>
<table class="table tabled-bordered border border-dark">
<thead class="thead-dark">
<tr>
<th>#</th>
<th>Scope</th>
<th>Amount</th>
<th>Date</th>
<th>Due</th>
<th>Status</th>
<td><a target="_blank" href="//<?php echo $config_base_url ?>/guest_view_invoice.php?invoice_id=<?php echo "$invoice_id&url_key=$invoice_url_key"?>"> <?php echo "$invoice_prefix$invoice_number"; ?></a></td>
<td><?php echo $invoice_scope_display; ?></td>
<td><?php echo numfmt_format_currency($currency_format, $invoice_amount, $session_company_currency); ?></td>
<td><?php echo $invoice_date; ?></td>
<td class="<?php echo $overdue_color; ?>"><?php echo $invoice_due; ?></td>
<td>
<span class="p-2 badge badge-<?php echo $invoice_badge_color; ?>">
<?php echo $invoice_status; ?>
</span>
</td>
</tr>
</thead>
<tbody>
<?php } ?>
<?php
while ($row = mysqli_fetch_array($invoices_sql)) {
$invoice_id = intval($row['invoice_id']);
$invoice_prefix = nullable_htmlentities($row['invoice_prefix']);
$invoice_number = intval($row['invoice_number']);
$invoice_scope = nullable_htmlentities($row['invoice_scope']);
$invoice_status = nullable_htmlentities($row['invoice_status']);
$invoice_date = nullable_htmlentities($row['invoice_date']);
$invoice_due = nullable_htmlentities($row['invoice_due']);
$invoice_amount = floatval($row['invoice_amount']);
$invoice_url_key = nullable_htmlentities($row['invoice_url_key']);
if (empty($invoice_scope)) {
$invoice_scope_display = "-";
} else {
$invoice_scope_display = $invoice_scope;
}
$now = time();
if (($invoice_status == "Sent" || $invoice_status == "Partial" || $invoice_status == "Viewed") && strtotime($invoice_due) + 86400 < $now) {
$overdue_color = "text-danger font-weight-bold";
} else {
$overdue_color = "";
}
if ($invoice_status == "Sent") {
$invoice_badge_color = "warning text-white";
} elseif ($invoice_status == "Viewed") {
$invoice_badge_color = "info";
} elseif ($invoice_status == "Partial") {
$invoice_badge_color = "primary";
} elseif ($invoice_status == "Paid") {
$invoice_badge_color = "success";
} elseif ($invoice_status == "Cancelled") {
$invoice_badge_color = "danger";
} else{
$invoice_badge_color = "secondary";
}
?>
<tr>
<td><a target="_blank" href="//<?php echo $config_base_url ?>/guest_view_invoice.php?invoice_id=<?php echo "$invoice_id&url_key=$invoice_url_key"?>"> <?php echo "$invoice_prefix$invoice_number"; ?></a></td>
<td><?php echo $invoice_scope_display; ?></td>
<td><?php echo numfmt_format_currency($currency_format, $invoice_amount, $session_company_currency); ?></td>
<td><?php echo $invoice_date; ?></td>
<td class="<?php echo $overdue_color; ?>"><?php echo $invoice_due; ?></td>
<td>
<span class="p-2 badge badge-<?php echo $invoice_badge_color; ?>">
<?php echo $invoice_status; ?>
</span>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</tbody>
</table>
</div>
</div>
<?php
require_once "portal_footer.php";

View File

@ -33,7 +33,7 @@ header("X-Frame-Options: DENY"); // Legacy
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
<a class="navbar-brand" href="index.php"><?php echo nullable_htmlentities($session_company_name); ?></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent">
<span class="navbar-toggler-icon"></span>
</button>
@ -64,12 +64,12 @@ header("X-Frame-Options: DENY"); // Legacy
<ul class="nav navbar-nav pull-right">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown">
<?php echo nullable_htmlentities($session_contact_name); ?>
<?php echo stripslashes(nullable_htmlentities($session_contact_name)); ?>
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="profile.php">Profile</a>
<div class="dropdown-menu">
<a class="dropdown-item" href="profile.php"><i class="fas fa-fw fa-user mr-2"></i>Account</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="portal_post.php?logout">Sign out</a>
<a class="dropdown-item" href="portal_post.php?logout"><i class="fas fa-fw fa-sign-out-alt mr-2"></i>Sign out</a>
</div>
</li>
</ul>
@ -81,3 +81,23 @@ header("X-Frame-Options: DENY"); // Legacy
<!-- Page content container -->
<div class="container">
<div class="row mb-3">
<div class="col-md-1 text-center">
<?php if (!empty($session_contact_photo)) { ?>
<img src="<?php echo "../uploads/clients/$session_client_id/$session_contact_photo"; ?>" alt="..." height="50" width="50" class="img-circle img-responsive">
<?php } else { ?>
<span class="fa-stack fa-2x rounded-left">
<i class="fa fa-circle fa-stack-2x text-secondary"></i>
<span class="fa fa-stack-1x text-white"><?php echo $session_contact_initials; ?></span>
</span>
<?php } ?>
</div>
<div class="col-md-11 p-0">
<h4>Welcome, <strong><?php echo stripslashes(nullable_htmlentities($session_contact_name)); ?></strong>!</h4>
<hr>
</div>
</div>

View File

@ -9,23 +9,18 @@ require_once "inc_portal.php";
if (isset($_POST['add_ticket'])) {
// Get ticket prefix/number
$sql_settings = mysqli_query($mysqli, "SELECT * FROM settings WHERE company_id = 1");
$row = mysqli_fetch_array($sql_settings);
$config_ticket_prefix = sanitizeInput($row['config_ticket_prefix']);
$config_ticket_next_number = intval($row['config_ticket_next_number']);
// Get email settings
$config_ticket_from_name = $row['config_ticket_from_name'];
$config_ticket_from_email = $row['config_ticket_from_email'];
$config_ticket_new_ticket_notification_email = filter_var($row['config_ticket_new_ticket_notification_email'], FILTER_VALIDATE_EMAIL);
$client_id = intval($session_client_id);
$contact = intval($session_contact_id);
$subject = sanitizeInput($_POST['subject']);
$details = mysqli_real_escape_string($mysqli,($_POST['details']));
// Get settings from get_settings.php
$config_ticket_prefix = sanitizeInput($config_ticket_prefix);
$config_ticket_from_name = sanitizeInput($config_ticket_from_name);
$config_ticket_from_email = sanitizeInput($config_ticket_from_email);
$config_base_url = sanitizeInput($config_base_url);
$config_ticket_new_ticket_notification_email = filter_var($row['config_ticket_new_ticket_notification_email'], FILTER_VALIDATE_EMAIL);
// Ensure priority is low/med/high (as can be user defined)
if ($_POST['priority'] !== "Low" && $_POST['priority'] !== "Medium" && $_POST['priority'] !== "High") {
$priority = "Low";

View File

@ -12,7 +12,7 @@ require_once 'inc_portal.php';
<h2>Profile</h2>
<p>Name: <?php echo $session_contact_name ?></p>
<p>Name: <?php echo stripslashes(nullable_htmlentities($session_contact_name)); ?></p>
<p>Email: <?php echo $session_contact_email ?></p>
<p>PIN: <?php echo $session_contact_pin ?></p>
<p>Client: <?php echo $session_client_name ?></p>

View File

@ -8,7 +8,6 @@ header("Content-Security-Policy: default-src 'self' fonts.googleapis.com fonts.g
require_once "inc_portal.php";
if ($session_contact_primary == 0 && !$session_contact_is_billing_contact) {
header("Location: portal_post.php?logout");
exit();
@ -17,98 +16,75 @@ 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");
?>
<div class="row">
<div class="col-md-1 text-center">
<?php if (!empty($session_contact_photo)) { ?>
<img src="<?php echo "../uploads/clients/$session_client_id/$session_contact_photo"; ?>" alt="..." height="50" width="50" class="img-circle img-responsive">
<?php } else { ?>
<span class="fa-stack fa-2x rounded-left">
<i class="fa fa-circle fa-stack-2x text-secondary"></i>
<span class="fa fa-stack-1x text-white"><?php echo $session_contact_initials; ?></span>
</span>
<?php } ?>
</div>
<div class="row">
<div class="col-md-11 p-0">
<h4>Welcome, <strong><?php echo $session_contact_name ?></strong>!</h4>
<hr>
</div>
<div class="col-md-10">
</div>
<table class="table tabled-bordered border border-dark">
<thead class="thead-dark">
<tr>
<th>#</th>
<th>Scope</th>
<th>Amount</th>
<th>Date</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<br>
<?php
while ($row = mysqli_fetch_array($quotes_sql)) {
$quote_id = intval($row['quote_id']);
$quote_prefix = nullable_htmlentities($row['quote_prefix']);
$quote_number = intval($row['quote_number']);
$quote_scope = nullable_htmlentities($row['quote_scope']);
$quote_status = nullable_htmlentities($row['quote_status']);
$quote_date = nullable_htmlentities($row['quote_date']);
$quote_amount = floatval($row['quote_amount']);
$quote_url_key = nullable_htmlentities($row['quote_url_key']);
<div class="row">
if (empty($quote_scope)) {
$quote_scope_display = "-";
} else {
$quote_scope_display = $quote_scope;
}
<div class="col-md-10">
if ($quote_status == "Sent") {
$quote_badge_color = "warning text-white";
} elseif ($quote_status == "Viewed") {
$quote_badge_color = "primary";
} elseif ($quote_status == "Accepted") {
$quote_badge_color = "success";
} elseif ($quote_status == "Declined") {
$quote_badge_color = "danger";
} elseif ($quote_status == "Invoiced") {
$quote_badge_color = "info";
} else {
$quote_badge_color = "secondary";
}
?>
<table class="table tabled-bordered border border-dark">
<thead class="thead-dark">
<tr>
<th>#</th>
<th>Scope</th>
<th>Amount</th>
<th>Date</th>
<th>Status</th>
<td><a target="_blank" href="//<?php echo $config_base_url ?>/guest_view_quote.php?quote_id=<?php echo "$quote_id&url_key=$quote_url_key"?>"> <?php echo "$quote_prefix$quote_number"; ?></a></td>
<td><?php echo $quote_scope_display; ?></td>
<td><?php echo numfmt_format_currency($currency_format, $quote_amount, $session_company_currency); ?></td>
<td><?php echo $quote_date; ?></td>
<td>
<span class="p-2 badge badge-<?php echo $quote_badge_color; ?>">
<?php echo $quote_status; ?>
</span>
</td>
</tr>
</thead>
<tbody>
<?php } ?>
<?php
while ($row = mysqli_fetch_array($quotes_sql)) {
$quote_id = intval($row['quote_id']);
$quote_prefix = nullable_htmlentities($row['quote_prefix']);
$quote_number = intval($row['quote_number']);
$quote_scope = nullable_htmlentities($row['quote_scope']);
$quote_status = nullable_htmlentities($row['quote_status']);
$quote_date = nullable_htmlentities($row['quote_date']);
$quote_amount = floatval($row['quote_amount']);
$quote_url_key = nullable_htmlentities($row['quote_url_key']);
if (empty($quote_scope)) {
$quote_scope_display = "-";
} else {
$quote_scope_display = $quote_scope;
}
if ($quote_status == "Sent") {
$quote_badge_color = "warning text-white";
} elseif ($quote_status == "Viewed") {
$quote_badge_color = "primary";
} elseif ($quote_status == "Accepted") {
$quote_badge_color = "success";
} elseif ($quote_status == "Declined") {
$quote_badge_color = "danger";
} elseif ($quote_status == "Invoiced") {
$quote_badge_color = "info";
} else {
$quote_badge_color = "secondary";
}
?>
<tr>
<td><a target="_blank" href="//<?php echo $config_base_url ?>/guest_view_quote.php?quote_id=<?php echo "$quote_id&url_key=$quote_url_key"?>"> <?php echo "$quote_prefix$quote_number"; ?></a></td>
<td><?php echo $quote_scope_display; ?></td>
<td><?php echo numfmt_format_currency($currency_format, $quote_amount, $session_company_currency); ?></td>
<td><?php echo $quote_date; ?></td>
<td>
<span class="p-2 badge badge-<?php echo $quote_badge_color; ?>">
<?php echo $quote_status; ?>
</span>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</tbody>
</table>
</div>
</div>
<?php
require_once "portal_footer.php";

View File

@ -45,29 +45,6 @@ $total_tickets = intval($row['total_tickets']);
?>
<div class="row">
<div class="col-md-1 text-center">
<?php if (!empty($session_contact_photo)) { ?>
<img src="<?php echo "../uploads/clients/$session_client_id/$session_contact_photo"; ?>" alt="..." height="50" width="50" class="img-circle img-responsive">
<?php } else { ?>
<span class="fa-stack fa-2x rounded-left">
<i class="fa fa-circle fa-stack-2x text-secondary"></i>
<span class="fa fa-stack-1x text-white"><?php echo $session_contact_initials; ?></span>
</span>
<?php } ?>
</div>
<div class="col-md-11 p-0">
<h4>Welcome, <strong><?php echo $session_contact_name ?></strong>!</h4>
<hr>
</div>
</div>
<br>
<div class="row">
<div class="col-md-10">