blob: 8fd9dd69d56b3b6df11cb35f970cf37117480cdf [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001<?php
2require_once(__DIR__."/../core.php");
3security::checkType(security::WORKER, security::METHOD_NOTFOUND);
4security::checkWorkerUIEnabled();
5
6$isAdmin = security::isAllowed(security::ADMIN);
7
8if (!isset($_GET["id"])) {
9 security::notFound();
10}
11
12$id = (int)$_GET["id"];
13
14$incident = incidents::get($id);
15if ($incident === false) security::notFound();
16
17if (!$isAdmin) incidents::checkIncidentIsFromPerson($incident["id"]);
18
19$status = incidents::getStatus($incident);
20$cantedit = (in_array($status, incidents::$cannotEditCommentsStates) || !$isAdmin);
21?>
22
23<form action="<?=(!$isAdmin ? "doeditworkerincidentcomment.php" : "doeditincidentcomment.php")?>" method="POST" autocomplete="off">
24 <input type="hidden" name="id" value="<?=(int)$incident["id"]?>">
25 <h4 class="mdl-dialog__title">Observaciones incidencia</h4>
26 <div class="mdl-dialog__content">
27 <h5>Observaciones</h5>
28 <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
29 <textarea class="mdl-textfield__input" name="details" id="details"<?=($cantedit ? " disabled" : "")?>><?=security::htmlsafe($incident["details"])?></textarea>
30 <label class="mdl-textfield__label" for="details">Observaciones (opcional)</label>
31 </div>
32
33 <h5>Observaciones del trabajador</h5>
34 <p><?=security::htmlsafe((!empty($incident["workerdetails"]) ? $incident["workerdetails"] : "-"))?></p>
35 </div>
36 <div class="mdl-dialog__actions">
37 <button type="submit" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--primary"<?=($cantedit ? " disabled" : "")?>>Modificar</button>
38 <button data-dyndialog-close class="mdl-button mdl-js-button mdl-js-ripple-effect cancel">Cancelar</button>
39 </div>
40</form>