mejoras ui/ux

This commit is contained in:
2025-10-01 06:51:39 -06:00
parent c4719d95cc
commit 32b10e1ad6
6 changed files with 557 additions and 171 deletions

View File

@@ -22,10 +22,10 @@
size="xs"
variant="ghost"
color="neutral"
@click="limpiarTodos"
icon="i-lucide-x"
@click="resetearAHoy"
icon="i-lucide-rotate-ccw"
>
Limpiar todos
Resetear a Hoy
</UButton>
</div>
</div>
@@ -69,7 +69,7 @@
class="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-medium bg-purple-500/10 text-purple-400 border border-purple-500/30 transition-all hover:bg-purple-500/20"
>
<UIcon name="i-lucide-calendar" class="size-3" />
<span>{{ fechaDesde || '—' }} {{ fechaHasta || '—' }}</span>
<span>{{ getPresetLabel() }}</span>
<button
@click="removeFechas"
class="ml-1 hover:text-purple-300 transition-colors"
@@ -179,6 +179,7 @@
interface Props {
clientes: any[]
selectedClienteIds: number[]
selectedPreset: string
fechaDesde: string | null
fechaHasta: string | null
selectedTipos: string[]
@@ -244,6 +245,29 @@ function getLabelEstado(value: string): string {
return estado?.label || value
}
function getPresetLabel(): string {
// Si es un preset conocido, mostrar su nombre
const presetLabels: Record<string, string> = {
'hoy': 'Hoy',
'semana': 'Esta Semana',
'mes': 'Este Mes',
'ytd': 'YTD',
'cosecha-20-21': 'Cosecha 20-21',
'cosecha-21-22': 'Cosecha 21-22',
'cosecha-22-23': 'Cosecha 22-23',
'cosecha-23-24': 'Cosecha 23-24',
'cosecha-24-25': 'Cosecha 24-25',
'cosecha-25-26': 'Cosecha 25-26'
}
if (props.selectedPreset && props.selectedPreset !== 'custom' && presetLabels[props.selectedPreset]) {
return presetLabels[props.selectedPreset]
}
// Si es personalizado, mostrar las fechas
return `${props.fechaDesde || '—'}${props.fechaHasta || '—'}`
}
function removeCliente(id: number) {
emit('update:selectedClienteIds', props.selectedClienteIds.filter(cid => cid !== id))
}
@@ -278,11 +302,9 @@ function removeNoFilter() {
emit('update:noFilter', false)
}
function limpiarTodos() {
function resetearAHoy() {
emit('update:selectedClienteIds', [])
emit('update:fechaDesde', null)
emit('update:fechaHasta', null)
emit('update:selectedPreset', '')
emit('update:selectedPreset', 'hoy')
emit('update:selectedTipos', [])
emit('update:selectedEstados', [])
emit('update:selectedUbicaciones', [])