<?php
function org_h($v) {
    return htmlspecialchars((string)$v, ENT_QUOTES, 'UTF-8');
}

$organization = $organization ?? [];
?>

<div class="container-fluid py-3">

    <div class="card border-0 shadow-sm mb-4" style="border-radius:22px;">
        <div class="card-body">

            <h4 class="fw-bold mb-3">
                <i class="fa fa-building"></i>
                إضافة مؤسسة
            </h4>

            <form method="post"
                  action="/easychair/admin/organizations/store"
                  class="row g-3">

                <div class="col-md-6">
                    <label class="form-label">Name</label>
                    <input name="name"
                           class="form-control"
                           value="<?= org_h($organization['name'] ?? '') ?>"
                           required>
                </div>

                <div class="col-md-6">
                    <label class="form-label">Arabic Name</label>
                    <input name="name_ar"
                           class="form-control"
                           value="<?= org_h($organization['name_ar'] ?? '') ?>">
                </div>

                <div class="col-md-6">
                    <label class="form-label">Email</label>
                    <input name="email"
                           class="form-control"
                           value="<?= org_h($organization['email'] ?? '') ?>">
                </div>

                <div class="col-md-6">
                    <label class="form-label">Phone</label>
                    <input name="phone"
                           class="form-control"
                           value="<?= org_h($organization['phone'] ?? '') ?>">
                </div>

                <div class="col-md-3">
                    <button class="btn btn-success w-100">
                        Save Organization
                    </button>
                </div>

                <div class="col-md-3">
                    <a href="/easychair/admin/organizations"
                       class="btn btn-secondary w-100">
                        Cancel
                    </a>
                </div>

            </form>

        </div>
    </div>

</div>
