diff --git a/resources/views/renovaciones/contratos.html b/resources/views/renovaciones/contratos.html index b410169..449268a 100644 --- a/resources/views/renovaciones/contratos.html +++ b/resources/views/renovaciones/contratos.html @@ -235,10 +235,16 @@ document.addEventListener('alpine:init', () => { async save() { this.loading = true; try { + const payload = { + ...this.form, + cliente_id: parseInt(this.form.cliente_id) || 0, + servicio_id: parseInt(this.form.servicio_id) || 0, + precio_acordado: parseFloat(this.form.precio_acordado) || 0, + }; if (this.editModal) { - await axios.put(`/app/api/contratos/${this.selectedId}`, this.form); + await axios.put(`/app/api/contratos/${this.selectedId}`, payload); } else { - await axios.post('/app/api/contratos', this.form); + await axios.post('/app/api/contratos', payload); } this.showToast('Guardado correctamente'); this.closeModals(); diff --git a/resources/views/renovaciones/reglas.html b/resources/views/renovaciones/reglas.html index 35d7cc4..ea1ff69 100644 --- a/resources/views/renovaciones/reglas.html +++ b/resources/views/renovaciones/reglas.html @@ -170,10 +170,15 @@ document.addEventListener('alpine:init', () => { async save() { this.loading = true; try { + const payload = { + ...this.form, + dias_antes: parseInt(this.form.dias_antes) || 0, + plantilla_id: parseInt(this.form.plantilla_id) || 0, + }; if (this.editModal) { - await axios.put(`/app/api/reglas-notificacion/${this.selectedId}`, this.form); + await axios.put(`/app/api/reglas-notificacion/${this.selectedId}`, payload); } else { - await axios.post('/app/api/reglas-notificacion', this.form); + await axios.post('/app/api/reglas-notificacion', payload); } this.showToast('Guardado'); this.closeModals(); diff --git a/resources/views/renovaciones/servicios.html b/resources/views/renovaciones/servicios.html index ed56e6f..d37d88a 100644 --- a/resources/views/renovaciones/servicios.html +++ b/resources/views/renovaciones/servicios.html @@ -192,10 +192,11 @@ document.addEventListener('alpine:init', () => { async save() { this.loading = true; try { + const payload = { ...this.form, precio: parseFloat(this.form.precio) || 0 }; if (this.editModal) { - await axios.put(`/app/api/servicios/${this.selectedId}`, this.form); + await axios.put(`/app/api/servicios/${this.selectedId}`, payload); } else { - await axios.post('/app/api/servicios', this.form); + await axios.post('/app/api/servicios', payload); } this.showToast('Guardado correctamente'); this.closeModals();