@@ -2,22 +2,27 @@ import { LabelledTypography } from "@/shared/components/labelled-typography";
2
2
import { PageBreak } from "@/shared/components/page-break" ;
3
3
import { EmploymentEntity } from "@/shared/entities/employment-entity" ;
4
4
import { EntityEmploymentLocalizationKeys } from "@/shared/localization/employment-localization" ;
5
+ import { IndexProps } from "@/shared/props/index-props" ;
5
6
import { ApplicationLanguage , LocalizationService } from "@/shared/services/localization-service" ;
7
+ import { PrintingService } from "@/shared/services/printing-service" ;
6
8
import { Paper , Typography } from "@mui/material" ;
7
9
import { ReactNode } from "react" ;
8
10
9
- interface EmploymentProps {
10
- employmentEntity : EmploymentEntity
11
+ interface EmploymentProps extends IndexProps {
12
+ employmentEntity : EmploymentEntity
11
13
}
12
14
13
15
export function Employment ( props : EmploymentProps ) : JSX . Element {
14
16
const localizationService : LocalizationService = LocalizationService . instance
17
+ const printService : PrintingService = PrintingService . instance
15
18
const entityLocalizationService = localizationService . getEmploymentLocalizationService ( )
16
19
const employedAsAt : string = buildEmployedAsAtString ( )
17
20
const employmentPeriode : string = buildEmploymentPeriodeString ( )
18
21
19
22
return (
20
23
< >
24
+ { printService . insertNewPageInPrintByProps ( props , 1 , ApplicationLanguage . DANISH ) }
25
+ { printService . insertNewPageInPrintByProps ( props , 1 , ApplicationLanguage . ENGLISH ) }
21
26
< Paper elevation = { 1 } sx = { { padding : '5px' , margin : '5px' } } >
22
27
< Typography color = { 'Highlight' } >
23
28
{ employedAsAt }
@@ -73,12 +78,4 @@ export function Employment(props: EmploymentProps): JSX.Element {
73
78
function getLocalizedDate ( date : Date ) : string {
74
79
return date . toLocaleDateString ( localizationService . getCurrentLanguage ( ) , { dateStyle : "medium" } )
75
80
}
76
-
77
- function insertNewPageInPrint ( employerKey : EntityEmploymentLocalizationKeys , language : ApplicationLanguage ) : ReactNode {
78
- if ( props . employmentEntity . employerKey === employerKey && localizationService . getCurrentLanguage ( ) === language ) {
79
- return ( < PageBreak /> )
80
- }
81
-
82
- return ( < > </ > )
83
- }
84
81
}
0 commit comments