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("workers.php"); |
| 6 | ?> |
| 7 | <!DOCTYPE html> |
| 8 | <html> |
| 9 | <head> |
| 10 | <title><?php echo $conf["appName"]; ?></title> |
| 11 | <?php visual::includeHead(); ?> |
| 12 | <link rel="stylesheet" href="css/dashboard.css"> |
| 13 | |
| 14 | <style> |
| 15 | .addtemplate { |
| 16 | position: fixed; |
| 17 | bottom: 16px; |
| 18 | right: 16px; |
| 19 | z-index: 1000; |
| 20 | } |
| 21 | </style> |
| 22 | </head> |
| 23 | <?php visual::printBodyTag(); ?> |
| 24 | <div class="mdl-layout mdl-js-layout mdl-layout--fixed-header mdl-layout--fixed-drawer"> |
| 25 | <?php visual::includeNav(); ?> |
| 26 | <button class="addtemplate 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> |
| 27 | <main class="mdl-layout__content"> |
| 28 | <div class="page-content"> |
| 29 | <div class="main mdl-shadow--4dp"> |
| 30 | <h2>Plantillas de horarios</h2> |
| 31 | <?php |
| 32 | $templates = schedules::getTemplates(); |
| 33 | if (count($templates)) { |
| 34 | foreach ($templates as $t) { |
| 35 | ?> |
| 36 | <a href="scheduletemplate.php?id=<?=(int)$t["id"]?>" class="clicky-container"> |
| 37 | <div class="clicky mdl-js-ripple-effect"> |
| 38 | <div class="text"> |
| 39 | <span class="title"><?=security::htmlsafe($t["name"])?></span><br> |
| 40 | <span class="description"><?=security::htmlsafe(date("d/m/Y", $t["begins"]))?> - <?=security::htmlsafe(date("d/m/Y", $t["ends"]))?></span> |
| 41 | </div> |
| 42 | <div class="mdl-ripple"></div> |
| 43 | </div> |
| 44 | </a> |
| 45 | <?php |
| 46 | } |
| 47 | } else { |
| 48 | ?> |
| 49 | <p>Todavía no has creado ninguna plantilla.</p> |
| 50 | <p>Puedes añadir una haciendo clic en el botón de la esquina inferior derecha de la página.</p> |
| 51 | <?php |
| 52 | } |
| 53 | ?> |
| 54 | |
| 55 | <?php visual::printDebug("schedules::getTemplates()", $templates); ?> |
| 56 | </div> |
| 57 | </div> |
| 58 | </main> |
| 59 | </div> |
| 60 | |
| 61 | <dialog class="mdl-dialog" id="addtemplate"> |
| 62 | <form action="doaddscheduletemplate.php" method="POST" autocomplete="off"> |
| 63 | <h4 class="mdl-dialog__title">Crea una nueva plantilla</h4> |
| 64 | <div class="mdl-dialog__content"> |
| 65 | <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"> |
| 66 | <input class="mdl-textfield__input" type="text" name="name" id="name" autocomplete="off" data-required> |
| 67 | <label class="mdl-textfield__label" for="name">Nombre de la plantilla</label> |
| 68 | </div> |
| 69 | <br> |
| 70 | <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"> |
| 71 | <input class="mdl-textfield__input" type="date" name="begins" id="begins" autocomplete="off" data-required> |
| 72 | <label class="mdl-textfield__label always-focused" for="begins">Fecha inicio de validez del horario</label> |
| 73 | </div> |
| 74 | <br> |
| 75 | <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"> |
| 76 | <input class="mdl-textfield__input" type="date" name="ends" id="ends" autocomplete="off" data-required> |
| 77 | <label class="mdl-textfield__label always-focused" for="ends">Fecha fin de validez del horario</label> |
| 78 | </div> |
| 79 | </div> |
| 80 | <div class="mdl-dialog__actions"> |
| 81 | <button type="submit" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--accent">Crear</button> |
| 82 | <button onclick="event.preventDefault(); document.querySelector('#addtemplate').close();" class="mdl-button mdl-js-button mdl-js-ripple-effect cancel">Cancelar</button> |
| 83 | </div> |
| 84 | </form> |
| 85 | </dialog> |
| 86 | |
| 87 | <?php |
| 88 | visual::smartSnackbar([ |
| 89 | ["added", "Se ha añadido la plantilla correctamente."], |
| 90 | ["deleted", "Se ha eliminado la plantilla correctamente."], |
| 91 | ["empty", "Faltan datos por introducir en el formulario."], |
| 92 | ["unexpected", "Ha ocurrido un error inesperado. Inténtelo de nuevo en unos segundos."], |
| 93 | ["order", "La fecha de inicio debe ser anterior a la fecha de fin."] |
| 94 | ]); |
| 95 | ?> |
| 96 | |
| 97 | <script src="js/scheduletemplates.js"></script> |
| 98 | </body> |
| 99 | </html> |