blob: 228fa21dc14dd7b5ce0bfddf5ab1ac5f1271ffc6 [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001<?php
Adrià Vilanova Martínez5af86512023-12-02 20:44:16 +01002/*
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 botbe50d492023-11-30 00:16:42 +010021require_once(__DIR__."/../core.php");
22security::checkType(security::ADMIN, security::METHOD_NOTFOUND);
23
24if (!security::checkParams("GET", [
25 ["workers", security::PARAM_ISARRAY]
26])) {
27 security::notFound();
28}
29?>
30
31<style>
32.notvisible {
33 display: none;
34}
35</style>
36
37<dynscript>
38document.getElementById("allday").addEventListener("change", e => {
39 var partialtime = document.getElementById("partialtime");
40 if (e.target.checked) {
41 partialtime.classList.add("notvisible");
42 } else {
43 partialtime.classList.remove("notvisible");
44 }
45});
46</dynscript>
47
48<form action="doaddincidentbulk.php" method="POST" autocomplete="off">
49 <h4 class="mdl-dialog__title">Añade una incidencia</h4>
50 <div class="mdl-dialog__content">
51 <div class="mdlext-selectfield mdlext-js-selectfield mdlext-selectfield--floating-label">
52 <select name="type" id="type" class="mdlext-selectfield__select" data-required>
53 <option></option>
54 <?php
55 foreach (incidents::getTypesForm() as $i) {
56 echo '<option value="'.(int)$i["id"].'">'.security::htmlsafe($i["name"]).'</option>';
57 }
58 ?>
59 </select>
60 <label for="type" class="mdlext-selectfield__label">Tipo</label>
61 </div>
62
63 <h5>Afectación</h5>
64 <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
65 <input class="mdl-textfield__input" type="date" name="day" id="day" autocomplete="off" data-required>
66 <label class="mdl-textfield__label always-focused" for="day">Día</label>
67 </div>
68 <br>
69 <p>
70 <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="allday">
71 <input type="checkbox" id="allday" name="allday" value="1" class="mdl-switch__input">
72 <span class="mdl-switch__label">Día entero</span>
73 </label>
74 </p>
75 <div id="partialtime">De <input type="time" name="begins"> a <input type="time" name="ends"></div>
76
77 <h5>Detalles adicionales</h5>
78 <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
79 <textarea class="mdl-textfield__input" name="details" id="details"></textarea>
80 <label class="mdl-textfield__label" for="details">Observaciones (opcional)</label>
81 </div>
82 <p>Las observaciones aparecerán en los PDFs que se exporten.</p>
83 <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>
84
85 <b>Trabajadores:</b>
86 <div class="copyto">
87 <ul>
88 <?php
89 foreach ($_GET["workers"] as $workerid) {
90 $worker = workers::get($workerid);
91 if ($worker === false) {
92 die("Error: Uno de los trabajadores seleccionados ya no existe");
93 }
94
95 echo "<li><input type='hidden' name='workers[]' value='".(int)$worker["id"]."'> ".security::htmlsafe($worker["name"])." (".security::htmlsafe($worker["companyname"]).")</li>";
96 }
97 ?>
98 </ul>
99 </div>
100 </div>
101 <div class="mdl-dialog__actions">
102 <button type="submit" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--accent">Añadir</button>
103 <button data-dyndialog-close class="mdl-button mdl-js-button mdl-js-ripple-effect cancel">Cancelar</button>
104 </div>
105</form>