Files
itflow/agent/modals/service/service_export.php
johnnyq ade9d5aac3 Services modernization: new services list with Needs attention, Review due, High importance, No review set, Starred and Archived views, dependency chips, in-place importance, bulk importance/category/review schedule, mark reviewed, star, archive/restore/delete and CSV/PDF export; new service page with service facts, backup and recovery, who to call (vendor and client contact details), auto-saving notes and tabs for the assets it runs on, logins, domains and certificates, documents, tickets and history; compact quick look; shared add/edit form with importance, category suggestions, a review schedule and dependency pickers on add; review modal with checklist and history note; attention flags for expiring or expired domains and certificates, certificate check problems, infrastructure out of warranty or out of action, and archived records still linked; Report a problem opens a prefilled ticket linked to the service, plus a service_tickets table, ticket page services list and link/unlink from both sides; services, domains and certificates added to the generic link system, legacy service link actions routed through it with same-client checks; services shown on the asset, contact and vendor pages, the asset/domain/certificate/credential quick looks, the document Linked card, the client overview (card, attention items, upcoming reviews), the dashboard, calendar, global search, client PDF pack and nightly review notifications; archived services left out of nav counts and lookups; services read endpoint in the API; demo data review schedules; database update 2.8.7 (archive and review columns, wider category and backup, link table dedupe with primary keys, service_domains foreign keys, service_tickets)
2026-10-15 17:32:09 -04:00

98 lines
3.9 KiB
PHP

<?php
/*
* Export services - pre-filled from the services list's view and filters.
* Everything here is editable; the export runs whatever this form posts.
*/
require_once '../../../includes/modal_header.php';
enforceUserPermission('module_support');
$client_id = intval($_GET['client_id'] ?? 0);
if ($client_id) {
enforceClientAccess();
}
$q_filter = $_GET['q'] ?? '';
$show_filter = (string) ($_GET['show'] ?? '');
$client_filter = (string) ($_GET['client'] ?? '');
$importance_filter = (string) ($_GET['importance'] ?? '');
$category_filter = (string) ($_GET['category'] ?? '');
$views = serviceViews();
ob_start();
?>
<div class="modal-header bg-dark">
<h5 class="modal-title"><i class="fas fa-fw fa-download me-2"></i>Export Services</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
</div>
<?php exportTabsNav(); ?>
<form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<input type="hidden" name="client_id" value="<?= $client_id ?>">
<div class="modal-body">
<?php exportTabsFiltersOpen(); ?>
<div class="mb-3">
<label class="form-label">Which</label>
<select class="form-select select2" name="show">
<?php foreach ($views as $key => $view) { ?>
<option value="<?= escapeHtml($key) ?>" <?= $show_filter === $key ? 'selected' : '' ?>><?= escapeHtml($view['label']) ?></option>
<?php } ?>
</select>
</div>
<div class="row g-3 mb-3">
<div class="col-md-6">
<label class="form-label">Importance</label>
<select class="form-select select2" name="importance">
<option value="">- Any importance -</option>
<?php foreach (SERVICE_IMPORTANCE as $importance) { ?>
<option value="<?= $importance ?>" <?= $importance_filter === $importance ? 'selected' : '' ?>><?= $importance ?></option>
<?php } ?>
</select>
</div>
<div class="col-md-6">
<label class="form-label">Category</label>
<input type="text" class="form-control" name="category" value="<?= escapeHtml($category_filter) ?>" placeholder="Any category">
</div>
</div>
<div class="mb-3">
<label class="form-label">Search</label>
<input type="text" class="form-control" name="q" value="<?= stripslashes(escapeHtml($q_filter)) ?>" placeholder="Name, description, category, client">
</div>
<?php if (!$client_id) { ?>
<div class="mb-3">
<label class="form-label">Client</label>
<select class="form-select select2" name="client">
<option value="">- All Clients -</option>
<?php
$sql = mysqli_query($mysqli, "SELECT client_id, client_name, client_abbreviation FROM clients
WHERE client_archived_at IS NULL AND EXISTS (SELECT 1 FROM services WHERE service_client_id = client_id) " . clientScopeSql('clients.client_id') . " ORDER BY client_name ASC");
while ($row = mysqli_fetch_assoc($sql)) { ?>
<option value="<?= intval($row['client_id']) ?>" <?= $client_filter === (string) intval($row['client_id']) ? 'selected' : '' ?><?= selectOptionClient($row['client_id'], $row['client_name'], $row['client_abbreviation'] ?? '') ?>><?= escapeHtml($row['client_name']) ?></option>
<?php } ?>
</select>
</div>
<?php } ?>
<?php exportTabsColumns('services'); ?>
</div>
<div class="modal-footer">
<?php renderExportButtons('export_services'); ?>
</div>
</form>
<?php
require_once '../../../includes/modal_footer.php';