<?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 justify-between items-center no-print">
            <h2 class="font-semibold text-xl text-gray-800 leading-tight">
                <?php echo e(__('Detalle de Pedido #')); ?><?php echo e($specialOrder->id); ?>

            </h2>
            <div class="flex gap-2">
                <button onclick="window.print()" class="btn-secondary">
                    Imprimir Ticket
                </button>
                <a href="<?php echo e(route('special-orders.index')); ?>" class="btn-secondary">
                    Volver
                </a>
            </div>
        </div>
     <?php $__env->endSlot(); ?>

    <div class="py-12">
        <div class="max-w-4xl mx-auto sm:px-6 lg:px-8">

            <!-- Management Card (No Print) -->
            <?php if (isset($component)) { $__componentOriginalfc34df8c041cfce1b125f68563b94330 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalfc34df8c041cfce1b125f68563b94330 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.modern-card','data' => ['variant' => 'bordered','class' => 'mb-6 no-print']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('modern-card'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['variant' => 'bordered','class' => 'mb-6 no-print']); ?>
                <h3 class="font-bold text-lg mb-4">Gestionar Estado</h3>
                <form action="<?php echo e(route('special-orders.update-status', $specialOrder)); ?>" method="POST"
                    class="flex flex-wrap gap-2 items-center">
                    <?php echo csrf_field(); ?>
                    <?php echo method_field('PATCH'); ?>

                    <?php
                        $statuses = [
                            'pending' => 'Pendiente',
                            'confirmed' => 'Confirmado',
                            'in_production' => 'En Producción',
                            'ready' => 'Listo para Retirar',
                            'delivered' => 'Entregado',
                            'cancelled' => 'Cancelado',
                        ];
                    ?>

                    <?php $__currentLoopData = $statuses; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $label): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <button type="submit" name="status" value="<?php echo e($key); ?>"
                            class="px-4 py-2 rounded-lg text-sm font-semibold transition-colors
                                    <?php echo e($specialOrder->status === $key ? 'bg-bakery-dark text-white shadow-md' : 'bg-gray-100 text-gray-600 hover:bg-gray-200'); ?>">
                            <?php echo e($label); ?>

                        </button>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </form>
             <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalfc34df8c041cfce1b125f68563b94330)): ?>
<?php $attributes = $__attributesOriginalfc34df8c041cfce1b125f68563b94330; ?>
<?php unset($__attributesOriginalfc34df8c041cfce1b125f68563b94330); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalfc34df8c041cfce1b125f68563b94330)): ?>
<?php $component = $__componentOriginalfc34df8c041cfce1b125f68563b94330; ?>
<?php unset($__componentOriginalfc34df8c041cfce1b125f68563b94330); ?>
<?php endif; ?>

            <!-- Order Ticket (Printable) -->
            <div
                class="bg-white p-8 rounded-xl shadow-lg border border-gray-100 print:shadow-none print:border-none printable-area">

                <!-- Header -->
                <div class="text-center mb-8 border-b pb-4">
                    <h1 class="text-3xl font-display font-bold text-bakery-dark-deep mb-2">Panadería & Pastelería</h1>
                    <p class="text-sm text-gray-500 uppercase tracking-wide">Orden de Pedido Especial</p>
                    <h2 class="text-4xl font-bold text-bakery-gold mt-2">#<?php echo e($specialOrder->id); ?></h2>
                </div>

                <!-- Info Grid -->
                <div class="grid grid-cols-2 gap-8 mb-8">
                    <div>
                        <h4 class="text-xs uppercase text-gray-400 font-bold mb-1">Cliente</h4>
                        <p class="text-lg font-bold text-gray-900"><?php echo e($specialOrder->customer->name); ?></p>
                        <p class="text-gray-600"><?php echo e($specialOrder->customer->phone); ?></p>
                    </div>
                    <div class="text-right">
                        <h4 class="text-xs uppercase text-gray-400 font-bold mb-1">Fecha de Entrega</h4>
                        <p class="text-2xl font-bold text-bakery-dark"><?php echo e($specialOrder->pickup_date->format('d/m/Y')); ?>

                        </p>
                        <p class="text-lg text-bakery-gold font-bold"><?php echo e($specialOrder->pickup_date->format('h:i A')); ?>

                        </p>
                    </div>
                </div>

                <!-- Items Table -->
                <table class="w-full mb-8">
                    <thead class="border-b-2 border-gray-100">
                        <tr>
                            <th class="text-left py-2 text-gray-500 font-bold uppercase text-xs">Producto</th>
                            <th class="text-right py-2 text-gray-500 font-bold uppercase text-xs">Cant.</th>
                            <th class="text-right py-2 text-gray-500 font-bold uppercase text-xs">Total</th>
                        </tr>
                    </thead>
                    <tbody class="divide-y divide-gray-50">
                        <?php $__currentLoopData = $specialOrder->items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                                <td class="py-4">
                                    <p class="font-bold text-gray-800"><?php echo e($item->productVariant->product->name); ?></p>
                                    <p class="text-sm text-gray-500"><?php echo e($item->productVariant->name); ?></p>
                                    <?php if($item->specifications): ?>
                                        <div
                                            class="mt-1 bg-yellow-50 p-2 rounded text-xs text-yellow-800 italic border border-yellow-100 inline-block">
                                            "<?php echo e($item->specifications); ?>"
                                        </div>
                                    <?php endif; ?>
                                </td>
                                <td class="text-right py-4 align-top font-bold"><?php echo e($item->quantity + 0); ?></td>
                                <td class="text-right py-4 align-top font-bold text-gray-800"><?php echo (($globalSettings['currency_symbol'] ?? '$') . ' ' . number_format($item->subtotal, 2)); ?>
                                </td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                </table>

                <!-- Totals -->
                <div class="flex justify-end border-t pt-4">
                    <div class="w-64 space-y-2">
                        <div class="flex justify-between text-gray-600">
                            <span>Subtotal</span>
                            <span><?php echo (($globalSettings['currency_symbol'] ?? '$') . ' ' . number_format($specialOrder->total_amount, 2)); ?></span>
                        </div>
                        <div class="flex justify-between text-green-600 font-medium">
                            <span>Anticipo / Seña</span>
                            <span>- <?php echo (($globalSettings['currency_symbol'] ?? '$') . ' ' . number_format($specialOrder->deposit_amount, 2)); ?></span>
                        </div>
                        <div
                            class="flex justify-between text-xl font-bold text-bakery-dark border-t border-dashed pt-2 mt-2">
                            <span>Saldo a Pagar</span>
                            <span><?php echo (($globalSettings['currency_symbol'] ?? '$') . ' ' . number_format($specialOrder->balance, 2)); ?></span>
                        </div>
                    </div>
                </div>

                <!-- Notes -->
                <?php if($specialOrder->notes): ?>
                    <div class="mt-8 bg-gray-50 p-4 rounded-lg border border-gray-100">
                        <h4 class="text-xs uppercase text-gray-400 font-bold mb-1">Notas Generales</h4>
                        <p class="text-gray-700 italic"><?php echo e($specialOrder->notes); ?></p>
                    </div>
                <?php endif; ?>

                <div class="mt-12 text-center text-xs text-gray-400">
                    <p>Gracias por su preferencia</p>
                    <p class="mt-1"><?php echo e(now()->format('d/m/Y H:i')); ?></p>
                </div>

            </div>
        </div>
    </div>
 <?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:\Webs\PHP\panaderiapasteleria\resources\views/special_orders/show.blade.php ENDPATH**/ ?>