<?php $this->load->helper('az_config'); ?>
<!DOCTYPE html>
<html>
<head>
    <title>Laporan Recovery Device</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="<?php echo base_url(); ?>assets/plugins/bootstrap/bootstrap.min.css">
</head>
<body style="padding:20px;background:#f5f5f5;">
<div style="max-width:1000px;margin:0 auto;background:#fff;padding:24px;border-radius:8px;">
    <h3>Laporan Recovery Device</h3>

    <p>
        <a href="<?php echo base_url(); ?>login_device/list_devices" class="btn btn-default btn-sm">Kembali</a>
    </p>

    <table class="table table-bordered table-striped">
        <thead>
        <tr>
            <th>ID</th>
            <th>Nama Device</th>
            <th>IP</th>
            <th>User Agent</th>
            <th>Alasan</th>
            <th>Status</th>
            <th>Waktu</th>
        </tr>
        </thead>
        <tbody>
        <?php if (count($requests) == 0): ?>
            <tr><td colspan="7" style="text-align:center;">Belum ada laporan.</td></tr>
        <?php else: ?>
            <?php foreach ($requests as $r): ?>
                <tr>
                    <td><?php echo (int)$r->id; ?></td>
                    <td><?php echo htmlspecialchars($r->device_name); ?></td>
                    <td><?php echo htmlspecialchars($r->ip_address); ?></td>
                    <td><small><?php echo htmlspecialchars($r->user_agent); ?></small></td>
                    <td><?php echo htmlspecialchars($r->reason); ?></td>
                    <td><span class="label label-warning"><?php echo htmlspecialchars($r->status); ?></span></td>
                    <td><?php echo htmlspecialchars($r->created); ?></td>
                </tr>
            <?php endforeach; ?>
        <?php endif; ?>
        </tbody>
    </table>

    <p>
        <small>
            Jika ada laporan, admin bisa mendaftarkan ulang device lewat menu <b>Device Registry → Tambah Device</b>,
            lalu memberikan link aktivasi baru ke perangkat outlet.
        </small>
    </p>
</div>
</body>
</html>