<?php require __DIR__ . '/../../layouts/header.php'; $lang=current_lang(); ?>
<?php
$t=fn($ar,$en)=>($lang==='ar'?$ar:$en);
$confs=$confs??[]; $confId=(int)($confId??0); $subs=$subs??[];
?>
<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-gavel"></i> <?= e($t('لوحة القرارات','Decision Board')) ?></h4>
    <form method="get" class="d-flex gap-2">
      <select class="form-select" name="conference_id" onchange="this.form.submit()">
        <?php foreach($confs as $c): ?>
          <option value="<?= e((string)$c['id']) ?>" <?= ((int)$c['id']===$confId?'selected':'') ?>>
            <?= e($lang==='ar' ? (string)($c['title_ar']??'') : (string)($c['title_en']??'')) ?>
          </option>
        <?php endforeach; ?>
      </select>
    </form>
  </div>

  <div class="card border-0 shadow-sm">
    <div class="card-body">
      <form method="post" action="<?= e(base_path('admin/decision-board/decide')) ?>" class="row g-2">
        <input type="hidden" name="conference_id" value="<?= e((string)$confId) ?>">

        <div class="col-md-5">
          <label class="form-label"><?= e($t('البحث','Submission')) ?></label>
          <select class="form-select" name="submission_id" required>
            <?php foreach($subs as $s): ?>
              <option value="<?= e((string)$s['id']) ?>">#<?= e((string)$s['id']) ?> — <?= e((string)($s['title_ar']??$s['title_en']??'—')) ?></option>
            <?php endforeach; ?>
          </select>
        </div>

        <div class="col-md-3">
          <label class="form-label"><?= e($t('القرار','Decision')) ?></label>
          <select class="form-select" name="decision" required>
            <option value="accepted"><?= e($t('مقبول','Accepted')) ?></option>
            <option value="minor_revision"><?= e($t('تعديل بسيط','Minor Revision')) ?></option>
            <option value="major_revision"><?= e($t('تعديل جوهري','Major Revision')) ?></option>
            <option value="rejected"><?= e($t('مرفوض','Rejected')) ?></option>
          </select>
        </div>

        <div class="col-md-4">
          <label class="form-label"><?= e($t('ملاحظات','Notes')) ?></label>
          <input class="form-control" name="notes" placeholder="<?= e($t('ملاحظات مختصرة للقرار','Short notes')) ?>">
        </div>

        <div class="col-12 d-grid mt-2">
          <button class="btn btn-success"><i class="fa-solid fa-floppy-disk"></i> <?= e($t('حفظ القرار','Save Decision')) ?></button>
        </div>
      </form>
    </div>
  </div>
</div>
<?php require __DIR__ . '/../../layouts/footer.php'; ?>
