Compare commits
No commits in common. "09fce4e96a0b155fc2eed36f66ec5911c29f207e" and "bb27698e80459bb28d80f4dc69a55b2aea9212a4" have entirely different histories.
09fce4e96a
...
bb27698e80
15 changed files with 92 additions and 223 deletions
|
@ -13,12 +13,4 @@ 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,11 +23,6 @@ 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,7 +15,6 @@ 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:
|
||||||
|
@ -24,8 +23,6 @@ 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,7 +26,6 @@ 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;
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
<?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,10 +5,9 @@ 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: { OllasBody, InfoTags, ComisionesBody, AdminBody, PedidosBody, NavBar },
|
components: { InfoTags, ComisionesBody, AdminBody, PedidosBody, NavBar },
|
||||||
computed: {
|
computed: {
|
||||||
...mapState("login", ["rol"]),
|
...mapState("login", ["rol"]),
|
||||||
},
|
},
|
||||||
|
@ -27,7 +26,6 @@ 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>
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
<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,26 +1,43 @@
|
||||||
<template>
|
<template>
|
||||||
<nav id="nav-bar"
|
<nav id="nav-bar" class="navbar is-danger is-fixed-top" role="navigation" aria-label="main navigation">
|
||||||
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" alt="Logo del MPS">
|
<img src="/assets/logoMPS.png" height="28">
|
||||||
|
</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"
|
<div class="navbar-menu" :class="{'is-active':burgerActiva}">
|
||||||
:class="{'is-active': burger_activa}">
|
|
||||||
<div class="navbar-end">
|
<div class="navbar-end">
|
||||||
<buscador v-if="pedidoDefinido"/>
|
<div v-if="pedidoDefinido" class="navbar-item field has-addons mt-1 mr-3 mb-1">
|
||||||
<chismosa-dropdown v-if="pedidoDefinido"
|
<a class="button is-small has-text-dark-grey" @click.capture="buscar">
|
||||||
class="hide-below-1024"
|
<span class="icon">
|
||||||
ariaControls="wide"/>
|
<i class="fas fa-search"></i>
|
||||||
|
</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 @click="logOut" class="text-a">
|
<a onclick="event.preventDefault(); document.getElementById('logout-form').submit();"
|
||||||
|
class="text-a">
|
||||||
Cerrar sesión
|
Cerrar sesión
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -31,28 +48,63 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ChismosaDropdown from '../pedidos/ChismosaDropdown.vue';
|
import ChismosaDropdown from '../pedidos/ChismosaDropdown.vue';
|
||||||
import { mapGetters, mapState } from "vuex";
|
import { mapActions, mapGetters, mapMutations, 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: { Buscador, OllasNavBar, AdminNavBar, ComisionesNavBar, PedidosNavBar, ChismosaDropdown },
|
components: { ChismosaDropdown },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
burgerActiva: false,
|
||||||
|
searchString: "",
|
||||||
|
nombreCanasta: "",
|
||||||
|
fechaCanasta: "",
|
||||||
|
}
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters('pedido', ["pedidoDefinido"]),
|
...mapGetters('pedido', ["pedidoDefinido"]),
|
||||||
...mapState('login', ["rol"]),
|
...mapState('pedido', ["nombre"]),
|
||||||
...mapState('ui', ["burger_activa"])
|
...mapState('pedido', ["grupo_de_compra"]),
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
logOut() {
|
...mapActions('productos', ["filtrarProductos"]),
|
||||||
event.preventDefault();
|
...mapMutations('ui', ["addMiga", "popUltimaBusqueda"]),
|
||||||
document.getElementById('logout-form').submit();
|
toggleBurger() {
|
||||||
|
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>
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
<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,18 +8,21 @@ export default {
|
||||||
components: { Burger, ChismosaDropdown },
|
components: { Burger, ChismosaDropdown },
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters('pedido', ["pedidoDefinido"]),
|
...mapGetters('pedido', ["pedidoDefinido"]),
|
||||||
...mapState('pedido', ["nombre"]),
|
...mapState('pedido', ["nombre", "grupo_de_compra"]),
|
||||||
...mapState('ui', ["burger_activa"])
|
...mapState('ui', ["burger_activa"])
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations('ui', ["toggleBurger"]),
|
...mapMutations('ui', ["toggleBurger"]),
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="navbar-item hide-below-1024">
|
<div>
|
||||||
<p v-if="pedidoDefinido">{{ nombre }}</p>
|
<div class="navbar-item hide-below-1024">
|
||||||
|
<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"
|
||||||
|
@ -29,4 +32,5 @@ export default {
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
<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,8 +88,7 @@ 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,11 +94,6 @@ 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,30 +48,6 @@ 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:ollas'])->group( function() {
|
Route::middleware(['auth', 'role:olla'])->group( function() {
|
||||||
Route::get('/ollas', 'RouteController@main')->name('ollas');
|
Route::get('/ollas', 'RouteController@main')->name('ollas');
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue