Compare commits

...

14 commits

16 changed files with 219 additions and 122 deletions

1
.gitignore vendored
View file

@ -12,3 +12,4 @@ npm-debug.log
yarn-error.log
.idea
/resources/csv/exports/*.csv
/public

View file

@ -17,6 +17,13 @@ class GrupoDeCompra extends Model
protected $table = 'grupos_de_compra';
protected $hidden = ['password'];
public function toggleDevoluciones()
{
$this->devoluciones_habilitadas = !$this->devoluciones_habilitadas;
$this->save();
return $this->devoluciones_habilitadas;
}
public function subpedidos() {
return $this->hasMany('App\Subpedido');
}
@ -115,7 +122,7 @@ class GrupoDeCompra extends Model
$fila = $productos_id_fila[$id];
$records[$fila][1] = $producto_pedido->cantidad_pedida;
}
$records[$this->obtenerFilaDeBonoTransporte()][1] = $this->calcularCantidadBDT();
try {
@ -131,12 +138,12 @@ class GrupoDeCompra extends Model
// si no hay pedidos aprobados, salir
if ($productos_en_pedido->count() == 0) { \Log::debug("El grupo de compra ". $this->nombre . " no tiene pedidos aprobados."); return; }
$pedidos = $this->pedidosAprobados();
// Generar tabla vacía con una columna por núcleo
$records = $this->obtenerTemplateDeFilasVacias($pedidos->count());
$productos_id_fila = Producto::productosIdFila();
foreach ($productos_en_pedido as $id => $producto_pedido) {
$fila = $productos_id_fila[$id];
$i = 1;
@ -155,7 +162,7 @@ class GrupoDeCompra extends Model
$i++;
}
array_splice($records, 0, 0, array($nucleos));
// Guardar en un archivo .csv
try {
$writer = Writer::createFromPath(resource_path('csv/exports/'.$this->nombre.'-completo.csv'), 'w');

View file

@ -1,50 +0,0 @@
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0be94811453f bc48a6b1eec1 "/bin/sh -c 'apt-get…" 3 days ago Exited (100) 3 days ago festive_poitras
20904ea983a8 bc48a6b1eec1 "/bin/sh -c 'apt-get…" 3 days ago Exited (100) 3 days ago nifty_antonelli
eb71d65b34cc odoo:15 "/entrypoint.sh odoo" 6 weeks ago Up 6 days 0.0.0.0:8069->8069/tcp, 8071-8072/tcp odoo_bar_web_1
6b08d5b023b7 postgres:latest "docker-entrypoint.s…" 6 weeks ago Up 6 weeks 0.0.0.0:32775->5432/tcp odoo_bar_db_1
2be39cf0f208 wordpress:latest "docker-entrypoint.s…" 2 months ago Up 2 months 0.0.0.0:8007->80/tcp wordpress-mps_wordpress_1
1fb3ab9d5196 mariadb:10.3 "docker-entrypoint.s…" 2 months ago Up 2 months 3306/tcp wordpress-mps_db_1
62d94ac320a9 wordpress:cli-php8.0 "docker-entrypoint.s…" 2 months ago Exited (1) 2 months ago wordpress-mps_wpcli_1
dfa0be51db2f mysql:5.7 "docker-entrypoint.s…" 6 months ago Up 4 months 33060/tcp, 0.0.0.0:33060->3306/tcp pedi2-db
d2261994fbbb nginx:alpine "/docker-entrypoint.…" 6 months ago Up 4 months 0.0.0.0:8903->80/tcp pedi2-nginx
8dfd4713c569 laravel-image "docker-php-entrypoi…" 6 months ago Up 4 months 9000/tcp pedi2-app
1717f2e0e075 collabora/code:latest "/start-collabora-on…" 6 months ago Up 4 months 0.0.0.0:9980->9980/tcp collabora
949c45e8e331 nginx:alpine "/docker-entrypoint.…" 11 months ago Up 4 months 0.0.0.0:8902->80/tcp planifibot-nginx
855c759a117d 70bc6d959246 "docker-php-entrypoi…" 11 months ago Up 4 months 9000/tcp planifibot-app
f8591a57bab7 mysql:5.7 "docker-entrypoint.s…" 11 months ago Up 4 months 33060/tcp, 0.0.0.0:3316->3306/tcp planifibot-db
a7de86736ea4 akaunting/akaunting:es "/usr/local/bin/akau…" 12 months ago Exited (0) 8 months ago akaunting
0f4753ad709d mariadb "docker-entrypoint.s…" 12 months ago Exited (0) 8 months ago akaunting-db
7dab3c403e21 127.0.0.1:5000/mps/planifibot:latest "docker-php-entrypoi…" 12 months ago Exited (255) 12 months ago 0.0.0.0:8044->80/tcp planifibot
5880418fe8df 105826cada74 "docker-php-entrypoi…" 12 months ago Exited (255) 12 months ago 0.0.0.0:8044->80/tcp admiring_lumiere
8fd9068db7ed 592f6de18841 "docker-php-entrypoi…" 12 months ago Exited (0) 12 months ago tender_kare
db313e1dc227 72ba750ea9de "/bin/sh -c 'chown -…" 12 months ago Exited (1) 12 months ago pedantic_torvalds
4bd63fb01f80 8e2bc9d43c26 "/bin/sh -c 'chown -…" 12 months ago Exited (1) 12 months ago stoic_goldstine
8181000e76cc 1ed58aad8567 "/bin/sh -c 'docker-…" 12 months ago Exited (1) 12 months ago lucid_lalande
ec7da80bde1a b042c91004f0 "/bin/sh -c 'apt-get…" 12 months ago Exited (100) 12 months ago keen_mendel
43fd36cd860f b042c91004f0 "/bin/sh -c 'docker-…" 12 months ago Exited (1) 12 months ago jovial_khayyam
02a551fc62b5 b042c91004f0 "/bin/sh -c 'docker-…" 12 months ago Exited (1) 12 months ago heuristic_curie
47f377f81a3e 1b37a536c088 "/bin/sh -c 'apt-get…" 12 months ago Exited (1) 12 months ago laughing_franklin
0f63ee6729d9 1b37a536c088 "/bin/sh -c 'apt-get…" 12 months ago Exited (1) 12 months ago elegant_hoover
8a97c786f1e8 1b37a536c088 "/bin/sh -c 'apt-get…" 12 months ago Exited (100) 12 months ago distracted_yonath
d4c7f0f8b235 1b37a536c088 "/bin/sh -c 'apt-get…" 12 months ago Exited (100) 12 months ago vigilant_brown
a6d3cf25487e 80bfd1c2ffed "/bin/sh -c 'apt-get…" 12 months ago Exited (100) 12 months ago dazzling_williams
50030ac55043 80bfd1c2ffed "/bin/sh -c 'apt-get…" 12 months ago Exited (100) 12 months ago pedantic_lovelace
0ba2516ca8bd 1e9cc426f6db "/bin/sh -c 'apt-get…" 12 months ago Exited (100) 12 months ago suspicious_merkle
506eb5744961 1e9cc426f6db "/bin/sh -c 'apt-get…" 12 months ago Exited (100) 12 months ago stupefied_curie
29a25c955eef 1e9cc426f6db "/bin/sh -c 'apt-get…" 12 months ago Exited (100) 12 months ago competent_greider
bcbd4a6e70fc 1e9cc426f6db "/bin/sh -c 'apt-get…" 12 months ago Exited (100) 12 months ago condescending_chaum
0ff1e51bf0c5 1e9cc426f6db "/bin/sh -c 'apt-get…" 12 months ago Exited (100) 12 months ago eager_morse
4b200797fbb8 9ff09bb3bbaf "/bin/sh -c 'apk add…" 12 months ago Exited (127) 12 months ago trusting_euler
4630e65da875 38b8d34febc3 "/bin/sh -c 'docker-…" 12 months ago Exited (2) 12 months ago pensive_khorana
31bc5cbeebda 38b8d34febc3 "/bin/sh -c 'docker-…" 13 months ago Exited (2) 13 months ago elated_chatterjee
dcbaf807509c c2521253d4dc "/bin/sh -c 'docker-…" 13 months ago Exited (2) 13 months ago mystifying_cohen
a8d287e4972e c2521253d4dc "/bin/sh -c 'docker-…" 13 months ago Exited (2) 13 months ago adoring_boyd
57e55bd140e5 919da407c087 "/bin/sh -c 'apt-get…" 13 months ago Exited (100) 13 months ago blissful_turing
16759118d07b 919da407c087 "/bin/sh -c 'apt-get…" 13 months ago Exited (100) 13 months ago modest_edison
686e965026ac 919da407c087 "/bin/sh -c 'apt-get…" 13 months ago Exited (100) 13 months ago upbeat_khorana
e6a4f4e0bc55 919da407c087 "/bin/sh -c 'apt-get…" 13 months ago Exited (100) 13 months ago inspiring_lovelace
d19e81ca0ad2 34258187e19e "/bin/sh -c 'wget -q…" 17 months ago Exited (127) 17 months ago hardcore_lederberg
0d3305ea4c5d fc0cc68061fd "/bin/sh -c 'apt-get…" 17 months ago Exited (2) 17 months ago epic_einstein
1f0cc817b5f9 fc0cc68061fd "/bin/sh -c 'apt-get…" 17 months ago Exited (2) 17 months ago flamboyant_jang
ec330033c36f mariadb:10.3 "docker-entrypoint.s…" 22 months ago Exited (137) 17 months ago akaunting_db_1

49
resources/js/app.js vendored
View file

@ -24,14 +24,14 @@ files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(
* Constants
*/
Vue.prototype.$rootMiga = {
nombre: "Categorías",
nombre: "Categorías",
href: "/productos"
}
/**
* Global methods
*/
Vue.prototype.$settearProducto = function(cantidad, id) {
Event.$emit("sync-subpedido", this.cant, this.producto.id)
Vue.prototype.$settearProducto = function(cantidad, id) {
Event.$emit("sync-subpedido", this.cant, this.producto.id)
}
Vue.prototype.$toast = function(mensaje, duration = 1000) {
return window.bulmaToast.toast({
@ -59,7 +59,8 @@ const app = new Vue({
data() {
return {
gdc: null,
pedido: null
pedido: null,
devoluciones: null,
}
},
computed: {
@ -71,20 +72,34 @@ const app = new Vue({
cantidad(producto) {
let pedido = this.productos.some(p => p.id == producto.id)
return pedido ? this.productos.find(p => p.id == producto.id).pivot.cantidad : 0
}
},
settearDevoluciones() {
axios.get(`/api/grupos-de-compra/${this.gdc}/devoluciones`)
.then(response => {
this.devoluciones = response.data.devoluciones;
});
}
},
mounted() {
Event.$on('obtener-sesion', () => {
axios.get('/subpedidos/obtener_sesion')
.then(response => {
this.pedido = response.data.subpedido.id
axios.get('/api/subpedidos/' + this.pedido)
.then(response => {
this.pedido = response.data.data
this.gdc = this.pedido.grupo_de_compra.id
})
})
})
Event.$on('obtener-sesion', () => {
axios.get('/subpedidos/obtener_sesion')
.then(response => {
if (response.data.subpedido.id) {
this.gdc = response.data.gdc;
this.settearDevoluciones();
this.pedido = response.data.subpedido.id;
axios.get('/api/subpedidos/' + this.pedido)
.then(response => {
this.pedido = response.data.data;
});
} else {
axios.get('/admin/obtener_sesion')
.then(response => {
this.gdc = response.data.gdc
});
}
})
})
Event.$on('sync-subpedido', (cantidad, id) => {
if (this.pedido.aprobado) {
this.$toast('No se puede modificar un pedido ya aprobado', 2000);
@ -104,7 +119,7 @@ const app = new Vue({
this.$toast('No se puede modificar un pedido ya aprobado', 2000);
return;
}
axios.post("api/subpedidos/" + this.pedido.id + "/sync_devoluciones", {
total: total,
notas: notas,

View file

@ -18,7 +18,7 @@
<th></th>
<th></th>
</tr>
<tr>
<tr v-if="this.$root.devoluciones">
<th><p :title="this.$root.pedido.devoluciones_notas">Devoluciones</p></th>
<th class="has-text-right"></th>
<th class="has-text-right">-{{ this.$root.pedido.devoluciones_total }}</th>
@ -62,7 +62,7 @@
return this.$limpiarInt(this.$root.pedido.subtotal_bonos_de_transporte)
},
total: function() {
return this.$limpiarInt(this.$root.pedido.total_menos_devoluciones)
return this.$limpiarInt(this.$root.devoluciones ? this.$root.pedido.total_menos_devoluciones : this.$root.pedido.total)
}
},
methods: {
@ -79,4 +79,4 @@
max-width: 80vw;
}
}
</style>
</style>

View file

@ -5,7 +5,7 @@
<span class="icon is-small mr-1">
<img src="/assets/chismosa.png">
</span>
<span v-text="'$' + this.$limpiarInt(this.$root.pedido.total_menos_devoluciones)"></span>
<span v-text="'$' + this.$limpiarInt($root.devoluciones ? $root.pedido.total_menos_devoluciones : $root.pedido.total)"></span>
</a>
</div>
<div class="dropdown-menu chismosa-menu" :id="id" role="menu">
@ -61,4 +61,4 @@ export default {
max-height: 75vh;
}
}
</style>
</style>

View file

@ -8,7 +8,7 @@
</div>
<div class="control">
<a class="button is-warning" @click="togglePassword">
{{ (passwordVisible ? 'Ocultar' : 'Mostrar') + ' contraseña'}}
{{ (passwordVisible ? 'Ocultar' : 'Mostrar') + ' contraseña'}}
</a>
</div>
</div>

View file

@ -1,8 +1,8 @@
<template>
<div class="container is-max-widescreen is-max-desktop">
<pedidos-admin-tabs-secciones></pedidos-admin-tabs-secciones>
<div class="block" id="pedidos-seccion"
:class="seccionActiva === 'pedidos-seccion' ? 'is-active' : 'is-hidden'">
<div class="block" id="pedidos-seccion"
:class="seccionActiva === 'pedidos-seccion' ? 'is-active' : 'is-hidden'">
<div class="block pb-6" id="pedidos-tabla-y-dropdown" v-show="hayPedidos">
<pedidos-admin-dropdown-descargar
:gdc="gdc">
@ -15,8 +15,8 @@
Todavía no hay ningún pedido para administrar.
</p>
</div>
<div class="block pb-6" id="bonos-seccion"
:class="seccionActiva === 'bonos-seccion' ? 'is-active' : 'is-hidden'">
<div class="block pb-6" id="bonos-seccion"
:class="seccionActiva === 'bonos-seccion' ? 'is-active' : 'is-hidden'">
<pedidos-admin-tabla-bonos v-show="hayAprobados"
:pedidos="pedidos">
</pedidos-admin-tabla-bonos>
@ -24,6 +24,11 @@
Todavía no hay pedidos aprobados.
</p>
</div>
<div class="block pb-6" id="caracteristicas-seccion"
:class="seccionActiva === 'caracteristicas-seccion' ? 'is-active' : 'is-hidden'">
<pedidos-admin-caracteristicas-opcionales>
</pedidos-admin-caracteristicas-opcionales>
</div>
</div>
</template>
@ -32,9 +37,11 @@ import PedidosAdminTabsSecciones from './PedidosAdminTabsSecciones.vue';
import PedidosAdminDropdownDescargar from "./PedidosAdminDropdownDescargar.vue";
import PedidosAdminTablaBonos from './PedidosAdminTablaBonos.vue';
import PedidosAdminTablaPedidos from "./PedidosAdminTablaPedidos.vue";
import PedidosAdminCaracteristicasOpcionales from "./PedidosAdminCaracteristicasOpcionales.vue";
export default {
name: "PedidosAdminBody",
components: {
PedidosAdminCaracteristicasOpcionales,
PedidosAdminTabsSecciones,
PedidosAdminDropdownDescargar,
PedidosAdminTablaPedidos,
@ -47,7 +54,7 @@ export default {
bonosDeTransporte: 0,
totalBonosBarriales: 0,
tabActiva: "pedidos",
seccionActiva: "pedidos-seccion"
seccionActiva: "pedidos-seccion",
}
},
computed: {

View file

@ -0,0 +1,45 @@
<script>
import axios from "axios";
import PedidosAdminFilaCaracteristica from "./PedidosAdminFilaCaracteristica.vue";
export default {
name: "PedidosAdminCaracteristicasOpcionales",
components: {PedidosAdminFilaCaracteristica},
data() {
return {
caracteristicas: [
{
id: "devoluciones",
nombre: "Devoluciones",
habilitada: false
},
]
}
},
}
</script>
<template>
<div class="block">
<table class="table is-fullwidth is-striped is-bordered">
<thead>
<tr>
<th> Característica </th>
<th> Habilitada </th>
</tr>
</thead>
<tbody>
<pedidos-admin-fila-caracteristica
v-for="(c,i) in caracteristicas"
:key="i"
:caracteristica="c">
</pedidos-admin-fila-caracteristica>
</tbody>
</table>
</div>
</template>
<style scoped>
</style>

View file

@ -0,0 +1,68 @@
<script>
import axios from "axios";
export default {
name: "PedidosAdminFilaCaracteristica",
props: {
caracteristica: Object
},
data: {
gdc: undefined
},
watch: {
'$root.gdc' : {
handler(newValue) {
if (newValue) {
this.gdc = newValue;
this.obtenerValor();
}
}
},
},
methods: {
toggleActivacion() {
const id = this.caracteristica.id;
axios.post(`/api/grupos-de-compra/${this.gdc}/${id}`)
.then(response => {
this.caracteristica.habilitada = response.data[id];
this.$root[id] = response.data[id];
});
},
obtenerValor() {
const id = this.caracteristica.id;
axios.get(`/api/grupos-de-compra/${this.gdc}/${id}`)
.then(response => {
this.caracteristica.habilitada = response.data[id];
this.$root[id] = response.data[id];
});
},
},
mounted() {
if (this.$root.gdc) {
this.gdc = this.$root.gdc;
this.obtenerValor(this);
}
}
}
</script>
<template>
<tr>
<td>{{ caracteristica.nombre }}</td>
<td>
<div class="field">
<input type="checkbox" class="switch is-rounded is-success"
:id="'switch-'+caracteristica.id"
:checked="caracteristica.habilitada"
@change="toggleActivacion(caracteristica)">
<label :for="'switch-'+caracteristica.id">
<span class="is-hidden-mobile">{{ caracteristica.habilitada ? 'Habilitada' : 'Deshabilitada' }}</span>
</label>
</div>
</td>
</tr>
</template>
<style scoped>
</style>

View file

@ -1,8 +1,8 @@
<template>
<div class="field">
<input type="checkbox" name="switchRoundedSuccess" class="switch is-rounded is-success"
:id="'switch'+this.pedido.id"
:checked="pedido.aprobado"
:id="'switch'+this.pedido.id"
:checked="pedido.aprobado"
@change="toggleAprobacion">
<label :for="'switch'+this.pedido.id">
<span class="is-hidden-mobile">{{ mensaje }}</span>
@ -23,7 +23,7 @@ export default {
},
computed: {
mensaje: function () {
return this.aprobado ? "Aprobado" : "No aprobado"
return this.aprobado ? "Pagado" : "No pagado"
}
},
methods: {

View file

@ -7,16 +7,17 @@
<th><abbr title="Total sin tomar en cuenta las devoluciones">Total parcial $</abbr></th>
<th><abbr title="Devoluciones correspondientes al núcleo">Devoluciones $</abbr></th>
<th><abbr title="Total a Pagar por el núleo">Total real $</abbr></th>
<th class="is-1"><abbr title="Aprobacion">Aprobación</abbr></th>
<th class="is-1"><abbr title="Pagado">Pagado</abbr></th>
</tr>
</thead>
<tbody>
<pedidos-admin-fila-pedido v-for="pedido in this.pedidos"
:pedido="pedido" :key="pedido.id">
</pedidos-admin-fila-pedido>
<pedidos-admin-fila-pedido
v-for="pedido in this.pedidos"
:pedido="pedido" :key="pedido.id">
</pedidos-admin-fila-pedido>
</tbody>
</table>
<table class="table is-striped is-bordered">
<table v-if="$root.devoluciones" class="table is-striped is-bordered">
<tr>
<th colspan="2" class="has-background-black has-text-white has-text-centered">TOTALES</th>
</tr>
@ -32,6 +33,10 @@
<th>Total devoluciones:</th>
<td class="has-text-right">- $ {{ totalDevoluciones() }}</td>
</tr>
<tr>
<th>Total bonos de transporte:</th>
<td class="has-text-right">$ {{ bonosDeTransporte * 15 }}</td>
</tr>
<tr>
<th>Total a depositar:</th>
<td class="has-text-right">$ {{ totalAprobados() - totalBonosBarriales }}</td>
@ -62,43 +67,28 @@ export default {
},
},
methods: {
totalBonosBarriales() {
let suma = 0;
let aprobados = this.pedidos.filter(p => p.aprobado);
for (let i = 0; i < aprobados.length; i++) {
let bonoBarrial = aprobados[i].productos.find(p => p.nombre.includes("barrial"))
if (bonoBarrial) {
suma += this.$limpiarInt(bonoBarrial.pivot.total)
}
}
return suma;
},
totalDevoluciones() {
let suma = 0
let aprobados = this.pedidos.filter(p => p.aprobado);
for (let i = 0; i < aprobados.length; i++) {
suma = aprobados[i].devoluciones_total
suma += aprobados[i].devoluciones_total
}
suma += parseInt(this.bonosDeTransporte)*15
return suma;
},
totalAprobadosMenosDevoluciones() {
let suma = 0
let aprobados = this.pedidos.filter(p => p.aprobado);
for (let i = 0; i < aprobados.length; i++) {
suma += this.$limpiarFloat(aprobados[i].subtotal_bonos)
suma += this.$limpiarFloat(aprobados[i].subtotal_productos)
suma -= aprobados[i].devoluciones_total
suma += this.$limpiarFloat(aprobados[i].total_menos_devoluciones)
}
suma += parseInt(this.bonosDeTransporte)*15
return suma;
},
totalAprobados() {
let suma = 0
let aprobados = this.pedidos.filter(p => p.aprobado);
for (let i = 0; i < aprobados.length; i++) {
suma += this.$limpiarFloat(aprobados[i].subtotal_bonos)
suma += this.$limpiarFloat(aprobados[i].subtotal_productos)
suma += this.$limpiarFloat(aprobados[i].total)
suma -= this.$limpiarFloat(aprobados[i].subtotal_bonos_de_transporte)
}
suma += parseInt(this.bonosDeTransporte)*15
return suma;
@ -109,4 +99,4 @@ export default {
<style>
</style>
</style>

View file

@ -3,11 +3,11 @@
<div class="tabs is-boxed" id="tabs">
<ul class="has-bottom-line">
<li v-for="(tab, index) in tabs" class="is-size-6"
:key="index"
:id="tab.id + '-tab'"
:key="index"
:id="tab.id + '-tab'"
:class="{'is-active': tab.id === tabActiva}">
<a @click="setTabActiva(tab.id)">
<span>
<span>
{{ tab.nombre }}
</span>
</a>
@ -31,6 +31,10 @@ export default {
{
id: "bonos",
nombre: "Bonos"
},
{
id: "caracteristicas",
nombre: "Caracteristicas opcionales"
}
]
}
@ -59,4 +63,4 @@ export default {
border-bottom-color: #e3342f;
color: #e3342f;
}
</style>
</style>

View file

@ -79,7 +79,8 @@
},
guardarSubpedidoEnSesion(subpedido) {
axios.post("/subpedidos/guardar_sesion", {
subpedido: subpedido
subpedido: subpedido,
grupo_de_compra_id: this.gdcid
}).then(_ => {
Event.$emit('obtener-sesion')
window.location.href = 'productos';

View file

@ -36,9 +36,13 @@ Route::middleware('api')->group(function () {
$grupo = GrupoDeCompra::where('id',$gdc)->first();
return ['bonos_barriales' => $grupo->totalBonosBarriales()];
});
Route::get('/{gdc}/devoluciones-habilitadas', function($gdc) {
$habilitadas = GrupoDeCompra::where('id',$gdc)->value('devoluciones_habilitadas');
return ['devoluciones_habilitadas' => $habilitadas];
Route::get('/{gdc}/devoluciones', function($gdc) {
$habilitadas = GrupoDeCompra::find($gdc)->devoluciones_habilitadas;
return ['devoluciones' => $habilitadas];
});
Route::post('/{gdc}/devoluciones', function($gdc) {
$habilitadas = GrupoDeCompra::find($gdc)->toggleDevoluciones();
return ['devoluciones' => $habilitadas];
});
});

View file

@ -34,11 +34,11 @@ Route::get('/admin/obtener_sesion', function() {
Route::middleware(['auth', 'admin'])->group( function () {
Route::get('/admin/pedidos', 'AdminController@index')->name('admin_login.index');
Route::get('/admin/exportar-planillas-a-pdf/{gdc}', 'AdminController@exportarPlanillasAPdf');
Route::get('/admin/exportar-pedido-a-csv/{gdc}', 'AdminController@exportarPedidoACSV');
Route::get('/admin/exportar-pedido-con-nucleos-a-csv/{gdc}', 'AdminController@exportarPedidoConNucleosACSV');
});
@ -54,8 +54,12 @@ Route::middleware('auth')->group( function() {
if (!isset($r["subpedido"])) {
throw new HttpException(400, "La request necesita un subpedido para guardar en sesión");
}
if (!isset($r["grupo_de_compra_id"])) {
throw new HttpException(400, "La request necesita un grupo de compra para guardar en sesión");
}
session(["subpedido_nombre" => $r["subpedido"]["nombre"]]);
session(["subpedido_id" => $r["subpedido"]["id"]]);
session(["gdc" => $r["grupo_de_compra_id"]]);
return "Subpedido guardado en sesión";
})->name('guardarSesion');
@ -64,7 +68,8 @@ Route::middleware('auth')->group( function() {
'subpedido' => [
'nombre' => session("subpedido_nombre"),
'id' => session("subpedido_id")
]
],
'gdc' => session("gdc")
];
return $sesion;
})->name('obtenerSesion');