mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
fix btn cancel fa
This commit is contained in:
@ -23,7 +23,8 @@ class MaquinistaFichajeAuto {
|
||||
Notiflix.Block.circle('.section-block');
|
||||
this.otInputId.trigger('focus')
|
||||
this.otInputId.on('change', this._handleGetOt.bind(this))
|
||||
this.btnFinishTarea.on('click', this._handleFinishTareasConfirm.bind(this))
|
||||
this.btnFinishTarea.on('click', this._handleUpdateTareasConfirm.bind(this))
|
||||
this.btnCancelTarea.on('click',this._handleResetTareasConfirm.bind(this))
|
||||
}
|
||||
|
||||
hideCard() {
|
||||
@ -83,7 +84,7 @@ class MaquinistaFichajeAuto {
|
||||
console.log("Iniciar ", this.otId)
|
||||
if (this.lastOtId != this.otId) {
|
||||
console.log("Finalizar", this.lastOtId)
|
||||
this._handleFinishTareas(this.lastOtId)
|
||||
this._handleUpdateTareas(this.lastOtId,'F')
|
||||
}
|
||||
} else {
|
||||
console.log("Primera OT insertada")
|
||||
@ -93,9 +94,7 @@ class MaquinistaFichajeAuto {
|
||||
this.actionLoader(false)
|
||||
if (response.data) {
|
||||
this.fillData(response.data)
|
||||
response.data.tareas.forEach(tarea => {
|
||||
this._handleInitTareas(tarea.id, 'I')
|
||||
});
|
||||
this._handleUpdateTareas(this.otId, 'I')
|
||||
}
|
||||
}
|
||||
_handleGetOtError(error) {
|
||||
@ -103,44 +102,31 @@ class MaquinistaFichajeAuto {
|
||||
this.otInputId.addClass('is-invalid')
|
||||
popErrorAlert(error.responseJSON.message)
|
||||
}
|
||||
_handleInitTareas(tareaId, estado = 'I') {
|
||||
let ajax = new Ajax('/produccion/ordentrabajo/update/tarea/progress',
|
||||
{
|
||||
ot_tarea_id: tareaId,
|
||||
estado: estado
|
||||
}, null,
|
||||
this._handleInitTareasSuccess.bind(this),
|
||||
this._handleInitTareasError.bind(this)
|
||||
);
|
||||
if (tareaId) {
|
||||
ajax.post();
|
||||
}
|
||||
}
|
||||
_handleInitTareasSuccess() { }
|
||||
_handleInitTareasError() { }
|
||||
|
||||
_handleFinishTareas(otId) {
|
||||
let ajax = new Ajax('/produccion/ordentrabajo/fa/tareas/finish',
|
||||
_handleUpdateTareas(otId,estado = "F") {
|
||||
let ajax = new Ajax('/produccion/ordentrabajo/fa/tareas/update',
|
||||
{
|
||||
orden_trabajo_id: otId,
|
||||
estado : estado,
|
||||
...this.getFormData()
|
||||
}, null,
|
||||
this._handleFinishTareasSucess.bind(this),
|
||||
this._handleFinishTareasError.bind(this)
|
||||
this._handleUpdateTareasSucess.bind(this),
|
||||
this._handleUpdateTareasError.bind(this)
|
||||
);
|
||||
ajax.post()
|
||||
|
||||
}
|
||||
_handleFinishTareasConfirm(event) {
|
||||
_handleUpdateTareasConfirm(event) {
|
||||
let otId = this.otInputId.val()
|
||||
console.log("Finalizar", otId);
|
||||
let ajax = new Ajax('/produccion/ordentrabajo/fa/tareas/finish',
|
||||
let ajax = new Ajax('/produccion/ordentrabajo/fa/tareas/update',
|
||||
{
|
||||
orden_trabajo_id: otId,
|
||||
estado : 'F',
|
||||
...this.getFormData()
|
||||
}, null,
|
||||
this._handleFinishTareasConfirmSucess.bind(this),
|
||||
this._handleFinishTareasConfirmError.bind(this)
|
||||
this._handleUpdateTareasConfirmSucess.bind(this),
|
||||
this._handleUpdateTareasConfirmError.bind(this)
|
||||
);
|
||||
if (otId) {
|
||||
alertConfirmAction('Se va finalizar la tarea actual y se cancelará el modo auto.')
|
||||
@ -152,7 +138,7 @@ class MaquinistaFichajeAuto {
|
||||
}
|
||||
|
||||
}
|
||||
_handleFinishTareasConfirmSucess(response) {
|
||||
_handleUpdateTareasConfirmSucess(response) {
|
||||
this.hideCard()
|
||||
this.otInputId.val(null)
|
||||
this.otId = null
|
||||
@ -160,9 +146,46 @@ class MaquinistaFichajeAuto {
|
||||
this.tareas = []
|
||||
popSuccessAlert(response.message)
|
||||
}
|
||||
_handleFinishTareasConfirmError() { }
|
||||
_handleFinishTareasSucess() { }
|
||||
_handleFinishTareasError() { }
|
||||
_handleDeleteTareasConfirmSucess(response) {
|
||||
this.hideCard()
|
||||
this.otInputId.val(null)
|
||||
this.otId = null
|
||||
this.lastOtId = null
|
||||
this.tareas = []
|
||||
popSuccessAlert(response.message)
|
||||
}
|
||||
_handleDeleteTareasConfirmError(error) {
|
||||
popErrorAlert(error)
|
||||
}
|
||||
_handleResetTareasConfirm(event) {
|
||||
let otId = this.otInputId.val()
|
||||
console.log("Finalizar", otId);
|
||||
let ajax = new Ajax('/produccion/ordentrabajo/fa/tareas/reset',
|
||||
{
|
||||
orden_trabajo_id: otId,
|
||||
estado : 'P',
|
||||
...this.getFormData()
|
||||
}, null,
|
||||
this._handleDeleteTareasConfirmSucess.bind(this),
|
||||
this._handleUpdateTareasConfirmError.bind(this)
|
||||
);
|
||||
if (otId) {
|
||||
alertConfirmAction('Se va a cancelar la tarea y se borrará el progreso')
|
||||
.then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
ajax.post();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
_handleUpdateTareasConfirmError() { }
|
||||
_handleUpdateTareasSucess(response) {
|
||||
this.item.find('#tiempo-estimado-info').text(response.data.tiempo_total_estimado)
|
||||
this.item.find('#tiempo-real-info').text(response.data.tiempo_total_real)
|
||||
|
||||
}
|
||||
_handleUpdateTareasError() { }
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user