From 05b9a3ad8ab3b6d3af84130e8bed197a8cec40cd Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Tue, 30 Apr 2024 11:35:04 -0400 Subject: [PATCH] FIX: valor vacio --- app/resources/views/ventas/propiedades/edit.blade.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/resources/views/ventas/propiedades/edit.blade.php b/app/resources/views/ventas/propiedades/edit.blade.php index e54d5d9..5f9a243 100644 --- a/app/resources/views/ventas/propiedades/edit.blade.php +++ b/app/resources/views/ventas/propiedades/edit.blade.php @@ -81,7 +81,7 @@ tipo_id: {{$unidad->proyectoTipoUnidad->tipoUnidad->id}}, descripcion: '{{$unidad->descripcion}}', pid: {{$unidad->pu_id}}, - valor: {{($unidad->valor > 0) ? $unidad->valor : $unidad->precio($venta->fecha)->valor}} + valor: {{($unidad->valor > 0) ? $unidad->valor : ($unidad->precio($venta->fecha)->valor ?? 0)}} }, @endforeach ], @@ -108,9 +108,12 @@ }, doAddUnidad: function() { const url = '{{$urls->api}}/ventas/propiedades/unidades/add' - const data = new FormData(document.getElementById('add_form')) - data.set('propiedad', {{$propiedad->id}}) - return fetchAPI(url, {method: 'post', body: data}).then(response => { + const body = new FormData(document.getElementById('add_form')) + body.set('propiedad', {{$propiedad->id}}) + if (body.get('valor') === '') { + body.set('valor', '0') + } + return fetchAPI(url, {method: 'post', body}).then(response => { if (response.ok) { return response.json() }