blob: f7b72a8d69dc49391a637d4f2ae78ab81ea5daac [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<form action="docopytemplate.php" method="POST" autocomplete="off">
32 <h4 class="mdl-dialog__title">Copiar plantilla a trabajadores</h4>
33 <div class="mdl-dialog__content">
34 <div class="mdlext-selectfield mdlext-js-selectfield mdlext-selectfield--floating-label">
35 <select name="template" id="template" class="mdlext-selectfield__select" data-required>
36 <?php
37 $templates = schedules::getTemplates();
38 foreach ($templates as $t) {
39 echo '<option value="'.(int)$t["id"].'">'.security::htmlsafe($t["name"]).'</option>';
40 }
41 ?>
42 </select>
43 <label for="template" class="mdlext-selectfield__label">Plantilla</label>
44 </div>
45 <br>
46 <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="active">
47 <input type="checkbox" id="active" name="active" value="1" class="mdl-switch__input">
48 <span class="mdl-switch__label">Activar horario</span>
49 </label>
50 <br><br>
51 <b>Copiar a:</b>
52 <div class="copyto">
53 <ul>
54 <?php
55 foreach ($_GET["workers"] as $workerid) {
56 $worker = workers::get($workerid);
57 if ($worker === false) {
58 die("Error: Uno de los trabajadores seleccionados ya no existe");
59 }
60
61 echo "<li><input type='hidden' name='workers[]' value='".(int)$worker["id"]."'> ".security::htmlsafe($worker["name"])." (".security::htmlsafe($worker["companyname"]).")</li>";
62 }
63 ?>
64 </ul>
65 </div>
66 </div>
67 <div class="mdl-dialog__actions">
68 <button type="submit" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--accent">Copiar</button>
69 <button data-dyndialog-close class="mdl-button mdl-js-button mdl-js-ripple-effect cancel">Cancelar</button>
70 </div>
71</form>