'vendor templates', 'title' => 'That vendor template is gone', 'text' => 'It may have been deleted.', 'icon' => 'fa-building', 'filtered' => false, 'actions' => [['label' => 'Vendor Templates', 'href' => 'vendor_templates.php']]]); require_once "../includes/footer.php"; exit(); } $vendor_template_id = intval($template['vendor_template_id']); $name = escapeHtml($template['vendor_template_name']); // Tab title - used raw, the footer encodes it $page_title = $template['vendor_template_name']; $archived = !empty($template['vendor_template_archived_at']); $usage = vendorTemplateUsage([$vendor_template_id])[$vendor_template_id] ?? ['clients' => 0, 'vendors' => 0, 'ours' => 0, 'last' => null]; $csrf = $_SESSION['csrf_token']; // Its vendors - the current ones for current clients listed, the rest counted $all_vendors = vendorTemplateVendors($vendor_template_id); $current = array_filter($all_vendors, function ($vendor) { return !$vendor['archived'] && !$vendor['client_archived']; }); $set_up = count(array_filter($current, function ($vendor) { return $vendor['client_id'] && $vendor['account_number'] !== ''; })); $client_vendors = count(array_filter($current, function ($vendor) { return $vendor['client_id'] > 0; })); $out_of_step = count(array_filter($current, function ($vendor) { return (bool) $vendor['differences']; })); $others = count($all_vendors) - count($current); $license_templates = vendorTemplateLicenseTemplates($vendor_template_id); // ...seen all at once, the ones out of step, or the ones without the client's account number $views = [ '' => ['label' => 'All', 'icon' => 'fa-list', 'title' => 'Every current vendor made from it', 'test' => function ($vendor) { return true; }], 'out' => ['label' => 'Out of step', 'icon' => 'fa-not-equal', 'title' => 'Saying something other than the template does', 'test' => function ($vendor) { return (bool) $vendor['differences']; }], 'account' => ['label' => 'No account number', 'icon' => 'fa-fingerprint', 'title' => "Without the client's account number", 'test' => function ($vendor) { return $vendor['client_id'] && $vendor['account_number'] === ''; }], ]; $view = is_string($_GET['view'] ?? null) && isset($views[$_GET['view']]) ? $_GET['view'] : ''; $view_counts = []; foreach ($views as $key => $definition) { $view_counts[$key] = count(array_filter($current, $definition['test'])); } $vendors = array_filter($current, $views[$view]['test']); $view_url = function ($key) use ($vendor_template_id) { return '?' . http_build_query(array_filter(['vendor_template_id' => $vendor_template_id, 'view' => $key])) . '#vendorTemplateVendors'; }; // Vendors made by hand that look like it - not offered while it is archived $matches = $archived ? [] : vendorTemplateMatches($vendor_template_id); // Who should have one - not counted while it is archived $required = intval($template['vendor_template_required']); $required_tags = vendorTemplateRequiredTags([$vendor_template_id])[$vendor_template_id]; $scope_text = vendorTemplateScopeText($required, $required_tags); $coverage = $required && !$archived ? vendorTemplateCoverage($vendor_template_id, $required, array_keys($required_tags)) : null; $list_limit = 8; $missing_text = $coverage && $coverage['missing'] ? (count($coverage['missing']) === 1 ? 'the client missing it' : 'the ' . count($coverage['missing']) . ' clients missing it') : ''; $edit_url = "modals/vendor_template/vendor_template_edit.php?id=$vendor_template_id"; $clients_url = "/agent/modals/vendor/vendor_template_clients.php?template_id=$vendor_template_id"; $required_url = "modals/vendor_template/vendor_template_required.php?id=$vendor_template_id"; $update_url = "/agent/modals/vendor/vendor_template_update.php"; $in_line_url = "$update_url?template_id=$vendor_template_id"; // What a vendor from it starts with - the ones it has $t = $template; $link = function ($site) { $url = vendorWebsiteUrl($site); return $url !== '' ? '' . escapeHtml(vendorWebsiteLabel($site)) . '' : ''; }; // The account manager every client shares - their name, with their line and email under it $manager = array_filter([ escapeHtml(trim((string) $t['vendor_template_contact_name'])), trim((string) $t['vendor_template_contact_phone']) !== '' ? '' . contactPhoneLink($t['vendor_template_contact_phone'], $t['vendor_template_contact_phone_country_code']) : '', trim((string) $t['vendor_template_contact_email']) !== '' ? '' . escapeHtml($t['vendor_template_contact_email']) . '' : '', ]); $facts = array_filter([ 'What they are' => escapeHtml((string) $t['vendor_template_description']), 'Support line' => vendorTemplatePhoneHtml($t['vendor_template_phone'], $t['vendor_template_phone_country_code'], $t['vendor_template_extension']), 'Support hours' => escapeHtml((string) $t['vendor_template_hours']), 'SLA' => escapeHtml((string) $t['vendor_template_sla']), 'Support email' => trim((string) $t['vendor_template_email']) !== '' ? '' . escapeHtml($t['vendor_template_email']) . '' : '', 'Support site' => $link($t['vendor_template_website']), 'Status page' => $link($t['vendor_template_status_page']), 'Support portal' => $link($t['vendor_template_portal']), 'Account number' => escapeHtml(trim((string) $t['vendor_template_account_number'])), 'PIN' => vendorSecretHtml($t['vendor_template_code']), 'Account manager' => $manager ? '
' . implode('
', $manager) . '
' : '', ], function ($value) { return trim($value) !== ''; }); $icons = []; foreach (vendorTemplateFieldLabels() as $field) { $icons[$field['label']] = $field['icon']; } ?>

Archived - not offered for new vendors

What a vendor starts with

Name
$value) { ?>
Notes
None - what every client's vendor should say: the escalation path, what they ask for before they help, how to open a case online.
No way to reach their support yet - give it their support line, email, site or portal, so every client's vendor has it.

Clients with it

Saying something other than the template does - it may be the client's own, or the template changed since.
$vendor) { $client_id = $vendor['client_id']; $vendor_url = '/agent/vendor.php?' . ($client_id ? "client_id=$client_id&" : '') . "vendor_id=$vendor_id"; $differences = $vendor['differences']; $differs_text = count($differences) > 2 ? count($differences) . ' fields' : ucfirst(vendorTemplateLabelsText($differences)); ?>
ClientTheir vendorIn stepAccountAdded
Ours
In step No account number -
None of them - see them all.
No client has a vendor made from it yet. Agents add one from New Vendor on a client's Vendors.

Not linked yet

Vendors made by hand with its name or support site, at clients without one from it. Linked, they count as made from it and are kept in step with it - nothing on them changes unless you say so.
$match) { $match_client = $match['client_id']; $match_url = '/agent/vendor.php?' . ($match_client ? "client_id=$match_client&" : '') . "vendor_id=$match_id"; ?>
Ours' ?>
-
1 || array_filter(array_column($matches, 'differences'))) { ?>

Used

client a vendor from it - last added
No vendors made from it yet.

License templates

$license_template) { ?> Archived

Who should have it

No one in particular. Set it up to see which clients are missing it - every client, or the ones with a tag.
- not counted while it is archived.
of have it
Missing it
$client_name) { ?>
$list_limit) { ?>
and more
Every one of them has it.
.

Details

Made
' . escapeHtml($template['created_by_name']) . '
' : '' ?>
Last changed
' . escapeHtml($template['updated_by_name']) . '
' : '' ?>