{{ Form::open(['route' => 'Admin.Shop.Invoices.update', 'id' => 'invoice-form', 'autocomplete' => 'off']) }}
<input type="hidden" name="id" id="id" value="{{ $invoice['id'] ?? false }}">
<div class="row">
    <div class="col-9">
        <h5>
            <a href="{{ route('Admin.Shop.Orders.edit', ['id' => $invoice['order_id']]) }}" class="btn btn-success">
                <i class="fa fa-fw fa-truck"></i>
            </a>
            Facture N° {{ $invoice['ref'] }}
            <span class="small">
                du {{ Carbon\Carbon::parse($invoice['created_at'])->isoFormat('LLLL') }}
            </span>
        </h5>
    </div>
    <div class="col-3 text-right">
        <x-save />
    </div>
</div>

<div class="row mb-3">
    <div class="col-6">
        <h5>
            @if ($invoice['order']['customer']['company'])
                Société : {{ $invoice['order']['customer']['company'] }}<br />
            @endif
            {{ $invoice['order']['customer']['first_name'] }}
            {{ $invoice['order']['customer']['last_name'] }}
        </h5>

        @if ($invoice['order']['delivery_address'])
            <x-card title="Adresse de facturation" classBody="mt-3">
                @include('components.address-view', [
                    'address' => $invoice['order']['delivery_address'],
                ])
            </x-card>
        @endif
    </div>
    <div class="col-6">
        <div class="row mb-3">
            <div class="col-6">
                @include('components.form.select', [
                    'label' => 'Statut',
                    'name' => 'status',
                    'list' => $statuses ?? [],
                    'value' => $invoice['status'],
                    'class' => 'select2',
                ])
            </div>
            <div class="col-6">
            </div>
        </div>
        <x-card class="bg-darker">
            @include('Admin.Shop.Invoices.partials.payments', [
                'payments' => $invoice['payments'] ?? false,
            ])
        </x-card>
    </div>
</div>
<div class="row mb-3">
    <div class="col-12">
        @include('Admin.Shop.Orders.partials.detail', [
            'detail_type' => 'facture',
            'order' => $invoice['order'] ?? null,
        ])
    </div>
</div>
</form>

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