blob: 3829b4713f97fb10c36e94640d109bea31f82319 [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 (!isset($_GET["id"])) {
6 security::notFound();
7}
8
9$id = (int)$_GET["id"];
10
11$day = schedules::getDay($id);
12
13if ($day === false) {
14 security::notFound();
15}
16
17$empty = [];
18
19foreach (schedules::$allEvents as $date) {
20 $empty[$date] = (intervals::measure([$day["begins".$date], $day["ends".$date]]) == 0);
21}
22?>
23
24<form action="doeditdayschedule.php" method="POST" autocomplete="off">
25 <input type="hidden" name="id" value="<?=(int)$day["id"]?>">
26 <h4 class="mdl-dialog__title">Modificar horario</h4>
27 <div class="mdl-dialog__content">
28 <h5>Día</h5>
29 <div class="mdlext-selectfield mdlext-js-selectfield mdlext-selectfield--floating-label">
30 <select id="edit_day" class="mdlext-selectfield__select" disabled>
31 <?php
32 foreach (calendars::$days as $id => $tday) {
33 echo '<option value="'.(int)$id.'"'.($day["day"] == $id ? " selected" : "").'>'.security::htmlsafe($tday).'</option>';
34 }
35 ?>
36 </select>
37 <label for="edit_day" class="mdlext-selectfield__label">Día de la semana</label>
38 </div>
39 <br>
40 <div class="mdlext-selectfield mdlext-js-selectfield mdlext-selectfield--floating-label">
41 <select id="edit_type" class="mdlext-selectfield__select" disabled>
42 <?php
43 foreach (calendars::$types as $id => $type) {
44 if ($id == calendars::TYPE_FESTIU) continue;
45 echo '<option value="'.(int)$id.'"'.($day["typeday"] == $id ? " selected" : "").'>'.security::htmlsafe($type).'</option>';
46 }
47 ?>
48 </select>
49 <label for="edit_type" class="mdlext-selectfield__label">Tipo de día</label>
50 </div>
51
52 <h5>Jornada laboral</h5>
53 <p>De <input type="time" name="beginswork" <?=(!$empty["work"] ? " value='".schedules::sec2time($day["beginswork"])."'" : "")?> required> a <input type="time" name="endswork" <?=(!$empty["work"] ? " value='".schedules::sec2time($day["endswork"])."'" : "")?> required></p>
54
55 <h5>Desayuno</h5>
56 <p>De <input type="time" name="beginsbreakfast" <?=(!$empty["breakfast"] ? " value='".schedules::sec2time($day["beginsbreakfast"])."'" : "")?>> a <input type="time" name="endsbreakfast" <?=(!$empty["breakfast"] ? " value='".schedules::sec2time($day["endsbreakfast"])."'" : "")?>></p>
57
58 <h5>Comida</h5>
59 <p>De <input type="time" name="beginslunch" <?=(!$empty["lunch"] ? " value='".schedules::sec2time($day["beginslunch"])."'" : "")?>> a <input type="time" name="endslunch" <?=(!$empty["lunch"] ? " value='".schedules::sec2time($day["endslunch"])."'" : "")?>></p>
60 </div>
61 <div class="mdl-dialog__actions">
62 <button type="submit" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--primary">Modificar</button>
63 <button data-dyndialog-close class="mdl-button mdl-js-button mdl-js-ripple-effect cancel">Cancelar</button>
64 </div>
65</form>