Copybara bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame] | 1 | <?php |
| 2 | require_once(__DIR__."/../core.php"); |
| 3 | security::checkType(security::ADMIN, security::METHOD_NOTFOUND); |
| 4 | |
| 5 | if (!isset($_GET["id"])) { |
| 6 | security::notFound(); |
| 7 | } |
| 8 | |
| 9 | $id = (int)$_GET["id"]; |
| 10 | |
| 11 | $item = workers::getWorkHistoryItem($id); |
| 12 | if ($item === false) security::notFound(); |
| 13 | |
| 14 | $isHidden = workers::isHidden($item["status"]); |
| 15 | |
| 16 | $worker = workers::get($item["worker"]); |
| 17 | if ($worker === false) security::notFound(); |
| 18 | |
| 19 | $helper = security::htmlsafe(strtolower(workers::affiliationStatusHelper($item["status"]))); |
| 20 | ?> |
| 21 | |
| 22 | <dynscript> |
| 23 | document.getElementById("cancel").addEventListener("click", e => { |
| 24 | e.preventDefault(); |
| 25 | dynDialog.load("dynamic/workhistory.php?id="+parseInt(document.getElementById("cancel").getAttribute("data-worker-id"))); |
| 26 | }); |
| 27 | </dynscript> |
| 28 | |
| 29 | <form action="dodeleteworkhistoryitem.php" method="POST" autocomplete="off"> |
| 30 | <input type="hidden" name="id" value="<?=(int)$id?>"> |
| 31 | <h4 class="mdl-dialog__title">Eliminar registro de <?=security::htmlsafe($helper)?></h4> |
| 32 | |
| 33 | <div class="mdl-dialog__content"> |
| 34 | <p><b>Persona:</b> <?=security::htmlsafe($worker["name"])?><br> |
| 35 | <b>Empresa:</b> <?=security::htmlsafe($worker["companyname"])?><br> |
| 36 | <b>Día:</b> <?=security::htmlsafe(date("d/m/Y", $item["day"]))?></p> |
| 37 | |
| 38 | <p>¿Estás seguro que quieres eliminar este registro de <?=security::htmlsafe($helper)?>? <span style="color:#EF5350;font-weight:bold;">Esta acción es irreversible</span></p> |
| 39 | </div> |
| 40 | <div class="mdl-dialog__actions"> |
| 41 | <button type="submit" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--accent">Eliminar</button> |
| 42 | <button id="cancel" class="mdl-button mdl-js-button mdl-js-ripple-effect" data-worker-id="<?=(int)$worker["id"]?>">Cancelar</button> |
| 43 | </div> |
| 44 | </form> |