85 lines
4.6 KiB
PHP
85 lines
4.6 KiB
PHP
<?php $current = auth_check() ? user() : null; ?>
|
|
|
|
<div class="container text-center text-light mt-5">
|
|
<h1 class="text-center"><?= e($user->name) ?></h1>
|
|
|
|
<form style="background-color: #fff;" class="text-dark" method="post" action="/member/<?= e($user->id) ?>"
|
|
enctype="multipart/form-data">
|
|
<?= csrf_field() ?>
|
|
<input type="hidden" name="_method" value="PUT">
|
|
<input type="hidden" name="id" value="<?= e($user->id) ?>">
|
|
|
|
<div class="form-group" style="display:flex;">
|
|
<label class="ml-2 mt-4" style="width:150px; text-align:left;" for="name"><h4>Name:</h4></label>
|
|
<input class="mt-3 mr-2 form-control" type="text" id="name" style="font-size:20px;" name="name"
|
|
value="<?= e(old('name') ?? $user->name) ?>" required>
|
|
</div>
|
|
<div class="form-group" style="display:flex;">
|
|
<label class="ml-2 mt-4" style="width:150px; text-align:left;" for="mobile"><h4>Telefonnummer:</h4></label>
|
|
<input type="text" class="mt-3 mr-2 form-control" id="mobile" style="font-size:20px;" name="mobile"
|
|
value="<?= e(old('mobile') ?? $user->mobile) ?>" required>
|
|
</div>
|
|
<div class="form-group" style="display:flex;">
|
|
<label class="ml-2 mt-4" style="width:150px; text-align:left;" for="email"><h4>EMail:</h4></label>
|
|
<input type="text" class="mt-3 mr-2 form-control" id="email" style="font-size:20px;" name="email"
|
|
value="<?= e(old('email') ?? $user->email) ?>" required>
|
|
</div>
|
|
|
|
<div class="form-group" style="display:flex;">
|
|
<label class="ml-2 mt-4" style="width:150px; text-align:left;" for="bild"><h4>Bild:</h4></label>
|
|
|
|
<?php if (file_exists(storage_path('img_storage/user/' . $user->id . '.jpg'))): ?>
|
|
<a href="/img_storage/user/<?= e($user->id) ?>_gross.jpg" data-lightbox="<?= e($user->id) ?>_gross.jpg"
|
|
data-title="<?= e($user->name) ?>">
|
|
<img src="/img_storage/user/<?= e($user->id) ?>.jpg" id="bild" class="mt-3 ml-3"
|
|
style="width:256px;height:256px">
|
|
</a>
|
|
<?php else: ?>
|
|
<img src="/img/placeholder/user64x96.jpg" id="bild" class="mt-3 ml-3">
|
|
<?php endif; ?>
|
|
|
|
<input type="file" class="mt-3 mr-2 form-control" style="font-size:20px;" name="bild" value=""
|
|
accept="image/*" onchange="preview_image(event)">
|
|
</div>
|
|
|
|
<?php if ($current && $current->isAdmin()): ?>
|
|
<div class="form-group" style="display:flex;">
|
|
<label class="ml-2 mt-4" style="width:130px; text-align:left;" for="role"><h4>Rolle:</h4></label>
|
|
|
|
<select name="role" class="dropdown-item ml-3 border form-control mt-3 mr-2" style="font-size:18px;">
|
|
<option value="GUEST" style="font-size:18px;" class="dropdown-item bg-light form-control" <?= $user->role === 'GUEST' ? 'selected' : '' ?>>GUEST</option>
|
|
<option value="MEMBER" style="font-size:18px;" class="dropdown-item bg-light" <?= $user->role === 'MEMBER' ? 'selected' : '' ?>>MEMBER</option>
|
|
<option value="ADMIN" style="font-size:18px;" class="dropdown-item bg-light" <?= $user->role === 'ADMIN' ? 'selected' : '' ?>>ADMIN</option>
|
|
</select>
|
|
</div>
|
|
<?php else: ?>
|
|
<div class="form-group" style="display:flex;">
|
|
<label class="ml-2 mt-4" style="width:130px; text-align:left;" for="role"><h4>Rolle:</h4></label>
|
|
<h4 class="mt-4"><?= e($user->role) ?></h4>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<a href="/member" class="btn btn-primary col-2 mb-2 float-left" style="margin-right:20px;">Zurück</a>
|
|
|
|
<?php if ($current && ($current->isAdmin() || (int) $current->id === (int) $user->id)): ?>
|
|
<button type="submit" class="btn btn-danger col-2 mb-2 float-right mr-2">Speichern</button>
|
|
<button type="submit" form="destroy-user-form" class="btn btn-primary col-2 mb-2 float-left"
|
|
style="margin-right:20px;">Löschen</button>
|
|
<?php endif; ?>
|
|
</form>
|
|
|
|
<form id="destroy-user-form" action="/admin/destroy_user/<?= e($user->id) ?>" method="POST" style="display:none;">
|
|
<?= csrf_field() ?>
|
|
</form>
|
|
</div>
|
|
|
|
<script>
|
|
function preview_image(event) {
|
|
var reader = new FileReader();
|
|
reader.onload = function () {
|
|
var output = document.getElementById('bild');
|
|
output.src = reader.result;
|
|
}
|
|
reader.readAsDataURL(event.target.files[0]);
|
|
}
|
|
</script>
|