Skip date if none provided

This commit is contained in:
Juan Pablo Vial
2025-11-24 19:02:29 -03:00
parent 49f5aa21f9
commit a0019b51a5

View File

@ -115,7 +115,7 @@
this.data.filename = 'Plantilla de Precios'
this.data.format = 'xlsx'
this.data.columns = {
Fecha: '',
'Fecha*': 'Fecha es opcional. Se toma la fecha seleccionada',
'Proyecto*': 'Proyecto es opcional. Se toma el proyecto seleccionado',
'Tipo*': 'Tipo es optional. Se toma departamento.',
Unidad: '',
@ -181,7 +181,9 @@
const body = new FormData()
body.set('project_id', this.components.project.value)
const date = this.components.$calendar.calendar('get date')
body.set('date', [date.getFullYear(), date.getMonth() + 1, date.getDate()].join('-'))
if (date) {
body.set('date', [date.getFullYear(), date.getMonth() + 1, date.getDate()].join('-'))
}
body.set('file', this.components.file.files[0])
APIClient.fetch(url, {method, body}).then(response => response.json()).then(json => {
if (json.status === true) {