blob: 76b72ca1a1700586f8acfbbddb14190e1c50d498 [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001<?php
2require_once("core.php");
3security::checkType(security::WORKER);
4
5if (!security::checkParams("GET", [
6 ["id", security::PARAM_ISINT]
7])) {
8 security::go("workerhome.php?msg=empty");
9}
10
11$isAdmin = security::isAllowed(security::ADMIN);
12
13if (!$isAdmin && people::userData("id") != $_GET["id"]) {
14 security::notFound();
15}
16
17$workers = workers::getPersonWorkers((int)$_GET["id"]);
18if ($workers === false) security::go("workerhome.php?msg=unexpected");
19
20$companies = companies::getAll();
21
22$date = new DateTime();
23$interval = new DateInterval("P1D");
24$date->sub($interval);
25$yesterday = date("Y-m-d", $date->getTimestamp());
26?>
27<!DOCTYPE html>
28<html>
29<head>
30 <title><?php echo $conf["appName"]; ?></title>
31 <?php visual::includeHead(); ?>
32 <link rel="stylesheet" href="css/dashboard.css">
33</head>
34<?php visual::printBodyTag(); ?>
35 <div class="mdl-layout mdl-js-layout mdl-layout--fixed-header mdl-layout--fixed-drawer">
36 <?php visual::includeNav(); ?>
37 <main class="mdl-layout__content">
38 <div class="page-content">
39 <div class="main mdl-shadow--4dp">
40 <?php helpView::renderHelpButton(help::PLACE_EXPORT_REGISTRY_PAGE, true); ?>
41 <h2>Exportar registro</h2>
42 <?php
43 if (count($workers)) {
44 ?>
45 <form action="doexport.php" method="GET">
46 <?php
47 foreach ($workers as $w) {
48 echo '<input type="hidden" name="workers[]" value="'.(int)$w["id"].'">';
49 }
50 ?>
51
52 <h5>Periodo</h5>
53 <p>Del <input type="date" name="begins" max="<?=security::htmlsafe($yesterday)?>" required> al <input type="date" name="ends" max="<?=security::htmlsafe($yesterday)?>" required></p>
54
55 <h5>Formato</h5>
56 <div class="mdlext-selectfield mdlext-js-selectfield mdlext-selectfield--floating-label">
57 <select name="format" id="format" class="mdlext-selectfield__select">
58 <?php
59 foreach (export::$formats as $i => $format) {
60 if (!in_array($i, export::$workerFormats)) continue;
61 echo '<option value="'.(int)$i.'">'.security::htmlsafe($format).'</option>';
62 }
63 ?>
64 </select>
65 <label for="format" class="mdlext-selectfield__label">Formato</label>
66 </div>
67
68 <div id="pdf">
69 <h5>Opciones para PDF</h5>
70 <p>
71 <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="labelinvalid">
72 <input type="checkbox" id="labelinvalid" name="labelinvalid" value="1" class="mdl-switch__input" checked>
73 <span class="mdl-switch__label">Marcar en rojo incidencias/registros no validados</span>
74 </label>
75 </p>
76 <p style="font-weight: bold;">
77 Mostrar registros/incidencias que estén:
78 </p>
79 <p>
80 <label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="showvalidated">
81 <input type="checkbox" id="showvalidated" name="showvalidated" value="1" class="mdl-checkbox__input" checked>
82 <span class="mdl-checkbox__label">Validados</span>
83 </label>
84 <br>
85 <label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="shownotvalidated">
86 <input type="checkbox" id="shownotvalidated" name="shownotvalidated" value="1" class="mdl-checkbox__input" checked>
87 <span class="mdl-checkbox__label">No validados</span>
88 </label>
89 </p>
90 </div>
91 <br>
92 <button class="mdl-button mdl-js-button mdl-button--raised mdl-button--accent mdl-js-ripple-effect">Exportar</button>
93 </form>
94 <?php
95 } else {
96 echo "<p>No puedes exportar el registro porque todavía no se te ha asignado ninguna empresa.</p>";
97 }
98 ?>
99 </div>
100 </div>
101 </main>
102 </div>
103
104 <?php
105 visual::smartSnackbar([
106 ["empty", "Faltan datos por introducir en el formulario."],
107 ["unexpected", "Ha ocurrido un error inesperado. Inténtelo de nuevo en unos segundos."],
108 ["inverted", "La fecha de inicio debe ser anterior a la de fin."],
109 ["forecastingthefutureisimpossible", "La fecha de fin debe ser anterior al día de hoy."]
110 ]);
111 ?>
112
113 <script src="js/export.js"></script>
114</body>
115</html>