<div class="col-6 float-left text-right">
    <h1>
        @lang('admin.orders.order')
        @lang('admin.orders.statuses.' . $order->payment_status)
    </h1>
    <div class="invoice-details mt-2">
        <h6>@lang('admin.orders.order_number', ['number' => $order->id])</h6>

        <h6 class="mt-2">@lang('admin.orders.date')</h6>
        <p>{{ date('H:i - d.m.Y', strtotime($order->created_at)) }}</p>

        <h6 class="mt-2">@lang('admin.orders.payment_system')</h6>
        <p>@lang('admin.orders.payment_type.' . $order->payment_type)</p>

        <h6 class="mt-2">@lang('admin.orders.delivery_type')</h6>
        <p>@lang('admin.orders.type_delivery.' . $order->delivery_type)</p>

        <h6 class="mt-2">@lang('admin.orders.with_installation')</h6>
        <p>@lang('admin.orders.with_installations.' . $order->with_installation)</p>

        <h6 class="mt-2">@lang('admin.orders.with_didox')</h6>
        <p>@lang('admin.orders.with_installations.' . $order->with_didox)</p>

        <h6 class="mt-2">@lang('admin.orders.payment_status')</h6>
        <div class="btn-group dropleft mb-1">
            @php
                // Mapping order statuses to button classes
                $statusClasses = [
                    'payed' => 'btn-success',
                    'cancelled' => 'btn-danger',
                    'waiting' => 'btn-warning',
                    'review' => 'btn-warning',
                ];

                // Get the class for the current status or set a default class
                $buttonClass = $statusClasses[$order->payment_status] ?? 'btn-secondary';
            @endphp
            <button type="button" class="btn {{ $buttonClass }} dropdown-toggle waves-effect waves-light"
                data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                @lang('admin.orders.statuses.' . $order->payment_status)
            </button>
            <div class="dropdown-menu" x-placement="left-start"
                style="position: absolute; transform: translate3d(-147px, 0px, 0px); top: 0px; left: 0px; will-change: transform;">
                @foreach (App\Models\Order::paymentStatuses() as $status)
                    <a class="dropdown-item" onclick="return confirm('Вы действительно хотите изменить статус')"
                        href="{{ route('dashboard.orders.change-payment-status', ['order' => $order, 'status' => $status]) }}">
                        @lang('admin.statuses.' . $status)
                    </a>
                @endforeach
            </div>
        </div>

        <h6 class="mt-2">@lang('admin.orders.status')</h6>
        <div class="btn-group dropleft mb-1">
            @php
                // Mapping order statuses to button classes
                $statusClasses = [
                    'delivered' => 'btn-success',
                    'cancelled' => 'btn-danger',
                    'processing' => 'btn-primary',
                    'waiting' => 'btn-warning',
                ];

                // Get the class for the current status or set a default class
                $buttonClass = $statusClasses[$order->status] ?? 'btn-secondary';
            @endphp
            <button type="button" class="btn {{ $buttonClass }} dropdown-toggle waves-effect waves-light"
                data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                @lang('admin.orders.statuses.' . $order->status)
            </button>
            <div class="dropdown-menu" x-placement="left-start"
                style="position: absolute; transform: translate3d(-147px, 0px, 0px); top: 0px; left: 0px; will-change: transform;">
                @foreach (App\Models\Order::statuses() as $status)
                    <a class="dropdown-item" onclick="return confirm('Вы действительно хотите изменить статус')"
                        href="{{ route('dashboard.orders.change-status', ['order' => $order, 'status' => $status]) }}">
                        @lang('admin.statuses.' . $status)
                    </a>
                @endforeach
            </div>
        </div>
    </div>
</div>
