

<?php $__env->startSection('admin'); ?>
<div class="flex flex-col h-full">
    <!-- Header -->
    <div class="mb-8">
        <div class="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4">
            <div>
                <h1 class="text-2xl md:text-3xl font-bold text-gray-900 dark:text-white">Request Details</h1>
                <div class="mt-2 inline-flex items-center gap-2 text-sm bg-gradient-to-r from-blue-500 to-blue-600 text-white px-4 py-1 rounded-full">
                    <i class="fas fa-file-alt text-xs"></i>
                    <span>ID: <?php echo e($serviceRequest->id); ?></span>
                </div>
            </div>
            <div class="flex items-center gap-3">
                <a href="<?php echo e(route('admin.service-requests.edit', $serviceRequest)); ?>" 
                   class="inline-flex items-center gap-2 bg-gradient-to-r from-green-500 to-green-600 text-white px-4 py-2 rounded-lg 
                          hover:from-green-600 hover:to-green-700 active:scale-[0.98] transition-all shadow-sm hover:shadow">
                    <i class="fas fa-edit text-sm"></i>
                    Edit
                </a>
                <a href="<?php echo e(route('admin.service-requests.index')); ?>" 
                   class="inline-flex items-center gap-2 border border-gray-200 dark:border-gray-700 text-gray-700 dark:text-gray-300 
                          px-4 py-2 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors">
                    <i class="fas fa-arrow-left text-sm"></i>
                    Back
                </a>
            </div>
        </div>
    </div>

    <!-- Main Content Grid -->
    <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
        <!-- Left Column (2/3) -->
        <div class="lg:col-span-2 space-y-6">
            <!-- Contact Information -->
            <div class="bg-white dark:bg-gray-800 rounded-xl border border-gray-100 dark:border-gray-700/50 shadow-sm p-5">
                <h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2">
                    <div class="w-8 h-8 rounded-lg bg-blue-50 dark:bg-blue-900/20 flex items-center justify-center">
                        <i class="fas fa-user text-blue-500 dark:text-blue-400 text-sm"></i>
                    </div>
                    Contact Information
                </h3>
                <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                    <div class="space-y-1">
                        <p class="text-sm font-medium text-gray-500 dark:text-gray-400">Full Name</p>
                        <p class="text-gray-900 dark:text-white"><?php echo e($contactInfo['name'] ?? 'N/A'); ?></p>
                    </div>
                    <div class="space-y-1">
                        <p class="text-sm font-medium text-gray-500 dark:text-gray-400">Email</p>
                        <p class="text-gray-900 dark:text-white"><?php echo e($contactInfo['email'] ?? 'N/A'); ?></p>
                    </div>
                    <div class="space-y-1">
                        <p class="text-sm font-medium text-gray-500 dark:text-gray-400">Phone</p>
                        <p class="text-gray-900 dark:text-white"><?php echo e($contactInfo['phone'] ?? 'N/A'); ?></p>
                    </div>
                    <div class="space-y-1">
                        <p class="text-sm font-medium text-gray-500 dark:text-gray-400">Company</p>
                        <p class="text-gray-900 dark:text-white"><?php echo e($contactInfo['company'] ?? 'N/A'); ?></p>
                    </div>
                </div>
            </div>

            <!-- Business Information -->
            <div class="bg-white dark:bg-gray-800 rounded-xl border border-gray-100 dark:border-gray-700/50 shadow-sm p-5">
                <h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2">
                    <div class="w-8 h-8 rounded-lg bg-green-50 dark:bg-green-900/20 flex items-center justify-center">
                        <i class="fas fa-briefcase text-green-500 dark:text-green-400 text-sm"></i>
                    </div>
                    Business Information
                </h3>
                <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
                    <div class="space-y-1">
                        <p class="text-sm font-medium text-gray-500 dark:text-gray-400">Business Type</p>
                        <p class="text-gray-900 dark:text-white"><?php echo e($serviceRequest->businessType->name ?? 'N/A'); ?></p>
                    </div>
                    <div class="space-y-1">
                        <p class="text-sm font-medium text-gray-500 dark:text-gray-400">Business Model</p>
                        <p class="text-gray-900 dark:text-white"><?php echo e($serviceRequest->businessModel->name ?? 'N/A'); ?></p>
                    </div>
                    <div class="space-y-1">
                        <p class="text-sm font-medium text-gray-500 dark:text-gray-400">Branch</p>
                        <p class="text-gray-900 dark:text-white"><?php echo e($serviceRequest->branch->name ?? 'N/A'); ?></p>
                    </div>
                </div>
            </div>

            <!-- Services Requested -->
            <div class="bg-white dark:bg-gray-800 rounded-xl border border-gray-100 dark:border-gray-700/50 shadow-sm p-5">
                <h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2">
                    <div class="w-8 h-8 rounded-lg bg-purple-50 dark:bg-purple-900/20 flex items-center justify-center">
                        <i class="fas fa-list-alt text-purple-500 dark:text-purple-400 text-sm"></i>
                    </div>
                    Services Requested (<?php echo e(count($servicesData)); ?>)
                </h3>
                <div class="space-y-3">
                    <?php $__currentLoopData = $servicesData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $service): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <div class="flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-700/50">
                            <div class="flex items-center gap-3">
                                <div class="w-8 h-8 rounded-lg bg-purple-50 dark:bg-purple-900/20 flex items-center justify-center flex-shrink-0">
                                    <i class="fas fa-cog text-purple-500 dark:text-purple-400 text-sm"></i>
                                </div>
                                <div class="min-w-0 flex-1">
                                    <p class="text-sm font-medium text-gray-900 dark:text-white"><?php echo e($service['name'] ?? 'Unnamed Service'); ?></p>
                                    <?php if($service['description'] ?? false): ?>
                                        <p class="text-xs text-gray-500 dark:text-gray-400 mt-1"><?php echo e(Str::limit($service['description'], 80)); ?></p>
                                    <?php endif; ?>
                                </div>
                            </div>
                            <?php if($service['price'] ?? false): ?>
                                <span class="text-sm font-semibold text-gray-900 dark:text-white">
                                    <?php echo e(number_format($service['price'], 0)); ?> SR
                                </span>
                            <?php endif; ?>
                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
            </div>
        </div>

        <!-- Right Column (1/3) -->
        <div class="space-y-6">
            <!-- Request Summary -->
            <div class="bg-white dark:bg-gray-800 rounded-xl border border-gray-100 dark:border-gray-700/50 shadow-sm p-5">
                <h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2">
                    <div class="w-8 h-8 rounded-lg bg-orange-50 dark:bg-orange-900/20 flex items-center justify-center">
                        <i class="fas fa-file-invoice text-orange-500 dark:text-orange-400 text-sm"></i>
                    </div>
                    Request Summary
                </h3>
                <div class="space-y-3">
                    <div class="flex justify-between items-center py-2 border-b border-gray-100 dark:border-gray-700">
                        <span class="text-sm text-gray-500 dark:text-gray-400">Package Type</span>
                        <span class="text-sm font-medium text-gray-900 dark:text-white capitalize"><?php echo e($serviceRequest->package_type); ?></span>
                    </div>
                    <div class="flex justify-between items-center py-2 border-b border-gray-100 dark:border-gray-700">
                        <span class="text-sm text-gray-500 dark:text-gray-400">Total Price</span>
                        <span class="text-lg font-bold text-green-600 dark:text-green-400"><?php echo e(number_format($serviceRequest->total_price, 0)); ?> SR</span>
                    </div>
                    <div class="flex justify-between items-center py-2 border-b border-gray-100 dark:border-gray-700">
                        <span class="text-sm text-gray-500 dark:text-gray-400">Status</span>
                        <?php
                            $statusConfig = [
                                'pending' => [
                                    'color' => 'bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300',
                                    'icon' => 'fa-clock'
                                ],
                                'in_progress' => [
                                    'color' => 'bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300',
                                    'icon' => 'fa-spinner'
                                ],
                                'approved' => [
                                    'color' => 'bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300',
                                    'icon' => 'fa-check-circle'
                                ],
                                'cancelled' => [
                                    'color' => 'bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300',
                                    'icon' => 'fa-times-circle'
                                ]
                            ];
                            $config = $statusConfig[$serviceRequest->status] ?? [
                                'color' => 'bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300',
                                'icon' => 'fa-question-circle'
                            ];
                        ?>
                        <span class="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-medium <?php echo e($config['color']); ?>">
                            <i class="fas <?php echo e($config['icon']); ?> text-xs"></i>
                            <?php echo e(ucfirst(str_replace('_', ' ', $serviceRequest->status))); ?>

                        </span>
                    </div>
                    <div class="flex justify-between items-center py-2 border-b border-gray-100 dark:border-gray-700">
                        <span class="text-sm text-gray-500 dark:text-gray-400">Created</span>
                        <span class="text-sm text-gray-900 dark:text-white"><?php echo e($serviceRequest->created_at->format('M j, Y')); ?></span>
                    </div>
                    <div class="flex justify-between items-center py-2">
                        <span class="text-sm text-gray-500 dark:text-gray-400">Updated</span>
                        <span class="text-sm text-gray-900 dark:text-white"><?php echo e($serviceRequest->updated_at->format('M j, Y')); ?></span>
                    </div>
                </div>
            </div>

            <!-- Quick Actions -->
            <div class="bg-white dark:bg-gray-800 rounded-xl border border-gray-100 dark:border-gray-700/50 shadow-sm p-5">
                <h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2">
                    <div class="w-8 h-8 rounded-lg bg-red-50 dark:bg-red-900/20 flex items-center justify-center">
                        <i class="fas fa-bolt text-red-500 dark:text-red-400 text-sm"></i>
                    </div>
                    Quick Actions
                </h3>
                <div class="space-y-2">
                    <form action="<?php echo e(route('admin.service-requests.update-status', $serviceRequest)); ?>" method="POST" class="space-y-2">
                        <?php echo csrf_field(); ?>
                        <?php $__currentLoopData = ['in_progress', 'approved', 'cancelled']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $status): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <?php if($serviceRequest->status !== $status): ?>
                                <button type="submit" 
                                        name="status" 
                                        value="<?php echo e($status); ?>"
                                        class="w-full flex items-center justify-between text-left px-3 py-2 text-sm rounded-lg 
                                               hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors text-gray-700 dark:text-gray-300">
                                    <span>Mark as <?php echo e(ucfirst(str_replace('_', ' ', $status))); ?></span>
                                    <i class="fas fa-arrow-right text-xs text-gray-400"></i>
                                </button>
                            <?php endif; ?>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </form>
                </div>

                <div class="mt-4 pt-4 border-t border-gray-100 dark:border-gray-700">
                    <a href="<?php echo e(route('admin.start-Project.index', $serviceRequest->id)); ?>" 
                       class="w-full inline-flex items-center justify-center gap-2 bg-gradient-to-r from-green-500 to-green-600 text-white 
                              px-4 py-2 rounded-lg hover:from-green-600 hover:to-green-700 active:scale-[0.98] transition-all shadow-sm hover:shadow text-sm">
                        <i class="fas fa-play-circle text-sm"></i>
                        Start Project
                    </a>
                </div>
            </div>

            <!-- Admin Notes -->
            <?php if($serviceRequest->admin_notes): ?>
                <div class="bg-white dark:bg-gray-800 rounded-xl border border-gray-100 dark:border-gray-700/50 shadow-sm p-5">
                    <h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2">
                        <div class="w-8 h-8 rounded-lg bg-yellow-50 dark:bg-yellow-900/20 flex items-center justify-center">
                            <i class="fas fa-sticky-note text-yellow-500 dark:text-yellow-400 text-sm"></i>
                        </div>
                        Admin Notes
                    </h3>
                    <div class="bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-3">
                        <p class="text-sm text-gray-700 dark:text-gray-300"><?php echo e($serviceRequest->admin_notes); ?></p>
                    </div>
                </div>
            <?php endif; ?>
        </div>
    </div>
</div>

<style>
    .dark .bg-gray-750 {
        background-color: rgba(55, 65, 81, 0.5);
    }
</style>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.layout.main', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\laragon\www\crm_new\resources\views/admin/service-requests/show.blade.php ENDPATH**/ ?>