FIX: Desisitimiento no encontrado

This commit is contained in:
Juan Pablo Vial
2024-12-03 11:46:18 -03:00
parent 2b1190202a
commit 9f302e712c

View File

@ -54,8 +54,8 @@
}
$(document).ready(() => {
const url = '{{$urls->api}}/ventas/pago/{{$venta->resciliacion()->id}}'
let old = new Date({{$venta->resciliacion()->fecha->format('Y')}},
{{$venta->resciliacion()->fecha->format('n')}}-1, {{$venta->resciliacion()->fecha->format('j')}})
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')}})
calendar_date_options['initialDate'] = old
calendar_date_options['onChange'] = function(date, text, mode) {
if (date.getTime() === old.getTime()) {
@ -64,7 +64,7 @@
const body = new FormData()
body.set('fecha', date.toISOString())
$('#loading-spinner-fecha').show()
fetchAPI(url, {method: 'post', body}).then(response => {
APIClient.fetch(url, {method: 'post', body}).then(response => {
$('#loading-spinner-fecha').hide()
if (!response) {
return
@ -79,7 +79,7 @@
const body = new FormData()
body.set('valor', val)
$('#loading-spinner-devolucion').show()
fetchAPI(url, {method: 'post', body}).then(response => {
APIClient.fetch(url, {method: 'post', body}).then(response => {
$('#loading-spinner-devolucion').hide()
if (!response) {
return
@ -90,7 +90,7 @@
$('#eliminar_desistimiento').click(event => {
const url = '{{$urls->api}}/venta/{{$venta->id}}/desistir/eliminar'
$('#loading-spinner-eliminar').show()
fetchAPI(url).then(response => {
APIClient.fetch(url).then(response => {
$('#loading-spinner-eliminar').hide()
if (!response) {
alertResponse('No se pudo eliminar el desistimiento', {color: 'red', icon: 'triangle exclamation'})