feat: mostrar detalle y nombre en ventanas de sincronización Tryton

- Fallidos muestran ID + Nombre/Código + Detalle (causa del fallo)
- Actualizados muestran columna Detalle con los cambios aplicados
- Creados/Sin cambios/Verificados muestran ID + Nombre; ventas ID + Código
- Formateadores toleran backend anterior (IDs sueltos)
This commit is contained in:
2026-08-15 16:05:22 -05:00
parent 2b00b2556a
commit 87c01b11a7
4 changed files with 99 additions and 38 deletions

View File

@@ -51,9 +51,13 @@
<v-card-title class="bg-error text-white"> Fallidos ({{ result.failed?.length || 0 }})</v-card-title>
<v-card-text>
<v-data-table
:items="formatItems(result.failed)"
:items="formatSalesResults(result.failed)"
density="compact"
:headers="[{ title: 'ID', key: 'id' }]"
:headers="[
{ title: 'ID', key: 'id' },
{ title: 'Código', key: 'code' },
{ title: 'Detalle', key: 'detail' }
]"
></v-data-table>
</v-card-text>
</v-card>
@@ -64,9 +68,12 @@
<v-card-title class="bg-success text-white"> Exitosos ({{ result.successful?.length || 0 }})</v-card-title>
<v-card-text>
<v-data-table
:items="formatItems(result.successful)"
:items="formatSalesResults(result.successful)"
density="compact"
:headers="[{ title: 'ID', key: 'id' }]"
:headers="[
{ title: 'ID', key: 'id' },
{ title: 'Código', key: 'code' }
]"
></v-data-table>
</v-card-text>
</v-card>
@@ -99,9 +106,13 @@
}
},
methods: {
formatItems(ids) {
if (!ids || ids.length === 0) return [];
return ids.map(id => ({ id }));
formatSalesResults(items) {
if (!items || items.length === 0) return [];
return items.map(item =>
typeof item === 'object'
? { id: item.id, code: item.code ?? '', detail: item.error ?? '' }
: { id: item, code: '', detail: '' }
);
},
startSync() {
this.loading = true;

View File

@@ -55,9 +55,13 @@
<v-card-title class="bg-error text-white"> Fallidos ({{ result.failed_parties?.length || 0 }})</v-card-title>
<v-card-text>
<v-data-table
:items="formatItems(result.failed_parties)"
:items="formatResults(result.failed_parties)"
density="compact"
:headers="[{ title: 'ID', key: 'id' }]"
:headers="[
{ title: 'ID', key: 'id' },
{ title: 'Nombre', key: 'name' },
{ title: 'Detalle', key: 'detail' }
]"
></v-data-table>
</v-card-text>
</v-card>
@@ -68,9 +72,12 @@
<v-card-title class="bg-success text-white"> Creados ({{ result.created_customers?.length || 0 }})</v-card-title>
<v-card-text>
<v-data-table
:items="formatItems(result.created_customers)"
:items="formatResults(result.created_customers)"
density="compact"
:headers="[{ title: 'ID', key: 'id' }]"
:headers="[
{ title: 'ID', key: 'id' },
{ title: 'Nombre', key: 'name' }
]"
></v-data-table>
</v-card-text>
</v-card>
@@ -81,9 +88,13 @@
<v-card-title class="bg-warning">🔄 Actualizados ({{ result.updated_customers?.length || 0 }})</v-card-title>
<v-card-text>
<v-data-table
:items="formatItems(result.updated_customers)"
:items="formatResults(result.updated_customers)"
density="compact"
:headers="[{ title: 'ID', key: 'id' }]"
:headers="[
{ title: 'ID', key: 'id' },
{ title: 'Nombre', key: 'name' },
{ title: 'Detalle', key: 'detail' }
]"
></v-data-table>
</v-card-text>
</v-card>
@@ -94,9 +105,12 @@
<v-card-title class="bg-grey-lighten-1"> Sin cambios ({{ result.untouched_customers?.length || 0 }})</v-card-title>
<v-card-text>
<v-data-table
:items="formatItems(result.untouched_customers)"
:items="formatResults(result.untouched_customers)"
density="compact"
:headers="[{ title: 'ID', key: 'id' }]"
:headers="[
{ title: 'ID', key: 'id' },
{ title: 'Nombre', key: 'name' }
]"
></v-data-table>
</v-card-text>
</v-card>
@@ -107,9 +121,12 @@
<v-card-title class="bg-info text-white">🔍 Verificados ({{ result.checked_tryton_parties?.length || 0 }})</v-card-title>
<v-card-text>
<v-data-table
:items="formatItems(result.checked_tryton_parties)"
:items="formatResults(result.checked_tryton_parties)"
density="compact"
:headers="[{ title: 'ID', key: 'id' }]"
:headers="[
{ title: 'ID', key: 'id' },
{ title: 'Nombre', key: 'name' }
]"
></v-data-table>
</v-card-text>
</v-card>
@@ -142,9 +159,13 @@
}
},
methods: {
formatItems(ids) {
if (!ids || ids.length === 0) return [];
return ids.map(id => ({ id }));
formatResults(items) {
if (!items || items.length === 0) return [];
return items.map(item =>
typeof item === 'object'
? { id: item.id ?? item.external_id, name: item.name ?? '', detail: item.error ?? item.detail ?? '' }
: { id: item, name: '', detail: '' }
);
},
startSync() {
this.loading = true;

View File

@@ -55,9 +55,13 @@
<v-card-title class="bg-error text-white"> Fallidos ({{ result.failed_products?.length || 0 }})</v-card-title>
<v-card-text>
<v-data-table
:items="formatItems(result.failed_products)"
:items="formatResults(result.failed_products)"
density="compact"
:headers="[{ title: 'ID', key: 'id' }]"
:headers="[
{ title: 'ID', key: 'id' },
{ title: 'Nombre', key: 'name' },
{ title: 'Detalle', key: 'detail' }
]"
></v-data-table>
</v-card-text>
</v-card>
@@ -68,9 +72,12 @@
<v-card-title class="bg-success text-white"> Creados ({{ result.created_products?.length || 0 }})</v-card-title>
<v-card-text>
<v-data-table
:items="formatItems(result.created_products)"
:items="formatResults(result.created_products)"
density="compact"
:headers="[{ title: 'ID', key: 'id' }]"
:headers="[
{ title: 'ID', key: 'id' },
{ title: 'Nombre', key: 'name' }
]"
></v-data-table>
</v-card-text>
</v-card>
@@ -81,9 +88,13 @@
<v-card-title class="bg-info text-white">🔄 Actualizados ({{ result.updated_products?.length || 0 }})</v-card-title>
<v-card-text>
<v-data-table
:items="formatItems(result.updated_products)"
:items="formatResults(result.updated_products)"
density="compact"
:headers="[{ title: 'ID', key: 'id' }]"
:headers="[
{ title: 'ID', key: 'id' },
{ title: 'Nombre', key: 'name' },
{ title: 'Detalle', key: 'detail' }
]"
></v-data-table>
</v-card-text>
</v-card>
@@ -94,9 +105,12 @@
<v-card-title class="bg-grey-lighten-1"> Sin cambios ({{ result.untouched_products?.length || 0 }})</v-card-title>
<v-card-text>
<v-data-table
:items="formatItems(result.untouched_products)"
:items="formatResults(result.untouched_products)"
density="compact"
:headers="[{ title: 'ID', key: 'id' }]"
:headers="[
{ title: 'ID', key: 'id' },
{ title: 'Nombre', key: 'name' }
]"
></v-data-table>
</v-card-text>
</v-card>
@@ -129,9 +143,13 @@
}
},
methods: {
formatItems(ids) {
if (!ids || ids.length === 0) return [];
return ids.map(id => ({ id }));
formatResults(items) {
if (!items || items.length === 0) return [];
return items.map(item =>
typeof item === 'object'
? { id: item.id ?? item.external_id, name: item.name ?? '', detail: item.error ?? item.detail ?? '' }
: { id: item, name: '', detail: '' }
);
},
startSync() {
this.loading = true;

View File

@@ -51,9 +51,13 @@
<v-card-title class="bg-error text-white"> Fallidos ({{ result.failed?.length || 0 }})</v-card-title>
<v-card-text>
<v-data-table
:items="formatItems(result.failed)"
:items="formatSalesResults(result.failed)"
density="compact"
:headers="[{ title: 'ID', key: 'id' }]"
:headers="[
{ title: 'ID', key: 'id' },
{ title: 'Código', key: 'code' },
{ title: 'Detalle', key: 'detail' }
]"
></v-data-table>
</v-card-text>
</v-card>
@@ -64,9 +68,12 @@
<v-card-title class="bg-success text-white"> Exitosos ({{ result.successful?.length || 0 }})</v-card-title>
<v-card-text>
<v-data-table
:items="formatItems(result.successful)"
:items="formatSalesResults(result.successful)"
density="compact"
:headers="[{ title: 'ID', key: 'id' }]"
:headers="[
{ title: 'ID', key: 'id' },
{ title: 'Código', key: 'code' }
]"
></v-data-table>
</v-card-text>
</v-card>
@@ -99,9 +106,13 @@
}
},
methods: {
formatItems(ids) {
if (!ids || ids.length === 0) return [];
return ids.map(id => ({ id }));
formatSalesResults(items) {
if (!items || items.length === 0) return [];
return items.map(item =>
typeof item === 'object'
? { id: item.id, code: item.code ?? '', detail: item.error ?? '' }
: { id: item, code: '', detail: '' }
);
},
startSync() {
this.loading = true;