i`
This commit is contained in:
@@ -235,10 +235,16 @@ document.addEventListener('alpine:init', () => {
|
|||||||
async save() {
|
async save() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
try {
|
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) {
|
if (this.editModal) {
|
||||||
await axios.put(`/app/api/contratos/${this.selectedId}`, this.form);
|
await axios.put(`/app/api/contratos/${this.selectedId}`, payload);
|
||||||
} else {
|
} else {
|
||||||
await axios.post('/app/api/contratos', this.form);
|
await axios.post('/app/api/contratos', payload);
|
||||||
}
|
}
|
||||||
this.showToast('Guardado correctamente');
|
this.showToast('Guardado correctamente');
|
||||||
this.closeModals();
|
this.closeModals();
|
||||||
|
|||||||
@@ -170,10 +170,15 @@ document.addEventListener('alpine:init', () => {
|
|||||||
async save() {
|
async save() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
try {
|
try {
|
||||||
|
const payload = {
|
||||||
|
...this.form,
|
||||||
|
dias_antes: parseInt(this.form.dias_antes) || 0,
|
||||||
|
plantilla_id: parseInt(this.form.plantilla_id) || 0,
|
||||||
|
};
|
||||||
if (this.editModal) {
|
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 {
|
} else {
|
||||||
await axios.post('/app/api/reglas-notificacion', this.form);
|
await axios.post('/app/api/reglas-notificacion', payload);
|
||||||
}
|
}
|
||||||
this.showToast('Guardado');
|
this.showToast('Guardado');
|
||||||
this.closeModals();
|
this.closeModals();
|
||||||
|
|||||||
@@ -192,10 +192,11 @@ document.addEventListener('alpine:init', () => {
|
|||||||
async save() {
|
async save() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
try {
|
try {
|
||||||
|
const payload = { ...this.form, precio: parseFloat(this.form.precio) || 0 };
|
||||||
if (this.editModal) {
|
if (this.editModal) {
|
||||||
await axios.put(`/app/api/servicios/${this.selectedId}`, this.form);
|
await axios.put(`/app/api/servicios/${this.selectedId}`, payload);
|
||||||
} else {
|
} else {
|
||||||
await axios.post('/app/api/servicios', this.form);
|
await axios.post('/app/api/servicios', payload);
|
||||||
}
|
}
|
||||||
this.showToast('Guardado correctamente');
|
this.showToast('Guardado correctamente');
|
||||||
this.closeModals();
|
this.closeModals();
|
||||||
|
|||||||
Reference in New Issue
Block a user