blob: afb04ba56aa130365480729d7c4298249653f3d6 [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001<?php
2require_once(__DIR__."/../core.php");
3security::checkType(security::ADMIN, security::METHOD_NOTFOUND);
4
5if (!security::checkParams("GET", [
6 ["workers", security::PARAM_ISARRAY]
7])) {
8 security::notFound();
9}
10?>
11
12<style>
13.notvisible {
14 display: none;
15}
16</style>
17
18<dynscript>
19document.getElementById("allday").addEventListener("change", e => {
20 var partialtime = document.getElementById("partialtime");
21 if (e.target.checked) {
22 partialtime.classList.add("notvisible");
23 } else {
24 partialtime.classList.remove("notvisible");
25 }
26});
27</dynscript>
28
29<form action="doaddincidentbulk.php" method="POST" autocomplete="off">
30 <h4 class="mdl-dialog__title">Añade una incidencia</h4>
31 <div class="mdl-dialog__content">
32 <div class="mdlext-selectfield mdlext-js-selectfield mdlext-selectfield--floating-label">
33 <select name="type" id="type" class="mdlext-selectfield__select" data-required>
34 <option></option>
35 <?php
36 foreach (incidents::getTypesForm() as $i) {
37 echo '<option value="'.(int)$i["id"].'">'.security::htmlsafe($i["name"]).'</option>';
38 }
39 ?>
40 </select>
41 <label for="type" class="mdlext-selectfield__label">Tipo</label>
42 </div>
43
44 <h5>Afectación</h5>
45 <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
46 <input class="mdl-textfield__input" type="date" name="day" id="day" autocomplete="off" data-required>
47 <label class="mdl-textfield__label always-focused" for="day">Día</label>
48 </div>
49 <br>
50 <p>
51 <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="allday">
52 <input type="checkbox" id="allday" name="allday" value="1" class="mdl-switch__input">
53 <span class="mdl-switch__label">Día entero</span>
54 </label>
55 </p>
56 <div id="partialtime">De <input type="time" name="begins"> a <input type="time" name="ends"></div>
57
58 <h5>Detalles adicionales</h5>
59 <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
60 <textarea class="mdl-textfield__input" name="details" id="details"></textarea>
61 <label class="mdl-textfield__label" for="details">Observaciones (opcional)</label>
62 </div>
63 <p>Las observaciones aparecerán en los PDFs que se exporten.</p>
64 <p>Después de crear la incidencia podrás añadir archivos adjuntos haciendo clic en el botón <i class="material-icons" style="vertical-align: middle;">attach_file</i>.</p>
65
66 <b>Trabajadores:</b>
67 <div class="copyto">
68 <ul>
69 <?php
70 foreach ($_GET["workers"] as $workerid) {
71 $worker = workers::get($workerid);
72 if ($worker === false) {
73 die("Error: Uno de los trabajadores seleccionados ya no existe");
74 }
75
76 echo "<li><input type='hidden' name='workers[]' value='".(int)$worker["id"]."'> ".security::htmlsafe($worker["name"])." (".security::htmlsafe($worker["companyname"]).")</li>";
77 }
78 ?>
79 </ul>
80 </div>
81 </div>
82 <div class="mdl-dialog__actions">
83 <button type="submit" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--accent">Añadir</button>
84 <button data-dyndialog-close class="mdl-button mdl-js-button mdl-js-ripple-effect cancel">Cancelar</button>
85 </div>
86</form>