nueva-chismosa #35

Merged
rho merged 11 commits from nueva-chismosa into master 2024-09-19 21:42:45 -03:00
6 changed files with 61 additions and 22 deletions
Showing only changes of commit b845637064 - Show all commits

1
resources/js/app.js vendored
View file

@ -91,6 +91,7 @@ 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')

View file

@ -1,10 +1,31 @@
<template> <template>
<div v-show="this.$root.pedido.aprobado" class="notification is-warning has-text-centered"> <div v-show="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

@ -12,29 +12,29 @@
<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">{{ cantidadBonosDeTransporte() }}</th> <th class="has-text-right">{{ cantidad_bonos_transporte }}</th>
<th class="has-text-right">{{ totalBonosDeTransporte() }}</th> <th class="has-text-right">{{ total_bonos_transporte }}</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>
<p :title="notasDevoluciones()">...</p> <p :title="notas_devoluciones">...</p>
<button @click.capture="modificarDevoluciones()" class="button is-warning"> <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,6 +49,12 @@
data() { data() {
return { return {
mostrar_tabla: false, mostrar_tabla: false,
cantidad_bonos_transporte: 0,
total_bonos_transporte: 0,
devoluciones: 0,
notas_devoluciones: "",
total: 0,
productos: [],
} }
}, },
mounted() { mounted() {
@ -58,12 +64,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();
total: function() { this.total_bonos_transporte = this.totalBonosDeTransporte();
return this.$limpiarInt(this.$root.devoluciones ? this.$root.pedido.total_menos_devoluciones : this.$root.pedido.total) this.devoluciones = this.$root.pedido.devoluciones_total;
}, this.notas_devoluciones = this.$root.pedido.devoluciones_notas;
productos: function() { this.total = this.$limpiarInt(this.$root.devoluciones ? this.$root.pedido.total_menos_devoluciones : this.$root.pedido.total);
return this.$root.productos this.productos = this.$root.productos
}, },
modificarDevoluciones: function() { modificarDevoluciones: function() {
Event.$emit("modificar-devoluciones"); Event.$emit("modificar-devoluciones");
@ -74,12 +80,6 @@
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="'$' + this.$limpiarInt($root.devoluciones ? $root.pedido.total_menos_devoluciones : $root.pedido.total)"></span> <span v-text="'$' + total"></span>
</a> </a>
</div> </div>
</div> </div>
@ -25,14 +25,21 @@ 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

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