diff --git a/android-app/app/src/main/java/com/korexlabs/dhinspeccion/ui/ModernMobileActsScreen.kt b/android-app/app/src/main/java/com/korexlabs/dhinspeccion/ui/ModernMobileActsScreen.kt index 50020ce..2c0e5b8 100644 --- a/android-app/app/src/main/java/com/korexlabs/dhinspeccion/ui/ModernMobileActsScreen.kt +++ b/android-app/app/src/main/java/com/korexlabs/dhinspeccion/ui/ModernMobileActsScreen.kt @@ -245,7 +245,7 @@ fun ModernMobileActsScreen( ) { Text( if (newActUrgency == "URGENT") { - "El plazo urgente se computará desde el Acta conforme a la política institucional vigente al bloquearla." + "El plazo urgente se computará conforme a la política institucional vigente al cerrar el contenido del Acta." } else { "El plazo no urgente comienza con la oficialización GEDO, no al crear el Acta." }, @@ -319,12 +319,16 @@ fun ModernMobileActsScreen( OutlinedTextField(fullName, { fullName = it }, label = { Text("Nombre y apellido *") }, modifier = Modifier.fillMaxWidth(), singleLine = true) Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(6.dp)) { listOf("DNI", "CUIL", "PASSPORT", "OTHER").forEach { kind -> - FilterChip(selected = documentType == kind, onClick = { documentType = kind }, label = { Text(kind) }) + FilterChip( + selected = documentType == kind, + onClick = { documentType = kind }, + label = { Text(documentTypeLabel(kind)) }, + ) } } OutlinedTextField(documentNumber, { documentNumber = it }, label = { Text("Documento *") }, modifier = Modifier.fillMaxWidth(), singleLine = true) OutlinedTextField(position, { position = it }, label = { Text("Cargo *") }, modifier = Modifier.fillMaxWidth(), singleLine = true) - OutlinedTextField(email, { email = it }, label = { Text("Email") }, modifier = Modifier.fillMaxWidth(), singleLine = true) + OutlinedTextField(email, { email = it }, label = { Text("Correo electrónico") }, modifier = Modifier.fillMaxWidth(), singleLine = true) OutlinedTextField(phone, { phone = it }, label = { Text("Teléfono") }, modifier = Modifier.fillMaxWidth(), singleLine = true) Button( onClick = { model.setCompanyResponsiblePresent(fullName, documentType, documentNumber, position, email, phone) }, @@ -353,17 +357,24 @@ fun ModernMobileActsScreen( Row(verticalAlignment = Alignment.CenterVertically) { Icon(Icons.Filled.Lock, null, tint = MaterialTheme.colorScheme.error) Spacer(Modifier.width(8.dp)) - Text("Finalizar contenido", style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.Bold) + Text("Cerrar Acta", style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.Bold) } Text( - "Al bloquear el Acta, su contenido y sus Hallazgos quedan inmutables.", + "Al cerrar el Acta, su contenido y sus Hallazgos quedan inmutables. El Acta quedará pendiente de firma.", color = MaterialTheme.colorScheme.onSurfaceVariant, ) Button( onClick = { model.prepareSelectedAct() }, enabled = !model.busy && closure?.responsible != null, modifier = Modifier.fillMaxWidth(), - ) { Text("Finalizar y BLOQUEAR Acta") } + ) { Text("Cerrar Acta y dejar pendiente de firma") } + if (closure?.responsible == null) { + Text( + "Antes de cerrar, registrá al responsable de la empresa o su ausencia.", + style = MaterialTheme.typography.bodySmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + ) + } } } } @@ -379,10 +390,10 @@ fun ModernMobileActsScreen( Row(verticalAlignment = Alignment.CenterVertically) { Icon(Icons.Filled.Lock, null, tint = MaterialTheme.colorScheme.secondary) Spacer(Modifier.width(8.dp)) - Text("Acta BLOQUEADA", 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. Restan firmas y manifestaciones para poder sellarla.") - closure?.closure?.preparedSha256?.let { Text("Hash · $it", style = MaterialTheme.typography.bodySmall) } + Text("El contenido ya es inmutable. Completá las firmas o dejá asentada la imposibilidad de firma para finalizarla.") + closure?.closure?.preparedSha256?.let { Text("SHA-256 de cierre · $it", style = MaterialTheme.typography.bodySmall) } HorizontalDivider() Text("Firma del inspector", fontWeight = FontWeight.Bold) @@ -402,8 +413,8 @@ fun ModernMobileActsScreen( if (companyOutcome != null && companyResolved) { val detail = when (companyOutcome.status) { "SIGNED" -> if (companyOutcome.companyManifestation == "DISSENT") "Firma en disidencia" else "Firma en conformidad" - "REFUSED" -> "Negativa a firmar" - else -> companyOutcome.status + "REFUSED" -> "Negativa o imposibilidad de firma registrada" + else -> "Manifestación registrada" } SuccessLine(detail) companyOutcome.reason?.let { Text(it, style = MaterialTheme.typography.bodySmall) } @@ -413,12 +424,24 @@ fun ModernMobileActsScreen( Row(Modifier.padding(12.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) { Icon(Icons.Filled.ErrorOutline, null, tint = MaterialTheme.colorScheme.error) Text( - "La ausencia no resuelve la manifestación. Debe registrarse firma o negativa antes de sellar.", + "El responsable fue registrado como ausente. Dejá asentado el motivo para resolver la firma de la empresa.", Modifier.weight(1f), style = MaterialTheme.typography.bodySmall, ) } } + OutlinedTextField( + refusalReason, + { refusalReason = it }, + label = { Text("Motivo de imposibilidad de firma *") }, + minLines = 2, + modifier = Modifier.fillMaxWidth(), + ) + OutlinedButton( + onClick = { model.recordCompanyOutcome("REFUSED", refusalReason) }, + enabled = !model.busy && inspectorSigned && refusalReason.trim().length >= 10, + modifier = Modifier.fillMaxWidth(), + ) { Text("Registrar imposibilidad de firma") } } else { Text(closure?.consents?.company.orEmpty(), style = MaterialTheme.typography.bodySmall) Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) { @@ -462,11 +485,11 @@ fun ModernMobileActsScreen( ) { Icon(Icons.Filled.CheckCircle, null) Spacer(Modifier.width(6.dp)) - Text("SELLAR Acta definitivamente") + Text("Finalizar Acta firmada") } } else { Text( - "La Inspección no puede cerrarse hasta completar las manifestaciones de esta Acta.", + "La inspección no puede cerrarse hasta resolver las firmas de esta Acta.", style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant, ) @@ -480,9 +503,9 @@ fun ModernMobileActsScreen( Row(Modifier.padding(18.dp), horizontalArrangement = Arrangement.spacedBy(10.dp), verticalAlignment = Alignment.Top) { Icon(Icons.Filled.CheckCircle, null, tint = MaterialTheme.colorScheme.primary) Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(5.dp)) { - Text("Acta SELLADA e inmutable", fontWeight = FontWeight.Bold) - Text("Desde este sellado se genera el PDF del Acta y el INF Word editable para el Inspector.") - closure?.closure?.finalSha256?.let { Text("SHA-256 · $it", style = MaterialTheme.typography.bodySmall) } + Text("Acta firmada e inmutable", fontWeight = FontWeight.Bold) + 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) } } } } @@ -501,12 +524,12 @@ fun ModernMobileActsScreen( val pendingActs = activeActs.filter { it.status != "SEALED" } ElevatedCard(Modifier.fillMaxWidth()) { 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()) { - SuccessLine("Todas las Actas están SELLADAS") + SuccessLine("Todas las Actas están firmadas y finalizadas") } else { Text( - "Falta SELLAR: ${pendingActs.joinToString { it.code }}", + "Actas pendientes de firma o finalización: ${pendingActs.joinToString { it.code }}", style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.error, ) @@ -515,7 +538,7 @@ fun ModernMobileActsScreen( onClick = { model.closeInspection() }, enabled = !model.busy && activeActs.isNotEmpty() && pendingActs.isEmpty(), modifier = Modifier.fillMaxWidth(), - ) { Text("Cerrar Inspección y salir") } + ) { Text("Cerrar inspección y salir") } } } } @@ -531,12 +554,20 @@ private fun SuccessLine(text: String) { } } +private fun documentTypeLabel(kind: String): String = when (kind) { + "DNI" -> "DNI" + "CUIL" -> "CUIL" + "PASSPORT" -> "Pasaporte" + "OTHER" -> "Otro" + else -> "Otro" +} + private fun modernActStatusLabel(status: String): String = when (status) { "DRAFT" -> "Borrador" - "LOCKED" -> "Bloqueada" - "SEALED" -> "Sellada" + "LOCKED" -> "Pendiente de firma" + "SEALED" -> "Firmada" "CANCELLED" -> "Cancelada" - else -> status + else -> "Estado no reconocido" } private fun hasModernActLocation(context: Context): Boolean =