frontend admin refakctorálás
This commit is contained in:
@@ -12,6 +12,30 @@
|
||||
label="Irányítószám / Város"
|
||||
placeholder="Kezdj el gépelni (pl. 1011 vagy Budapest)..."
|
||||
/>
|
||||
<!-- P0 BUGFIX: Fallback plain text inputs for unknown zip/city
|
||||
When the autocomplete returns no results, the user can still
|
||||
type any zip/city combination manually. These fields are always
|
||||
visible and editable, ensuring data is never lost. -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-3">
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-slate-400 mb-1">Irányítószám (kézi)</label>
|
||||
<input
|
||||
:value="modelValue.zip"
|
||||
@input="updateField('zip', ($event.target as HTMLInputElement).value)"
|
||||
placeholder="pl. 1151"
|
||||
class="w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500 text-sm"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-slate-400 mb-1">Város (kézi)</label>
|
||||
<input
|
||||
:value="modelValue.city"
|
||||
@input="updateField('city', ($event.target as HTMLInputElement).value)"
|
||||
placeholder="pl. Budapest"
|
||||
class="w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500 text-sm"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Street name -->
|
||||
@@ -205,17 +229,23 @@ const selectedLocation = computed<LocationItem | null>(() => {
|
||||
/**
|
||||
* Handle location selection from SmartLocationInput.
|
||||
* Updates the zip and city fields in the address model.
|
||||
*
|
||||
* P0 BUGFIX: When the autocomplete emits null (user types something
|
||||
* that doesn't match any known location), we NO LONGER clear zip/city.
|
||||
* Instead, we preserve the existing values. The user can manually edit
|
||||
* zip/city using the fallback plain text inputs below the autocomplete.
|
||||
* This ensures that typing "1151 Budapest" (which may not be in the
|
||||
* autocomplete DB) doesn't silently erase the data.
|
||||
*/
|
||||
function onLocationSelected(location: LocationItem | null) {
|
||||
const updated = { ...props.modelValue }
|
||||
if (location) {
|
||||
const updated = { ...props.modelValue }
|
||||
updated.zip = location.zip_code
|
||||
updated.city = location.city
|
||||
} else {
|
||||
updated.zip = null
|
||||
updated.city = null
|
||||
emit('update:modelValue', updated)
|
||||
}
|
||||
emit('update:modelValue', updated)
|
||||
// P0 BUGFIX: When location is null, do NOT clear zip/city.
|
||||
// The fallback text inputs allow manual entry of unknown locations.
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user