Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikmork committed Jan 6, 2025
2 parents 09bcd49 + b06ba5b commit 9671567
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.4.0</version>
<version>3.4.1</version>
</parent>

<properties>
Expand All @@ -20,10 +20,10 @@
<sha1/>
<changelist>-SNAPSHOT</changelist>
<kotlin.version>2.1.0</kotlin.version>
<springdoc.version>2.7.0</springdoc.version>
<jupiter.version>5.11.3</jupiter.version>
<mockk.version>1.13.13</mockk.version>
<felles.version>3.20241127123724_adfc561</felles.version>
<springdoc.version>2.8.0</springdoc.version>
<jupiter.version>5.11.4</jupiter.version>
<mockk.version>1.13.14</mockk.version>
<felles.version>3.20250106100611_6ae49d2</felles.version>
<token-validation.version>5.0.13</token-validation.version>
<start-class>no.nav.familie.pdf.ApplicationKt</start-class>
<itext.version>9.0.0</itext.version>
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/no/nav/familie/pdf/pdf/PdfController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("api/pdf")
@RequestMapping("api/v1/pdf")
@ProtectedWithClaims(
issuer = "azuread",
)
Expand Down
27 changes: 21 additions & 6 deletions src/main/kotlin/no/nav/familie/pdf/pdf/PdfElementUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ object PdfElementUtils {
tabell.caption = captionDiv
tabell.addCell(lagTabellOverskriftscelle("Spørsmål"))
tabell.addCell(lagTabellOverskriftscelle("Svar", false))
lagTabellRekursivt(tabell, tabellData.verdiliste)
lagTabellRekursivt(tabellData.verdiliste, tabell)
return tabell
}

Expand All @@ -163,18 +163,33 @@ object PdfElementUtils {
}

private fun lagTabellRekursivt(
tabell: Table,
tabellData: kotlin.collections.List<VerdilisteElement>,
) {
tabell: Table,
harMørkBakgrunn: Boolean = false,
): Boolean {
var mørkBakgrunn = harMørkBakgrunn
tabellData.forEach { element ->
when {
element.verdi != null -> {
tabell.addCell(lagTabellInformasjonscelle(element.label, erUthevet = true))
tabell.addCell(lagTabellInformasjonscelle(element.verdi, erVenstreKolonne = false))
val labelCelle = lagTabellInformasjonscelle(element.label, erUthevet = true)
val verdiCelle = lagTabellInformasjonscelle(element.verdi, false)

if (mørkBakgrunn) {
labelCelle.apply { setBackgroundColor(DeviceRgb(204, 225, 255)) }
verdiCelle.apply { setBackgroundColor(DeviceRgb(204, 225, 255)) }
}
tabell.addCell(labelCelle)
tabell.addCell(verdiCelle)

mørkBakgrunn = !mørkBakgrunn
}

element.verdiliste != null -> {
mørkBakgrunn = lagTabellRekursivt(element.verdiliste, tabell, mørkBakgrunn)
}
element.verdiliste != null -> lagTabellRekursivt(tabell, element.verdiliste)
}
}
return mørkBakgrunn
}

private fun lagTabellInformasjonscelle(
Expand Down

0 comments on commit 9671567

Please sign in to comment.