FIX: Escritura no grababa valor

This commit is contained in:
Juan Pablo Vial
2025-02-24 16:53:12 -03:00
parent b8af053c43
commit ab3c8da4f6
4 changed files with 35 additions and 11 deletions

View File

@ -37,7 +37,7 @@
<label for="valor">Valor</label>
<div class="ui left labeled input">
<div class="ui basic label">$</div>
<input type="text" name="valor" value="{{$venta->formaPago()->escritura->pago->valor}}" />
<input type="text" name="valor" id="valor" value="{{$venta->formaPago()->escritura->pago->valor}}" />
</div>
</div>
<div class="three wide field">
@ -62,9 +62,9 @@
function editEscritura() {
const url = '{{$urls->api}}/ventas/escritura/{{$venta->id}}/edit'
const data = new FormData()
data.set('venta', {{$venta->id}})
const fecha = $('#fecha').calendar('get date')
data.set('fecha', fecha.toISOString())
data.set('valor', $('#valor').val())
data.set('estado', $('#estado').dropdown('get value'))
return fetchAPI(url, {method: 'post', body: data}).then(response => {
if (response.ok) {
@ -78,10 +78,11 @@
})
}
$(document).ready(() => {
calendar_date_options.initialDate = new Date({{$venta->currentEstado()->fecha->format('Y, m-1, j')}})
calendar_date_options.initialDate = new Date({{$venta->formaPago()->escritura->pago->currentEstado->fecha->format('Y, m-1, j')}})
$('#fecha').calendar(calendar_date_options)
$('#estado').dropdown()
$('#estado').dropdown('set selected', '{{$venta->currentEstado()->id}}')
const $estado = $('#estado')
$estado.dropdown()
$estado.dropdown('set selected', '{{$venta->formaPago()->escritura->pago->currentEstado->tipoEstadoPago->id}}')
$('#edit_form').submit(event => {
event.preventDefault()
editEscritura()