blob: de1c123e89eee2aa4e1a1e860af63f2b8bfa3b08 [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001<?php
2require_once("core.php");
3security::checkType(security::ADMIN);
4
5$companies = companies::getAll();
6$showInvalidated = (isset($_GET["showinvalidated"]) && $_GET["showinvalidated"] == 1);
7$numRows = registry::numRows($showInvalidated);
8$page = (isset($_GET["page"]) ? (int)$_GET["page"] - 1 : null);
9?>
10<!DOCTYPE html>
11<html>
12<head>
13 <title><?php echo $conf["appName"]; ?></title>
14 <?php visual::includeHead(); ?>
15 <link rel="stylesheet" href="css/dashboard.css">
16 <link rel="stylesheet" href="css/incidents.css">
17
18 <style>
19 @media (max-width: 655px) {
20 .extra {
21 display: none;
22 }
23 }
24 </style>
25</head>
26<?php visual::printBodyTag(); ?>
27 <div class="mdl-layout mdl-js-layout mdl-layout--fixed-header mdl-layout--fixed-drawer">
28 <?php visual::includeNav(); ?>
29 <main class="mdl-layout__content">
30 <div class="page-content">
31 <div class="main mdl-shadow--4dp">
32 <form action="registry.php" method="GET" id="show-invalidated-form" class="actions" style="padding-right: 32px;">
33 <input type="hidden" name="page" value="<?=(int)($_GET["page"] ?? 1)?>">
34 <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="showinvalidated">
35 <input type="checkbox" id="showinvalidated" name="showinvalidated" value="1" class="mdl-switch__input"<?=($showInvalidated ? " checked" : "")?>>
36 <span class="mdl-switch__label mdl-color-text--grey-700">Mostrar registros invalidados</span>
37 </label>
38 </form>
39
40 <h2>Registro</h2>
41
42 <p>Total: <?=(int)$numRows?> registros</p>
43
44 <?php
45 $registry = registry::getRecords(false, false, false, $showInvalidated, true, true, $page);
46 if (count($registry)) {
47 registryView::renderRegistry($registry, $companies);
48 } else {
49 echo "El registro está vacío.";
50 }
51 ?>
52
53 <?php
54 visual::renderPagination($numRows, "registry.php?".($showInvalidated ? "showinvalidated=1" : ""), incidents::PAGINATION_LIMIT, false, true);
55 visual::printDebug("registry::getRecords(false, false, false, ".($showInvalidated ? "true" : "false").", true, true, ".(int)$page.")", $registry);
56 ?>
57 </div>
58 </div>
59 </main>
60 </div>
61
62 <?php
63 visual::renderTooltips();
64
65 visual::smartSnackbar([
66 ["unexpected", "Ha ocurrido un error inesperado. Inténtelo de nuevo en unos segundos."],
67 ["invalidated", "Se ha invalidado el registro correctamente."]
68 ]);
69 ?>
70
71 <script src="js/incidentsgeneric.js"></script>
72 <script src="js/registry.js"></script>
73</body>
74</html>