This commit is contained in:
Lizandro Guarnizo
2026-04-30 21:52:12 -05:00
parent aa393fce98
commit 7be96ad491
3 changed files with 18 additions and 6 deletions
+8 -2
View File
@@ -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();
+7 -2
View File
@@ -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();
+3 -2
View File
@@ -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();