Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions 1775206654746-migrations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class AddMenstrualDayLeave1775206654746
implements MigrationInterface {
name = 'AddMenstrualDayLeave1775206654746'

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TYPE "public"."leave_request_type_enum" RENAME TO "leave_request_type_enum_old"`
);
await queryRunner.query(
`CREATE TYPE "public"."leave_request_type_enum" AS ENUM('paid', 'unpaid', 'special', 'medical', 'illimited', 'postponedWorkedFreeDay', 'relocation', 'menstrualDay')`
);
await queryRunner.query(
`ALTER TABLE "leave_request" ALTER COLUMN "type" TYPE "public"."leave_request_type_enum" USING "type"::"text"::"public"."leave_request_type_enum"`
);
await queryRunner.query(`DROP TYPE "public"."leave_request_type_enum_old"`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TYPE "public"."leave_request_type_enum_old" AS ENUM('paid', 'unpaid', 'special', 'medical', 'illimited', 'postponedWorkedFreeDay, 'relocation')`
);
await queryRunner.query(
`ALTER TABLE "leave_request" ALTER COLUMN "type" TYPE "public"."leave_request_type_enum_old" USING "type"::"text"::"public"."leave_request_type_enum_old"`
);
await queryRunner.query(`DROP TYPE "public"."leave_request_type_enum"`);
await queryRunner.query(
`ALTER TYPE "public"."leave_request_type_enum_old" RENAME TO "leave_request_type_enum"`
);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ export class GetUsersElementsQueryHandler {
this.createUserLeavesView(userLeaves.medical, date),
this.createUserLeavesView(userLeaves.special, date),
this.createUserLeavesView(userLeaves.postponedWorkedFreeDay, date),
this.createUserLeavesView(userLeaves.relocation, date)
this.createUserLeavesView(userLeaves.relocation, date),
this.createUserLeavesView(userLeaves.menstrualDay, date)
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class UserElementsView {
public readonly sickLeaves: UserLeavesView,
public readonly exceptionalLeaves: UserLeavesView,
public readonly postponedWorkedFreeDayLeaves: UserLeavesView,
public readonly relocationLeaves: UserLeavesView
public readonly relocationLeaves: UserLeavesView,
public readonly menstrualDayLeaves: UserLeavesView
) {}
}
3 changes: 2 additions & 1 deletion src/Domain/HumanResource/Leave/LeaveRequest.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export enum Type {
MEDICAL = 'medical',
ILLIMITED = 'illimited',
POSTPONED_WORKED_FREE_DAY = 'postponedWorkedFreeDay',
RELOCATION = 'relocation'
RELOCATION = 'relocation',
MENSTRUAL_DAY = 'menstrualDay'
}

export function getSelectableLeaveRequestTypes() {
Expand Down
6 changes: 5 additions & 1 deletion src/Domain/HumanResource/Leave/UserLeavesCollection.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@ describe('UserLeavesCollection', () => {
);
const relocationLeave = mock(LeaveRequest);
when(relocationLeave.getType()).thenReturn(Type.RELOCATION);
const menstrualDayLeave = mock(LeaveRequest);
when(menstrualDayLeave.getType()).thenReturn(Type.MENSTRUAL_DAY);

const userLeaves = new UserLeavesCollection([
instance(paidLeave),
instance(unpaidLeave),
instance(specialLeave),
instance(medicalLeave),
instance(postponedWorkedFreeDayLeave),
instance(relocationLeave)
instance(relocationLeave),
instance(menstrualDayLeave)
]);
expect(userLeaves.paid[0].getType()).toBe(Type.PAID);
expect(userLeaves.unpaid[0].getType()).toBe(Type.UNPAID);
Expand All @@ -35,5 +38,6 @@ describe('UserLeavesCollection', () => {
Type.POSTPONED_WORKED_FREE_DAY
);
expect(userLeaves.relocation[0].getType()).toBe(Type.RELOCATION);
expect(userLeaves.menstrualDay[0].getType()).toBe(Type.MENSTRUAL_DAY);
});
});
4 changes: 4 additions & 0 deletions src/Domain/HumanResource/Leave/UserLeavesCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export class UserLeavesCollection {
public medical: LeaveRequest[] = [];
public postponedWorkedFreeDay: LeaveRequest[] = [];
public relocation: LeaveRequest[] = [];
public menstrualDay: LeaveRequest[] = [];

constructor(leaves: LeaveRequest[]) {
this.distributeLeavesByType(leaves);
Expand All @@ -33,6 +34,9 @@ export class UserLeavesCollection {
case Type.RELOCATION:
this.relocation.push(leave);
break;
case Type.MENSTRUAL_DAY:
this.menstrualDay.push(leave);
break;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export class PayrollElementsTableFactory {
'payroll-elements-medicalLeaves',
'payroll-elements-specialLeaves',
'payroll-elements-postponedWorkedFreeDayLeaves',
'payroll-elements-relocationLeaves'
'payroll-elements-relocationLeaves',
'payroll-elements-menstrualDayLeaves'
];

const rows = [];
Expand Down Expand Up @@ -68,6 +69,9 @@ export class PayrollElementsTableFactory {
.template('pages/payroll_elements/_leaves.njk', {
leaves: item.relocationLeaves
})
.template('pages/payroll_elements/_leaves.njk', {
leaves: item.menstrualDayLeaves
})
.build();

rows.push(row);
Expand Down
3 changes: 3 additions & 0 deletions src/translations/fr-FR.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ leaves-type-value = {$type ->
[illimited] Congé illimité
[postponedWorkedFreeDay] Congé jour férié glissant
[relocation] Congé déménagement
[menstrualDay] Congé menstruel
*[other] Autre
}
leaves-type-value-plural = {$type ->
Expand All @@ -144,6 +145,7 @@ leaves-type-value-plural = {$type ->
[illimited] Congés illimités
[postponedWorkedFreeDay] Congés jours fériés glissants
[relocation] Congés déménagement
[menstrualDay] Congés menstruels
*[other] Autre
}
leaves-startDate = Du
Expand Down Expand Up @@ -222,6 +224,7 @@ payroll-elements-medicalLeaves = Congés maladie
payroll-elements-specialLeaves = Congés exceptionnels
payroll-elements-postponedWorkedFreeDayLeaves = Congés jours fériés glissants
payroll-elements-relocationLeaves = Congés déménagement
payroll-elements-menstrualDayLeaves = Congés menstruel
payroll-elements-download = Télécharger
payroll-elements-filename = Fairness - Éléments de paie - {$date}.csv
payroll-elements-wiki = Voir le Wiki
Expand Down
Loading