<?php $assignment = $assignment ?? []; ?>
<div class="enterprise-settings-fields enterprise-settings-fields--single">
    <div class="enterprise-field">
        <label class="enterprise-field-label">Asset Type <span class="text-danger">*</span></label>
        <select name="asset_type_id" class="form-select" required>
            <option value="">Select type...</option>
            <?php foreach ($types as $t): ?>
                <option value="<?= $t['id'] ?>" <?= old('asset_type_id', $assignment['asset_type_id'] ?? '') == $t['id'] ? 'selected' : '' ?>>
                    <?= esc($t['name']) ?> (<?= esc($t['code']) ?>)
                </option>
            <?php endforeach; ?>
        </select>
    </div>
    <div class="enterprise-field">
        <label class="enterprise-field-label">Item Name <span class="text-danger">*</span></label>
        <input type="text" name="asset_name" class="form-control" value="<?= esc(old('asset_name', $assignment['asset_name'] ?? '')) ?>" required placeholder="e.g. iPhone 14, Floor cleaner kit, Company SIM">
    </div>
    <div class="enterprise-field">
        <label class="enterprise-field-label">Serial / IMEI / Identifier</label>
        <input type="text" name="identifier" class="form-control" value="<?= esc(old('identifier', $assignment['identifier'] ?? '')) ?>" placeholder="IMEI, SIM number, asset tag">
    </div>
    <div class="enterprise-field">
        <label class="enterprise-field-label">Quantity</label>
        <input type="number" name="quantity" class="form-control" step="0.01" min="0.01" value="<?= esc(old('quantity', $assignment['quantity'] ?? 1)) ?>">
    </div>
    <div class="enterprise-field">
        <label class="enterprise-field-label">Assigned Date <span class="text-danger">*</span></label>
        <input type="date" name="assigned_date" class="form-control" value="<?= esc(old('assigned_date', $assignment['assigned_date'] ?? date('Y-m-d'))) ?>" required>
    </div>
    <div class="enterprise-field">
        <label class="enterprise-field-label">Condition on Assign</label>
        <input type="text" name="condition_on_assign" class="form-control" value="<?= esc(old('condition_on_assign', $assignment['condition_on_assign'] ?? '')) ?>" placeholder="e.g. New, Good, Used">
    </div>
    <div class="enterprise-field">
        <label class="enterprise-field-label">Notes</label>
        <textarea name="notes" class="form-control" rows="3"><?= esc(old('notes', $assignment['notes'] ?? '')) ?></textarea>
    </div>
</div>
