<?php require __DIR__ . '/../../layouts/header.php'; $lang=current_lang(); ?>
<?php
$t = fn($ar,$en)=>($lang==='ar'?$ar:$en);
$title = $t($title_ar??'',$title_en??'');
$note  = $t($note_ar??'',$note_en??'');
$orgId = (int)($org_id??0);
$confs = $confs??[];
?>
<div class="container py-3">
  <div class="d-flex justify-content-between align-items-center flex-wrap gap-2 mb-3">
    <h4 class="mb-0"><i class="fa-solid fa-layer-group"></i> <?= e($title) ?></h4>
    <span class="badge bg-dark"><i class="fa-solid fa-building"></i> <?= e($t('Org','Org')) ?> #<?= e((string)$orgId) ?></span>
  </div>

  <div class="alert alert-info border-0 shadow-sm">
    <i class="fa-solid fa-circle-info"></i> <?= e($note) ?>
  </div>

  <div class="card border-0 shadow-sm">
    <div class="card-header bg-white fw-bold">
      <i class="fa-solid fa-calendar-days"></i> <?= e($t('مؤتمرات المؤسسة','Organization Conferences')) ?>
    </div>
    <div class="table-responsive">
      <table class="table table-hover mb-0">
        <thead class="table-light">
          <tr>
            <th>#</th>
            <th><?= e($t('العنوان','Title')) ?></th>
            <th><?= e($t('الحالة','Active')) ?></th>
          </tr>
        </thead>
        <tbody>
          <?php foreach($confs as $c): ?>
            <tr>
              <td class="text-muted"><?= e((string)$c['id']) ?></td>
              <td><?= e((string)($lang==='ar'?($c['title_ar']??''):($c['title_en']??''))) ?></td>
              <td>
                <?= ((int)($c['is_active']??1)===1)
                  ? '<span class="badge bg-success">ON</span>'
                  : '<span class="badge bg-danger">OFF</span>'; ?>
              </td>
            </tr>
          <?php endforeach; ?>
          <?php if(empty($confs)): ?><tr><td colspan="3" class="text-center text-muted py-4">—</td></tr><?php endif; ?>
        </tbody>
      </table>
    </div>
  </div>
</div>
<?php require __DIR__ . '/../../layouts/footer.php'; ?>
