feat: Add Update Parties From Tryton
This commit is contained in:
parent
1b84c5419f
commit
f22fcb6f16
@ -56,7 +56,8 @@
|
|||||||
{ title: 'Cuadres de tarro', route: '/cuadres_de_tarro', icon: 'mdi-chart-bar'},
|
{ title: 'Cuadres de tarro', route: '/cuadres_de_tarro', icon: 'mdi-chart-bar'},
|
||||||
{ title: 'CSV Tryton', route: '/ventas_para_tryton', icon: 'mdi-file-table'},
|
{ title: 'CSV Tryton', route: '/ventas_para_tryton', icon: 'mdi-file-table'},
|
||||||
{ title: 'Compra adm', route: '/compra_admin', icon: 'mdi-cart'},
|
{ title: 'Compra adm', route: '/compra_admin', icon: 'mdi-cart'},
|
||||||
{ title: 'Sincronizar Tryton Productos', route: '/sincronizar_productos_tryton', icon: 'trytonIcon'},
|
{ title: 'Actualizar Productos De Tryton', route: '/sincronizar_productos_tryton', icon: 'trytonIcon'},
|
||||||
|
{ title: 'Actualizar Clientes De Tryton', route: '/sincronizar_clientes_tryton', icon: 'trytonIcon'},
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
watch: {
|
watch: {
|
||||||
|
75
src/pages/sincronizar_clientes_tryton.vue
Normal file
75
src/pages/sincronizar_clientes_tryton.vue
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<template>
|
||||||
|
<v-container class="fill-height d-flex align-center justify-center">
|
||||||
|
<v-card class="pa-6" max-width="600" elevation="4">
|
||||||
|
<v-card-title class="text-h5 font-weight-bold text-center">
|
||||||
|
🔄 Sincronización de Clientes
|
||||||
|
</v-card-title>
|
||||||
|
|
||||||
|
<v-card-text>
|
||||||
|
<p>
|
||||||
|
Esta acción sincronizará los <strong>clientes</strong> desde el sistema
|
||||||
|
<strong>Tryton</strong> hacia la plataforma.
|
||||||
|
</p>
|
||||||
|
<v-alert type="warning" dense border="start" border-color="warning">
|
||||||
|
<strong>Advertencia:</strong> Este proceso podría tardar varios minutos
|
||||||
|
y reemplazar datos existentes en la plataforma.
|
||||||
|
Asegúrese de que la información en Tryton esté actualizada antes de
|
||||||
|
continuar.
|
||||||
|
</v-alert>
|
||||||
|
<p class="mt-4">
|
||||||
|
Durante la sincronización, no se podrán modificar productos en la
|
||||||
|
plataforma para evitar conflictos.
|
||||||
|
</p>
|
||||||
|
</v-card-text>
|
||||||
|
|
||||||
|
<v-card-actions class="justify-center">
|
||||||
|
<v-btn color="primary" @click="startSync">
|
||||||
|
Iniciar Sincronización
|
||||||
|
</v-btn>
|
||||||
|
<v-btn text @click="$router.push('/')">
|
||||||
|
Cancelar
|
||||||
|
</v-btn>
|
||||||
|
</v-card-actions>
|
||||||
|
</v-card>
|
||||||
|
|
||||||
|
|
||||||
|
<v-data-table :items="checked_tryton_parties"></v-data-table>
|
||||||
|
<v-data-table :items="created_customers"></v-data-table>
|
||||||
|
<v-data-table :items="failed_parties"></v-data-table>
|
||||||
|
<v-data-table :items="untouched_customers"></v-data-table>
|
||||||
|
</v-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { inject } from 'vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'CustomersFromTryton',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
api: inject('api'),
|
||||||
|
checked_tryton_parties: [],
|
||||||
|
created_customers: [],
|
||||||
|
failed_parties: [],
|
||||||
|
untouched_customers: [],
|
||||||
|
updated_customers: [],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
startSync() {
|
||||||
|
this.api.getCustomersFromTryton()
|
||||||
|
.then(response => {
|
||||||
|
// Manejar la respuesta exitosa
|
||||||
|
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 }));
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
// Manejar el error
|
||||||
|
console.error("Error al sincronizar clientes:", error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
@ -54,6 +54,10 @@ class Api {
|
|||||||
getProductsFromTryton() {
|
getProductsFromTryton() {
|
||||||
return this.apiImplementation.getProductsFromTryton();
|
return this.apiImplementation.getProductsFromTryton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getCustomersFromTryton() {
|
||||||
|
return this.apiImplementation.getCustomersFromTryton();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Api;
|
export default Api;
|
||||||
|
@ -68,6 +68,10 @@ class DjangoApi {
|
|||||||
return this.postRequest(url, {});
|
return this.postRequest(url, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getCustomersFromTryton(){
|
||||||
|
const url = this.base + '/don_confiao/api/importar_clientes_de_tryton';
|
||||||
|
return this.postRequest(url, {});
|
||||||
|
}
|
||||||
|
|
||||||
getRequest(url) {
|
getRequest(url) {
|
||||||
return new Promise ((resolve, reject) => {
|
return new Promise ((resolve, reject) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user