<?php $list = $list ?? []; ?>
<div class="enterprise-settings-fields">
    <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', $list['name'] ?? '')) ?>" required>
    </div>
    <div class="enterprise-field">
        <label class="enterprise-field-label">Code</label>
        <input type="text" name="code" class="form-control text-uppercase" maxlength="30" value="<?= esc(old('code', $list['code'] ?? '')) ?>">
    </div>
    <div class="enterprise-field">
        <label class="enterprise-field-label">Currency</label>
        <input type="text" name="currency" class="form-control text-uppercase" maxlength="3"
               value="<?= esc(old('currency', $list['currency'] ?? 'USD')) ?>">
    </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', $list['status'] ?? 'active') === $s ? 'selected' : '' ?>><?= ucfirst($s) ?></option>
            <?php endforeach; ?>
        </select>
    </div>
    <div class="enterprise-field" style="grid-column: 1 / -1;">
        <label class="enterprise-field-label">Notes</label>
        <textarea name="notes" class="form-control" rows="3"><?= esc(old('notes', $list['notes'] ?? '')) ?></textarea>
    </div>
    <?= $this->include('Modules\Sale\Views\partials\document_lines', [
        'lines' => $lines ?? [],
        'mode'  => 'price_list',
    ]) ?>
</div>
