Working on member edit

This commit is contained in:
TorstenS 2020-09-22 15:40:12 +02:00
parent cf3bd96bac
commit 87830632ce
10 changed files with 173 additions and 110 deletions

View file

@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\User;
use Illuminate\Http\Request;
use Log;
class UserController extends Controller
{
@ -15,7 +16,7 @@ class UserController extends Controller
public function index()
{
$users=User::all();
return view('memberlist', compact('users'));
return view('users.index')->with('users',$users);
}
/**
@ -45,10 +46,16 @@ class UserController extends Controller
* @param \App\User $user
* @return \Illuminate\Http\Response
*/
public function show($user_id)
public function show($id)
{
$user=User::find($user_id);
return view('member_show',compact('user'));
//Log("show user id=".$id);
error_log("(show)=>".$id);
$user=User::find($id);
return view('users.show')->with('user',$user);
}
/**
@ -57,9 +64,13 @@ class UserController extends Controller
* @param \App\User $user
* @return \Illuminate\Http\Response
*/
public function edit(User $user)
public function edit($id)
{
//
error_log("Edit:".$id);
$user=User::find($id);
error_log($user);
return view('users.edit')->with('user',$user);
}
/**

View file

@ -67,7 +67,7 @@ return [
|
*/
'timezone' => 'UTC',
'timezone' => 'Europe/Berlin',
/*
|--------------------------------------------------------------------------

View file

@ -4597,7 +4597,7 @@ readers do not read off random characters that represent icons */
--white: #fff;
--gray: #6c757d;
--gray-dark: #343a40;
--primary: #3490dc;
--primary: #343a40;
--secondary: #6c757d;
--success: #38c172;
--info: #6cb2eb;
@ -4746,13 +4746,13 @@ sup {
}
a {
color: #3490dc;
color: #343a40;
text-decoration: none;
background-color: transparent;
}
a:hover {
color: #1d68a7;
color: #121416;
text-decoration: underline;
}
@ -6404,23 +6404,23 @@ pre code {
.table-primary,
.table-primary > th,
.table-primary > td {
background-color: #c6e0f5;
background-color: #c6c8ca;
}
.table-primary th,
.table-primary td,
.table-primary thead th,
.table-primary tbody + tbody {
border-color: #95c5ed;
border-color: #95999c;
}
.table-hover .table-primary:hover {
background-color: #b0d4f1;
background-color: #b9bbbe;
}
.table-hover .table-primary:hover > td,
.table-hover .table-primary:hover > th {
background-color: #b0d4f1;
background-color: #b9bbbe;
}
.table-secondary,
@ -6726,9 +6726,9 @@ pre code {
.form-control:focus {
color: #495057;
background-color: #fff;
border-color: #a1cbef;
border-color: #6d7a86;
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(52, 144, 220, 0.25);
box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.25);
}
.form-control::-moz-placeholder {
@ -7230,7 +7230,7 @@ textarea.form-control.is-invalid {
.btn:focus,
.btn.focus {
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(52, 144, 220, 0.25);
box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.25);
}
.btn.disabled,
@ -7249,43 +7249,43 @@ fieldset:disabled a.btn {
.btn-primary {
color: #fff;
background-color: #3490dc;
border-color: #3490dc;
background-color: #343a40;
border-color: #343a40;
}
.btn-primary:hover {
color: #fff;
background-color: #227dc7;
border-color: #2176bd;
background-color: #23272b;
border-color: #1d2124;
}
.btn-primary:focus,
.btn-primary.focus {
color: #fff;
background-color: #227dc7;
border-color: #2176bd;
box-shadow: 0 0 0 0.2rem rgba(82, 161, 225, 0.5);
background-color: #23272b;
border-color: #1d2124;
box-shadow: 0 0 0 0.2rem rgba(82, 88, 93, 0.5);
}
.btn-primary.disabled,
.btn-primary:disabled {
color: #fff;
background-color: #3490dc;
border-color: #3490dc;
background-color: #343a40;
border-color: #343a40;
}
.btn-primary:not(:disabled):not(.disabled):active,
.btn-primary:not(:disabled):not(.disabled).active,
.show > .btn-primary.dropdown-toggle {
color: #fff;
background-color: #2176bd;
border-color: #1f6fb2;
background-color: #1d2124;
border-color: #171a1d;
}
.btn-primary:not(:disabled):not(.disabled):active:focus,
.btn-primary:not(:disabled):not(.disabled).active:focus,
.show > .btn-primary.dropdown-toggle:focus {
box-shadow: 0 0 0 0.2rem rgba(82, 161, 225, 0.5);
box-shadow: 0 0 0 0.2rem rgba(82, 88, 93, 0.5);
}
.btn-secondary {
@ -7576,24 +7576,24 @@ fieldset:disabled a.btn {
}
.btn-outline-primary {
color: #3490dc;
border-color: #3490dc;
color: #343a40;
border-color: #343a40;
}
.btn-outline-primary:hover {
color: #fff;
background-color: #3490dc;
border-color: #3490dc;
background-color: #343a40;
border-color: #343a40;
}
.btn-outline-primary:focus,
.btn-outline-primary.focus {
box-shadow: 0 0 0 0.2rem rgba(52, 144, 220, 0.5);
box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.5);
}
.btn-outline-primary.disabled,
.btn-outline-primary:disabled {
color: #3490dc;
color: #343a40;
background-color: transparent;
}
@ -7601,14 +7601,14 @@ fieldset:disabled a.btn {
.btn-outline-primary:not(:disabled):not(.disabled).active,
.show > .btn-outline-primary.dropdown-toggle {
color: #fff;
background-color: #3490dc;
border-color: #3490dc;
background-color: #343a40;
border-color: #343a40;
}
.btn-outline-primary:not(:disabled):not(.disabled):active:focus,
.btn-outline-primary:not(:disabled):not(.disabled).active:focus,
.show > .btn-outline-primary.dropdown-toggle:focus {
box-shadow: 0 0 0 0.2rem rgba(52, 144, 220, 0.5);
box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.5);
}
.btn-outline-secondary {
@ -7865,12 +7865,12 @@ fieldset:disabled a.btn {
.btn-link {
font-weight: 400;
color: #3490dc;
color: #343a40;
text-decoration: none;
}
.btn-link:hover {
color: #1d68a7;
color: #121416;
text-decoration: underline;
}
@ -8176,7 +8176,7 @@ input[type=button].btn-block {
.dropdown-item:active {
color: #fff;
text-decoration: none;
background-color: #3490dc;
background-color: #343a40;
}
.dropdown-item.disabled,
@ -8539,22 +8539,22 @@ input[type=button].btn-block {
.custom-control-input:checked ~ .custom-control-label::before {
color: #fff;
border-color: #3490dc;
background-color: #3490dc;
border-color: #343a40;
background-color: #343a40;
}
.custom-control-input:focus ~ .custom-control-label::before {
box-shadow: 0 0 0 0.2rem rgba(52, 144, 220, 0.25);
box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.25);
}
.custom-control-input:focus:not(:checked) ~ .custom-control-label::before {
border-color: #a1cbef;
border-color: #6d7a86;
}
.custom-control-input:not(:disabled):active ~ .custom-control-label::before {
color: #fff;
background-color: #cce3f6;
border-color: #cce3f6;
background-color: #88939e;
border-color: #88939e;
}
.custom-control-input[disabled] ~ .custom-control-label,
@ -8606,8 +8606,8 @@ input[type=button].btn-block {
}
.custom-checkbox .custom-control-input:indeterminate ~ .custom-control-label::before {
border-color: #3490dc;
background-color: #3490dc;
border-color: #343a40;
background-color: #343a40;
}
.custom-checkbox .custom-control-input:indeterminate ~ .custom-control-label::after {
@ -8615,11 +8615,11 @@ input[type=button].btn-block {
}
.custom-checkbox .custom-control-input:disabled:checked ~ .custom-control-label::before {
background-color: rgba(52, 144, 220, 0.5);
background-color: rgba(52, 58, 64, 0.5);
}
.custom-checkbox .custom-control-input:disabled:indeterminate ~ .custom-control-label::before {
background-color: rgba(52, 144, 220, 0.5);
background-color: rgba(52, 58, 64, 0.5);
}
.custom-radio .custom-control-label::before {
@ -8631,7 +8631,7 @@ input[type=button].btn-block {
}
.custom-radio .custom-control-input:disabled:checked ~ .custom-control-label::before {
background-color: rgba(52, 144, 220, 0.5);
background-color: rgba(52, 58, 64, 0.5);
}
.custom-switch {
@ -8667,7 +8667,7 @@ input[type=button].btn-block {
}
.custom-switch .custom-control-input:disabled:checked ~ .custom-control-label::before {
background-color: rgba(52, 144, 220, 0.5);
background-color: rgba(52, 58, 64, 0.5);
}
.custom-select {
@ -8689,9 +8689,9 @@ input[type=button].btn-block {
}
.custom-select:focus {
border-color: #a1cbef;
border-color: #6d7a86;
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(52, 144, 220, 0.25);
box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.25);
}
.custom-select:focus::-ms-value {
@ -8754,8 +8754,8 @@ input[type=button].btn-block {
}
.custom-file-input:focus ~ .custom-file-label {
border-color: #a1cbef;
box-shadow: 0 0 0 0.2rem rgba(52, 144, 220, 0.25);
border-color: #6d7a86;
box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.25);
}
.custom-file-input[disabled] ~ .custom-file-label,
@ -8819,15 +8819,15 @@ input[type=button].btn-block {
}
.custom-range:focus::-webkit-slider-thumb {
box-shadow: 0 0 0 1px #f8fafc, 0 0 0 0.2rem rgba(52, 144, 220, 0.25);
box-shadow: 0 0 0 1px #f8fafc, 0 0 0 0.2rem rgba(52, 58, 64, 0.25);
}
.custom-range:focus::-moz-range-thumb {
box-shadow: 0 0 0 1px #f8fafc, 0 0 0 0.2rem rgba(52, 144, 220, 0.25);
box-shadow: 0 0 0 1px #f8fafc, 0 0 0 0.2rem rgba(52, 58, 64, 0.25);
}
.custom-range:focus::-ms-thumb {
box-shadow: 0 0 0 1px #f8fafc, 0 0 0 0.2rem rgba(52, 144, 220, 0.25);
box-shadow: 0 0 0 1px #f8fafc, 0 0 0 0.2rem rgba(52, 58, 64, 0.25);
}
.custom-range::-moz-focus-outer {
@ -8838,7 +8838,7 @@ input[type=button].btn-block {
width: 1rem;
height: 1rem;
margin-top: -0.25rem;
background-color: #3490dc;
background-color: #343a40;
border: 0;
border-radius: 1rem;
-webkit-transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
@ -8855,7 +8855,7 @@ input[type=button].btn-block {
}
.custom-range::-webkit-slider-thumb:active {
background-color: #cce3f6;
background-color: #88939e;
}
.custom-range::-webkit-slider-runnable-track {
@ -8871,7 +8871,7 @@ input[type=button].btn-block {
.custom-range::-moz-range-thumb {
width: 1rem;
height: 1rem;
background-color: #3490dc;
background-color: #343a40;
border: 0;
border-radius: 1rem;
-moz-transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
@ -8888,7 +8888,7 @@ input[type=button].btn-block {
}
.custom-range::-moz-range-thumb:active {
background-color: #cce3f6;
background-color: #88939e;
}
.custom-range::-moz-range-track {
@ -8907,7 +8907,7 @@ input[type=button].btn-block {
margin-top: 0;
margin-right: 0.2rem;
margin-left: 0.2rem;
background-color: #3490dc;
background-color: #343a40;
border: 0;
border-radius: 1rem;
-ms-transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
@ -8923,7 +8923,7 @@ input[type=button].btn-block {
}
.custom-range::-ms-thumb:active {
background-color: #cce3f6;
background-color: #88939e;
}
.custom-range::-ms-track {
@ -9050,7 +9050,7 @@ input[type=button].btn-block {
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
color: #fff;
background-color: #3490dc;
background-color: #343a40;
}
.nav-fill > .nav-link,
@ -9805,14 +9805,14 @@ input[type=button].btn-block {
padding: 0.5rem 0.75rem;
margin-left: -1px;
line-height: 1.25;
color: #3490dc;
color: #343a40;
background-color: #fff;
border: 1px solid #dee2e6;
}
.page-link:hover {
z-index: 2;
color: #1d68a7;
color: #121416;
text-decoration: none;
background-color: #e9ecef;
border-color: #dee2e6;
@ -9821,7 +9821,7 @@ input[type=button].btn-block {
.page-link:focus {
z-index: 3;
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(52, 144, 220, 0.25);
box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.25);
}
.page-item:first-child .page-link {
@ -9838,8 +9838,8 @@ input[type=button].btn-block {
.page-item.active .page-link {
z-index: 3;
color: #fff;
background-color: #3490dc;
border-color: #3490dc;
background-color: #343a40;
border-color: #343a40;
}
.page-item.disabled .page-link {
@ -9923,19 +9923,19 @@ a.badge:focus {
.badge-primary {
color: #fff;
background-color: #3490dc;
background-color: #343a40;
}
a.badge-primary:hover,
a.badge-primary:focus {
color: #fff;
background-color: #2176bd;
background-color: #1d2124;
}
a.badge-primary:focus,
a.badge-primary.focus {
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(52, 144, 220, 0.5);
box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.5);
}
.badge-secondary {
@ -10105,17 +10105,17 @@ a.badge-dark.focus {
}
.alert-primary {
color: #1b4b72;
background-color: #d6e9f8;
border-color: #c6e0f5;
color: #1b1e21;
background-color: #d6d8d9;
border-color: #c6c8ca;
}
.alert-primary hr {
border-top-color: #b0d4f1;
border-top-color: #b9bbbe;
}
.alert-primary .alert-link {
color: #113049;
color: #040505;
}
.alert-secondary {
@ -10254,7 +10254,7 @@ a.badge-dark.focus {
color: #fff;
text-align: center;
white-space: nowrap;
background-color: #3490dc;
background-color: #343a40;
transition: width 0.6s ease;
}
@ -10345,8 +10345,8 @@ a.badge-dark.focus {
.list-group-item.active {
z-index: 2;
color: #fff;
background-color: #3490dc;
border-color: #3490dc;
background-color: #343a40;
border-color: #343a40;
}
.list-group-item + .list-group-item {
@ -10519,20 +10519,20 @@ a.badge-dark.focus {
}
.list-group-item-primary {
color: #1b4b72;
background-color: #c6e0f5;
color: #1b1e21;
background-color: #c6c8ca;
}
.list-group-item-primary.list-group-item-action:hover,
.list-group-item-primary.list-group-item-action:focus {
color: #1b4b72;
background-color: #b0d4f1;
color: #1b1e21;
background-color: #b9bbbe;
}
.list-group-item-primary.list-group-item-action.active {
color: #fff;
background-color: #1b4b72;
border-color: #1b4b72;
background-color: #1b1e21;
border-color: #1b1e21;
}
.list-group-item-secondary {
@ -11533,14 +11533,14 @@ a.close.disabled {
}
.bg-primary {
background-color: #3490dc !important;
background-color: #343a40 !important;
}
a.bg-primary:hover,
a.bg-primary:focus,
button.bg-primary:hover,
button.bg-primary:focus {
background-color: #2176bd !important;
background-color: #1d2124 !important;
}
.bg-secondary {
@ -11669,7 +11669,7 @@ button.bg-dark:focus {
}
.border-primary {
border-color: #3490dc !important;
border-color: #343a40 !important;
}
.border-secondary {
@ -15267,12 +15267,12 @@ button.bg-dark:focus {
}
.text-primary {
color: #3490dc !important;
color: #343a40 !important;
}
a.text-primary:hover,
a.text-primary:focus {
color: #1d68a7 !important;
color: #121416 !important;
}
.text-secondary {

View file

@ -1,4 +1,4 @@
$theme-colors: (
/*"primary": #000, */
"primary": #343a40,
"danger": #ff4136
);

View file

@ -51,7 +51,7 @@
@auth
@if(Auth::user()->role !='GUEST')
<li class="nav-item" style="font-size:1.5rem" >
<a class="nav-link {{ Request::is('memberlist') ? 'active' : '' }}" href="/memberlist">Mitgliederliste</a>
<a class="nav-link {{ Request::is('member') ? 'active' : '' }}" href="/member">Mitgliederliste</a>
</li>
<li class="nav-item" style="font-size:1.5rem">
<a class="nav-link {{ Request::is('tourplan') ? 'active' : '' }}" href="/tourplan">Tourenplan</a>

View file

@ -4,17 +4,17 @@
<div class="container text-center text-light mt-5">
<h1 class="text-center">{{$user->name}}</h1>
<form style="background-color: #fff;" class="text-dark" method="POST" action="/store_user">
<form style="background-color: #fff;" class="text-dark" method="GET" action="/member">
{{ csrf_field() }}
<div class="form-group" style="display:flex;">
<label class="ml-2 mt-4" style="width:150px; text-align:left;" for="name"><h4>Vorname:</h4></label>
<input class="mt-3 mr-2 form-control" type="text" id="name" style="font-size:20px;" name="firstname" value="{{ $user->name }}"required>
<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="{{ $user->name }}" required >
</div>
<div class="form-group" style="display:flex;">
<label class="ml-2 mt-4" style="width:150px; text-align:left;" for="name" ><h4>Nachname:</h4></label>
<input type="text" class="mt-3 mr-2 form-control" id="lastname" style="font-size:20px;" name="lastname" required>
<label class="ml-2 mt-4" style="width:150px; text-align:left;" for="name" ><h4>EMail:</h4></label>
<input type="text" class="mt-3 mr-2 form-control" id="lastname" style="font-size:20px;" name="email" value="{{ $user->email }}" required >
</div>
<div class="form-group" style="display:flex;">
@ -30,11 +30,16 @@
<a class="dropdown-item" href="#">ADMIN</a>
</div>
</div>
</div>
<div class="form-group text-light">
<button type="submit" class="btn btn-primary mb-2">Speichern</button>
</div>
@if($user->role=="ADMIN")
<a href="#" class="btn btn-danger col-2 mb-2 float-right mr-2">Speichern</a>
@endif
<a href="/member" class="btn btn-primary col-2 mb-2 float-left">Abbrechen</a>
</form>

View file

@ -5,10 +5,10 @@
<h1 class="text-center">Mitgliederliste</h1>
<div class="container text-primary">
.<ul class="list-group offset-3 col-6">
<ul class="list-group offset-3 col-6">
@foreach($users as $user)
<li class="list-group-item d-flex justify-content-between align-items-center">
{{$user->name}},{{$user->id}}
<a href="/member/{{$user->id}}" class="list-group-item d-flex justify-content-between align-items-center">
{{$user->name}}
@if($user->role=='ADMIN')
<span class="badge badge-danger badge-pill">Admin</span>
@elseif($user->role=='MEMBER')
@ -16,7 +16,7 @@
@else
<span class="badge badge-warning badge-pill">Gast</span>
@endif
</li>
</a>
@endforeach
</ul>
</div>

View file

@ -0,0 +1,43 @@
@extends('layouts.app')
@section('content')
<div class="container text-center text-light mt-5">
<h1 class="text-center">{{$user->name}}</h1>
<form style="background-color: #fff;" class="text-dark" method="GET" action="/member">
{{ csrf_field() }}
<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="{{ $user->name }}" required readonly>
</div>
<div class="form-group" style="display:flex;">
<label class="ml-2 mt-4" style="width:150px; text-align:left;" for="name" ><h4>EMail:</h4></label>
<input type="text" class="mt-3 mr-2 form-control" id="lastname" style="font-size:20px;" name="email" value="{{ $user->email }}" required readonly>
</div>
<div class="form-group" style="display:flex;">
<label class="ml-2 mt-4" style="width:130px; text-align:left;" for="name" ><h4>Rolle:</h4></label>
<div class="dropdown mt-3">
<button class="btn btn-secondary dropdown-toggle bg-light text-dark" type="button" id="dropdownMenuButton" data-toggle="" aria-haspopup="true" aria-expanded="false">
{{$user->role}}
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#">GUEST</a>
<a class="dropdown-item" href="#">MEMBER</a>
<a class="dropdown-item" href="#">ADMIN</a>
</div>
</div>
</div>
@if($user->role=="ADMIN")
<a href="/member/{{$user->id}}/edit" class="btn btn-danger col-2 mb-2 float-right mr-2">Bearbeiten</a>
@endif
<a href="/member" class="btn btn-primary col-2 mb-2 float-left">Zurück</a>
</form>
</div>
@endsection

View file

@ -22,8 +22,12 @@ Route::get('/become_member', function () { return view('become_member'); });
Route::get('/meetings', function () { return view('meetings'); });
Route::get('/tourplan', function () { return view('tourplan'); });
Route::get('/memberlist','UserController@index');
Route::get('/member/{user_id}','UserController@show');
//Route::get('/memberlist','UserController@index');
//Route::get('/member/{user_id}','UserController@show');
Route::resource('/member',UserController::class);
Auth::routes();