diff --git a/app/Controller/Bonos.php b/app/Controller/Bonos.php index 837c3f0..32daaa5 100644 --- a/app/Controller/Bonos.php +++ b/app/Controller/Bonos.php @@ -52,6 +52,16 @@ class Bonos } public static function do_edit() { - d(post()); + $id_venta = get('venta'); + $venta = model(Venta::class)->findOne($id_venta); + $bono = $venta->bonoPie(); + $valor = post('valor') * $bono->pago()->uf(); + $pago = $bono->pago(); + if ($valor != $bono->pago()->valor()) { + $pago->valor = $valor; + $pago->save(); + } + header('Location: ' . nUrl('ventas', 'show', ['venta' => $venta->id])); + exit(); } } diff --git a/resources/views/ventas/bonos/edit.blade.php b/resources/views/ventas/bonos/edit.blade.php index e69de29..7cbcb60 100644 --- a/resources/views/ventas/bonos/edit.blade.php +++ b/resources/views/ventas/bonos/edit.blade.php @@ -0,0 +1,29 @@ +@extends('layout.base') + +@section('content') +
+

Editar Bono Pie - Venta {{$venta->unidad()->descripcion}}

+
+
+
+
+
Pie
+
+ @if ($venta->pie()) + {{format('ufs', $venta->pie()->valor('uf'), null, true)}} + @endif +
+
+
+
+
Valor
+
+
UF
+
+
+
+ +
+
+
+@endsection