@extends('agency.layouts.app')
@section('title', 'Satış Düzenle – ' . $sale->sale_code)
@section('page_title', 'Satış Düzenle')

@include('agency.sales.edit.styles')

@section('content')
    <div class="container-fluid">

        <div class="d-flex align-items-center gap-2 mb-3" style="font-size:.83rem;color:#94a3b8">
            <a href="{{ route('agency.sales.index') }}" style="color:#6366f1;text-decoration:none;font-weight:600"><i
                    class="fas fa-shopping-bag me-1"></i>Satışlar</a>
            <i class="fas fa-chevron-right" style="font-size:10px"></i>
            <a href="{{ route('agency.sales.show', $sale) }}"
                style="color:#6366f1;text-decoration:none;font-weight:600">{{ $sale->sale_code }}</a>
            <i class="fas fa-chevron-right" style="font-size:10px"></i>
            <span style="color:#0f172a;font-weight:600">Düzenle</span>
        </div>

        @if($errors->any())
            <div class="alert alert-danger border-0 shadow-sm mb-3" style="border-radius:12px;font-size:.85rem">
                <ul class="mb-0 ps-3">@foreach($errors->all() as $e)<li>{{ $e }}</li>@endforeach</ul>
            </div>
        @endif
        @if(session('success'))
            <div class="alert alert-success border-0 mb-3" style="border-radius:12px;font-size:.85rem"><i
                    class="fas fa-check-circle me-2"></i>{{ session('success') }}</div>
        @endif

        <form method="POST" action="{{ route('agency.sales.update', $sale) }}" id="resForm">
            @csrf @method('PUT')

            <div class="form-wrap">
                <div class="row g-4">
                    <div class="col-lg-8">
                        @include('agency.sales.edit.product_type')
                        @include('agency.sales.edit.product_selection')
                        @include('agency.sales.edit.customer_selection')
                        @include('agency.sales.edit.date_selection')
                        @include('agency.sales.edit.counts_and_locations')
                        @include('agency.sales.edit.passenger_forms')
                        @include('agency.sales.edit.extra_fields')
                        @include('agency.sales.edit.notes')
                    </div>{{-- col-lg-8 --}}

                    <div class="col-lg-4">
                        @include('agency.sales.edit.sidebar')
                    </div>{{-- col-lg-4 --}}
                </div>{{-- row --}}

                <div class="form-footer mt-4">
                    <a href="{{ route('agency.sales.show', $sale) }}" class="btn btn-outline-secondary"
                        style="border-radius:10px;padding:.6rem 1.5rem">İptal</a>
                    <button type="submit" class="btn text-white fw-bold shadow-sm"
                        style="background:linear-gradient(135deg,#6366f1,#8b5cf6);border-radius:11px;padding:.6rem 2.5rem;min-width:180px">
                        <i class="fas fa-save me-2"></i>Değişiklikleri Kaydet
                    </button>
                </div>

            </div>
        </form>
    </div>
@endsection

@include('agency.sales.edit.scripts')
