<?php
/**
 * (c) ININOUT & PYXIS. All Rights Reserved.
 * Wszelkie modyfikacje tego pliku wymagaja zgloszenia oraz zgody autorow.
 * Any modifications to this file require notification and consent of the authors.
 */
/**
 * i-BOK 5 - Urządzenia klienckie / MAC lista (admin)
 */

$devices = vbk_read_maclista();
?>

<div class="fade-in">
    <h4 class="mb-4">
        <i class="bi bi-router me-2"></i> <?= __('admin_devices.title') ?>
        <span class="badge bg-secondary ms-2"><?= count($devices) ?></span>
    </h4>

    <?= ibok_help_section('admin_urzadzenia', __('help.show_help'), __('help_admin.urzadzenia_section_content')) ?>

    <div class="card">
        <div class="card-body">
            <?php if (empty($devices)): ?>
                <p class="text-muted text-center py-4"><?= __('admin_devices.no_data') ?></p>
            <?php else: ?>
                <div class="table-responsive">
                    <table class="table table-hover ibok-table" id="tblUrzadzenia">
                        <thead>
                            <tr>
                                <th><?= __('admin_devices.id') ?></th>
                                <th><?= __('admin_devices.client_name') ?></th>
                                <th><?= __('admin_devices.ip') ?></th>
                                <th><?= __('admin_devices.mac') ?></th>
                                <th><?= __('admin_devices.type') ?></th>
                                <th><?= __('admin_devices.model') ?></th>
                                <th><?= __('admin_devices.connected') ?></th>
                                <th><?= __('admin_devices.ip_pub') ?></th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php foreach ($devices as $d): ?>
                            <tr class="<?= ($d['wylaczony'] !== '0') ? 'text-muted' : '' ?>">
                                <td><?= e($d['nr']) ?></td>
                                <td><?= e($d['klient'] ?? '') ?></td>
                                <td class="font-monospace"><?= e($d['ip']) ?></td>
                                <td class="font-monospace small"><?= e($d['mac']) ?></td>
                                <td><?= e($d['rodzaj']) ?></td>
                                <td><?= e($d['typ']) ?></td>
                                <td class="small"><?= e($d['podl_do']) ?></td>
                                <td class="font-monospace"><?= e($d['ip_pub']) ?></td>
                            </tr>
                            <?php endforeach; ?>
                        </tbody>
                    </table>
                </div>
            <?php endif; ?>
        </div>
    </div>
</div>
