<div>
    <x-title>
        Edit {{ $first_name }} {{ $last_name }}

        <x-slot name="buttons">
            <a wire:navigate href="{{ route('clients.show', $client) }}" class="btn btn-primary btn-md">
                Back
            </a>
        </x-slot>
    </x-title>

    <div class="row">
        <div class="col-md-8">

            <form wire:submit.prevent="save" class="card shadow-sm mb-4">
                <div class="card-body">

                    @if (session()->has('errors'))
                        <div class="alert alert-warning">
                            {{ session('errors') }}
                        </div>
                    @endif

                    <div class="row">
                        <div class="col-md-12 mb-3">
                            <x-ui.input
                                    name="title"
                                    label="Title"
                            />
                        </div>

                        <div class="col-md-4">
                            <x-ui.input
                                    name="first_name"
                                    label="First Name"
                            />
                        </div>

                        <div class="col-md-4">
                            <x-ui.input
                                    name="middle_name"
                                    label="Middle Name"
                            />
                        </div>

                        <div class="col-md-4">
                            <x-ui.input
                                    name="last_name"
                                    label="Last Name"
                            />
                        </div>
                    </div>

                    <div class="mb-3">
                        <x-ui.input name="preferred_name" label="Preferred Name"/>
                    </div>
                    <div class="row">
                        <div class="col-md-3 mb-3">
                            <x-ui.input
                                    type="date"
                                    name="dob"
                                    label="Date of Birth"
                            />
                        </div>

                        <div class="col-md-3 mb-3">
                            <x-ui.input
                                    type="email"
                                    name="email"
                                    label="Email Address"
                            />
                        </div>

                        <div class="col-md-3 mb-3">
                            <x-ui.input
                                    name="phone"
                                    label="Phone Number"
                                    placeholder="07xxxxxxxxx"
                            />
                        </div>

                        <div class="col-md-3 mb-3">
                            <x-ui.input
                                name="landline"
                                label="Landline Number"
                                placeholder="01511234567"
                            />
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-md-6">
                            <x-ui.select :options="$lead_sources" name="lead_source_id" label="Lead Provider"/>
                        </div>

                        <div class="col-md-6">
                            <x-ui.select :options="$tranches" name="tranche_id" label="Funding Tranche"/>
                        </div>
                    </div>
                </div>


                <div class="card-footer text-end">
                    <button class="btn btn-success">
                        Save
                    </button>
                </div>
            </form>
        </div>
        <div class="col-md-4">
            <livewire:client.previous-name-manager :client="$client"/>
            <livewire:client.handler-manager :client="$client"/>
        </div>
    </div>
</div>