<?php if (isset($component)) { $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54 = $attributes; } ?>
<?php $component = App\View\Components\AppLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('app-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\AppLayout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
     <?php $__env->slot('header', null, []); ?> 
        <div class="flex items-center space-x-4">
            <a href="<?php echo e(route('customers.index')); ?>"
               class="p-2 text-gray-600 hover:text-gray-900 hover:bg-gray-100 rounded-xl transition-all duration-200 flex items-center justify-center">
                <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"></path>
                </svg>
            </a>
            <div class="flex-1">
                <h1 class="text-2xl font-bold text-gray-900"><?php echo e($customer->full_name); ?></h1>
                <p class="text-gray-600 text-sm mt-0.5">Customer #<?php echo e($customer->id); ?> • Member since <?php echo e($customer->created_at->format('M Y')); ?></p>
            </div>
            <div class="flex items-center space-x-3">
                <a href="<?php echo e(route('customers.edit', $customer)); ?>"
                   class="bg-gradient-to-r from-yellow-500 to-yellow-600 hover:from-yellow-600 hover:to-yellow-700 text-white font-semibold py-2.5 px-5 rounded-xl transition-all duration-200 flex items-center shadow-lg hover:shadow-xl text-sm">
                    <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path>
                    </svg>
                    Edit
                </a>
                <button onclick="createOrder()"
                        class="bg-gradient-to-r from-green-600 to-green-700 hover:from-green-700 hover:to-green-800 text-white font-semibold py-2.5 px-5 rounded-xl transition-all duration-200 flex items-center shadow-lg hover:shadow-xl text-sm">
                    <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path>
                    </svg>
                    New Order
                </button>
                <?php if(Auth::user()->hasPermission('delete_customers')): ?>
                    <button onclick="confirmDelete()"
                            class="bg-gradient-to-r from-red-600 to-red-700 hover:from-red-700 hover:to-red-800 text-white font-semibold py-2.5 px-5 rounded-xl transition-all duration-200 flex items-center shadow-lg hover:shadow-xl text-sm">
                        <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"></path>
                        </svg>
                        Delete
                    </button>
                <?php endif; ?>
            </div>
        </div>
     <?php $__env->endSlot(); ?>

    <div class="p-6">
        <div class="max-w-7xl mx-auto">
            <div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
                <!-- Customer Information -->
                <div class="lg:col-span-1">
                    <div class="bg-white overflow-hidden shadow-lg rounded-xl border border-gray-100">
                        <div class="p-6">
                            <div class="flex items-center mb-6">
                                <div class="w-16 h-16 bg-gradient-to-r from-blue-500 to-purple-600 rounded-full flex items-center justify-center text-white font-bold text-2xl">
                                    <?php echo e(strtoupper(substr($customer->full_name, 0, 1))); ?>

                                </div>
                                <div class="ml-4">
                                    <h3 class="text-xl font-bold text-gray-900"><?php echo e($customer->full_name); ?></h3>
                                    <p class="text-gray-600">Customer since <?php echo e($customer->created_at->format('M Y')); ?></p>
                                </div>
                            </div>

                            <div class="space-y-4">
                                <div class="flex items-center">
                                    <svg class="w-5 h-5 text-gray-400 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z"></path>
                                    </svg>
                                    <span class="text-gray-900"><?php echo e($customer->phone); ?></span>
                                </div>

                                <?php if($customer->email): ?>
                                    <div class="flex items-center">
                                        <svg class="w-5 h-5 text-gray-400 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 4.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"></path>
                                        </svg>
                                        <span class="text-gray-900"><?php echo e($customer->email); ?></span>
                                    </div>
                                <?php endif; ?>

                                <div class="flex items-start">
                                    <svg class="w-5 h-5 text-gray-400 mr-3 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"></path>
                                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z"></path>
                                    </svg>
                                    <span class="text-gray-900"><?php echo e($customer->address); ?></span>
                                </div>
                            </div>

                            <div class="mt-6 pt-6 border-t border-gray-200">
                                <div class="text-sm text-gray-600">
                                    <p><strong>Created by:</strong> <?php echo e($customer->createdBy->name); ?></p>
                                    <p><strong>Created on:</strong> <?php echo e($customer->created_at->format('M d, Y \a\t g:i A')); ?></p>
                                    <?php if($customer->updated_at != $customer->created_at): ?>
                                        <p><strong>Last updated:</strong> <?php echo e($customer->updated_at->format('M d, Y \a\t g:i A')); ?></p>
                                    <?php endif; ?>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Quick Stats -->
                    <div class="mt-6 bg-white overflow-hidden shadow-lg rounded-xl border border-gray-100">
                        <div class="p-6">
                            <h4 class="text-lg font-semibold text-gray-900 mb-4">Quick Stats</h4>
                            <div class="grid grid-cols-2 gap-4">
                                <div class="text-center p-4 bg-gradient-to-br from-blue-50 to-blue-100 rounded-xl border border-blue-200">
                                    <div class="text-2xl font-bold text-blue-600"><?php echo e($customer->orders->count()); ?></div>
                                    <div class="text-sm text-blue-800">Total Orders</div>
                                </div>
                                <div class="text-center p-4 bg-gradient-to-br from-green-50 to-green-100 rounded-xl border border-green-200">
                                    <div class="text-2xl font-bold text-green-600">₦<?php echo e(number_format($customer->orders->sum('final_amount'), 2)); ?></div>
                                    <div class="text-sm text-green-800">Total Spent</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Order History -->
                <div class="lg:col-span-2">
                    <div class="bg-white overflow-hidden shadow-lg rounded-xl border border-gray-100">
                        <div class="p-6">
                            <div class="flex items-center justify-between mb-6">
                                <h3 class="text-xl font-bold text-gray-900">Order History</h3>
                                <span class="text-sm text-gray-600"><?php echo e($customer->orders->count()); ?> orders total</span>
                            </div>

                            <?php if($customer->orders->count() > 0): ?>
                                <div class="space-y-4">
                                    <?php $__currentLoopData = $customer->orders; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $order): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <div class="border border-gray-200 rounded-lg p-4 hover:shadow-md transition duration-200">
                                            <div class="flex items-center justify-between mb-3">
                                                <div class="flex items-center">
                                                    <h4 class="font-semibold text-gray-900"><?php echo e($order->order_number); ?></h4>
                                                    <span class="ml-3 px-3 py-1 text-xs font-medium rounded-full <?php echo e($order->status_color); ?>">
                                                        <?php echo e(ucfirst($order->status)); ?>

                                                    </span>
                                                </div>
                                                <div class="text-right">
                                                    <div class="font-semibold text-gray-900">₦<?php echo e(number_format($order->final_amount, 2)); ?></div>
                                                    <div class="text-sm text-gray-600"><?php echo e($order->created_at->format('M d, Y')); ?></div>
                                                </div>
                                            </div>
                                            
                                            <div class="text-sm text-gray-600 mb-3">
                                                <?php echo e($order->orderItems->count()); ?> items • 
                                                <?php echo e($order->color_separation ? 'Color separated' : 'Mixed colors'); ?> • 
                                                <?php echo e(ucfirst($order->packaging_preference)); ?>

                                            </div>

                                            <div class="flex items-center justify-between">
                                                <div class="flex flex-wrap gap-2">
                                                    <?php $__currentLoopData = $order->orderItems->take(3); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <span class="px-2 py-1 bg-gray-100 text-gray-700 text-xs rounded">
                                                            <?php echo e($item->quantity); ?>x <?php echo e($item->laundryItem->name); ?>

                                                        </span>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                    <?php if($order->orderItems->count() > 3): ?>
                                                        <span class="px-2 py-1 bg-gray-100 text-gray-700 text-xs rounded">
                                                            +<?php echo e($order->orderItems->count() - 3); ?> more
                                                        </span>
                                                    <?php endif; ?>
                                                </div>
                                                <a href="#" class="text-blue-600 hover:text-blue-800 text-sm font-medium">
                                                    View Details
                                                </a>
                                            </div>
                                        </div>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </div>
                            <?php else: ?>
                                <div class="text-center py-12">
                                    <svg class="w-16 h-16 mx-auto text-gray-400 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path>
                                    </svg>
                                    <h4 class="text-lg font-medium text-gray-900 mb-2">No orders yet</h4>
                                    <p class="text-gray-600 mb-6">This customer hasn't placed any orders yet.</p>
                                    <button onclick="createOrder()"
                                            class="bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-700 hover:to-blue-800 text-white font-semibold py-3 px-6 rounded-xl transition-all duration-200 flex items-center shadow-lg hover:shadow-xl">
                                        Create First Order
                                    </button>
                                </div>
                            <?php endif; ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Delete Confirmation Modal -->
    <?php if(Auth::user()->hasPermission('delete_customers')): ?>
        <div id="deleteModal" class="fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full hidden z-50">
            <div class="relative top-20 mx-auto p-5 border w-96 shadow-lg rounded-xl bg-white">
                <div class="mt-3 text-center">
                    <div class="mx-auto flex items-center justify-center h-12 w-12 rounded-full bg-red-100">
                        <svg class="h-6 w-6 text-red-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"></path>
                        </svg>
                    </div>
                    <h3 class="text-lg font-bold text-gray-900 mt-4 mb-2">Delete Customer</h3>
                    <p class="text-sm text-gray-600 mb-6">
                        Are you sure you want to delete <strong><?php echo e($customer->full_name); ?></strong>?
                        This action cannot be undone and will only work if the customer has no existing orders.
                    </p>
                    <div class="flex space-x-3">
                        <button onclick="closeDeleteModal()"
                                class="flex-1 bg-gray-200 hover:bg-gray-300 text-gray-700 font-semibold py-2 px-4 rounded-lg transition-all duration-200">
                            Cancel
                        </button>
                        <form method="POST" action="<?php echo e(route('customers.destroy', $customer)); ?>" class="flex-1">
                            <?php echo csrf_field(); ?>
                            <?php echo method_field('DELETE'); ?>
                            <button type="submit"
                                    class="w-full bg-gradient-to-r from-red-600 to-red-700 hover:from-red-700 hover:to-red-800 text-white font-semibold py-2 px-4 rounded-lg transition-all duration-200">
                                Delete Customer
                            </button>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    <?php endif; ?>

    <script>
        function createOrder() {
            // Redirect to order creation page with customer pre-selected
            window.location.href = '<?php echo e(route("orders.create")); ?>?customer_id=<?php echo e($customer->id); ?>';
        }

        <?php if(Auth::user()->hasPermission('delete_customers')): ?>
            function confirmDelete() {
                document.getElementById('deleteModal').classList.remove('hidden');
            }

            function closeDeleteModal() {
                document.getElementById('deleteModal').classList.add('hidden');
            }

            // Close modal when clicking outside
            document.getElementById('deleteModal').addEventListener('click', function(e) {
                if (e.target === this) {
                    closeDeleteModal();
                }
            });
        <?php endif; ?>
    </script>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $attributes = $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $component = $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php /**PATH C:\xampp\htdocs\slarry\resources\views/customers/show.blade.php ENDPATH**/ ?>