blob: c8ff443bad10041aa1eaa8b09ae2782e8ef15c7a [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::HYPERADMIN);
23
24$companies = companies::getAll();
25
26$mdHeaderRowBefore = visual::backBtn("powertools.php");
27?>
28<!DOCTYPE html>
29<html>
30<head>
31 <title><?php echo $conf["appName"]; ?></title>
32 <?php visual::includeHead(); ?>
33 <link rel="stylesheet" href="css/dashboard.css">
34</head>
35<?php visual::printBodyTag(); ?>
36 <div class="mdl-layout mdl-js-layout mdl-layout--fixed-header mdl-layout--fixed-drawer">
37 <?php visual::includeNav(); ?>
38 <main class="mdl-layout__content">
39 <div class="page-content">
40 <div class="main mdl-shadow--4dp">
41 <h2>Invalidar registros en masa</h2>
42 <p>Selecciona los trabajadores de los cuales quieres invalidar sus registros, y el periodo de tiempo aplicable:</p>
43 <form action="doinvalidatebulkrecords.php" method="POST">
44 <h5>Periodo de tiempo</h5>
45 <p>Del <input type="date" name="begins" required> al <input type="date" name="ends" required></p>
46
47 <h5>Personas</h5>
48
49 <div class="overflow-wrapper overflow-wrapper--for-table">
50 <table class="mdl-data-table mdl-js-data-table mdl-data-table--selectable mdl-shadow--2dp">
51 <thead>
52 <tr>
53 <?php
54 if ($conf["debug"]) {
55 ?>
56 <th class="extra">ID</th>
57 <?php
58 }
59 ?>
60 <th class="mdl-data-table__cell--non-numeric">Nombre</th>
61 <th class="mdl-data-table__cell--non-numeric">Empresa</th>
62 <th class="mdl-data-table__cell--non-numeric extra">Categoría</th>
63 </tr>
64 </thead>
65 <tbody>
66 <?php
67 $workers = people::getAll(false, true);
68 foreach ($workers as $w) {
69 ?>
70 <tr data-worker-id="<?=(int)$w["workerid"]?>">
71 <?php
72 if ($conf["debug"]) {
73 ?>
74 <td class="extra"><?=(int)$w["workerid"]?></td>
75 <?php
76 }
77 ?>
78 <td class="mdl-data-table__cell--non-numeric"><?=security::htmlsafe($w["name"])?></td>
79 <td class="mdl-data-table__cell--non-numeric"><?=security::htmlsafe($companies[$w["companyid"]])?></td>
80 <td class="mdl-data-table__cell--non-numeric extra"><?=security::htmlsafe($w["category"])?></td>
81 </tr>
82 <?php
83 }
84 ?>
85 </tbody>
86 </table>
87 </div>
88 <br>
89 <button class="mdl-button mdl-js-button mdl-button--raised mdl-button--accent mdl-js-ripple-effect">Invalidar</button>
90 </form>
91 </div>
92 </div>
93 </main>
94 </div>
95
96 <?php
97 visual::smartSnackbar([
98 ["empty", "Faltan datos por introducir en el formulario."],
99 ["unexpected", "Ha ocurrido un error inesperado. Inténtelo de nuevo en unos segundos."],
100 ["inverted", "La fecha de inicio debe ser igual o anterior a la de fin."],
101 ["success", "Se han invalidado todos los registros correspondientes correcamente."],
102 ["partialortotalfailure", "Varios (o todos) los registros no se han podido invalidar correctamente."]
103 ]);
104 ?>
105 <script src="js/invalidatebulkrecords.js"></script>
106</body>
107</html>