Chismosa scrollablre

This commit is contained in:
nat 2022-05-18 17:46:47 -03:00
parent 70235970ab
commit e4a08f5aed
3 changed files with 30 additions and 10 deletions

22
public/css/app.css vendored
View File

@ -21,13 +21,33 @@ nav.breadcrumb.is-fixed-top {
right: 0; right: 0;
z-index: 30; z-index: 30;
top: 3.25rem; top: 3.25rem;
height: 3.25rem;
} }
main.has-top-padding { main.has-top-padding {
padding-top: 3rem !important; padding-top: 4.5rem !important;
} }
.has-text-centered { .has-text-centered {
text-align: center; text-align: center;
margin: 0 1em; margin: 0 1em;
} }
.is-fixed-top {
position: fixed;
z-index: 30;
}
.chismosa-container {
top: 6.5rem;
max-height: 21rem;
overflow-y: scroll;
overflow-x: hidden;
width: 100%;
position: fixed;
z-index: 15;
}
main.chisma-abierta {
padding-top: 25.5rem !important;
}

16
public/js/chismosa.js vendored
View File

@ -1,6 +1,6 @@
Vue.component('chismosa', { Vue.component('chismosa', {
template: ` template: `
<div class="container" v-show="this.visible"> <div class="container table-container chismosa-container is-max-widescreen is-max-desktop animate__animated" :class="animation" v-show="!init">
<table v-show="this.subpedido.productos.length != 0" class="table is-fullwidth is-striped is-bordered"> <table v-show="this.subpedido.productos.length != 0" class="table is-fullwidth is-striped is-bordered">
<thead> <thead>
<tr> <tr>
@ -39,23 +39,19 @@ Vue.component('chismosa', {
subpedido: { subpedido: {
productos:[] productos:[]
}, },
init: true,
visible: false visible: false
} }
}, },
computed: { computed: {
/* TODO: tener el camino que se había hecho antes de abrir la chismosa para volver atrás */ animation: function() {
miga: function() { return this.visible ? "animate__slideInDown" : "animate__slideOutUp";
return {
nombre: "Chismosa de " + this.subpedido.nombre,
href: "/chismosa"
}
} }
}, },
beforeCreate() { beforeCreate() {
axios.get("/subpedidos/obtener_sesion").then(response => { axios.get("/subpedidos/obtener_sesion").then(response => {
this.subpedido = response.data.subpedido; this.subpedido = response.data.subpedido;
this.fetchSubpedido(); this.fetchSubpedido();
Event.$emit("migas-agregar",this.miga);
}); });
}, },
methods: { methods: {
@ -71,7 +67,11 @@ Vue.component('chismosa', {
this.fetchSubpedido(); this.fetchSubpedido();
}); });
Event.$on('toggle-chismosa', () => { Event.$on('toggle-chismosa', () => {
this.init = false;
this.visible = !this.visible; this.visible = !this.visible;
var main = document.getElementById("main");
if (this.visible) main.classList.add("chisma-abierta");
else main.classList.remove("chisma-abierta");
}); });
} }
}); });

View File

@ -40,7 +40,7 @@
</nav> </nav>
</nav-migas> </nav-migas>
<main class="py-4 has-top-padding"> <main id="main" class="py-4 has-top-padding">
@yield('content') @yield('content')
</main> </main>
</div> </div>