Merge branch 'lista-chismosa'
This commit is contained in:
commit
67aadf157f
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ChismosaController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create a new controller instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware(['auth','subpedido']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function show()
|
||||||
|
{
|
||||||
|
return view('chismosa');
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,11 +17,11 @@ class SubpedidoResource extends JsonResource
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'nombre' => $this->nombre,
|
'nombre' => $this->nombre,
|
||||||
'subtotal_productos' => number_format($this->getSubtotalProductos(),2),
|
'subtotal_productos' => number_format($this->getSubtotalProductos(),0),
|
||||||
'subtotal_bonos' => number_format($this->getSubtotalBonos(),2),
|
'subtotal_bonos' => number_format($this->getSubtotalBonos(),0),
|
||||||
'bonos_de_transporte' => $this->cantidadBDT(),
|
'bonos_de_transporte' => $this->cantidadBDT(),
|
||||||
'subtotal_bonos_de_transporte' => number_format($this->getSubtotalBDT(),2),
|
'subtotal_bonos_de_transporte' => number_format($this->getSubtotalBDT(),0),
|
||||||
'total' => number_format($this->getTotal(),2),
|
'total' => number_format($this->getTotal(),0),
|
||||||
'grupo_de_compra' => $this->grupoDeCompra,
|
'grupo_de_compra' => $this->grupoDeCompra,
|
||||||
'productos' => $this->productos
|
'productos' => $this->productos
|
||||||
];
|
];
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
File diff suppressed because one or more lines are too long
|
@ -6,3 +6,28 @@ p.navbar-item:empty {
|
||||||
color: #cc0f35;
|
color: #cc0f35;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.help {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.table td {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav.breadcrumb.is-fixed-top {
|
||||||
|
left: 0;
|
||||||
|
position: fixed;
|
||||||
|
right: 0;
|
||||||
|
z-index: 30;
|
||||||
|
top: 3.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
main.has-top-padding {
|
||||||
|
padding-top: 3rem !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.has-text-centered {
|
||||||
|
text-align: center;
|
||||||
|
margin: 0 1em;
|
||||||
|
}
|
||||||
|
|
|
@ -2,13 +2,13 @@ window.Event = new Vue();
|
||||||
|
|
||||||
Vue.component('nav-bar', {
|
Vue.component('nav-bar', {
|
||||||
template: `
|
template: `
|
||||||
<nav class="navbar is-danger" role="navigation" aria-label="main navigation">
|
<nav 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">
|
||||||
</a>
|
</a>
|
||||||
<p style="margin:0 auto" class="navbar-item"><slot name="subpedido"></slot></p>
|
<p style="margin:0 auto" class="navbar-item"><slot name="subpedido"></slot></p>
|
||||||
<a class="navbar-item" href="#">
|
<a class="navbar-item" href="/chismosa">
|
||||||
<img style="padding:0 0.3em;" src="/assets/chismosa.png" height="28">
|
<img style="padding:0 0.3em;" src="/assets/chismosa.png" height="28">
|
||||||
<p style="margin:0 auto; color:white">$ <span v-text="subpedido == null ? 0 : subpedido.total"></span></p>
|
<p style="margin:0 auto; color:white">$ <span v-text="subpedido == null ? 0 : subpedido.total"></span></p>
|
||||||
</a>
|
</a>
|
||||||
|
@ -35,7 +35,7 @@ Vue.component('nav-bar', {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isActive: false,
|
isActive: false,
|
||||||
subpedido: null
|
subpedido: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -59,7 +59,13 @@ Vue.component('nav-bar', {
|
||||||
cantidad: cantidad,
|
cantidad: cantidad,
|
||||||
producto_id: id
|
producto_id: id
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
alert('subpedido actualizado');
|
bulmaToast.toast({
|
||||||
|
message: 'Pedido actualizado exitosamente',
|
||||||
|
duration: 1000,
|
||||||
|
type: 'is-danger',
|
||||||
|
position: 'bottom-center',
|
||||||
|
animate: { in: 'fadeIn', out: 'fadeOut' }
|
||||||
|
});
|
||||||
this.actualizarSubpedido();
|
this.actualizarSubpedido();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,105 @@
|
||||||
|
Vue.component('chismosa', {
|
||||||
|
template: `
|
||||||
|
<div class="container">
|
||||||
|
<table v-show="this.subpedido.productos.length != 0" class="table is-fullwidth is-striped is-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Producto</th>
|
||||||
|
<th><abbr title="Cantidad">C</abbr></th>
|
||||||
|
<th><abbr title="Precio Total">$</abbr></th>
|
||||||
|
<th></th>
|
||||||
|
<th><abbr title="Eliminar"></abbr></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th><abbr title="Bonos de Transporte">B. Transporte</abbr></th>
|
||||||
|
<th>{{ this.subpedido.bonos_de_transporte }}</th>
|
||||||
|
<th>{{ this.subpedido.subtotal_bonos_de_transporte }}</th>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Total total</th>
|
||||||
|
<th></th>
|
||||||
|
<th>{{ this.subpedido.total }}</th>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
<tbody>
|
||||||
|
<producto-row v-for="producto in this.subpedido.productos" :producto="producto" :key="producto.id"></producto-row>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p class="has-text-centered" v-show="this.subpedido.productos.length == 0">Compa, todavía no agregaste nada a la chismosa.</p>
|
||||||
|
</div>
|
||||||
|
`,
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
subpedido: {
|
||||||
|
productos:[]
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
/* TODO: tener el camino que se había hecho antes de abrir la chismosa para volver atrás */
|
||||||
|
miga: function() {
|
||||||
|
return {
|
||||||
|
nombre: "Chismosa de " + this.subpedido.nombre,
|
||||||
|
href: "/chismosa"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeCreate() {
|
||||||
|
axios.get("/subpedidos/obtener_sesion").then(response => {
|
||||||
|
this.subpedido = response.data.subpedido;
|
||||||
|
this.fetchSubpedido();
|
||||||
|
Event.$emit("migas-agregar",this.miga);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
fetchSubpedido() {
|
||||||
|
axios.get("/api/subpedidos/" + this.subpedido.id)
|
||||||
|
.then(response => {
|
||||||
|
this.subpedido = response.data.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
Event.$on('sync-subpedido', () => {
|
||||||
|
this.fetchSubpedido();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Vue.component('producto-row', {
|
||||||
|
template: `
|
||||||
|
<tr>
|
||||||
|
<td>{{ this.producto.nombre }}</td>
|
||||||
|
<td>{{ this.producto.pivot.cantidad }}</td>
|
||||||
|
<td>{{ this.producto.pivot.total }}</td>
|
||||||
|
<td><button @click.capture="seleccionarProducto(producto)" class="button is-warning">
|
||||||
|
<span class="icon">
|
||||||
|
<i class="fas fa-edit"></i>
|
||||||
|
</span>
|
||||||
|
</button></td>
|
||||||
|
<td><button @click.capture="eliminarProducto(producto)" class="button is-danger">
|
||||||
|
<span class="icon">
|
||||||
|
<i class="fas fa-trash-alt"></i>
|
||||||
|
</span>
|
||||||
|
</button></td>
|
||||||
|
</tr>
|
||||||
|
`,
|
||||||
|
props: {
|
||||||
|
producto: Object
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
seleccionarProducto(producto) {
|
||||||
|
Event.$emit("producto-seleccionado",producto);
|
||||||
|
},
|
||||||
|
eliminarProducto(producto) {
|
||||||
|
Event.$emit("sync-subpedido", 0, this.producto.id);
|
||||||
|
Event.$emit("sync-subpedido");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
|
@ -119,20 +119,21 @@ Vue.component('producto-container', {
|
||||||
</header>
|
</header>
|
||||||
<section class="modal-card-body">
|
<section class="modal-card-body">
|
||||||
<div class="card-image">
|
<div class="card-image">
|
||||||
|
<figure v-show="producto.nacional" class="image icono is-32x32" style="z-index:10">
|
||||||
|
<img src="/assets/uruguay.png">
|
||||||
|
</figure>
|
||||||
|
<figure v-show="producto.economia_solidaria" class="image icono is-32x32" style="z-index:10">
|
||||||
|
<img src="/assets/solidaria.png">
|
||||||
|
</figure>
|
||||||
<figure class="image is-4by3">
|
<figure class="image is-4by3">
|
||||||
<img
|
<img
|
||||||
v-bind:src="producto.imagen ? producto.imagen : 'https://bulma.io/images/placeholders/1280x960.png'">
|
v-bind:src="producto.imagen ? producto.imagen : 'https://bulma.io/images/placeholders/1280x960.png'">
|
||||||
</figure>
|
</figure>
|
||||||
<figure v-show="producto.nacional" class="image icono is-32x32">
|
|
||||||
<img src="/assets/uruguay.png">
|
|
||||||
</figure>
|
|
||||||
<figure v-show="producto.economia_solidaria" class="image icono is-32x32">
|
|
||||||
<img src="/assets/solidaria.png">
|
|
||||||
</figure>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="media-content">
|
<div class="media-content">
|
||||||
<p class="title is-4" v-text="producto.proveedor"></p>
|
<p class="title is-4" v-text="producto.proveedor"></p>
|
||||||
<p class="subtitle is-4">$<span v-text="producto.precio"></span></p>
|
<p class="subtitle is-4">$<span v-text="producto.precio"></span></p>
|
||||||
|
<p class="subtitle is-6"><span v-show="producto.apto_veganxs">Apto para veganxs. </span><span v-show="producto.apto_celiacxs">Apto para celíacxs.</span></p>
|
||||||
<p class="subtitle is-5"><span v-text="producto.descripcion"></span></p>
|
<p class="subtitle is-5"><span v-text="producto.descripcion"></span></p>
|
||||||
<div class="field has-addons is-centered is-thin-centered">
|
<div class="field has-addons is-centered is-thin-centered">
|
||||||
<p class="control">
|
<p class="control">
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>{{ config('app.name', 'Compras del MPS') }}</title>
|
<title>{{ config('app.name', 'Compras del MPS') }}</title>
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css">
|
||||||
|
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<section class="section">
|
<section class="section">
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@section('stylesheets')
|
||||||
|
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<chismosa></chismosa>
|
||||||
|
<producto-container></producto-container>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('scripts')
|
||||||
|
<script src="{{ asset('js/chismosa.js') }}"></script>
|
||||||
|
<script src="{{ asset('js/productos.js') }}"></script>
|
||||||
|
@endsection
|
|
@ -8,17 +8,20 @@
|
||||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
|
|
||||||
<title>{{ session("subpedido_nombre") ? "Pedido de " . session("subpedido_nombre") . " - " . config('app.name', 'Compras del MPS') : config('app.name', 'Compras del MPS')}}</title>
|
<title>{{ session("subpedido_nombre") ? "Pedido de " . session("subpedido_nombre") . " - " . config('app.name', 'Compras del MPS') : config('app.name', 'Compras del MPS')}}</title>
|
||||||
|
<link rel="icon" type="image/x-icon" href="/assets/favicon.png">
|
||||||
|
|
||||||
<!-- Fonts -->
|
<!-- Fonts -->
|
||||||
|
<script src="https://kit.fontawesome.com/9235d1c676.js" crossorigin="anonymous"></script>
|
||||||
|
<script src="{{ asset('js/bulma-toast.min.js') }}"></script>
|
||||||
<!-- Styles -->
|
<!-- Styles -->
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css">
|
||||||
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
|
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
|
||||||
|
<link rel="stylesheet" href="{{ asset('css/animate.min.css') }}">
|
||||||
@yield('stylesheets')
|
@yield('stylesheets')
|
||||||
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="has-navbar-fixed-top">
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<nav-bar>
|
<nav-bar>
|
||||||
<template slot="subpedido">{{ session('subpedido_nombre') ? 'Pedido de '. session('subpedido_nombre') : Auth::user()->name }}</template>
|
<template slot="subpedido">{{ session('subpedido_nombre') ? 'Pedido de '. session('subpedido_nombre') : Auth::user()->name }}</template>
|
||||||
|
@ -30,14 +33,14 @@
|
||||||
</template>
|
</template>
|
||||||
</nav-bar>
|
</nav-bar>
|
||||||
<nav-migas inline-template>
|
<nav-migas inline-template>
|
||||||
<nav class="breadcrumb is-centered has-background-danger-light" aria-label="breadcrumbs" v-show="visible">
|
<nav class="breadcrumb is-centered has-background-danger-light is-fixed-top" aria-label="breadcrumbs" v-show="visible">
|
||||||
<ul>
|
<ul>
|
||||||
<li v-for="(miga, i) in migas" v-bind:class="i==migas.length-1 ? 'is-active' : ''"><a :href="miga.href" v-text="miga.nombre"></a></li>
|
<li v-for="(miga, i) in migas" v-bind:class="i==migas.length-1 ? 'is-active' : ''"><a :href="miga.href" v-text="miga.nombre"></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</nav-migas>
|
</nav-migas>
|
||||||
|
|
||||||
<main class="py-4">
|
<main class="py-4 has-top-padding">
|
||||||
@yield('content')
|
@yield('content')
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="column is-one-third buttons">
|
<div class="column is-one-third buttons">
|
||||||
<button class="button is-danger" :disabled="botonCrearDesabilitado" @click="submit">Crear nuevo pedido</button>
|
<button class="button is-danger" v-show="!botonCrearDesabilitado" @click="submit">Crear nuevo pedido</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="subpedidosExistentes.length" class="block">
|
<div v-if="subpedidosExistentes.length" class="block">
|
||||||
|
|
|
@ -19,13 +19,15 @@ Auth::routes(['register' => false]);
|
||||||
|
|
||||||
Route::get('/productos', 'ProductoController@index')->name('productos.index');
|
Route::get('/productos', 'ProductoController@index')->name('productos.index');
|
||||||
|
|
||||||
|
Route::get('/chismosa', 'ChismosaController@show')->name('chismosa.show');
|
||||||
|
|
||||||
Route::middleware('auth')->group( function() {
|
Route::middleware('auth')->group( function() {
|
||||||
|
|
||||||
Route::name('subpedidos.')->prefix("subpedidos")->group( function() {
|
Route::name('subpedidos.')->prefix("subpedidos")->group( function() {
|
||||||
Route::get('/', function() {
|
Route::get('/', function() {
|
||||||
return view('subpedidos_create');
|
return view('subpedidos_create');
|
||||||
})->name('create');
|
})->name('create');
|
||||||
|
|
||||||
Route::post('guardar_sesion', function() {
|
Route::post('guardar_sesion', function() {
|
||||||
$r = request();
|
$r = request();
|
||||||
if (!isset($r["subpedido"])) {
|
if (!isset($r["subpedido"])) {
|
||||||
|
|
Loading…
Reference in New Issue