Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ajoute le type de congé déménagement #443

Merged
merged 1 commit into from
Jun 28, 2024
Merged
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 migrations/1719581515131-addRelocationLeave.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class AddRelocationLeave1719581515131
implements MigrationInterface {
name = 'AddRelocationLeave1719581515131';

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')`
);
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')`
);
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 @@ -169,6 +169,7 @@ describe('GetUserElementsQueryHandler', () => {
new UserLeavesView(0, []),
new UserLeavesView(0, []),
new UserLeavesView(0, []),
new UserLeavesView(0, []),
new UserLeavesView(0, [])
)
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ export class GetUsersElementsQueryHandler {
this.createUserLeavesView(userLeaves.unpaid, date),
this.createUserLeavesView(userLeaves.medical, date),
this.createUserLeavesView(userLeaves.special, date),
this.createUserLeavesView(userLeaves.postponedWorkedFreeDay, date)
this.createUserLeavesView(userLeaves.postponedWorkedFreeDay, date),
this.createUserLeavesView(userLeaves.relocation, date)
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export class UserElementsView {
public readonly unpaidLeaves: UserLeavesView,
public readonly sickLeaves: UserLeavesView,
public readonly exceptionalLeaves: UserLeavesView,
public readonly postponedWorkedFreeDayLeaves: UserLeavesView
public readonly postponedWorkedFreeDayLeaves: UserLeavesView,
public readonly relocationLeaves: 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 @@ -13,7 +13,8 @@ export enum Type {
SPECIAL = 'special',
MEDICAL = 'medical',
ILLIMITED = 'illimited',
POSTPONED_WORKED_FREE_DAY = 'postponedWorkedFreeDay'
POSTPONED_WORKED_FREE_DAY = 'postponedWorkedFreeDay',
RELOCATION = 'relocation'
}

export interface ILeaveRequestModeration {
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 @@ -16,13 +16,16 @@ describe('UserLeavesCollection', () => {
when(postponedWorkedFreeDayLeave.getType()).thenReturn(
Type.POSTPONED_WORKED_FREE_DAY
);
const relocationLeave = mock(LeaveRequest);
when(relocationLeave.getType()).thenReturn(Type.RELOCATION);

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

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

const rows = [];
Expand Down Expand Up @@ -64,6 +65,9 @@ export class PayrollElementsTableFactory {
.template('pages/payroll_elements/_leaves.njk', {
leaves: item.postponedWorkedFreeDayLeaves
})
.template('pages/payroll_elements/_leaves.njk', {
leaves: item.relocationLeaves
})
.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 @@ -131,6 +131,7 @@ leaves-type-value = {$type ->
[medical] Congé maladie
[illimited] Congé illimité
[postponedWorkedFreeDay] Congé jour férié glissant
[relocation] Congé déménagement
*[other] Autre
}
leaves-type-value-plural = {$type ->
Expand All @@ -140,6 +141,7 @@ leaves-type-value-plural = {$type ->
[medical] Congés maladie
[illimited] Congés illimités
[postponedWorkedFreeDay] Congés jours fériés glissants
[relocation] Congés déménagement
*[other] Autre
}
leaves-startDate = Du
Expand Down Expand Up @@ -200,6 +202,7 @@ payroll-elements-unpaidLeaves = Congés sans solde
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-download = Télécharger
payroll-elements-filename = Fairness - Éléments de paie - {$date}.csv
payroll-elements-wiki = Voir le Wiki
Expand Down
Loading