

<?php $__env->startSection('content'); ?>
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:16px;">
    <h2 style="margin:0;">Diferencias</h2>
    <a href="<?php echo e(route('diferencias.create')); ?>" style="background:#2563eb;color:#fff;padding:10px 14px;border-radius:8px;text-decoration:none;">Nueva diferencia</a>
</div>

<?php if(session('success')): ?>
    <div style="margin-bottom:12px;padding:10px;border:1px solid #bbf7d0;background:#dcfce7;color:#166534;border-radius:8px;">
        <?php echo e(session('success')); ?>

    </div>
<?php endif; ?>

<div style="overflow:auto;background:#fff;border:1px solid #e5e7eb;border-radius:10px;">
    <table style="width:100%;border-collapse:collapse;">
        <thead style="background:#f8fafc;">
            <tr>
                <th style="text-align:left;padding:10px;border-bottom:1px solid #e5e7eb;">ID</th>
                <th style="text-align:left;padding:10px;border-bottom:1px solid #e5e7eb;">Usuario</th>
                <th style="text-align:left;padding:10px;border-bottom:1px solid #e5e7eb;">Observación</th>
                <th style="text-align:left;padding:10px;border-bottom:1px solid #e5e7eb;">Turno</th>
                <th style="text-align:left;padding:10px;border-bottom:1px solid #e5e7eb;">Tipo combustible</th>
                <th style="text-align:right;padding:10px;border-bottom:1px solid #e5e7eb;">Galones</th>
                <th style="text-align:right;padding:10px;border-bottom:1px solid #e5e7eb;">Precio</th>
                <th style="text-align:right;padding:10px;border-bottom:1px solid #e5e7eb;">Total</th>
                <th style="text-align:center;padding:10px;border-bottom:1px solid #e5e7eb;">Estado</th>
                <th style="text-align:center;padding:10px;border-bottom:1px solid #e5e7eb;">Acciones</th>
            </tr>
        </thead>
        <tbody>
            <?php $__empty_1 = true; $__currentLoopData = $items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                <tr>
                    <td style="padding:10px;border-bottom:1px solid #f1f5f9;"><?php echo e($item->id); ?></td>
                    <td style="padding:10px;border-bottom:1px solid #f1f5f9;"><?php echo e($item->usuario?->usuario ?? $item->usuario?->name ?? $item->usuario?->email); ?></td>
                    <td style="padding:10px;border-bottom:1px solid #f1f5f9;"><?php echo e($item->observacion); ?></td>
                    <td style="padding:10px;border-bottom:1px solid #f1f5f9;"><?php echo e($item->turno->turnos ?? '-'); ?></td>
                    <td style="padding:10px;border-bottom:1px solid #f1f5f9;"><?php echo e($item->tipoCombustible->nombre ?? '-'); ?></td>
                    <td style="padding:10px;border-bottom:1px solid #f1f5f9;text-align:right;"><?php echo e(number_format((float)$item->cantidad_galones, 3)); ?></td>
                    <td style="padding:10px;border-bottom:1px solid #f1f5f9;text-align:right;"><?php echo e(number_format((float)$item->precio, 2)); ?></td>
                    <td style="padding:10px;border-bottom:1px solid #f1f5f9;text-align:right;"><?php echo e(number_format((float)$item->total, 2)); ?></td>
                    <td style="padding:10px;border-bottom:1px solid #f1f5f9;text-align:center;">
                        <?php if((int)$item->estado === 1): ?>
                            <span style="padding:4px 8px;border-radius:999px;background:#dcfce7;color:#166534;">Activo</span>
                        <?php else: ?>
                            <span style="padding:4px 8px;border-radius:999px;background:#fee2e2;color:#991b1b;">Inactivo</span>
                        <?php endif; ?>
                    </td>
                    <td style="padding:10px;border-bottom:1px solid #f1f5f9;text-align:center;">
                        <a href="<?php echo e(route('diferencias.edit', $item->id)); ?>" style="color:#2563eb;text-decoration:none;margin-right:8px;">Editar</a>
                        <form method="POST" action="<?php echo e(route('diferencias.destroy', $item->id)); ?>" style="display:inline;" onsubmit="return confirm('¿Eliminar este registro?')">
                            <?php echo csrf_field(); ?>
                            <?php echo method_field('DELETE'); ?>
                            <button type="submit" style="border:none;background:transparent;color:#dc2626;cursor:pointer;">Eliminar</button>
                        </form>
                    </td>
                </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                <tr>
                    <td colspan="9" style="padding:14px;text-align:center;color:#64748b;">Sin registros</td>
                </tr>
            <?php endif; ?>
        </tbody>
    </table>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('partials.layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\laragon\www\grifo\resources\views/diferencias/index.blade.php ENDPATH**/ ?>