<?php require __DIR__ . '/../../layouts/header.php'; $lang=current_lang(); ?>
<?php $t=fn($ar,$en)=>($lang==='ar'?$ar:$en); $row=$row??null; ?>
<div class="container py-3">
  <div class="d-flex justify-content-between align-items-center mb-3">
    <h4 class="mb-0"><i class="fa-solid fa-building"></i> <?= e($t('بيانات المؤسسة','Organization')) ?></h4>
    <a class="btn btn-outline-secondary" href="<?= e(base_path('admin/owner/orgs')) ?>"><i class="fa-solid fa-arrow-right"></i> <?= e($t('عودة','Back')) ?></a>
  </div>

  <div class="card border-0 shadow-sm">
    <div class="card-body">
      <form method="post" action="<?= e(base_path('admin/owner/orgs/save')) ?>" class="row g-2">
        <input type="hidden" name="id" value="<?= e((string)($row['id']??0)) ?>">

        <div class="col-md-4">
          <label class="form-label"><?= e($t('الكود','Code')) ?></label>
          <input class="form-control" name="code" required value="<?= e((string)($row['code']??'')) ?>">
        </div>

        <div class="col-md-6">
          <label class="form-label"><?= e($t('الاسم','Name')) ?></label>
          <input class="form-control" name="name" required value="<?= e((string)($row['name']??'')) ?>">
        </div>

        <div class="col-md-2">
          <label class="form-label"><?= e($t('الحالة','Status')) ?></label>
          <select class="form-select" name="is_active">
            <option value="1" <?= ((int)($row['is_active']??1)===1?'selected':'') ?>><?= e($t('نشط','Active')) ?></option>
            <option value="0" <?= ((int)($row['is_active']??1)!==1?'selected':'') ?>><?= e($t('غير نشط','Inactive')) ?></option>
          </select>
        </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')) ?></button>
        </div>
      </form>
    </div>
  </div>
</div>
<?php require __DIR__ . '/../../layouts/footer.php'; ?>
