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 - -
- -
-
- - + 'project templates', + 'icon' => 'fa-cubes', + 'filtered' => $q !== '', + 'archived' => $show_archived, + 'views' => ['show'], + 'text' => 'A client onboarding plan is a good first one: one ticket template per step, each with its checklist of tasks.', + 'actions' => [['label' => 'New Project Template', 'modal' => 'modals/project_template/project_template_add.php']], + ]; + require_once "../includes/filter_footer.php"; + ?> + 'roles', + 'icon' => 'fa-user-shield', + 'actions' => [['label' => 'New Role', 'modal' => 'modals/role/role_add.php', 'icon' => 'fa-user-plus']], + ]; + ?> diff --git a/admin/saved_payment_methods.php b/admin/saved_payment_methods.php index 5059a205a..7fa72a07b 100644 --- a/admin/saved_payment_methods.php +++ b/admin/saved_payment_methods.php @@ -147,6 +147,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); + 'saved payment methods', + 'icon' => 'fa-credit-card', + 'text' => 'The cards clients save when they pay online show here.', + ]; + ?> diff --git a/admin/software_templates.php b/admin/software_templates.php index ffcc0a52f..b1740e031 100644 --- a/admin/software_templates.php +++ b/admin/software_templates.php @@ -121,6 +121,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); + 'license templates', + 'icon' => 'fa-cube', + 'actions' => [['label' => 'New License Template', 'modal' => 'modals/software_template/software_template_add.php']], + ]; + ?> diff --git a/admin/tags.php b/admin/tags.php index 7b5826a98..899daeceb 100644 --- a/admin/tags.php +++ b/admin/tags.php @@ -158,6 +158,14 @@ while ($row = mysqli_fetch_assoc($sql_tag_type_counts)) { + strtolower($tag_type_display) . ' tags', + 'icon' => 'fa-tags', + 'views' => ['type'], + 'actions' => [['label' => "New $tag_type_display Tag", 'modal' => "modals/tag/tag_add.php?type=$type_filter"]], + ]; + ?> diff --git a/admin/tax_rates.php b/admin/tax_rates.php index 538d86498..6b0db86e4 100644 --- a/admin/tax_rates.php +++ b/admin/tax_rates.php @@ -99,6 +99,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); + 'tax rates', + 'icon' => 'fa-balance-scale', + 'actions' => [['label' => 'New Tax Rate', 'modal' => 'modals/tax/tax_add.php']], + ]; + ?> diff --git a/admin/ticket_statuses.php b/admin/ticket_statuses.php index 4f5827b81..6f34ac7f9 100644 --- a/admin/ticket_statuses.php +++ b/admin/ticket_statuses.php @@ -129,6 +129,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); + 'ticket statuses', + 'icon' => 'fa-info-circle', + 'actions' => [['label' => 'New Ticket Status', 'modal' => 'modals/ticket_status/ticket_status_add.php']], + ]; + ?> diff --git a/admin/ticket_templates.php b/admin/ticket_templates.php index a32574361..7830e7bcd 100644 --- a/admin/ticket_templates.php +++ b/admin/ticket_templates.php @@ -112,6 +112,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); + 'ticket templates', + 'icon' => 'fa-life-ring', + 'text' => 'The details and tasks to start a ticket with.', + 'actions' => [['label' => 'New Ticket Template', 'modal' => 'modals/ticket_template/ticket_template_add.php', 'size' => 'lg']], + ]; + ?> diff --git a/admin/users.php b/admin/users.php index 882314485..f2cf54c16 100644 --- a/admin/users.php +++ b/admin/users.php @@ -359,25 +359,17 @@ $csrf = $_SESSION['csrf_token']; - -
- -
- - No users match. - - Everyone active signs in with MFA. - - No archived users. - - Nobody is disabled. - - No users here. - -
-
- - + 'users', + 'icon' => 'fa-users', + 'filtered' => $q !== '' || $role_filter, + 'archived' => $show === 'archived', + 'views' => ['show'], + 'view' => $show === 'nomfa' ? ['title' => 'Everyone active signs in with MFA', 'icon' => 'fa-check'] : emptyStatePill($shows, $show), + ]; + require_once "../includes/filter_footer.php"; + ?> diff --git a/admin/vendor_templates.php b/admin/vendor_templates.php index 46a905c63..3fe93b8a8 100644 --- a/admin/vendor_templates.php +++ b/admin/vendor_templates.php @@ -179,6 +179,14 @@ while ($use_row = mysqli_fetch_row($sql_template_use)) { + 'vendor templates', + 'icon' => 'fa-building', + 'text' => 'A vendor set up once - its support numbers and site - to add to any client.', + 'actions' => [['label' => 'New Vendor Template', 'modal' => 'modals/vendor_template/vendor_template_add.php']], + ]; + ?> diff --git a/agent/assets.php b/agent/assets.php index 7704f3dc6..c0ed8b285 100644 --- a/agent/assets.php +++ b/agent/assets.php @@ -730,6 +730,18 @@ $search_noun = $type_filter ? $asset_type_tabs[$type_filter]['label'] : 'assets' + $type_filter ? strtolower($asset_type_tabs[$type_filter]['label']) : 'assets', + 'icon' => $type_filter ? $asset_type_tabs[$type_filter]['icon'] : 'fa-desktop', + 'views' => ['type'], + 'text' => $type_filter ? '' : 'Their computers, servers, network gear and phones - what each is, where it is and who uses it.', + 'actions' => $can_edit ? array_merge( + [['label' => 'New ' . ($type_filter ? rtrim($asset_type_tabs[$type_filter]['label'], 's') : 'Asset'), 'modal' => "modals/asset/asset_add.php?$client_url&type=$type_filter", 'size' => 'lg']], + $client_url ? [['label' => 'Import', 'modal' => "modals/asset/asset_import.php?$client_url", 'icon' => 'fa-upload']] : [] + ) : [], + ]; + ?> diff --git a/agent/certificates.php b/agent/certificates.php index 87863c071..c3354d112 100644 --- a/agent/certificates.php +++ b/agent/certificates.php @@ -444,13 +444,18 @@ $export_extra = [ - -
- -
-
- - + 'certificates', + 'icon' => 'fa-lock', + 'filtered' => $q || $issuer_query || $expire_query, + 'views' => ['show'], + 'view' => emptyStatePill($shows, $show, '', ['soon', 'expired', 'problems', 'unchecked']), + 'text' => 'The certificates on their websites and services, and when each expires.', + 'actions' => $can_edit ? [['label' => 'New Certificate', 'modal' => "modals/certificate/certificate_add.php?$client_url", 'size' => 'lg']] : [], + ]; + require_once "../includes/filter_footer.php"; + ?> diff --git a/agent/clients.php b/agent/clients.php index 24e1689f8..87789dc02 100644 --- a/agent/clients.php +++ b/agent/clients.php @@ -636,6 +636,18 @@ $total_leads = intval($row['leads']); + $leads_filter ? 'leads' : 'clients', + 'icon' => 'fa-user-friends', + 'views' => ['leads'], + 'text' => $leads_filter ? 'Prospects you are talking to, kept apart from your clients.' : 'Add the companies you look after, or import them all at once.', + 'actions' => $can_edit ? array_merge( + [['label' => $leads_filter ? 'New Lead' : 'New Client', 'modal' => 'modals/client/client_add.php' . ($leads_filter ? '?lead=1' : '')]], + $leads_filter ? [] : [['label' => 'Import', 'modal' => 'modals/client/client_import.php', 'icon' => 'fa-upload']] + ) : [], + ]; + ?> diff --git a/agent/contacts.php b/agent/contacts.php index 8e0fa5436..4f6635551 100644 --- a/agent/contacts.php +++ b/agent/contacts.php @@ -553,6 +553,19 @@ $search_noun = $role_filter ? strtolower($contact_role_tabs[$role_filter]['label + 'contacts', + 'icon' => 'fa-address-book', + 'views' => ['role'], + 'view' => emptyStatePill($contact_role_tabs, $role_filter), + 'text' => 'The people at the client - who to call, and who gets the invoices.', + 'actions' => $can_edit ? array_merge( + [['label' => 'New Contact', 'modal' => "modals/contact/contact_add.php?$client_url", 'size' => 'lg']], + $client_url ? [['label' => 'Import', 'modal' => "modals/contact/contact_import.php?$client_url", 'icon' => 'fa-upload']] : [] + ) : [], + ]; + ?> diff --git a/agent/credentials.php b/agent/credentials.php index 6c24805a7..ae0733581 100644 --- a/agent/credentials.php +++ b/agent/credentials.php @@ -467,13 +467,21 @@ $filter_url = function ($changes) use ($client_url) { - -
- -
-
- - + 'credentials', + 'icon' => 'fa-key', + 'filtered' => $q || $tag_query, + 'views' => ['show'], + 'view' => emptyStatePill($shows, $show, '', ['nootp', 'due']), + 'text' => 'The logins for their systems, encrypted in the vault.', + 'actions' => $can_edit ? array_merge( + [['label' => 'New Credential', 'modal' => "modals/credential/credential_add.php?$client_url", 'size' => 'lg']], + $client_url ? [['label' => 'Import', 'modal' => "modals/credential/credential_import.php?$client_url", 'icon' => 'fa-upload']] : [] + ) : [], + ]; + require_once "../includes/filter_footer.php"; + ?> diff --git a/agent/domains.php b/agent/domains.php index 962656db1..d7a0acd80 100644 --- a/agent/domains.php +++ b/agent/domains.php @@ -434,13 +434,18 @@ $bulk_vendor_options = $can_edit ? domainVendorChoices($client_url ? $client_id - -
- -
-
- - + 'domains', + 'icon' => 'fa-globe', + 'filtered' => $q || $tag_query || $vendor_query || $expire_query, + 'views' => ['show'], + 'view' => emptyStatePill($shows, $show, '', ['soon', 'expired', 'noauto', 'mail']), + 'text' => 'Their domain names, where each is registered and when it expires.', + 'actions' => $can_edit ? [['label' => 'New Domain', 'modal' => "modals/domain/domain_add.php?$client_url", 'size' => 'lg']] : [], + ]; + require_once "../includes/filter_footer.php"; + ?> diff --git a/agent/expenses.php b/agent/expenses.php index 239758708..d35aaa9ac 100644 --- a/agent/expenses.php +++ b/agent/expenses.php @@ -449,13 +449,21 @@ $month_change = $stats['last_to_date'] > 0 ? round(($stats['month'] - $stats['la - -
- -
-
- - + 'expenses', + 'icon' => 'fa-shopping-cart', + 'filtered' => $q || $vendor_filter || $category_filter || $account_filter || $client_filter || $method_filter !== '' || $recurring_filter || $paid_by_filter || $dtf !== '1970-01-01', + 'views' => ['show'], + 'view' => emptyStatePill($shows, $show, '', ['no_receipt', 'to_bill', 'to_reimburse']), + 'text' => 'What the business spends - enter them as they come, or bring in a bank or card statement.', + 'actions' => $can_edit ? [ + ['label' => 'New Expense', 'modal' => 'modals/expense/expense_add.php' . ($vendor_filter ? "?vendor_id=$vendor_filter" : ''), 'size' => 'lg'], + ['label' => 'Import Statement', 'href' => 'expense_import.php', 'icon' => 'fa-file-import'], + ] : [], + ]; + require_once "../includes/filter_footer.php"; + ?> diff --git a/agent/files.php b/agent/files.php index 167167ef4..b8102fe17 100644 --- a/agent/files.php +++ b/agent/files.php @@ -463,26 +463,25 @@ $preview = []; // the grid's previewer payload -
- - -
Nothing matches "".
- Clear search - - -
Nothing archived .
- - -
- -
Drop files here to upload them, or
-
- - -
- - -
+ 'files or documents', + 'icon' => 'fa-folder-open', + 'filtered' => $search !== '', + 'clear_url' => filesUrl(['q' => '']), + 'match_title' => $search !== '' ? 'Nothing matches "' . escapeHtml($search) . '"' . ($search_everywhere ? '' : ' in ' . $folder_name) : null, + 'archived' => $archived, + 'archived_title' => 'Nothing archived ' . ($folder_id ? 'in ' . $folder_name : 'here'), + 'title' => $folder_id ? $folder_name . ' is empty' : 'No files or documents yet', + 'text' => $can_edit ? 'Drop files here to upload them, or start a document.' : '', + 'view' => $type_filter && !$folder_id ? [ + 'title' => $type_filter === 'document' ? 'No documents yet' : 'No uploads yet', + 'text' => $can_edit ? ($type_filter === 'document' ? 'Write one here - a procedure, a how-to, notes on the site.' : 'Drop files here to upload them.') : '', + ] : null, + 'actions' => $can_edit ? [ + ['label' => 'Upload files', 'modal' => $upload_url, 'icon' => 'fa-cloud-upload-alt'], + ['label' => 'New document', 'modal' => "modals/document/document_add.php?client_id=$client_id&folder_id=$folder_id", 'size' => 'xl', 'icon' => 'fa-file-alt'], + ] : [], + ]) ?> diff --git a/agent/income.php b/agent/income.php index 5214a5ca7..dc48866d5 100644 --- a/agent/income.php +++ b/agent/income.php @@ -406,16 +406,22 @@ $invoices_url = 'invoices.php?' . ($client_page ? "client_id=$client_id&" : '') - -
- -
- -
A payment is added on its invoice. Money in that isn't for an invoice is New Income hereImport 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) { - -
- -
-
- - + 'invoices', + 'icon' => 'fa-file-invoice-dollar', + 'filtered' => $q || $category_filter || $recurring_filter || $hardware_filter || $dtf !== '1970-01-01', + 'views' => ['status'], + 'view' => emptyStatePill($statuses, $status, '', ['Unpaid', 'Overdue']), + 'text' => 'Bill a client by hand, or from an accepted quote or their unbilled time.', + 'actions' => $can_edit ? [['label' => 'New Invoice', 'modal' => "modals/invoice/invoice_add.php?$client_url"]] : [], + ]; + require_once "../includes/filter_footer.php"; + ?> diff --git a/agent/locations.php b/agent/locations.php index 64287d910..d61b49509 100644 --- a/agent/locations.php +++ b/agent/locations.php @@ -412,13 +412,19 @@ $locations_counts = locationCounts(array_keys($locations)); - -
- -
-
- - + 'locations', + 'icon' => 'fa-map-marker-alt', + 'filtered' => $q || $tag_query, + 'text' => 'Their offices and sites, with the address and phone of each.', + 'actions' => $can_edit ? array_merge( + [['label' => 'New Location', 'modal' => "modals/location/location_add.php?$client_url", 'size' => 'lg']], + $client_url ? [['label' => 'Import', 'modal' => "modals/location/location_import.php?$client_url", 'icon' => 'fa-upload']] : [] + ) : [], + ]; + require_once "../includes/filter_footer.php"; + ?> diff --git a/agent/networks.php b/agent/networks.php index 902136960..f468c6dfd 100644 --- a/agent/networks.php +++ b/agent/networks.php @@ -425,21 +425,23 @@ $csrf = $_SESSION['csrf_token']; - -
- -
- - No network has in it. - - No networks match. - - No networks yet - start with the office LAN, the guest wireless and the internet connection. - -
-
- - + 'networks', + 'icon' => 'fa-network-wired', + 'filtered' => $q !== '' || $type_filter || $client_filter || $location_filter, + 'archived' => $show === 'archived', + 'views' => ['show'], + 'view' => emptyStatePill($shows, $show), + 'match_title' => $q_ip !== false ? 'No network has ' . escapeHtml($q_ip) . ' in it' : null, + 'text' => 'Start with the office LAN, the guest wireless and the internet connection.', + 'actions' => $can_edit ? array_merge( + [['label' => 'New Network', 'modal' => "modals/network/network_add.php?{$client_url}location_id=$location_filter&type=$type_filter", 'size' => 'lg']], + $client_url ? [['label' => 'Import', 'modal' => "modals/network/network_import.php?$client_url", 'icon' => 'fa-upload']] : [] + ) : [], + ]; + require_once "../includes/filter_footer.php"; + ?> diff --git a/agent/notifications.php b/agent/notifications.php index aee4e6749..ca3013b84 100644 --- a/agent/notifications.php +++ b/agent/notifications.php @@ -127,23 +127,18 @@ $empty_state_skip = true; -
- - -
No notifications match the current filters
- - Clear filters - - - -
You're all caught up
-

Nothing new since you last looked.

- See all notifications - - -
No notifications yet
- -
+ 'notifications', + 'icon' => 'fa-bell-slash', + 'filtered' => $notifications_filtered, + 'clear_url' => 'notifications.php' . ($view === 'all' ? '?view=all' : ''), + 'view' => $view === 'unread' ? [ + 'title' => "You're all caught up", + 'text' => 'Nothing new since you last looked.', + 'icon' => 'fa-check', + 'actions' => [['label' => 'See all notifications', 'href' => 'notifications.php?view=all', 'icon' => 'fa-bell']], + ] : null, + ]) ?> diff --git a/agent/products.php b/agent/products.php index 71da7168f..32dbce873 100644 --- a/agent/products.php +++ b/agent/products.php @@ -474,6 +474,19 @@ $add_type = in_array($view, ['product', 'hardware', 'stocked', 'reorder'], true) + 'products and services', + 'icon' => 'fa-box-open', + 'views' => ['type'], + 'view' => emptyStatePill($views, $view, 'all', ['reorder']), + 'text' => 'What you sell - your services and the products you resell - with their prices, ready to add to an invoice.', + 'actions' => $can_edit ? [ + ['label' => 'New Service', 'modal' => 'modals/product/product_add.php?type=service', 'size' => 'lg', 'icon' => 'fa-wrench'], + ['label' => 'New Product', 'modal' => 'modals/product/product_add.php?type=product', 'size' => 'lg', 'icon' => 'fa-box-open'], + ] : [], + ]; + ?> diff --git a/agent/projects.php b/agent/projects.php index dd160727e..d9207600c 100644 --- a/agent/projects.php +++ b/agent/projects.php @@ -474,13 +474,19 @@ $hidden_filter_count = $date_filter_active ? 1 : 0; - -
- -
-
- - + '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) { - -
- -
-
- - + 'quotes', + 'icon' => 'fa-comment-dollar', + 'filtered' => $q || $dtf !== '1970-01-01', + 'views' => ['status'], + 'view' => emptyStatePill($statuses, $status, '', ['Expired']), + 'text' => 'Price up work for a client, and turn it into an invoice once they accept.', + 'actions' => $can_edit ? [['label' => 'New Quote', 'modal' => "modals/quote/quote_add.php?$client_url"]] : [], + ]; + require_once "../includes/filter_footer.php"; + ?> diff --git a/agent/racks.php b/agent/racks.php index fd7c1fb60..ed201b499 100644 --- a/agent/racks.php +++ b/agent/racks.php @@ -178,22 +178,14 @@ foreach ($racks as $rack_id => $row) { -
- - -
No racks match that
- -
No archived racks
- -
No racks yet
-
Document the comms closet: what's racked where, front and rear, and how much room and power is left.
- - - - -
+ 'racks', + 'icon' => 'fa-server', + 'filtered' => $q || $location_filter || $client_filter, + 'archived' => $archived, + 'text' => "Document the comms closet: what's racked where, front and rear, and how much room and power is left.", + 'actions' => $client_url && $can_edit ? [['label' => 'New Rack', 'modal' => "modals/rack/rack_add.php?client_id=$client_id", 'size' => 'lg']] : [], + ]) ?> diff --git a/agent/recurring_expenses.php b/agent/recurring_expenses.php index 4d84e2921..c728ac6fd 100644 --- a/agent/recurring_expenses.php +++ b/agent/recurring_expenses.php @@ -314,13 +314,18 @@ $any_filter = $q || $vendor_filter || $category_filter || $client_filter; - -
- -
-
- - + 'recurring expenses', + 'icon' => 'fa-redo-alt', + 'filtered' => $any_filter, + 'views' => ['status'], + 'view' => emptyStatePill($statuses, $status, 'active', ['late']), + 'text' => 'Rent, colocation, licensing and insurance - recorded for you each time they come round.', + 'actions' => $can_edit ? [['label' => 'New Recurring Expense', 'modal' => 'modals/recurring_expense/recurring_expense_add.php' . ($vendor_filter ? "?vendor_id=$vendor_filter" : ''), 'size' => 'lg']] : [], + ]; + require_once "../includes/filter_footer.php"; + ?> diff --git a/agent/recurring_invoices.php b/agent/recurring_invoices.php index 668566aa7..a1c622d06 100644 --- a/agent/recurring_invoices.php +++ b/agent/recurring_invoices.php @@ -294,13 +294,18 @@ $stat_money = function ($amount) use ($session_company_currency) { - -
- -
-
- - + 'recurring invoices', + 'icon' => 'fa-redo-alt', + 'filtered' => (bool) $q, + 'views' => ['status'], + 'view' => emptyStatePill($statuses, $status, 'active', ['late']), + 'text' => 'Monthly agreements and subscriptions - each bills itself when it comes round.', + 'actions' => $can_edit ? [['label' => 'New Recurring Invoice', 'modal' => "modals/recurring_invoice/recurring_invoice_add.php?$client_url"]] : [], + ]; + require_once "../includes/filter_footer.php"; + ?> - -
- -
-
- - + 'recurring tickets', + 'icon' => 'fa-redo-alt', + 'filtered' => $q !== '' || $category_filter || $agent_filter || $client || $billable_filter !== null, + 'views' => ['show'], + 'view' => emptyStatePill($shows, $show, '', ['missed', 'unassigned']), + 'text' => 'A monthly maintenance visit or a quarterly backup test is a good first one.', + 'actions' => $can_edit ? [['label' => 'New Recurring Ticket', 'modal' => "modals/recurring_ticket/recurring_ticket_add.php?$client_url", 'size' => 'lg']] : [], + ]; + require_once '../includes/filter_footer.php'; + ?> diff --git a/agent/services.php b/agent/services.php index e7812581f..f1593a529 100644 --- a/agent/services.php +++ b/agent/services.php @@ -408,13 +408,19 @@ $link_icons = ['asset' => ['fa-desktop', 'asset', 'assets'], 'credential' => ['f - -
- -
-
- - + 'services', + 'icon' => 'fa-stream', + 'filtered' => $q !== '' || $importance_filter || $category_filter !== '' || $client_filter, + 'archived' => $show === 'archived', + 'views' => ['show'], + 'view' => emptyStatePill($shows, $show, '', ['unreviewed']), + 'text' => 'Start with what the client cannot work without: email, backup, their line of business app.', + 'actions' => $can_edit ? [['label' => 'New Service', 'modal' => "modals/service/service_add.php?$client_url", 'size' => 'lg']] : [], + ]; + require_once "../includes/filter_footer.php"; + ?> diff --git a/agent/shares.php b/agent/shares.php index bff312715..b54d8402b 100644 --- a/agent/shares.php +++ b/agent/shares.php @@ -363,18 +363,22 @@ $filter_url = function ($changes) { - -
- - -
No shared links match.
- -
No open links.
-
Share a credential, document or file from its menu.
- -
- - + '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. - - 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) { - -
- -
-
- - + 'transactions', + 'icon' => $show === 'transfers' ? 'fa-exchange-alt' : 'fa-list-alt', + 'filtered' => $q || $category_filter || $client_filter || $more_filters || $reconciliation_filter || $dtf !== '1970-01-01', + 'views' => ['show', 'account'], + 'view' => emptyStatePill($shows, $show, '', ['uncleared']), + 'title' => $account ? 'Nothing on ' . escapeHtml($account['account_name']) . ' yet' : 'No transactions yet', + 'text' => 'Payments, other income, expenses and transfers show here as they are recorded.', + 'actions' => $can_edit ? [['label' => $is_card ? 'Pay the Card' : 'New Transfer', 'modal' => 'modals/transfer/transfer_add.php' . ($account ? ($is_card ? '?to=' : '?from=') . $account_filter : ''), 'size' => 'lg', 'icon' => $is_card ? 'fa-credit-card' : 'fa-exchange-alt']] : [], + ]; + require_once "../includes/filter_footer.php"; + ?> - -
- -
- -
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 - -
- -
-
- - + '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 match the current filters.
-

Try widening the date range or clearing the search.

- - - Clear filters - - - - - -

No yet.

-
Anything you add will show up here.
- - -
+echo emptyStateHtml(($empty_state ?? []) + ['thing' => strtolower($page_title ?? 'records'), 'archived' => !empty($archived)]);