<?php $type = $type ?? []; ?>
<div class="enterprise-settings-fields enterprise-settings-fields--single">
    <div class="enterprise-field">
        <label class="enterprise-field-label">Name <span class="text-danger">*</span></label>
        <input type="text" name="name" class="form-control" value="<?= esc(old('name', $type['name'] ?? '')) ?>" required>
    </div>
    <div class="enterprise-field">
        <label class="enterprise-field-label">Code <span class="text-danger">*</span></label>
        <input type="text" name="code" class="form-control text-uppercase" maxlength="10" value="<?= esc(old('code', $type['code'] ?? '')) ?>" required>
    </div>
    <div class="enterprise-field">
        <label class="enterprise-field-label">Days Per Year</label>
        <input type="number" name="days_per_year" class="form-control" step="0.5" min="0" value="<?= esc(old('days_per_year', $type['days_per_year'] ?? 0)) ?>">
    </div>
    <div class="enterprise-field">
        <div class="form-check">
            <input class="form-check-input" type="checkbox" name="is_paid" value="1" id="is_paid"
                <?= old('is_paid', $type['is_paid'] ?? 1) ? 'checked' : '' ?>>
            <label class="form-check-label" for="is_paid">Paid leave</label>
        </div>
    </div>
    <div class="enterprise-field">
        <div class="form-check">
            <input class="form-check-input" type="checkbox" name="requires_approval" value="1" id="requires_approval"
                <?= old('requires_approval', $type['requires_approval'] ?? 1) ? 'checked' : '' ?>>
            <label class="form-check-label" for="requires_approval">Requires manager approval</label>
        </div>
    </div>
    <div class="enterprise-field">
        <label class="enterprise-field-label">Description</label>
        <textarea name="description" class="form-control" rows="3"><?= esc(old('description', $type['description'] ?? '')) ?></textarea>
    </div>
    <div class="enterprise-field">
        <label class="enterprise-field-label">Status</label>
        <select name="status" class="form-select">
            <?php foreach (['active', 'inactive'] as $s): ?>
                <option value="<?= $s ?>" <?= old('status', $type['status'] ?? 'active') === $s ? 'selected' : '' ?>><?= ucfirst($s) ?></option>
            <?php endforeach; ?>
        </select>
    </div>
</div>
