fix(android): cerrar ausencia de firma con outcome ABSENT

This commit is contained in:
2026-09-11 11:50:35 -03:00
parent 01bd7c8454
commit 726768bb78
@@ -383,7 +383,7 @@ fun ModernMobileActsScreen(
val signatures = closure?.signatures.orEmpty() val signatures = closure?.signatures.orEmpty()
val inspectorSigned = signatures.any { it.signerType == "INSPECTOR" && it.status == "SIGNED" } val inspectorSigned = signatures.any { it.signerType == "INSPECTOR" && it.status == "SIGNED" }
val companyOutcome = signatures.firstOrNull { it.signerType == "COMPANY_RESPONSIBLE" } val companyOutcome = signatures.firstOrNull { it.signerType == "COMPANY_RESPONSIBLE" }
val companyResolved = companyOutcome?.status == "SIGNED" || companyOutcome?.status == "REFUSED" val companyResolved = companyOutcome?.status in setOf("SIGNED", "REFUSED", "ABSENT")
ElevatedCard(Modifier.fillMaxWidth()) { ElevatedCard(Modifier.fillMaxWidth()) {
Column(Modifier.padding(18.dp), verticalArrangement = Arrangement.spacedBy(12.dp)) { Column(Modifier.padding(18.dp), verticalArrangement = Arrangement.spacedBy(12.dp)) {
@@ -392,7 +392,7 @@ fun ModernMobileActsScreen(
Spacer(Modifier.width(8.dp)) Spacer(Modifier.width(8.dp))
Text("Acta pendiente de firma", style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.Bold) Text("Acta pendiente de firma", style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.Bold)
} }
Text("El contenido ya es inmutable. Completá las firmas o dejá asentada la imposibilidad de firma para finalizarla.") Text("El contenido ya es inmutable. Completá las firmas o dejá asentada la ausencia/negativa correspondiente para finalizarla.")
closure?.closure?.preparedSha256?.let { Text("SHA-256 de cierre · $it", style = MaterialTheme.typography.bodySmall) } closure?.closure?.preparedSha256?.let { Text("SHA-256 de cierre · $it", style = MaterialTheme.typography.bodySmall) }
HorizontalDivider() HorizontalDivider()
@@ -413,35 +413,29 @@ fun ModernMobileActsScreen(
if (companyOutcome != null && companyResolved) { if (companyOutcome != null && companyResolved) {
val detail = when (companyOutcome.status) { val detail = when (companyOutcome.status) {
"SIGNED" -> if (companyOutcome.companyManifestation == "DISSENT") "Firma en disidencia" else "Firma en conformidad" "SIGNED" -> if (companyOutcome.companyManifestation == "DISSENT") "Firma en disidencia" else "Firma en conformidad"
"REFUSED" -> "Negativa o imposibilidad de firma registrada" "REFUSED" -> "Negativa a firmar registrada"
"ABSENT" -> "Ausencia para la firma registrada"
else -> "Manifestación registrada" else -> "Manifestación registrada"
} }
SuccessLine(detail) SuccessLine(detail)
companyOutcome.reason?.let { Text(it, style = MaterialTheme.typography.bodySmall) } companyOutcome.reason?.let { Text(it, style = MaterialTheme.typography.bodySmall) }
companyOutcome.companyStatement?.let { Text(it, style = MaterialTheme.typography.bodySmall) } companyOutcome.companyStatement?.let { Text(it, style = MaterialTheme.typography.bodySmall) }
} else if (closure?.responsible?.attendanceStatus == "ABSENT") { } else if (closure?.responsible?.attendanceStatus == "ABSENT") {
Surface(Modifier.fillMaxWidth(), shape = MaterialTheme.shapes.medium, color = MaterialTheme.colorScheme.errorContainer) { val savedAbsenceReason = closure.responsible.absenceReason.orEmpty()
Surface(Modifier.fillMaxWidth(), shape = MaterialTheme.shapes.medium, color = MaterialTheme.colorScheme.secondaryContainer) {
Row(Modifier.padding(12.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) { Row(Modifier.padding(12.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
Icon(Icons.Filled.ErrorOutline, null, tint = MaterialTheme.colorScheme.error) Icon(Icons.Filled.ErrorOutline, null, tint = MaterialTheme.colorScheme.secondary)
Text( Column(Modifier.weight(1f)) {
"El responsable fue registrado como ausente. Dejá asentado el motivo para resolver la firma de la empresa.", Text("El responsable fue registrado como ausente.", fontWeight = FontWeight.SemiBold)
Modifier.weight(1f), if (savedAbsenceReason.isNotBlank()) Text(savedAbsenceReason, style = MaterialTheme.typography.bodySmall)
style = MaterialTheme.typography.bodySmall, }
)
} }
} }
OutlinedTextField(
refusalReason,
{ refusalReason = it },
label = { Text("Motivo de imposibilidad de firma *") },
minLines = 2,
modifier = Modifier.fillMaxWidth(),
)
OutlinedButton( OutlinedButton(
onClick = { model.recordCompanyOutcome("REFUSED", refusalReason) }, onClick = { model.recordCompanyOutcome("ABSENT", savedAbsenceReason) },
enabled = !model.busy && inspectorSigned && refusalReason.trim().length >= 10, enabled = !model.busy && inspectorSigned && savedAbsenceReason.trim().length >= 10,
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
) { Text("Registrar imposibilidad de firma") } ) { Text("Registrar ausencia para la firma") }
} else { } else {
Text(closure?.consents?.company.orEmpty(), style = MaterialTheme.typography.bodySmall) Text(closure?.consents?.company.orEmpty(), style = MaterialTheme.typography.bodySmall)
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) { Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
@@ -485,11 +479,11 @@ fun ModernMobileActsScreen(
) { ) {
Icon(Icons.Filled.CheckCircle, null) Icon(Icons.Filled.CheckCircle, null)
Spacer(Modifier.width(6.dp)) Spacer(Modifier.width(6.dp))
Text("Finalizar Acta firmada") Text("Finalizar Acta")
} }
} else { } else {
Text( Text(
"La inspección no puede cerrarse hasta resolver las firmas de esta Acta.", "La inspección no puede cerrarse hasta resolver la firma, negativa o ausencia de esta Acta.",
style = MaterialTheme.typography.bodySmall, style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant, color = MaterialTheme.colorScheme.onSurfaceVariant,
) )
@@ -503,7 +497,7 @@ fun ModernMobileActsScreen(
Row(Modifier.padding(18.dp), horizontalArrangement = Arrangement.spacedBy(10.dp), verticalAlignment = Alignment.Top) { Row(Modifier.padding(18.dp), horizontalArrangement = Arrangement.spacedBy(10.dp), verticalAlignment = Alignment.Top) {
Icon(Icons.Filled.CheckCircle, null, tint = MaterialTheme.colorScheme.primary) Icon(Icons.Filled.CheckCircle, null, tint = MaterialTheme.colorScheme.primary)
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(5.dp)) { Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(5.dp)) {
Text("Acta firmada e inmutable", fontWeight = FontWeight.Bold) Text("Acta finalizada e inmutable", fontWeight = FontWeight.Bold)
Text("Al finalizar se genera el PDF del Acta y el archivo INF editable para el Inspector.") Text("Al finalizar se genera el PDF del Acta y el archivo INF editable para el Inspector.")
closure?.closure?.finalSha256?.let { Text("SHA-256 final · $it", style = MaterialTheme.typography.bodySmall) } closure?.closure?.finalSha256?.let { Text("SHA-256 final · $it", style = MaterialTheme.typography.bodySmall) }
} }
@@ -526,7 +520,7 @@ fun ModernMobileActsScreen(
Column(Modifier.padding(18.dp), verticalArrangement = Arrangement.spacedBy(9.dp)) { Column(Modifier.padding(18.dp), verticalArrangement = Arrangement.spacedBy(9.dp)) {
Text("Finalizar inspección", style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.Bold) Text("Finalizar inspección", style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.Bold)
if (pendingActs.isEmpty()) { if (pendingActs.isEmpty()) {
SuccessLine("Todas las Actas están firmadas y finalizadas") SuccessLine("Todas las Actas están finalizadas")
} else { } else {
Text( Text(
"Actas pendientes de firma o finalización: ${pendingActs.joinToString { it.code }}", "Actas pendientes de firma o finalización: ${pendingActs.joinToString { it.code }}",
@@ -565,7 +559,7 @@ private fun documentTypeLabel(kind: String): String = when (kind) {
private fun modernActStatusLabel(status: String): String = when (status) { private fun modernActStatusLabel(status: String): String = when (status) {
"DRAFT" -> "Borrador" "DRAFT" -> "Borrador"
"LOCKED" -> "Pendiente de firma" "LOCKED" -> "Pendiente de firma"
"SEALED" -> "Firmada" "SEALED" -> "Finalizada"
"CANCELLED" -> "Cancelada" "CANCELLED" -> "Cancelada"
else -> "Estado no reconocido" else -> "Estado no reconocido"
} }