FIX: Venta desistida pero sin resciliacion

This commit is contained in:
Juan Pablo Vial
2025-07-18 16:15:30 -04:00
parent 56505fe519
commit 3ce41914e5
2 changed files with 23 additions and 4 deletions

View File

@ -54,15 +54,16 @@
}
$(document).ready(() => {
const url = '{{$urls->api}}/ventas/pago/{{$venta->resciliacion()->id}}'
let old = new Date({{$venta->resciliacion()?->fecha->format('Y') ?? date('Y')}},
{{$venta->resciliacion()?->fecha->format('n') ?? date('n')}}-1, {{$venta->resciliacion()?->fecha->format('j') ?? date('j')}})
let old = new Date(Date.parse('{{$venta->resciliacion()?->fecha->format('Y-m-d') ?? $venta->currentEstado()->fecha->format('Y-m-d') ?? $venta->fecha->format('Y-m-d')}}') + 24 * 60 * 60 * 1000)
calendar_date_options['initialDate'] = old
calendar_date_options['onChange'] = function(date, text, mode) {
if (date.getTime() === old.getTime()) {
return
}
const body = new FormData()
body.set('fecha', date.toISOString())
const fecha = date
fecha.setDate(date.getDate() - 1)
body.set('fecha', fecha.toISOString())
$('#loading-spinner-fecha').show()
APIClient.fetch(url, {method: 'post', body}).then(response => {
$('#loading-spinner-fecha').hide()