<?php
$toolbarFilterSchema = is_array($toolbarFilterSchema ?? null) ? $toolbarFilterSchema : [];
$searchToolbarFilterSchema = is_array($searchToolbarFilterSchema ?? null) ? $searchToolbarFilterSchema : [];
$drawerToolbarFilterSchema = is_array($drawerToolbarFilterSchema ?? null) ? $drawerToolbarFilterSchema : [];
$toolbarFilterState = is_array($toolbarFilterState ?? null) ? $toolbarFilterState : [];
$clientFilterSchema = is_array($clientFilterSchema ?? null) ? $clientFilterSchema : [];
$searchConfig = is_array($searchConfig ?? null) ? $searchConfig : null;
$filterChipMeta = is_array($filterChipMeta ?? null) ? $filterChipMeta : [];
$canCreate = $canCreate ?? false;
$activeView = $activeView ?? 'active';
?>
<?php
$listTitle = t('Security checks');
ob_start();
?>
<?php if ($canCreate): ?>
  <a role="button" class="app-action-success" href="<?php e(requestPathWithReturnTarget('security/checks/create', \MintyPHP\Http\Request::pathWithQuery())); ?>">
    <i class="bi bi-plus"></i> <?php e(t('New security check')); ?>
  </a>
<?php endif; ?>
<?php
$listTitleActionsHtml = ob_get_clean();
require templatePath('partials/app-list-titlebar.phtml');
?>

<div class="app-tabs-nav" style="margin-bottom: 12px;">
  <a
    href="<?php e(lurl('security/checks') . '?view=active'); ?>"
    role="button"
    class="<?php e($activeView === 'active' ? 'primary small' : 'secondary outline small'); ?>"
  ><?php e(t('In progress')); ?></a>
  <a
    href="<?php e(lurl('security/checks') . '?view=done'); ?>"
    role="button"
    class="<?php e($activeView === 'done' ? 'primary small' : 'secondary outline small'); ?>"
  ><?php e(t('Done')); ?></a>
</div>

<?php
$filterUiNamespace = 'security-checks';
require templatePath('partials/app-list-filters.phtml');
?>
<div class="app-list-table">
  <div id="security-checks-grid"></div>
</div>

<script src="<?php e(assetVersion('vendor/gridjs/gridjs.umd.js')); ?>"></script>
<script type="application/json" id="page-config-security-checks"><?php gridJsonForJs([
    'dataUrl' => lurl('security/checks-data') . '?view=' . rawurlencode($activeView),
    'gridLang' => gridLang(),
    'gridSearch' => $searchConfig,
    'filterSchema' => $clientFilterSchema,
    'filterChipMeta' => $filterChipMeta,
    'editBaseUrl' => lurl('security/checks/edit/'),
    'activeView' => $activeView,
    'labels' => [
        'customer' => t('Customer'),
        'domain' => t('Domain'),
        'product' => t('Software product'),
        'status' => t('Status'),
        'owner' => t('Owner'),
        'createdAt' => t('Created'),
    ],
]); ?></script>
<script type="module" src="<?php e(assetVersion('modules/security/js/pages/security-checks-index.js')); ?>"></script>
