@extends('layouts.app')

@section('title', 'Add team member')
@section('heading', 'Add team member')

@section('content')
    <div class="card" style="max-width: 32rem">
        <form method="POST" action="{{ route('team.store') }}">
            @csrf
            <div class="form-group">
                <label for="name">Name</label>
                <input id="name" class="form-control" name="name" value="{{ old('name') }}" required maxlength="255">
            </div>
            <div class="form-group">
                <label for="email">Email</label>
                <input id="email" class="form-control" type="email" name="email" value="{{ old('email') }}" required maxlength="255">
            </div>
            <div class="form-group">
                <label for="password">Password</label>
                <input id="password" class="form-control" type="password" name="password" required autocomplete="new-password">
            </div>
            <div class="form-group">
                <label for="password_confirmation">Confirm password</label>
                <input id="password_confirmation" class="form-control" type="password" name="password_confirmation" required autocomplete="new-password">
            </div>
            <div class="form-group">
                <label for="role">Role</label>
                <select id="role" class="form-control" name="role" required>
                    @foreach ($roles as $r)
                        <option value="{{ $r }}" @selected(old('role') === $r)>{{ $r }}</option>
                    @endforeach
                </select>
            </div>
            <button type="submit" class="btn btn-primary">Create</button>
            <a href="{{ route('team.index') }}" class="btn btn-ghost">Cancel</a>
        </form>
    </div>
@endsection
