blob: e71fd90db5f048ab9b9b265d0041e68cd16614f5 [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001<?php
Adrià Vilanova Martínez5af86512023-12-02 20:44:16 +01002/*
3 * hores
4 * Copyright (c) 2023 Adrià Vilanova Martínez
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
15 *
16 * You should have received a copy of the GNU Affero General Public
17 * License along with this program.
18 * If not, see http://www.gnu.org/licenses/.
19 */
20
Copybara botbe50d492023-11-30 00:16:42 +010021require_once("core.php");
22security::checkType(security::ADMIN);
23
24$companies = companies::getAll();
25$showInvalidated = (isset($_GET["showinvalidated"]) && $_GET["showinvalidated"] == 1);
26$numRows = registry::numRows($showInvalidated);
27$page = (isset($_GET["page"]) ? (int)$_GET["page"] - 1 : null);
28?>
29<!DOCTYPE html>
30<html>
31<head>
32 <title><?php echo $conf["appName"]; ?></title>
33 <?php visual::includeHead(); ?>
34 <link rel="stylesheet" href="css/dashboard.css">
35 <link rel="stylesheet" href="css/incidents.css">
36
37 <style>
38 @media (max-width: 655px) {
39 .extra {
40 display: none;
41 }
42 }
43 </style>
44</head>
45<?php visual::printBodyTag(); ?>
46 <div class="mdl-layout mdl-js-layout mdl-layout--fixed-header mdl-layout--fixed-drawer">
47 <?php visual::includeNav(); ?>
48 <main class="mdl-layout__content">
49 <div class="page-content">
50 <div class="main mdl-shadow--4dp">
51 <form action="registry.php" method="GET" id="show-invalidated-form" class="actions" style="padding-right: 32px;">
52 <input type="hidden" name="page" value="<?=(int)($_GET["page"] ?? 1)?>">
53 <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="showinvalidated">
54 <input type="checkbox" id="showinvalidated" name="showinvalidated" value="1" class="mdl-switch__input"<?=($showInvalidated ? " checked" : "")?>>
55 <span class="mdl-switch__label mdl-color-text--grey-700">Mostrar registros invalidados</span>
56 </label>
57 </form>
58
59 <h2>Registro</h2>
60
61 <p>Total: <?=(int)$numRows?> registros</p>
62
63 <?php
64 $registry = registry::getRecords(false, false, false, $showInvalidated, true, true, $page);
65 if (count($registry)) {
66 registryView::renderRegistry($registry, $companies);
67 } else {
68 echo "El registro está vacío.";
69 }
70 ?>
71
72 <?php
73 visual::renderPagination($numRows, "registry.php?".($showInvalidated ? "showinvalidated=1" : ""), incidents::PAGINATION_LIMIT, false, true);
74 visual::printDebug("registry::getRecords(false, false, false, ".($showInvalidated ? "true" : "false").", true, true, ".(int)$page.")", $registry);
75 ?>
76 </div>
77 </div>
78 </main>
79 </div>
80
81 <?php
82 visual::renderTooltips();
83
84 visual::smartSnackbar([
85 ["unexpected", "Ha ocurrido un error inesperado. Inténtelo de nuevo en unos segundos."],
86 ["invalidated", "Se ha invalidado el registro correctamente."]
87 ]);
88 ?>
89
90 <script src="js/incidentsgeneric.js"></script>
91 <script src="js/registry.js"></script>
92</body>
93</html>