From 86d2c0e9f6acca567f08974d502088e573cb0226 Mon Sep 17 00:00:00 2001 From: Ale Date: Thu, 31 Mar 2022 17:48:08 -0300 Subject: [PATCH] Se ven los productos en una tabla al clickear en la chismosa --- app/Http/Controllers/ChismosaController.php | 24 ++++++ public/js/app.js | 4 +- public/js/chismosa.js | 82 +++++++++++++++++++++ resources/views/chismosa.blade.php | 13 ++++ routes/web.php | 4 +- 5 files changed, 124 insertions(+), 3 deletions(-) create mode 100644 app/Http/Controllers/ChismosaController.php create mode 100644 public/js/chismosa.js create mode 100644 resources/views/chismosa.blade.php diff --git a/app/Http/Controllers/ChismosaController.php b/app/Http/Controllers/ChismosaController.php new file mode 100644 index 0000000..f576b7d --- /dev/null +++ b/app/Http/Controllers/ChismosaController.php @@ -0,0 +1,24 @@ +middleware(['auth','subpedido']); + } + + + public function show() + { + return view('chismosa'); + } +} diff --git a/public/js/app.js b/public/js/app.js index 0d46c60..17ed606 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -8,7 +8,7 @@ Vue.component('nav-bar', { - +

$

@@ -35,7 +35,7 @@ Vue.component('nav-bar', { data() { return { isActive: false, - subpedido: null + subpedido: null } }, methods: { diff --git a/public/js/chismosa.js b/public/js/chismosa.js new file mode 100644 index 0000000..95aab20 --- /dev/null +++ b/public/js/chismosa.js @@ -0,0 +1,82 @@ +Vue.component('chismosa', { + template: ` +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ProdCant$EditarX
BTR{{ this.subpedido.bonos_de_transporte }}{{ this.subpedido.subtotal_bonos_de_transporte }}
Total total{{ this.subpedido.total }}
+
+ `, + 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; + }); + } + } +}); + +Vue.component('producto-row', { + template: ` + + {{ this.producto.nombre }} + {{ this.producto.pivot.cantidad }} + {{ this.producto.pivot.total }} + ACÁ VA BOTON PA EDITAR + ACÁ VA BOTON PA BORRAR + + `, + props: { + producto: Object + } +}) diff --git a/resources/views/chismosa.blade.php b/resources/views/chismosa.blade.php new file mode 100644 index 0000000..6760876 --- /dev/null +++ b/resources/views/chismosa.blade.php @@ -0,0 +1,13 @@ +@extends('layouts.app') + +@section('stylesheets') + +@endsection + +@section('content') + +@endsection + +@section('scripts') + +@endsection diff --git a/routes/web.php b/routes/web.php index 8a4a4a0..3c3d0e0 100644 --- a/routes/web.php +++ b/routes/web.php @@ -19,13 +19,15 @@ Auth::routes(['register' => false]); Route::get('/productos', 'ProductoController@index')->name('productos.index'); +Route::get('/chismosa', 'ChismosaController@show')->name('chismosa.show'); + Route::middleware('auth')->group( function() { Route::name('subpedidos.')->prefix("subpedidos")->group( function() { Route::get('/', function() { return view('subpedidos_create'); })->name('create'); - + Route::post('guardar_sesion', function() { $r = request(); if (!isset($r["subpedido"])) {