@extends('Templates/templateAdmin')

@section('Main-content')

    <section class="content">
        <div class="container-fluid">
            {{-- <h1>Editar dados do {{$user->name }}</h1>
            <div class="card">
                <div class="card-header">
                    Detalhes do usuário :: {{ $user->name }}</div>
                <div class="card-body">
                    <div class="row">
                        <div class="col-sm">
                            <input type="text">
                        </div>

                        <div class="col-sm">
                            <input type="text">

                        </div>
                    </div>


                </div>
                <div class="row">
                    <div class="col-sm">
                    </div>
                    <div class="col-sm">
                        <button class="btn btn-primary">Editar</button>
                    </div>
                </div>
                
            </div> --}}

<br><br>
            <div class="container">
                <div class="row">
                    <div class="col-md-8 col-md-offset-2">
                        <div class="card">
                            <div class="card-header">Editar Usuário</div>
                            <div class="card-body">
                                <form action="{{ route('users.update', $user->user_id) }}" method="POST">
                                    @csrf
                                    @method('PUT')
            
                                    <div class="form-group">
                                        <label for="name">Nome:</label>
                                        <input type="text" class="form-control" id="name" name="name" value="{{ $user->user_name }}" required>
                                    </div>
            
                                    <div class="form-group">
                                        <label for="email">Email:</label>
                                        <input type="email" class="form-control" id="email" name="email" value="{{ $user->email }}" required>
                                    </div>
            
                                    <div class="form-group">
                                        <label for="password">Senha:</label>
                                        <input type="password" class="form-control" id="password" name="password" placeholder="Deixe em branco para não alterar">
                                    </div>
            
                                    <div class="form-group">
                                        <label for="password_confirmation">Confirme a senha:</label>
                                        <input type="password" class="form-control" id="password_confirmation" name="password_confirmation">
                                    </div>
            
                                    <div class="form-group">
                                        <label for="user_type">Tipo de Usuário:</label>
                                        <select class="form-control" id="user_type" name="user_type" required>
                                            <option value="Super_Administrador" {{ $user->user_type == 'Super_Administrador' ? 'selected' : '' }}>Super Administrador</option>
                                            <option value="Administrador" {{ $user->user_type == 'Administrador' ? 'selected' : '' }}>Administrador</option>
                                            <option value="Utilizador" {{ $user->user_type == 'Utilizador' ? 'selected' : '' }}>Utilizador</option>
                                        </select>
                                    </div>
            
                                    <div class="form-group">
                                        <label for="user_phone">Telemóvel:</label>
                                        <input type="text" class="form-control" id="user_phone" name="user_phone" value="{{ $user->user_phone }}" required>
                                    </div>
            
                                    <div class="form-group">
                                        <label for="user_nif">NIF:</label>
                                        <input type="text" class="form-control" id="user_nif" name="user_nif" value="{{ $user->user_nif }}" required>
                                    </div>
            
                                    <button type="submit" class="btn btn-primary">Salvar</button>
                                    <a href="{{ route('users.list') }}" class="btn btn-secondary">Cancelar</a>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>











        </div>
        {{-- ./container-fluid --}}
    </section>
    {{-- /.content --}}




@endsection
