fix(android): alinear alta de campo y cierre pendiente de firma
This commit is contained in:
@@ -161,7 +161,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
|||||||
val currentVisit = visit ?: return
|
val currentVisit = visit ?: return
|
||||||
val asset = selectedFieldAsset?.asset
|
val asset = selectedFieldAsset?.asset
|
||||||
if (currentVisit.status != "IN_PROGRESS") {
|
if (currentVisit.status != "IN_PROGRESS") {
|
||||||
error = "La Inspección debe estar en curso para crear un Acta."
|
error = "La inspección debe estar en curso para crear un Acta."
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (urgency !in setOf("URGENT", "NON_URGENT")) {
|
if (urgency !in setOf("URGENT", "NON_URGENT")) {
|
||||||
@@ -169,7 +169,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (acts.any { it.status == "DRAFT" }) {
|
if (acts.any { it.status == "DRAFT" }) {
|
||||||
error = "Ya existe un Acta en borrador. Bloqueala o cancelala antes de crear la siguiente."
|
error = "Ya existe un Acta en borrador. Cerrala y resolvé sus firmas antes de crear la siguiente."
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
launchBusy {
|
launchBusy {
|
||||||
@@ -218,7 +218,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
|||||||
val visitId = visit?.id ?: return
|
val visitId = visit?.id ?: return
|
||||||
launchBusy {
|
launchBusy {
|
||||||
selectedFieldAsset = repository.selectFieldAsset(visitId, item.id)
|
selectedFieldAsset = repository.selectFieldAsset(visitId, item.id)
|
||||||
notice = "Inventario agregado a la Inspección."
|
notice = "Inventario agregado a la inspección."
|
||||||
reloadCurrentInventory(visitId)
|
reloadCurrentInventory(visitId)
|
||||||
val draft = selectedDraftAct()
|
val draft = selectedDraftAct()
|
||||||
if (selectedFieldAsset?.capture?.readyForFinding == true && draft != null) {
|
if (selectedFieldAsset?.capture?.readyForFinding == true && draft != null) {
|
||||||
@@ -237,6 +237,8 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
|||||||
familyId: String?,
|
familyId: String?,
|
||||||
name: String,
|
name: String,
|
||||||
commonName: String?,
|
commonName: String?,
|
||||||
|
description: String?,
|
||||||
|
discoveryNotes: String?,
|
||||||
attributes: Map<String, Any?>,
|
attributes: Map<String, Any?>,
|
||||||
latitude: Double,
|
latitude: Double,
|
||||||
longitude: Double,
|
longitude: Double,
|
||||||
@@ -244,7 +246,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
|||||||
) {
|
) {
|
||||||
val visitId = visit?.id ?: return
|
val visitId = visit?.id ?: return
|
||||||
if (visit?.status != "IN_PROGRESS") {
|
if (visit?.status != "IN_PROGRESS") {
|
||||||
error = "La Inspección debe estar en curso para dar de alta Inventario."
|
error = "La inspección debe estar en curso para dar de alta Inventario."
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (type.familyRequired && familyId == null) {
|
if (type.familyRequired && familyId == null) {
|
||||||
@@ -258,6 +260,8 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
|||||||
familyId = familyId,
|
familyId = familyId,
|
||||||
name = name.trim(),
|
name = name.trim(),
|
||||||
commonName = commonName?.trim()?.takeIf { it.isNotBlank() },
|
commonName = commonName?.trim()?.takeIf { it.isNotBlank() },
|
||||||
|
description = description?.trim()?.takeIf { it.isNotBlank() },
|
||||||
|
discoveryNotes = discoveryNotes?.trim()?.takeIf { it.isNotBlank() },
|
||||||
attributes = attributes,
|
attributes = attributes,
|
||||||
deviceLatitude = latitude,
|
deviceLatitude = latitude,
|
||||||
deviceLongitude = longitude,
|
deviceLongitude = longitude,
|
||||||
@@ -265,7 +269,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
|||||||
deviceCapturedAt = Instant.now().toString(),
|
deviceCapturedAt = Instant.now().toString(),
|
||||||
)
|
)
|
||||||
selectedFieldAsset = repository.createFieldAsset(visitId, request)
|
selectedFieldAsset = repository.createFieldAsset(visitId, request)
|
||||||
notice = "Inventario creado con GPS. Falta la fotografía obligatoria. Si ya existía, podés fusionarlo antes de continuar."
|
notice = "Inventario creado con ubicación. Falta la fotografía obligatoria. Si ya existía, podés fusionarlo antes de continuar."
|
||||||
reloadCurrentInventory(visitId)
|
reloadCurrentInventory(visitId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -319,7 +323,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
|||||||
)
|
)
|
||||||
selectedFieldAsset = selectedFieldAsset?.copy(capture = response.capture)
|
selectedFieldAsset = selectedFieldAsset?.copy(capture = response.capture)
|
||||||
notice = if (response.capture.readyForFinding) {
|
notice = if (response.capture.readyForFinding) {
|
||||||
"Captura completa: GPS y fotografía registrados."
|
"Captura completa: ubicación y fotografía registradas."
|
||||||
} else {
|
} else {
|
||||||
"Fotografía registrada."
|
"Fotografía registrada."
|
||||||
}
|
}
|
||||||
@@ -419,7 +423,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
|||||||
description = description,
|
description = description,
|
||||||
)
|
)
|
||||||
loadEvidenceInternal(findingId)
|
loadEvidenceInternal(findingId)
|
||||||
notice = "Evidencia fotográfica registrada con GPS."
|
notice = "Evidencia fotográfica registrada con ubicación."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -471,7 +475,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
|||||||
absenceReason = reason.trim(),
|
absenceReason = reason.trim(),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
notice = "Ausencia del responsable registrada. La manifestación de empresa quedará pendiente y deberá resolverse antes de sellar el Acta."
|
notice = "Ausencia del responsable registrada. La firma de empresa deberá resolverse antes de finalizar el Acta."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -480,12 +484,12 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
|||||||
launchBusy {
|
launchBusy {
|
||||||
actClosure = actsRepository.lock(actId)
|
actClosure = actsRepository.lock(actId)
|
||||||
refreshSelectedActInternal(actId)
|
refreshSelectedActInternal(actId)
|
||||||
notice = "Acta bloqueada. Su contenido quedó inmutable; ahora deben resolverse las firmas y manifestaciones."
|
notice = "Acta cerrada y pendiente de firma. El contenido y los Hallazgos quedaron inmutables."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun reopenSelectedAct() {
|
fun reopenSelectedAct() {
|
||||||
error = "Un Acta bloqueada es inmutable y no puede volver a borrador."
|
error = "Un Acta cerrada y pendiente de firma es inmutable y no puede volver a borrador."
|
||||||
}
|
}
|
||||||
|
|
||||||
fun signSelectedActAsInspector(
|
fun signSelectedActAsInspector(
|
||||||
@@ -534,7 +538,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
|||||||
}
|
}
|
||||||
launchBusy {
|
launchBusy {
|
||||||
actClosure = actsRepository.companyOutcome(actId, status, reason)
|
actClosure = actsRepository.companyOutcome(actId, status, reason)
|
||||||
notice = "Negativa a firmar asentada."
|
notice = "Negativa o imposibilidad de firma asentada."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -546,7 +550,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
|||||||
refreshSelectedActInternal(actId)
|
refreshSelectedActInternal(actId)
|
||||||
loadActsInternal(currentVisit.id, selectDraft = false)
|
loadActsInternal(currentVisit.id, selectDraft = false)
|
||||||
clearFindingState()
|
clearFindingState()
|
||||||
notice = "${selectedAct?.code ?: "Acta"} SELLADA e inmutable. Podés crear otra Acta o continuar hacia el cierre de la Inspección."
|
notice = "${selectedAct?.code ?: "Acta"} firmada, finalizada e inmutable. Podés crear otra Acta o continuar hacia el cierre de la inspección."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -555,7 +559,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
|||||||
launchBusy {
|
launchBusy {
|
||||||
visit = actsRepository.closeVisit(visitId)
|
visit = actsRepository.closeVisit(visitId)
|
||||||
loadVisitsInternal()
|
loadVisitsInternal()
|
||||||
notice = "Inspección cerrada. Todas sus Actas quedaron SELLADAS y disponibles para el circuito de oficina."
|
notice = "Inspección cerrada. Todas sus Actas quedaron firmadas y disponibles para el circuito de oficina."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user