@extends('backend.layouts.app')

@section('title')
    Complaint Details - Hotel Management System
@endsection

@section('content')
    <!-- Breadcrumb -->
    <div class="bg-white shadow-sm border-b border-gray-200 px-6 py-4">
        <div class="flex items-center justify-between">
            <div class="flex items-center text-sm text-gray-600">
                <i class="fas fa-comment mr-2"></i>
                <span>/ <a href="{{ route('complaints.index') }}" class="text-blue-600 hover:text-blue-800">Complaints</a> / Complaint Details</span>
            </div>
            <div class="flex space-x-3">
                @can('edit-complaints')
                <a href="{{ route('complaints.edit', $complaint) }}" class="inline-flex items-center px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors">
                    <i class="fas fa-edit mr-2"></i>
                    Edit
                </a>
                @endcan
                @can('delete-complaints')
                <form action="{{ route('complaints.destroy', $complaint) }}" method="POST" class="inline" onsubmit="return confirm('Are you sure you want to delete this complaint?')">
                    @csrf
                    @method('DELETE')
                    <button type="submit" class="inline-flex items-center px-4 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 transition-colors">
                        <i class="fas fa-trash mr-2"></i>
                        Delete
                    </button>
                </form>
                @endcan
            </div>
        </div>
    </div>

    <!-- Content -->
    <div class="p-6">
        <!-- Header -->
        <div class="mb-6">
            <div class="flex items-center justify-between">
                <div>
                    <h1 class="text-3xl font-bold text-gray-900 mb-2">Complaint Details</h1>
                    <p class="text-gray-600">View and manage complaint information</p>
                </div>
                <div class="text-right">
                    <div class="text-sm text-gray-500">Complaint ID</div>
                    <div class="text-lg font-semibold text-gray-900">#{{ $complaint->id }}</div>
                </div>
            </div>
        </div>

        <!-- Complaint Information -->
        <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
            <!-- Main Details -->
            <div class="lg:col-span-2">
                <div class="bg-white rounded-lg shadow-md p-6">
                    <h3 class="text-lg font-semibold text-gray-900 mb-4">Complaint Information</h3>
                    
                    <div class="space-y-4">
                        <div>
                            <label class="block text-sm font-medium text-gray-700">Complainant Name</label>
                            <p class="mt-1 text-lg text-gray-900">{{ $complaint->complainant_name }}</p>
                        </div>
                        
                        <div>
                            <label class="block text-sm font-medium text-gray-700">Complaint Type</label>
                            <span class="inline-flex px-3 py-1 text-sm font-semibold rounded-full bg-blue-100 text-blue-800 mt-1">
                                {{ $complaint->complaint_type }}
                            </span>
                        </div>
                        
                        <div>
                            <label class="block text-sm font-medium text-gray-700">Description</label>
                            <div class="mt-1 p-3 bg-gray-50 rounded-lg">
                                <p class="text-gray-900">{{ $complaint->complaint }}</p>
                            </div>
                        </div>
                        
                        <div>
                            <label class="block text-sm font-medium text-gray-700">Status</label>
                            <div class="mt-1">
                                @if($complaint->resolve_status)
                                    <span class="inline-flex px-3 py-1 text-sm font-semibold rounded-full bg-green-100 text-green-800">
                                        <i class="fas fa-check mr-2"></i>Resolved
                                    </span>
                                @else
                                    <span class="inline-flex px-3 py-1 text-sm font-semibold rounded-full bg-yellow-100 text-yellow-800">
                                        <i class="fas fa-clock mr-2"></i>Pending
                                    </span>
                                @endif
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Sidebar Information -->
            <div class="lg:col-span-1">
                <!-- Timestamps -->
                <div class="bg-white rounded-lg shadow-md p-6 mb-6">
                    <h3 class="text-lg font-semibold text-gray-900 mb-4">Timeline</h3>
                    <div class="space-y-3">
                        <div>
                            <div class="text-sm text-gray-500">Submitted</div>
                            <div class="text-sm font-medium text-gray-900">{{ $complaint->created_at->format('M d, Y') }}</div>
                            <div class="text-xs text-gray-500">{{ $complaint->created_at->format('H:i') }}</div>
                        </div>
                        
                        @if($complaint->resolve_date)
                        <div class="pt-3 border-t border-gray-200">
                            <div class="text-sm text-gray-500">Resolved</div>
                            <div class="text-sm font-medium text-green-600">{{ $complaint->resolve_date->format('M d, Y') }}</div>
                            <div class="text-xs text-gray-500">{{ $complaint->resolve_date->format('H:i') }}</div>
                        </div>
                        @endif
                    </div>
                </div>

                <!-- Budget Information -->
                <div class="bg-white rounded-lg shadow-md p-6">
                    <h3 class="text-lg font-semibold text-gray-900 mb-4">Budget</h3>
                    @if($complaint->budget)
                        <div class="text-center">
                            <div class="text-3xl font-bold text-green-600">${{ number_format($complaint->budget, 2) }}</div>
                            <div class="text-sm text-gray-500">Estimated Budget</div>
                        </div>
                    @else
                        <div class="text-center text-gray-500">
                            <i class="fas fa-dollar-sign text-2xl mb-2"></i>
                            <div class="text-sm">No budget set</div>
                        </div>
                    @endif
                </div>
            </div>
        </div>

        <!-- Action Buttons -->
        <div class="mt-8 flex justify-center space-x-4">
            <a href="{{ route('complaints.index') }}" 
               class="px-6 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition-colors">
                <i class="fas fa-arrow-left mr-2"></i>
                Back to List
            </a>
            
            @can('edit-complaints')
            <a href="{{ route('complaints.edit', $complaint) }}" 
               class="px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors">
                <i class="fas fa-edit mr-2"></i>
                Edit Complaint
            </a>
            @endcan
        </div>
    </div>
@endsection 