<?php
use App\Core\Csrf;
use function App\Core\e;

$package = $package ?? [];
?>
<form class="studio-form package-form" data-package-form>
    <?= Csrf::field() ?>
    <input type="hidden" name="id" value="<?= e((string) ($package['id'] ?? '')) ?>" data-package-field="id">

    <label>
        Paket adi
        <input name="name" value="<?= e((string) ($package['name'] ?? '')) ?>" maxlength="120" required data-package-field="name">
    </label>

    <label>
        Aciklama
        <textarea name="description" required data-package-field="description"><?= e((string) ($package['description'] ?? '')) ?></textarea>
    </label>

    <div class="form-grid">
        <label>
            Aylik fiyat
            <input name="price_monthly" type="number" min="0.01" step="0.01" value="<?= e((string) ($package['price_monthly'] ?? '')) ?>" required data-package-field="price_monthly">
        </label>
        <label>
            6 aylik fiyat
            <input name="price_6_month" type="number" min="0.01" step="0.01" value="<?= e((string) ($package['price_6_month'] ?? '')) ?>" required data-package-field="price_6_month">
        </label>
        <label>
            12 aylik fiyat
            <input name="price_12_month" type="number" min="0.01" step="0.01" value="<?= e((string) ($package['price_12_month'] ?? '')) ?>" required data-package-field="price_12_month">
        </label>
        <label>
            Durum
            <select name="status" data-package-field="status">
                <option value="active" <?= (($package['status'] ?? 'active') === 'active') ? 'selected' : '' ?>>Aktif</option>
                <option value="inactive" <?= (($package['status'] ?? '') === 'inactive') ? 'selected' : '' ?>>Pasif</option>
            </select>
        </label>
    </div>

    <div class="package-form-actions">
        <button class="pill primary" type="submit" data-package-submit>Paket Olustur</button>
        <button class="pill" type="button" data-package-cancel hidden>Vazgec</button>
    </div>
</form>
