2024-08-29 22:51:13 -03:00
|
|
|
<script>
|
2024-09-15 18:09:23 -03:00
|
|
|
import ProductoCantidad from './Producto/ProductoCantidad.vue';
|
|
|
|
|
2024-08-29 22:51:13 -03:00
|
|
|
export default {
|
|
|
|
name: "ProductoCard",
|
2024-09-15 18:09:23 -03:00
|
|
|
components: {
|
|
|
|
ProductoCantidad,
|
|
|
|
},
|
2024-08-29 22:51:13 -03:00
|
|
|
props: {
|
|
|
|
producto: Object
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
cantidad: this.producto.cantidad,
|
|
|
|
enChismosa: this.producto.cantidad,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
2024-08-29 22:54:05 -03:00
|
|
|
Event.$on('sync-subpedido', (cantidad,productoId) => {
|
|
|
|
if (this.producto.id === productoId)
|
|
|
|
this.sincronizar(cantidad);
|
|
|
|
});
|
2024-08-29 22:51:13 -03:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
decrementar() {
|
|
|
|
this.cantidad -= 1;
|
|
|
|
},
|
|
|
|
incrementar() {
|
|
|
|
this.cantidad += 1;
|
|
|
|
},
|
|
|
|
confirmar() {
|
|
|
|
Event.$emit('sync-subpedido', this.cantidad, this.producto.id);
|
|
|
|
},
|
|
|
|
borrar() {
|
|
|
|
this.cantidad = 0;
|
|
|
|
this.confirmar();
|
|
|
|
},
|
|
|
|
sincronizar(cantidad) {
|
|
|
|
this.cantidad = cantidad;
|
|
|
|
this.producto.cantidad = cantidad;
|
|
|
|
this.enChismosa = cantidad;
|
|
|
|
},
|
2024-08-31 23:03:09 -03:00
|
|
|
hayCambios() {
|
|
|
|
return this.cantidad != this.enChismosa;
|
|
|
|
},
|
|
|
|
puedeBorrar() {
|
|
|
|
return this.enChismosa > 0;
|
|
|
|
},
|
2024-08-29 22:51:13 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2024-09-09 00:14:29 -03:00
|
|
|
<div class="block column is-one-quarter-desktop is-full-mobile is-half-tablet min-width-from-desktop">
|
2024-08-29 22:51:13 -03:00
|
|
|
<div class="box" style="height:100%">
|
|
|
|
<div class="columns">
|
2024-09-09 00:14:29 -03:00
|
|
|
<div class="column">
|
2024-08-29 22:51:13 -03:00
|
|
|
<p class="title is-6">
|
|
|
|
{{ producto.nombre }}
|
|
|
|
</p>
|
|
|
|
<p class="subtitle is-7" v-text="producto.proveedor"></p>
|
2024-09-09 01:09:23 -03:00
|
|
|
<span class="subtitle is-7 hidden-from-tablet" v-if="enChismosa !== 0">{{ enChismosa }} en chismosa</span>
|
2024-08-29 22:51:13 -03:00
|
|
|
</div>
|
|
|
|
<div class="column is-one-quarter has-text-right">
|
2024-09-09 01:09:23 -03:00
|
|
|
<p class="has-text-weight-bold has-text-primary">
|
|
|
|
<span class="is-left-mobile">
|
|
|
|
<img v-show="producto.economia_solidaria" height="30px" width="30px" src="/assets/solidaria.png" alt="proveedor de economía solidaria">
|
|
|
|
<img v-show="producto.nacional" height="30px" width="30px" src="/assets/uruguay.png" alt="proveedor nacional"/>
|
|
|
|
</span>
|
|
|
|
$<span v-text="producto.precio"></span>
|
|
|
|
</p>
|
2024-08-29 22:51:13 -03:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<footer class="columns">
|
|
|
|
<div class="column is-three-quarters">
|
2024-09-15 12:48:34 -03:00
|
|
|
<producto-cantidad :producto="producto"></producto-cantidad>
|
2024-08-29 22:51:13 -03:00
|
|
|
</div>
|
2024-09-09 01:09:23 -03:00
|
|
|
<div class="column">
|
|
|
|
<p class="subtitle is-7 is-hidden-mobile" v-if="enChismosa !== 0">{{ enChismosa }} en chismosa</p>
|
2024-08-29 22:51:13 -03:00
|
|
|
</div>
|
|
|
|
</footer>
|
|
|
|
</div><!-- END BOX -->
|
2024-08-29 23:01:31 -03:00
|
|
|
</div>
|
2024-08-29 22:51:13 -03:00
|
|
|
</template>
|
|
|
|
|
2024-08-30 00:10:50 -03:00
|
|
|
<style lang="scss" scoped>
|
|
|
|
@use "bulma/sass/utilities/mixins";
|
2024-08-29 22:51:13 -03:00
|
|
|
|
2024-09-09 00:14:29 -03:00
|
|
|
@include mixins.until(mixins.$desktop) {
|
|
|
|
.hidden-until-desktop {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@include mixins.from(mixins.$desktop) {
|
|
|
|
.min-width-from-desktop {
|
2024-08-30 00:10:50 -03:00
|
|
|
min-width: 25rem;
|
|
|
|
}
|
2024-09-09 00:14:29 -03:00
|
|
|
.hidden-from-desktop {
|
|
|
|
display: none;
|
|
|
|
}
|
2024-08-30 00:10:50 -03:00
|
|
|
}
|
2024-09-09 01:09:23 -03:00
|
|
|
|
|
|
|
@include mixins.from(mixins.$tablet) {
|
|
|
|
.hidden-from-tablet {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@include mixins.mobile() {
|
|
|
|
.is-left-mobile {
|
|
|
|
float: left;
|
|
|
|
}
|
|
|
|
}
|
2024-08-29 22:51:13 -03:00
|
|
|
</style>
|