FIX: valor vacio
This commit is contained in:
@ -81,7 +81,7 @@
|
|||||||
tipo_id: {{$unidad->proyectoTipoUnidad->tipoUnidad->id}},
|
tipo_id: {{$unidad->proyectoTipoUnidad->tipoUnidad->id}},
|
||||||
descripcion: '{{$unidad->descripcion}}',
|
descripcion: '{{$unidad->descripcion}}',
|
||||||
pid: {{$unidad->pu_id}},
|
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
|
@endforeach
|
||||||
],
|
],
|
||||||
@ -108,9 +108,12 @@
|
|||||||
},
|
},
|
||||||
doAddUnidad: function() {
|
doAddUnidad: function() {
|
||||||
const url = '{{$urls->api}}/ventas/propiedades/unidades/add'
|
const url = '{{$urls->api}}/ventas/propiedades/unidades/add'
|
||||||
const data = new FormData(document.getElementById('add_form'))
|
const body = new FormData(document.getElementById('add_form'))
|
||||||
data.set('propiedad', {{$propiedad->id}})
|
body.set('propiedad', {{$propiedad->id}})
|
||||||
return fetchAPI(url, {method: 'post', body: data}).then(response => {
|
if (body.get('valor') === '') {
|
||||||
|
body.set('valor', '0')
|
||||||
|
}
|
||||||
|
return fetchAPI(url, {method: 'post', body}).then(response => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
return response.json()
|
return response.json()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user