<?php $warehouse = $warehouse ?? []; ?>
<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', $warehouse['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="30" value="<?= esc(old('code', $warehouse['code'] ?? '')) ?>" required>
    </div>
    <div class="enterprise-field">
        <label class="enterprise-field-label">Address</label>
        <input type="text" name="address" class="form-control" value="<?= esc(old('address', $warehouse['address'] ?? '')) ?>">
    </div>
    <div class="enterprise-field">
        <label class="enterprise-field-label">City</label>
        <input type="text" name="city" class="form-control" value="<?= esc(old('city', $warehouse['city'] ?? '')) ?>">
    </div>
    <div class="enterprise-field">
        <label class="enterprise-field-label">Country</label>
        <input type="text" name="country" class="form-control" value="<?= esc(old('country', $warehouse['country'] ?? '')) ?>">
    </div>
    <div class="enterprise-field">
        <div class="form-check">
            <input type="checkbox" name="is_default" value="1" class="form-check-input" id="is_default"
                   <?= old('is_default', $warehouse['is_default'] ?? 0) ? 'checked' : '' ?>>
            <label class="form-check-label" for="is_default">Default warehouse</label>
        </div>
    </div>
    <div class="enterprise-field">
        <label class="enterprise-field-label">Notes</label>
        <textarea name="notes" class="form-control" rows="3"><?= esc(old('notes', $warehouse['notes'] ?? '')) ?></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', $warehouse['status'] ?? 'active') === $s ? 'selected' : '' ?>><?= ucfirst($s) ?></option>
            <?php endforeach; ?>
        </select>
    </div>
</div>
