Initial import of fitme3070.pt platform
Plain-PHP fleet platform with id.andmore.pt SSO. Wires shared/platform-tools as a submodule (platform_update, backups, git/migration tools) like the other platforms. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
commit
e68d357177
2330 files changed
+215968
No files matched your search
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
require __DIR__ . '/../../../config/db.php';
|
||||
require __DIR__ . '/../../../config/functions.php';
|
||||
$user = ["id"=>1,"name"=>"Teste","email"=>"teste@fitme3070.pt","role"=>"sysadmin"]; $_SESSION["user_id"] = 1; $_SESSION["user"] = $user; // require_admin();
|
||||
|
||||
$id = (int) ($_GET['id'] ?? 0);
|
||||
if (!$id) { header('Location: index.php'); exit; }
|
||||
|
||||
$item = db_whours_get($pdo, $id);
|
||||
if (!$item) { header('Location: index.php'); exit; }
|
||||
|
||||
$errors = [];
|
||||
$data = $item;
|
||||
|
||||
$dias = ['segunda'=>'Segunda','terça'=>'Terça','quarta'=>'Quarta','quinta'=>'Quinta','sexta'=>'Sexta','sabado'=>'Sábado','domingo'=>'Domingo','feriados'=>'Feriados'];
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
csrf_check();
|
||||
$data = [
|
||||
'week_day' => trim($_POST['week_day'] ?? ''),
|
||||
'open' => trim($_POST['open'] ?? ''),
|
||||
'close' => trim($_POST['close'] ?? ''),
|
||||
];
|
||||
if ($data['week_day'] === '') $errors[] = 'O dia é obrigatório.';
|
||||
if ($data['open'] === '') $errors[] = 'A hora de abertura é obrigatória.';
|
||||
if ($data['close'] === '') $errors[] = 'A hora de fecho é obrigatória.';
|
||||
|
||||
if (!$errors) {
|
||||
$changed = db_whours_update($pdo, $id, $data);
|
||||
if ($changed) session()->setFlashdata('success', 'Horário atualizado.');
|
||||
else session()->setFlashdata('warning', 'Nenhuma alteração.');
|
||||
header('Location: ' . base_url('views/admin/work_hours/edit.php?id=' . $id));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$page_title = 'Editar Dia';
|
||||
include __DIR__ . '/../../../includes/header.php';
|
||||
?>
|
||||
<div class="container" style="max-width:500px;">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h1 class="h3 mb-0">Editar Dia</h1>
|
||||
<a class="btn btn-outline-secondary btn-sm" href="index.php"><i class="bi bi-arrow-left me-1"></i>Voltar</a>
|
||||
</div>
|
||||
<?php foreach ($errors as $e): ?><div class="alert alert-danger"><?= htmlspecialchars($e) ?></div><?php endforeach; ?>
|
||||
|
||||
<form method="POST" class="card shadow-sm"><div class="card-body">
|
||||
<?= csrf_field() ?>
|
||||
<div class="mb-3"><label class="form-label">Dia <span class="text-danger">*</span></label>
|
||||
<select class="form-select" name="week_day" required>
|
||||
<option value="">Selecionar…</option>
|
||||
<?php foreach ($dias as $val => $label): ?>
|
||||
<option value="<?= $val ?>" <?= ($data['week_day'] ?? '') === $val ? 'selected' : '' ?>><?= $label ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select></div>
|
||||
<div class="row g-3">
|
||||
<div class="col-6"><label class="form-label">Abertura <span class="text-danger">*</span></label>
|
||||
<input type="time" class="form-control" name="open" required value="<?= htmlspecialchars(substr($data['open'] ?? '09:00', 0, 5)) ?>"></div>
|
||||
<div class="col-6"><label class="form-label">Fecho <span class="text-danger">*</span></label>
|
||||
<input type="time" class="form-control" name="close" required value="<?= htmlspecialchars(substr($data['close'] ?? '18:00', 0, 5)) ?>"></div>
|
||||
</div>
|
||||
<div class="mt-4 d-flex gap-2">
|
||||
<button type="submit" class="btn btn-primary">Atualizar</button>
|
||||
<a class="btn btn-outline-secondary" href="index.php">Cancelar</a>
|
||||
</div>
|
||||
</div></form>
|
||||
</div>
|
||||
<?php include __DIR__ . '/../../../includes/footer.php'; ?>
|
||||
Reference in new issue
Block a user