Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 3430-ticket_step-two
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2022-01-17 13:37:25 +01:00
commit 4b2153d638
6 changed files with 47 additions and 5 deletions

View File

@ -0,0 +1,25 @@
ALTER TABLE `postgresql`.`business` ADD payedHolidays INT NULL;
ALTER TABLE `postgresql`.`business` CHANGE payedHolidays payedHolidays INT NULL AFTER reasonEndFk;
CREATE OR REPLACE
ALGORITHM = UNDEFINED VIEW `vn`.`workerLabour` AS
select
`b`.`business_id` AS `businessFk`,
`p`.`id_trabajador` AS `workerFk`,
`bl`.`workcenter_id` AS `workCenterFk`,
`b`.`date_start` AS `started`,
`b`.`date_end` AS `ended`,
`d`.`id` AS `departmentFk`,
`b`.`payedHolidays` AS `payedHolidays`
from
((((`postgresql`.`person` `p`
join `postgresql`.`profile` `pr` on
((`pr`.`person_id` = `p`.`person_id`)))
join `postgresql`.`business` `b` on
((`b`.`client_id` = `pr`.`profile_id`)))
join `postgresql`.`business_labour` `bl` on
((`b`.`business_id` = `bl`.`business_id`)))
join `vn`.`department` `d` on
((`d`.`id` = `bl`.`department_id`)))
order by
`b`.`date_start` desc

View File

@ -112,6 +112,13 @@ module.exports = Self => {
const contracts = await models.WorkerLabour.find(filter, myOptions); const contracts = await models.WorkerLabour.find(filter, myOptions);
let [firstContract] = contracts;
let payedHolidays;
if (firstContract.payedHolidays)
payedHolidays = firstContract.payedHolidays;
else payedHolidays = 0;
let totalHolidays = 0; let totalHolidays = 0;
let holidaysEnjoyed = 0; let holidaysEnjoyed = 0;
@ -166,8 +173,7 @@ module.exports = Self => {
return isLeapYear(year) ? 366 : 365; return isLeapYear(year) ? 366 : 365;
} }
return {totalHolidays, holidaysEnjoyed, payedHolidays};
return {totalHolidays, holidaysEnjoyed};
}; };
function isLeapYear(year) { function isLeapYear(year) {

View File

@ -9,16 +9,19 @@
"properties": { "properties": {
"businessFk": { "businessFk": {
"id": true, "id": true,
"type": "Number" "type": "number"
}, },
"workerFk": { "workerFk": {
"type": "Number" "type": "number"
}, },
"started": { "started": {
"type": "date" "type": "date"
}, },
"ended": { "ended": {
"type": "date" "type": "date"
},
"payedHolidays": {
"type": "number"
} }
}, },
"relations": { "relations": {

View File

@ -28,6 +28,9 @@
{{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed}} {{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed}}
{{'of' | translate}} {{$ctrl.contractHolidays.totalHolidays || 0}} {{'days' | translate}} {{'of' | translate}} {{$ctrl.contractHolidays.totalHolidays || 0}} {{'days' | translate}}
</div> </div>
<div>
{{'Paid holidays' | translate}} {{$ctrl.contractHolidays.payedHolidays}} {{'days' | translate}}
</div>
</div> </div>
<div class="totalBox" style="text-align: center;"> <div class="totalBox" style="text-align: center;">

View File

@ -71,6 +71,10 @@ class Controller extends Section {
} }
} }
get payedHolidays() {
return this._businessId;
}
buildYearFilter() { buildYearFilter() {
const now = new Date(); const now = new Date();
now.setFullYear(now.getFullYear() + 1); now.setFullYear(now.getFullYear() + 1);

View File

@ -9,3 +9,4 @@ Choose an absence type from the right menu: Elige un tipo de ausencia desde el m
To start adding absences, click an absence type from the right menu and then on the day you want to add an absence: Para empezar a añadir ausencias, haz clic en un tipo de ausencia desde el menu de la derecha y después en el día que quieres añadir la ausencia To start adding absences, click an absence type from the right menu and then on the day you want to add an absence: Para empezar a añadir ausencias, haz clic en un tipo de ausencia desde el menu de la derecha y después en el día que quieres añadir la ausencia
You can just add absences within the current year: Solo puedes añadir ausencias dentro del año actual You can just add absences within the current year: Solo puedes añadir ausencias dentro del año actual
Current day: Día actual Current day: Día actual
Paid holidays: Vacaciones pagadas