diff --git a/src/pages/sincronizar_clientes_tryton.vue b/src/pages/sincronizar_clientes_tryton.vue index 625c874..6fee0e3 100644 --- a/src/pages/sincronizar_clientes_tryton.vue +++ b/src/pages/sincronizar_clientes_tryton.vue @@ -1,42 +1,126 @@ @@ -53,11 +137,8 @@ data() { return { api: inject('api'), - checked_tryton_parties: [], - created_customers: [], - failed_parties: [], - untouched_customers: [], - updated_customers: [], + loading: false, + result: null, } }, mounted() { @@ -66,16 +147,20 @@ } }, methods: { + formatItems(ids) { + if (!ids || ids.length === 0) return []; + return ids.map(id => ({ id })); + }, startSync() { + this.loading = true; this.api.getCustomersFromTryton() .then(response => { - this.checked_tryton_parties = response.checked_tryton_parties.map(id => ({ id })); - this.created_customers = response.created_customers.map(id => ({ id })); - this.failed_parties = response.failed_parties.map(id => ({ id })); - this.untouched_customers = response.untouched_customers.map(id => ({ id })); + this.result = response; + this.loading = false; }) .catch(error => { - console.error("Error al sincronizar clientes:", error); + console.error('Error al sincronizar clientes:', error); + this.loading = false; }); } } diff --git a/src/pages/sincronizar_productos_tryton.vue b/src/pages/sincronizar_productos_tryton.vue index fcd74b0..d091ee5 100644 --- a/src/pages/sincronizar_productos_tryton.vue +++ b/src/pages/sincronizar_productos_tryton.vue @@ -1,37 +1,113 @@ @@ -48,7 +124,8 @@ data() { return { api: inject('api'), - productos_tryton: [{}], + loading: false, + result: null, } }, mounted() { @@ -57,8 +134,21 @@ } }, methods: { + formatItems(ids) { + if (!ids || ids.length === 0) return []; + return ids.map(id => ({ id })); + }, startSync() { - this.productos_tryton = this.api.getProductsFromTryton() + this.loading = true; + this.api.getProductsFromTryton() + .then(response => { + this.result = response; + this.loading = false; + }) + .catch(error => { + console.error('Error al sincronizar productos:', error); + this.loading = false; + }); } } } diff --git a/src/pages/sincronizar_ventas_tryton.vue b/src/pages/sincronizar_ventas_tryton.vue index 35fc356..232c291 100644 --- a/src/pages/sincronizar_ventas_tryton.vue +++ b/src/pages/sincronizar_ventas_tryton.vue @@ -1,36 +1,86 @@ +