<?php $__env->startSection('title', 'Import ' . $batch->file_name . ' – Gap Finder Analytics'); ?>

<?php $__env->startSection('content'); ?>
    <div class="page-actions">
        <a href="<?php echo e(route('imports.index')); ?>" class="btn btn-ghost">← Back to imports</a>
        <a href="<?php echo e(route('imports.mapping', $batch)); ?>" class="btn btn-primary">Manual mapping</a>
    </div>
    <h1><?php echo e($batch->file_name); ?></h1>
    <p class="muted">Status: <?php echo e($batch->status); ?> · <?php echo e($batch->stagingRows->count()); ?> rows</p>

    <?php if(!empty($stats)): ?>
        <div class="grid grid-2 mt-1">
            <div class="card mb-0"><div class="card-title">Valid</div><div class="card-value"><?php echo e($stats['valid'] ?? 0); ?></div></div>
            <div class="card mb-0"><div class="card-title">Partial</div><div class="card-value"><?php echo e($stats['partial'] ?? 0); ?></div></div>
            <div class="card mb-0"><div class="card-title">Invalid</div><div class="card-value"><?php echo e($stats['invalid'] ?? 0); ?></div></div>
        </div>
    <?php endif; ?>

    <div class="card mt-1">
        <h2>Staging rows (first 100)</h2>
        <div class="table-wrap"><table>
            <thead>
                <tr>
                    <th>Row</th>
                    <th>Status</th>
                    <th>Raw data</th>
                    <th>Errors</th>
                </tr>
            </thead>
            <tbody>
                <?php $__currentLoopData = $batch->stagingRows->take(100); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <tr>
                        <td><?php echo e($row->row_index); ?></td>
                        <td><?php echo e($row->validation_status); ?></td>
                        <td><pre><?php echo e(json_encode($row->raw_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)); ?></pre></td>
                        <td class="muted"><?php echo e($row->validation_errors ? implode('; ', $row->validation_errors) : '–'); ?></td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </tbody>
        </table></div>
        <?php if($batch->stagingRows->count() > 100): ?>
            <p class="muted mt-1">Showing first 100 of <?php echo e($batch->stagingRows->count()); ?> rows.</p>
        <?php endif; ?>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\gap-finder-analytics\resources\views/imports/show.blade.php ENDPATH**/ ?>