<?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 placeholder="e.g. Mobile Phone, Cleaning Supplies">
    </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">Category</label>
        <input type="text" name="category" class="form-control" value="<?= esc(old('category', $type['category'] ?? '')) ?>" placeholder="e.g. electronics, supplies, telecom">
    </div>
    <div class="enterprise-field">
        <div class="form-check">
            <input class="form-check-input" type="checkbox" name="requires_identifier" value="1" id="requires_identifier"
                <?= old('requires_identifier', $type['requires_identifier'] ?? 0) ? 'checked' : '' ?>>
            <label class="form-check-label" for="requires_identifier">Requires serial / IMEI / identifier</label>
        </div>
    </div>
    <div class="enterprise-field">
        <div class="form-check">
            <input class="form-check-input" type="checkbox" name="is_consumable" value="1" id="is_consumable"
                <?= old('is_consumable', $type['is_consumable'] ?? 0) ? 'checked' : '' ?>>
            <label class="form-check-label" for="is_consumable">Consumable (quantity-based, e.g. cleaning supplies)</label>
        </div>
    </div>
    <div class="enterprise-field">
        <div class="form-check">
            <input class="form-check-input" type="checkbox" name="requires_return" value="1" id="requires_return"
                <?= old('requires_return', $type['requires_return'] ?? 1) ? 'checked' : '' ?>>
            <label class="form-check-label" for="requires_return">Must be returned when employee leaves</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>
