<?php $__env->startSection('content'); ?>
    <p style="margin: 12px 0;">
        <a href="<?php echo e(url('admin/octoparse')); ?>">&larr; Back to Octoparse dashboard</a>
    </p>
    <h1 style="margin-top: 0;">Octoparse — Import logs</h1>

    <table class="table table-condensed table-hover table-striped">
        <thead>
            <tr>
                <th>Started</th>
                <th>Finished</th>
                <th>Task</th>
                <th>Status</th>
                <th class="text-right">Fetched</th>
                <th class="text-right">Inserted</th>
                <th class="text-right">Updated</th>
                <th class="text-right">Failed</th>
                <th>New entries</th>
                <th>Mode</th>
                <th>Error</th>
            </tr>
        </thead>
        <tbody>
        <?php $__empty_1 = true; $__currentLoopData = $logs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $log): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
            <?php
                $label = $tasks[$log->task_id]['label'] ?? $log->task_id;
                $badge = $log->status === 'success' ? 'success'
                    : ($log->status === 'failed' ? 'danger'
                        : ($log->status === 'partial' ? 'warning' : 'info'));
            ?>
            <tr>
                <td><?php echo e(optional($log->started_at)->format('Y-m-d H:i:s')); ?></td>
                <td><?php echo e(optional($log->finished_at)->format('Y-m-d H:i:s') ?: '—'); ?></td>
                <td>
                    <a href="<?php echo e(url('admin/octoparse/tasks/' . $log->task_id)); ?>"><?php echo e($label); ?></a>
                    <br>
                    <small class="text-muted"><code><?php echo e($log->task_id); ?></code></small>
                </td>
                <td><span class="label label-<?php echo e($badge); ?>"><?php echo e($log->status); ?></span></td>
                <td class="text-right"><?php echo e($log->rows_fetched); ?></td>
                <td class="text-right"><?php echo e($log->rows_inserted); ?></td>
                <td class="text-right"><?php echo e($log->rows_updated); ?></td>
                <td class="text-right"><?php echo e($log->rows_failed); ?></td>
                <td>
                    <?php if($log->new_record_ids === null): ?>
                        <span class="text-muted" title="This import predates new-entries tracking">n/a</span>
                    <?php elseif($log->rows_inserted > 0): ?>
                        <a href="<?php echo e(url('admin/octoparse/logs/' . $log->id . '/new-entries')); ?>">
                            <span class="label label-success"><?php echo e($log->rows_inserted); ?> new</span>
                        </a>
                    <?php else: ?>
                        <span class="text-muted">—</span>
                    <?php endif; ?>
                </td>
                <td>
                    <?php if($log->dry_run): ?><span class="label label-default">dry-run</span><?php endif; ?>
                    <?php if($log->triggered_manually): ?><span class="label label-info">manual</span><?php endif; ?>
                </td>
                <td>
                    <?php if($log->error_message): ?>
                        <span title="<?php echo e($log->error_message); ?>">
                            <?php echo e(\Illuminate\Support\Str::limit($log->error_message, 80)); ?>

                        </span>
                    <?php else: ?>
                        —
                    <?php endif; ?>
                </td>
            </tr>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
            <tr>
                <td colspan="11" class="text-center text-muted">No imports recorded yet.</td>
            </tr>
        <?php endif; ?>
        </tbody>
    </table>

    <div class="text-center">
        <?php echo e($logs->links()); ?>

    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.layouts.main', ['fluid' => true], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/html/resources/views/admin/octoparse/logs.blade.php ENDPATH**/ ?>