mirror of
https://github.com/itflow-org/itflow
synced 2026-11-29 07:38:59 +00:00
Quick add: the plus beside Contact, Site, Location, Assigned to and Vendor in New Ticket, Edit Ticket and the asset form opens the usual New Contact, New Location or New Vendor window over the form, saved in the background and picked, in place of the pop-up
This commit is contained in:
@@ -98,7 +98,7 @@ function categoryKinds() {
|
||||
],
|
||||
'asset_status' => [
|
||||
'label' => 'Asset Status', 'one' => 'asset status', 'many' => 'asset statuses', 'icon' => 'fa-heartbeat',
|
||||
'about' => 'Where an asset stands - deployed, out for repair, retired. Its colour is the status badge\'s; without one the built-in statuses keep theirs.',
|
||||
'about' => 'Where an asset stands - deployed, out for repair, retired. Its color is the status badge\'s; without one the built-in statuses keep theirs.',
|
||||
'by' => 'name', 'ordered' => true, 'max' => 200, 'modules' => ['module_support'],
|
||||
'uses' => [
|
||||
$use('assets', 'asset_status', 'asset', 'assets', '/agent/assets.php?status={name}', 'asset_archived_at', 'asset_updated_at'),
|
||||
|
||||
@@ -50,7 +50,7 @@ function clientOverviewAttention($client_id, $access, $renewals) {
|
||||
];
|
||||
$items[] = [
|
||||
'count' => dashboardCount("SELECT COUNT(ticket_id) FROM tickets WHERE $open AND ticket_assigned_to = 0"),
|
||||
'label' => 'Unassigned tickets', 'icon' => 'user-slash', 'tone' => 'warning',
|
||||
'label' => 'Unassigned tickets', 'one' => 'Unassigned ticket', 'icon' => 'user-slash', 'tone' => 'warning',
|
||||
'url' => "/agent/tickets.php?client_id=$client_id&assigned=unassigned",
|
||||
];
|
||||
$items[] = [
|
||||
@@ -61,7 +61,7 @@ function clientOverviewAttention($client_id, $access, $renewals) {
|
||||
// The same rule as projects.php?show=overdue
|
||||
$items[] = [
|
||||
'count' => dashboardCount("SELECT COUNT(project_id) FROM projects WHERE project_client_id = $client_id AND " . projectViews()['overdue']['where']),
|
||||
'label' => 'Overdue projects', 'icon' => 'project-diagram', 'tone' => 'danger',
|
||||
'label' => 'Overdue projects', 'one' => 'Overdue project', 'icon' => 'project-diagram', 'tone' => 'danger',
|
||||
'url' => "/agent/projects.php?client_id=$client_id&show=overdue",
|
||||
];
|
||||
}
|
||||
@@ -73,7 +73,7 @@ function clientOverviewAttention($client_id, $access, $renewals) {
|
||||
- dashboardSum("SELECT SUM(payment_amount) FROM payments JOIN invoices ON payment_invoice_id = invoice_id WHERE $overdue_where");
|
||||
$items[] = [
|
||||
'count' => $overdue_count,
|
||||
'label' => 'Overdue invoices', 'icon' => 'file-invoice-dollar', 'tone' => 'danger',
|
||||
'label' => 'Overdue invoices', 'one' => 'Overdue invoice', 'icon' => 'file-invoice-dollar', 'tone' => 'danger',
|
||||
'detail' => $overdue_count ? dashboardMoney($overdue_amount) . ' outstanding' : null,
|
||||
'url' => "/agent/invoices.php?client_id=$client_id&status=Overdue",
|
||||
];
|
||||
@@ -82,13 +82,13 @@ function clientOverviewAttention($client_id, $access, $renewals) {
|
||||
$soon = contractViews()['soon']['where'];
|
||||
$items[] = [
|
||||
'count' => dashboardCount("SELECT COUNT(contract_id) FROM contracts WHERE contract_client_id = $client_id AND contract_archived_at IS NULL AND $soon AND contract_auto_renew = 0"),
|
||||
'label' => 'Contracts ending', 'icon' => 'file-contract', 'tone' => 'warning',
|
||||
'label' => 'Contracts ending', 'one' => 'Contract ending', 'icon' => 'file-contract', 'tone' => 'warning',
|
||||
'detail' => "They don't renew themselves",
|
||||
'url' => "/agent/contracts.php?client_id=$client_id&show=soon",
|
||||
];
|
||||
$items[] = [
|
||||
'count' => dashboardCount("SELECT COUNT(contract_id) FROM contracts WHERE contract_client_id = $client_id AND contract_archived_at IS NULL AND $soon AND contract_auto_renew = 1"),
|
||||
'label' => 'Contracts renewing', 'icon' => 'sync-alt', 'tone' => 'info',
|
||||
'label' => 'Contracts renewing', 'one' => 'Contract renewing', 'icon' => 'sync-alt', 'tone' => 'info',
|
||||
'detail' => 'Time to review them with the client',
|
||||
'url' => "/agent/contracts.php?client_id=$client_id&show=soon",
|
||||
];
|
||||
@@ -104,14 +104,14 @@ function clientOverviewAttention($client_id, $access, $renewals) {
|
||||
$to_bill = expenseUnbilledCount($client_id);
|
||||
$items[] = [
|
||||
'count' => $to_bill['count'],
|
||||
'label' => 'Expenses to bill', 'icon' => 'shopping-cart', 'tone' => 'info',
|
||||
'label' => 'Expenses to bill', 'one' => 'Expense to bill', 'icon' => 'shopping-cart', 'tone' => 'info',
|
||||
'detail' => $to_bill['count'] ? dashboardMoney($to_bill['value']) . ' to bill on' : null,
|
||||
'url' => "/agent/unbilled_time.php?client_id=$client_id",
|
||||
];
|
||||
$trips_to_bill = tripUnbilledCount($client_id);
|
||||
$items[] = [
|
||||
'count' => $trips_to_bill['count'],
|
||||
'label' => 'Trips to bill', 'icon' => 'route', 'tone' => 'info',
|
||||
'label' => 'Trips to bill', 'one' => 'Trip to bill', 'icon' => 'route', 'tone' => 'info',
|
||||
'detail' => $trips_to_bill['count'] ? dashboardMoney($trips_to_bill['value']) . ' of travel' : null,
|
||||
'url' => "/agent/unbilled_time.php?client_id=$client_id",
|
||||
];
|
||||
@@ -123,14 +123,14 @@ function clientOverviewAttention($client_id, $access, $renewals) {
|
||||
$items[] = [
|
||||
'count' => dashboardCount("SELECT COUNT(software_id) FROM software WHERE software_client_id = $client_id AND software_archived_at IS NULL
|
||||
AND " . softwareStatusFilters()['over']['sql']),
|
||||
'label' => 'Licenses over seats', 'icon' => 'cube', 'tone' => 'danger',
|
||||
'label' => 'Licenses over seats', 'one' => 'License over seats', 'icon' => 'cube', 'tone' => 'danger',
|
||||
'url' => "/agent/software.php?client_id=$client_id&status=over",
|
||||
];
|
||||
// What the last check of a host found wrong - the same rule as certificates.php?show=problems
|
||||
$items[] = [
|
||||
'count' => dashboardCount("SELECT COUNT(certificate_id) FROM certificates WHERE certificate_client_id = $client_id AND certificate_archived_at IS NULL
|
||||
AND " . certificateProblemSql()),
|
||||
'label' => 'Certificate problems', 'icon' => 'lock', 'tone' => 'warning',
|
||||
'label' => 'Certificate problems', 'one' => 'Certificate problem', 'icon' => 'lock', 'tone' => 'warning',
|
||||
'detail' => 'Name mismatch, untrusted, expired or unreachable',
|
||||
'url' => "/agent/certificates.php?client_id=$client_id&show=problems",
|
||||
];
|
||||
@@ -138,34 +138,34 @@ function clientOverviewAttention($client_id, $access, $renewals) {
|
||||
$service_views = serviceViews();
|
||||
$items[] = [
|
||||
'count' => dashboardCount("SELECT COUNT(service_id) FROM services WHERE service_client_id = $client_id AND " . $service_views['attention']['where']),
|
||||
'label' => 'Services needing attention', 'icon' => 'stream', 'tone' => 'danger',
|
||||
'label' => 'Services needing attention', 'one' => 'Service needing attention', 'icon' => 'stream', 'tone' => 'danger',
|
||||
'detail' => 'What they run on needs a look',
|
||||
'url' => "/agent/services.php?client_id=$client_id&show=attention",
|
||||
];
|
||||
$items[] = [
|
||||
'count' => dashboardCount("SELECT COUNT(service_id) FROM services WHERE service_client_id = $client_id AND " . $service_views['review']['where']),
|
||||
'label' => 'Service reviews due', 'icon' => 'clipboard-check', 'tone' => 'warning',
|
||||
'label' => 'Service reviews due', 'one' => 'Service review due', 'icon' => 'clipboard-check', 'tone' => 'warning',
|
||||
'detail' => 'Next ' . SERVICE_REVIEW_SOON_DAYS . ' days or overdue',
|
||||
'url' => "/agent/services.php?client_id=$client_id&show=review",
|
||||
];
|
||||
// Document templates it should have a document from - the strip across the top of its Files
|
||||
$items[] = [
|
||||
'count' => count(documentTemplatesMissingFor($client_id)),
|
||||
'label' => 'Documents missing', 'icon' => 'file-medical', 'tone' => 'warning',
|
||||
'label' => 'Documents missing', 'one' => 'Document missing', 'icon' => 'file-medical', 'tone' => 'warning',
|
||||
'detail' => 'Ones every client like it should have',
|
||||
'url' => "/agent/files.php?client_id=$client_id",
|
||||
];
|
||||
// The same rule as files.php?type=due
|
||||
$items[] = [
|
||||
'count' => count(documentsReviewDue("documents.document_client_id = $client_id")),
|
||||
'label' => 'Document reviews due', 'icon' => 'calendar-check', 'tone' => 'warning',
|
||||
'label' => 'Document reviews due', 'one' => 'Document review due', 'icon' => 'calendar-check', 'tone' => 'warning',
|
||||
'detail' => 'As their templates ask',
|
||||
'url' => "/agent/files.php?client_id=$client_id&type=due",
|
||||
];
|
||||
// License templates it should have a license from - the strip across the top of its Licenses
|
||||
$items[] = [
|
||||
'count' => count(softwareTemplatesMissingFor($client_id)),
|
||||
'label' => 'Licenses missing', 'icon' => 'cube', 'tone' => 'warning',
|
||||
'label' => 'Licenses missing', 'one' => 'License missing', 'icon' => 'cube', 'tone' => 'warning',
|
||||
'detail' => 'Ones every client like it should have',
|
||||
'url' => "/agent/software.php?client_id=$client_id",
|
||||
];
|
||||
@@ -176,7 +176,7 @@ function clientOverviewAttention($client_id, $access, $renewals) {
|
||||
$items[] = [
|
||||
'count' => dashboardCount("SELECT COUNT(credential_id) FROM credentials WHERE credential_client_id = $client_id AND credential_archived_at IS NULL
|
||||
AND (credential_password_changed_at IS NULL OR credential_password_changed_at < NOW() - INTERVAL " . CREDENTIAL_ROTATE_DAYS . " DAY)"),
|
||||
'label' => 'Passwords due for a change', 'icon' => 'history', 'tone' => 'warning',
|
||||
'label' => 'Passwords due for a change', 'one' => 'Password due for a change', 'icon' => 'history', 'tone' => 'warning',
|
||||
'detail' => 'Not changed in ' . CREDENTIAL_ROTATE_DAYS . ' days',
|
||||
'url' => "/agent/credentials.php?client_id=$client_id&show=due&sort=credential_password_changed_at&order=ASC",
|
||||
];
|
||||
@@ -186,7 +186,7 @@ function clientOverviewAttention($client_id, $access, $renewals) {
|
||||
// Vendor templates it should have a vendor from - the strip across the top of its Vendors
|
||||
$items[] = [
|
||||
'count' => count(vendorTemplatesMissingFor($client_id)),
|
||||
'label' => 'Vendors missing', 'icon' => 'building', 'tone' => 'warning',
|
||||
'label' => 'Vendors missing', 'one' => 'Vendor missing', 'icon' => 'building', 'tone' => 'warning',
|
||||
'detail' => 'Ones every client like it should have',
|
||||
'url' => "/agent/vendors.php?client_id=$client_id",
|
||||
];
|
||||
@@ -201,9 +201,15 @@ function clientOverviewAttention($client_id, $access, $renewals) {
|
||||
'detail' => 'Next ' . $renewals['days'] . ' days', 'url' => '#clientRenewals'];
|
||||
}
|
||||
|
||||
return array_values(array_filter($items, function ($item) {
|
||||
// "1 Draft invoice", not "1 Draft invoices"
|
||||
return array_values(array_map(function ($item) {
|
||||
if (intval($item['count']) === 1 && isset($item['one'])) {
|
||||
$item['label'] = $item['one'];
|
||||
}
|
||||
return $item;
|
||||
}, array_filter($items, function ($item) {
|
||||
return $item['count'] > 0;
|
||||
}));
|
||||
})));
|
||||
}
|
||||
|
||||
/** Open tickets, the ones most in need of attention first: past SLA, then priority, then waiting longest. */
|
||||
|
||||
@@ -189,8 +189,9 @@ function contactQuickRecord($contact_id) {
|
||||
}
|
||||
|
||||
/**
|
||||
* The + in a picker's input group that adds a contact, location or vendor there and then
|
||||
* (js/quick_add.js, agent/ajax.php quick_add_record) - '' for an agent who can't add them.
|
||||
* The + in a picker's input group that adds a contact, location or vendor there and then - it
|
||||
* opens the usual New Contact, New Location or New Vendor window over the form (js/quick_add.js),
|
||||
* and what is made there is picked in the picker - '' for an agent who can't add them.
|
||||
* $client_id when the window's client is fixed; otherwise the form's client_id is used. Styled
|
||||
* like the + beside a category picker (categoryAddButtonHtml()) - $class to match it where it differs.
|
||||
*/
|
||||
@@ -201,5 +202,5 @@ function quickAddButton($type, $client_id = 0, $class = 'btn btn-outline-seconda
|
||||
$titles = ['contact' => 'New contact', 'location' => 'New location', 'vendor' => 'New vendor'];
|
||||
return '<button type="button" class="' . escapeHtml($class) . '" data-quick-add="' . $type . '"'
|
||||
. (intval($client_id) ? ' data-quick-add-client="' . intval($client_id) . '"' : '')
|
||||
. ' data-csrf="' . escapeHtml($_SESSION['csrf_token'] ?? '') . '" title="' . $titles[$type] . '"><i class="fas fa-fw fa-plus"></i></button>';
|
||||
. ' title="' . $titles[$type] . '" aria-label="' . $titles[$type] . '"><i class="fas fa-fw fa-plus"></i></button>';
|
||||
}
|
||||
|
||||
@@ -250,13 +250,13 @@ function dashboardAttention($access) {
|
||||
];
|
||||
$items[] = [
|
||||
'count' => dashboardCount("SELECT COUNT(ticket_id) FROM tickets WHERE ticket_resolved_at IS NULL AND ticket_assigned_to = 0 $ticket_scope" . projectTicketsServiceSql()),
|
||||
'label' => 'Unassigned tickets', 'icon' => 'user-slash', 'tone' => 'warning',
|
||||
'label' => 'Unassigned tickets', 'one' => 'Unassigned ticket', 'icon' => 'user-slash', 'tone' => 'warning',
|
||||
'url' => '/agent/tickets.php?assigned=unassigned',
|
||||
];
|
||||
// The same rule as projects.php?show=overdue
|
||||
$items[] = [
|
||||
'count' => dashboardCount("SELECT COUNT(project_id) FROM projects WHERE " . projectViews()['overdue']['where'] . ' ' . clientScopeSql('project_client_id')),
|
||||
'label' => 'Overdue projects', 'icon' => 'project-diagram', 'tone' => 'danger',
|
||||
'label' => 'Overdue projects', 'one' => 'Overdue project', 'icon' => 'project-diagram', 'tone' => 'danger',
|
||||
'url' => '/agent/projects.php?show=overdue',
|
||||
];
|
||||
}
|
||||
@@ -269,13 +269,13 @@ function dashboardAttention($access) {
|
||||
- dashboardSum("SELECT SUM(payment_amount) FROM payments JOIN invoices ON payment_invoice_id = invoice_id WHERE $overdue_where");
|
||||
$items[] = [
|
||||
'count' => $overdue_count,
|
||||
'label' => 'Overdue invoices', 'icon' => 'file-invoice-dollar', 'tone' => 'danger',
|
||||
'label' => 'Overdue invoices', 'one' => 'Overdue invoice', 'icon' => 'file-invoice-dollar', 'tone' => 'danger',
|
||||
'detail' => $overdue_count ? dashboardMoney($overdue_amount) . ' outstanding' : null,
|
||||
'url' => '/agent/invoices.php?status=Overdue',
|
||||
];
|
||||
$items[] = [
|
||||
'count' => dashboardCount("SELECT COUNT(invoice_id) FROM invoices WHERE invoice_status = 'Draft' $invoice_scope"),
|
||||
'label' => 'Draft invoices', 'icon' => 'pen', 'tone' => 'secondary',
|
||||
'label' => 'Draft invoices', 'one' => 'Draft invoice', 'icon' => 'pen', 'tone' => 'secondary',
|
||||
'url' => '/agent/invoices.php?status=Draft',
|
||||
];
|
||||
// The same rule as products.php?type=reorder
|
||||
@@ -288,7 +288,7 @@ function dashboardAttention($access) {
|
||||
$reprice = productRepriceCount();
|
||||
$items[] = [
|
||||
'count' => intval($reprice['lines']),
|
||||
'label' => 'Lines at an old price', 'icon' => 'tags', 'tone' => 'warning',
|
||||
'label' => 'Lines at an old price', 'one' => 'Line at an old price', 'icon' => 'tags', 'tone' => 'warning',
|
||||
'detail' => $reprice['monthly'] > 0 ? '+' . dashboardMoney($reprice['monthly']) . ' a month on recurring' : ($reprice['lines'] ? 'On recurring invoices, drafts and quotes' : null),
|
||||
'url' => '/agent/products_reprice.php',
|
||||
];
|
||||
@@ -314,7 +314,7 @@ function dashboardAttention($access) {
|
||||
$to_bill = expenseUnbilledCount();
|
||||
$items[] = [
|
||||
'count' => $to_bill['count'],
|
||||
'label' => 'Expenses to bill', 'icon' => 'shopping-cart', 'tone' => 'info',
|
||||
'label' => 'Expenses to bill', 'one' => 'Expense to bill', 'icon' => 'shopping-cart', 'tone' => 'info',
|
||||
'detail' => $to_bill['count'] ? dashboardMoney($to_bill['value']) . ' to bill on' : null,
|
||||
'url' => '/agent/expenses.php?show=to_bill',
|
||||
];
|
||||
@@ -322,7 +322,7 @@ function dashboardAttention($access) {
|
||||
$owed = expenseToReimburseCount();
|
||||
$items[] = [
|
||||
'count' => $owed['count'],
|
||||
'label' => 'Expenses to reimburse', 'icon' => 'hand-holding-usd', 'tone' => 'warning',
|
||||
'label' => 'Expenses to reimburse', 'one' => 'Expense to reimburse', 'icon' => 'hand-holding-usd', 'tone' => 'warning',
|
||||
'detail' => $owed['count'] ? dashboardMoney($owed['total']) . ' owed to ' . ($owed['agents'] === 1 ? '1 agent' : $owed['agents'] . ' agents') : null,
|
||||
'url' => '/agent/expenses.php?show=to_reimburse',
|
||||
];
|
||||
@@ -330,7 +330,7 @@ function dashboardAttention($access) {
|
||||
$trips_to_bill = tripUnbilledCount();
|
||||
$items[] = [
|
||||
'count' => $trips_to_bill['count'],
|
||||
'label' => 'Trips to bill', 'icon' => 'route', 'tone' => 'info',
|
||||
'label' => 'Trips to bill', 'one' => 'Trip to bill', 'icon' => 'route', 'tone' => 'info',
|
||||
'detail' => $trips_to_bill['count'] ? dashboardMoney($trips_to_bill['value']) . ' of travel' : null,
|
||||
'url' => '/agent/unbilled_time.php',
|
||||
];
|
||||
@@ -350,22 +350,22 @@ function dashboardAttention($access) {
|
||||
$soon = "BETWEEN CURDATE() AND CURDATE() + INTERVAL 30 DAY";
|
||||
$items[] = [
|
||||
'count' => dashboardCount("SELECT COUNT(domain_id) FROM domains WHERE domain_archived_at IS NULL AND domain_expire $soon " . clientScopeSql('domain_client_id')),
|
||||
'label' => 'Domains expiring', 'icon' => 'globe', 'tone' => 'warning', 'detail' => 'Next 30 days',
|
||||
'label' => 'Domains expiring', 'one' => 'Domain expiring', 'icon' => 'globe', 'tone' => 'warning', 'detail' => 'Next 30 days',
|
||||
'url' => '/agent/domains.php?expire_days=30&sort=domain_expire&order=ASC',
|
||||
];
|
||||
$items[] = [
|
||||
'count' => dashboardCount("SELECT COUNT(certificate_id) FROM certificates WHERE certificate_archived_at IS NULL AND " . certificateSoonSql() . ' ' . clientScopeSql('certificate_client_id')),
|
||||
'label' => 'Certificates expiring', 'icon' => 'lock', 'tone' => 'warning', 'detail' => 'Next 30 days',
|
||||
'label' => 'Certificates expiring', 'one' => 'Certificate expiring', 'icon' => 'lock', 'tone' => 'warning', 'detail' => 'Next 30 days',
|
||||
'url' => '/agent/certificates.php?show=soon&sort=certificate_expire&order=ASC',
|
||||
];
|
||||
$items[] = [
|
||||
'count' => dashboardCount("SELECT COUNT(software_id) FROM software WHERE software_archived_at IS NULL AND software_expire $soon " . clientScopeSql('software_client_id')),
|
||||
'label' => 'Licenses expiring', 'icon' => 'cube', 'tone' => 'warning', 'detail' => 'Next 30 days',
|
||||
'label' => 'Licenses expiring', 'one' => 'License expiring', 'icon' => 'cube', 'tone' => 'warning', 'detail' => 'Next 30 days',
|
||||
'url' => '/agent/software.php?status=renewing&sort=software_expire&order=ASC',
|
||||
];
|
||||
$items[] = [
|
||||
'count' => dashboardCount("SELECT COUNT(asset_id) FROM assets WHERE asset_archived_at IS NULL AND asset_warranty_expire $soon " . clientScopeSql('asset_client_id')),
|
||||
'label' => 'Warranties expiring', 'icon' => 'shield-alt', 'tone' => 'warning', 'detail' => 'Next 30 days',
|
||||
'label' => 'Warranties expiring', 'one' => 'Warranty expiring', 'icon' => 'shield-alt', 'tone' => 'warning', 'detail' => 'Next 30 days',
|
||||
'url' => '/agent/assets.php?expire_days=30&sort=asset_warranty_expire&order=ASC&show_column[]=Warranty_Expire',
|
||||
];
|
||||
// The same rules as services.php?show=attention and ?show=review
|
||||
@@ -373,19 +373,25 @@ function dashboardAttention($access) {
|
||||
$service_scope = "FROM services JOIN clients ON client_id = service_client_id WHERE client_archived_at IS NULL " . clientScopeSql('service_client_id');
|
||||
$items[] = [
|
||||
'count' => dashboardCount("SELECT COUNT(service_id) $service_scope AND " . $service_views['attention']['where']),
|
||||
'label' => 'Services needing attention', 'icon' => 'stream', 'tone' => 'danger', 'detail' => 'What they depend on',
|
||||
'label' => 'Services needing attention', 'one' => 'Service needing attention', 'icon' => 'stream', 'tone' => 'danger', 'detail' => 'What they depend on',
|
||||
'url' => '/agent/services.php?show=attention',
|
||||
];
|
||||
$items[] = [
|
||||
'count' => dashboardCount("SELECT COUNT(service_id) $service_scope AND " . $service_views['review']['where']),
|
||||
'label' => 'Service reviews due', 'icon' => 'clipboard-check', 'tone' => 'warning', 'detail' => 'Next ' . SERVICE_REVIEW_SOON_DAYS . ' days',
|
||||
'label' => 'Service reviews due', 'one' => 'Service review due', 'icon' => 'clipboard-check', 'tone' => 'warning', 'detail' => 'Next ' . SERVICE_REVIEW_SOON_DAYS . ' days',
|
||||
'url' => '/agent/services.php?show=review&sort=service_review_due&order=ASC',
|
||||
];
|
||||
}
|
||||
|
||||
return array_values(array_filter($items, function ($item) {
|
||||
// "1 Draft invoice", not "1 Draft invoices"
|
||||
return array_values(array_map(function ($item) {
|
||||
if (intval($item['count']) === 1 && isset($item['one'])) {
|
||||
$item['label'] = $item['one'];
|
||||
}
|
||||
return $item;
|
||||
}, array_filter($items, function ($item) {
|
||||
return $item['count'] > 0;
|
||||
}));
|
||||
})));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -209,9 +209,11 @@ function formatAssignee($user_id, $user_name, $user_avatar, $highlight_unassigne
|
||||
$user_id = intval($user_id);
|
||||
|
||||
if (!$user_id) {
|
||||
$tone = $highlight_unassigned ? 'danger' : 'secondary';
|
||||
$colors = $highlight_unassigned ? 'text-danger-emphasis bg-danger-subtle' : 'text-body-secondary bg-body-secondary';
|
||||
return "<span class='$pill $colors'><span class='position-relative d-inline-flex' aria-hidden='true'><i class='fas fa-circle fs-5 text-$tone'></i><i class='fas fa-user-slash position-absolute top-50 start-50 translate-middle small text-white'></i></span>" . escapeHtml($none_label) . "</span>";
|
||||
// Amber, as the Unassigned view and the dashboard's tile are - red is kept for what is late
|
||||
$tone = $highlight_unassigned ? 'warning' : 'secondary';
|
||||
$colors = $highlight_unassigned ? 'text-warning-emphasis bg-warning-subtle' : 'text-body-secondary bg-body-secondary';
|
||||
$icon = $highlight_unassigned ? 'text-dark' : 'text-white';
|
||||
return "<span class='$pill $colors'><span class='position-relative d-inline-flex' aria-hidden='true'><i class='fas fa-circle fs-5 text-$tone'></i><i class='fas fa-user-slash position-absolute top-50 start-50 translate-middle small $icon'></i></span>" . escapeHtml($none_label) . "</span>";
|
||||
}
|
||||
|
||||
$user_avatar = escapeHtml($user_avatar);
|
||||
|
||||
@@ -119,6 +119,21 @@ function redirect($url = null, $permanent = false) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* A New Contact, New Location or New Vendor window opened by the + beside a picker in another
|
||||
* window (quickAddButton(), js/quick_add.js) posts inline=1: answer it with the new record for the
|
||||
* picker - ['ok' => true, 'value', 'label', 'message'] - or ['ok' => false, 'error'], in place of
|
||||
* a message and a reload. Does nothing for an ordinary post.
|
||||
*/
|
||||
function inlineSaveAnswer(array $answer): void {
|
||||
if (empty($_POST['inline'])) {
|
||||
return;
|
||||
}
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($answer);
|
||||
exit;
|
||||
}
|
||||
|
||||
//Flash Alert Function
|
||||
function flashAlert(string $message, string $type = 'success'): void {
|
||||
$_SESSION['alert_type'] = $type;
|
||||
|
||||
@@ -40,7 +40,7 @@ function settingsPages() {
|
||||
'localization' => ['group' => 'company', 'title' => 'Localization', 'icon' => 'fa-globe', 'url' => 'settings_localization.php',
|
||||
'about' => 'The language dates and numbers are written in, the currency you bill in, and your timezone.'],
|
||||
'theme' => ['group' => 'company', 'title' => 'Theme', 'icon' => 'fa-paint-brush', 'url' => 'settings_theme.php',
|
||||
'about' => 'The colour of the top bar, links, buttons and highlights, and the icon on the browser tab.'],
|
||||
'about' => 'The color of the top bar, links, buttons and highlights, and the icon on the browser tab.'],
|
||||
'default' => ['group' => 'work', 'title' => 'Defaults', 'icon' => 'fa-cogs', 'url' => 'settings_default.php',
|
||||
'about' => 'Where ITFlow opens, what a client is billed on without a contract, and what new payments, expenses and transfers start with.'],
|
||||
'ticket' => ['group' => 'work', 'title' => 'Tickets', 'icon' => 'fa-life-ring', 'url' => 'settings_ticket.php', 'module' => 'ticketing',
|
||||
@@ -239,7 +239,7 @@ function settingsFields() {
|
||||
'config_timezone' => ['page' => 'localization', 'section' => 'Timezone', 'label' => 'Timezone', 'words' => 'time zone clock utc'],
|
||||
|
||||
// Theme
|
||||
'config_theme' => ['page' => 'theme', 'section' => 'Colour', 'label' => 'Theme colour', 'kind' => 'select', 'options' => 'themes',
|
||||
'config_theme' => ['page' => 'theme', 'section' => 'Color', 'label' => 'Theme color', 'kind' => 'select', 'options' => 'themes',
|
||||
'words' => 'theme color colour accent top bar branding'],
|
||||
'favicon' => ['page' => 'theme', 'section' => 'Browser tab icon', 'label' => 'Browser tab icon', 'kind' => 'file', 'words' => 'favicon ico icon tab'],
|
||||
|
||||
|
||||
@@ -1757,12 +1757,17 @@ function ticketSlaState($row) {
|
||||
'due' => $responded ? ($row['ticket_resolution_due_at'] ?? null) : ($row['ticket_response_due_at'] ?? null),
|
||||
'what' => $responded ? 'Resolution due' : 'First response due',
|
||||
];
|
||||
if ($stage === 2) {
|
||||
// Missed already - as the SLA breached view and the dashboard count it
|
||||
if ($stage === 2 || ($row['ticket_response_sla_met'] ?? null) === '0' || ($row['ticket_resolution_sla_met'] ?? null) === '0') {
|
||||
return ['key' => 'breached'] + $state;
|
||||
}
|
||||
if (intval($row['ticket_status_pauses_sla'] ?? 0)) {
|
||||
return ['key' => 'paused'] + $state;
|
||||
}
|
||||
// Past its deadline is a breach whether or not cron has got round to marking it
|
||||
if (!empty($state['due']) && strtotime($state['due']) < time()) {
|
||||
return ['key' => 'breached'] + $state;
|
||||
}
|
||||
if ($stage === 1) {
|
||||
return ['key' => 'at_risk'] + $state;
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ function ticketBillableHtml($billable, $style = 'list') {
|
||||
}
|
||||
return $billable
|
||||
? '<span class="badge rounded-pill bg-success p-2"><i class="fas fa-fw fa-dollar-sign"></i></span>'
|
||||
: '<span class="badge rounded-pill bg-secondary p-2"><i class="fas fa-fw fa-minus"></i></span>';
|
||||
: '<span class="badge rounded-pill bg-body-secondary text-body-secondary p-2"><i class="fas fa-fw fa-minus"></i></span>';
|
||||
}
|
||||
|
||||
/* A status as its badge - text that reads on its colour, and what it is for on hover (functions/ticket_status.php). */
|
||||
|
||||
@@ -312,7 +312,7 @@ function ticketStatusUpdate(array $row, array $f) {
|
||||
'name' => (string) $row['ticket_status_name'], 'color' => ticketStatusColor($row['ticket_status_color']),
|
||||
'description' => trim((string) ($row['ticket_status_description'] ?? '')),
|
||||
];
|
||||
foreach (['name' => 'name', 'color' => 'colour', 'description' => 'description'] as $key => $label) {
|
||||
foreach (['name' => 'name', 'color' => 'color', 'description' => 'description'] as $key => $label) {
|
||||
if ($was[$key] !== $f[$key]) {
|
||||
$changes[] = "$label from " . ($was[$key] !== '' ? $was[$key] : 'none') . ' to ' . ($f[$key] !== '' ? $f[$key] : 'none');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user