Compare commits

..

No commits in common. "1586a1190ae37e9ee5ecd8dc3b07712cf71f0a4e" and "6fc7021317aad9c6a4754600963039ae1be01cb9" have entirely different histories.

7 changed files with 27 additions and 80 deletions

6
resources/js/app.js vendored
View file

@ -91,7 +91,6 @@ const app = new Vue({
axios.get('/api/subpedidos/' + this.pedido) axios.get('/api/subpedidos/' + this.pedido)
.then(response => { .then(response => {
this.pedido = response.data.data; this.pedido = response.data.data;
Event.$emit("pedido-actualizado");
}); });
} else { } else {
axios.get('/admin/obtener_sesion') axios.get('/admin/obtener_sesion')
@ -114,21 +113,20 @@ const app = new Vue({
this.$toast('Pedido actualizado exitosamente') this.$toast('Pedido actualizado exitosamente')
Event.$emit("pedido-actualizado"); Event.$emit("pedido-actualizado");
}); });
}); });
// Actualizar monto y notas de devoluciones // Actualizar monto y notas de devoluciones
Event.$on('sync-devoluciones', (total, notas) => { Event.$on('sync-devoluciones', (total, notas) => {
if (this.pedido.aprobado) { if (this.pedido.aprobado) {
this.$toast('No se puede modificar un pedido ya aprobado', 2000); this.$toast('No se puede modificar un pedido ya aprobado', 2000);
return; return;
} }
axios.post("api/subpedidos/" + this.pedido.id + "/sync_devoluciones", { axios.post("api/subpedidos/" + this.pedido.id + "/sync_devoluciones", {
total: total, total: total,
notas: notas, notas: notas,
}).then((response) => { }).then((response) => {
this.pedido = response.data.data; this.pedido = response.data.data;
this.$toast('Pedido actualizado'); this.$toast('Pedido actualizado');
Event.$emit("pedido-actualizado");
}); });
}); });

View file

@ -1,31 +1,10 @@
<template> <template>
<div v-show="aprobado" class="notification is-warning has-text-centered"> <div v-show="this.$root.pedido.aprobado" class="notification is-warning has-text-centered">
Tu pedido fue <strong>aprobado</strong>, por lo que no puede ser modificado Tu pedido fue <strong>aprobado</strong>, por lo que no puede ser modificado
</div> </div>
</template> </template>
<script> <script>
export default {
data() {
return {
aprobado: false,
}
},
mounted() {
Event.$on('pedido-actualizado', this.actualizarEstado);
if (this.$root.pedido != null) {
this.actualizarEstado();
}
},
methods: {
pedidoAprobado: function() {
return this.$root.pedido.aprobado;
},
actualizarEstado: function() {
this.aprobado = this.pedidoAprobado();
},
},
}
</script> </script>
<style> <style>

View file

@ -5,36 +5,36 @@
<thead> <thead>
<tr> <tr>
<th>Producto</th> <th>Producto</th>
<th>Cantidad</th> <th><abbr title="Cantidad">C</abbr></th>
<th><abbr title="Precio Total">$</abbr></th> <th><abbr title="Precio Total">$</abbr></th>
</tr> </tr>
</thead> </thead>
<tfoot> <tfoot>
<tr> <tr>
<th><abbr title="Bonos de Transporte">B. Transporte</abbr></th> <th><abbr title="Bonos de Transporte">B. Transporte</abbr></th>
<th class="has-text-right">{{ cantidad_bonos_transporte }}</th> <th class="has-text-right">{{ cantidadBonosDeTransporte() }}</th>
<th class="has-text-right">{{ total_bonos_transporte }}</th> <th class="has-text-right">{{ totalBonosDeTransporte() }}</th>
</tr> </tr>
<tr v-if="this.$root.devoluciones"> <tr v-if="this.$root.devoluciones">
<th><p>Devoluciones</p></th> <th><p>Devoluciones</p></th>
<td> <td>
<abbr :title="notas_devoluciones">{{ notas_devoluciones_abbr }}</abbr> <p :title="notasDevoluciones()">...</p>
<button @click.capture="modificarDevoluciones()" class="button is-warning is-small"> <button @click.capture="modificarDevoluciones()" class="button is-warning">
<span class="icon"> <span class="icon">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</span> </span>
</button> </button>
</td> </td>
<th class="has-text-right">-{{ devoluciones }}</th> <th class="has-text-right">-{{ devoluciones() }}</th>
</tr> </tr>
<tr> <tr>
<th>Total total</th> <th>Total total</th>
<th></th> <th></th>
<th class="has-text-right">{{ total }}</th> <th class="has-text-right">{{ total() }}</th>
</tr> </tr>
</tfoot> </tfoot>
<tbody> <tbody>
<producto-row v-for="producto in productos" :producto="producto" :key="producto.id"></producto-row> <producto-row v-for="producto in productos()" :producto="producto" :key="producto.id"></producto-row>
</tbody> </tbody>
</table> </table>
<p class="has-text-centered" v-show="!mostrar_tabla"> <p class="has-text-centered" v-show="!mostrar_tabla">
@ -49,13 +49,6 @@
data() { data() {
return { return {
mostrar_tabla: false, mostrar_tabla: false,
cantidad_bonos_transporte: 0,
total_bonos_transporte: 0,
devoluciones: 0,
notas_devoluciones: "",
notas_devoluciones_abbr: "",
total: 0,
productos: [],
} }
}, },
mounted() { mounted() {
@ -65,16 +58,12 @@
methods: { methods: {
pedidoActualizado: function() { pedidoActualizado: function() {
this.mostrar_tabla = this.$root.productos.length > 0; this.mostrar_tabla = this.$root.productos.length > 0;
this.cantidad_bonos_transporte = this.cantidadBonosDeTransporte(); },
this.total_bonos_transporte = this.totalBonosDeTransporte(); total: function() {
this.devoluciones = this.$root.pedido.devoluciones_total; return this.$limpiarInt(this.$root.devoluciones ? this.$root.pedido.total_menos_devoluciones : this.$root.pedido.total)
this.notas_devoluciones = this.$root.pedido.devoluciones_notas; },
this.notas_devoluciones_abbr = this.notas_devoluciones.substring(0, 15); productos: function() {
if (this.notas_devoluciones.length > 15) { return this.$root.productos
this.notas_devoluciones_abbr += "...";
}
this.total = this.$limpiarInt(this.$root.devoluciones ? this.$root.pedido.total_menos_devoluciones : this.$root.pedido.total);
this.productos = this.$root.productos
}, },
modificarDevoluciones: function() { modificarDevoluciones: function() {
Event.$emit("modificar-devoluciones"); Event.$emit("modificar-devoluciones");
@ -85,6 +74,12 @@
totalBonosDeTransporte: function() { totalBonosDeTransporte: function() {
return this.$limpiarInt(this.$root.pedido.subtotal_bonos_de_transporte) return this.$limpiarInt(this.$root.pedido.subtotal_bonos_de_transporte)
}, },
devoluciones: function() {
return this.$root.pedido.devoluciones_total;
},
notasDevoluciones: function() {
return this.$root.pedido.devoluciones_notas;
},
}, },
} }
</script> </script>

View file

@ -5,7 +5,7 @@
<span class="icon is-small mr-1"> <span class="icon is-small mr-1">
<img src="/assets/chismosa.png"> <img src="/assets/chismosa.png">
</span> </span>
<span v-text="'$' + total"></span> <span v-text="'$' + this.$limpiarInt($root.devoluciones ? $root.pedido.total_menos_devoluciones : $root.pedido.total)"></span>
</a> </a>
</div> </div>
</div> </div>
@ -25,21 +25,14 @@ export default {
}, },
data() { data() {
return { return {
activa: false, activa: false
total: 0,
} }
}, },
mounted() {
Event.$on('pedido-actualizado', this.actualizar);
},
methods: { methods: {
toggle() { toggle() {
this.activa = !this.activa; this.activa = !this.activa;
Event.$emit("toggle-chismosa", this.activa); Event.$emit("toggle-chismosa", this.activa);
}, },
actualizar() {
this.total = this.$limpiarInt(this.$root.devoluciones ? this.$root.pedido.total_menos_devoluciones : this.$root.pedido.total);
},
}, },
} }
</script> </script>

View file

@ -38,10 +38,6 @@
} }
}, },
mounted() { mounted() {
if (this.producto.pivot !== undefined) {
this.cantidad = this.producto.pivot.cantidad;
this.enChismosa = this.cantidad;
}
Event.$on('sync-subpedido', (cantidad,productoId) => { Event.$on('sync-subpedido', (cantidad,productoId) => {
if (this.producto.id === productoId) if (this.producto.id === productoId)
this.sincronizar(cantidad); this.sincronizar(cantidad);
@ -63,11 +59,7 @@
}, },
sincronizar(cantidad) { sincronizar(cantidad) {
this.cantidad = cantidad; this.cantidad = cantidad;
if (this.producto.pivot != null) { this.producto.cantidad = cantidad;
this.producto.pivot.cantidad = cantidad;
} else {
this.producto.cantidad = cantidad;
}
this.enChismosa = cantidad; this.enChismosa = cantidad;
}, },
hayCambios() { hayCambios() {

View file

@ -1,11 +1,6 @@
<script> <script>
import ProductoCantidad from './Producto/ProductoCantidad.vue';
export default { export default {
name: "ProductoCard", name: "ProductoCard",
components: {
ProductoCantidad,
},
props: { props: {
producto: Object producto: Object
}, },

View file

@ -9,12 +9,7 @@
</template> </template>
producto producto
<script> <script>
import ProductoCantidad from './Producto/ProductoCantidad.vue'; export default {
export default {
components: {
ProductoCantidad,
},
props: { props: {
producto: Object producto: Object
}, },