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 | |
| 20 | <dynscript> |
| 21 | document.getElementById("cancel").addEventListener("click", e => { |
| 22 | e.preventDefault(); |
| 23 | dynDialog.load("dynamic/workhistory.php?id="+parseInt(document.getElementById("cancel").getAttribute("data-worker-id"))); |
| 24 | }); |
| 25 | </dynscript> |
| 26 | |
| 27 | <form action="doeditworkhistoryitem.php" method="POST" autocomplete="off"> |
| 28 | <input type="hidden" name="id" value="<?=(int)$id?>"> |
| 29 | <h4 class="mdl-dialog__title">Editar <?=security::htmlsafe(strtolower(workers::affiliationStatusHelper($item["status"])))?></h4> |
| 30 | <div class="mdl-dialog__content"> |
| 31 | <p><b>Persona:</b> <?=security::htmlsafe($worker["name"])?><br> |
| 32 | <b>Empresa:</b> <?=security::htmlsafe($worker["companyname"])?></p> |
| 33 | |
| 34 | <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"> |
| 35 | <input class="mdl-textfield__input" type="date" name="day" id="day" autocomplete="off" data-required value="<?=security::htmlsafe(date("Y-m-d", $item["day"]))?>"> |
| 36 | <label class="mdl-textfield__label" for="day">Fecha</label> |
| 37 | </div> |
| 38 | <br> |
| 39 | <div class="mdlext-selectfield mdlext-js-selectfield mdlext-selectfield--floating-label"> |
| 40 | <select name="status" id="status" class="mdlext-selectfield__select" data-required> |
| 41 | <option></option> |
| 42 | <?php |
| 43 | foreach (workers::$affiliationStatusesManual as $status) { |
| 44 | $currentIsHidden = workers::isHidden($status); |
| 45 | echo '<option value="'.(int)$status.'"'.((($isHidden && $currentIsHidden) || (!$isHidden && !$currentIsHidden)) ? ' selected' : '').'>'.security::htmlsafe(workers::affiliationStatusHelper($status)).'</option>'; |
| 46 | } |
| 47 | ?> |
| 48 | </select> |
| 49 | <label for="status" class="mdlext-selectfield__label">Tipo</label> |
| 50 | </div> |
| 51 | </div> |
| 52 | <div class="mdl-dialog__actions"> |
| 53 | <button type="submit" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--accent">Editar</button> |
| 54 | <button id="cancel" class="mdl-button mdl-js-button mdl-js-ripple-effect" data-worker-id="<?=(int)$worker["id"]?>">Cancelar</button> |
| 55 | </div> |
| 56 | </form> |