Update badge classes to bg

This commit is contained in:
johnnyq
2026-08-15 13:00:41 -04:00
parent 73e10e72f2
commit 2375e69f2d
25 changed files with 80 additions and 44 deletions

View File

@@ -148,7 +148,7 @@ if (!empty($_SESSION['backup_master_key_reveal'])) {
<td><?= $backup['backup_size'] > 0 ? escapeHtml(backupFormatBytes($backup['backup_size'])) : '-' ?></td>
<td><?= escapeHtml($backup['backup_source']) ?></td>
<td>
<span class="badge badge-<?= $badge ?>"><?= escapeHtml($status) ?></span>
<span class="badge text-bg-<?= $badge ?>"><?= escapeHtml($status) ?></span>
<?php if (!empty($backup['backup_error'])) { ?>
<br><small class="text-danger"><?= escapeHtml($backup['backup_error']) ?></small>
<?php } ?>

View File

@@ -784,7 +784,7 @@ if ($user_config_dashboard_technical_enable == 1) {
<td><a href="ticket.php?ticket_id=<?= "$ticket_id$has_client" ?>"><?= $ticket_subject ?></a></td>
<td><a href="tickets.php?client_id=<?= $client_id ?>"><strong><?= $client_name ?></strong></a></td>
<td><?= $contact_display ?></td>
<td><span class='p-2 badge rounded-pill badge-<?= $ticket_priority_color ?>'><?= $ticket_priority ?></span></td>
<td><span class='p-2 badge rounded-pill text-bg-<?= $ticket_priority_color ?>'><?= $ticket_priority ?></span></td>
<td><span class='badge rounded-pill text-light p-2' style="background-color: <?= $ticket_status_color ?>"><?= $ticket_status_name ?></span></td>
<td><?= $ticket_updated_at_display ?></td>
</tr>

View File

@@ -349,7 +349,7 @@ if (isset($_GET['invoice_id'])) {
<div class="col-sm-4">
<h3 class="text-end"><strong>INVOICE</strong></h3>
<h5 class="badge badge-<?= $invoice_badge_color ?> p-2 float-end">
<h5 class="badge text-bg-<?= $invoice_badge_color ?> p-2 float-end">
<?= "$invoice_status" ?>
</h5>
<table class="table table-sm table-borderless">

View File

@@ -396,12 +396,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<?php if ($invoice_status == 'Paid' || $invoice_status == 'Partial') { ?>
<a class="ajax-modal" href="#" title="View payments"
data-modal-url="modals/invoice/invoice_payments.php?invoice_id=<?= $invoice_id ?>">
<span class="p-2 badge badge-<?= $invoice_badge_color ?>">
<span class="p-2 badge text-bg-<?= $invoice_badge_color ?>">
<?= $invoice_status ?>
</span>
</a>
<?php } else { ?>
<span class="p-2 badge badge-<?= $invoice_badge_color ?>">
<span class="p-2 badge text-bg-<?= $invoice_badge_color ?>">
<?= $invoice_status ?>
</span>
<?php } ?>

View File

@@ -43,7 +43,7 @@ ob_start();
<div class="modal-header bg-dark">
<h5 class="modal-title text-white">
<i class="fa fa-fw fa-credit-card me-2"></i>Payments for <?= "$invoice_prefix$invoice_number" ?>
<span class="p-2 ms-2 badge badge-<?= $invoice_badge_color ?>"><?= $invoice_status ?></span>
<span class="p-2 ms-2 badge text-bg-<?= $invoice_badge_color ?>"><?= $invoice_status ?></span>
</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
</div>

View File

@@ -820,7 +820,7 @@ if (isset($_GET['export_quote_pdf'])) {
//Set Badge color based off of quote status
if ($quote_status == "Sent") {
$quote_badge_color = "warning text-white";
$quote_badge_color = "warning";
} elseif ($quote_status == "Viewed") {
$quote_badge_color = "primary";
} elseif ($quote_status == "Accepted") {

View File

@@ -103,7 +103,7 @@ if (isset($_GET['quote_id'])) {
//Set Badge color based off of quote status
if ($quote_status == "Sent") {
$quote_badge_color = "warning text-white";
$quote_badge_color = "warning";
} elseif ($quote_status == "Viewed") {
$quote_badge_color = "primary";
} elseif ($quote_status == "Accepted") {
@@ -259,7 +259,7 @@ if (isset($_GET['quote_id'])) {
<div class="col-sm-4">
<h3 class="text-end"><strong>QUOTE</strong></h3>
<h5 class="badge badge-<?= $quote_badge_color ?> p-2 float-end">
<h5 class="badge text-bg-<?= $quote_badge_color ?> p-2 float-end">
<?= "$quote_status" ?>
</h5>
<table class="table table-sm table-borderless">

View File

@@ -171,7 +171,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
}
if ($quote_status == "Sent") {
$quote_badge_color = "warning text-white";
$quote_badge_color = "warning";
} elseif ($quote_status == "Viewed") {
$quote_badge_color = "primary";
} elseif ($quote_status == "Accepted") {
@@ -203,7 +203,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<td><?= $quote_expire ?></td>
<td><?= $category_name ?></td>
<td>
<span class="p-2 badge badge-<?= $quote_badge_color ?>">
<span class="p-2 badge text-bg-<?= $quote_badge_color ?>">
<?= $quote_status ?>
</span>
</td>

View File

@@ -227,7 +227,7 @@ if (isset($_GET['recurring_invoice_id'])) {
<div class="col-sm-4">
<h3 class="text-end"><strong>RECURRING INVOICE</strong></h3>
<h5 class="badge badge-<?= $status_badge_color ?> p-2 float-end">
<h5 class="badge text-bg-<?= $status_badge_color ?> p-2 float-end">
<?= $status ?>
</h5>
<table class="table table-sm table-borderless">

View File

@@ -245,7 +245,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<?php } ?>
</td>
<td>
<span class="p-2 badge badge-<?= $status_badge_color ?>">
<span class="p-2 badge text-bg-<?= $status_badge_color ?>">
<?= $status ?>
</span>

View File

@@ -573,7 +573,7 @@ if (isset($_GET['ticket_id'])) {
data-modal-url="modals/ticket/ticket_priority.php?id=<?= $ticket_id ?>"
<?php } ?>
>
<span class="badge rounded-pill badge-<?= $ticket_priority_color ?> p-2"><?= $ticket_priority ?></span>
<span class="badge rounded-pill text-bg-<?= $ticket_priority_color ?> p-2"><?= $ticket_priority ?></span>
</a>
</div>
</div>

View File

@@ -153,7 +153,7 @@ $kanban = array_values($statuses);
<?= escapeHtml($item['ticket_prefix']) . intval($item['ticket_number']) ?>
</a>
<span class="badge badge-<?= $ticket_priority_color ?>"><?= $item_priority ?></span>
<span class="badge text-bg-<?= $ticket_priority_color ?>"><?= $item_priority ?></span>
<?php if ($ticket_sla_alert_stage == 2) { ?>
<span class="badge bg-danger" title="SLA breached"><i class="fas fa-fw fa-stopwatch"></i></span>

View File

@@ -391,7 +391,7 @@ if ($tickets) {
data-modal-url="modals/ticket/ticket_priority.php?id=<?= $ticket_id ?>"
<?php } ?>
>
<span class="p-2 badge rounded-pill badge-<?= $ticket_priority_color ?>"><?= $ticket_priority ?></span>
<span class="p-2 badge rounded-pill text-bg-<?= $ticket_priority_color ?>"><?= $ticket_priority ?></span>
</a>
</td>

View File

@@ -519,7 +519,7 @@ if ($account_filter) {
</a>
<?php } ?>
</td>
<td><span class="badge badge-<?= $transaction_badge_color ?>"><?= $transaction_type ?></span></td>
<td><span class="badge text-bg-<?= $transaction_badge_color ?>"><?= $transaction_type ?></span></td>
<td>
<?= $transaction_category_display ?>
<div class="text-secondary"><small><?= truncate($transaction_description, 60) ?></small></div>

View File

@@ -157,9 +157,9 @@ header("X-Frame-Options: DENY"); // Legacy
$_SESSION['alert_type'] = "info";
}
?>
<div class="alert alert-<?= $_SESSION['alert_type'] ?>" id="alert">
<div class="alert alert-<?= alertStyleClass($_SESSION['alert_type'] ?? 'success') ?> alert-dismissible" id="alert">
<?= alertMessageHtml($_SESSION['alert_message']) ?>
<button class='close' data-bs-dismiss='alert'>&times;</button>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<?php

View File

@@ -59,7 +59,7 @@ $invoices_sql = mysqli_query($mysqli, "SELECT invoice_amount, invoice_date, invo
}
if ($invoice_status == "Sent") {
$invoice_badge_color = "warning text-white";
$invoice_badge_color = "warning";
} elseif ($invoice_status == "Viewed") {
$invoice_badge_color = "info";
} elseif ($invoice_status == "Partial") {
@@ -80,7 +80,7 @@ $invoices_sql = mysqli_query($mysqli, "SELECT invoice_amount, invoice_date, invo
<td><?= $invoice_date ?></td>
<td class="<?= $overdue_color ?>"><?= $invoice_due ?></td>
<td>
<span class="p-2 badge badge-<?= $invoice_badge_color ?>">
<span class="p-2 badge text-bg-<?= $invoice_badge_color ?>">
<?= $invoice_status ?>
</span>
</td>

View File

@@ -49,7 +49,7 @@ $quotes_sql = mysqli_query($mysqli, "SELECT quote_amount, quote_date, quote_id,
}
if ($quote_status == "Sent") {
$quote_badge_color = "warning text-white";
$quote_badge_color = "warning";
} elseif ($quote_status == "Viewed") {
$quote_badge_color = "primary";
} elseif ($quote_status == "Accepted") {
@@ -70,7 +70,7 @@ $quotes_sql = mysqli_query($mysqli, "SELECT quote_amount, quote_date, quote_id,
<td><?= numfmt_format_currency($currency_format, $quote_amount, $session_company_currency) ?></td>
<td><?= $quote_date ?></td>
<td>
<span class="p-2 badge badge-<?= $quote_badge_color ?>">
<span class="p-2 badge text-bg-<?= $quote_badge_color ?>">
<?= $quote_status ?>
</span>
</td>

View File

@@ -119,7 +119,7 @@ $balance = $invoice_amounts - $amount_paid;
}
if ($invoice_status == "Sent") {
$invoice_badge_color = "warning text-white";
$invoice_badge_color = "warning";
} elseif ($invoice_status == "Viewed") {
$invoice_badge_color = "info";
} elseif ($invoice_status == "Partial") {

View File

@@ -594,3 +594,25 @@ a:not(.dropdown-item):not(.btn-app):not(.nav-link):not(.brand-link):not(.page-li
.theme-teal .nav-pills {
--bs-nav-pills-link-active-color: #000;
}
/* --- Theme swatch colours -----------------------------------------------
admin/settings_theme.php renders each choice as <i class="fa-circle
text-<colour>">. AdminLTE 3 defined those; v4 does not, so every swatch
on the theme picker rendered with no colour at all - you could not see
what you were selecting. Same accent hexes the themes themselves use. */
.text-black { color: #000000 !important; }
.text-blue { color: #007bff !important; }
.text-cyan { color: #17a2b8 !important; }
.text-fuchsia { color: #f012be !important; }
.text-gray { color: #6c757d !important; }
.text-green { color: #28a745 !important; }
.text-indigo { color: #6610f2 !important; }
.text-lightblue { color: #3c8dbc !important; }
.text-maroon { color: #d81b60 !important; }
.text-navy { color: #001f3f !important; }
.text-olive { color: #3d9970 !important; }
.text-orange { color: #fd7e14 !important; }
.text-pink { color: #e83e8c !important; }
.text-purple { color: #6f42c1 !important; }
.text-red { color: #dc3545 !important; }
.text-teal { color: #20c997 !important; }

View File

@@ -39,7 +39,7 @@ function getAssetIcon($asset_type) {
function getInvoiceBadgeColor($invoice_status) {
if ($invoice_status == "Sent") {
$invoice_badge_color = "warning text-white";
$invoice_badge_color = "warning";
} elseif ($invoice_status == "Viewed") {
$invoice_badge_color = "info";
} elseif ($invoice_status == "Partial") {

View File

@@ -169,6 +169,28 @@ function escapeCsvFormula($value) {
* existed there were four separate implementations and one of them interpolated
* raw.
*/
/**
* Map a flashAlert type onto a real Bootstrap contextual class.
*
* flashAlert() is called with more type names than Bootstrap has classes -
* 'error', 'alert' and a typo'd 'errpr' among them - so interpolating the raw
* value produced alert-error / alert-alert, which style nothing at all.
*/
function alertStyleClass($type) {
$alert_classes = [
'success' => 'success',
'info' => 'info',
'warning' => 'warning',
'alert' => 'warning',
'error' => 'danger',
'errpr' => 'danger',
'danger' => 'danger',
];
return $alert_classes[$type] ?? 'secondary';
}
function alertMessageHtml($message) {
$allowed_tags = [

View File

@@ -217,7 +217,7 @@ if ($balance > 0) {
<div class="col-sm-4">
<h3 class="text-end"><strong>INVOICE</strong></h3>
<h5 class="badge badge-<?= $invoice_badge_color ?> p-2 float-end">
<h5 class="badge text-bg-<?= $invoice_badge_color ?> p-2 float-end">
<?= "$invoice_status" ?>
</h5>
<table class="table table-sm table-borderless">

View File

@@ -92,7 +92,7 @@ $currency_format = numfmt_create($company_locale, NumberFormatter::CURRENCY);
//Set Badge color based off of quote status
if ($quote_status == "Sent") {
$quote_badge_color = "warning text-white";
$quote_badge_color = "warning";
} elseif ($quote_status == "Viewed") {
$quote_badge_color = "primary";
} elseif ($quote_status == "Accepted") {
@@ -150,7 +150,7 @@ if ($quote_status == "Draft" || $quote_status == "Sent" || $quote_status == "Vie
<div class="col-sm-4">
<h3 class="text-end"><strong>QUOTE</strong></h3>
<h5 class="badge badge-<?= $quote_badge_color ?> p-2 float-end">
<h5 class="badge text-bg-<?= $quote_badge_color ?> p-2 float-end">
<?= "$quote_status" ?>
</h5>
<table class="table table-sm table-borderless">

View File

@@ -20,21 +20,13 @@ if (!empty($_SESSION['alert_message'])) {
$alert_type = $_SESSION['alert_type'] ?? 'success';
// flashAlert() is called with more type names than toastr ever defined -
// 'danger' (19 sites), 'alert' (4) and a typo'd 'errpr' (1) all resolved to
// an undefined toastr method, threw, and showed the user nothing at all.
// Everything maps onto a real style here; anything unrecognised still shows.
$alert_styles = [
'success' => 'text-bg-success',
'info' => 'text-bg-info',
'warning' => 'text-bg-warning',
'alert' => 'text-bg-warning',
'error' => 'text-bg-danger',
'errpr' => 'text-bg-danger',
'danger' => 'text-bg-danger',
];
$alert_style = $alert_styles[$alert_type] ?? 'text-bg-secondary';
$alert_dark_text = in_array($alert_type, ['warning', 'alert', 'info'], true);
// One mapping for both renderers - see alertStyleClass() in
// functions/sanitize.php. flashAlert() is called with more type names than
// Bootstrap has classes ('danger', 'alert' and a typo'd 'errpr' among
// them), and an unmapped value used to resolve to nothing at all.
$alert_style = 'text-bg-' . alertStyleClass($alert_type);
// text-bg-info and text-bg-warning are the two Bootstrap pairs with dark text
$alert_dark_text = in_array(alertStyleClass($alert_type), ['warning', 'info'], true);
// Escaping lives in one place now - see alertMessageHtml() in functions/sanitize.php
$alert_safe_message = alertMessageHtml($_SESSION['alert_message']);

View File

@@ -658,7 +658,7 @@ if (isset($_POST['add_telemetry'])) {
?>
<div class="alert alert-info" id="alert">
<?= alertMessageHtml($_SESSION['alert_message']) ?>
<button class='close' data-bs-dismiss='alert'>&times;</button>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<?php
$_SESSION['alert_type'] = '';