Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
802393962e | ||
|
|
ac31308443 |
@@ -34,8 +34,8 @@ android {
|
||||
applicationId = "pl.firmatpp.kierowca"
|
||||
minSdk = 26
|
||||
targetSdk = 36
|
||||
versionCode = 127
|
||||
versionName = "1.0.74"
|
||||
versionCode = 128
|
||||
versionName = "1.0.75"
|
||||
setProperty("archivesBaseName", "pl.firmatpp.kierowca")
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
|
||||
@@ -88,6 +88,13 @@ data class DriverAppSettingsDto(
|
||||
data class LeaveRequestsConfigDto(
|
||||
val enabled: Boolean = false,
|
||||
val types: List<String> = listOf("URLOP"),
|
||||
val usagePoolCodes: List<String> = listOf(
|
||||
"ANNUAL",
|
||||
"ANNUAL_DISABILITY",
|
||||
"FORCE_MAJEURE",
|
||||
"CHILD_CARE_14",
|
||||
"CARE_LEAVE",
|
||||
),
|
||||
)
|
||||
|
||||
data class DispatchSheetReminderDto(
|
||||
@@ -252,6 +259,13 @@ data class DriverLeaveSummaryDto(
|
||||
val dailyNormMinutes: Int = 480,
|
||||
val balanceConfigured: Boolean = false,
|
||||
val overdueQuantity: Int = 0,
|
||||
val visibleUsagePoolCodes: List<String> = listOf(
|
||||
"ANNUAL",
|
||||
"ANNUAL_DISABILITY",
|
||||
"FORCE_MAJEURE",
|
||||
"CHILD_CARE_14",
|
||||
"CARE_LEAVE",
|
||||
),
|
||||
val availableTypes: List<LeaveRequestTypeDto> = emptyList(),
|
||||
val reminders: List<DriverLeaveReminderDto> = emptyList(),
|
||||
)
|
||||
|
||||
@@ -1547,6 +1547,12 @@ private fun LeaveBalanceOverview(state: DriverUiState) {
|
||||
val summary = state.leaveSummary
|
||||
val totals = DriverLeaveRequestUiRules.annualTotals(summary)
|
||||
val norm = summary?.dailyNormMinutes ?: 480
|
||||
val showAnnualUsage = DriverLeaveRequestUiRules.isUsageVisible(summary, "ANNUAL")
|
||||
val otherPools = DriverLeaveRequestUiRules.otherEntitlementPools(summary)
|
||||
|
||||
if (summary != null && !showAnnualUsage && otherPools.isEmpty()) {
|
||||
return
|
||||
}
|
||||
|
||||
Card(
|
||||
colors = CardDefaults.cardColors(containerColor = TppTheme.colors.card),
|
||||
@@ -1555,8 +1561,14 @@ private fun LeaveBalanceOverview(state: DriverUiState) {
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
) {
|
||||
Column(Modifier.padding(18.dp), verticalArrangement = Arrangement.spacedBy(14.dp)) {
|
||||
Text("Twój urlop wypoczynkowy", color = TppTheme.colors.ink, fontWeight = FontWeight.Bold, fontSize = 20.sp)
|
||||
Text(
|
||||
if (showAnnualUsage) "Twój urlop wypoczynkowy" else "Twoje limity nieobecności",
|
||||
color = TppTheme.colors.ink,
|
||||
fontWeight = FontWeight.Bold,
|
||||
fontSize = 20.sp,
|
||||
)
|
||||
|
||||
if (showAnnualUsage) {
|
||||
when {
|
||||
summary == null -> {
|
||||
Text("Pobieramy aktualne saldo…", color = TppTheme.colors.muted)
|
||||
@@ -1638,9 +1650,10 @@ private fun LeaveBalanceOverview(state: DriverUiState) {
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val otherPools = DriverLeaveRequestUiRules.otherEntitlementPools(summary)
|
||||
if (otherPools.isNotEmpty()) {
|
||||
if (showAnnualUsage) {
|
||||
HorizontalDivider(color = TppTheme.colors.outline)
|
||||
Text(
|
||||
"Pozostałe dostępne limity",
|
||||
@@ -1648,6 +1661,7 @@ private fun LeaveBalanceOverview(state: DriverUiState) {
|
||||
fontWeight = FontWeight.Bold,
|
||||
fontSize = 17.sp,
|
||||
)
|
||||
}
|
||||
Text(
|
||||
"Te limity są rozliczane osobno i nie zmniejszają zwykłego urlopu wypoczynkowego.",
|
||||
color = TppTheme.colors.muted,
|
||||
|
||||
@@ -106,6 +106,9 @@ object DriverLeaveRequestUiRules {
|
||||
.filter { it.poolCode == "ANNUAL" && it.status == "active" }
|
||||
.sortedByDescending { it.year }
|
||||
|
||||
fun isUsageVisible(summary: DriverLeaveSummaryDto?, poolCode: String): Boolean =
|
||||
summary?.visibleUsagePoolCodes?.contains(poolCode) ?: true
|
||||
|
||||
fun otherEntitlementPools(summary: DriverLeaveSummaryDto?): List<DriverLeavePoolDto> =
|
||||
summary?.pools.orEmpty()
|
||||
.filter { it.poolCode != "ANNUAL" && it.status == "active" }
|
||||
|
||||
@@ -19,6 +19,7 @@ class DriverLeaveApiContractTest {
|
||||
"dailyNormMinutes": 480,
|
||||
"balanceConfigured": true,
|
||||
"overdueQuantity": 480,
|
||||
"visibleUsagePoolCodes": ["ANNUAL", "CHILD_CARE_14"],
|
||||
"pools": [{
|
||||
"id": 7,
|
||||
"poolCode": "ANNUAL",
|
||||
@@ -49,6 +50,7 @@ class DriverLeaveApiContractTest {
|
||||
)
|
||||
|
||||
assertEquals(480, response.data.dailyNormMinutes)
|
||||
assertEquals(listOf("ANNUAL", "CHILD_CARE_14"), response.data.visibleUsagePoolCodes)
|
||||
assertEquals(7680, response.data.pools.single().availableQuantity)
|
||||
assertEquals("URLOP", response.data.availableTypes.single().value)
|
||||
assertEquals("ANNUAL", response.data.availableTypes.single().code)
|
||||
|
||||
@@ -124,6 +124,13 @@ class DriverLeaveRequestUiRulesTest {
|
||||
assertEquals(listOf("CHILD_CARE_14", "CARE_LEAVE"), pools.map { it.poolCode })
|
||||
assertEquals("Urlop opiekuńczy", DriverLeaveRequestUiRules.poolLabel("CARE_LEAVE"))
|
||||
assertEquals("Rodzina i opieka", DriverLeaveRequestUiRules.categoryLabel("family"))
|
||||
assertTrue(DriverLeaveRequestUiRules.isUsageVisible(summary, "ANNUAL"))
|
||||
assertFalse(
|
||||
DriverLeaveRequestUiRules.isUsageVisible(
|
||||
summary.copy(visibleUsagePoolCodes = emptyList()),
|
||||
"ANNUAL",
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user