Compare commits
10 commits
bb27698e80
...
09fce4e96a
Author | SHA1 | Date | |
---|---|---|---|
09fce4e96a | |||
0ce7b00e90 | |||
0009d4b123 | |||
9062faf24e | |||
54d1e6ab36 | |||
5e69a04d35 | |||
b61fdb1fff | |||
8b86cddb33 | |||
4bbab3a8f9 | |||
2356fe597a |
15 changed files with 223 additions and 92 deletions
|
@ -13,4 +13,12 @@ class FiltroDeSubpedido extends Filtro
|
||||||
|
|
||||||
$this->builder->where('grupo_de_compra_id', intval($valor));
|
$this->builder->where('grupo_de_compra_id', intval($valor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function tipoPedido(String $valor)
|
||||||
|
{
|
||||||
|
if (!is_numeric($valor))
|
||||||
|
throw new TypeError();
|
||||||
|
|
||||||
|
$this->builder->where('tipo_pedido_id', intval($valor));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,11 @@ class GrupoDeCompra extends Model
|
||||||
return $this->hasMany(Subpedido::class);
|
return $this->hasMany(Subpedido::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function users(): HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(User::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function toggleDevoluciones(): bool
|
public function toggleDevoluciones(): bool
|
||||||
{
|
{
|
||||||
$this->devoluciones_habilitadas = !$this->devoluciones_habilitadas;
|
$this->devoluciones_habilitadas = !$this->devoluciones_habilitadas;
|
||||||
|
|
|
@ -15,6 +15,7 @@ class RouteController extends Controller
|
||||||
$barrio = UserRole::where('nombre', 'barrio')->first();
|
$barrio = UserRole::where('nombre', 'barrio')->first();
|
||||||
$admin = UserRole::where('nombre', 'admin_barrio')->first();
|
$admin = UserRole::where('nombre', 'admin_barrio')->first();
|
||||||
$comision = UserRole::where('nombre', 'comision')->first();
|
$comision = UserRole::where('nombre', 'comision')->first();
|
||||||
|
$ollas = UserRole::where('nombre', 'ollas')->first();
|
||||||
|
|
||||||
switch ($request->user()->role_id) {
|
switch ($request->user()->role_id) {
|
||||||
case $barrio->id:
|
case $barrio->id:
|
||||||
|
@ -23,6 +24,8 @@ class RouteController extends Controller
|
||||||
return redirect('/admin');
|
return redirect('/admin');
|
||||||
case $comision->id:
|
case $comision->id:
|
||||||
return redirect('/comisiones');
|
return redirect('/comisiones');
|
||||||
|
case $ollas->id:
|
||||||
|
return redirect('/ollas');
|
||||||
default:
|
default:
|
||||||
abort(400, 'Rol de usuario invalido');
|
abort(400, 'Rol de usuario invalido');
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ class UserController extends Controller
|
||||||
$result = [ 'grupo_de_compra' => null, ];
|
$result = [ 'grupo_de_compra' => null, ];
|
||||||
$grupo_de_compra = GrupoDeCompra::find($user->grupo_de_compra_id);
|
$grupo_de_compra = GrupoDeCompra::find($user->grupo_de_compra_id);
|
||||||
switch (UserRole::findOrFail($user->role_id)->nombre) {
|
switch (UserRole::findOrFail($user->role_id)->nombre) {
|
||||||
|
case 'ollas':
|
||||||
case 'barrio':
|
case 'barrio':
|
||||||
$result['grupo_de_compra'] = new GrupoDeCompraPedidoResource($grupo_de_compra);
|
$result['grupo_de_compra'] = new GrupoDeCompraPedidoResource($grupo_de_compra);
|
||||||
break;
|
break;
|
||||||
|
|
40
database/migrations/2025_06_20_040800_user_role_ollas.php
Normal file
40
database/migrations/2025_06_20_040800_user_role_ollas.php
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use App\GrupoDeCompra;
|
||||||
|
use App\User;
|
||||||
|
use App\UserRole;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
|
class UserRoleOllas extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$ollasRol = UserRole::firstOrCreate(['nombre' => 'ollas']);
|
||||||
|
$barrios = GrupoDeCompra::all();
|
||||||
|
foreach ($barrios as $barrio) {
|
||||||
|
$barrio->users()->firstOrCreate([
|
||||||
|
'name' => $barrio->nombre . '_ollas',
|
||||||
|
'password' => Hash::make('123'),
|
||||||
|
'role_id' => $ollasRol->id
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
$ollasRol = UserRole::where('nombre', 'ollas')->firstOrFail();
|
||||||
|
User::where('role_id', $ollasRol->id)->delete();
|
||||||
|
$ollasRol->delete();
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,9 +5,10 @@ import ComisionesBody from "./comisiones/Body.vue";
|
||||||
import AdminBody from "./admin/Body.vue";
|
import AdminBody from "./admin/Body.vue";
|
||||||
import PedidosBody from "./pedidos/Body.vue";
|
import PedidosBody from "./pedidos/Body.vue";
|
||||||
import InfoTags from "./comunes/InfoTags.vue";
|
import InfoTags from "./comunes/InfoTags.vue";
|
||||||
|
import OllasBody from "./ollas/OllasBody.vue";
|
||||||
export default {
|
export default {
|
||||||
name: 'Main',
|
name: 'Main',
|
||||||
components: { InfoTags, ComisionesBody, AdminBody, PedidosBody, NavBar },
|
components: { OllasBody, InfoTags, ComisionesBody, AdminBody, PedidosBody, NavBar },
|
||||||
computed: {
|
computed: {
|
||||||
...mapState("login", ["rol"]),
|
...mapState("login", ["rol"]),
|
||||||
},
|
},
|
||||||
|
@ -26,6 +27,7 @@ export default {
|
||||||
<pedidos-body v-if="rol === 'barrio'"/>
|
<pedidos-body v-if="rol === 'barrio'"/>
|
||||||
<admin-body v-else-if="rol === 'admin_barrio'"/>
|
<admin-body v-else-if="rol === 'admin_barrio'"/>
|
||||||
<comisiones-body v-else-if="rol === 'comision'"/>
|
<comisiones-body v-else-if="rol === 'comision'"/>
|
||||||
|
<ollas-body v-else-if="rol === 'ollas'"/>
|
||||||
<info-tags/>
|
<info-tags/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
30
resources/js/components/comunes/Burger.vue
Normal file
30
resources/js/components/comunes/Burger.vue
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<script>
|
||||||
|
import { mapMutations, mapState } from "vuex";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Burger",
|
||||||
|
computed: {
|
||||||
|
...mapState('ui', ["burger_activa"])
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapMutations('ui', ["toggleBurger"]),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<a role="button"
|
||||||
|
class="navbar-burger"
|
||||||
|
:class="{'is-active': burger_activa}"
|
||||||
|
aria-label="menu"
|
||||||
|
aria-expanded="false"
|
||||||
|
data-target="nav-bar"
|
||||||
|
@click="toggleBurger">
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
</a>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
</style>
|
|
@ -1,43 +1,26 @@
|
||||||
<template>
|
<template>
|
||||||
<nav id="nav-bar" class="navbar is-danger is-fixed-top" role="navigation" aria-label="main navigation">
|
<nav id="nav-bar"
|
||||||
|
class="navbar is-danger is-fixed-top"
|
||||||
|
role="navigation"
|
||||||
|
aria-label="main navigation">
|
||||||
<div class="navbar-brand">
|
<div class="navbar-brand">
|
||||||
<a class="navbar-item" href="https://mps.org.uy">
|
<a class="navbar-item" href="https://mps.org.uy">
|
||||||
<img src="/assets/logoMPS.png" height="28">
|
<img src="/assets/logoMPS.png" height="28" alt="Logo del MPS">
|
||||||
</a>
|
|
||||||
<div class="navbar-item hide-below-1024" v-if="pedidoDefinido">
|
|
||||||
<p>{{ `Barrio: ${grupo_de_compra.nombre} - Núcleo: ${nombre}` }}</p>
|
|
||||||
</div>
|
|
||||||
<chismosa-dropdown
|
|
||||||
v-if="pedidoDefinido"
|
|
||||||
class="hide-above-1023"
|
|
||||||
ariaControls="mobile"
|
|
||||||
/>
|
|
||||||
<a role="button" class="navbar-burger" :class="{'is-active':burgerActiva}" aria-label="menu"
|
|
||||||
aria-expanded="false" data-target="nav-bar" @click="toggleBurger">
|
|
||||||
<span aria-hidden="true"></span>
|
|
||||||
<span aria-hidden="true"></span>
|
|
||||||
<span aria-hidden="true"></span>
|
|
||||||
</a>
|
</a>
|
||||||
|
<pedidos-nav-bar v-if="rol === 'barrio'"/>
|
||||||
|
<ollas-nav-bar v-else-if="rol === 'ollas'"/>
|
||||||
|
<admin-nav-bar v-else-if="rol === 'admin_barrio'"/>
|
||||||
|
<comisiones-nav-bar v-else/>
|
||||||
</div>
|
</div>
|
||||||
<div class="navbar-menu" :class="{'is-active':burgerActiva}">
|
<div class="navbar-menu"
|
||||||
|
:class="{'is-active': burger_activa}">
|
||||||
<div class="navbar-end">
|
<div class="navbar-end">
|
||||||
<div v-if="pedidoDefinido" class="navbar-item field has-addons mt-1 mr-3 mb-1">
|
<buscador v-if="pedidoDefinido"/>
|
||||||
<a class="button is-small has-text-dark-grey" @click.capture="buscar">
|
<chismosa-dropdown v-if="pedidoDefinido"
|
||||||
<span class="icon">
|
class="hide-below-1024"
|
||||||
<i class="fas fa-search"></i>
|
ariaControls="wide"/>
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
<input class="input is-small" type="text" placeholder="Harina" v-model="searchString"
|
|
||||||
@keyup.enter="buscar">
|
|
||||||
</div>
|
|
||||||
<chismosa-dropdown
|
|
||||||
v-if="pedidoDefinido"
|
|
||||||
class="hide-below-1024"
|
|
||||||
ariaControls="wide">
|
|
||||||
</chismosa-dropdown>
|
|
||||||
<div class="block navbar-item">
|
<div class="block navbar-item">
|
||||||
<a onclick="event.preventDefault(); document.getElementById('logout-form').submit();"
|
<a @click="logOut" class="text-a">
|
||||||
class="text-a">
|
|
||||||
Cerrar sesión
|
Cerrar sesión
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -48,63 +31,28 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ChismosaDropdown from '../pedidos/ChismosaDropdown.vue';
|
import ChismosaDropdown from '../pedidos/ChismosaDropdown.vue';
|
||||||
import { mapActions, mapGetters, mapMutations, mapState } from "vuex";
|
import { mapGetters, mapState } from "vuex";
|
||||||
|
import PedidosNavBar from "../pedidos/PedidosNavBar.vue";
|
||||||
|
import ComisionesNavBar from "../comisiones/ComisionesNavBar.vue";
|
||||||
|
import AdminNavBar from "../admin/AdminNavBar.vue";
|
||||||
|
import OllasNavBar from "../ollas/OllasNavBar.vue";
|
||||||
|
import Buscador from "../pedidos/Buscador.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { ChismosaDropdown },
|
components: { Buscador, OllasNavBar, AdminNavBar, ComisionesNavBar, PedidosNavBar, ChismosaDropdown },
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
burgerActiva: false,
|
|
||||||
searchString: "",
|
|
||||||
nombreCanasta: "",
|
|
||||||
fechaCanasta: "",
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters('pedido', ["pedidoDefinido"]),
|
...mapGetters('pedido', ["pedidoDefinido"]),
|
||||||
...mapState('pedido', ["nombre"]),
|
...mapState('login', ["rol"]),
|
||||||
...mapState('pedido', ["grupo_de_compra"]),
|
...mapState('ui', ["burger_activa"])
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions('productos', ["filtrarProductos"]),
|
logOut() {
|
||||||
...mapMutations('ui', ["addMiga", "popUltimaBusqueda"]),
|
event.preventDefault();
|
||||||
toggleBurger() {
|
document.getElementById('logout-form').submit();
|
||||||
this.burgerActiva = !this.burgerActiva
|
|
||||||
},
|
},
|
||||||
buscar() {
|
}
|
||||||
if (this.burgerActiva)
|
|
||||||
this.toggleBurger();
|
|
||||||
this.filtrarProductos({ filtro: "nombre", valor: this.searchString });
|
|
||||||
this.popUltimaBusqueda();
|
|
||||||
this.addMiga({ nombre: this.searchString });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
p.navbar-item:empty {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nav-bar {
|
|
||||||
z-index: 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-a {
|
|
||||||
color: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 1023px) {
|
|
||||||
.hide-below-1024 {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 1024px) {
|
|
||||||
.hide-above-1023 {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
26
resources/js/components/ollas/OllasBody.vue
Normal file
26
resources/js/components/ollas/OllasBody.vue
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<script>
|
||||||
|
import PedidosMain from "../pedidos/PedidosMain.vue";
|
||||||
|
import { mapActions } from "vuex";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "OllasBody",
|
||||||
|
components: { PedidosMain },
|
||||||
|
methods: {
|
||||||
|
...mapActions('pedido', ["getPedidoDeOllas", "getGrupoDeCompra"]),
|
||||||
|
},
|
||||||
|
async mounted() {
|
||||||
|
await this.getGrupoDeCompra();
|
||||||
|
await this.getPedidoDeOllas();
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div id="ollas-body" class="pb-6 mb-6">
|
||||||
|
<pedidos-main></pedidos-main>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
|
@ -8,21 +8,18 @@ export default {
|
||||||
components: { Burger, ChismosaDropdown },
|
components: { Burger, ChismosaDropdown },
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters('pedido', ["pedidoDefinido"]),
|
...mapGetters('pedido', ["pedidoDefinido"]),
|
||||||
...mapState('pedido', ["nombre", "grupo_de_compra"]),
|
...mapState('pedido', ["nombre"]),
|
||||||
...mapState('ui', ["burger_activa"])
|
...mapState('ui', ["burger_activa"])
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations('ui', ["toggleBurger"]),
|
...mapMutations('ui', ["toggleBurger"]),
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div class="navbar-item hide-below-1024">
|
||||||
<div class="navbar-item hide-below-1024">
|
<p v-if="pedidoDefinido">{{ nombre }}</p>
|
||||||
<p v-if="pedidoDefinido">{{ nombre }}</p>
|
|
||||||
<p v-else>{{ grupo_de_compra.nombre }}</p>
|
|
||||||
</div>
|
|
||||||
<chismosa-dropdown
|
<chismosa-dropdown
|
||||||
v-if="pedidoDefinido"
|
v-if="pedidoDefinido"
|
||||||
class="hide-above-1023"
|
class="hide-above-1023"
|
||||||
|
@ -32,5 +29,4 @@ export default {
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
42
resources/js/components/pedidos/Buscador.vue
Normal file
42
resources/js/components/pedidos/Buscador.vue
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<script>
|
||||||
|
import { mapActions, mapMutations } from "vuex";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Buscador",
|
||||||
|
methods: {
|
||||||
|
...mapActions('productos', ["filtrarProductos"]),
|
||||||
|
...mapMutations('ui', ["addMiga", "popUltimaBusqueda", "toggleBurger"]),
|
||||||
|
buscar() {
|
||||||
|
if (this.burger_activa)
|
||||||
|
this.toggleBurger();
|
||||||
|
this.filtrarProductos({ filtro: "nombre", valor: this.searchString });
|
||||||
|
this.popUltimaBusqueda();
|
||||||
|
this.addMiga({ nombre: this.searchString });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
searchString: "",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="navbar-item field has-addons mt-1 mr-3 mb-1">
|
||||||
|
<a class="button is-small has-text-dark-grey" @click.capture="buscar">
|
||||||
|
<span class="icon">
|
||||||
|
<i class="fas fa-search"></i>
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
<input class="input is-small"
|
||||||
|
type="text"
|
||||||
|
placeholder="Harina"
|
||||||
|
v-model="searchString"
|
||||||
|
@keyup.enter="buscar">
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
|
@ -88,7 +88,8 @@ export default {
|
||||||
const response = await axios.get('/api/subpedidos/',{
|
const response = await axios.get('/api/subpedidos/',{
|
||||||
params: {
|
params: {
|
||||||
nombre: nombre,
|
nombre: nombre,
|
||||||
grupo_de_compra: this.grupo_de_compra.id
|
grupo_de_compra: this.grupo_de_compra.id,
|
||||||
|
tipo_pedido: 1,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.pedidos = response.data;
|
this.pedidos = response.data;
|
||||||
|
|
5
resources/js/store/modules/pedido.js
vendored
5
resources/js/store/modules/pedido.js
vendored
|
@ -94,6 +94,11 @@ const actions = {
|
||||||
dispatch("ui/resetear", null, { root: true });
|
dispatch("ui/resetear", null, { root: true });
|
||||||
commit('reset');
|
commit('reset');
|
||||||
},
|
},
|
||||||
|
async getPedidoDeOllas({ commit }) {
|
||||||
|
const response = await axios.get(`/api/ollas/${state.grupo_de_compra.id}`);
|
||||||
|
console.log(response);
|
||||||
|
commit('setPedido', response.data);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const getters = {
|
const getters = {
|
||||||
|
|
24
resources/sass/app.scss
vendored
24
resources/sass/app.scss
vendored
|
@ -48,6 +48,30 @@ table.table td {
|
||||||
border-color: transparent;
|
border-color: transparent;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p.navbar-item:empty {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav-bar {
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-a {
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1023px) {
|
||||||
|
.hide-below-1024 {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 1024px) {
|
||||||
|
.hide-above-1023 {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
Author: Aseem Lalfakawma <alalfakawma.github.io>
|
Author: Aseem Lalfakawma <alalfakawma.github.io>
|
||||||
This SCSS mixin will allow sizing of table columns in Bulma CSS Framework.
|
This SCSS mixin will allow sizing of table columns in Bulma CSS Framework.
|
||||||
|
|
|
@ -60,6 +60,6 @@ Route::middleware(['auth', 'role:comision'])->group( function() {
|
||||||
|
|
||||||
Route::get('/ollas/login', 'OllasController@show')->name('ollas.login');
|
Route::get('/ollas/login', 'OllasController@show')->name('ollas.login');
|
||||||
|
|
||||||
Route::middleware(['auth', 'role:olla'])->group( function() {
|
Route::middleware(['auth', 'role:ollas'])->group( function() {
|
||||||
Route::get('/ollas', 'RouteController@main')->name('ollas');
|
Route::get('/ollas', 'RouteController@main')->name('ollas');
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue