diff --git a/CHANGELOG.md b/CHANGELOG.md
index eb3750a8c..00d878de8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -170,6 +170,7 @@ If you are coming from 26.08 or earlier, the database update still has to be run
- Drop-downs show pictures, initials, colors and icons where they help: client, agent and contact avatars, tag and category colors, priority dots and asset types. On a phone the list comes up from the bottom of the screen.
- Forms have an icon in front of every field, the same across the app. Long forms are split into tabs, and most of them take you to a required field you left empty on another tab when you save.
- Buttons that only show an icon say what they do when you point at them.
+ - Empty lists look the same on every list page. With nothing added yet, a list says so, with a line on what goes in it and its own New buttons - and Import, where the list has it. When a search or filters leave nothing, it says nothing matches, with Clear filters to go back to the whole list, keeping the client and the tab you are on. An empty tab that flags trouble, such as Overdue or Expiring soon, shows a tick, as nothing there is good news. Archived says when nothing is archived.
- Links that delete or disable something ask first.
- Leaving a page with a half-written reply or note asks first, including after a window has been opened and closed on that page.
- The side navigation shows your company logo (Admin > Settings > Company Details) or the company's initials, with the company name wrapping onto two lines.
@@ -1044,6 +1045,7 @@ If you are coming from 26.08 or earlier, the database update still has to be run
- Sidebar brand: `agent/css/sidebar_brand_fix.css` and `agent/js/sidebar_brand_fix.js` from 26.10 are replaced by CSS in `css/itflow_custom.css`. `includes/load_company_settings.php` now sets `$session_company_logo`.
- `alertMessageHtml()` no longer double-encodes, and save messages built from `escapeSql()` values use `stripslashes()` at the flash.
- CSS: `[hidden] { display: none !important; }` at the top of `css/itflow_custom.css`, so the `hidden` attribute wins over `d-flex` and the other display utilities. `.pagination` wraps.
+- Empty states: every list page sets `$empty_state` before including `includes/filter_footer.php`, and `includes/inc_empty_state.php` draws it with `emptyStateHtml()` (`functions/format.php`) when the list has nothing - `thing`, `icon`, `title`, `text`, `actions` (`label`, `modal` or `href`, `size`, `icon`; the first is the main one), `archived`, `view`, `filtered`, `views`, `match_title`, `match_text` and `clear_url`. `emptyStateFiltered($views)` reads the GET string for a search or filter, leaving out paging, sorting, `client_id`, `archived` and the page's views, and `emptyStateClearUrl($views)` is the page without them. `emptyStatePill($pills, $key, $default, $good)` builds a pill's own state from the page's pill array (`label`, `icon`, `title`, `alarm`), with a tick for `alarm` pills and the keys in `$good`. Files, notifications and racks call `emptyStateHtml()` in their own layout; files and notifications set `$empty_state_skip`. A page that sets nothing still gets one, worded from `$page_title`. The pages' own empty blocks (`.itflow-asset-empty` under a list) are gone. CSS: `.itflow-empty-state` with `-icon` (a grey round tile), `-title`, `-text` and `-actions`.
- Removed unused helpers and files:
- `credentialLink()`, `projectLink()`, `linkCounts()`, `assetContactAvatar()` and `clientOverviewPersonInitials()`
- `agent/modals/asset/asset_documents.php`, `document_bulk_move.php`, `document_add_file_relation.php` and `project_link_closed_ticket.php`
diff --git a/admin/ai_models.php b/admin/ai_models.php
index aaca1dd57..ecea6371e 100644
--- a/admin/ai_models.php
+++ b/admin/ai_models.php
@@ -120,6 +120,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
+ 'AI models',
+ 'icon' => 'fa-robot',
+ 'text' => 'The models ITFlow uses for ticket summaries and rewording - add a provider first.',
+ 'actions' => [['label' => 'Add Model', 'modal' => 'modals/ai/ai_model_add.php']],
+ ];
+ ?>
diff --git a/admin/ai_providers.php b/admin/ai_providers.php
index 2f3d967ed..73fc5d268 100644
--- a/admin/ai_providers.php
+++ b/admin/ai_providers.php
@@ -111,6 +111,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
+ 'AI providers',
+ 'icon' => 'fa-robot',
+ 'text' => 'Connect an AI service, then pick the models ITFlow uses from it.',
+ 'actions' => [['label' => 'Add Provider', 'modal' => 'modals/ai/ai_provider_add.php']],
+ ];
+ ?>
diff --git a/admin/api_keys.php b/admin/api_keys.php
index 861b8307b..0d1db9a6e 100644
--- a/admin/api_keys.php
+++ b/admin/api_keys.php
@@ -160,6 +160,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
+ 'API keys',
+ 'icon' => 'fa-key',
+ 'text' => 'A key lets another system read and write ITFlow through its API.',
+ 'actions' => [['label' => 'New API Key', 'modal' => 'modals/api/api_key_add.php']],
+ ];
+ ?>
diff --git a/admin/app_logs.php b/admin/app_logs.php
index 528afcf29..1c8fb49bd 100644
--- a/admin/app_logs.php
+++ b/admin/app_logs.php
@@ -162,6 +162,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
+ 'app logs',
+ 'icon' => 'fa-history',
+ 'text' => 'What ITFlow itself does - cron runs, mail, errors - shows here.',
+ ];
+ ?>
diff --git a/admin/audit_logs.php b/admin/audit_logs.php
index 999540924..66e4baf94 100644
--- a/admin/audit_logs.php
+++ b/admin/audit_logs.php
@@ -280,6 +280,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
+ 'audit logs',
+ 'icon' => 'fa-history',
+ 'text' => 'Who changed what, and when, shows here.',
+ ];
+ ?>
diff --git a/admin/canned_responses.php b/admin/canned_responses.php
index dcb3989e4..9a76e38bc 100644
--- a/admin/canned_responses.php
+++ b/admin/canned_responses.php
@@ -126,6 +126,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
+ 'canned responses',
+ 'icon' => 'fa-comment-dots',
+ 'text' => 'Replies agents drop into a ticket in one click.',
+ 'actions' => [['label' => 'New Canned Response', 'modal' => 'modals/canned_response/canned_response_add.php', 'size' => 'lg']],
+ ];
+ ?>
diff --git a/admin/categories.php b/admin/categories.php
index 0f18fdff1..f2cdb9b15 100644
--- a/admin/categories.php
+++ b/admin/categories.php
@@ -210,6 +210,14 @@ $archive_toggle_url = '?' . http_build_query($archive_toggle_query);
+ strtolower($category_label) . ' categories',
+ 'icon' => 'fa-list-ul',
+ 'views' => ['category'],
+ 'actions' => [['label' => "New $category_label Category", 'modal' => 'modals/category/category_add.php?category=' . urlencode($category)]],
+ ];
+ ?>
diff --git a/admin/contract_templates.php b/admin/contract_templates.php
index e373e3ab4..2bceb7e62 100644
--- a/admin/contract_templates.php
+++ b/admin/contract_templates.php
@@ -154,6 +154,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
+ 'contract templates',
+ 'icon' => 'fa-file-contract',
+ 'actions' => [['label' => 'New Template', 'modal' => 'modals/contract_template/contract_template_add.php', 'size' => 'lg']],
+ ];
+ ?>
diff --git a/admin/custom_links.php b/admin/custom_links.php
index 77a8a0c0a..96da211cd 100644
--- a/admin/custom_links.php
+++ b/admin/custom_links.php
@@ -136,6 +136,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
+ 'custom links',
+ 'icon' => 'fa-external-link-alt',
+ 'text' => 'Your own links, added to the menus.',
+ 'actions' => [['label' => 'New Link', 'modal' => 'modals/custom_link/custom_link_add.php']],
+ ];
+ ?>
diff --git a/admin/document_templates.php b/admin/document_templates.php
index fbbe474c3..303231675 100644
--- a/admin/document_templates.php
+++ b/admin/document_templates.php
@@ -129,6 +129,14 @@
+ 'document templates',
+ 'icon' => 'fa-file-alt',
+ 'text' => 'Start a client document from one.',
+ 'actions' => [['label' => 'New Template', 'modal' => 'modals/document_template/document_template_add.php', 'size' => 'xl']],
+ ];
+ ?>
diff --git a/admin/mail_queue.php b/admin/mail_queue.php
index 58ed712b4..141c2c8b0 100644
--- a/admin/mail_queue.php
+++ b/admin/mail_queue.php
@@ -182,6 +182,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
+ 'emails',
+ 'icon' => 'fa-inbox',
+ 'title' => 'Nothing in the mail queue',
+ 'text' => 'The email ITFlow sends waits here until it goes.',
+ ];
+ ?>
diff --git a/admin/modules.php b/admin/modules.php
index 07b9f16ce..a5ee78ca3 100644
--- a/admin/modules.php
+++ b/admin/modules.php
@@ -101,6 +101,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
+ 'modules',
+ 'icon' => 'fa-puzzle-piece',
+ 'actions' => [['label' => 'New Module', 'modal' => 'modals/module/module_add.php']],
+ ];
+ ?>
diff --git a/admin/payment_methods.php b/admin/payment_methods.php
index 6ed572f7f..5d13736ca 100644
--- a/admin/payment_methods.php
+++ b/admin/payment_methods.php
@@ -104,6 +104,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
+ 'payment methods',
+ 'icon' => 'fa-credit-card',
+ 'text' => 'How clients pay you - check, ACH, cash, card.',
+ 'actions' => [['label' => 'Add Payment Method', 'modal' => 'modals/payment_method/payment_method_add.php']],
+ ];
+ ?>
diff --git a/admin/payment_providers.php b/admin/payment_providers.php
index 73af45fd2..275394b08 100644
--- a/admin/payment_providers.php
+++ b/admin/payment_providers.php
@@ -143,6 +143,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
+ 'payment providers',
+ 'icon' => 'fa-credit-card',
+ 'text' => 'Take card payments online when clients pay an invoice.',
+ 'actions' => [['label' => 'Add Provider', 'modal' => 'modals/payment_provider/payment_provider_add.php']],
+ ];
+ ?>
diff --git a/admin/project_templates.php b/admin/project_templates.php
index 2ba849593..5c3592d1e 100644
--- a/admin/project_templates.php
+++ b/admin/project_templates.php
@@ -137,13 +137,18 @@ $sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $di
-
-
-
-
= $q !== '' ? 'No project templates match.' : ($show_archived ? 'No archived project templates.' : 'No project templates yet - a client onboarding plan is a good first one: one ticket template per step, each with its checklist of tasks.') ?>
= $any_filter ? 'Nothing matches.' : 'Nothing has come in yet.' ?>
-
-
A payment is added on its invoice. Money in that isn't for an invoice is New Income here= $can_edit ? ', and a bank statement\'s deposits come in with Import Deposits' : '' ?>.
-
-
-
-
+ 'income',
+ 'icon' => 'fa-hand-holding-usd',
+ 'filtered' => $q || ($client_filter && !$client_page) || $category_filter || $account_filter || $method_filter !== '' || $dtf !== '1970-01-01',
+ 'views' => ['show'],
+ 'view' => emptyStatePill($shows, $show, '', ['uncategorised']),
+ 'match_title' => 'No income matches',
+ 'text' => "A payment is added on its invoice. Money in that isn't for an invoice is New Income here.",
+ 'actions' => $can_edit ? [
+ ['label' => 'New Income', 'modal' => $add_url, 'size' => 'lg'],
+ ['label' => 'Import Deposits', 'href' => 'income_import.php', 'icon' => 'fa-file-import'],
+ ] : [],
+ ];
+ require_once "../includes/filter_footer.php";
+ ?>
diff --git a/agent/invoices.php b/agent/invoices.php
index 7d552facf..10842558e 100644
--- a/agent/invoices.php
+++ b/agent/invoices.php
@@ -442,13 +442,18 @@ $stat_money = function ($amount) use ($session_company_currency) {
-
-
-
- No network has = escapeHtml($q_ip) ?> in it= $show || $type_filter ? ' in this view' : '' ?>.
-
- No networks match.
-
- No networks yet - start with the office LAN, the guest wireless and the internet connection.
-
-
= $q !== '' || $show || $manager_filter !== '' || $client_filter !== '' || $date_filter_active ? 'No projects match.' : 'No projects yet - onboarding a new client or a server refresh is a good first one.' ?>
-
-
-
+ 'projects',
+ 'icon' => 'fa-project-diagram',
+ 'filtered' => $q !== '' || $manager_filter !== '' || $client_filter !== '' || $date_filter_active,
+ 'archived' => $show === 'archived',
+ 'views' => ['show'],
+ 'view' => emptyStatePill($shows, $show),
+ 'text' => 'Onboarding a new client or a server refresh is a good first one.',
+ 'actions' => $can_edit ? [['label' => 'New Project', 'modal' => "modals/project/project_add.php?$client_url", 'size' => 'lg']] : [],
+ ];
+ require_once "../includes/filter_footer.php";
+ ?>
diff --git a/agent/quotes.php b/agent/quotes.php
index cd435894e..de014d6a0 100644
--- a/agent/quotes.php
+++ b/agent/quotes.php
@@ -309,13 +309,18 @@ $stat_monthly = function ($amount) use ($stat_money) {
-
-
= $q !== '' || $show || $importance_filter || $category_filter !== '' || $client_filter ? 'No services match.' : 'No services yet - start with what the client cannot work without: email, backup, their line of business app.' ?>
No open links= $client_url ? ' for this client' : '' ?>.
-
Share a credential, document or file from its menu= $client_url && ($can_note || $can_request) ? ', or send a secure note or ask for a login from the button above' : '' ?>.
-
-
-
-
+ 'shared links',
+ 'icon' => 'fa-share-alt',
+ 'filtered' => $q || $type_query,
+ 'views' => ['show'],
+ 'view' => emptyStatePill($shows, $show),
+ 'title' => 'No open links' . ($client_url ? ' for this client' : ''),
+ 'text' => 'Share a credential, document or file from its menu' . ($can_note || $can_request ? ', or send a secure note or ask for a login here' : '') . '.',
+ 'actions' => array_merge(
+ $can_note ? [['label' => 'Secure Note', 'modal' => 'modals/share/share_add.php?type=Note&client_id=' . intval($client_id), 'icon' => 'fa-user-secret']] : [],
+ $can_request ? [['label' => 'Ask the client for a login', 'modal' => 'modals/share/share_add.php?type=Request&client_id=' . intval($client_id), 'icon' => 'fa-inbox']] : []
+ ),
+ ];
+ require_once "../includes/filter_footer.php";
+ ?>
diff --git a/agent/software.php b/agent/software.php
index eba1bcce1..74728c267 100644
--- a/agent/software.php
+++ b/agent/software.php
@@ -515,13 +515,17 @@ while ($license_type_row = mysqli_fetch_row($sql_license_types)) {
-
-
-
-
+ 'licenses',
+ 'icon' => 'fa-cube',
+ 'views' => ['status'],
+ 'view' => emptyStatePill($status_filters, $status, '', ['renewing', 'expired', 'over', 'unused']),
+ 'text' => 'Their software and subscriptions - the seats bought, who and what uses them, and when each renews.',
+ 'actions' => $can_edit ? [['label' => 'New License', 'modal' => "modals/software/software_add.php?$client_url", 'size' => 'lg']] : [],
+ ];
+ require_once "../includes/filter_footer.php";
+ ?>
diff --git a/agent/ticket_list.php b/agent/ticket_list.php
index f0ad2a830..b30cf0232 100644
--- a/agent/ticket_list.php
+++ b/agent/ticket_list.php
@@ -299,22 +299,15 @@ $sort_link = function ($column, $label, $class = '') use ($url_query_strings_sor
-
-
-
-
-
- No tickets match.
-
- Nothing waiting on a reply from us.
-
- Nothing overdue.
-
- No open tickets= $show === 'mine' ? ' for you' : '' ?>.
-
- No tickets here.
-
-
-
-
-
+ 'tickets',
+ 'icon' => 'fa-life-ring',
+ 'filtered' => $q !== '' || $active_filters || $assigned_filter !== '' || $client_filter,
+ 'views' => ['show', 'view'],
+ 'view' => $show === 'open' ? ['title' => 'No open tickets', 'text' => 'Nothing is waiting to be worked on.', 'icon' => 'fa-check'] : emptyStatePill($shows, $show),
+ 'text' => 'Tickets come in by email and from the client portal, or add one here.',
+ 'actions' => $can_edit ? [['label' => 'New Ticket', 'modal' => "modals/ticket/ticket_add.php?$client_url", 'size' => 'lg']] : [],
+];
+require_once "../includes/filter_footer.php";
+?>
diff --git a/agent/transactions.php b/agent/transactions.php
index b0bf00f21..1d80d44e9 100644
--- a/agent/transactions.php
+++ b/agent/transactions.php
@@ -432,13 +432,19 @@ if ($transfer_cards) {
-
-
Log the drive out to a client from their ticket - Log a trip, in its menu - or with New Trip here.
-
-
-
-
+ 'trips',
+ 'icon' => 'fa-route',
+ 'filtered' => $q || $driver_filter || ($client_filter && !$client_page) || $location_filter || $ticket_filter || $expense_filter || $invoice_filter || $dtf !== '1970-01-01',
+ 'views' => ['show'],
+ 'view' => emptyStatePill($shows, $show, '', ['to_pay', 'to_bill']),
+ 'text' => 'Log the drive out to a client from their ticket - Log a trip, in its menu - or with New Trip here.',
+ 'actions' => [['label' => 'New Trip', 'modal' => $add_url, 'size' => 'lg']],
+ ];
+ require_once "../includes/filter_footer.php";
+ ?>
diff --git a/agent/vendors.php b/agent/vendors.php
index 2e321c976..8e0bceb04 100644
--- a/agent/vendors.php
+++ b/agent/vendors.php
@@ -444,13 +444,18 @@ $add_url = "modals/vendor/vendor_add.php?" . ($view === 'client' ? "client_id=$c
-
-
-
-
= $q || $tag_query ? 'No vendors match.' : ($view === 'ours' ? 'None of our own vendors yet - the suppliers expenses are booked against.' : 'No vendors yet - their ISP, phone provider and software makers.') ?>
-
-
-
+ 'vendors',
+ 'icon' => 'fa-building',
+ 'filtered' => $q || $tag_query,
+ 'views' => ['view'],
+ 'title' => $view === 'ours' ? 'None of our own vendors yet' : 'No vendors yet',
+ 'text' => $view === 'ours' ? 'The suppliers expenses are booked against.' : 'Their ISP, phone provider and software makers.',
+ 'actions' => $can_edit ? [['label' => 'New Vendor', 'modal' => $add_url, 'size' => 'lg']] : [],
+ ];
+ require_once "../includes/filter_footer.php";
+ ?>
diff --git a/css/itflow_custom.css b/css/itflow_custom.css
index 632be2372..b8816d27a 100644
--- a/css/itflow_custom.css
+++ b/css/itflow_custom.css
@@ -3738,6 +3738,43 @@ tr:hover .itflow-copy,
text-align: center;
color: var(--bs-secondary-color);
}
+/* Empty state - a list with nothing in it, or nothing its filters let
+ through (emptyStateHtml()): the list's icon in a round tile, a title, a
+ line on what goes there and its buttons */
+.itflow-empty-state {
+ padding: 3rem 1rem;
+ text-align: center;
+}
+.itflow-empty-state-icon {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ width: 4rem;
+ height: 4rem;
+ margin-bottom: 1rem;
+ border-radius: 50%;
+ font-size: 1.5rem;
+ background: var(--bs-secondary-bg);
+ color: var(--bs-secondary-color);
+}
+.itflow-empty-state-title {
+ font-size: 1.05rem;
+ font-weight: 600;
+ color: var(--bs-emphasis-color);
+}
+.itflow-empty-state-text {
+ max-width: 34rem;
+ margin: .25rem auto 0;
+ font-size: .875rem;
+ color: var(--bs-secondary-color);
+}
+.itflow-empty-state-actions {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: center;
+ gap: .5rem;
+ margin-top: 1.25rem;
+}
.itflow-asset-dl .font-monospace {
font-size: .82rem;
}
diff --git a/functions/format.php b/functions/format.php
index ba441955c..5f42e86e0 100644
--- a/functions/format.php
+++ b/functions/format.php
@@ -556,3 +556,130 @@ function secondsToTime($inputSeconds) {
return implode(', ', $timeParts);
}
+
+/*
+ * The empty state of a list - one look on every list page. A page sets
+ * $empty_state and includes/inc_empty_state.php (from filter_footer.php)
+ * draws it when the list has nothing; a page with a layout of its own calls
+ * emptyStateHtml() where it wants it. Three kinds:
+ *
+ * - nothing there yet: the list's icon, "No vendors yet", a line on what
+ * goes there, and the page's own New buttons
+ * - a search or filters left nothing: "No vendors match" and Clear filters
+ * - a view that is empty for a good reason (nothing overdue, all caught
+ * up): its own title, with a tick
+ *
+ * Archived, with nothing in it, says so and offers nothing to add.
+ */
+
+/**
+ * Whether a search or filter is on the request: any GET value but paging,
+ * sorting, the client, Archived and the page's views ($views - the GET keys
+ * that pick a view, such as a pill, rather than filter it).
+ */
+function emptyStateFiltered(array $views = []) {
+ $ignored = array_merge(['page', 'sort', 'order', 'canned_date', 'show_column', 'client_id', 'archived'], $views);
+ foreach ($_GET as $key => $value) {
+ if (in_array($key, $ignored, true)) {
+ continue;
+ }
+ if (is_array($value) ? count(array_filter($value, function ($v) { return is_scalar($v) && trim((string) $v) !== ''; })) : trim((string) $value) !== '') {
+ return true;
+ }
+ }
+ return false;
+}
+
+/** This page with its search and filters gone - the client, Archived and the page's views ($views) kept. */
+function emptyStateClearUrl(array $views = []) {
+ $keep = [];
+ foreach (array_merge(['client_id', 'archived'], $views) as $key) {
+ if (isset($_GET[$key]) && is_scalar($_GET[$key]) && trim((string) $_GET[$key]) !== '') {
+ $keep[$key] = (string) $_GET[$key];
+ }
+ }
+ return strtok($_SERVER['REQUEST_URI'] ?? '', '?') . ($keep ? '?' . http_build_query($keep) : '');
+}
+
+/**
+ * The empty state of the pill picked ($key, from a page's $pills - label,
+ * icon, title, alarm): "Nothing in Overdue" with the pill's own line under
+ * it - with a tick for a pill that flags trouble (alarm, or one of $good),
+ * as nothing there is good news. Null for the page's usual pill
+ * ($default), All and Archived, which have their own.
+ */
+function emptyStatePill(array $pills, $key, $default = '', array $good = []) {
+ $key = (string) $key;
+ if ($key === (string) $default || $key === 'all' || $key === 'archived' || !isset($pills[$key])) {
+ return null;
+ }
+ $pill = $pills[$key];
+ $view = ['title' => 'Nothing in ' . escapeHtml($pill['label'] ?? $key), 'text' => escapeHtml($pill['title'] ?? '')];
+ if (!empty($pill['alarm']) || in_array($key, array_map('strval', $good), true)) {
+ return $view + ['icon' => 'fa-check'];
+ }
+ return $view + ['icon' => $pill['icon'] ?? 'fa-filter'];
+}
+
+/**
+ * A list's empty state. $o:
+ * thing - what the list holds, plural ('vendors')
+ * icon - the list's icon ('fa-building', or full classes 'fab fa-...')
+ * title - HTML; "No {thing} yet" when left out
+ * text - HTML; a line on what goes there
+ * actions - when nothing is there and nothing filters it: buttons, the first
+ * the main one - each [label, modal (an ajax-modal URL) or href,
+ * size (the modal's), icon]
+ * archived - the Archived view: "No archived {thing}", nothing to add
+ * view - the pill picked, when it has a title of its own
+ * (emptyStatePill()): title, text, icon and actions over the
+ * ones above - a tick for good news
+ * filtered - a search or filters left nothing; emptyStateFiltered($views)
+ * when left out
+ * views - GET keys that pick a view rather than filter - not counted as
+ * filters, and kept by Clear filters
+ * match_title, match_text - HTML, for when filters left nothing
+ * clear_url - where Clear filters goes, for a page that builds its own
+ */
+function emptyStateHtml(array $o) {
+ $thing = (string) ($o['thing'] ?? 'records');
+ $views = (array) ($o['views'] ?? []);
+ $filtered = array_key_exists('filtered', $o) ? (bool) $o['filtered'] : emptyStateFiltered($views);
+ $buttons = '';
+ if (!$filtered && empty($o['archived']) && !empty($o['view'])) {
+ $o = (array) $o['view'] + ['text' => ''] + $o;
+ }
+
+ if ($filtered) {
+ $icon = 'fas fa-filter';
+ $title = $o['match_title'] ?? 'No ' . escapeHtml($thing) . ' match';
+ $text = $o['match_text'] ?? 'Try a different search, or clear the filters to see everything.';
+ $buttons = 'Clear filters';
+ } elseif (!empty($o['archived'])) {
+ $icon = 'fas fa-archive';
+ $title = $o['archived_title'] ?? 'No archived ' . escapeHtml($thing);
+ $text = '';
+ } else {
+ $icon = (string) ($o['icon'] ?? 'fa-inbox');
+ $icon = strpos($icon, ' ') === false ? "fas $icon" : $icon;
+ $title = $o['title'] ?? 'No ' . escapeHtml($thing) . ' yet';
+ $text = (string) ($o['text'] ?? '');
+ foreach (array_values((array) ($o['actions'] ?? [])) as $i => $action) {
+ $class = 'btn ' . ($i ? 'btn-outline-primary' : 'btn-primary');
+ $inner = '' . escapeHtml($action['label']);
+ if (isset($action['modal'])) {
+ $buttons .= '';
+ } else {
+ $buttons .= '' . $inner . '';
+ }
+ }
+ }
+
+ return '
'
+ . '
'
+ . '
' . $title . '
'
+ . ($text !== '' ? '
' . $text . '
' : '')
+ . ($buttons !== '' ? '
' . $buttons . '
' : '')
+ . '
';
+}
diff --git a/includes/inc_empty_state.php b/includes/inc_empty_state.php
index ee8190993..55e62cf4f 100644
--- a/includes/inc_empty_state.php
+++ b/includes/inc_empty_state.php
@@ -2,76 +2,24 @@
/*
* Empty state for listing pages.
*
- * Required from filter_footer.php, which every listing page already includes
- * and which already receives $num_rows - so this reaches all 48 of them
- * without touching each one.
+ * Required from filter_footer.php, which every listing page includes and
+ * which already has $num_rows. When the list has nothing, this draws the one
+ * empty state every list shares (emptyStateHtml() in functions/format.php):
+ * "No vendors yet" with the page's New buttons, or "No vendors match" with
+ * Clear filters when a search or filters left nothing.
*
- * The tables already hide their when $num_rows[0] is 0, so an empty
- * result was rendering as a card with a filter bar and nothing under it. This
- * fills that gap and, more usefully, distinguishes the two reasons a list can
- * be empty:
+ * The page says what its list holds with $empty_state - its icon, the thing
+ * it lists, a line on what goes there, its New buttons and, where it knows
+ * better than the GET string, whether it is filtered. A page that lays out
+ * an empty state of its own (files, notifications, racks) calls
+ * emptyStateHtml() there and sets $empty_state_skip.
*
- * - nothing has been created yet -> say so plainly
- * - the filters exclude everything -> say THAT, and offer a way out
- *
- * The second is the one worth getting right: a filtered-to-nothing list looks
- * identical to an empty install, and the fix (clear the filters) is invisible.
- *
- * $page_title is set from the script name by includes/page_title.php, which
- * every listing page pulls in via inc_all / inc_all_client / inc_all_admin,
- * so the label is already correct per page ("Clients", "Recurring Invoices")
- * with nothing to maintain.
+ * $page_title is set from the script name by includes/page_title.php, so a
+ * page that sets nothing still reads "No clients yet".
*/
-// A page that draws its own empty state sets $empty_state_skip
if (!isset($num_rows) || intval($num_rows[0]) > 0 || !empty($empty_state_skip)) {
return;
}
-/*
- * Which GET keys are page furniture rather than a filter the user chose.
- * canned_date is here because filter_header.php WRITES it on every request
- * when absent, so its presence says nothing; the dates it resolves to are
- * what count, and those arrive as dtf/dtt.
- *
- * client_id is scope, not a filter - 33 of these pages run inside a client via
- * inc_all_client.php. Counting it would tell someone their empty client has
- * "no invoices matching the current filters" and offer a Clear filters link
- * that quietly drops them out of the client entirely.
- */
-$empty_state_ignored_params = array('page', 'sort', 'order', 'canned_date', 'show_column', 'client_id');
-
-$empty_state_filtered = false;
-foreach ($_GET as $empty_state_key => $empty_state_value) {
- if (in_array($empty_state_key, $empty_state_ignored_params, true)) {
- continue;
- }
- if (is_array($empty_state_value) ? count($empty_state_value) : strlen(trim((string)$empty_state_value))) {
- $empty_state_filtered = true;
- break;
- }
-}
-
-$empty_state_thing = strtolower($page_title ?? 'records');
-
-?>
-
-
-
-
-
-
No = escapeHtml($empty_state_thing) ?> match the current filters.
-
Try widening the date range or clearing the search.