<?php $__env->startSection('title', 'Log Notifikasi WhatsApp'); ?>
<?php $__env->startSection('page-title', 'Riwayat Log Notifikasi WhatsApp'); ?>
<?php $__env->startSection('page-subtitle', 'Monitoring riwayat dan status pengiriman pesan notifikasi otomatis.'); ?>

<?php $__env->startSection('content'); ?>
<div class="card shadow-sm border-0">
    <div class="card-header bg-white py-3 border-bottom d-flex justify-content-between align-items-center">
        <h5 class="card-title mb-0 fw-bold"><i class="bi bi-bell-fill text-primary me-2"></i> Log Notifikasi WhatsApp</h5>
        <span class="badge bg-light-primary text-primary">Total: <?php echo e($logs->total()); ?> Log</span>
    </div>
    <div class="card-body p-0">
        <div class="table-responsive">
            <table class="table table-hover align-middle mb-0">
                <thead class="bg-light">
                    <tr>
                        <th class="ps-4">Waktu</th>
                        <th>Karyawan</th>
                        <th>Nomor Tujuan</th>
                        <th>Tipe Notifikasi</th>
                        <th>Isi Pesan</th>
                        <th>Status</th>
                        <th class="pe-4">Keterangan / Response</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; ?>
                        <tr>
                            <td class="ps-4 text-xs">
                                <strong><?php echo e($log->created_at->format('d/m/Y')); ?></strong>
                                <br><span class="text-muted"><?php echo e($log->created_at->format('H:i:s')); ?></span>
                            </td>
                            <td>
                                <strong><?php echo e($log->employee?->name ?? 'Pengujian'); ?></strong>
                            </td>
                            <td><code><?php echo e($log->recipient); ?></code></td>
                            <td>
                                <span class="badge bg-light-info text-info"><?php echo e(ucfirst($log->type)); ?></span>
                            </td>
                            <td>
                                <span class="d-inline-block text-truncate" style="max-width: 250px;" title="<?php echo e($log->message); ?>">
                                    <?php echo e($log->message); ?>

                                </span>
                            </td>
                            <td>
                                <?php if($log->status === 'sent'): ?>
                                    <span class="badge bg-success">Terkirim</span>
                                <?php elseif($log->status === 'pending'): ?>
                                    <span class="badge bg-warning text-dark">Pending</span>
                                <?php else: ?>
                                    <span class="badge bg-danger">Gagal</span>
                                <?php endif; ?>
                            </td>
                            <td class="pe-4 text-xs">
                                <?php if($log->error_message): ?>
                                    <span class="text-danger"><?php echo e($log->error_message); ?></span>
                                <?php else: ?>
                                    <span class="text-success">OK (<?php echo e($log->sent_at ? $log->sent_at->format('H:i:s') : '-'); ?>)</span>
                                <?php endif; ?>
                            </td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr>
                            <td colspan="7" class="text-center py-5 text-muted">
                                Belum ada riwayat pengiriman notifikasi.
                            </td>
                        </tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>

        <?php if($logs->hasPages()): ?>
            <div class="p-3 border-top d-flex justify-content-end">
                <?php echo e($logs->links('pagination::bootstrap-5')); ?>

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

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\laragon\www\absensi\resources\views/admin/logs/notifications.blade.php ENDPATH**/ ?>