@extends('layouts.app')

@section('content')
    <div class="container mt-3"> 
        <div class="d-flex flex-column align-items-center">

            <div class="col-md-10 col-sm-10 col-lg-10">
                @if (session('success'))
                    <div class="alert alert-success">
                        {!! session('success') !!}
                    </div>
                @endif
            </div>

            <div class="col-md-10 col-sm-10 col-lg-10">
                <div class="row">
                    <div class="col-6 d-flex align-items-center">
                        <h5 class="text-center">Add User</h5> 
                    </div>
                    <div class="col-6 d-flex justify-content-end">
                        <a href="{{route('user.index')}}" class="btn btn-secondary" >Back</a>
                    </div>
                </div>
            </div>
            
            <div class="col-md-10 col-sm-10 col-lg-10">
            <hr>
            </div>

            <div class="col-md-10 col-sm-10 col-lg-10">
                <form method="post" action ="{{route('user.store')}}"> 
                    @csrf 
                    @method('post')
                    <div class="mb-3"> 
                        <label><b>Name:</b></label> 
                        <input type="text" name="name" class="form-control @error('name') is-invalid @enderror"> 
                        @error('name')
                    <span class="invalid-feedback" role="alert">
                        <strong>{{ $message }}</strong>
                    </span>
                    @enderror
                    </div> 
                    <div class="mb-3"> 
                        <label><b>Email:</b></label> 
                        <input type="text" name="email" class="form-control @error('name') is-invalid @enderror">
                        @error('name')
                    <span class="invalid-feedback" role="alert">
                        <strong>{{ $message }}</strong>
                    </span>
                    @enderror 
                    </div> 
                    <div class="mb-3"> 
                        <label><b>Password:</b></label> 
                        <input type="password" name="password" class="form-control @error('name') is-invalid @enderror"> 
                        @error('name')
                    <span class="invalid-feedback" role="alert">
                        <strong>{{ $message }}</strong>
                    </span>
                    @enderror 
                    </div> 
                    <div class="mb-3"> 
                        <label><b>Role:</b></label> 
                        <select class="form-control @error('name') is-invalid @enderror" id="exampleFormControlSelect1" name="type">
                        @error('name')
                    <span class="invalid-feedback" role="alert">
                        <strong>{{ $message }}</strong>
                    </span>
                    @enderror 
                            <option>Choose from the following---------</option>
                            <option value="admin">Admin</option>
                            <option value="user">User</option>
                        </select>
                    </div> 
                    <button type="submit" class="btn btn-primary btn-block">Submit</button>
                </form> 
            </div> 
        </div>
    </div>
@endsection









  