Lachenzelg/admin/categories-reports.php

101 lines
4.3 KiB
PHP
Raw Normal View History

2025-01-07 03:02:25 +01:00
<?php include('includes/header.php'); ?>
<div>
<div class="card card-body p-4">
<?= alertMessage(); ?>
<div class="row">
<div class="col-8">
<h3 class="fw-semibold mb-4">Administrator bearbeiten</h3>
</div>
<div class="col-4">
<a href="admins.php" class="btn btn-light float-end"> <i class="ti ti-arrow-left"></i> Zurück zur Übersicht</a>
</div>
</div>
<form action="code.php" method="POST">
<?php
$paramResult = checkParamId('id');
if(!is_numeric($paramResult)){
echo '<div class="alert alert-danger" role="alert">'.$paramResult.'</div>';
return false;
}
$admin = getById('tbl_admins',checkParamId('id'));
if($admin['status'] == 200)
{
?>
<input type="hidden" name="id" value="<?= $admin['data']['id'] ;?>" required>
<div class="row">
<div class="col-md-6">
<div class="mb-3">
<label class="form-label">Vorname</label>
<input type="text" name="firstname" value="<?= $admin['data']['firstname'] ;?>" required class="form-control">
</div>
</div>
<div class="col-md-6">
<div class="mb-3">
<label class="form-label">Nachname</label>
<input type="text" name="lastname" value="<?= $admin['data']['lastname'] ;?>" required class="form-control">
</div>
</div>
<div class="col-md-6">
<div class="mb-3">
<label class="form-label">Benutzer-ID</label>
<input type="text" name="user-id" value="<?= $admin['data']['userid'] ;?>" required pattern="[A-Za-z0-9\-]+" onkeydown="if(['Space'].includes(arguments[0].code)){return false;}" class="form-control">
</div>
</div>
<div class="col-md-6">
<div class="mb-3">
<label class="form-label">Kennwort</label>
<input type="password" name="password" value="<?= $admin['data']['password'] ;?>" required class="form-control">
</div>
</div>
<div class="col-md-6">
<div class="mb-3">
<label class="form-label">Status</label>
<select name="status" class="form-select">
<?php
$enumValueLabels = [
'active' => 'Aktiv',
'disabled' => 'Inaktiv'
];
createEnumSelect('tbl_admins', 'status', $admin['data']['status'],$enumValueLabels); ?>
</select>
</div>
</div>
<div class="col-md-12">
<button type="submit" name="updateadmin" class="btn btn-info float-end mx-1"> <i class="ti ti-check"></i> Änderungen speichern</button>
<a type="button" class="btn btn-danger float-end mx-1" data-bs-toggle="modal" data-bs-target="#deleteAdmin"><i class="ti ti-trash"></i> Löschen</a>
</div>
</div>
<?php
}
else
{
echo '<div class="alert alert-danger" role="alert">'.$admin['message'].'</div>';
}
?>
</form>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="deleteAdmin" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="staticBackdropLabel">Administrator entfernen</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p>Sind Sie sicher, dass Sie <b><?= $admin['data']['firstname'] . ' ' . $admin['data']['lastname']?></b> entfernen möchten?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light" data-bs-dismiss="modal">Abbrechen</button>
<a href="admins-delete.php?id=<?= $admin['data']['id']; ?>" class="btn btn-danger"><i class="ti ti-trash"></i> Löschen</a>
</div>
</div>
</div>
</div>
<!-- Modal Ende -->
<?php include('includes/footer.php'); ?>