mejora ui x exageradas
This commit is contained in:
@@ -26,11 +26,11 @@
|
||||
<div class="grid grid-cols-2 gap-4 flex-1">
|
||||
<div>
|
||||
<label class="text-xs text-[var(--brand-text-muted)]">Fecha desde</label>
|
||||
<UInput :model-value="fechaDesde" type="date" @input="onManualDateChange" />
|
||||
<UInput :model-value="fechaDesde" type="date" @input="(e) => onManualDateChange('desde', e)" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-xs text-[var(--brand-text-muted)]">Fecha hasta</label>
|
||||
<UInput :model-value="fechaHasta" type="date" @input="onManualDateChange" />
|
||||
<UInput :model-value="fechaHasta" type="date" @input="(e) => onManualDateChange('hasta', e)" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -114,24 +114,21 @@ function selectPreset(preset: PresetValue) {
|
||||
}
|
||||
}
|
||||
|
||||
function onManualDateChange(event: Event) {
|
||||
function onManualDateChange(type: 'desde' | 'hasta', event: Event) {
|
||||
const target = event.target as HTMLInputElement
|
||||
const value = target.value
|
||||
const value = target.value || null
|
||||
|
||||
// Si el usuario modifica las fechas manualmente, cambiar a "Personalizado"
|
||||
emit('update:selectedPreset', 'custom')
|
||||
|
||||
// Actualizar la fecha correspondiente según el input
|
||||
if (target.type === 'date') {
|
||||
const label = target.labels?.[0]?.textContent
|
||||
if (label?.includes('desde')) {
|
||||
emit('update:fechaDesde', value)
|
||||
} else if (label?.includes('hasta')) {
|
||||
emit('update:fechaHasta', value)
|
||||
}
|
||||
// Actualizar la fecha correspondiente
|
||||
if (type === 'desde') {
|
||||
emit('update:fechaDesde', value)
|
||||
} else {
|
||||
emit('update:fechaHasta', value)
|
||||
}
|
||||
|
||||
console.log('Manual date change, preset set to custom')
|
||||
console.log(`Manual date change (${type}):`, value, 'preset set to custom')
|
||||
}
|
||||
|
||||
function clearPreset() {
|
||||
|
||||
Reference in New Issue
Block a user