

<?php $__env->startSection('title', 'Tracking Updates'); ?>

<?php $__env->startSection('content'); ?>
<div class="space-y-6">
    <!-- Header -->
    <div class="bg-white rounded-xl shadow-sm p-6">
        <div class="flex flex-col md:flex-row md:items-center md:justify-between">
            <div>
                <h1 class="text-2xl font-bold text-gray-900">
                    Tracking Updates for Shipment
                </h1>
                <div class="mt-2 flex items-center">
                    <span class="text-blue-600 font-mono font-medium mr-3">#<?php echo e($shipment->tracking_number); ?></span>
                    <span class="px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full 
                        <?php echo e($shipment->status === 'delivered' ? 'bg-green-100 text-green-800' : 
                           ($shipment->status === 'in_transit' ? 'bg-yellow-100 text-yellow-800' : 
                           'bg-gray-100 text-gray-800')); ?>">
                        <?php echo e(ucfirst($shipment->status)); ?>

                    </span>
                </div>
            </div>
            <div class="mt-4 md:mt-0 flex space-x-3">
                <a href="<?php echo e(route('admin.shipments.show', $shipment)); ?>" 
                   class="inline-flex items-center px-4 py-2 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition-colors">
                    <i class="fas fa-arrow-left mr-2"></i>
                    Back to Shipment
                </a>
                <a href="<?php echo e(route('admin.tracking-updates.create', $shipment)); ?>" 
                   class="inline-flex items-center px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors shadow-sm">
                    <i class="fas fa-plus mr-2"></i>
                    Add Update
                </a>
            </div>
        </div>
    </div>

    <!-- Updates Timeline -->
    <div class="bg-white rounded-xl shadow-sm overflow-hidden">
        <div class="px-6 py-4 border-b border-gray-100">
            <h2 class="text-lg font-semibold text-gray-900">Tracking History</h2>
        </div>
        
        <?php if($updates->isEmpty()): ?>
            <div class="p-12 text-center">
                <div class="flex flex-col items-center">
                    <i class="fas fa-route text-gray-300 text-5xl mb-3"></i>
                    <span class="font-medium text-gray-900">No tracking updates found</span>
                    <p class="text-gray-500 mt-1">Add the first update to start tracking this shipment</p>
                    <div class="mt-4">
                        <a href="<?php echo e(route('admin.tracking-updates.create', $shipment)); ?>" 
                           class="inline-flex items-center px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors shadow-sm">
                            <i class="fas fa-plus mr-2"></i>
                            Add First Update
                        </a>
                    </div>
                </div>
            </div>
        <?php else: ?>
            <div class="py-4 px-2 md:px-8">
                <div class="flow-root">
                    <ul class="-my-8">
                        <?php $__currentLoopData = $updates; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $update): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <li>
                                <div class="relative pb-8">
                                    <?php if(!$loop->last): ?>
                                        <span class="absolute top-5 left-5 -ml-px h-full w-0.5 bg-gray-200" aria-hidden="true"></span>
                                    <?php endif; ?>
                                    <div class="relative flex items-start space-x-3">
                                        <div>
                                            <div class="relative px-1.5">
                                                <div class="h-10 w-10 rounded-full bg-<?php echo e($update->status === 'delivered' ? 'green' : ($update->status === 'in_transit' ? 'yellow' : 'gray')); ?>-100 flex items-center justify-center ring-8 ring-white">
                                                    <i class="fas <?php echo e($update->status === 'delivered' ? 'fa-check-circle text-green-600' : ($update->status === 'in_transit' ? 'fa-truck text-yellow-600' : 'fa-circle text-gray-600')); ?>"></i>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="min-w-0 flex-1 py-3">
                                            <div class="bg-gray-50 rounded-lg shadow-sm p-4 hover:bg-gray-50">
                                                <div class="flex justify-between">
                                                    <div>
                                                        <h3 class="text-lg font-medium text-gray-900"><?php echo e($update->location); ?></h3>
                                                        <div class="mt-1 flex items-center text-sm text-gray-500">
                                                            <i class="fas fa-calendar-alt mr-1.5 text-gray-400"></i>
                                                            <?php echo e($update->created_at->format('M d, Y h:i A')); ?>

                                                        </div>
                                                    </div>
                                                    <div class="flex space-x-4 items-start">
                                                        <span class="px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full 
                                                            <?php echo e($update->status === 'delivered' ? 'bg-green-100 text-green-800' : 
                                                               ($update->status === 'in_transit' ? 'bg-yellow-100 text-yellow-800' : 
                                                               'bg-gray-100 text-gray-800')); ?>">
                                                            <?php echo e(ucfirst($update->status)); ?>

                                                        </span>
                                                        <form action="<?php echo e(route('admin.shipments.updates.destroy', [$shipment, $update])); ?>" 
                                                              method="POST" 
                                                              onsubmit="return confirm('Are you sure you want to delete this update?');">
                                                            <?php echo csrf_field(); ?>
                                                            <?php echo method_field('DELETE'); ?>
                                                            <button type="submit" 
                                                                    class="text-red-500 hover:text-red-700 transition-colors">
                                                                <i class="fas fa-trash-alt"></i>
                                                            </button>
                                                        </form>
                                                    </div>
                                                </div>
                                                <p class="mt-2 text-gray-700"><?php echo e($update->description); ?></p>
                                                <?php if($update->latitude && $update->longitude): ?>
                                                    <div class="mt-2 inline-flex items-center px-2.5 py-1 rounded-full text-xs font-medium bg-blue-50 text-blue-700">
                                                        <i class="fas fa-map-marker-alt mr-1"></i>
                                                        <?php echo e($update->latitude); ?>, <?php echo e($update->longitude); ?>

                                                    </div>
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </li>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </ul>
                </div>
            </div>
        <?php endif; ?>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home2/gczzqaya/goldenmuskfreight.com/resources/views/admin/tracking-updates/index.blade.php ENDPATH**/ ?>