Copybara bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame] | 1 | <?php |
Adrià Vilanova Martínez | 5af8651 | 2023-12-02 20:44:16 +0100 | [diff] [blame] | 2 | /* |
| 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 bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame] | 21 | require_once("core.php"); |
| 22 | security::checkType(security::ADMIN); |
| 23 | |
| 24 | $mdHeaderRowBefore = visual::backBtn("settings.php"); |
| 25 | ?> |
| 26 | <!DOCTYPE html> |
| 27 | <html> |
| 28 | <head> |
| 29 | <title><?php echo $conf["appName"]; ?></title> |
| 30 | <?php visual::includeHead(); ?> |
| 31 | <link rel="stylesheet" href="css/dashboard.css"> |
| 32 | |
| 33 | <style> |
| 34 | .addincident { |
| 35 | position: fixed; |
| 36 | bottom: 16px; |
| 37 | right: 16px; |
| 38 | z-index: 1000; |
| 39 | } |
| 40 | |
| 41 | @media (max-width: 655px) { |
| 42 | .extra { |
| 43 | display: none; |
| 44 | } |
| 45 | } |
| 46 | </style> |
| 47 | </head> |
| 48 | <?php visual::printBodyTag(); ?> |
| 49 | <div class="mdl-layout mdl-js-layout mdl-layout--fixed-header mdl-layout--fixed-drawer"> |
| 50 | <?php visual::includeNav(); ?> |
| 51 | <button class="addincident mdl-button md-js-button mdl-button--fab mdl-js-ripple-effect mdl-button--accent"><i class="material-icons">add</i><span class="mdl-ripple"></span></button> |
| 52 | <main class="mdl-layout__content"> |
| 53 | <div class="page-content"> |
| 54 | <div class="main mdl-shadow--4dp"> |
| 55 | <h2>Tipos de incidencias</h2> |
| 56 | <?php |
| 57 | $incidents = incidents::getTypes(); |
| 58 | if (count($incidents)) { |
| 59 | ?> |
| 60 | <div class="overflow-wrapper overflow-wrapper--for-table"> |
| 61 | <table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp"> |
| 62 | <thead> |
| 63 | <tr> |
| 64 | <?php |
| 65 | if ($conf["debug"]) { |
| 66 | ?> |
| 67 | <th class="extra">ID</th> |
| 68 | <?php |
| 69 | } |
| 70 | ?> |
| 71 | <th class="mdl-data-table__cell--non-numeric">Nombre</th> |
| 72 | <th class="mdl-data-table__cell--centered"><i id="tt_present" class="material-icons help">business</i></th> |
| 73 | <th class="mdl-data-table__cell--centered"><i id="tt_paid" class="material-icons help">euro_symbol</i></th> |
| 74 | <th class="mdl-data-table__cell--centered"><i id="tt_workerfill" class="material-icons help">face</i></th> |
| 75 | <th class="mdl-data-table__cell--centered"><i id="tt_notifies" class="material-icons help">email</i></th> |
| 76 | <th class="mdl-data-table__cell--centered"><i id="tt_autovalidates" class="material-icons help">verified_user</i></th> |
| 77 | <th class="mdl-data-table__cell--non-numeric"></th> |
| 78 | </tr> |
| 79 | </thead> |
| 80 | <tbody> |
| 81 | <?php |
| 82 | foreach ($incidents as $t) { |
| 83 | ?> |
| 84 | <tr<?=($t["hidden"] == 1 ? " class='mdl-color-text--grey-600'" : "")?>> |
| 85 | <?php |
| 86 | if ($conf["debug"]) { |
| 87 | ?> |
| 88 | <td class="extra"><?=(int)$t["id"]?></td> |
| 89 | <?php |
| 90 | } |
| 91 | ?> |
| 92 | <td class="mdl-data-table__cell--non-numeric"><?=security::htmlsafe($t["name"])?></td> |
| 93 | <td class="mdl-data-table__cell--centered"><?=($t["present"] == 1 ? visual::YES : "")?></td> |
| 94 | <td class="mdl-data-table__cell--centered"><?=($t["paid"] == 1 ? visual::YES : "")?></td> |
| 95 | <td class="mdl-data-table__cell--centered"><?=($t["workerfill"] == 1 ? visual::YES : "")?></td> |
| 96 | <td class="mdl-data-table__cell--centered"><?=($t["notifies"] == 1 ? visual::YES : "")?></td> |
| 97 | <td class="mdl-data-table__cell--centered"><?=($t["autovalidates"] == 1 ? visual::YES : "")?></td> |
| 98 | <td class='mdl-data-table__cell--non-numeric'><a href='dynamic/editincidenttype.php?id=<?=security::htmlsafe($t["id"])?>' data-dyndialog-href='dynamic/editincidenttype.php?id=<?=security::htmlsafe($t["id"])?>' title='Editar tipo de incidencia'><i class='material-icons icon'>edit</i></a></td> |
| 99 | </tr> |
| 100 | <?php |
| 101 | } |
| 102 | ?> |
| 103 | </tbody> |
| 104 | </table> |
| 105 | </div> |
| 106 | <?php |
| 107 | visual::addTooltip("tt_present", "Indica si el trabajador está físicamente presente en el espacio de trabajo durante la incidencia (es la opción que indica si las horas cuentan como positivas o negativas)."); |
| 108 | visual::addTooltip("tt_paid", "Indica si el trabajador es remunerado las horas que dura la incidencia."); |
| 109 | visual::addTooltip("tt_workerfill", "Indica si se permite que el trabajador pueda rellenar una incidencia de este tipo él mismo (con la posterior verificación por parte de un administrador)."); |
| 110 | visual::addTooltip("tt_notifies", "Indica si la introducción de una incidencia de este tipo notifica por correo electrónico a las personas especificadas en la categoría del trabajador."); |
| 111 | visual::addTooltip("tt_autovalidates", "Indica si al introducir una incidencia de este tipo se autovalida sin necesidad de ser validada posteriormente por el trabajador."); |
| 112 | } else { |
| 113 | ?> |
| 114 | <p>Todavía no hay definido ningún tipo de incidencia.</p> |
| 115 | <p>Puedes añadir uno haciendo clic en el botón de la esquina inferior derecha de la página.</p> |
| 116 | <?php |
| 117 | } |
| 118 | ?> |
| 119 | |
| 120 | <?php visual::printDebug("incidents::getTypes()", $incidents); ?> |
| 121 | </div> |
| 122 | </div> |
| 123 | </main> |
| 124 | </div> |
| 125 | |
| 126 | <dialog class="mdl-dialog" id="addincident"> |
| 127 | <form action="doaddincidenttype.php" method="POST" autocomplete="off"> |
| 128 | <h4 class="mdl-dialog__title">Añade un tipo de incidencia</h4> |
| 129 | <div class="mdl-dialog__content"> |
| 130 | <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"> |
| 131 | <input class="mdl-textfield__input" type="text" name="name" id="name" autocomplete="off" data-required> |
| 132 | <label class="mdl-textfield__label" for="name">Nombre del tipo de incidencia</label> |
| 133 | </div> |
| 134 | <p> |
| 135 | <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="present"> |
| 136 | <input type="checkbox" id="present" name="present" value="1" class="mdl-switch__input"> |
| 137 | <span class="mdl-switch__label">Presente <i class="material-icons help" id="add_present">help</i></span> |
| 138 | </label> |
| 139 | <div class="mdl-tooltip" for="add_present">Márquese si el trabajador está físicamente presente en el espacio de trabajo durante la incidencia.</div> |
| 140 | </p> |
| 141 | <p> |
| 142 | <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="paid"> |
| 143 | <input type="checkbox" id="paid" name="paid" value="1" class="mdl-switch__input"> |
| 144 | <span class="mdl-switch__label">Remunerada <i class="material-icons help" id="add_paid">help</i></span> |
| 145 | </label> |
| 146 | <div class="mdl-tooltip" for="add_paid">Márquese si el trabajador es remunerado las horas que dura la incidencia.</div> |
| 147 | </p> |
| 148 | <p> |
| 149 | <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="workerfill"> |
| 150 | <input type="checkbox" id="workerfill" name="workerfill" value="1" class="mdl-switch__input"> |
| 151 | <span class="mdl-switch__label">Puede autorrellenarse <i class="material-icons help" id="add_workerfill">help</i></span> |
| 152 | </label> |
| 153 | </p> |
| 154 | <div class="mdl-tooltip" for="add_workerfill">Márquese si se permite que el trabajador pueda rellenar una incidencia de este tipo él mismo (con la posterior verificación por parte de un administrador).</div> |
| 155 | <p> |
| 156 | <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="notifies"> |
| 157 | <input type="checkbox" id="notifies" name="notifies" value="1" class="mdl-switch__input"> |
| 158 | <span class="mdl-switch__label">Notifica <i class="material-icons help" id="add_notifies">help</i></span> |
| 159 | </label> |
| 160 | <div class="mdl-tooltip" for="add_notifies">Márquese si la introducción de una incidencia de este tipo se quiere que se notifique por correo electrónico a las personas especificadas en la categoría del trabajador.</div> |
| 161 | </p> |
| 162 | <p> |
| 163 | <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="autovalidates"> |
| 164 | <input type="checkbox" id="autovalidates" name="autovalidates" value="1" class="mdl-switch__input"> |
| 165 | <span class="mdl-switch__label">Se autovalida <i class="material-icons help" id="add_autovalidates">help</i></span> |
| 166 | </label> |
| 167 | <div class="mdl-tooltip" for="add_autovalidates">Márquese si al introducir una incidencia de este tipo se quiere que se autovalide sin necesidad de ser validada posteriormente por el trabajador.</div> |
| 168 | </p> |
| 169 | <p> |
| 170 | <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="hidden"> |
| 171 | <input type="checkbox" id="hidden" name="hidden" value="1" class="mdl-switch__input"> |
| 172 | <span class="mdl-switch__label">Oculto</span> |
| 173 | </label> |
| 174 | </p> |
| 175 | </div> |
| 176 | <div class="mdl-dialog__actions"> |
| 177 | <button type="submit" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--accent">Añadir</button> |
| 178 | <button onclick="event.preventDefault(); document.querySelector('#addincident').close();" class="mdl-button mdl-js-button mdl-js-ripple-effect cancel">Cancelar</button> |
| 179 | </div> |
| 180 | </form> |
| 181 | </dialog> |
| 182 | |
| 183 | <?php |
| 184 | visual::renderTooltips(); |
| 185 | |
| 186 | visual::smartSnackbar([ |
| 187 | ["added", "Se ha añadido el tipo de incidencia correctamente."], |
| 188 | ["modified", "Se ha modificado el tipo de incidencia correctamente."], |
| 189 | ["empty", "Faltan datos por introducir en el formulario."], |
| 190 | ["unexpected", "Ha ocurrido un error inesperado. Inténtelo de nuevo en unos segundos."] |
| 191 | ]); |
| 192 | ?> |
| 193 | |
| 194 | <script src="js/incidenttypes.js"></script> |
| 195 | </body> |
| 196 | </html> |