From 36f39b926bdbf6f95bf7c942fb79bcc5def66c28 Mon Sep 17 00:00:00 2001 From: FazeElian Date: Mon, 5 Feb 2024 16:21:43 -0500 Subject: [PATCH] =?UTF-8?q?Adici=C3=B3n=20funcionalidad:=20Editar=20Venta?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/SaleController.php | 4 +- resources/views/Admin/facture/form.blade.php | 2 +- resources/views/Admin/sale/edit.blade.php | 119 ++++++++++++++++++- resources/views/Admin/sale/index.blade.php | 8 +- 4 files changed, 125 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/SaleController.php b/app/Http/Controllers/SaleController.php index a402e84..f7d00cf 100644 --- a/app/Http/Controllers/SaleController.php +++ b/app/Http/Controllers/SaleController.php @@ -77,8 +77,10 @@ public function edit($id) { $sale = Sale::find($id); $products = $sale->products; + $allProducts = Product::all(); + $selectedProducts = $sale->products; - return view('Admin.sale.edit', compact('sale', 'products')); + return view('Admin.sale.edit', compact('sale', 'products', 'allProducts', 'selectedProducts')); } public function update(Request $request, $id) diff --git a/resources/views/Admin/facture/form.blade.php b/resources/views/Admin/facture/form.blade.php index 1a07c40..31d1f10 100644 --- a/resources/views/Admin/facture/form.blade.php +++ b/resources/views/Admin/facture/form.blade.php @@ -15,7 +15,7 @@
- {{ Form::date('date', $facture->date, ['class' => 'form-control' . ($errors->has('date') ? ' is-invalid' : ''), 'placeholder' => 'Seleccionar una fecha', "id" => "fechaFactura", "name" => "date"]) }} + {{ Form::date('date', $facture->date ?? now()->toDateString(), ['class' => 'inp-venta' . ($errors->has('date') ? ' is-invalid' : ''), 'placeholder' => 'Seleccionar una fecha', "id" => "fechaFactura", "name" => "date"]) }}
diff --git a/resources/views/Admin/sale/edit.blade.php b/resources/views/Admin/sale/edit.blade.php index 36a9b9c..30e3319 100644 --- a/resources/views/Admin/sale/edit.blade.php +++ b/resources/views/Admin/sale/edit.blade.php @@ -1,10 +1,15 @@ +@include("layouts.headerAdmin") + - Editar Venta | No. {{ $sale->id }} + Ventas | Editar + + {{-- Estilos para este archivo --}} + @@ -18,7 +23,61 @@
{{ method_field('PATCH') }} @csrf - @include('Admin.sale.form') + + +
+ +
+ + + {{ Form::date('date', $sale->date ?? now()->toDateString(), ['class' => 'inp-venta' . ($errors->has('date') ? ' is-invalid' : ''), 'placeholder' => 'Seleccionar una fecha', "id" => "fechaVenta", "name" => "date"]) }} +
+ + + + + + + + + + + + + @foreach ($selectedProducts as $product) + + + + + + + @endforeach +
Nombre productoCantidadPrecio /u + +
+ + + + + + + Eliminar Producto +
+ + +
+ +
+ Añadir Producto +
+
+
{{-- Opciones Venta --}}
@@ -34,3 +93,59 @@ + diff --git a/resources/views/Admin/sale/index.blade.php b/resources/views/Admin/sale/index.blade.php index 581f798..d01d7fe 100644 --- a/resources/views/Admin/sale/index.blade.php +++ b/resources/views/Admin/sale/index.blade.php @@ -54,7 +54,7 @@ {{ $sale->total }} $ - + @csrf @method('DELETE') @@ -108,7 +108,7 @@ @endif - @section('content') + {{-- @section('content') - @endsection + --}} + {{-- @endsection --}}