feat: Add page send sales to tryton close #20
This commit is contained in:
parent
e192c3778a
commit
460e213e0e
@ -40,7 +40,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import trytonIcon from '/src/assets/icons/tryton-icon.svg';
|
import trytonIcon from '../assets/icons/tryton-icon.svg';
|
||||||
export default {
|
export default {
|
||||||
name: 'NavBar',
|
name: 'NavBar',
|
||||||
data: () => ({
|
data: () => ({
|
||||||
@ -58,6 +58,7 @@
|
|||||||
{ title: 'Compra adm', route: '/compra_admin', icon: 'mdi-cart'},
|
{ title: 'Compra adm', route: '/compra_admin', icon: 'mdi-cart'},
|
||||||
{ title: 'Actualizar Productos De Tryton', 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'},
|
{ title: 'Actualizar Clientes De Tryton', route: '/sincronizar_clientes_tryton', icon: 'trytonIcon'},
|
||||||
|
{ title: 'Actualizar Ventas Tryton', route: '/sincronizar_ventas_tryton', icon: 'trytonIcon'}
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
watch: {
|
watch: {
|
||||||
|
63
src/pages/sincronizar_ventas_tryton.vue
Normal file
63
src/pages/sincronizar_ventas_tryton.vue
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<CodeDialog @code-verified="(verified) => showComponent = verified"/>
|
||||||
|
</div>
|
||||||
|
<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 Ventas
|
||||||
|
</v-card-title>
|
||||||
|
|
||||||
|
<v-card-text>
|
||||||
|
<p>
|
||||||
|
Esta acción sincronizará las <strong>ventas</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>
|
||||||
|
</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="ventas_tryton_failed"></v-data-table>
|
||||||
|
<v-data-table :items="ventas_tryton_successful"></v-data-table>
|
||||||
|
</v-container>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import CodeDialog from '../components/CodeDialog.vue';
|
||||||
|
import { inject } from 'vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'SalesToTryton',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
api: inject('api'),
|
||||||
|
ventas_tryton: [],
|
||||||
|
showComponent: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
startSync() {
|
||||||
|
this.api.sendSalesToTryton()
|
||||||
|
.then(response => {
|
||||||
|
this.ventas_tryton_failed = response.failed.map(id => ({ id }));
|
||||||
|
this.ventas_tryton_successful = response.successful.map(id => ({ id }));
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error("Error al sincronizar las ventas", error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
@ -58,6 +58,10 @@ class Api {
|
|||||||
getCustomersFromTryton() {
|
getCustomersFromTryton() {
|
||||||
return this.apiImplementation.getCustomersFromTryton();
|
return this.apiImplementation.getCustomersFromTryton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sendSalesToTryton(){
|
||||||
|
return this.apiImplementation.sendSalesToTryton();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Api;
|
export default Api;
|
||||||
|
@ -73,6 +73,11 @@ class DjangoApi {
|
|||||||
return this.postRequest(url, {});
|
return this.postRequest(url, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sendSalesToTryton(){
|
||||||
|
const url = this.base + '/don_confiao/api/enviar_ventas_a_tryton';
|
||||||
|
return this.postRequest(url, {});
|
||||||
|
}
|
||||||
|
|
||||||
getRequest(url) {
|
getRequest(url) {
|
||||||
return new Promise ((resolve, reject) => {
|
return new Promise ((resolve, reject) => {
|
||||||
fetch(url)
|
fetch(url)
|
||||||
|
Loading…
Reference in New Issue
Block a user