codex es otro pedo, lo soluciono
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m7s
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m7s
This commit is contained in:
@@ -41,38 +41,36 @@
|
|||||||
|
|
||||||
<UCard>
|
<UCard>
|
||||||
<UTable
|
<UTable
|
||||||
v-model="selected"
|
:data="lotes"
|
||||||
:rows="lotes"
|
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:empty-state="{
|
:empty-state="{
|
||||||
icon: 'i-heroicons-inbox',
|
icon: 'i-heroicons-inbox',
|
||||||
label: 'No hay lotes registrados'
|
label: 'No hay lotes registrados'
|
||||||
}"
|
}"
|
||||||
@select="handleSelect"
|
|
||||||
>
|
>
|
||||||
<template #codigo-data="{ row }">
|
<template #codigo-cell="{ row }">
|
||||||
<span class="font-mono font-semibold">{{ row.codigo || '-' }}</span>
|
<span class="font-mono font-semibold">{{ row.codigo || '-' }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #tipo-data="{ row }">
|
<template #tipo-cell="{ row }">
|
||||||
<UBadge :color="getTipoColor(row.tipo)" variant="subtle">
|
<UBadge :color="getTipoColor(row.tipo)" variant="subtle">
|
||||||
{{ getTipoLabel(row.tipo) }}
|
{{ getTipoLabel(row.tipo) }}
|
||||||
</UBadge>
|
</UBadge>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #cantidad_kg-data="{ row }">
|
<template #cantidad_kg-cell="{ row }">
|
||||||
<span v-if="row.cantidad_kg" class="font-medium">
|
<span v-if="row.cantidad_kg" class="font-medium">
|
||||||
{{ row.cantidad_kg.toLocaleString('es-AR') }} kg
|
{{ row.cantidad_kg.toLocaleString('es-AR') }} kg
|
||||||
</span>
|
</span>
|
||||||
<span v-else class="text-gray-400">-</span>
|
<span v-else class="text-gray-400">-</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #fecha_creado-data="{ row }">
|
<template #fecha_creado-cell="{ row }">
|
||||||
{{ formatDate(row.fecha_creado) }}
|
{{ formatDate(row.fecha_creado) }}
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #actions-data="{ row }">
|
<template #actions-cell="{ row }">
|
||||||
<div class="flex gap-1">
|
<div class="flex gap-1">
|
||||||
<UButton
|
<UButton
|
||||||
icon="i-heroicons-eye"
|
icon="i-heroicons-eye"
|
||||||
@@ -101,6 +99,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import type { ColumnDef } from '@tanstack/vue-table'
|
||||||
import type { Lote } from '~/composables/useLotes'
|
import type { Lote } from '~/composables/useLotes'
|
||||||
|
|
||||||
console.log('🟢 LotesTable: <script setup> ejecutándose')
|
console.log('🟢 LotesTable: <script setup> ejecutándose')
|
||||||
@@ -118,16 +117,15 @@ console.log('🟢 LotesTable: useLotes() completado')
|
|||||||
|
|
||||||
const lotes = ref<Lote[]>([])
|
const lotes = ref<Lote[]>([])
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const selected = ref<Lote[]>([])
|
|
||||||
const filtroTipo = ref('')
|
const filtroTipo = ref('')
|
||||||
const error = ref<string | null>(null)
|
const error = ref<string | null>(null)
|
||||||
|
|
||||||
const columns = [
|
const columns: ColumnDef<Lote>[] = [
|
||||||
{ key: 'codigo', label: 'Código' },
|
{ accessorKey: 'codigo', id: 'codigo', header: 'Código' },
|
||||||
{ key: 'tipo', label: 'Tipo' },
|
{ accessorKey: 'tipo', id: 'tipo', header: 'Tipo' },
|
||||||
{ key: 'cantidad_kg', label: 'Cantidad' },
|
{ accessorKey: 'cantidad_kg', id: 'cantidad_kg', header: 'Cantidad' },
|
||||||
{ key: 'fecha_creado', label: 'Fecha Creación' },
|
{ accessorKey: 'fecha_creado', id: 'fecha_creado', header: 'Fecha Creación' },
|
||||||
{ key: 'actions', label: 'Acciones' },
|
{ id: 'actions', header: 'Acciones' },
|
||||||
]
|
]
|
||||||
|
|
||||||
const loadLotes = async () => {
|
const loadLotes = async () => {
|
||||||
@@ -152,10 +150,6 @@ const loadLotes = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSelect = (rows: Lote[]) => {
|
|
||||||
selected.value = rows
|
|
||||||
}
|
|
||||||
|
|
||||||
const getTipoLabel = (tipo: string) => {
|
const getTipoLabel = (tipo: string) => {
|
||||||
const found = TIPOS_LOTE.find((t) => t.value === tipo)
|
const found = TIPOS_LOTE.find((t) => t.value === tipo)
|
||||||
return found?.label || tipo
|
return found?.label || tipo
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
<UCard>
|
<UCard>
|
||||||
<UTable
|
<UTable
|
||||||
:rows="operaciones"
|
:data="operaciones"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:empty-state="{
|
:empty-state="{
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
label: 'No hay operaciones registradas'
|
label: 'No hay operaciones registradas'
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<template #tipo-data="{ row }">
|
<template #tipo-cell="{ row }">
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<UIcon :name="getTipoIcon(row.tipo)" class="w-4 h-4" />
|
<UIcon :name="getTipoIcon(row.tipo)" class="w-4 h-4" />
|
||||||
<UBadge :color="getTipoColor(row.tipo)" variant="subtle">
|
<UBadge :color="getTipoColor(row.tipo)" variant="subtle">
|
||||||
@@ -58,11 +58,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #fecha-data="{ row }">
|
<template #fecha-cell="{ row }">
|
||||||
{{ formatDate(row.fecha) }}
|
{{ formatDate(row.fecha) }}
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #actions-data="{ row }">
|
<template #actions-cell="{ row }">
|
||||||
<div class="flex gap-1">
|
<div class="flex gap-1">
|
||||||
<UButton
|
<UButton
|
||||||
icon="i-heroicons-eye"
|
icon="i-heroicons-eye"
|
||||||
@@ -78,6 +78,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import type { ColumnDef } from '@tanstack/vue-table'
|
||||||
import type { Operacion } from '~/composables/useLotes'
|
import type { Operacion } from '~/composables/useLotes'
|
||||||
|
|
||||||
console.log('🟡 OperacionesTable: <script setup> ejecutándose')
|
console.log('🟡 OperacionesTable: <script setup> ejecutándose')
|
||||||
@@ -96,11 +97,11 @@ const loading = ref(false)
|
|||||||
const filtroTipo = ref('')
|
const filtroTipo = ref('')
|
||||||
const error = ref<string | null>(null)
|
const error = ref<string | null>(null)
|
||||||
|
|
||||||
const columns = [
|
const columns: ColumnDef<Operacion>[] = [
|
||||||
{ key: 'tipo', label: 'Tipo de Operación' },
|
{ accessorKey: 'tipo', id: 'tipo', header: 'Tipo de Operación' },
|
||||||
{ key: 'fecha', label: 'Fecha' },
|
{ accessorKey: 'fecha', id: 'fecha', header: 'Fecha' },
|
||||||
{ key: 'lugar_id', label: 'Lugar' },
|
{ accessorKey: 'lugar_id', id: 'lugar_id', header: 'Lugar' },
|
||||||
{ key: 'actions', label: 'Acciones' },
|
{ id: 'actions', header: 'Acciones' },
|
||||||
]
|
]
|
||||||
|
|
||||||
const loadOperaciones = async () => {
|
const loadOperaciones = async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user