@extends('Shop.layout.layout', [
    'title' => __('Editer son profil'),
])

@section('content')
    {{ Form::open([
        'route' => 'Shop.Customers.store',
        'id' => 'customer-form',
        'autocomplete' => 'off',
        'files' => true,
    ]) }}

    <input type="hidden" name="id" id="id" value="{{ $customer['id'] ?? null }}">

    <div class="row mb-3">
        <div class="col-6">
            <x-card title="Mes coordonnées" class="gradient-green1">
                @include('Shop.Customers.partials.registration')
            </x-card>
        </div>
        <div class="col-6">
            <x-card title="Mes adresses de livraison" class="gradient-green1 mb-3">
                @include('Shop.Customers.partials.addresses', [
                    'prefix' => 'deliveries',
                    'addresses' => $customer['delivery_addresses'],
                    'with_name' => true,
                    'selected' => $customer['delivery_address_id'] ?? null,
                ])
            </x-card>

            <x-card title="Mes adresses de facturation" class="gradient-green1 mb-3">
                @include('Shop.Customers.partials.addresses', [
                    'prefix' => 'invoices',
                    'addresses' => $customer['invoice_addresses'],
                    'with_name' => true,
                    'selected' => $customer['invoice_address_id'] ?? null,
                ])
            </x-card>

            <x-card title="Mon mot de passe" class="gradient-green1">
                @include('Shop.auth.passwords.password_confirmation')
            </x-card>
        </div>
    </div>
    </form>
    <x-save />
@endsection

@include('load.form.save')
@include('load.layout.modal')

@push('js')
    <script>
        $(function() {
            initSaveForm('#customer-form');
        });
    </script>
@endpush
