@extends('layouts.app')

@section('content')
    <div class="px-3">
        <div class="col-xxl-6 offset-xxl-2">
            <form action="{{ route('user.store') }}" method="post">
                @csrf

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

                @include('partials.input', ['name' => 'email',
                                            'type' => 'email',
                                            'title' => ($user && $user->email_verified_at) ? 'Email подтверждён' : 'Email',
                                            'required' => true,
                                            'value' => $user->email ?? '',
                                            'disabled' => ($user && $user->email_verified_at),
                                            ])
                @include('partials.input', ['name' => 'name', 'title' => 'Имя', 'required' => true, 'value' => $user->name ?? ''])
                @include('partials.input', ['name' => 'phone', 'title' => 'Телефон', 'value' => $user->phone ?? ''])

{{--                @include('partials.avatars', ['user' => $user])--}}
                @include('partials.input', ['name' => 'password', 'type' => 'password', 'title' => 'Пароль'])

                @include('partials.select', ['name' => 'role', 'title' => 'Роль', 'options' => getRoles(), 'value' => $user->role ?? \App\Models\Role::MANAGER])

                @include('partials.submit')
            </form>
        </div>
    </div>
@endsection
