@extends('layouts.layout-2')

@section('content')

    @if ($errors->any())
        <div class="row">
            <div class="col-sm-12">
                <div class="alert alert-danger">
                    <ul>
                        @foreach ($errors->all() as $error)
                            <li>{{ $error }}</li>
                        @endforeach
                    </ul>
                </div>
            </div>
        </div>
    @endif


    {!! Form::open(['url' => route('admin_user_store'), 'class' => 'form-horizontal']) !!}

    <h4 class="font-weight-bold py-3 mb-1">
        User @if($user->id == "new") <span class="text-primary">anlegen</span> @else {{"(ID: ".$user->id.")"}} verwalten @endif
        <div class="float-right">
            <button type="submit" name="action" value="saveAll" class="btn btn-submit btn-sm">{{ __('save changes') }}</button>&nbsp;
            <a href="{{route('admin_users')}}" class="btn btn-default btn-sm">{{ __('back') }}</a>
        </div>
    </h4>
    <div class="clearfix"></div>

        <input type="hidden" name="user_id" id="user_id" value="@if($user->id>0){{$user->id}}@else new @endif">

    @include('admin.user_form')
    <div class="text-left mt-3">
        <button type="submit" class="btn btn-submit">{{ __('save') }}</button>&nbsp;
        <a href="{{ route('admin_users') }}" class="btn btn-default">{{ __('abort') }}</a>
    </div>


    {!! Form::close() !!}


@endsection