refs #4856 feat: se envia el registro a todos los teletrabajadores. Tmb se pone estado 'SENDED' cuando se da a 'Reenviar'
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2023-03-29 11:27:48 +02:00
parent 8f2735e126
commit d066c4ea0b
2 changed files with 17 additions and 12 deletions

View File

@ -131,20 +131,10 @@ module.exports = Self => {
JOIN business b ON b.id = tb.businessFk
LEFT JOIN tmp.timeControlCalculate tc ON tc.userFk = tb.userFk AND tc.dated = tb.dated
LEFT JOIN worker w ON w.id = u.id
JOIN (SELECT tb.userFk,
SUM(IF(tb.type IS NULL,
IF(tc.timeWorkDecimal > 0, FALSE, IF(tb.timeWorkDecimal > 0, TRUE, FALSE)),
TRUE))isTeleworkingWeek
FROM tmp.timeBusinessCalculate tb
LEFT JOIN tmp.timeControlCalculate tc ON tc.userFk = tb.userFk
AND tc.dated = tb.dated
GROUP BY tb.userFk
HAVING isTeleworkingWeek > 0
)sub ON sub.userFk = u.id
WHERE d.hasToRefill
AND IFNULL(?, u.id) = u.id
WHERE IFNULL(?, u.id) = u.id
AND b.companyCodeFk = 'VNL'
AND w.businessFk
AND d.isTeleworking
ORDER BY u.id, tb.dated
`, [args.workerId]);
const index = stmts.push(stmt) - 1;

View File

@ -379,6 +379,20 @@ class Controller extends Section {
});
}
isSended() {
const params = {
workerId: this.worker.id,
year: this.date.getFullYear(),
week: this.weekNumber,
state: 'SENDED'
};
const query = `WorkerTimeControls/updateWorkerTimeControlMail`;
this.$http.post(query, params).then(() => {
this.getMailStates(this.date);
this.getWeekData();
});
}
changeState(state, reason) {
this.state = state;
this.reason = reason;
@ -412,6 +426,7 @@ class Controller extends Section {
};
this.$http.post(`WorkerTimeControls/weekly-hour-hecord-email`, params)
.then(() => {
this.isSended();
this.vnApp.showSuccess(this.$t('Email sended'));
});
}