Copybara bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame^] | 1 | <?php |
| 2 | require_once("core.php"); |
| 3 | security::checkType(security::ADMIN); |
| 4 | |
| 5 | $mdHeaderRowBefore = visual::backBtn("powertools.php"); |
| 6 | |
| 7 | $gracePeriod = (int)($_GET["gracePeriod"] ?? validations::reminderGracePeriod()); |
| 8 | ?> |
| 9 | <!DOCTYPE html> |
| 10 | <html> |
| 11 | <head> |
| 12 | <title><?php echo $conf["appName"]; ?></title> |
| 13 | <?php visual::includeHead(); ?> |
| 14 | <link rel="stylesheet" href="css/dashboard.css"> |
| 15 | </head> |
| 16 | <?php visual::printBodyTag(); ?> |
| 17 | <div class="mdl-layout mdl-js-layout mdl-layout--fixed-header mdl-layout--fixed-drawer"> |
| 18 | <?php visual::includeNav(); ?> |
| 19 | <main class="mdl-layout__content"> |
| 20 | <div class="page-content"> |
| 21 | <div class="main mdl-shadow--4dp"> |
| 22 | <h2>Validaciones pendientes</h2> |
| 23 | <form action="pendingvalidations.php" method="GET"> |
| 24 | <p>Contar elementos que lleven más de <input type="text" name="gracePeriod" value="<?=(int)$gracePeriod?>" size="2"> días pendientes de validar. <button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent">Generar tabla</button></p> |
| 25 | </form> |
| 26 | <?php |
| 27 | $pending = validations::getPeopleWithPendingValidations($gracePeriod); |
| 28 | usort($pending, function($a, $b) { |
| 29 | $n =& $a["numPending"]; |
| 30 | $m =& $b["numPending"]; |
| 31 | return ($n > $m ? -1 : ($n < $m ? 1 : 0)); |
| 32 | }); |
| 33 | |
| 34 | if (count($pending)) { |
| 35 | ?> |
| 36 | <div class="overflow-wrapper overflow-wrapper--for-table"> |
| 37 | <table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp"> |
| 38 | <thead> |
| 39 | <tr> |
| 40 | <?php |
| 41 | if ($conf["debug"]) { |
| 42 | ?> |
| 43 | <th class="extra">ID</th> |
| 44 | <?php |
| 45 | } |
| 46 | ?> |
| 47 | <th class="mdl-data-table__cell--non-numeric">Nombre</th> |
| 48 | <th class="mdl-data-table__cell--non-numeric">Validaciones pendientes</th> |
| 49 | <th class="mdl-data-table__cell--non-numeric"></th> |
| 50 | </tr> |
| 51 | </thead> |
| 52 | <tbody> |
| 53 | <?php |
| 54 | foreach ($pending as $p) { |
| 55 | ?> |
| 56 | <tr> |
| 57 | <?php |
| 58 | if ($conf["debug"]) { |
| 59 | ?> |
| 60 | <td class="extra"><?=(int)$p["person"]["id"]?></td> |
| 61 | <?php |
| 62 | } |
| 63 | ?> |
| 64 | <td class="mdl-data-table__cell--non-numeric"><?=security::htmlsafe($p["person"]["name"])?></td> |
| 65 | <td class="mdl-data-table__cell--non-numeric"><?=(int)$p["numPending"]?></td> |
| 66 | <td class='mdl-data-table__cell--non-numeric'> |
| 67 | <a href='userincidents.php?id=<?=(int)$p["person"]["id"]?>' title='Ver y gestionar las incidencias del trabajador'><i class='material-icons icon'>assignment_late</i></a> |
| 68 | <a href='userregistry.php?id=<?=(int)$p["person"]["id"]?>' title='Ver y gestionar los registros del trabajador'><i class='material-icons icon'>list</i></a> |
| 69 | </td> |
| 70 | </tr> |
| 71 | <?php |
| 72 | } |
| 73 | ?> |
| 74 | </tbody> |
| 75 | </table> |
| 76 | </div> |
| 77 | <?php |
| 78 | } else { |
| 79 | ?> |
| 80 | <p>Todavía no existe ninguna persona.</p> |
| 81 | <?php |
| 82 | } |
| 83 | ?> |
| 84 | |
| 85 | <?php visual::printDebug("validations::getPeopleWithPendingValidations(".$gracePeriod.")", $pending); ?> |
| 86 | </div> |
| 87 | </div> |
| 88 | </main> |
| 89 | </div> |
| 90 | </body> |
| 91 | </html> |