<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>
<div class="container">
  <h3><?php echo _l('desk_moloni_webhook_logs'); ?></h3>
  <?php if (empty($logs)) { ?>
    <p>No webhook logs found.</p>
  <?php } else { ?>
    <table class="table table-striped">
      <thead>
        <tr>
          <th>Timestamp</th>
          <th>Event</th>
          <th>Status</th>
          <th>Error</th>
        </tr>
      </thead>
      <tbody>
        <?php foreach ($logs as $log) { ?>
          <tr>
            <td><?php echo htmlspecialchars($log['timestamp'] ?? ''); ?></td>
            <td><?php echo htmlspecialchars($log['endpoint'] ?? ''); ?></td>
            <td><?php echo empty($log['error']) ? 'SUCCESS' : 'ERROR'; ?></td>
            <td><?php echo htmlspecialchars($log['error'] ?? ''); ?></td>
          </tr>
        <?php } ?>
      </tbody>
    </table>
  <?php } ?>
</div>
